Skip to content

Commit

Permalink
🚑 Fix unhandled promise rejections
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarbar338 committed Apr 18, 2021
1 parent b441dda commit ebadfab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"main": "dist",
"name": "reaction-role",
"version": "4.0.1",
"version": "4.0.2",
"description": "ReactionRole is a module that allows you to create Discord reaction role easily!",
"scripts": {
"prebuild": "rimraf dist",
Expand Down
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ export class ReactionRole extends Client {
);
for (const message_id in this.config) {
const message = this.config[message_id];
const channel = (await this.channels.fetch(
message.channel_id,
)) as TextChannel;
const channel = (await this.channels
.fetch(message.channel_id)
.catch(() => undefined)) as TextChannel | undefined;
if (!channel || channel.type != "text") {
this.deleteMessage(message.message_id);
continue;
}
const msg = await channel.messages.fetch(message.message_id);
const msg = await channel.messages
.fetch(message.message_id)
.catch(() => undefined);
if (!msg || msg.deleted) {
this.deleteMessage(message.message_id);
continue;
Expand Down

0 comments on commit ebadfab

Please sign in to comment.