fix errors

This commit is contained in:
Evert Prants 2020-12-05 18:14:35 +02:00
parent 0621386e55
commit 761157e693
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 7 additions and 3 deletions

View File

@ -20,7 +20,7 @@ function addCommands(plugin: UtilityPlugin, commands: any): void {
if (!simplified[0]) {
return true;
}
const script = msg.data.split(' ').slice(1).join(' ');
const script = simplified.join(' ');
// Disallow child_process when shell is disallowed
if ((script.indexOf('child_process') !== -1 ||

View File

@ -67,7 +67,7 @@ class DictionPlugin extends Plugin {
pos = '';
}
const word = encodeURIComponent(msg.text.split(' ').slice(pos ? 2 : 1).join(' '));
const word = encodeURIComponent(simplified.slice(pos ? 1 : 0).join(' '));
if (!word) {
msg.resolve('Please specifiy a word or term!');
@ -111,6 +111,7 @@ class DictionPlugin extends Plugin {
msg.resolve(str);
return true;
},
match: /define (\w*)/,
aliases: ['df'],
description: 'Find definitions for words',
usage: '[<pos>] <word>'

View File

@ -61,7 +61,10 @@ class FunPlugin extends Plugin {
name: 'hug',
plugin: this.name,
execute: async (msg: IMessage): Promise<boolean> => {
msg.resolve(msg.source.format.format('action', 'hugs %s'), msg.sender?.name);
if (!msg.sender) {
return true;
}
msg.resolve(msg.source.format.format('action', 'hugs %s'), msg.mention(msg.sender));
return true;
},
hidden: true