def registerMe(bot, update):
if not checkValidCommand(update.message.text, bot.username):
return
if not checkTypeGroup(update):
update.message.reply_text("This only works in groups the bot is in. If you would like to add the bot to a group, do so and then send /registerme")
return
#userDict = createUserDict(update.message.from_user)
userDict = update.message.from_user.id
logger.debug("New User: %s" % str(userDict))
mDatabase.groups.update({'_id':update.message.chat.id},
{'$addToSet':{'users':userDict},
'$set':{'title':update.message.chat.title}},
upsert=True)
logger.info("Register Me called for %s (%s)" % (update.message.chat.title, update.message.chat.id))
keyboard = [[InlineKeyboardButton("Register Me!",
callback_data="RegisterMe")]]
markup = InlineKeyboardMarkup(keyboard)
reply_text = "If you would like to register with this bot for this group, send /registerme, or click the button below."
try:
bot.sendMessage(chat_id = update.message.chat.id,
text = reply_text,
reply_markup = markup)
except TelegramError as TE:
logger.error("Caught this from registerMe: %s" % str(TE))
评论列表
文章目录