def statusReceived(bot, update):
logger.debug("Message Received")
if update.message.new_chat_member and update.message.new_chat_member.username == bot.username:
logger.info("Added To Chat %s (%s)" %(update.message.chat.title, update.message.chat.id))
newGroup = dict()
chat = update.message.chat
#newGroup['_id'] = chat.id
newGroup['title'] = chat.title
newGroup['admins'] = [chatmember.user.id for chatmember in chat.get_administrators()]
logger.debug("newGroup: %s" % newGroup)
MDB.groups.update({'_id':chat.id}, newGroup, upsert=True)
logger.info("Added %s to the group list" % update.message.chat.title)
elif update.message.new_chat_member:
updateGroupData(update)
logger.info("New member joined the chat.")
update.message.reply_text(WELCOMETEXT, quote=False)
elif update.message.left_chat_member and update.message.left_chat_member.username == bot.username:
MDB.groups.remove({'_id':update.message.chat.id})
logger.info("Removing entry for %s" % (update.message.chat.title))
# When a user sends a message, it is forwarded to everyone with this method.
评论列表
文章目录