forked from trizin/Telegram-Airdrop-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
63 lines (53 loc) · 1.71 KB
/
bot.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import logging
from utils.handlers import *
from utils.handlers import BOT_TOKEN
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
PicklePersistence,
)
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
)
persistence = PicklePersistence(filename="conversationbot/conversationbot")
updater = Updater(token=BOT_TOKEN, use_context=True, persistence=persistence)
dispatcher = updater.dispatcher
states = {
PROCEED: [
MessageHandler(Filters.regex("^🚀 Join Airdrop$"), submit_details),
cancelHandler,
],
FOLLOW_TELEGRAM: [
MessageHandler(Filters.regex("^Submit Details$"), follow_telegram),
cancelHandler,
],
FOLLOW_TWITTER: [
MessageHandler(Filters.regex("^Done$"), follow_twitter),
cancelHandler,
],
SUBMIT_ADDRESS: [cancelHandler, MessageHandler(Filters.text, submit_address)],
END_CONVERSATION: [
cancelHandler,
MessageHandler(Filters.regex("^0x[a-fA-F0-9]{40}$"), end_conversation),
],
LOOP: [MessageHandler(Filters.text, loopAnswer)],
SUREWANTTO: [MessageHandler(Filters.regex("^(YES|NO)$"), sureWantTo)],
CAPTCHASTATE: [MessageHandler(Filters.text, checkCaptcha)],
}
conv_handler = ConversationHandler(
entry_points=[CommandHandler("start", start)],
states=states,
fallbacks=[],
name="main",
persistent=True,
)
dispatcher.add_handler(CommandHandler("list", getList))
dispatcher.add_handler(CommandHandler("stats", getStats))
dispatcher.add_handler(CommandHandler("bot", setStatus))
dispatcher.add_handler(conv_handler)
# %% start the bot
updater.start_polling()
updater.idle()