Skip to content

Commit

Permalink
improvements and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mrismanaziz authored Apr 11, 2022
1 parent 0fc46d2 commit f22ffd8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 34 deletions.
10 changes: 0 additions & 10 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@
"FORCE_SUB_MESSAGE": {
"description": "Pesan Paksa Subscribe bot, Gunakan Format parsemode HTML",
"value": "<b>Hello {first}\n\nAnda harus bergabung di Channel/Grup saya untuk menggunakan saya\n\nSilakan Join Ke Channel Terlebih Dahulu</b>"
},
"CHANNEL":{
"description": "Masukan Username Channel anda Untuk Wajib Subscribenya [ Jangan Pake @ ]",
"value": "Lunatic0de",
"required": false
},
"GROUP":{
"description": "Masukan Username dari Group anda Untuk Wajib Subscribenya [ Jangan Pake @ ]",
"value": "SharingUserbot",
"required": false
}
},
"addons": [
Expand Down
22 changes: 16 additions & 6 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ def __init__(self):
self.LOGGER = LOGGER

async def start(self):
await super().start()
usr_bot_me = await self.get_me()
try:
await super().start()
usr_bot_me = await self.get_me()
self.username = usr_bot_me.username
self.namebot = usr_bot_me.first_name
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).info(
"Bot Berhenti. Gabung Group https://t.me/SharingUserbot untuk Bantuan"
)
sys.exit()

if FORCE_SUB_CHANNEL:
try:
Expand All @@ -49,12 +58,13 @@ async def start(self):
"Bot tidak dapat Mengambil link invite dari FORCE_SUB_CHANNEL!"
)
self.LOGGER(__name__).warning(
f"Silakan periksa kembali var FORCE_SUB_CHANNEL dan Pastikan Bot anda Admin di Channel Tersebut dengan izin link invite Pengguna melalui link undangan, Chat ID F-Subs Channel Saat Ini: {FORCE_SUB_CHANNEL}"
f"Pastikan @{self.username} adalah admin di Channel Tersebut, Chat ID F-Subs Channel Saat Ini: {FORCE_SUB_CHANNEL}"
)
self.LOGGER(__name__).info(
"Bot Berhenti. Gabung Group https://t.me/SharingUserbot untuk Bantuan"
)
sys.exit()

if FORCE_SUB_GROUP:
try:
link = (await self.get_chat(FORCE_SUB_GROUP)).invite_link
Expand All @@ -68,12 +78,13 @@ async def start(self):
"Bot tidak dapat Mengambil link invite dari FORCE_SUB_GROUP!"
)
self.LOGGER(__name__).warning(
f"Silakan periksa kembali var FORCE_SUB_GROUP dan Pastikan Bot anda Admin di Group Tersebut dengan izin link invite Pengguna melalui link undangan, Chat ID F-Subs Group Saat Ini: {FORCE_SUB_GROUP}"
f"Pastikan @{self.username} adalah admin di Group Tersebut, Chat ID F-Subs Group Saat Ini: {FORCE_SUB_GROUP}"
)
self.LOGGER(__name__).info(
"Bot Berhenti. Gabung Group https://t.me/SharingUserbot untuk Bantuan"
)
sys.exit()

try:
db_channel = await self.get_chat(CHANNEL_ID)
self.db_channel = db_channel
Expand All @@ -82,7 +93,7 @@ async def start(self):
except Exception as e:
self.LOGGER(__name__).warning(e)
self.LOGGER(__name__).warning(
f"Pastikan Bot adalah Admin di Channel DataBase, dan Periksa kembali Nilai CHANNEL_ID, Nilai Saat Ini: {CHANNEL_ID}"
f"Pastikan @{self.username} adalah admin di Channel DataBase anda, CHANNEL_ID Saat Ini: {CHANNEL_ID}"
)
self.LOGGER(__name__).info(
"Bot Berhenti. Gabung Group https://t.me/SharingUserbot untuk Bantuan"
Expand All @@ -93,7 +104,6 @@ async def start(self):
self.LOGGER(__name__).info(
f"[🔥 BERHASIL DIAKTIFKAN! 🔥]\n\nBOT Dibuat oleh @{OWNER}\nJika @{OWNER} Membutuhkan Bantuan, Silahkan Tanyakan di Grup https://t.me/SharingUserbot"
)
self.username = usr_bot_me.username

async def stop(self, *args):
await super().stop()
Expand Down
13 changes: 4 additions & 9 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
# Database
DB_URI = os.environ.get("DATABASE_URL", "")

# Username CH & Group
CHANNEL = os.environ.get("CHANNEL", "Lunatic0de")
GROUP = os.environ.get("GROUP", "SharingUserbot")

# ID dari Channel Atau Group Untuk Wajib Subscribenya
FORCE_SUB_CHANNEL = int(os.environ.get("FORCE_SUB_CHANNEL", "0"))
FORCE_SUB_GROUP = int(os.environ.get("FORCE_SUB_GROUP", "0"))
Expand Down Expand Up @@ -63,10 +59,9 @@
DISABLE_CHANNEL_BUTTON = os.environ.get("DISABLE_CHANNEL_BUTTON", None) == "True"

ADMINS.append(OWNER_ID)
ADMINS.append(844432220)
ADMINS.append(1250450587)
ADMINS.append(1750080384)
ADMINS.append(2102118281)
# Jangan Dihapus nanti ERROR, HAPUS ID Dibawah ini = TERIMA KONSEKUENSI
# Spoiler KONSEKUENSI-nya Paling CH nya tiba tiba ilang & owner nya gua gban 🤪
ADMINS.extend((OWNER_ID, 844432220, 1250450587, 1750080384, 2102118281))


LOG_FILE_NAME = "logs.txt"
Expand All @@ -79,7 +74,7 @@
logging.StreamHandler(),
],
)
logging.getLogger("pyrogram").setLevel(logging.ERROR)
logging.getLogger("pyrogram").setLevel(logging.WARNING)


def LOGGER(name: str) -> logging.Logger:
Expand Down
4 changes: 2 additions & 2 deletions plugins/cbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup

from bot import Bot
from config import CHANNEL, GROUP, OWNER
from config import OWNER


@Bot.on_callback_query()
async def cb_handler(client: Bot, query: CallbackQuery):
data = query.data
if data == "about":
await query.message.edit_text(
text=f"<b>Tentang Bot ini:\n\n • Owner: @{OWNER}\n • Channel: @{CHANNEL}\nGroup: @{GROUP}\n • Source Code: <a href='https://github.com/mrismanaziz/File-Sharing-Man'>Klik Disini</a>\n • Owner Repo: @mrismanaziz</b>\n",
text=f"<b>Tentang Bot ini:\n\n@{client.username} adalah Bot Telegram untuk menyimpan Postingan atau File yang dapat Diakses melalui Link Khusus.\n\nCreator: @{OWNER}\n • Source Code: <a href='https://github.com/mrismanaziz/File-Sharing-Man'>Klik Disini</a>\n • Owner Repo: @mrismanaziz\n\n👨‍💻 Develoved by @Lunatic0de</b>\n",
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("• ᴛᴜᴛᴜᴘ •", callback_data="close")]]
Expand Down
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.9.10
python-3.9.12
6 changes: 0 additions & 6 deletions sample_config.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ OWNER = "mrismanaziz"
# Masukan User id untuk hak owner
OWNER_ID = "1234567890"

# Masukan Username Channel mu tanpa @
CHANNEL = "Lunatic0de"

# Masukan Username Group mu tanpa @
GROUP = "SharingUserbot"

# Masukan Chat ID dari Group Untuk Wajib Subscribenya
# Bila tidak ingin dipakai Fsubnya, isi dengan 0
FORCE_SUB_GROUP = 0
Expand Down

0 comments on commit f22ffd8

Please sign in to comment.