Implement Dynamic Presence #19

## Added Dynamic Presence to Functions
- Added default to startup
- Added to RSS manager
- Added to interaction create event
- Added to message create function

## Related Work #15
### LinkCop
- Updated with new regex string and logic approved and restricted channels
- Implemented new config storage
### Guild Member Add (event)
- Implemented new config storage for welcome channel
### Message Create (event)
- Implemented new config storage for ignored channel IDs
- Improved the logic for gpt interactions to reset presence
### Mongo Config Wrappers
- Updated logic in order to handle different data types the same way
- Updated set functions to wrap the value in the key
- Updated get functions to return the keyyed value ie `config[key]`
This commit is contained in:
Logan Cusano
2024-08-11 20:13:57 -04:00
parent d18ffd4c11
commit 94374b4d45
7 changed files with 73 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
import { DebugBuilder } from "../../modules/debugger.mjs";
const log = new DebugBuilder("server", "discordBot.events.interactionCreate");
import { Events } from "discord.js";
import PresenceManager from "../modules/presenceManager.mjs";
export const name = Events.InteractionCreate;
@@ -8,6 +9,10 @@ export async function execute(nodeIo, interaction) {
const command = interaction.client.commands.get(interaction.commandName);
log.INFO("Interaction created for command: ", command);
// Set the presence for handling interaction
const interactionPm = new PresenceManager(interaction.client);
await interactionPm.setPresence("online", "PLAYING", "handling interaction");
// Execute autocomplete if the user is checking autocomplete
if (interaction.isAutocomplete()) {
log.INFO("Running autocomplete for command: ", command.data.name);
@@ -33,4 +38,7 @@ export async function execute(nodeIo, interaction) {
// Execute the command
command.execute(nodeIo, interaction);
// Reset the presence
await interactionPm.resetToDefault();
}