Select the channel when sending messages

This commit is contained in:
Samuel Elliott 2018-04-26 19:52:56 +01:00
parent 117336a6b4
commit 1ace26b67f
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 3 additions and 0 deletions

View File

@ -63,6 +63,8 @@ export class Channel {
async sendMessage(content, parse = false) { async sendMessage(content, parse = false) {
if (this.assertPermissions) this.assertPermissions('SEND_MESSAGES', Modules.DiscordPermissions.VIEW_CHANNEL | Modules.DiscordPermissions.SEND_MESSAGES); if (this.assertPermissions) this.assertPermissions('SEND_MESSAGES', Modules.DiscordPermissions.VIEW_CHANNEL | Modules.DiscordPermissions.SEND_MESSAGES);
this.select();
if (parse) content = Modules.MessageParser.parse(this.discordObject, content); if (parse) content = Modules.MessageParser.parse(this.discordObject, content);
else content = {content}; else content = {content};
@ -76,6 +78,7 @@ export class Channel {
* @return {Message} * @return {Message}
*/ */
sendBotMessage(content) { sendBotMessage(content) {
this.select();
const message = Modules.MessageParser.createBotMessage(this.id, content); const message = Modules.MessageParser.createBotMessage(this.id, content);
Modules.MessageActions.receiveMessage(this.id, message); Modules.MessageActions.receiveMessage(this.id, message);
return Message.from(Modules.MessageStore.getMessage(this.id, message.id)); return Message.from(Modules.MessageStore.getMessage(this.id, message.id));