Skip to content

Commit

Permalink
Remove unnecessary error output
Browse files Browse the repository at this point in the history
It would fire any time a user was DM'd by the bot that didn't have a channel made because they themselves have not yet DM'd the bot. No need to create a channel every time a DM is sent out. Only when received.
  • Loading branch information
zajrik committed Jan 18, 2017
1 parent e7d1882 commit a052e7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yamdbf-addon-dm-manager",
"version": "0.1.1",
"version": "0.1.2",
"description": "YAMDBF addon for viewing and replying to DMs sent to your discord bot",
"main": "bin/index.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/DMManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class DMManager
}
catch (err)
{
this.sendError(`DMManager: Failed to create channel: '${normalize(user.username)}-${user.discriminator}'\n${err}`));
this.sendError(`DMManager: Failed to create channel: '${normalize(user.username)}-${user.discriminator}'\n${err}`);
}

if (newChannel) await newChannel.sendEmbed(this.buildUserInfo(user));
Expand Down Expand Up @@ -124,8 +124,7 @@ export default class DMManager
const channelID: string = message.author.id === this.client.user.id ?
(<DMChannel> message.channel).recipient.id : message.author.id;
const channel: TextChannel = this.channels.get(channelID);
const user: User = await this.client.fetchUser(channelID);
if (!channel) this.sendError(`Failed to find a channel for ${user.username}#${user.discriminator}`);
if (!channel) return;
if (message.embeds[0]) message.content += '\n\n**[RichEmbed]**';
await this.send(channel, message.author, message.content)
.catch(err => this.sendError(`Failed to send message in #${this.channels.get(channelID).name}\n${err}`));
Expand Down

0 comments on commit a052e7f

Please sign in to comment.