Add method to create menu, improve mention handling

This commit is contained in:
Klaus-Uwe Mitterer 2017-03-23 22:39:54 +01:00
parent dbd7e794d2
commit 7d68636751
1 changed files with 9 additions and 2 deletions

View File

@ -60,6 +60,9 @@ def toggleTweet(bot, update):
def unknown(bot, update):
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
def auth(bot, update):
@ -176,7 +179,7 @@ def reply(bot, update, args):
pass
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)
else:
@ -185,7 +188,11 @@ def reply(bot, update, args):
if "@%s" % sender.strip("@") != "@%s" % two.whoami().strip("@"):
first = ["@%s" % sender.strip("@")]
else:
first = [""]
try:
first = [mentions[0]]
mentions.remove(mentions[0])
except:
first = [""]
pargs = first + args[1:] + mentions