File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,17 @@ export async function sendToChannels(channels: {channelID: Snowflake, pingRole?:
2020 for ( const channel of channels ) {
2121 try {
2222 const chanObj = await client . channels . fetch ( channel . channelID )
23- if ( ! ( chanObj && chanObj . isTextBased ( ) ) )
23+ if ( ! ( chanObj && chanObj . isTextBased ( ) ) ) {
24+ Logger . error ( `Invalid channel ${ channel . channelID } ` )
2425 continue
26+ }
27+
28+ if ( chanObj instanceof GuildChannel )
29+ if ( ! ( chanObj . permissionsFor ( client . user ! ) ?. has ( "SendMessages" ) && chanObj . permissionsFor ( client . user ! ) ?. has ( "ViewChannel" ) ) ) {
30+ Logger . error ( `Missing permissions in ${ chanObj . id } (${ chanObj . name } )` )
31+ continue
32+ }
33+
2534 if ( embed && ( ( content && content . length > 0 ) || ( channel . pingRole && channel . pingRole . length > 0 ) ) )
2635 messages . push ( chanObj . send ( {
2736 content : `${ channel . pingRole && channel . pingRole != "" ? `<@&${ channel . pingRole } > ` : "" } ${ content ?? "" } ` . trim ( ) ,
You can’t perform that action at this time.
0 commit comments