mirror of
https://github.com/LBRYFoundation/lbry-tipbot.git
synced 2025-08-23 16:57:24 +00:00
allowed dm commands
This commit is contained in:
commit
98bc0ce942
1 changed files with 11 additions and 17 deletions
|
@ -42,17 +42,12 @@ function respond(bot, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var subcommand = words.length >= 2 ? words[1] : 'help';
|
var subcommand = words.length >= 2 ? words[1] : 'help';
|
||||||
var isAllowedTip = false;
|
|
||||||
|
|
||||||
//uncomment the next block when the new lower-level API is added (is_admin and is_owner must be included in the data dump)
|
var moveToBotSandbox = /*!tipper.is_admin && !tipper.is_owner && */channel !== 'C1TEEBS2Z' && ['help', 'balance', 'deposit', 'withdraw'].indexOf(subcommand) != -1 && !channel.name.startsWith("D")
|
||||||
if (/*(!tipper.is_admin || !tipper.is_owner) && */(channel.name !== 'C1TEEBS2Z' && !channel.name.startsWith("D") )){
|
if (moveToBotSandbox) {
|
||||||
//to check if the command is a tip (hence allowed to pass through) we need to check against all the other commands)
|
bot.postMessage(channel, 'Please use <#C1TEEBS2Z|bot-sandbox> to talk to bots.', globalSlackParams);
|
||||||
if (subcommand === 'help' || subcommand === 'balance' || subcommand === 'deposit' || subcommand === 'withdraw'){
|
|
||||||
bot.postMessage(channel, 'Please help keep the channel clean: use #bot-sandbox', globalSlackParams);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isAllowedTip = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subcommand === 'help') {
|
if (subcommand === 'help') {
|
||||||
doHelp(bot, channel);
|
doHelp(bot, channel);
|
||||||
|
@ -67,7 +62,7 @@ function respond(bot, data) {
|
||||||
doWithdraw(bot, channel, tipper, words);
|
doWithdraw(bot, channel, tipper, words);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doTip(bot, channel, tipper, words, isAllowedTip);
|
doTip(bot, channel, tipper, words);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,10 +117,8 @@ function doWithdraw(bot, channel, tipper, words) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function doTip(bot, channel, tipper, words, isAllowedTip) {
|
function doTip(bot, channel, tipper, words) {
|
||||||
if (words.length < 3) {
|
if (words.length < 3) {
|
||||||
//necessary to avoid the help menu opening up on all channels
|
|
||||||
if (!isAllowedTip)
|
|
||||||
doHelp(bot, channel);
|
doHelp(bot, channel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -157,6 +150,7 @@ function doTip(bot, channel, tipper, words, isAllowedTip) {
|
||||||
|
|
||||||
function doHelp(bot, channel) {
|
function doHelp(bot, channel) {
|
||||||
bot.postMessage(channel,
|
bot.postMessage(channel,
|
||||||
|
'*USE <#bot-sandbox> FOR EVERYTHING EXCEPT ACTUAL TIPPING*\n' +
|
||||||
'`' + command + ' help`: this message\n' +
|
'`' + command + ' help`: this message\n' +
|
||||||
'`' + command + ' balance`: get your balance\n' +
|
'`' + command + ' balance`: get your balance\n' +
|
||||||
'`' + command + ' deposit`: get address for deposits\n' +
|
'`' + command + ' deposit`: get address for deposits\n' +
|
||||||
|
|
Loading…
Add table
Reference in a new issue