File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments