Add say command
All checks were successful
Test / build (push) Successful in 5s

This commit is contained in:
Ethan Lane 2024-06-29 16:55:36 +01:00
parent 7ccfa34562
commit 7855f9a5aa
8 changed files with 4709 additions and 8843 deletions

View file

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

View file

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

View file

@ -19,6 +19,6 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 18.x node-version: 18.x
- run: npm ci - run: yarn install --frozen-lockfile
- run: npm run build - run: yarn build
- run: npm test - 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) { private async SendAuditForUser(interaction: CommandInteraction) {
if (!interaction.guildId) return; if (!interaction.guildId) return;
const user = interaction.options.getUser('target'); const user = interaction.options.get('target', true).user!;
if (!user) { if (!user) {
await interaction.reply("User not found."); await interaction.reply("User not found.");
@ -191,7 +191,7 @@ export default class Audits extends Command {
private async AddAudit(interaction: CommandInteraction) { private async AddAudit(interaction: CommandInteraction) {
if (!interaction.guildId) return; 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 auditType = interaction.options.get('type');
const reasonInput = interaction.options.get('reason'); 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}\``); 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 Role from "./commands/Role/role";
import ConfigRole from "./commands/Role/config"; import ConfigRole from "./commands/Role/config";
import Rules from "./commands/rules"; import Rules from "./commands/rules";
import Say from "./commands/say";
import Setup from "./commands/setup"; import Setup from "./commands/setup";
import Timeout from "./commands/timeout"; import Timeout from "./commands/timeout";
import Unmute from "./commands/unmute"; import Unmute from "./commands/unmute";
@ -55,6 +56,7 @@ export default class Registry {
CoreClient.RegisterCommand("mute", new Mute()); CoreClient.RegisterCommand("mute", new Mute());
CoreClient.RegisterCommand("poll", new Poll()); CoreClient.RegisterCommand("poll", new Poll());
CoreClient.RegisterCommand("rules", new Rules()); CoreClient.RegisterCommand("rules", new Rules());
CoreClient.RegisterCommand("say", new Say());
CoreClient.RegisterCommand("setup", new Setup()); CoreClient.RegisterCommand("setup", new Setup());
CoreClient.RegisterCommand("timeout", new Timeout()); CoreClient.RegisterCommand("timeout", new Timeout());
CoreClient.RegisterCommand("unmute", new Unmute()); CoreClient.RegisterCommand("unmute", new Unmute());
@ -91,4 +93,4 @@ export default class Registry {
public static RegisterButtonEvents() { public static RegisterButtonEvents() {
CoreClient.RegisterButtonEvent("verify", new Verify()); CoreClient.RegisterButtonEvent("verify", new Verify());
} }
} }

4666
yarn.lock Normal file

File diff suppressed because it is too large Load diff