diff --git a/src/commands/init.ts b/src/commands/admin/init.ts similarity index 93% rename from src/commands/init.ts rename to src/commands/admin/init.ts index 8aa17dc..42dc080 100644 --- a/src/commands/init.ts +++ b/src/commands/admin/init.ts @@ -1,8 +1,10 @@ import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime"; -import config from "../config"; +import config from "../../config"; + +// ---------- @SlashCommand( - new CommandBuilder('init', 'Event setup command.') + new CommandBuilder('init', 'Configure bot & settings.') .setIntegrationTypes(Constants.ApplicationIntegrationType.GuildInstall) .setContexts(Constants.InteractionContextType.Guild) .setCommandType(Constants.ApplicationCommandType.ChatInput) diff --git a/src/commands/admin/remove.ts b/src/commands/admin/remove.ts new file mode 100644 index 0000000..403a5f3 --- /dev/null +++ b/src/commands/admin/remove.ts @@ -0,0 +1,24 @@ +import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime"; +import { deleteUser } from "../../utils"; + +// ---------- + +@SlashCommand( + new CommandBuilder('remove', 'Remove a user from the database.') + .setIntegrationTypes(Constants.ApplicationIntegrationType.GuildInstall) + .setContexts(Constants.InteractionContextType.Guild) + .setCommandType(Constants.ApplicationCommandType.ChatInput) + .addUserOption('user', 'The user to remove.', true) +) +class RemoveCommand extends Command { + users = ['1363132678022631428']; + + async handleCommand(context: CommandClient, interaction: CommandInteraction) { + await interaction.defer(true); + + await deleteUser(interaction.getRequiredUser('user').id); + await interaction.createMessage({ content: `Successfully removed: ${interaction.user.mention} (*${interaction.user.username}*)`}); + } +} + +export default new RemoveCommand('remove'); diff --git a/src/commands/index.ts b/src/commands/index.ts index 51791d8..8cd5a6b 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,5 +1,9 @@ -import init from "./init"; -import optin from "./optin"; -import optout from "./optout"; +import init from "./admin/init"; +import remove from "./admin/remove"; +import optin from "./privacy/optin"; +import optout from "./privacy/optout"; +import profile from "./profile"; -export default [init, optin, optout]; +// ---------- + +export default [init, optin, optout, profile, remove]; diff --git a/src/commands/optin.ts b/src/commands/privacy/optin.ts similarity index 92% rename from src/commands/optin.ts rename to src/commands/privacy/optin.ts index 0be4f01..1dfb7b1 100644 --- a/src/commands/optin.ts +++ b/src/commands/privacy/optin.ts @@ -1,5 +1,7 @@ import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime"; -import { getUser, setUserPrivacy } from "../utils"; +import { getUser, setUserPrivacy } from "../../utils"; + +// ---------- @SlashCommand( new CommandBuilder('optin', 'Opt into the Pet the Pond event.') diff --git a/src/commands/optout.ts b/src/commands/privacy/optout.ts similarity index 92% rename from src/commands/optout.ts rename to src/commands/privacy/optout.ts index 46e0ca7..16bd197 100644 --- a/src/commands/optout.ts +++ b/src/commands/privacy/optout.ts @@ -1,5 +1,7 @@ import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime"; -import { getUser, setUserPrivacy } from "../utils"; +import { getUser, setUserPrivacy } from "../../utils"; + +// ---------- @SlashCommand( new CommandBuilder('optout', 'Opt out of the Pet the Pond event.') diff --git a/src/commands/profile.ts b/src/commands/profile.ts new file mode 100644 index 0000000..ba9b7d3 --- /dev/null +++ b/src/commands/profile.ts @@ -0,0 +1,46 @@ +import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime"; +import { getUser } from "../utils"; + +// ---------- + +@SlashCommand( + new CommandBuilder('profile', 'View your profile.') + .setIntegrationTypes(Constants.ApplicationIntegrationType.GuildInstall) + .setContexts(Constants.InteractionContextType.Guild) + .setCommandType(Constants.ApplicationCommandType.ChatInput) +) +class ProfileCommand extends Command { + cooldown = 5; + + async handleCommand(context: CommandClient, interaction: CommandInteraction) { + await interaction.defer(); + + const _user = await getUser(interaction.user.id); + + await interaction.createMessage({ + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL + }, + + color: 0xe77ed1, + + // TODO: Add Rankings. + title: `Pet the Pond | Your Profile`, + fields: [ + { name: 'Points', value: `${_user.xp.current}`, inline: true }, + { name: 'Rank', value: 'N/A', inline: true }, + { name: 'Participating', value: _user.privacy.optin ? 'Yes' : 'No', inline: false } + ], + + footer: { + text: `Made by nxbat @ Archwing`, + icon_url: 'https://femboytrain.ing/nxbat-archwing' + } + }] + }); + } +} + +export default new ProfileCommand('profile'); diff --git a/src/events/message/messageReactionAdd.ts b/src/events/message/messageReactionAdd.ts index 096b6ad..1fd9286 100644 --- a/src/events/message/messageReactionAdd.ts +++ b/src/events/message/messageReactionAdd.ts @@ -2,7 +2,7 @@ import { CommandClient, Constants, Event, Member, Message } from "athena-prime"; import config from '../../config'; import { getUser, setUserXp } from "../../utils"; -/// ---------- +// ---------- class MessageReactionAddEvent extends Event { event: string = 'messageReactionAdd' as const;