Skip to content

Commit 5778249

Browse files
Techbot121Meta Construct
authored and
Meta Construct
committed
add command to remove stuck event roles
1 parent 467d645 commit 5778249

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { SlashCommand } from "@/extensions/discord";
2+
import { endEvent } from "../../discord-events";
3+
import Discord from "discord.js";
4+
5+
export const SlashEndEvent: SlashCommand = {
6+
options: {
7+
name: "end_event",
8+
description: "forcibly ends an event and removes the event role from users",
9+
default_member_permissions: Discord.PermissionsBitField.Flags.ManageGuild.toString(),
10+
},
11+
execute: async ctx => {
12+
await ctx.deferReply({ flags: Discord.MessageFlags.Ephemeral });
13+
await endEvent();
14+
},
15+
};

app/services/discord/modules/commands/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { MenuManageMediaLinksCommand, SlashManageMediaLinks } from "./developer/
66
import { MenuRemoveHighlightMessageCommand } from "./RemoveHighlightMessage";
77
import { MenuWhyRoleCommand } from "./WhyRole";
88
import { SlashBanCommand } from "./developer/Ban";
9+
import { SlashEndEvent } from "./developer/Events";
910
import { SlashFileCommand } from "./developer/File";
1011
import { SlashGservCommand } from "./developer/Gserv";
1112
import { SlashKickCommand } from "./developer/Kick";
@@ -29,6 +30,7 @@ export function EphemeralResponse(content: string): Discord.InteractionReplyOpti
2930
export const slashCommands = [
3031
// restricted commands
3132
SlashBanCommand,
33+
SlashEndEvent,
3234
SlashFileCommand,
3335
SlashGservCommand,
3436
SlashKickCommand,

app/services/discord/modules/discord-events.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const endEvent = async (
1717
) => {
1818
const bot = await globalThis.MetaConcord.container.getService("DiscordBot");
1919
const guild = bot.getGuild();
20-
const name = event?.name ?? "A event";
20+
const name = event?.name ?? "An event";
2121
console.log(`"${name}" ended! Removing roles...`);
2222
const users = (await guild?.roles.fetch(DiscordConfig.roles.event))?.members;
2323
users?.forEach(usr => {

0 commit comments

Comments
 (0)