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", "main": "plugin.js",
"name": "discord", "name": "discord",
"description": "Discord Service for Squeebot 3", "description": "Discord Service for Squeebot 3",
"version": "1.0.0", "version": "1.1.0",
"tags": ["service", "discord"], "tags": ["service", "discord"],
"dependencies": ["control?"], "dependencies": ["control?"],
"npmDependencies": ["discord.js@^12.5.1"] "npmDependencies": ["discord.js@^12.5.1"]

View File

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

View File

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