diff --git a/.env.example b/.env.example deleted file mode 100644 index d64f24e..0000000 --- a/.env.example +++ /dev/null @@ -1,14 +0,0 @@ -# Tokens -DISCORD_TOKEN= # Bot token from: https://discord.com/developers/ - -# Configuration -DEFAULT_PREFIX= # Prefix used to run commands in Discord -DEVELOPMENT= # (true/false) Enables developer mode - -# Docker -POSTGRES_USER=USERNAME -POSTGRES_PASSWORD=PASSWORD -POSTGRES_DB=DB - -# Database URL (designed for Postgres, but designed on Prisma) -DATABASE_URL= # "postgresql://USERNAME:PASSWORD@postgres:5432/DB?schema=ara&sslmode=prefer" diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts new file mode 100644 index 0000000..b66f8c2 --- /dev/null +++ b/src/commands/fun/wave.ts @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +/* + Animal Rights Advocates Discord Bot + Copyright (C) 2022 Anthony Berg + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +import { Command, RegisterBehavior } from '@sapphire/framework'; +import { MessageEmbed } from 'discord.js'; +import { Wave } from '../../utils/gifs'; + +class WaveCommand extends Command { + public constructor(context: Command.Context, options: Command.Options) { + super(context, { + ...options, + name: 'wave', + description: 'Wave to a user', + preconditions: [['CoordinatorOnly', 'PatreonOnly']], + }); + } + + // Registers that this is a slash command + public override registerApplicationCommands(registry: Command.Registry) { + registry.registerChatInputCommand((builder) => builder + .setName(this.name) + .setDescription(this.description) + .addUserOption((option) => option + .setName('user') + .setDescription('User you want to wave to') + .setRequired(true)), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite }); + } + + // Command run + public async chatInputRun(interaction: Command.ChatInputInteraction) { + // Get the users + // TODO exception handling + const user = interaction.options.getUser('user')!; + const waver = interaction.member!.user; + const waverGuildMember = interaction.guild!.members.cache.get(waver.id)!; + + // Creates the embed for the wave + const randomWave = Wave[Math.floor(Math.random() * Wave.length)]; + const waveEmbed = new MessageEmbed() + .setColor('#0099ff') + .setTitle(`${waverGuildMember.displayName} waves at you, hello!`) + .setImage(randomWave); + + // Send the wave + await interaction.reply({ + content: `<@${user.id}>`, + embeds: [waveEmbed], + fetchReply: true, + }); + } +} + +export default WaveCommand; diff --git a/src/utils/gifs.ts b/src/utils/gifs.ts index 5b5f337..423c78a 100644 --- a/src/utils/gifs.ts +++ b/src/utils/gifs.ts @@ -68,3 +68,12 @@ export const N1984 = [ 'https://c.tenor.com/dcxOO-080OcAAAAd/discord-moderators.gif', 'https://c.tenor.com/-cUS-fPIEBsAAAAd/5second-slow-mode-1984.gif', ]; + +export const Wave = [ + 'https://c.tenor.com/Og0XNCa_vo8AAAAi/qoobee-hi.gif', + 'https://c.tenor.com/DcDYpWonGbIAAAAi/budding-pop-cute.gif', + 'https://c.tenor.com/PBG8IAgoXvQAAAAi/hello-waving-frog.gif', + 'https://c.tenor.com/q2d-2wQ4qxQAAAAC/hello.gif', + 'https://c.tenor.com/pqqlX7Ha8PcAAAAC/hello-bob.gif', + 'https://c.tenor.com/_CA1LzW9opoAAAAi/wumpus-wumpuswave.gif', +];