From 6437405222a0449f74bfcc83101764d48356da3f Mon Sep 17 00:00:00 2001 From: leftyxiv Date: Sun, 28 Aug 2022 08:34:12 -0400 Subject: [PATCH 1/7] feat: add a new file for the wave command and gifs for the wave command too issue-37 --- .env.example | 14 --------- src/commands/fun/wave.ts | 67 ++++++++++++++++++++++++++++++++++++++++ src/utils/gifs.ts | 9 ++++++ 3 files changed, 76 insertions(+), 14 deletions(-) delete mode 100644 .env.example create mode 100644 src/commands/fun/wave.ts 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..62cb061 --- /dev/null +++ b/src/commands/fun/wave.ts @@ -0,0 +1,67 @@ +// 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'; + + export 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 }); + } + } diff --git a/src/utils/gifs.ts b/src/utils/gifs.ts index 5b5f337..ec83081 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' +]; From 8fb7ef4d4065ec1c71cf8b6089ef9d02f926fab4 Mon Sep 17 00:00:00 2001 From: leftyxiv Date: Sun, 28 Aug 2022 08:44:08 -0400 Subject: [PATCH 2/7] chore: format document --- src/commands/fun/wave.ts | 90 ++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts index 62cb061..efd709a 100644 --- a/src/commands/fun/wave.ts +++ b/src/commands/fun/wave.ts @@ -17,51 +17,59 @@ along with this program. If not, see . */ - import { Command, RegisterBehavior } from '@sapphire/framework'; - import { MessageEmbed } from 'discord.js'; - import { Wave } from '../../utils/gifs'; +import { Command, RegisterBehavior } from '@sapphire/framework'; +import { MessageEmbed } from 'discord.js'; +import { Wave } from '../../utils/gifs'; - export 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']], - }); - } +export 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') + // 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, - }, - ); + .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)!; + // 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); + // 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 }); - } - } + // Send the wave + await interaction.reply({ + content: `<@${user.id}>`, + embeds: [waveEmbed], + fetchReply: true, + }); + } +} From a9fc99e00fa92888cfc6f287195a7ddc9e8ecb16 Mon Sep 17 00:00:00 2001 From: leftyxiv Date: Sun, 28 Aug 2022 08:51:46 -0400 Subject: [PATCH 3/7] chore: trying to mae the linter happy issue-37 --- src/commands/fun/wave.ts | 12 +++--------- src/utils/gifs.ts | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts index efd709a..5baf585 100644 --- a/src/commands/fun/wave.ts +++ b/src/commands/fun/wave.ts @@ -34,20 +34,14 @@ export class WaveCommand extends Command { // Registers that this is a slash command public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand( - (builder) => - builder + (builder) => builder .setName(this.name) .setDescription(this.description) - .addUserOption((option) => - option + .addUserOption((option) => option .setName('user') .setDescription('User you want to wave to') .setRequired(true) - ), - { - behaviorWhenNotIdentical: RegisterBehavior.Overwrite, - } - ); + ), { behaviorWhenNotIdentical: RegisterBehavior.Overwrite }); } // Command run diff --git a/src/utils/gifs.ts b/src/utils/gifs.ts index ec83081..423c78a 100644 --- a/src/utils/gifs.ts +++ b/src/utils/gifs.ts @@ -75,5 +75,5 @@ export const Wave = [ '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' + 'https://c.tenor.com/_CA1LzW9opoAAAAi/wumpus-wumpuswave.gif', ]; From 94cdee0081912e15d40822bcd6b5d91941df147a Mon Sep 17 00:00:00 2001 From: leftyxiv Date: Sun, 28 Aug 2022 08:56:35 -0400 Subject: [PATCH 4/7] chore: this linter will be the death of me I need to find a script lol --- src/commands/fun/wave.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts index 5baf585..b41f88e 100644 --- a/src/commands/fun/wave.ts +++ b/src/commands/fun/wave.ts @@ -33,15 +33,14 @@ export class WaveCommand extends Command { // 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 }); + 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 From 1a6aad936844d099cc2c81d82165921659adb726 Mon Sep 17 00:00:00 2001 From: Manny Ledoux Date: Fri, 2 Sep 2022 03:37:35 -0400 Subject: [PATCH 5/7] fix: changed the export from a single export to a default export to sate the linter issue-37 --- src/commands/fun/wave.ts | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts index b41f88e..f30474f 100644 --- a/src/commands/fun/wave.ts +++ b/src/commands/fun/wave.ts @@ -17,44 +17,48 @@ along with this program. If not, see . */ -import { Command, RegisterBehavior } from '@sapphire/framework'; -import { MessageEmbed } from 'discord.js'; -import { Wave } from '../../utils/gifs'; +import { Command, RegisterBehavior } from "@sapphire/framework"; +import { MessageEmbed } from "discord.js"; +import { Wave } from "../../utils/gifs"; -export class WaveCommand extends Command { +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']], + 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 }); + 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 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') + .setColor("#0099ff") .setTitle(`${waverGuildMember.displayName} waves at you, hello!`) .setImage(randomWave); @@ -66,3 +70,5 @@ export class WaveCommand extends Command { }); } } + +export default WaveCommand; \ No newline at end of file From f0e07a0431c64a791759b7cc47b51839f8faef61 Mon Sep 17 00:00:00 2001 From: Manny Ledoux Date: Fri, 2 Sep 2022 03:44:04 -0400 Subject: [PATCH 6/7] fix: hopefully made the linter fixes issue-37 --- src/commands/fun/wave.ts | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts index f30474f..2d3d4b7 100644 --- a/src/commands/fun/wave.ts +++ b/src/commands/fun/wave.ts @@ -17,17 +17,17 @@ along with this program. If not, see . */ -import { Command, RegisterBehavior } from "@sapphire/framework"; -import { MessageEmbed } from "discord.js"; -import { Wave } from "../../utils/gifs"; +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"]], + name: 'wave', + description: 'Wave to a user', + preconditions: [['CoordinatorOnly', 'PatreonOnly']], }); } @@ -37,28 +37,25 @@ class WaveCommand extends Command { (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 } - ); + .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 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") + .setColor('#0099ff') .setTitle(`${waverGuildMember.displayName} waves at you, hello!`) .setImage(randomWave); @@ -71,4 +68,4 @@ class WaveCommand extends Command { } } -export default WaveCommand; \ No newline at end of file +export default WaveCommand; From 6d0a148c18030c04caa36a591c08f0e9b600495a Mon Sep 17 00:00:00 2001 From: Manny Ledoux Date: Fri, 2 Sep 2022 03:48:27 -0400 Subject: [PATCH 7/7] fix: last linter fixes this thing hates me issue-37 --- src/commands/fun/wave.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/commands/fun/wave.ts b/src/commands/fun/wave.ts index 2d3d4b7..b66f8c2 100644 --- a/src/commands/fun/wave.ts +++ b/src/commands/fun/wave.ts @@ -33,15 +33,13 @@ class WaveCommand extends Command { // 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 }); + 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