Skip to content

Commit 19d23fa

Browse files
committed
troll
1 parent df74b26 commit 19d23fa

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/features/troll.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { ChannelType } from "discord.js";
2+
import { isStaff } from "../helpers/discord";
3+
import { ChannelHandlers } from "../types";
4+
5+
const troll: ChannelHandlers = {
6+
handleMessage: async ({ msg: maybeMessage, bot }) => {
7+
const msg = maybeMessage.partial
8+
? await maybeMessage.fetch()
9+
: maybeMessage;
10+
11+
if (
12+
msg.guild ||
13+
!isStaff(msg.member) ||
14+
!msg.content.startsWith("skillissue")
15+
)
16+
return;
17+
18+
const [, messageLink] = msg.content.split(" ");
19+
const [guildId, channelId, messageId] = new URL(messageLink).pathname
20+
.split("/")
21+
.slice(-3);
22+
23+
const guild = await bot.guilds.fetch(guildId);
24+
const channel = await guild.channels.fetch(channelId);
25+
if (channel && channel.type === ChannelType.GuildText) {
26+
const message = await channel.messages.fetch(messageId);
27+
await message.reply("skill issue");
28+
}
29+
},
30+
};
31+
32+
export default troll;

0 commit comments

Comments
 (0)