Skip to content

Commit

Permalink
troll
Browse files Browse the repository at this point in the history
  • Loading branch information
taranvohra committed Apr 8, 2024
1 parent df74b26 commit 19d23fa
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/features/troll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ChannelType } from "discord.js";
import { isStaff } from "../helpers/discord";
import { ChannelHandlers } from "../types";

const troll: ChannelHandlers = {
handleMessage: async ({ msg: maybeMessage, bot }) => {
const msg = maybeMessage.partial
? await maybeMessage.fetch()
: maybeMessage;

if (
msg.guild ||
!isStaff(msg.member) ||
!msg.content.startsWith("skillissue")
)
return;

const [, messageLink] = msg.content.split(" ");
const [guildId, channelId, messageId] = new URL(messageLink).pathname
.split("/")
.slice(-3);

const guild = await bot.guilds.fetch(guildId);
const channel = await guild.channels.fetch(channelId);
if (channel && channel.type === ChannelType.GuildText) {
const message = await channel.messages.fetch(messageId);
await message.reply("skill issue");
}
},
};

export default troll;

0 comments on commit 19d23fa

Please sign in to comment.