-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.py
132 lines (80 loc) · 2.83 KB
/
start.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# This file is part of the Compressor distribution.
# Copyright (c) 2021 Danish_00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# License can be found in <https://github.com/1Danish-00/CompressorBot/blob/main/License> .
from helper._get import *
basicConfig(format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s", level=INFO)
LOGS = getLogger(__name__)
LOGS.info("Starting...")
######## Connect ########
try:
cbot = TelegramClient("bot", APP_ID, API_HASH).start(bot_token=BOT_TOKEN)
except Exception as e:
LOGS.info("Environment vars are missing! Kindly recheck.")
LOGS.info("Bot is quiting...")
LOGS.info(str(e))
exit()
####### GENERAL CMDS ########
@cbot.on(events.NewMessage(pattern="/start"))
async def _(e):
await start(e)
@cbot.on(events.NewMessage(pattern="/ping"))
async def _(e):
await up(e)
@cbot.on(events.NewMessage(pattern="/help"))
async def _(e):
await help(e)
######## Callbacks #########
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"sshot(.*)")))
async def _(e):
await screenshot(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"gsmpl(.*)")))
async def _(e):
await sample(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"skip(.*)")))
async def _(e):
await skip(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"stats(.*)")))
async def _(e):
await stats(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"encc(.*)")))
async def _(e):
await encc(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"sencc(.*)")))
async def _(e):
await sencc(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"ccom(.*)")))
async def _(e):
await ccom(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile(b"back(.*)")))
async def _(e):
await back(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile("ihelp")))
async def _(e):
await ihelp(e)
@cbot.on(events.callbackquery.CallbackQuery(data=re.compile("beck")))
async def _(e):
await beck(e)
########## Direct ###########
@cbot.on(events.NewMessage(pattern="/eval"))
async def _(e):
await eval(e)
@cbot.on(events.NewMessage(pattern="/bash"))
async def _(e):
await bash(e)
########## AUTO ###########
@cbot.on(events.NewMessage(incoming=True))
async def _(e):
await encod(e)
########### Start ############
LOGS.info("Bot has started.")
cbot.run_until_disconnected()