Don't tag in group

This commit is contained in:
Ceda EI 2019-01-07 17:52:34 +05:30
parent b71174918b
commit 579fafd7b1
1 changed files with 7 additions and 3 deletions

10
bot.py
View File

@ -71,7 +71,7 @@ def update_message(bot, db, callback_id):
reply_markup=keyboard)
def send_stats(bot, update, db):
def send_stats(bot, update, db, tag):
cursor = db.cursor()
query = ("SELECT user_id, name FROM poll NATURAL JOIN message_ids WHERE "
"message_id = ?")
@ -84,7 +84,10 @@ def send_stats(bot, update, db):
else:
text = "Voters\n"
for i in voters:
text += f"<a href='tg://user?id={i[0]}'>{i[1]}</a>\n"
if tag:
text += f"<a href='tg://user?id={i[0]}'>{i[1]}</a>\n"
else:
text += f"{i[1]}\n"
bot.send_message(chat_id=update.message.chat_id, text=text,
parse_mode="HTML")
@ -95,7 +98,8 @@ def post(bot, update, db):
if (update.message.forward_from_chat and
update.message.forward_from_chat.id == config.channel_id and
user_id in config.allowed_users):
send_stats(bot, update, db)
tag = (chat_id == user_id)
send_stats(bot, update, db, tag)
return
if chat_id in config.allowed_users:
callback_id = get_callback_id(db)