Don't tag in group
This commit is contained in:
parent
b71174918b
commit
579fafd7b1
10
bot.py
10
bot.py
|
@ -71,7 +71,7 @@ def update_message(bot, db, callback_id):
|
||||||
reply_markup=keyboard)
|
reply_markup=keyboard)
|
||||||
|
|
||||||
|
|
||||||
def send_stats(bot, update, db):
|
def send_stats(bot, update, db, tag):
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = ("SELECT user_id, name FROM poll NATURAL JOIN message_ids WHERE "
|
query = ("SELECT user_id, name FROM poll NATURAL JOIN message_ids WHERE "
|
||||||
"message_id = ?")
|
"message_id = ?")
|
||||||
|
@ -84,7 +84,10 @@ def send_stats(bot, update, db):
|
||||||
else:
|
else:
|
||||||
text = "Voters\n"
|
text = "Voters\n"
|
||||||
for i in voters:
|
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,
|
bot.send_message(chat_id=update.message.chat_id, text=text,
|
||||||
parse_mode="HTML")
|
parse_mode="HTML")
|
||||||
|
|
||||||
|
@ -95,7 +98,8 @@ def post(bot, update, db):
|
||||||
if (update.message.forward_from_chat and
|
if (update.message.forward_from_chat and
|
||||||
update.message.forward_from_chat.id == config.channel_id and
|
update.message.forward_from_chat.id == config.channel_id and
|
||||||
user_id in config.allowed_users):
|
user_id in config.allowed_users):
|
||||||
send_stats(bot, update, db)
|
tag = (chat_id == user_id)
|
||||||
|
send_stats(bot, update, db, tag)
|
||||||
return
|
return
|
||||||
if chat_id in config.allowed_users:
|
if chat_id in config.allowed_users:
|
||||||
callback_id = get_callback_id(db)
|
callback_id = get_callback_id(db)
|
||||||
|
|
Loading…
Reference in New Issue