mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
print usage string on wrong syntax for regex
This commit is contained in:
parent
54b8b00bda
commit
1ad20e9606
@ -71,7 +71,11 @@ var command = function(dbot) {
|
||||
dbot.save();
|
||||
} else {
|
||||
if(commandName !== '~') {
|
||||
event.reply(dbot.t('syntax_error'));
|
||||
if(dbot.commands[commandName].hasOwnProperty('usage')){
|
||||
event.reply('Usage: ' + dbot.commands[commandName].usage);
|
||||
} else {
|
||||
event.reply(dbot.t('syntax_error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ var js = function(dbot) {
|
||||
};
|
||||
commands['~js'].regex = [/^~js (.*)/, 2];
|
||||
commands['~ajs'].regex = [/^~ajs (.*)/, 2];
|
||||
commands['~js'].usage = '~js [command]';
|
||||
commands['~ajs'].usage = '~ajs [command]';
|
||||
|
||||
return {
|
||||
'name': 'js',
|
||||
|
@ -207,13 +207,19 @@ var poll = function(dbot) {
|
||||
}
|
||||
}
|
||||
};
|
||||
commands['~newpoll'].regex = [/~newpoll (av )?([^ ]+) \[options=([^ ]+)\] (.+)/, 5];
|
||||
commands['~newpoll'].regex = [/~newpoll (av )?([^ ]+) options=([^ ]+) (.+)/, 5];
|
||||
commands['~addoption'].regex = [/~addoption ([^ ]+) ([^ ]+)/, 3];
|
||||
commands['~rmoption'].regex = [/~rmoption ([^ ]+) ([^ ]+)/, 3];
|
||||
commands['~vote'].regex = [/~vote ([^ ]+) ([^ ]+)/, 3];
|
||||
commands['~pdesc'].regex = [/~pdesc ([^ ]+)/, 2];
|
||||
commands['~count'].regex = [/~count ([^ ]+)/, 2];
|
||||
|
||||
commands['~newpoll'].usage = '~newpoll [pollname] options=[each,poll,option] [Poll Description]';
|
||||
commands['~addoption'].usage = '~addoption [pollname] [newoption]';
|
||||
commands['~rmoption'].usage= '~rmoption [pollname] [optiontoremove]';
|
||||
commands['~vote'].usage= '~vote [pollname] [option]';
|
||||
commands['~pdesc'].usage = '~pdesc [pollname]';
|
||||
|
||||
return {
|
||||
'name': 'poll',
|
||||
'ignorable': true,
|
||||
|
@ -218,6 +218,11 @@ var quotes = function(dbot) {
|
||||
commands['~rmlast'].regex = [/^~rmlast ([\d\w\s-]*)/, 2];
|
||||
commands['~qadd'].regex = [/^~qadd ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
|
||||
|
||||
commands['~q'].usage = '~q [category]';
|
||||
commands['~qsearch'].usage = '~qsearch [category]=[search]';
|
||||
commands['~rmlast'].usage = '~rmlast [category]'
|
||||
commands['~qadd'].usage = '~qadd [category]=[content]';
|
||||
|
||||
return {
|
||||
'name': 'quotes',
|
||||
'ignorable': true,
|
||||
|
@ -38,6 +38,7 @@ var report = function(dbot) {
|
||||
|
||||
};
|
||||
commands['~report'].regex = [/^~report ([^ ]+) ([^ ]+) (.+)$/, 4];
|
||||
commands['report'].usage = '~report [#channel] [username] [reason for reporting]';
|
||||
|
||||
return {
|
||||
'name': 'report',
|
||||
|
Loading…
Reference in New Issue
Block a user