forked from python-telegram-bot/python-telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdragons_trend_bot.py
More file actions
26 lines (20 loc) · 969 Bytes
/
Copy pathdragons_trend_bot.py
File metadata and controls
26 lines (20 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from telegram import Update
from telegram.ext import Updater, CommandHandler, CallbackContext
CHANNEL_ID = "@dragonstrending"
def vote(update: Update, context: CallbackContext):
user_id = update.effective_user.id
chat_member = context.bot.get_chat_member(@dragonstrending, user_id)
if chat_member.status in ["member", "administrator", "creator"]:
project = " ".join(context.args)
if project:
update.message.reply_text(f"✅ Your vote for {project} has been recorded!")
# save vote in DB or Google Sheet here
else:
update.message.reply_text("⚠️ Please specify a project name. Example: /vote Gashy")
else:
update.message.reply_text("❌ You must join our channel first: https://t.me/dragonstrending")
updater = Updater("8323882698:AAG09u4nIL1ychjc1lk5H9bp8dEsKppA9UM")
dp = updater.dispatcher
dp.add_handler(CommandHandler("vote", vote))
updater.start_polling()
updater.idle()