Add method to create menu, improve mention handling
This commit is contained in:
parent
dbd7e794d2
commit
7d68636751
|
@ -60,6 +60,9 @@ def toggleTweet(bot, update):
|
||||||
def unknown(bot, update):
|
def unknown(bot, update):
|
||||||
update.message.reply_text(bottools.strings.unknownCommand)
|
update.message.reply_text(bottools.strings.unknownCommand)
|
||||||
|
|
||||||
|
def makeMenu(buttons, columns):
|
||||||
|
return [buttons[i:i + columns] for i in range(0, len(buttons), columns)]
|
||||||
|
|
||||||
# Authentication process
|
# Authentication process
|
||||||
|
|
||||||
def auth(bot, update):
|
def auth(bot, update):
|
||||||
|
@ -176,7 +179,7 @@ def reply(bot, update, args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for m in mentions:
|
for m in mentions:
|
||||||
if m in args + [("@%s" % two.whoami().strip("@"))] + [("@%s" % sender.strip("@"))]:
|
if m in args or m =="@%s" % two.whoami().strip("@") or m == "@%s" % sender.strip("@"):
|
||||||
mentions.remove(m)
|
mentions.remove(m)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -185,7 +188,11 @@ def reply(bot, update, args):
|
||||||
if "@%s" % sender.strip("@") != "@%s" % two.whoami().strip("@"):
|
if "@%s" % sender.strip("@") != "@%s" % two.whoami().strip("@"):
|
||||||
first = ["@%s" % sender.strip("@")]
|
first = ["@%s" % sender.strip("@")]
|
||||||
else:
|
else:
|
||||||
first = [""]
|
try:
|
||||||
|
first = [mentions[0]]
|
||||||
|
mentions.remove(mentions[0])
|
||||||
|
except:
|
||||||
|
first = [""]
|
||||||
|
|
||||||
pargs = first + args[1:] + mentions
|
pargs = first + args[1:] + mentions
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue