add reject

This commit is contained in:
Evert Prants 2020-12-13 12:17:25 +02:00
parent 041266846d
commit b4f6300a23
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
"main": "plugin.js",
"name": "discord",
"description": "Discord Service for Squeebot 3",
"version": "1.0.0",
"version": "1.1.0",
"tags": ["service", "discord"],
"dependencies": ["control?"],
"npmDependencies": ["discord.js@^12.5.1"]

View File

@ -56,6 +56,11 @@ class DiscordMessageAdapter implements IMessage {
this.source.resolve(this, ...args);
}
public reject(error: Error): void {
this.resolved = true;
this.source.resolve(this, error.message);
}
public mention(user: IMessageTarget): string {
return `<@${user.id}>`;
}
@ -128,7 +133,7 @@ class DiscordProtocol extends Protocol {
member,
this,
{ id: member.user.id, name: member.user.username },
{ server: member.guild.id, id: '', name: ''});
{ server: member.guild.id, id: '*', name: '*'});
this.plugin.stream.emitTo('channel', 'event', newMessage);
});
@ -144,7 +149,7 @@ class DiscordProtocol extends Protocol {
member,
this,
{ id: member.user.id, name: member.user.username },
{ server: member.guild.id, id: '', name: ''});
{ server: member.guild.id, id: '*', name: '*'});
this.plugin.stream.emitTo('channel', 'event', newMessage);
});
}

View File

@ -3,7 +3,7 @@
"plugins": [
{
"name": "discord",
"version": "1.0.0"
"version": "1.1.0"
}
],
"typescript": true