-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathbot.py
More file actions
76 lines (63 loc) · 2.43 KB
/
bot.py
File metadata and controls
76 lines (63 loc) · 2.43 KB
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
# AutoCaptionBot by RknDeveloper
# Copyright (c) 2024 RknDeveloper
# Licensed under the MIT License
# https://github.com/RknDeveloper/Rkn-AutoCaptionBot/blob/main/LICENSE
# Please retain this credit when using or forking this code.
# Developer Contacts:
# Telegram: @RknDeveloperr
# Updates Channel: @Rkn_Bots_Updates & @Rkn_Botz
# Special Thanks To: @ReshamOwner
# Update Channels: @Digital_Botz & @DigitalBotz_Support
# ⚠️ Please do not remove this credit!
from aiohttp import web
from pyrogram import Client
from config import Rkn_Botz
from Rkn_Botz.web_support import web_server
class Rkn_AutoCaptionBot(Client):
def __init__(self):
super().__init__(
name="Rkn-Advance-Caption-Bot",
api_id=Rkn_Botz.API_ID,
api_hash=Rkn_Botz.API_HASH,
bot_token=Rkn_Botz.BOT_TOKEN,
workers=200,
plugins={"root": "Rkn_Botz"},
sleep_threshold=15,
)
async def start(self):
await super().start()
me = await self.get_me()
self.uptime = Rkn_Botz.BOT_UPTIME
self.force_channel = Rkn_Botz.FORCE_SUB
if Rkn_Botz.FORCE_SUB:
try:
link = await self.export_chat_invite_link(Rkn_Botz.FORCE_SUB)
self.invitelink = link
except Exception as e:
print(e)
print("Make Sure Bot admin in force sub channel")
self.force_channel = None
app = web.AppRunner(await web_server())
await app.setup()
bind_address = "0.0.0.0"
await web.TCPSite(app, bind_address, Rkn_Botz.PORT).start()
print(f"{me.first_name} Iꜱ Sᴛᴀʀᴛᴇᴅ.....✨️")
for id in Rkn_Botz.ADMIN:
try:
await self.send_message(id, f"**__{me.first_name} Iꜱ Sᴛᴀʀᴛᴇᴅ.....✨️__**")
except:
pass
async def stop(self, *args):
await super().stop()
print("Bot Stopped 🙄")
Rkn_AutoCaptionBot().run()
# ————
# End of file
# Original author: @RknDeveloperr
# GitHub: https://github.com/RknDeveloper
# Developer Contacts:
# Telegram: @RknDeveloperr
# Updates Channel: @Rkn_Bots_Updates & @Rkn_Botz
# Special Thanks To: @ReshamOwner
# Update Channels: @Digital_Botz & @DigitalBotz_Support
# ⚠️ Please do not remove this credit!