-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbot.py
56 lines (45 loc) · 1.69 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
# Donate Bot, A Simple Telegram Bot to tell How to Donate you
# Copyright (C) 2021 Jayant Kageri
#
# 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, either version 3 of the License, or
# any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# <! Functions >
import os
from telethon import TelegramClient, events, functions, Button
from telethon.tl.functions.users import GetFullUserRequest
from .Var import *
API_ID = Var.API_ID
API_HASH = Var.API_HASH
TOKEN = Var.TOKEN
OWNER_ID = Var.OWNER_ID
DONATE_TEXT = Var.DONATE_TEXT
telegram = TelegramClient("telegram_client", api_id=API_ID, api_hash=API_HASH).start(bot_token=TOKEN)
@telegram.on(events.NewMessage(pattern="^ ?(.*)"))
async def _(event):
# Send Donate Message
await telegram.send_message(event.chat_id, DONATE_TEXT)
# Forword Message to the Owner
incoming = event.raw_text
who = event.sender_id
if incoming.startswith("/start"):
pass
elif who == OWNER_ID:
return
else:
await event.forward_to(OWNER_ID)
import logging
logging.basicConfig(level=logging.WARNING)
print("Donatation Bot is Redy !")
print("Be Thankful to @JAYANTKAGERI")
telegram.run_until_disconnected()
# <! Functions Ends >