return types response

This commit is contained in:
mmacierzanka committed 2021-06-20 17:06:07 +02:00
1 parent c7c0a465bb
commit 16b5548d9b
1 file changed
+7 -1
+7 -1
View File
@@ -54,7 +54,13 @@ class Command {
async start(message?: Message, cmdArguments?: string[]) {
const memberPermissions : Readonly<Permissions> = message?.member?.permissions || new Permissions(0);
if(memberPermissions.any(this.permissions, true)) {
await this.function(message, cmdArguments);
const fnResult = await this.function(message, cmdArguments);
if(typeof fnResult == 'string') {
await message?.reply(fnResult);
}
else if(fnResult instanceof MessageEmbed) {
await message?.channel.send(fnResult);
}
}
else {
throw new PermissionsError(this, message?.member);