mirror of
https://github.com/nx-bat/pet-the-pond.git
synced 2026-09-22 10:29:11 -04:00
(commands): more commands.
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime";
|
import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime";
|
||||||
import config from "../config";
|
import config from "../../config";
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
|
||||||
@SlashCommand(
|
@SlashCommand(
|
||||||
new CommandBuilder('init', 'Event setup command.')
|
new CommandBuilder('init', 'Configure bot & settings.')
|
||||||
.setIntegrationTypes(Constants.ApplicationIntegrationType.GuildInstall)
|
.setIntegrationTypes(Constants.ApplicationIntegrationType.GuildInstall)
|
||||||
.setContexts(Constants.InteractionContextType.Guild)
|
.setContexts(Constants.InteractionContextType.Guild)
|
||||||
.setCommandType(Constants.ApplicationCommandType.ChatInput)
|
.setCommandType(Constants.ApplicationCommandType.ChatInput)
|
||||||
@@ -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<CommandClient> {
|
||||||
|
users = ['1363132678022631428'];
|
||||||
|
|
||||||
|
async handleCommand(context: CommandClient<any, any>, 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');
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
import init from "./init";
|
import init from "./admin/init";
|
||||||
import optin from "./optin";
|
import remove from "./admin/remove";
|
||||||
import optout from "./optout";
|
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];
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime";
|
import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime";
|
||||||
import { getUser, setUserPrivacy } from "../utils";
|
import { getUser, setUserPrivacy } from "../../utils";
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
|
||||||
@SlashCommand(
|
@SlashCommand(
|
||||||
new CommandBuilder('optin', 'Opt into the Pet the Pond event.')
|
new CommandBuilder('optin', 'Opt into the Pet the Pond event.')
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime";
|
import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from "athena-prime";
|
||||||
import { getUser, setUserPrivacy } from "../utils";
|
import { getUser, setUserPrivacy } from "../../utils";
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
|
||||||
@SlashCommand(
|
@SlashCommand(
|
||||||
new CommandBuilder('optout', 'Opt out of the Pet the Pond event.')
|
new CommandBuilder('optout', 'Opt out of the Pet the Pond event.')
|
||||||
@@ -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<CommandClient> {
|
||||||
|
cooldown = 5;
|
||||||
|
|
||||||
|
async handleCommand(context: CommandClient<any, any>, 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');
|
||||||
@@ -2,7 +2,7 @@ import { CommandClient, Constants, Event, Member, Message } from "athena-prime";
|
|||||||
import config from '../../config';
|
import config from '../../config';
|
||||||
import { getUser, setUserXp } from "../../utils";
|
import { getUser, setUserXp } from "../../utils";
|
||||||
|
|
||||||
/// ----------
|
// ----------
|
||||||
|
|
||||||
class MessageReactionAddEvent extends Event<CommandClient> {
|
class MessageReactionAddEvent extends Event<CommandClient> {
|
||||||
event: string = 'messageReactionAdd' as const;
|
event: string = 'messageReactionAdd' as const;
|
||||||
|
|||||||
Reference in New Issue
Block a user