Add say command (#446)
All checks were successful
Deploy To Stage / build (push) Successful in 5s
Deploy To Stage / deploy (push) Successful in 15s

- Add `/say` command to let the bot reply with a message
- Migrate to yarn

#19

Reviewed-on: #446
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
Ethan Lane 2024-06-29 18:26:25 +01:00 committed by Vylpes
parent 7ccfa34562
commit b1afc79dda
8 changed files with 4709 additions and 8843 deletions

View file

@ -17,9 +17,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: "Copy files over to location"
run: cp -r . ${{ secrets.PROD_REPO_PATH }}
@ -63,5 +63,5 @@ jobs:
&& (pm2 delete vylbot_prod || true) \
&& docker compose up -d \
&& sleep 10 \
&& npm run db:up \
&& pm2 start --name vylbot_prod dist/vylbot.js
&& yarn db:up \
&& pm2 start --name vylbot_prod dist/vylbot.js

View file

@ -17,9 +17,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: "Copy files over to location"
run: cp -r . ${{ secrets.STAGE_REPO_PATH }}
@ -63,5 +63,5 @@ jobs:
&& (pm2 delete vylbot_stage || true) \
&& docker compose up -d \
&& sleep 10 \
&& npm run db:up \
&& pm2 start --name vylbot_stage dist/vylbot.js
&& yarn db:up \
&& pm2 start --name vylbot_stage dist/vylbot.js

View file

@ -19,6 +19,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test

8826
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -93,7 +93,7 @@ export default class Audits extends Command {
private async SendAuditForUser(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const user = interaction.options.getUser('target');
const user = interaction.options.get('target', true).user!;
if (!user) {
await interaction.reply("User not found.");
@ -191,7 +191,7 @@ export default class Audits extends Command {
private async AddAudit(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const user = interaction.options.getUser('target');
const user = interaction.options.get('target', true).user!;
const auditType = interaction.options.get('type');
const reasonInput = interaction.options.get('reason');
@ -209,4 +209,4 @@ export default class Audits extends Command {
await interaction.reply(`Created new audit with ID \`${audit.AuditId}\``);
}
}
}

24
src/commands/say.ts Normal file
View file

@ -0,0 +1,24 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import EmbedColours from "../constants/EmbedColours";
import { Command } from "../type/command";
export default class Say extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName('say')
.setDescription('Have the bot reply with your message')
.addStringOption(x =>
x
.setName("message")
.setDescription("The message to repeat")
.setRequired(true));
}
public override async execute(interaction: CommandInteraction) {
const message = interaction.options.get("message", true);
await interaction.reply(message.value as string);
}
}

View file

@ -17,6 +17,7 @@ import Poll from "./commands/poll";
import Role from "./commands/Role/role";
import ConfigRole from "./commands/Role/config";
import Rules from "./commands/rules";
import Say from "./commands/say";
import Setup from "./commands/setup";
import Timeout from "./commands/timeout";
import Unmute from "./commands/unmute";
@ -55,6 +56,7 @@ export default class Registry {
CoreClient.RegisterCommand("mute", new Mute());
CoreClient.RegisterCommand("poll", new Poll());
CoreClient.RegisterCommand("rules", new Rules());
CoreClient.RegisterCommand("say", new Say());
CoreClient.RegisterCommand("setup", new Setup());
CoreClient.RegisterCommand("timeout", new Timeout());
CoreClient.RegisterCommand("unmute", new Unmute());
@ -91,4 +93,4 @@ export default class Registry {
public static RegisterButtonEvents() {
CoreClient.RegisterButtonEvent("verify", new Verify());
}
}
}

4666
yarn.lock Normal file

File diff suppressed because it is too large Load diff