From 433dfab9076f3473b06fec5147622d2ea4be5d84 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Thu, 5 Nov 2020 00:35:24 +0530
Subject: [PATCH 001/105] Update __main__.py
---
cinderella/__main__.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index f0306f5e..0f6eb785 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -58,8 +58,7 @@ def vercheck() -> str:
SOURCE_STRING = """
-⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [here](https://github.com/Sur-vivor/CinderellaProBot)
-⚡You Can Clone Me [Here](https://heroku.com/deploy?template=https://github.com/Sur-vivor/CinderellaProBot.git)
+⚡I'm built in python3 ⭐
"""
@@ -179,7 +178,7 @@ def send_start(bot, update):
first_name = update.effective_user.first_name
text = PM_START_TEXT
- keyboard = [[InlineKeyboardButton(text="🤝Help",callback_data="help_back"),InlineKeyboardButton(text="🛡Creator🛡",url="https://t.me/Surv_ivor")]]
+ keyboard = [[InlineKeyboardButton(text="🤝Help",callback_data="help_back"),InlineKeyboardButton(text="🛡OWNER🛡",url="https://t.me/POWER_OF_TELEGRAM")]]
keyboard += [[InlineKeyboardButton(text="🌐Connect Group", callback_data="main_connect"),InlineKeyboardButton(text="⚜️Add Me⚜️",url="t.me/{}?startgroup=true".format(bot.username))]]
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
@@ -601,7 +600,7 @@ def main():
updater.bot.set_webhook(url=URL + TOKEN)
else:
- LOGGER.info("Cinderella running...")
+ LOGGER.info("pikachu running...")
updater.start_polling(timeout=15, read_latency=4)
updater.idle()
From 2be5ea8ca5a65c00ff81b5ab479068a648decf1f Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 13 Nov 2020 00:09:46 +0530
Subject: [PATCH 002/105] Update __main__.py
---
cinderella/__main__.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 0f6eb785..b1495e47 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,20 +28,19 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A Powerful Telegram ProBot to Manage Your Groups,feel free to add to your groups!!_
-_Maintained by_ [{}](tg://user?id={})
+_My name is_ *{}*\n_ഞാൻ ഒരു ബോട്ട് ആണ് തങ്ങളുടെ ഗ്രൂപ്പിനെ കൺട്രോൾ ചെയ്യാൻ ഞാൻ ആഗ്രഹിക്കുന്നു
+എന്റെ സൃഷ്ടാവ് ഇദ്ദേഹം ആണ് _ [{}](tg://user?id={})
"""
HELP_STRINGS = """
Hey there! My name is *{}*.
-I'm a modular group management bot with a few fun extras! Have a look at the following for an idea of some of \
-the things I can help you with.
+എന്താ എന്ത് വേണം! ഈ പറയുന്ന കാര്യങ്ങൾ അല്ലാതെ ഉള്ള ഒരു കാര്യവും എനിക്ക് പറ്റില്ല .
*Main* commands available:
💠 - /start: start the bot
💠 - /help: PM's you this message.
💠 - /help : PM's you info about that module.
- 💠 - /source: Information about my source.
+ 💠 - /source: < str:
SOURCE_STRING = """
-⚡I'm built in python3 ⭐
+നാട്ടുകാരെ ഓടി വരണേ കള്ളൻ! കള്ളൻ!👹
"""
+CODE = """https://github.com/piku-adhi/pikachu"""
IMPORTED = {}
MIGRATEABLE = []
From 80fbe40b6f9cea6c7d2fd2d79ba9fc59199f4dee Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 13 Nov 2020 15:07:47 +0530
Subject: [PATCH 003/105] Update __main__.py
---
cinderella/__main__.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index b1495e47..eeb61d94 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -77,7 +77,7 @@ def vercheck() -> str:
START_IMG = os.environ.get('START_IMG', None)
if START_IMG is None:
- img = "https://telegra.ph/file/511ad504656e712b88235.jpg"
+ img = "https://telegra.ph/file/c0d931f914bc7de0e3f9b.jpg)
else:
img = START_IMG
@@ -178,8 +178,8 @@ def send_start(bot, update):
first_name = update.effective_user.first_name
text = PM_START_TEXT
- keyboard = [[InlineKeyboardButton(text="🤝Help",callback_data="help_back"),InlineKeyboardButton(text="🛡OWNER🛡",url="https://t.me/POWER_OF_TELEGRAM")]]
- keyboard += [[InlineKeyboardButton(text="🌐Connect Group", callback_data="main_connect"),InlineKeyboardButton(text="⚜️Add Me⚜️",url="t.me/{}?startgroup=true".format(bot.username))]]
+ keyboard = [[InlineKeyboardButton(text="സഹായം",callback_data="help_back"),InlineKeyboardButton(text="🤖OWNER🤖",url="https://t.me/POWER_OF_TELEGRAM")]]
+ keyboard += [[InlineKeyboardButton(text="🛡Contact Creator",url="https://t.me/POWER_OF_TELEGRAM")]] InlineKeyboardButton(text="⚜️Add Me⚜️",url="t.me/{}?startgroup=true".format(bot.username))]]
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
@@ -279,8 +279,8 @@ def get_help(bot: Bot, update: Update):
update.effective_message.reply_text("Contact me in PM to get the list of possible commands.",
reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="⚜️Help",url="t.me/{}?start=help".format(bot.username))],
- [InlineKeyboardButton(text="🛡Contact Creator",url="https://t.me/Surv_ivor")]]))
+ [[InlineKeyboardButton(text="🔱Help🔱",url="t.me/{}?start=help".format(bot.username))],
+ [InlineKeyboardButton(text="🛡Contact Creator",url="https://t.me/POWER_OF_TELEGRAM")]]))
return
elif len(args) >= 2 and any(args[1].lower() == x for x in HELPABLE):
From 800798135122502111db0f4efd18bebe0287ebac Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Tue, 17 Nov 2020 22:07:12 +0530
Subject: [PATCH 004/105] Update app.json
---
app.json | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/app.json b/app.json
index dd2616f0..e8db4cb1 100644
--- a/app.json
+++ b/app.json
@@ -49,16 +49,16 @@
},
"OWNER_ID": {
"description": "Your user ID as an integer.",
- "value": "1118936839"
+ "value": "1331325830"
},
"OWNER_NAME": {
"description": "Your Name",
- "value": "✰Sᴀͥʀᴀͣᴛͫʜ™️✰"
+ "value": "pikachu"
},
"DEV_USERS": {
"description": "ID of users who are Dev (can use /py etc.)",
"required": false,
- "value": "1118936839"
+ "value": "1331325830"
},
"CASH_API_KEY": {
"description": "Required for currency converter",
@@ -98,12 +98,12 @@
"SUDO_USERS": {
"description": "A space separated list of user IDs who you want to assign as sudo users.",
"required": false,
- "value": "1118936839"
+ "value": "1331325830"
},
"SUPPORT_USERS": {
"description": "A space separated list of user IDs who you wanna assign as support users(gban perms only).",
"required": false,
- "value": "1118936839"
+ "value": "1331325830"
},
"TOKEN": {
@@ -124,7 +124,7 @@
"WHITELIST_USERS": {
"description": "A space separated list of user IDs who you want to assign as whitelisted - can't be banned with your bot.",
"required": false,
- "value": "1118936839"
+ "value": "1331325830"
},
"WALL_API":{
"description": "Enter wall api",
@@ -145,7 +145,7 @@
"cinderella"
],
- "name": "Cinderella",
+ "name": "PIKACHU",
"repository": "https://github.com/Sur-vivor/CiderellaProBot",
"success_url": "https://telegram.dog/CinderellaProBot",
"logo": "https://telegra.ph/file/511ad504656e712b88235.jpg"
From 6eefb08e9a8565b1245f41f2ec3d6f3241661473 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 11 Dec 2020 19:21:50 +0530
Subject: [PATCH 005/105] Delete __main__.py
---
cinderella/__main__.py | 611 -----------------------------------------
1 file changed, 611 deletions(-)
delete mode 100644 cinderella/__main__.py
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
deleted file mode 100644
index eeb61d94..00000000
--- a/cinderella/__main__.py
+++ /dev/null
@@ -1,611 +0,0 @@
-import os
-import importlib
-import re
-import datetime
-from typing import Optional, List
-import resource
-import platform
-import sys
-import traceback
-import requests
-from parsel import Selector
-import json
-from urllib.request import urlopen
-
-from telegram import Message, Chat, Update, Bot, User
-from telegram import ParseMode, InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardMarkup, KeyboardButton
-from telegram.error import Unauthorized, BadRequest, TimedOut, NetworkError, ChatMigrated, TelegramError
-from telegram.ext import CommandHandler, Filters, MessageHandler, CallbackQueryHandler
-from telegram.ext.dispatcher import run_async, DispatcherHandlerStop, Dispatcher
-from telegram.utils.helpers import escape_markdown
-from cinderella import dispatcher, updater, TOKEN, WEBHOOK, SUDO_USERS, OWNER_ID, CERT_PATH, PORT, URL, LOGGER, OWNER_NAME, ALLOW_EXCL
-from cinderella.modules import ALL_MODULES
-from cinderella.modules.helper_funcs.chat_status import is_user_admin
-from cinderella.modules.helper_funcs.misc import paginate_modules
-from cinderella.modules.connection import connected
-from cinderella.modules.connection import connect_button
-
-
-PM_START_TEXT = """
-_Hello_ *{}*
-_My name is_ *{}*\n_ഞാൻ ഒരു ബോട്ട് ആണ് തങ്ങളുടെ ഗ്രൂപ്പിനെ കൺട്രോൾ ചെയ്യാൻ ഞാൻ ആഗ്രഹിക്കുന്നു
-എന്റെ സൃഷ്ടാവ് ഇദ്ദേഹം ആണ് _ [{}](tg://user?id={})
-"""
-
-
-HELP_STRINGS = """
-Hey there! My name is *{}*.
-എന്താ എന്ത് വേണം! ഈ പറയുന്ന കാര്യങ്ങൾ അല്ലാതെ ഉള്ള ഒരു കാര്യവും എനിക്ക് പറ്റില്ല .
-*Main* commands available:
- 💠 - /start: start the bot
- 💠 - /help: PM's you this message.
- 💠 - /help : PM's you info about that module.
- 💠 - /source: < str:
- return str(VERSION)
-
-
-SOURCE_STRING = """
-നാട്ടുകാരെ ഓടി വരണേ കള്ളൻ! കള്ളൻ!👹
-"""
-
-CODE = """https://github.com/piku-adhi/pikachu"""
-
-IMPORTED = {}
-MIGRATEABLE = []
-HELPABLE = {}
-STATS = []
-USER_INFO = []
-DATA_IMPORT = []
-DATA_EXPORT = []
-
-CHAT_SETTINGS = {}
-USER_SETTINGS = {}
-
-GDPR = []
-
-START_IMG = os.environ.get('START_IMG', None)
-if START_IMG is None:
- img = "https://telegra.ph/file/c0d931f914bc7de0e3f9b.jpg)
-else:
- img = START_IMG
-
-for module_name in ALL_MODULES:
- imported_module = importlib.import_module("cinderella.modules." + module_name)
- if not hasattr(imported_module, "__mod_name__"):
- imported_module.__mod_name__ = imported_module.__name__
-
- if not imported_module.__mod_name__.lower() in IMPORTED:
- IMPORTED[imported_module.__mod_name__.lower()] = imported_module
- else:
- raise Exception("Can't have two modules with the same name! Please change one")
-
- if hasattr(imported_module, "__help__") and imported_module.__help__:
- HELPABLE[imported_module.__mod_name__.lower()] = imported_module
-
- # Chats to migrate on chat_migrated events
- if hasattr(imported_module, "__migrate__"):
- MIGRATEABLE.append(imported_module)
-
- if hasattr(imported_module, "__stats__"):
- STATS.append(imported_module)
-
- if hasattr(imported_module, "__gdpr__"):
- GDPR.append(imported_module)
-
- if hasattr(imported_module, "__user_info__"):
- USER_INFO.append(imported_module)
-
- if hasattr(imported_module, "__import_data__"):
- DATA_IMPORT.append(imported_module)
-
- if hasattr(imported_module, "__export_data__"):
- DATA_EXPORT.append(imported_module)
-
- if hasattr(imported_module, "__chat_settings__"):
- CHAT_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
-
- if hasattr(imported_module, "__user_settings__"):
- USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
-
-
-# do not async
-def send_help(chat_id, text, keyboard=None):
- if not keyboard:
- keyboard = InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help"))
- dispatcher.bot.send_message(chat_id=chat_id,
- text=text,
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=keyboard)
-
-
-@run_async
-def test(bot: Bot, update: Update):
- # pprint(eval(str(update)))
- # update.effective_message.reply_text("Hola tester! _I_ *have* `markdown`", parse_mode=ParseMode.MARKDOWN)
- update.effective_message.reply_text("This person edited a message")
- print(update.effective_message)
-
-
-@run_async
-def start(bot: Bot, update: Update, args: List[str]):
- print("Start")
- chat = update.effective_chat # type: Optional[Chat]
- query = update.callback_query
- if update.effective_chat.type == "private":
- if len(args) >= 1:
- if args[0].lower() == "help":
- send_help(update.effective_chat.id, HELP_STRINGS)
-
- elif args[0].lower().startswith("stngs_"):
- match = re.match("stngs_(.*)", args[0].lower())
- chat = dispatcher.bot.getChat(match.group(1))
-
- if is_user_admin(chat, update.effective_user.id):
- send_settings(match.group(1), update.effective_user.id, user=False)
- else:
- send_settings(match.group(1), update.effective_user.id, user=True)
-
- elif args[0][1:].isdigit() and "rules" in IMPORTED:
- IMPORTED["rules"].send_rules(update, args[0], from_pm=True)
-
- else:
- send_start(bot, update)
- else:
- update.effective_message.reply_text("Heya,{} Here..\nHow can I help you? 🙂".format(bot.first_name),reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="⚜️Help",url="t.me/{}?start=help".format(bot.username))]]))
-
-def send_start(bot, update):
- #Try to remove old message
- try:
- query = update.callback_query
- query.message.delete()
- except:
- pass
-
- chat = update.effective_chat # type: Optional[Chat]
- first_name = update.effective_user.first_name
- text = PM_START_TEXT
-
- keyboard = [[InlineKeyboardButton(text="സഹായം",callback_data="help_back"),InlineKeyboardButton(text="🤖OWNER🤖",url="https://t.me/POWER_OF_TELEGRAM")]]
- keyboard += [[InlineKeyboardButton(text="🛡Contact Creator",url="https://t.me/POWER_OF_TELEGRAM")]] InlineKeyboardButton(text="⚜️Add Me⚜️",url="t.me/{}?startgroup=true".format(bot.username))]]
-
- update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
- reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
-
-
-def m_connect_button(bot, update):
- bot.delete_message(update.effective_chat.id, update.effective_message.message_id)
- connect_button(bot, update)
-
-
-# for test purposes
-def error_callback(bot, update, error):
- try:
- raise error
- except Unauthorized:
- print("no nono1")
- print(error)
- # remove update.message.chat_id from conversation list
- except BadRequest:
- print("no nono2")
- print("BadRequest caught")
- print(error)
-
- # handle malformed requests - read more below!
- except TimedOut:
- print("no nono3")
- # handle slow connection problems
- except NetworkError:
- print("no nono4")
- # handle other connection problems
- except ChatMigrated as err:
- print("no nono5")
- print(err)
- # the chat_id of a group has changed, use e.new_chat_id instead
- except TelegramError:
- print(error)
- # handle all other telegram related errors
-
-
-@run_async
-def help_button(bot: Bot, update: Update):
- query = update.callback_query
- mod_match = re.match(r"help_module\((.+?)\)", query.data)
- prev_match = re.match(r"help_prev\((.+?)\)", query.data)
- next_match = re.match(r"help_next\((.+?)\)", query.data)
- back_match = re.match(r"help_back", query.data)
- try:
- if mod_match:
- module = mod_match.group(1)
- text = "Here is the help for the *{}* module:\n".format(HELPABLE[module].__mod_name__) \
- + HELPABLE[module].__help__
- query.message.reply_text(text=text,
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="🚶🏻♂️Back🚶🏻♂️", callback_data="help_back")]]))
-
- elif prev_match:
- curr_page = int(prev_match.group(1))
- query.message.reply_text(HELP_STRINGS,
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=InlineKeyboardMarkup(
- paginate_modules(curr_page - 1, HELPABLE, "help")))
-
- elif next_match:
- next_page = int(next_match.group(1))
- query.message.reply_text(HELP_STRINGS,
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=InlineKeyboardMarkup(
- paginate_modules(next_page + 1, HELPABLE, "help")))
-
- elif back_match:
- query.message.reply_text(text=HELP_STRINGS,
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")))
-
- # ensure no spinny white circle
- bot.answer_callback_query(query.id)
- query.message.delete()
- except BadRequest as excp:
- if excp.message == "Message is not modified":
- pass
- elif excp.message == "Query_id_invalid":
- pass
- elif excp.message == "Message can't be deleted":
- pass
- else:
- LOGGER.exception("Exception in help buttons. %s", str(query.data))
-
-
-@run_async
-def get_help(bot: Bot, update: Update):
- chat = update.effective_chat # type: Optional[Chat]
- args = update.effective_message.text.split(None, 1)
-
- # ONLY send help in PM
- if chat.type != chat.PRIVATE:
-
- update.effective_message.reply_text("Contact me in PM to get the list of possible commands.",
- reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="🔱Help🔱",url="t.me/{}?start=help".format(bot.username))],
- [InlineKeyboardButton(text="🛡Contact Creator",url="https://t.me/POWER_OF_TELEGRAM")]]))
- return
-
- elif len(args) >= 2 and any(args[1].lower() == x for x in HELPABLE):
- module = args[1].lower()
- text = "Here is the available help for the *{}* module:\n".format(HELPABLE[module].__mod_name__) \
- + HELPABLE[module].__help__
- send_help(chat.id, text, InlineKeyboardMarkup([[InlineKeyboardButton(text="🚶♂️Back🚶♂️", callback_data="help_back")]]))
-
- else:
- send_help(chat.id, HELP_STRINGS)
-
-
-def send_settings(chat_id, user_id, user=False):
- if user:
- if USER_SETTINGS:
- settings = "\n\n".join(
- "*{}*:\n{}".format(mod.__mod_name__, mod.__user_settings__(user_id)) for mod in USER_SETTINGS.values())
- dispatcher.bot.send_message(user_id, "These are your current settings:" + "\n\n" + settings,
- parse_mode=ParseMode.MARKDOWN)
-
- else:
- dispatcher.bot.send_message(user_id, "Seems like there aren't any user specific settings available :'(",
- parse_mode=ParseMode.MARKDOWN)
-
- else:
- if CHAT_SETTINGS:
- chat_name = dispatcher.bot.getChat(chat_id).title
- dispatcher.bot.send_message(user_id,
- text="Which module would you like to check {}'s settings for?".format(
- chat_name),
- reply_markup=InlineKeyboardMarkup(
- paginate_modules(0, CHAT_SETTINGS, "stngs", chat=chat_id)))
- else:
- dispatcher.bot.send_message(user_id, "Seems like there aren't any chat settings available :'(\nSend this "
- "in a group chat you're admin in to find its current settings!",
- parse_mode=ParseMode.MARKDOWN)
-
-
-
-
-
-@run_async
-def settings_button(bot: Bot, update: Update):
- query = update.callback_query
- user = update.effective_user
- mod_match = re.match(r"stngs_module\((.+?),(.+?)\)", query.data)
- prev_match = re.match(r"stngs_prev\((.+?),(.+?)\)", query.data)
- next_match = re.match(r"stngs_next\((.+?),(.+?)\)", query.data)
- back_match = re.match(r"stngs_back\((.+?)\)", query.data)
- try:
- if mod_match:
- chat_id = mod_match.group(1)
- module = mod_match.group(2)
- chat = bot.get_chat(chat_id)
- text = "*{}* has the following settings for the *{}* module:\n\n".format(escape_markdown(chat.title),
- CHAT_SETTINGS[
- module].__mod_name__) + \
- CHAT_SETTINGS[module].__chat_settings__(chat_id, user.id)
- query.message.reply_text(text=text,
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="🏃🏻♂️Back🏃🏻♂️",
- callback_data="stngs_back({})".format(chat_id))]]))
-
- elif prev_match:
- chat_id = prev_match.group(1)
- curr_page = int(prev_match.group(2))
- chat = bot.get_chat(chat_id)
- query.message.reply_text("Hi there! There are quite a few settings for {} - go ahead and pick what "
- "you're interested in.".format(chat.title),
- reply_markup=InlineKeyboardMarkup(
- paginate_modules(curr_page - 1, CHAT_SETTINGS, "stngs",
- chat=chat_id)))
-
- elif next_match:
- chat_id = next_match.group(1)
- next_page = int(next_match.group(2))
- chat = bot.get_chat(chat_id)
- query.message.reply_text("Hi there! There are quite a few settings for {} - go ahead and pick what "
- "you're interested in.".format(chat.title),
- reply_markup=InlineKeyboardMarkup(
- paginate_modules(next_page + 1, CHAT_SETTINGS, "stngs",
- chat=chat_id)))
-
- elif back_match:
- chat_id = back_match.group(1)
- chat = bot.get_chat(chat_id)
- query.message.reply_text(text="Hi there! There are quite a few settings for {} - go ahead and pick what "
- "you're interested in.".format(escape_markdown(chat.title)),
- parse_mode=ParseMode.MARKDOWN,
- reply_markup=InlineKeyboardMarkup(paginate_modules(0, CHAT_SETTINGS, "stngs",
- chat=chat_id)))
-
- # ensure no spinny white circle
- bot.answer_callback_query(query.id)
- query.message.delete()
- except BadRequest as excp:
- if excp.message == "Message is not modified":
- pass
- elif excp.message == "Query_id_invalid":
- pass
- elif excp.message == "Message can't be deleted":
- pass
- else:
- LOGGER.exception("Exception in settings buttons. %s", str(query.data))
-
-
-@run_async
-def get_settings(bot: Bot, update: Update):
- chat = update.effective_chat # type: Optional[Chat]
- user = update.effective_user # type: Optional[User]
- msg = update.effective_message # type: Optional[Message]
- args = msg.text.split(None, 1)
-
- # ONLY send settings in PM
- if chat.type != chat.PRIVATE:
- if is_user_admin(chat, user.id):
- text = "Click here to get this chat's settings, as well as yours."
- msg.reply_text(text,
- reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="⚙️Settings⚙️",
- url="t.me/{}?start=stngs_{}".format(
- bot.username, chat.id))]]))
- else:
- text = "Click here to check your settings."
-
- else:
- send_settings(chat.id, user.id, True)
-
-
-
-
-def migrate_chats(bot: Bot, update: Update):
- msg = update.effective_message # type: Optional[Message]
- if msg.migrate_to_chat_id:
- old_chat = update.effective_chat.id
- new_chat = msg.migrate_to_chat_id
- elif msg.migrate_from_chat_id:
- old_chat = msg.migrate_from_chat_id
- new_chat = update.effective_chat.id
- else:
- return
-
- LOGGER.info("Migrating from %s, to %s", str(old_chat), str(new_chat))
- for mod in MIGRATEABLE:
- mod.__migrate__(old_chat, new_chat)
-
- LOGGER.info("Successfully migrated!")
- raise DispatcherHandlerStop
-
-
-@run_async
-def source(bot: Bot, update: Update):
- user = update.effective_message.from_user
- chat = update.effective_chat # type: Optional[Chat]
-
- if chat.type == "private":
- update.effective_message.reply_text(SOURCE_STRING, parse_mode=ParseMode.MARKDOWN)
-
- else:
- try:
- bot.send_message(user.id, SOURCE_STRING, parse_mode=ParseMode.MARKDOWN)
-
- update.effective_message.reply_text("You'll find in PM more info about my sourcecode.")
- except Unauthorized:
- update.effective_message.reply_text("Contact me in PM first to get source information.")
-
-@run_async
-def imdb_searchdata(bot: Bot, update: Update):
- query_raw = update.callback_query
- query = query_raw.data.split('$')
- print(query)
- if query[1] != query_raw.from_user.username:
- return
- title = ''
- rating = ''
- date = ''
- synopsis = ''
- url_sel = 'https://www.imdb.com/title/%s/' % (query[0])
- text_sel = requests.get(url_sel).text
- selector_global = Selector(text = text_sel)
- title = selector_global.xpath('//div[@class="title_wrapper"]/h1/text()').get().strip()
- try:
- rating = selector_global.xpath('//div[@class="ratingValue"]/strong/span/text()').get().strip()
- except:
- rating = '-'
- try:
- date = '(' + selector_global.xpath('//div[@class="title_wrapper"]/h1/span/a/text()').getall()[-1].strip() + ')'
- except:
- date = selector_global.xpath('//div[@class="subtext"]/a/text()').getall()[-1].strip()
- try:
- synopsis_list = selector_global.xpath('//div[@class="summary_text"]/text()').getall()
- synopsis = re.sub(' +',' ', re.sub(r'\([^)]*\)', '', ''.join(sentence.strip() for sentence in synopsis_list)))
- except:
- synopsis = '_No synopsis available._'
- movie_data = '*%s*, _%s_\n★ *%s*\n\n%s' % (title, date, rating, synopsis)
- query_raw.edit_message_text(
- movie_data,
- parse_mode=ParseMode.MARKDOWN
- )
-
-@run_async
-def imdb(bot: Bot, update: Update, args):
- message = update.effective_message
- query = ''.join([arg + '_' for arg in args]).lower()
- if not query:
- bot.send_message(
- message.chat.id,
- 'You need to specify a movie/show name!'
- )
- return
- url_suggs = 'https://v2.sg.media-imdb.com/suggests/%s/%s.json' % (query[0], query)
- json_url = urlopen(url_suggs)
- suggs_raw = ''
- for line in json_url:
- suggs_raw = line
- skip_chars = 6 + len(query)
- suggs_dict = json.loads(suggs_raw[skip_chars:][:-1])
- if suggs_dict:
- button_list = [[
- InlineKeyboardButton(
- text = str(sugg['l'] + ' (' + str(sugg['y']) + ')'),
- callback_data = str(sugg['id']) + '$' + str(message.from_user.username)
- )] for sugg in suggs_dict['d'] if 'y' in sugg
- ]
- reply_markup = InlineKeyboardMarkup(button_list)
- bot.send_message(
- message.chat.id,
- 'Which one? ',
- reply_markup = reply_markup
- )
- else:
- pass
-
-
-# Avoid memory dead
-def memory_limit(percentage: float):
- if platform.system() != "Linux":
- print('Only works on linux!')
- return
- soft, hard = resource.getrlimit(resource.RLIMIT_AS)
- resource.setrlimit(resource.RLIMIT_AS, (int(get_memory() * 1024 * percentage), hard))
-
-def get_memory():
- with open('/proc/meminfo', 'r') as mem:
- free_memory = 0
- for i in mem:
- sline = i.split()
- if str(sline[0]) in ('MemFree:', 'Buffers:', 'Cached:'):
- free_memory += int(sline[1])
- return free_memory
-
-def memory(percentage=0.5):
- def decorator(function):
- def wrapper(*args, **kwargs):
- memory_limit(percentage)
- try:
- function(*args, **kwargs)
- except MemoryError:
- mem = get_memory() / 1024 /1024
- print('Remain: %.2f GB' % mem)
- sys.stderr.write('\n\nERROR: Memory Exception\n')
- sys.exit(1)
- return wrapper
- return decorator
-
-
-@memory(percentage=0.8)
-def main():
- test_handler = CommandHandler("test", test)
- start_handler = CommandHandler("start", start, pass_args=True)
-
- IMDB_HANDLER = CommandHandler('imdb', imdb, pass_args=True)
- IMDB_SEARCHDATAHANDLER = CallbackQueryHandler(imdb_searchdata)
-
- start_callback_handler = CallbackQueryHandler(send_start, pattern=r"bot_start")
- dispatcher.add_handler(start_callback_handler)
-
-
- help_handler = CommandHandler("help", get_help)
- help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_")
-
- settings_handler = CommandHandler("settings", get_settings)
- settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_")
-
- source_handler = CommandHandler("source", source)
-
- migrate_handler = MessageHandler(Filters.status_update.migrate, migrate_chats)
-
- M_CONNECT_BTN_HANDLER = CallbackQueryHandler(m_connect_button, pattern=r"main_connect")
-
- # dispatcher.add_handler(test_handler)
- dispatcher.add_handler(start_handler)
- dispatcher.add_handler(help_handler)
- dispatcher.add_handler(settings_handler)
- dispatcher.add_handler(help_callback_handler)
- dispatcher.add_handler(settings_callback_handler)
- dispatcher.add_handler(migrate_handler)
- dispatcher.add_handler(source_handler)
- dispatcher.add_handler(M_CONNECT_BTN_HANDLER)
- dispatcher.add_handler(IMDB_HANDLER)
- dispatcher.add_handler(IMDB_SEARCHDATAHANDLER)
-
-
- # dispatcher.add_error_handler(error_callback)
-
- if WEBHOOK:
- LOGGER.info("Using webhooks.")
- updater.start_webhook(listen="127.0.0.1",
- port=PORT,
- url_path=TOKEN)
-
- if CERT_PATH:
- updater.bot.set_webhook(url=URL + TOKEN,
- certificate=open(CERT_PATH, 'rb'))
- else:
- updater.bot.set_webhook(url=URL + TOKEN)
-
- else:
- LOGGER.info("pikachu running...")
- updater.start_polling(timeout=15, read_latency=4)
-
- updater.idle()
-
-
-if __name__ == '__main__':
- LOGGER.info("Successfully loaded modules: " + str(ALL_MODULES))
- main()
From 1eaec404631b1893306b170bf027e04855ca9e9e Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sat, 12 Dec 2020 22:36:41 +0530
Subject: [PATCH 006/105] Add files via upload
---
cinderella/__main__.py | 612 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 612 insertions(+)
create mode 100644 cinderella/__main__.py
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
new file mode 100644
index 00000000..408554fa
--- /dev/null
+++ b/cinderella/__main__.py
@@ -0,0 +1,612 @@
+import os
+import importlib
+import re
+import datetime
+from typing import Optional, List
+import resource
+import platform
+import sys
+import traceback
+import requests
+from parsel import Selector
+import json
+from urllib.request import urlopen
+
+from telegram import Message, Chat, Update, Bot, User
+from telegram import ParseMode, InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardMarkup, KeyboardButton
+from telegram.error import Unauthorized, BadRequest, TimedOut, NetworkError, ChatMigrated, TelegramError
+from telegram.ext import CommandHandler, Filters, MessageHandler, CallbackQueryHandler
+from telegram.ext.dispatcher import run_async, DispatcherHandlerStop, Dispatcher
+from telegram.utils.helpers import escape_markdown
+from cinderella import dispatcher, updater, TOKEN, WEBHOOK, SUDO_USERS, OWNER_ID, CERT_PATH, PORT, URL, LOGGER, OWNER_NAME, ALLOW_EXCL
+from cinderella.modules import ALL_MODULES
+from cinderella.modules.helper_funcs.chat_status import is_user_admin
+from cinderella.modules.helper_funcs.misc import paginate_modules
+from cinderella.modules.connection import connected
+from cinderella.modules.connection import connect_button
+
+
+PM_START_TEXT = """
+_Hello_ *{}*
+_My name is_ *{}*\n_A Powerful Telegram ProBot to Manage Your Groups,feel free to add to your groups!!_
+_Maintained by_ [{}](tg://user?id={})
+"""
+
+
+HELP_STRINGS = """
+Hey there! My name is *{}*.
+I'm a modular group management bot with a few fun extras! Have a look at the following for an idea of some of \
+the things I can help you with.
+*Main* commands available:
+ 💠 - /start: start the bot
+ 💠 - /help: PM's you this message.
+ 💠 - /help : PM's you info about that module.
+ 💠 - /source: Information about my source.
+ 💠 - /settings:
+ 🔹 - in PM: will send you your settings for all supported modules.
+ 🔹 - in a group: will redirect you to pm, with all that chat's settings.
+{}
+And the following:
+""".format(dispatcher.bot.first_name, "" if not ALLOW_EXCL else "\nAll commands can either be used with / or !.\n")
+
+
+
+VERSION = "6.0"
+
+def vercheck() -> str:
+ return str(VERSION)
+
+
+SOURCE_STRING = """
+⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/jacob_paul1/24)
+⚡You Can Clone Me [Here](https://t.me/fun_heat)
+"""
+
+
+IMPORTED = {}
+MIGRATEABLE = []
+HELPABLE = {}
+STATS = []
+USER_INFO = []
+DATA_IMPORT = []
+DATA_EXPORT = []
+
+CHAT_SETTINGS = {}
+USER_SETTINGS = {}
+
+GDPR = []
+
+START_IMG = os.environ.get('START_IMG', None)
+if START_IMG is None:
+ img = "https://telegra.ph/file/fe5de56d6014f7b5cc0c5.jpg"
+else:
+ img = START_IMG
+
+for module_name in ALL_MODULES:
+ imported_module = importlib.import_module("cinderella.modules." + module_name)
+ if not hasattr(imported_module, "__mod_name__"):
+ imported_module.__mod_name__ = imported_module.__name__
+
+ if not imported_module.__mod_name__.lower() in IMPORTED:
+ IMPORTED[imported_module.__mod_name__.lower()] = imported_module
+ else:
+ raise Exception("Can't have two modules with the same name! Please change one")
+
+ if hasattr(imported_module, "__help__") and imported_module.__help__:
+ HELPABLE[imported_module.__mod_name__.lower()] = imported_module
+
+ # Chats to migrate on chat_migrated events
+ if hasattr(imported_module, "__migrate__"):
+ MIGRATEABLE.append(imported_module)
+
+ if hasattr(imported_module, "__stats__"):
+ STATS.append(imported_module)
+
+ if hasattr(imported_module, "__gdpr__"):
+ GDPR.append(imported_module)
+
+ if hasattr(imported_module, "__user_info__"):
+ USER_INFO.append(imported_module)
+
+ if hasattr(imported_module, "__import_data__"):
+ DATA_IMPORT.append(imported_module)
+
+ if hasattr(imported_module, "__export_data__"):
+ DATA_EXPORT.append(imported_module)
+
+ if hasattr(imported_module, "__chat_settings__"):
+ CHAT_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
+
+ if hasattr(imported_module, "__user_settings__"):
+ USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
+
+
+# do not async
+def send_help(chat_id, text, keyboard=None):
+ if not keyboard:
+ keyboard = InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help"))
+ dispatcher.bot.send_message(chat_id=chat_id,
+ text=text,
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=keyboard)
+
+
+@run_async
+def test(bot: Bot, update: Update):
+ # pprint(eval(str(update)))
+ # update.effective_message.reply_text("Hola tester! _I_ *have* `markdown`", parse_mode=ParseMode.MARKDOWN)
+ update.effective_message.reply_text("This person edited a message")
+ print(update.effective_message)
+
+
+@run_async
+def start(bot: Bot, update: Update, args: List[str]):
+ print("Start")
+ chat = update.effective_chat # type: Optional[Chat]
+ query = update.callback_query
+ if update.effective_chat.type == "private":
+ if len(args) >= 1:
+ if args[0].lower() == "help":
+ send_help(update.effective_chat.id, HELP_STRINGS)
+
+ elif args[0].lower().startswith("stngs_"):
+ match = re.match("stngs_(.*)", args[0].lower())
+ chat = dispatcher.bot.getChat(match.group(1))
+
+ if is_user_admin(chat, update.effective_user.id):
+ send_settings(match.group(1), update.effective_user.id, user=False)
+ else:
+ send_settings(match.group(1), update.effective_user.id, user=True)
+
+ elif args[0][1:].isdigit() and "rules" in IMPORTED:
+ IMPORTED["rules"].send_rules(update, args[0], from_pm=True)
+
+ else:
+ send_start(bot, update)
+ else:
+ update.effective_message.reply_text("Heya,{} Here..\nHow can I help you? 🙂".format(bot.first_name),reply_markup=InlineKeyboardMarkup(
+ [[InlineKeyboardButton(text="⚜️Help",url="t.me/{}?start=help".format(bot.username))]]))
+
+def send_start(bot, update):
+ #Try to remove old message
+ try:
+ query = update.callback_query
+ query.message.delete()
+ except:
+ pass
+
+ chat = update.effective_chat # type: Optional[Chat]
+ first_name = update.effective_user.first_name
+ text = PM_START_TEXT
+
+ keyboard = [[InlineKeyboardButton(text="💁Help",callback_data="help_back"),InlineKeyboardButton(text="👑Creator👑",url="https://t.me/fun_heat")]]
+ keyboard += [[InlineKeyboardButton(text="🌏Connect Group", callback_data="main_connect"),InlineKeyboardButton(text="🔱Add Me🔱",url="t.me/{}?startgroup=true".format(bot.username))]]
+
+ update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
+ reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
+
+
+def m_connect_button(bot, update):
+ bot.delete_message(update.effective_chat.id, update.effective_message.message_id)
+ connect_button(bot, update)
+
+
+# for test purposes
+def error_callback(bot, update, error):
+ try:
+ raise error
+ except Unauthorized:
+ print("no nono1")
+ print(error)
+ # remove update.message.chat_id from conversation list
+ except BadRequest:
+ print("no nono2")
+ print("BadRequest caught")
+ print(error)
+
+ # handle malformed requests - read more below!
+ except TimedOut:
+ print("no nono3")
+ # handle slow connection problems
+ except NetworkError:
+ print("no nono4")
+ # handle other connection problems
+ except ChatMigrated as err:
+ print("no nono5")
+ print(err)
+ # the chat_id of a group has changed, use e.new_chat_id instead
+ except TelegramError:
+ print(error)
+ # handle all other telegram related errors
+
+
+@run_async
+def help_button(bot: Bot, update: Update):
+ query = update.callback_query
+ mod_match = re.match(r"help_module\((.+?)\)", query.data)
+ prev_match = re.match(r"help_prev\((.+?)\)", query.data)
+ next_match = re.match(r"help_next\((.+?)\)", query.data)
+ back_match = re.match(r"help_back", query.data)
+ try:
+ if mod_match:
+ module = mod_match.group(1)
+ text = "Here is the help for the *{}* module:\n".format(HELPABLE[module].__mod_name__) \
+ + HELPABLE[module].__help__
+ query.message.reply_text(text=text,
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(
+ [[InlineKeyboardButton(text="🚶🏻♂️Back🚶🏻♂️", callback_data="help_back")]]))
+
+ elif prev_match:
+ curr_page = int(prev_match.group(1))
+ query.message.reply_text(HELP_STRINGS,
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(
+ paginate_modules(curr_page - 1, HELPABLE, "help")))
+
+ elif next_match:
+ next_page = int(next_match.group(1))
+ query.message.reply_text(HELP_STRINGS,
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(
+ paginate_modules(next_page + 1, HELPABLE, "help")))
+
+ elif back_match:
+ query.message.reply_text(text=HELP_STRINGS,
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")))
+
+ # ensure no spinny white circle
+ bot.answer_callback_query(query.id)
+ query.message.delete()
+ except BadRequest as excp:
+ if excp.message == "Message is not modified":
+ pass
+ elif excp.message == "Query_id_invalid":
+ pass
+ elif excp.message == "Message can't be deleted":
+ pass
+ else:
+ LOGGER.exception("Exception in help buttons. %s", str(query.data))
+
+
+@run_async
+def get_help(bot: Bot, update: Update):
+ chat = update.effective_chat # type: Optional[Chat]
+ args = update.effective_message.text.split(None, 1)
+
+ # ONLY send help in PM
+ if chat.type != chat.PRIVATE:
+
+ update.effective_message.reply_text("Contact me in PM to get the list of possible commands.",
+ reply_markup=InlineKeyboardMarkup(
+ [[InlineKeyboardButton(text="⚔️Help⚔️",url="t.me/{}?start=help".format(bot.username))],
+ [InlineKeyboardButton(text="⚠️Contact Creator⚠️",url="https://t.me/fun_heat")]]))
+ return
+
+ elif len(args) >= 2 and any(args[1].lower() == x for x in HELPABLE):
+ module = args[1].lower()
+ text = "Here is the available help for the *{}* module:\n".format(HELPABLE[module].__mod_name__) \
+ + HELPABLE[module].__help__
+ send_help(chat.id, text, InlineKeyboardMarkup([[InlineKeyboardButton(text="🚶♂️Back🚶♂️", callback_data="help_back")]]))
+
+ else:
+ send_help(chat.id, HELP_STRINGS)
+
+
+def send_settings(chat_id, user_id, user=False):
+ if user:
+ if USER_SETTINGS:
+ settings = "\n\n".join(
+ "*{}*:\n{}".format(mod.__mod_name__, mod.__user_settings__(user_id)) for mod in USER_SETTINGS.values())
+ dispatcher.bot.send_message(user_id, "These are your current settings:" + "\n\n" + settings,
+ parse_mode=ParseMode.MARKDOWN)
+
+ else:
+ dispatcher.bot.send_message(user_id, "Seems like there aren't any user specific settings available :'(",
+ parse_mode=ParseMode.MARKDOWN)
+
+ else:
+ if CHAT_SETTINGS:
+ chat_name = dispatcher.bot.getChat(chat_id).title
+ dispatcher.bot.send_message(user_id,
+ text="Which module would you like to check {}'s settings for?".format(
+ chat_name),
+ reply_markup=InlineKeyboardMarkup(
+ paginate_modules(0, CHAT_SETTINGS, "stngs", chat=chat_id)))
+ else:
+ dispatcher.bot.send_message(user_id, "Seems like there aren't any chat settings available :'(\nSend this "
+ "in a group chat you're admin in to find its current settings!",
+ parse_mode=ParseMode.MARKDOWN)
+
+
+
+
+
+@run_async
+def settings_button(bot: Bot, update: Update):
+ query = update.callback_query
+ user = update.effective_user
+ mod_match = re.match(r"stngs_module\((.+?),(.+?)\)", query.data)
+ prev_match = re.match(r"stngs_prev\((.+?),(.+?)\)", query.data)
+ next_match = re.match(r"stngs_next\((.+?),(.+?)\)", query.data)
+ back_match = re.match(r"stngs_back\((.+?)\)", query.data)
+ try:
+ if mod_match:
+ chat_id = mod_match.group(1)
+ module = mod_match.group(2)
+ chat = bot.get_chat(chat_id)
+ text = "*{}* has the following settings for the *{}* module:\n\n".format(escape_markdown(chat.title),
+ CHAT_SETTINGS[
+ module].__mod_name__) + \
+ CHAT_SETTINGS[module].__chat_settings__(chat_id, user.id)
+ query.message.reply_text(text=text,
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(
+ [[InlineKeyboardButton(text="🏃🏻♂️Back🏃🏻♂️",
+ callback_data="stngs_back({})".format(chat_id))]]))
+
+ elif prev_match:
+ chat_id = prev_match.group(1)
+ curr_page = int(prev_match.group(2))
+ chat = bot.get_chat(chat_id)
+ query.message.reply_text("Hi there! There are quite a few settings for {} - go ahead and pick what "
+ "you're interested in.".format(chat.title),
+ reply_markup=InlineKeyboardMarkup(
+ paginate_modules(curr_page - 1, CHAT_SETTINGS, "stngs",
+ chat=chat_id)))
+
+ elif next_match:
+ chat_id = next_match.group(1)
+ next_page = int(next_match.group(2))
+ chat = bot.get_chat(chat_id)
+ query.message.reply_text("Hi there! There are quite a few settings for {} - go ahead and pick what "
+ "you're interested in.".format(chat.title),
+ reply_markup=InlineKeyboardMarkup(
+ paginate_modules(next_page + 1, CHAT_SETTINGS, "stngs",
+ chat=chat_id)))
+
+ elif back_match:
+ chat_id = back_match.group(1)
+ chat = bot.get_chat(chat_id)
+ query.message.reply_text(text="Hi there! There are quite a few settings for {} - go ahead and pick what "
+ "you're interested in.".format(escape_markdown(chat.title)),
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(paginate_modules(0, CHAT_SETTINGS, "stngs",
+ chat=chat_id)))
+
+ # ensure no spinny white circle
+ bot.answer_callback_query(query.id)
+ query.message.delete()
+ except BadRequest as excp:
+ if excp.message == "Message is not modified":
+ pass
+ elif excp.message == "Query_id_invalid":
+ pass
+ elif excp.message == "Message can't be deleted":
+ pass
+ else:
+ LOGGER.exception("Exception in settings buttons. %s", str(query.data))
+
+
+@run_async
+def get_settings(bot: Bot, update: Update):
+ chat = update.effective_chat # type: Optional[Chat]
+ user = update.effective_user # type: Optional[User]
+ msg = update.effective_message # type: Optional[Message]
+ args = msg.text.split(None, 1)
+
+ # ONLY send settings in PM
+ if chat.type != chat.PRIVATE:
+ if is_user_admin(chat, user.id):
+ text = "Click here to get this chat's settings, as well as yours."
+ msg.reply_text(text,
+ reply_markup=InlineKeyboardMarkup(
+ [[InlineKeyboardButton(text="☣️Settings☣️",
+ url="t.me/{}?start=stngs_{}".format(
+ bot.username, chat.id))]]))
+ else:
+ text = "Click here to check your settings."
+
+ else:
+ send_settings(chat.id, user.id, True)
+
+
+
+
+def migrate_chats(bot: Bot, update: Update):
+ msg = update.effective_message # type: Optional[Message]
+ if msg.migrate_to_chat_id:
+ old_chat = update.effective_chat.id
+ new_chat = msg.migrate_to_chat_id
+ elif msg.migrate_from_chat_id:
+ old_chat = msg.migrate_from_chat_id
+ new_chat = update.effective_chat.id
+ else:
+ return
+
+ LOGGER.info("Migrating from %s, to %s", str(old_chat), str(new_chat))
+ for mod in MIGRATEABLE:
+ mod.__migrate__(old_chat, new_chat)
+
+ LOGGER.info("Successfully migrated!")
+ raise DispatcherHandlerStop
+
+
+@run_async
+def source(bot: Bot, update: Update):
+ user = update.effective_message.from_user
+ chat = update.effective_chat # type: Optional[Chat]
+
+ if chat.type == "private":
+ update.effective_message.reply_text(SOURCE_STRING, parse_mode=ParseMode.MARKDOWN)
+
+ else:
+ try:
+ bot.send_message(user.id, SOURCE_STRING, parse_mode=ParseMode.MARKDOWN)
+
+ update.effective_message.reply_text("You'll find in PM more info about my sourcecode.")
+ except Unauthorized:
+ update.effective_message.reply_text("Contact me in PM first to get source information.")
+
+@run_async
+def imdb_searchdata(bot: Bot, update: Update):
+ query_raw = update.callback_query
+ query = query_raw.data.split('$')
+ print(query)
+ if query[1] != query_raw.from_user.username:
+ return
+ title = ''
+ rating = ''
+ date = ''
+ synopsis = ''
+ url_sel = 'https://www.imdb.com/title/%s/' % (query[0])
+ text_sel = requests.get(url_sel).text
+ selector_global = Selector(text = text_sel)
+ title = selector_global.xpath('//div[@class="title_wrapper"]/h1/text()').get().strip()
+ try:
+ rating = selector_global.xpath('//div[@class="ratingValue"]/strong/span/text()').get().strip()
+ except:
+ rating = '-'
+ try:
+ date = '(' + selector_global.xpath('//div[@class="title_wrapper"]/h1/span/a/text()').getall()[-1].strip() + ')'
+ except:
+ date = selector_global.xpath('//div[@class="subtext"]/a/text()').getall()[-1].strip()
+ try:
+ synopsis_list = selector_global.xpath('//div[@class="summary_text"]/text()').getall()
+ synopsis = re.sub(' +',' ', re.sub(r'\([^)]*\)', '', ''.join(sentence.strip() for sentence in synopsis_list)))
+ except:
+ synopsis = '_No synopsis available._'
+ movie_data = '*%s*, _%s_\n★ *%s*\n\n%s' % (title, date, rating, synopsis)
+ query_raw.edit_message_text(
+ movie_data,
+ parse_mode=ParseMode.MARKDOWN
+ )
+
+@run_async
+def imdb(bot: Bot, update: Update, args):
+ message = update.effective_message
+ query = ''.join([arg + '_' for arg in args]).lower()
+ if not query:
+ bot.send_message(
+ message.chat.id,
+ 'You need to specify a movie/show name!'
+ )
+ return
+ url_suggs = 'https://v2.sg.media-imdb.com/suggests/%s/%s.json' % (query[0], query)
+ json_url = urlopen(url_suggs)
+ suggs_raw = ''
+ for line in json_url:
+ suggs_raw = line
+ skip_chars = 6 + len(query)
+ suggs_dict = json.loads(suggs_raw[skip_chars:][:-1])
+ if suggs_dict:
+ button_list = [[
+ InlineKeyboardButton(
+ text = str(sugg['l'] + ' (' + str(sugg['y']) + ')'),
+ callback_data = str(sugg['id']) + '$' + str(message.from_user.username)
+ )] for sugg in suggs_dict['d'] if 'y' in sugg
+ ]
+ reply_markup = InlineKeyboardMarkup(button_list)
+ bot.send_message(
+ message.chat.id,
+ 'Which one? ',
+ reply_markup = reply_markup
+ )
+ else:
+ pass
+
+
+# Avoid memory dead
+def memory_limit(percentage: float):
+ if platform.system() != "Linux":
+ print('Only works on linux!')
+ return
+ soft, hard = resource.getrlimit(resource.RLIMIT_AS)
+ resource.setrlimit(resource.RLIMIT_AS, (int(get_memory() * 1024 * percentage), hard))
+
+def get_memory():
+ with open('/proc/meminfo', 'r') as mem:
+ free_memory = 0
+ for i in mem:
+ sline = i.split()
+ if str(sline[0]) in ('MemFree:', 'Buffers:', 'Cached:'):
+ free_memory += int(sline[1])
+ return free_memory
+
+def memory(percentage=0.5):
+ def decorator(function):
+ def wrapper(*args, **kwargs):
+ memory_limit(percentage)
+ try:
+ function(*args, **kwargs)
+ except MemoryError:
+ mem = get_memory() / 1024 /1024
+ print('Remain: %.2f GB' % mem)
+ sys.stderr.write('\n\nERROR: Memory Exception\n')
+ sys.exit(1)
+ return wrapper
+ return decorator
+
+
+@memory(percentage=0.8)
+def main():
+ test_handler = CommandHandler("test", test)
+ start_handler = CommandHandler("start", start, pass_args=True)
+
+ IMDB_HANDLER = CommandHandler('imdb', imdb, pass_args=True)
+ IMDB_SEARCHDATAHANDLER = CallbackQueryHandler(imdb_searchdata)
+
+ start_callback_handler = CallbackQueryHandler(send_start, pattern=r"bot_start")
+ dispatcher.add_handler(start_callback_handler)
+
+
+ help_handler = CommandHandler("help", get_help)
+ help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_")
+
+ settings_handler = CommandHandler("settings", get_settings)
+ settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_")
+
+ source_handler = CommandHandler("source", source)
+
+ migrate_handler = MessageHandler(Filters.status_update.migrate, migrate_chats)
+
+ M_CONNECT_BTN_HANDLER = CallbackQueryHandler(m_connect_button, pattern=r"main_connect")
+
+ # dispatcher.add_handler(test_handler)
+ dispatcher.add_handler(start_handler)
+ dispatcher.add_handler(help_handler)
+ dispatcher.add_handler(settings_handler)
+ dispatcher.add_handler(help_callback_handler)
+ dispatcher.add_handler(settings_callback_handler)
+ dispatcher.add_handler(migrate_handler)
+ dispatcher.add_handler(source_handler)
+ dispatcher.add_handler(M_CONNECT_BTN_HANDLER)
+ dispatcher.add_handler(IMDB_HANDLER)
+ dispatcher.add_handler(IMDB_SEARCHDATAHANDLER)
+
+
+ # dispatcher.add_error_handler(error_callback)
+
+ if WEBHOOK:
+ LOGGER.info("Using webhooks.")
+ updater.start_webhook(listen="127.0.0.1",
+ port=PORT,
+ url_path=TOKEN)
+
+ if CERT_PATH:
+ updater.bot.set_webhook(url=URL + TOKEN,
+ certificate=open(CERT_PATH, 'rb'))
+ else:
+ updater.bot.set_webhook(url=URL + TOKEN)
+
+ else:
+ LOGGER.info("Cinderella running...")
+ updater.start_polling(timeout=15, read_latency=4)
+
+ updater.idle()
+
+
+if __name__ == '__main__':
+ LOGGER.info("Successfully loaded modules: " + str(ALL_MODULES))
+ main()
From 4674574249e79b3bee4e1c9cfebb90a4e5815c83 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 12:19:26 +0530
Subject: [PATCH 007/105] __main__.py
---
cinderella/__main__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 408554fa..abce82af 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -59,7 +59,7 @@ def vercheck() -> str:
SOURCE_STRING = """
⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/jacob_paul1/24)
-⚡You Can Clone Me [Here](https://t.me/fun_heat)
+⚡You Can Clone Me [Here](https://t.me/allbottest)
"""
@@ -179,8 +179,8 @@ def send_start(bot, update):
first_name = update.effective_user.first_name
text = PM_START_TEXT
- keyboard = [[InlineKeyboardButton(text="💁Help",callback_data="help_back"),InlineKeyboardButton(text="👑Creator👑",url="https://t.me/fun_heat")]]
- keyboard += [[InlineKeyboardButton(text="🌏Connect Group", callback_data="main_connect"),InlineKeyboardButton(text="🔱Add Me🔱",url="t.me/{}?startgroup=true".format(bot.username))]]
+ keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/power_of_telegram"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/mtoffbotdev")]]
+ keyboard += [[InlineKeyboardButton(text="📂Help📂", callback_data="help_back"),InlineKeyboardButton(text="🔱Add Me🔱",url="t.me/{}?startgroup=true".format(bot.username))]]
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
From 748bea12828a173020810909fb7c87f8a1ad7e34 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 12:28:23 +0530
Subject: [PATCH 008/105] __main__.py
---
cinderella/__main__.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index abce82af..a0044959 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,8 +28,9 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A Powerful Telegram ProBot to Manage Your Groups,feel free to add to your groups!!_
-_Maintained by_ [{}](tg://user?id={})
+_My name is_ *{}*\n_A POWER FULL BOT OF \n⏩⏩[LEGEND]⏪⏪(https://t.me/power_of_telegram)
+_
+_
"""
From 8793cc928ce53ef1be775823429d9318cbbe62f7 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 12:31:17 +0530
Subject: [PATCH 009/105] __main__.py
---
cinderella/__main__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index a0044959..95393bde 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,12 +28,12 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n⏩⏩[LEGEND]⏪⏪(https://t.me/power_of_telegram)
-_
-_
+_My name is_ *{}*\n_A POWER FULL BOT OF \n⏩⏩[LEGEND]⏪⏪(https://t.me/power_of_telegram)_
"""
+
+
HELP_STRINGS = """
Hey there! My name is *{}*.
I'm a modular group management bot with a few fun extras! Have a look at the following for an idea of some of \
From 276e25967f9dc9b8b3ba080c92978ae33af8a629 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 12:36:33 +0530
Subject: [PATCH 010/105] __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 95393bde..16e53415 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,7 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n⏩⏩[LEGEND]⏪⏪(https://t.me/power_of_telegram)_
+_My name is_ *{}*\n_A POWER FULL BOT OF \n[LEGEND](http://t.me/power_of_telegram)_
"""
From 0b01310eaee8d6be6eb4b6df49769870d54ee5fc Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 12:43:31 +0530
Subject: [PATCH 011/105] __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 16e53415..17e901e5 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,7 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n[LEGEND](http://t.me/power_of_telegram)_
+_My name is_ *{}*\n_A POWER FULL BOT OF \n[{}LEGEND](tg://user?id={})_
"""
From 7a3aa1354ef58b49fe9eb57866d5db79f2a75360 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 12:53:47 +0530
Subject: [PATCH 012/105] __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 17e901e5..a771ab13 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,7 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n[{}LEGEND](tg://user?id={})_
+_My name is_ *{}*\n_A POWER FULL BOT OF \n[{}](tg://user?id={})_
"""
From 2de07e2b0e7d21b6c6a9a8b70a5ffafa7dee185b Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 13:09:16 +0530
Subject: [PATCH 013/105] app.json
---
app.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app.json b/app.json
index e8db4cb1..793d5966 100644
--- a/app.json
+++ b/app.json
@@ -57,7 +57,7 @@
},
"DEV_USERS": {
"description": "ID of users who are Dev (can use /py etc.)",
- "required": false,
+ "required": "True",
"value": "1331325830"
},
"CASH_API_KEY": {
@@ -102,7 +102,7 @@
},
"SUPPORT_USERS": {
"description": "A space separated list of user IDs who you wanna assign as support users(gban perms only).",
- "required": false,
+ "required": "True",
"value": "1331325830"
},
@@ -132,7 +132,7 @@
"value": ""
},
"LYDIA_API": {
- "description": "Put here lydia API.",
+ "description": "Put here lydia API.venoghil",
"required": false,
"value": " "
}
@@ -146,7 +146,7 @@
],
"name": "PIKACHU",
- "repository": "https://github.com/Sur-vivor/CiderellaProBot",
+ "repository": "https://github.com/piku-adhi/DUHO",
"success_url": "https://telegram.dog/CinderellaProBot",
"logo": "https://telegra.ph/file/511ad504656e712b88235.jpg"
}
From f0e94d3c20c419e797f76fa1cc5c4a3909c1d8a3 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 13:42:18 +0530
Subject: [PATCH 014/105] __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index a771ab13..fad4ada3 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,7 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n[{}](tg://user?id={})_
+_My name is_ *{}*\n_A POWER FULL BOT OF \n MY OWNER_
"""
@@ -602,7 +602,7 @@ def main():
updater.bot.set_webhook(url=URL + TOKEN)
else:
- LOGGER.info("Cinderella running...")
+ LOGGER.info("uumbiitund...")
updater.start_polling(timeout=15, read_latency=4)
updater.idle()
From ebe80b56c6a7cf3c71ad61fdd9bbcdc377738ede Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 13:58:14 +0530
Subject: [PATCH 015/105] __main__.py
---
cinderella/__main__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index fad4ada3..cba4cbc3 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -181,7 +181,8 @@ def send_start(bot, update):
text = PM_START_TEXT
keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/power_of_telegram"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/mtoffbotdev")]]
- keyboard += [[InlineKeyboardButton(text="📂Help📂", callback_data="help_back"),InlineKeyboardButton(text="🔱Add Me🔱",url="t.me/{}?startgroup=true".format(bot.username))]]
+ keyboard += [[InlineKeyboardButton(text="📂Help📂", callback_data="help_back"),InlineKeyboardButton(text="ADD YOUR GROUPS",url="t.me/{}?startgroup=true".format(bot.username))]]
+ keyboard += [[InlineKeyboardButton(text="blah",url="hoya")]]
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
From d4492f49a8e7c884ac2352b99d0412e565106c98 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 13 Dec 2020 23:40:26 +0530
Subject: [PATCH 016/105] __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index cba4cbc3..c468778b 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -181,8 +181,8 @@ def send_start(bot, update):
text = PM_START_TEXT
keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/power_of_telegram"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/mtoffbotdev")]]
- keyboard += [[InlineKeyboardButton(text="📂Help📂", callback_data="help_back"),InlineKeyboardButton(text="ADD YOUR GROUPS",url="t.me/{}?startgroup=true".format(bot.username))]]
- keyboard += [[InlineKeyboardButton(text="blah",url="hoya")]]
+ keyboard += [[InlineKeyboardButton(text="BOT TESTING",url="http://t.me/allbottest"),InlineKeyboardButton(text="Movies",url="http://t.me/HoneyBeesChat")]]
+ keyboard += [[InlineKeyboardButton(text="нєℓρ",url="http://t.me/power_of_telegram")]]
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
From 82072a0efe22102a2c98cf219452a616d6bc65c5 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 19:57:49 +0530
Subject: [PATCH 017/105] __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index c468778b..f776d4a6 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -60,7 +60,7 @@ def vercheck() -> str:
SOURCE_STRING = """
⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/jacob_paul1/24)
-⚡You Can Clone Me [Here](https://t.me/allbottest)
+⚡You Can Clone Me [Here](https://github.com/piku-adhi/DUHO)
"""
From be18cea6c8998da5009d85a333229b3ae6d5ad4f Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 20:02:10 +0530
Subject: [PATCH 018/105] README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6c92b38d..6b7d6326 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Modular Telegram bot for managing your groups with a extras features with Hunter
### Click Below Image to Deploy
-[](https://heroku.com/deploy?template=https://github.com/Sur-vivor/CinderellaProBot.git)
+[](https://heroku.com/deploy?template=https://github.com/piku-adhi/DUHO.git)
### Configuration
From 25b6281d009c4ef642317d13ea6498f98048aa32 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:18:55 +0530
Subject: [PATCH 019/105] README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6b7d6326..32246f9e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-### @CinderellaProBot // http://www.telegram.dog/CinderellaProBot
+### @Piku_Piku_bot // http://www.telegram.dog/Piku_Piku_bot
> with HunterxHunter theme.
[](https://github.com/ellerbrock/open-source-badges/)
From 8adaa82bdab100ab105c159ae3670b5e81745d55 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:38:54 +0530
Subject: [PATCH 020/105] app.json
---
app.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app.json b/app.json
index 793d5966..2752f290 100644
--- a/app.json
+++ b/app.json
@@ -133,8 +133,8 @@
},
"LYDIA_API": {
"description": "Put here lydia API.venoghil",
- "required": false,
- "value": " "
+ "required": true,
+ "value": "9459646ca3dff1ff00ff4a98c7ead3368492c77cd2252f0dbb8d6959eb97e884fd65001a51faf22230774b3ae7df7b2ebd9defdeb70b90f6de10a449d783245a"
}
},
"keywords": [
From 5a7e9277de1737ec2ddc13ad7832f0b562d1081c Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:48:08 +0530
Subject: [PATCH 021/105] afk.py
---
cinderella/modules/afk.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/afk.py b/cinderella/modules/afk.py
index 1e4298a1..83e9b854 100644
--- a/cinderella/modules/afk.py
+++ b/cinderella/modules/afk.py
@@ -27,7 +27,7 @@ def afk(bot: Bot, update: Update):
sql.set_afk(update.effective_user.id, reason)
fname = update.effective_user.first_name
- update.effective_message.reply_text("{} is now away!".format(fname))
+ update.effective_message.reply_text("{} At last he is on 🏳️".format(fname))
@run_async
From cae54b11fd1b4017cfaca9d75131ae46bf290cfb Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:53:03 +0530
Subject: [PATCH 022/105] welcome.py
---
cinderella/modules/welcome.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/welcome.py b/cinderella/modules/welcome.py
index 02326fb5..c59a9c42 100644
--- a/cinderella/modules/welcome.py
+++ b/cinderella/modules/welcome.py
@@ -215,7 +215,7 @@ def new_member(bot: Bot, update: Update):
newMember = chat.get_member(int(new_mem.id))
if welc_mutes == "on" and ((newMember.can_send_messages is None or newMember.can_send_messages)):
buttonMsg = msg.reply_text("Click the button below to prove you're human",
- reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="I'm not a bot! 🤖",
+ reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="I'm a HUMAN !NOT A 🤖",
callback_data="userverify_({})".format(new_mem.id))]]))
bot.restrict_chat_member(chat.id, new_mem.id,
can_send_messages=False,
From 375ccf93d89913ec98f2546977ad1cdeb73a1d53 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:54:04 +0530
Subject: [PATCH 023/105] Delete reactions.py
---
cinderella/modules/reactions.py | 237 --------------------------------
1 file changed, 237 deletions(-)
delete mode 100644 cinderella/modules/reactions.py
diff --git a/cinderella/modules/reactions.py b/cinderella/modules/reactions.py
deleted file mode 100644
index ec187234..00000000
--- a/cinderella/modules/reactions.py
+++ /dev/null
@@ -1,237 +0,0 @@
-import random
-
-from telegram import Bot, Update
-from telegram.ext import run_async
-
-from cinderella import dispatcher
-from cinderella.modules.disable import DisableAbleCommandHandler
-
-
-reactions = [
- "( ͡° ͜ʖ ͡°)",
- "( . •́ _ʖ •̀ .)",
- "( ಠ ͜ʖ ಠ)",
- "( ͡ ͜ʖ ͡ )",
- "(ʘ ͜ʖ ʘ)",
- "ヾ(´〇`)ノ♪♪♪",
- "ヽ(o´∀`)ノ♪♬",
- "♪♬((d⌒ω⌒b))♬♪",
- "└(^^)┐",
- "( ̄▽ ̄)/♫•*¨*•.¸¸♪",
- "ヾ(⌐■_■)ノ♪",
- "乁( • ω •乁)",
- "♬♫♪◖(● o ●)◗♪♫♬",
- "(っ˘ڡ˘ς)",
- "( ˘▽˘)っ♨",
- "( ・ω・)⊃-[二二]",
- "(*´ー`)旦 旦( ̄ω ̄*)",
- "(  ̄▽ ̄)[] [](≧▽≦ )",
- "(* ̄▽ ̄)旦 且(´∀`*)",
- "(ノ ˘_˘)ノ ζ|||ζ ζ|||ζ ζ|||ζ",
- "(ノ°∀°)ノ⌒・*:.。. .。.:*・゜゚・*☆",
- "(⊃。•́‿•̀。)⊃━✿✿✿✿✿✿",
- "(∩` ロ ´)⊃━炎炎炎炎炎",
- "( ・∀・)・・・--------☆",
- "( -ω-)/占~~~~~",
- "○∞∞∞∞ヽ(^ー^ )",
- "(*^^)/~~~~~~~~~~◎",
- "(((  ̄□)_/",
- "(メ ̄▽ ̄)︻┳═一",
- "ヽ( ・∀・)ノ_θ彡☆Σ(ノ `Д´)ノ",
- "(*`0´)θ☆(メ°皿°)ノ",
- "(; -_-)――――――C<―_-)",
- "ヽ(>_<ヽ) ―⊂|=0ヘ(^‿^ )",
- "(҂` ロ ´)︻デ═一 \(º □ º l|l)/",
- "/( .□.)\ ︵╰(°益°)╯︵ /(.□. /)",
- "(`⌒*)O-(`⌒´Q)",
- "(っ•﹏•)っ ✴==≡눈٩(`皿´҂)ง",
- "ヾ(・ω・)メ(・ω・)ノ",
- "(*^ω^)八(⌒▽⌒)八(-‿‿- )ヽ",
- "ヽ( ⌒ω⌒)人(=^‥^= )ノ",
- "。*:☆(・ω・人・ω・)。:゜☆。",
- "(°(°ω(°ω°(☆ω☆)°ω°)ω°)°)",
- "(っ˘▽˘)(˘▽˘)˘▽˘ς)",
- "(*^ω^)人(^ω^*)",
- "\(▽ ̄ \ ( ̄▽ ̄) /  ̄▽)/",
- "( ̄Θ ̄)",
- "\( ˋ Θ ´ )/",
- "( ´(00)ˋ )",
- "\( ̄(oo) ̄)/",
- "/(≧ x ≦)\",
- "/(=・ x ・=)\",
- "(=^・ω・^=)",
- "(= ; ェ ; =)",
- "(=⌒‿‿⌒=)",
- "(^• ω •^)",
- "ଲ(ⓛ ω ⓛ)ଲ",
- "ଲ(ⓛ ω ⓛ)ଲ",
- "(^◔ᴥ◔^)",
- "[(--)]..zzZ",
- "( ̄o ̄) zzZZzzZZ",
- "(_ _*) Z z z",
- "☆ミ(o*・ω・)ノ",
- "ε=ε=ε=ε=┌(; ̄▽ ̄)┘",
- "ε===(っ≧ω≦)っ",
- "__φ(..)",
- "ヾ( `ー´)シφ__",
- "( ^▽^)ψ__",
- "|・ω・)",
- "|д・)",
- "┬┴┬┴┤・ω・)ノ",
- "|・д・)ノ",
- "(* ̄ii ̄)",
- "(^〃^)",
- "m(_ _)m",
- "人(_ _*)",
- "(シ. .)シ",
- "(^_~)",
- "(>ω^)",
- "(^_<)〜☆",
- "(^_<)",
- "(づ ̄ ³ ̄)づ",
- "(⊃。•́‿•̀。)⊃",
- "⊂(´• ω •`⊂)",
- "(*・ω・)ノ",
- "(^-^*)/",
- "ヾ(*'▽'*)",
- "(^0^)ノ",
- "(*°ー°)ノ",
- "( ̄ω ̄)/",
- "(≧▽≦)/",
- "w(°o°)w",
- "(⊙_⊙)",
- "(°ロ°) !",
- "∑(O_O;)",
- "(¬_¬)",
- "(¬_¬ )",
- "(↼_↼)",
- "( ̄ω ̄;)",
- "┐('~`;)┌",
- "(・_・;)",
- "(@_@)",
- "(•ิ_•ิ)?",
- "ヽ(ー_ー )ノ",
- "┐( ̄ヘ ̄)┌",
- "┐( ̄~ ̄)┌",
- "┐( ´ д ` )┌",
- "╮(︶▽︶)╭",
- "ᕕ( ᐛ )ᕗ",
- "(ノωヽ)",
- "(″ロ゛)",
- "(/ω\)",
- "(((><)))",
- "~(>_<~)",
- "(×_×)",
- "(×﹏×)",
- "(ノ_<。)",
- "(μ_μ)",
- "o(TヘTo)",
- "( ゚,_ゝ`)",
- "( ╥ω╥ )",
- "(/ˍ・、)",
- "(つω`。)",
- "(T_T)",
- "o(〒﹏〒)o",
- "(#`Д´)",
- "(・`ω´・)",
- "( `ε´ )",
- "(メ` ロ ´)",
- "Σ(▼□▼メ)",
- "(҂ `з´ )",
- "٩(╬ʘ益ʘ╬)۶",
- "↑_(ΦwΦ)Ψ",
- "(ノಥ益ಥ)ノ",
- "(#><)",
- "(; ̄Д ̄)",
- "(¬_¬;)",
- "(^^#)",
- "( ̄︿ ̄)",
- "ヾ(  ̄O ̄)ツ",
- "(ᗒᗣᗕ)՞",
- "(ノ_<。)ヾ(´ ▽ ` )",
- "ヽ( ̄ω ̄(。。 )ゝ",
- "(ノ_;)ヾ(´ ∀ ` )",
- "(´-ω-`( _ _ )",
- "(⌒_⌒;)",
- "(*/_\)",
- "( ◡‿◡ *)",
- "(//ω//)",
- "( ̄▽ ̄*)ゞ",
- "(„ಡωಡ„)",
- "(ノ´ з `)ノ",
- "(♡-_-♡)",
- "(─‿‿─)♡",
- "(´ ω `♡)",
- "(ღ˘⌣˘ღ)",
- "(´• ω •`) ♡",
- "╰(*´︶`*)╯♡",
- "(≧◡≦) ♡",
- "♡ (˘▽˘>ԅ( ˘⌣˘)",
- "σ(≧ε≦σ) ♡",
- "(˘∀˘)/(μ‿μ) ❤",
- "Σ>―(〃°ω°〃)♡→",
- "(* ^ ω ^)",
- "(o^▽^o)",
- "ヽ(・∀・)ノ",
- "(o・ω・o)",
- "(^人^)",
- "( ´ ω ` )",
- "(´• ω •`)",
- "╰(▔∀▔)╯",
- "(✯◡✯)",
- "(⌒‿⌒)",
- "(*°▽°*)",
- "(´。• ᵕ •。`)",
- "ヽ(>∀<☆)ノ",
- "\( ̄▽ ̄)/",
- "(o˘◡˘o)",
- "(╯✧▽✧)╯",
- "( ‾́ ◡ ‾́ )",
- "(๑˘︶˘๑)",
- "(´・ᴗ・ ` )",
- "( ͡° ʖ̯ ͡°)",
- "( ఠ ͟ʖ ఠ)",
- "( ಥ ʖ̯ ಥ)",
- "(≖ ͜ʖ≖)",
- "ヘ( ̄ω ̄ヘ)",
- "(ノ≧∀≦)ノ",
- "└( ̄- ̄└))",
- "┌(^^)┘",
- "(^_^♪)",
- "(〜 ̄△ ̄)〜",
- "(「• ω •)「",
- "( ˘ ɜ˘) ♬♪♫",
- "( o˘◡˘o) ┌iii┐",
- "♨o(>_<)o♨",
- "( ・・)つ―{}@{}@{}-",
- "(*´з`)口゚。゚口(・∀・ )",
- "( *^^)o∀*∀o(^^* )",
- "-●●●-c(・・ )",
- "(ノ≧∀≦)ノ ‥…━━━★",
- "╰( ͡° ͜ʖ ͡° )つ──☆*:・゚",
- "(∩ᄑ_ᄑ)⊃━☆゚*・。*・:≡( ε:)"
-]
-
-@run_async
-def react(bot: Bot, update: Update):
-
- message = update.effective_message
- react = random.choice(reactions)
- if message.reply_to_message:
- message.reply_to_message.reply_text(react)
- else:
- message.reply_text(react)
-
-
-__help__ = """
- - /react: Reacts with a random reaction
-"""
-
-REACT_HANDLER = DisableAbleCommandHandler("react", react)
-
-dispatcher.add_handler(REACT_HANDLER)
-
-__mod_name__ = "REACT"
-__command_list__ = ["react"]
-__handlers__ = [REACT_HANDLER]
-
From 3e391a81c4d1d7d443b19929de647bd3ed7590c3 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:57:13 +0530
Subject: [PATCH 024/105] gban.py
---
cinderella/modules/telethon/gban.py | 135 ++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
create mode 100644 cinderella/modules/telethon/gban.py
diff --git a/cinderella/modules/telethon/gban.py b/cinderella/modules/telethon/gban.py
new file mode 100644
index 00000000..e3d95726
--- /dev/null
+++ b/cinderella/modules/telethon/gban.py
@@ -0,0 +1,135 @@
+from julia import SUDO_USERS, tbot, OWNER_ID
+from julia.events import register
+from telethon.tl.types import ChatBannedRights
+from telethon.tl import functions
+from telethon.tl import types
+from telethon import events
+from telethon.tl.functions.channels import EditBannedRequest
+from pymongo import MongoClient
+from julia import MONGO_DB_URI
+
+G_BAN_LOGGER_GROUP = "@MissJuliaRobotGbans"
+BANNED_RIGHTS = ChatBannedRights(
+ until_date=None,
+ view_messages=True,
+ send_messages=True,
+ send_media=True,
+ send_stickers=True,
+ send_gifs=True,
+ send_games=True,
+ send_inline=True,
+ embed_links=True,
+)
+
+client = MongoClient()
+client = MongoClient(MONGO_DB_URI)
+db = client["missjuliarobot"]
+gbanned = db.gban
+
+
+def get_reason(id):
+ return gbanned.find_one({"user": id})
+
+
+@register(pattern="^/gban(?: |$)(.*)")
+async def _(event):
+ if event.fwd_from:
+ return
+ if event.sender_id in SUDO_USERS:
+ pass
+ elif event.sender_id == OWNER_ID:
+ pass
+ else:
+ return
+ reason = event.pattern_match.group(1)
+ if not reason:
+ reason = "No reason given"
+ if event.reply_to_msg_id:
+ r = await event.get_reply_message()
+ r_sender_id = r.sender_id
+
+ chats = gbanned.find({})
+
+ for c in chats:
+ if r_sender_id == c["user"]:
+ to_check = get_reason(id=r_sender_id)
+ gbanned.update_one({"_id": to_check["_id"], "bannerid": to_check["bannerid"], "user": to_check["user"], "reason": to_check["reason"]}, {
+ "$set": {"reason": reason}})
+ await event.reply("This user is already gbanned, I am updating the reason of the gban with your reason.")
+ await event.client.send_message(
+ G_BAN_LOGGER_GROUP,
+ "**GLOBAL BAN REASON UPDATE**\n\n**PERMALINK:** [user](tg://user?id={})\n**REASON:** `{}`".format(r_sender_id, reason))
+ return
+
+ gbanned.insert_one({"bannerid": event.sender_id, "user": r_sender_id, "reason": reason})
+
+ await event.client.send_message(
+ G_BAN_LOGGER_GROUP,
+ "**NEW GLOBAL BAN**\n\n**PERMALINK:** [user](tg://user?id={})\n**REASON:** `{}`".format(
+ r_sender_id, reason)
+ )
+ await event.reply("Gbanned Successfully !")
+
+
+@register(pattern="^/ungban(?: |$)(.*)")
+async def _(event):
+ if event.fwd_from:
+ return
+ if event.sender_id in SUDO_USERS:
+ pass
+ elif event.sender_id == OWNER_ID:
+ pass
+ else:
+ return
+ reason = event.pattern_match.group(1)
+ if not reason:
+ reason = "No reason given"
+ if event.reply_to_msg_id:
+ r = await event.get_reply_message()
+ r_sender_id = r.sender_id
+
+ chats = gbanned.find({})
+
+ for c in chats:
+ if r_sender_id == c["user"]:
+ to_check = get_reason(id=r_sender_id)
+ gbanned.delete_one({"user": r_sender_id})
+ await event.client.send_message(
+ G_BAN_LOGGER_GROUP,
+ "**REMOVAL OF GLOBAN BAN**\n\n**PERMALINK:** [user](tg://user?id={})\n**REASON:** `{}`".format(
+ r_sender_id, reason)
+ )
+ await event.reply("Ungbanned Successfully !")
+ return
+ await event.reply("Is that user even gbanned ?")
+
+
+@tbot.on(events.ChatAction())
+async def join_ban(event):
+ if event.user_joined:
+ try:
+ user = await event.get_user()
+ chat = await event.get_chat()
+ to_check = get_reason(id=user.id)
+ reason = to_check["reason"]
+ bannerid = to_check["bannerid"]
+ await tbot(EditBannedRequest(chat.id, user.id, BANNED_RIGHTS))
+ await event.reply("This user is gbanned and has been removed !\n\n**Gbanned By**: `{}`\n**Reason**: `{}`".format(bannerid, reason))
+ except Exception as e:
+ print(e)
+ return
+
+@tbot.on(events.NewMessage(pattern=None))
+async def type_ban(event):
+ chats=gbanned.find({})
+ for c in chats:
+ if event.sender_id == c["user"]:
+ try:
+ to_check = get_reason(id=event.sender_id)
+ reason = to_check["reason"]
+ bannerid = to_check["bannerid"]
+ await tbot(EditBannedRequest(event.chat_id, event.sender_id, BANNED_RIGHTS))
+ await event.reply("This user is gbanned and has been removed !\n\n**Gbanned By**: `{}`\n**Reason**: `{}`".format(bannerid, reason))
+ except Exception as e:
+ print(e)
+ return
From bf5e93beed86870e54099e8d807234c491ccfb4f Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Wed, 16 Dec 2020 21:57:36 +0530
Subject: [PATCH 025/105] Delete covid_tracker.py
---
cinderella/modules/covid_tracker.py | 81 -----------------------------
1 file changed, 81 deletions(-)
delete mode 100644 cinderella/modules/covid_tracker.py
diff --git a/cinderella/modules/covid_tracker.py b/cinderella/modules/covid_tracker.py
deleted file mode 100644
index 214aed96..00000000
--- a/cinderella/modules/covid_tracker.py
+++ /dev/null
@@ -1,81 +0,0 @@
-import json
-import requests
-from urllib.request import urlopen
-from telegram import ParseMode, Update, Bot, Chat
-from telegram.ext import CommandHandler, MessageHandler, BaseFilter, run_async
-
-from cinderella import dispatcher
-from cinderella.modules.disable import DisableAbleCommandHandler
-from requests import get
-
-def covindia(bot: Bot, update: Update):
- message = update.effective_message
- state = ''
- confirmed = 0
- deceased = 0
- recovered = 0
- state_input = ''.join([message.text.split(' ')[i] + ' ' for i in range(1, len(message.text.split(' ')))]).strip()
- if state_input:
- url_india = 'https://api.covid19india.org/data.json'
- json_url = urlopen(url_india)
- state_dict = json.loads(json_url.read())
- for sdict in state_dict['statewise']:
- if sdict['state'].lower() == state_input.lower():
- confirmed = sdict['confirmed']
- deceased = sdict['deaths']
- recovered = sdict['recovered']
- state = sdict['state']
- break
-
- if state:
- bot.send_message(
- message.chat.id,
- '`COVID-19 Tracker`\n*Number of confirmed cases in %s:* %s\n*Deceased:* %s\n*Recovered:* %s\n\n_Source:_ covid19india.org' % (state, confirmed, deceased, recovered),
- parse_mode = ParseMode.MARKDOWN,
- disable_web_page_preview = True
- )
- else:
- bot.send_message(
- message.chat.id,
- 'You need to specify a valid Indian state!',
- parse_mode = ParseMode.MARKDOWN,
- disable_web_page_preview = True
- )
-@run_async
-def corona(bot: Bot, update: Update):
- message = update.effective_message
- device = message.text[len('/corona '):]
- fetch = get(f'https://coronavirus-tracker-api.herokuapp.com/all')
-
- if fetch.status_code == 200:
- usr = fetch.json()
- data = fetch.text
- parsed = json.loads(data)
- total_confirmed_global = parsed["latest"]["confirmed"]
- total_deaths_global = parsed["latest"]["deaths"]
- total_recovered_global = parsed["latest"]["recovered"]
- active_cases_covid19 = total_confirmed_global - total_deaths_global - total_recovered_global
- reply_text = ("*Corona Stats🦠:*\n"
- "Total Confirmed: `" + str(total_confirmed_global) + "`\n"
- "Total Deaths: `" + str(total_deaths_global) + "`\n"
- "Total Recovered: `" + str(total_recovered_global) +"`\n"
- "Active Cases: `"+ str(active_cases_covid19) + "`")
- message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True)
-
- return
-
- elif fetch.status_code == 404:
- reply_text = "The API is currently down."
- message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True)
-
-__help__ = """
- - /covid: get worldwide corona status
- - /covindia : Get real time COVID-19 stats for the input Indian state
-"""
-
-__mod_name__ = 'COVID-19 Tracker'
-
-COV_INDIA_HANDLER = CommandHandler('covindia', covindia)
-CORONA_HANDLER = DisableAbleCommandHandler("covid", corona, admin_ok=True)
-dispatcher.add_handler(CORONA_HANDLER)
-dispatcher.add_handler(COV_INDIA_HANDLER)
From cb32d938dc31b3029bc24377cac813626202d49f Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Thu, 17 Dec 2020 17:35:37 +0530
Subject: [PATCH 026/105] __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index f776d4a6..e015c4eb 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -59,7 +59,7 @@ def vercheck() -> str:
SOURCE_STRING = """
-⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/jacob_paul1/24)
+⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/http://t.me/Bot_Hub1)
⚡You Can Clone Me [Here](https://github.com/piku-adhi/DUHO)
"""
From 1f3e87f8ba73e89a19d36ce04353ac4b22728832 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Thu, 17 Dec 2020 17:42:51 +0530
Subject: [PATCH 027/105] app.json
---
app.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app.json b/app.json
index 2752f290..1e82612b 100644
--- a/app.json
+++ b/app.json
@@ -7,7 +7,7 @@
"plan": "heroku-postgresql"
}
],
- "description": "Modular Telegram bot for managing your groups with a few extras features.",
+ "description": "A telegram pro bot to manage ur groups and much extra features.",
"env": {
"ALLOW_EXCL": {
"description": "Set this to True if you want ! to be a command prefix along with /",
@@ -75,7 +75,7 @@
},
"START_IMG": {
"description": "Image shows when hit /start",
- "value": "https://telegra.ph/file/511ad504656e712b88235.jpg"
+ "value": "https://telegra.ph/file/48f109f213b0b453e4e3d.jpg"
},
"API_OPENWEATHER": {
"description": "Required for weather information",
@@ -147,6 +147,6 @@
],
"name": "PIKACHU",
"repository": "https://github.com/piku-adhi/DUHO",
- "success_url": "https://telegram.dog/CinderellaProBot",
- "logo": "https://telegra.ph/file/511ad504656e712b88235.jpg"
+ "success_url": "https://telegram.dog/Piku_piku_bot",
+ "logo": "https://telegra.ph/file/48f109f213b0b453e4e3d.jpg"
}
From 4a6ad15608509ea4b6b26156a4b84a17bfc65206 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Thu, 17 Dec 2020 17:50:17 +0530
Subject: [PATCH 028/105] __main__.py
---
cinderella/__main__.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index e015c4eb..9c97e2d2 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -39,13 +39,13 @@
I'm a modular group management bot with a few fun extras! Have a look at the following for an idea of some of \
the things I can help you with.
*Main* commands available:
- 💠 - /start: start the bot
- 💠 - /help: PM's you this message.
- 💠 - /help : PM's you info about that module.
- 💠 - /source: Information about my source.
- 💠 - /settings:
- 🔹 - in PM: will send you your settings for all supported modules.
- 🔹 - in a group: will redirect you to pm, with all that chat's settings.
+ 🔆- /start: start the bot
+ 🔱 - /help: PM's you this message.
+ ▶️- /help : PM's you info about that module.
+ ⏩ - /source: clone me .
+ 🗡️- /settings:
+ ➡️ - in PM: will send you your settings for all supported modules.
+ ♒- in a group: will redirect you to pm, with all that chat's settings.
{}
And the following:
""".format(dispatcher.bot.first_name, "" if not ALLOW_EXCL else "\nAll commands can either be used with / or !.\n")
@@ -59,7 +59,7 @@ def vercheck() -> str:
SOURCE_STRING = """
-⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/http://t.me/Bot_Hub1)
+⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/Bot_Hub1)
⚡You Can Clone Me [Here](https://github.com/piku-adhi/DUHO)
"""
From b8727780f4c44544dfa54a28aa37122f26d38082 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Thu, 17 Dec 2020 17:53:02 +0530
Subject: [PATCH 029/105] __main__.py
---
cinderella/__main__.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 9c97e2d2..42144b7d 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -79,7 +79,9 @@ def vercheck() -> str:
START_IMG = os.environ.get('START_IMG', None)
if START_IMG is None:
- img = "https://telegra.ph/file/fe5de56d6014f7b5cc0c5.jpg"
+ img = "https://telegra.ph/file/48f109f213b0b453e4e3d.jpg"
+
+
else:
img = START_IMG
From 61d7fa71034415cdfaeb4b5795b0cfa4777289d7 Mon Sep 17 00:00:00 2001
From: piku-adhi <73607487+piku-adhi@users.noreply.github.com>
Date: Thu, 17 Dec 2020 18:05:58 +0530
Subject: [PATCH 030/105] __main__.py
---
cinderella/__main__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 42144b7d..91e6f0a5 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -184,7 +184,8 @@ def send_start(bot, update):
keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/power_of_telegram"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/mtoffbotdev")]]
keyboard += [[InlineKeyboardButton(text="BOT TESTING",url="http://t.me/allbottest"),InlineKeyboardButton(text="Movies",url="http://t.me/HoneyBeesChat")]]
- keyboard += [[InlineKeyboardButton(text="нєℓρ",url="http://t.me/power_of_telegram")]]
+ keyboard += [[InlineKeyboardButton(text="нєℓρ",callback_data="help_back"),InlineKeyboardButton(text="🔗CONNECT🔗",callback_data="main_connect")]]
+
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True, parse_mode=ParseMode.MARKDOWN)
From db1a0b03d77226be0283d47e6be4b12c33974311 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Tue, 22 Dec 2020 20:12:56 +0530
Subject: [PATCH 031/105] Delete antiflood.py
---
cinderella/modules/antiflood.py | 202 --------------------------------
1 file changed, 202 deletions(-)
delete mode 100644 cinderella/modules/antiflood.py
diff --git a/cinderella/modules/antiflood.py b/cinderella/modules/antiflood.py
deleted file mode 100644
index c6dde1d8..00000000
--- a/cinderella/modules/antiflood.py
+++ /dev/null
@@ -1,202 +0,0 @@
-import html
-from typing import Optional, List
-
-from telegram import Message, Chat, Update, Bot, User, ParseMode, InlineKeyboardButton, InlineKeyboardMarkup
-from telegram.error import BadRequest
-from telegram.ext import Filters, MessageHandler, CommandHandler, run_async
-from telegram.utils.helpers import mention_html
-
-from cinderella import dispatcher
-from cinderella.modules.helper_funcs.chat_status import is_user_admin, user_admin, can_restrict, can_delete
-from cinderella.modules.log_channel import loggable
-from cinderella.modules.sql import antiflood_sql as sql
-
-FLOOD_GROUP = 3
-
-
-@run_async
-@loggable
-def check_flood(bot: Bot, update: Update) -> str:
- user = update.effective_user # type: Optional[User]
- chat = update.effective_chat # type: Optional[Chat]
- msg = update.effective_message # type: Optional[Message]
-
- if not user: # ignore channels
- return ""
-
- # ignore admins
- if is_user_admin(chat, user.id):
- sql.update_flood(chat.id, None)
- return ""
-
- should_ban = sql.update_flood(chat.id, user.id)
- if not should_ban:
- return ""
-
- soft_flood = sql.get_flood_strength(chat.id)
- if soft_flood: # kick
- chat.unban_member(user.id)
- reply = "Wonderful, I don't like your flooding. Get out! {} has been kicked!".format(mention_html(user.id, user.first_name))
-
- else: # ban
- chat.kick_member(user.id)
- reply = "Frankly, I like to leave the flooding to natural disasters. {} has been banned!".format(mention_html(user.id, user.first_name))
- try:
- keyboard = []
- msg.reply_text(reply, reply_markup=keyboard, parse_mode=ParseMode.HTML)
- msg.delete()
- return "{}:" \
- "\n#FLOOD_CTL" \
- "\n• User: {}" \
- "\nFlooded the group.".format(html.escape(chat.title),
- mention_html(user.id, user.first_name))
-
- except BadRequest:
- msg.reply_text("I can't kick people here, give me permissions first! Until then, I'll disable anti-flood.")
- sql.set_flood(chat.id, 0)
- return "{}:" \
- "\n#INFO" \
- "\nDon't have kick permissions, so automatically disabled anti-flood.".format(chat.title)
-
-
-@run_async
-@user_admin
-@can_restrict
-@loggable
-def set_flood(bot: Bot, update: Update, args: List[str]) -> str:
- chat = update.effective_chat # type: Optional[Chat]
- user = update.effective_user # type: Optional[User]
- message = update.effective_message # type: Optional[Message]
-
- if len(args) >= 1:
- val = args[0].lower()
- if val == "off" or val == "no" or val == "0":
- sql.set_flood(chat.id, 0)
- message.reply_text("Anti-flood has been disabled.")
-
- elif val.isdigit():
- amount = int(val)
- if amount <= 0:
- sql.set_flood(chat.id, 0)
- message.reply_text("Anti-flood has been disabled.")
- return "{}:" \
- "\n#SETFLOOD" \
- "\n• Admin: {}" \
- "\nDisabled Anti-flood.".format(html.escape(chat.title), mention_html(user.id, user.first_name))
-
- elif amount < 1:
- message.reply_text("Anti-flood has to be either 0 (disabled) or least 1")
- return ""
-
- else:
- sql.set_flood(chat.id, amount)
- message.reply_text("Anti-flood has been updated and set to {}".format(amount))
- return "{}:" \
- "\n#SETFLOOD" \
- "\n• Admin: {}" \
- "\nSet anti-flood to {}.".format(html.escape(chat.title),
- mention_html(user.id, user.first_name), amount)
-
- else:
- message.reply_text("Unrecognised argument - please use a number, 'off', or 'no'.")
- else:
- message.reply_text("Give me an argument! Set a number to enforce against consecutive spams.\n" \
- "i.e `/setflood 5`: to control consecutive of messages.", parse_mode=ParseMode.MARKDOWN)
- return ""
-
-
-@run_async
-def flood(bot: Bot, update: Update):
- chat = update.effective_chat # type: Optional[Chat]
- msg = update.effective_message # type: Optional[Message]
- limit = sql.get_flood_limit(chat.id)
- if limit == 0:
- update.effective_message.reply_text("I'm not currently enforcing flood control!")
- else:
- soft_flood = sql.get_flood_strength(chat.id)
- if soft_flood:
- msg.reply_text("I'm currently kicking users out if they send more than {} "
- "consecutive messages. They will able to join again!".format(limit, parse_mode=ParseMode.MARKDOWN))
- else:
- msg.reply_text("I'm currently banning users if they send more than {} "
- "consecutive messages.".format(limit, parse_mode=ParseMode.MARKDOWN))
-
-@run_async
-@user_admin
-@loggable
-def set_flood_strength(bot: Bot, update: Update, args: List[str]):
- chat = update.effective_chat # type: Optional[Chat]
- user = update.effective_user # type: Optional[User]
- msg = update.effective_message # type: Optional[Message]
-
- if args:
- if args[0].lower() in ("on", "yes"):
- sql.set_flood_strength(chat.id, False)
- msg.reply_text("Exceeding consecutive flood limit will result in a ban!")
- return "{}:\n" \
- "• Admin: {}\n" \
- "Has enabled strong flood and users will be banned.".format(html.escape(chat.title),
- mention_html(user.id, user.first_name))
-
- elif args[0].lower() in ("off", "no"):
- sql.set_flood_strength(chat.id, True)
- msg.reply_text("Exceeding consecutive flood limit will result in a kick, Users will able to join back.")
- return "{}:\n" \
- "• Admin: {}\n" \
- "Has disabled strong flood and users will only be kicked.".format(html.escape(chat.title),
- mention_html(user.id,
- user.first_name))
-
- else:
- msg.reply_text("I only understand on/yes/no/off!")
- else:
- soft_flood = sql.get_flood_strength(chat.id)
- if soft_flood == True:
- msg.reply_text("Flood strength is currently set to *kick* users when they exceed the limits. ",
- parse_mode=ParseMode.MARKDOWN)
-
- elif soft_flood:
- msg.reply_text("The default configuration for flood control is currently set as a ban.",
- parse_mode=ParseMode.MARKDOWN)
-
- elif soft_flood == False:
- msg.reply_text("Flood strength is currently set to *ban* users when they exceed the limits, "
- "user will be banned.",
- parse_mode=ParseMode.MARKDOWN)
- return ""
-
-def __migrate__(old_chat_id, new_chat_id):
- sql.migrate_chat(old_chat_id, new_chat_id)
-
-
-def __chat_settings__(chat_id, user_id):
- limit = sql.get_flood_limit(chat_id)
- soft_flood = sql.get_flood_strength(chat_id)
- if limit == 0:
- return "*Not* currently enforcing flood control."
- else:
- if soft_flood:
- return "Anti-flood is set to `{}` messages and *KICK* if exceeded.".format(limit)
- else:
- return "Anti-flood is set to `{}` messages and *BAN* if exceeded.".format(limit)
-__help__ = """
-You know how sometimes, people join, send 100 messages, and ruin your chat? With antiflood, that happens no more!
-Antiflood allows you to take action on users that send more than x messages in a row. Exceeding the set flood \
-will result in banning or kicking the user.
- - /flood: Get the current flood control setting
-*Admin only:*
- - /setflood : enables or disables flood control
- - /strongflood : If set to on, exceeding the flood limit will result in a ban. Else, will just kick.
-"""
-
-__mod_name__ = "ANTIFLOOD"
-
-FLOOD_BAN_HANDLER = MessageHandler(Filters.all & ~Filters.status_update & Filters.group, check_flood)
-SET_FLOOD_HANDLER = CommandHandler("setflood", set_flood, pass_args=True, filters=Filters.group)
-FLOOD_HANDLER = CommandHandler("flood", flood, filters=Filters.group)
-FLOOD_STRENGTH_HANDLER = CommandHandler("strongflood", set_flood_strength, pass_args=True, filters=Filters.group)
-
-dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP)
-dispatcher.add_handler(SET_FLOOD_HANDLER)
-dispatcher.add_handler(FLOOD_HANDLER)
-dispatcher.add_handler(FLOOD_STRENGTH_HANDLER)
From 94d76279f02d389d8fa7ca8fb1b35dace130b5ee Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Tue, 22 Dec 2020 20:13:43 +0530
Subject: [PATCH 032/105] Add files via upload
---
cinderella/modules/antiflood.py | 202 ++++++++++++++++++++++++++++++++
1 file changed, 202 insertions(+)
create mode 100644 cinderella/modules/antiflood.py
diff --git a/cinderella/modules/antiflood.py b/cinderella/modules/antiflood.py
new file mode 100644
index 00000000..99092a4a
--- /dev/null
+++ b/cinderella/modules/antiflood.py
@@ -0,0 +1,202 @@
+import html
+from typing import Optional, List
+
+from telegram import Message, Chat, Update, Bot, User, ParseMode, InlineKeyboardButton, InlineKeyboardMarkup
+from telegram.error import BadRequest
+from telegram.ext import Filters, MessageHandler, CommandHandler, run_async
+from telegram.utils.helpers import mention_html
+
+from cinderella import dispatcher
+from cinderella.modules.helper_funcs.chat_status import is_user_admin, user_admin, can_restrict, can_delete
+from cinderella.modules.log_channel import loggable
+from cinderella.modules.sql import antiflood_sql as sql
+
+FLOOD_GROUP = 3
+
+
+@run_async
+@loggable
+def check_flood(bot: Bot, update: Update) -> str:
+ user = update.effective_user # type: Optional[User]
+ chat = update.effective_chat # type: Optional[Chat]
+ msg = update.effective_message # type: Optional[Message]
+
+ if not user: # ignore channels
+ return ""
+
+ # ignore admins
+ if is_user_admin(chat, user.id):
+ sql.update_flood(chat.id, None)
+ return ""
+
+ should_ban = sql.update_flood(chat.id, user.id)
+ if not should_ban:
+ return ""
+
+ soft_flood = sql.get_flood_strength(chat.id)
+ if soft_flood: # kick
+ chat.unban_member(user.id)
+ reply = "ഇത് ഏതാ പുതിയ വാണം കിടന്ന് ഷോ ! {} പൊയ്ക്കോ!".format(mention_html(user.id, user.first_name))
+
+ else: # ban
+ chat.kick_member(user.id)
+ reply = "Frankly, I like to leave the flooding to natural disasters. {} has been banned!".format(mention_html(user.id, user.first_name))
+ try:
+ keyboard = []
+ msg.reply_text(reply, reply_markup=keyboard, parse_mode=ParseMode.HTML)
+ msg.delete()
+ return "{}:" \
+ "\n#FLOOD_CTL" \
+ "\n• User: {}" \
+ "\nFlooded the group.".format(html.escape(chat.title),
+ mention_html(user.id, user.first_name))
+
+ except BadRequest:
+ msg.reply_text("ആദ്യം പെര്മിസ്സഷൻ താ")
+ sql.set_flood(chat.id, 0)
+ return "{}:" \
+ "\n#INFO" \
+ "\nDon't have kick permissions, so automatically disabled anti-flood.".format(chat.title)
+
+
+@run_async
+@user_admin
+@can_restrict
+@loggable
+def set_flood(bot: Bot, update: Update, args: List[str]) -> str:
+ chat = update.effective_chat # type: Optional[Chat]
+ user = update.effective_user # type: Optional[User]
+ message = update.effective_message # type: Optional[Message]
+
+ if len(args) >= 1:
+ val = args[0].lower()
+ if val == "off" or val == "no" or val == "0":
+ sql.set_flood(chat.id, 0)
+ message.reply_text("Anti-flood has been disabled.")
+
+ elif val.isdigit():
+ amount = int(val)
+ if amount <= 0:
+ sql.set_flood(chat.id, 0)
+ message.reply_text("Anti-flood has been disabled.")
+ return "{}:" \
+ "\n#SETFLOOD" \
+ "\n• Admin: {}" \
+ "\nDisabled Anti-flood.".format(html.escape(chat.title), mention_html(user.id, user.first_name))
+
+ elif amount < 1:
+ message.reply_text("Anti-flood has to be either 0 (disabled) or least 1")
+ return ""
+
+ else:
+ sql.set_flood(chat.id, amount)
+ message.reply_text("Anti-flood has been updated and set to {}".format(amount))
+ return "{}:" \
+ "\n#SETFLOOD" \
+ "\n• Admin: {}" \
+ "\nSet anti-flood to {}.".format(html.escape(chat.title),
+ mention_html(user.id, user.first_name), amount)
+
+ else:
+ message.reply_text("Unrecognised argument - please use a number, 'off', or 'no'.")
+ else:
+ message.reply_text("Give me an argument! Set a number to enforce against consecutive spams.\n" \
+ "i.e `/setflood 5`: to control consecutive of messages.", parse_mode=ParseMode.MARKDOWN)
+ return ""
+
+
+@run_async
+def flood(bot: Bot, update: Update):
+ chat = update.effective_chat # type: Optional[Chat]
+ msg = update.effective_message # type: Optional[Message]
+ limit = sql.get_flood_limit(chat.id)
+ if limit == 0:
+ update.effective_message.reply_text("I'm not currently enforcing flood control!")
+ else:
+ soft_flood = sql.get_flood_strength(chat.id)
+ if soft_flood:
+ msg.reply_text("I'm currently kicking users out if they send more than {} "
+ "consecutive messages. They will able to join again!".format(limit, parse_mode=ParseMode.MARKDOWN))
+ else:
+ msg.reply_text("I'm currently banning users if they send more than {} "
+ "consecutive messages.".format(limit, parse_mode=ParseMode.MARKDOWN))
+
+@run_async
+@user_admin
+@loggable
+def set_flood_strength(bot: Bot, update: Update, args: List[str]):
+ chat = update.effective_chat # type: Optional[Chat]
+ user = update.effective_user # type: Optional[User]
+ msg = update.effective_message # type: Optional[Message]
+
+ if args:
+ if args[0].lower() in ("on", "yes"):
+ sql.set_flood_strength(chat.id, False)
+ msg.reply_text("Exceeding consecutive flood limit will result in a ban!")
+ return "{}:\n" \
+ "• Admin: {}\n" \
+ "Has enabled strong flood and users will be banned.".format(html.escape(chat.title),
+ mention_html(user.id, user.first_name))
+
+ elif args[0].lower() in ("off", "no"):
+ sql.set_flood_strength(chat.id, True)
+ msg.reply_text("Exceeding consecutive flood limit will result in a kick, Users will able to join back.")
+ return "{}:\n" \
+ "• Admin: {}\n" \
+ "Has disabled strong flood and users will only be kicked.".format(html.escape(chat.title),
+ mention_html(user.id,
+ user.first_name))
+
+ else:
+ msg.reply_text("I only understand on/yes/no/off!")
+ else:
+ soft_flood = sql.get_flood_strength(chat.id)
+ if soft_flood == True:
+ msg.reply_text("Flood strength is currently set to *kick* users when they exceed the limits. ",
+ parse_mode=ParseMode.MARKDOWN)
+
+ elif soft_flood:
+ msg.reply_text("The default configuration for flood control is currently set as a ban.",
+ parse_mode=ParseMode.MARKDOWN)
+
+ elif soft_flood == False:
+ msg.reply_text("Flood strength is currently set to *ban* users when they exceed the limits, "
+ "user will be banned.",
+ parse_mode=ParseMode.MARKDOWN)
+ return ""
+
+def __migrate__(old_chat_id, new_chat_id):
+ sql.migrate_chat(old_chat_id, new_chat_id)
+
+
+def __chat_settings__(chat_id, user_id):
+ limit = sql.get_flood_limit(chat_id)
+ soft_flood = sql.get_flood_strength(chat_id)
+ if limit == 0:
+ return "*Not* currently enforcing flood control."
+ else:
+ if soft_flood:
+ return "Anti-flood is set to `{}` messages and *KICK* if exceeded.".format(limit)
+ else:
+ return "Anti-flood is set to `{}` messages and *BAN* if exceeded.".format(limit)
+__help__ = """
+You know how sometimes, people join, send 100 messages, and ruin your chat? With antiflood, that happens no more!
+Antiflood allows you to take action on users that send more than x messages in a row. Exceeding the set flood \
+will result in banning or kicking the user.
+ - /flood: Get the current flood control setting
+*Admin only:*
+ - /setflood : enables or disables flood control
+ - /strongflood : If set to on, exceeding the flood limit will result in a ban. Else, will just kick.
+"""
+
+__mod_name__ = "ANTIFLOOD"
+
+FLOOD_BAN_HANDLER = MessageHandler(Filters.all & ~Filters.status_update & Filters.group, check_flood)
+SET_FLOOD_HANDLER = CommandHandler("setflood", set_flood, pass_args=True, filters=Filters.group)
+FLOOD_HANDLER = CommandHandler("flood", flood, filters=Filters.group)
+FLOOD_STRENGTH_HANDLER = CommandHandler("strongflood", set_flood_strength, pass_args=True, filters=Filters.group)
+
+dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP)
+dispatcher.add_handler(SET_FLOOD_HANDLER)
+dispatcher.add_handler(FLOOD_HANDLER)
+dispatcher.add_handler(FLOOD_STRENGTH_HANDLER)
\ No newline at end of file
From 29b61655e657ad21395da008b17293af60696ad9 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 17:45:54 +0530
Subject: [PATCH 033/105] Update __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 91e6f0a5..66a23753 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,8 +28,8 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n MY OWNER_
-"""
+_My name is_ *{}*\n_A POWER FULL BOT OF \n THE HERO_
+[{}](tg://user?id={})"""
From 5e2361d13db60b8fa84881ead439215f3202aceb Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 17:50:26 +0530
Subject: [PATCH 034/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 66a23753..fedec0d2 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -183,7 +183,7 @@ def send_start(bot, update):
text = PM_START_TEXT
keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/power_of_telegram"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/mtoffbotdev")]]
- keyboard += [[InlineKeyboardButton(text="BOT TESTING",url="http://t.me/allbottest"),InlineKeyboardButton(text="Movies",url="http://t.me/HoneyBeesChat")]]
+ keyboard += [[InlineKeyboardButton(text="GIT REPOS",url="http://t.me/Bot_Hub1"),InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/HoneyBeesChat")]]
keyboard += [[InlineKeyboardButton(text="нєℓρ",callback_data="help_back"),InlineKeyboardButton(text="🔗CONNECT🔗",callback_data="main_connect")]]
From b5ab1de9559ea80faa2dc0c84c9acbd532515bff Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 17:52:33 +0530
Subject: [PATCH 035/105] Update misc.py
---
cinderella/modules/helper_funcs/misc.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cinderella/modules/helper_funcs/misc.py b/cinderella/modules/helper_funcs/misc.py
index d0c32406..89979894 100644
--- a/cinderella/modules/helper_funcs/misc.py
+++ b/cinderella/modules/helper_funcs/misc.py
@@ -68,12 +68,12 @@ def paginate_modules(page_n: int, module_dict: Dict, prefix, chat=None) -> List:
# can only have a certain amount of buttons side by side
if len(pairs) > 7:
pairs = pairs[modulo_page * 7:7 * (modulo_page + 1)] + [
- (EqInlineKeyboardButton("<<<", callback_data="{}_prev({})".format(prefix, modulo_page)),
- EqInlineKeyboardButton("🏡 Home", callback_data="bot_start"),
- EqInlineKeyboardButton(">>>", callback_data="{}_next({})".format(prefix, modulo_page)))]
+ (EqInlineKeyboardButton("⏪", callback_data="{}_prev({})".format(prefix, modulo_page)),
+ EqInlineKeyboardButton("😎 Home😎", callback_data="bot_start"),
+ EqInlineKeyboardButton("⏩", callback_data="{}_next({})".format(prefix, modulo_page)))]
else:
- pairs += [[EqInlineKeyboardButton("🏡 Home", callback_data="bot_start")]]
+ pairs += [[EqInlineKeyboardButton("🏳️HOME", callback_data="bot_start")]]
return pairs
From 2c298ee4c6e83a08418ed7569ffcab43c13c4ab4 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 17:55:30 +0530
Subject: [PATCH 036/105] Delete wiki.py
---
cinderella/modules/wiki.py | 51 --------------------------------------
1 file changed, 51 deletions(-)
delete mode 100644 cinderella/modules/wiki.py
diff --git a/cinderella/modules/wiki.py b/cinderella/modules/wiki.py
deleted file mode 100644
index 33577071..00000000
--- a/cinderella/modules/wiki.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import re
-import json
-import urllib.request
-import urllib.parse
-import wikipedia
-from wikipedia.exceptions import DisambiguationError, PageError
-from telegram import Message, Chat, Update, Bot, ParseMode
-from telegram.ext import run_async
-
-from cinderella import dispatcher
-from cinderella.modules.disable import DisableAbleCommandHandler
-@run_async
-def wiki(bot: Bot, update: Update):
- msg = update.effective_message.reply_to_message if update.effective_message.reply_to_message else update.effective_message
- res = ""
- if msg == update.effective_message:
- search = msg.text.split(" ", maxsplit=1)[1]
- else:
- search = msg.text
- try:
- res = wikipedia.summary(search)
- except DisambiguationError as e:
- update.message.reply_text("Disambiguated pages found! Adjust your query accordingly.\n{}".format(e),
- parse_mode=ParseMode.HTML)
- except PageError as e:
- update.message.reply_text("{}".format(e), parse_mode=ParseMode.HTML)
- if res:
- result = f"{search}\n\n"
- result += f"{res}\n"
- result += f"""Read more..."""
- if len(result) > 4000:
- with open("result.txt", 'w') as f:
- f.write(f"{result}\n\nUwU OwO OmO UmU")
- with open("result.txt", 'rb') as f:
- bot.send_document(document=f, filename=f.name,
- reply_to_message_id=update.message.message_id, chat_id=update.effective_chat.id,
- parse_mode=ParseMode.HTML)
- else:
- update.message.reply_text(result, parse_mode=ParseMode.HTML)
-__help__ = """
-WIKIPEDIA!!
-
-*Available commands:*
- - /wiki : wiki your query.
-
-"""
-
-__mod_name__ = "WIKIPEDIA"
-
-WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki)
-dispatcher.add_handler(WIKI_HANDLER)
From 54967554ebd933038440f2866fdeb7453d7c56e0 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 18:10:35 +0530
Subject: [PATCH 037/105] Update welcome.py
---
cinderella/modules/welcome.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/modules/welcome.py b/cinderella/modules/welcome.py
index c59a9c42..90cccf8d 100644
--- a/cinderella/modules/welcome.py
+++ b/cinderella/modules/welcome.py
@@ -158,8 +158,8 @@ def new_member(bot: Bot, update: Update):
elif new_mem.id in WHITELIST_USERS:
update.effective_message.reply_text("Oof! A Whitelist User just joined!")
- elif new_mem.id == 1118936839:
- update.effective_message.reply_text("Oh🤴Genos,My Creator/Developer has just joined your group.")
+ elif new_mem.id == 1331325830:
+ update.effective_message.reply_text("Oh🤴Genos,Developer has arrived her.")
# Make bot greet admins
elif new_mem.id == bot.id:
From f31a54810d7a32a7e09a4bc06ef04cbc7ea2b1a9 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 18:11:57 +0530
Subject: [PATCH 038/105] Update whois.py
---
cinderella/modules/whois.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/whois.py b/cinderella/modules/whois.py
index 6aa129d9..64529156 100644
--- a/cinderella/modules/whois.py
+++ b/cinderella/modules/whois.py
@@ -79,7 +79,7 @@ def info(bot: Bot, update: Update, args: List[str]):
elif user.id in DEV_USERS:
text += "\n🚴♂️Pling,This person is my dev🤷♂️\nI would never do anything against him!."
- elif user.id == 1118936839:
+ elif user.id == 1331325830:
text += "\n🚴♂️Pling,This person is my Creator/developer🤷♂️\nI would never do anything against him!."
elif user.id in SUDO_USERS:
From c56a5266661c9dbfad4771d2374b15960538f732 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 18:14:20 +0530
Subject: [PATCH 039/105] Update global_bans.py
---
cinderella/modules/global_bans.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
index c67d786f..5c5492b2 100644
--- a/cinderella/modules/global_bans.py
+++ b/cinderella/modules/global_bans.py
@@ -63,7 +63,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
message.reply_text("There is no way I can gban this user.He is my Owner")
return
- if user_id == 1118936839:
+ if user_id == 1331325830:
message.reply_text("There is no way I can gban this user.He is my Creator/Developer")
return
From d14eef89df08a645ff7309d78027d6692da21ec9 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 18:15:38 +0530
Subject: [PATCH 040/105] Update global_bans.py
---
cinderella/modules/global_bans.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
index 5c5492b2..0c4dd21c 100644
--- a/cinderella/modules/global_bans.py
+++ b/cinderella/modules/global_bans.py
@@ -63,7 +63,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
message.reply_text("There is no way I can gban this user.He is my Owner")
return
- if user_id == 1331325830:
+ if user_id == 1331325830,:
message.reply_text("There is no way I can gban this user.He is my Creator/Developer")
return
From 8f329910b7d69934639469edb169735b7179f0a8 Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 19:28:56 +0530
Subject: [PATCH 041/105] Delete global_bans.py
---
cinderella/modules/global_bans.py | 516 ------------------------------
1 file changed, 516 deletions(-)
delete mode 100644 cinderella/modules/global_bans.py
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
deleted file mode 100644
index 0c4dd21c..00000000
--- a/cinderella/modules/global_bans.py
+++ /dev/null
@@ -1,516 +0,0 @@
-import html
-from io import BytesIO
-from typing import Optional, List
-
-import time
-from datetime import datetime
-
-from telegram import Message, Update, Bot, User, Chat, ParseMode
-from telegram.error import BadRequest, TelegramError
-from telegram.ext import run_async, CommandHandler, MessageHandler, Filters
-from telegram.utils.helpers import mention_html
-
-import cinderella.modules.sql.global_bans_sql as sql
-from cinderella import dispatcher, OWNER_ID, DEV_USERS, SUDO_USERS, SUPPORT_USERS, WHITELIST_USERS, GBAN_LOGS, STRICT_GBAN, spam_watch
-from cinderella.modules.helper_funcs.chat_status import user_admin, is_user_admin
-from cinderella.modules.helper_funcs.extraction import extract_user, extract_user_and_text
-from cinderella.modules.helper_funcs.filters import CustomFilters
-from cinderella.modules.helper_funcs.misc import send_to_list
-from cinderella.modules.sql.users_sql import get_all_chats
-
-GBAN_ENFORCE_GROUP = 6
-
-GBAN_ERRORS = {
- "User is an administrator of the chat",
- "Chat not found",
- "Not enough rights to restrict/unrestrict chat member",
- "User_not_participant",
- "Peer_id_invalid",
- "Group chat was deactivated",
- "Need to be inviter of a user to kick it from a basic group",
- "Chat_admin_required",
- "Only the creator of a basic group can kick group administrators",
- "Channel_private",
- "Not in the chat",
- "Can't remove chat owner"
-}
-
-UNGBAN_ERRORS = {
- "User is an administrator of the chat",
- "Chat not found",
- "Not enough rights to restrict/unrestrict chat member",
- "User_not_participant",
- "Method is available for supergroup and channel chats only",
- "Not in the chat",
- "Channel_private",
- "Chat_admin_required",
- "Peer_id_invalid",
- "User not found"
-}
-
-@run_async
-def gban(bot: Bot, update: Update, args: List[str]):
- message = update.effective_message # type: Optional[Message]
- chat = update.effective_chat
-
- user_id, reason = extract_user_and_text(message, args)
-
- if not user_id:
- message.reply_text("You don't seem to be referring to a user.")
- return
-
- if int(user_id) == OWNER_ID:
- message.reply_text("There is no way I can gban this user.He is my Owner")
- return
-
- if user_id == 1331325830,:
- message.reply_text("There is no way I can gban this user.He is my Creator/Developer")
- return
-
- if int(user_id) in DEV_USERS:
- message.reply_text("There is no way I can gban this user.")
- return
-
- if int(user_id) in SUDO_USERS:
- message.reply_text("I spy, with my little eye... a sudo user war! Why are you guys turning on each other?")
- return
-
- if int(user_id) in SUPPORT_USERS:
- message.reply_text("OOOH someone's trying to gban a support user! *grabs popcorn*")
- return
-
- if int(user_id) in WHITELIST_USERS:
- message.reply_text("I can't ban my master's close frd.")
- return
-
- if user_id == bot.id:
- message.reply_text("-_- So funny, lets gban myself why don't I? Nice try.")
- return
-
- try:
- user_chat = bot.get_chat(user_id)
- except BadRequest as excp:
- message.reply_text(excp.message)
- return
-
- if user_chat.type != 'private':
- message.reply_text("That's not a user!")
- return
-
- if sql.is_user_gbanned(user_id):
- if not reason:
- message.reply_text("This user is already gbanned; I'd change the reason, but you haven't given me one...")
- return
-
- old_reason = sql.update_gban_reason(user_id, user_chat.username or user_chat.first_name, reason)
- if old_reason:
- message.reply_text("This user is already gbanned, for the following reason:\n"
- "{}\n"
- "I've gone and updated it with your new reason!".format(html.escape(old_reason)),
- parse_mode=ParseMode.HTML)
- else:
- message.reply_text("This user is already gbanned, but had no reason set; I've gone and updated it!")
-
- return
-
- message.reply_text("⚡️ *Snaps the Banhammer* ⚡️")
-
- start_time = time.time()
- datetime_fmt = "%H:%M - %d-%m-%Y"
- current_time = datetime.utcnow().strftime(datetime_fmt)
-
- if chat.type != 'private':
- chat_origin = "{} ({})\n".format(html.escape(chat.title), chat.id)
- else:
- chat_origin = "{}\n".format(chat.id)
-
- banner = update.effective_user # type: Optional[User]
- log_message = (
- "Global Ban" \
- "\n#GBANNED" \
- "\nOriginated from: {}" \
- "\nStatus: Enforcing" \
- "\nSudo Admin: {}" \
- "\nUser: {}" \
- "\nID: {}" \
- "\nEvent Stamp: {}" \
- "\nReason: {}".format(chat_origin, mention_html(banner.id, banner.first_name),
- mention_html(user_chat.id, user_chat.first_name),
- user_chat.id, current_time, reason or "No reason given"))
-
-
- if GBAN_LOGS:
- try:
- log = bot.send_message(
- GBAN_LOGS, log_message, parse_mode=ParseMode.HTML)
- except BadRequest as e:
- print(e)
- log = bot.send_message(
- GBAN_LOGS,
- log_message +
- "\n\nFormatting has been disabled due to an unexpected error.")
-
- else:
- send_to_list(bot, SUDO_USERS + DEV_USERS, log_message, html=True)
-
- sql.gban_user(user_id, user_chat.username or user_chat.first_name, reason)
-
- chats = get_all_chats()
- gbanned_chats = 0
- for chat in chats:
- chat_id = chat.chat_id
-
- # Check if this group has disabled gbans
- if not sql.does_chat_gban(chat_id):
- continue
-
- try:
- bot.kick_chat_member(chat_id, user_id)
- gbanned_chats += 1
- except BadRequest as excp:
- if excp.message in GBAN_ERRORS:
- pass
- else:
- message.reply_text("Could not gban due to: {}".format(excp.message))
- if GBAN_LOGS:
- bot.send_message(
- GBAN_LOGS,
- f"Could not gban due to {excp.message}",
- parse_mode=ParseMode.HTML)
- else:
- send_to_list(bot, SUDO_USERS + DEV_USERS,
- f"Could not gban due to: {excp.message}")
- sql.ungban_user(user_id)
- return
- except TelegramError:
- pass
-
- if GBAN_LOGS:
- log.edit_text(
- log_message +
- f"\nChats affected: {gbanned_chats}",
- parse_mode=ParseMode.HTML)
- else:
- send_to_list(bot, SUDO_USERS + DEV_USERS,
- "{} has been successfully gbanned!".format(mention_html(user_chat.id, user_chat.first_name)),
- html=True)
-
- message.reply_text("Done! {} has been globally banned.".format(mention_html(user_chat.id, user_chat.first_name)),
- parse_mode=ParseMode.HTML)
-
-
- end_time = time.time()
- gban_time = round((end_time - start_time), 2)
-
- if gban_time > 60:
- gban_time = round((gban_time / 60), 2)
- message.reply_text(f"Done! This gban affected {gbanned_chats} chats, Took {gban_time} min")
- else:
- message.reply_text(f"Done! This gban affected {gbanned_chats} chats, Took {gban_time} sec")
-
-
-
-@run_async
-def ungban(bot: Bot, update: Update, args: List[str]):
- message = update.effective_message # type: Optional[Message]
- chat = update.effective_chat
- user = update.effective_user
-
- user_id = extract_user(message, args)
- if not user_id:
- message.reply_text("You don't seem to be referring to a user.")
- return
-
- user_chat = bot.get_chat(user_id)
- if user_chat.type != 'private':
- message.reply_text("That's not a user!")
- return
-
- if not sql.is_user_gbanned(user_id):
- message.reply_text("This user is not gbanned!")
- return
-
- message.reply_text("I pardon {}, globally with a second chance.".format(user_chat.first_name))
-
- start_time = time.time()
- datetime_fmt = "%H:%M - %d-%m-%Y"
- current_time = datetime.utcnow().strftime(datetime_fmt)
-
- if chat.type != 'private':
- chat_origin = "{} ({})\n".format(html.escape(chat.title), chat.id)
- else:
- chat_origin = "{}\n".format(chat.id)
-
- log_message = (
- f"#UNGBANNED\n"
- f"Originated from: {chat_origin}\n"
- f"Sudo Admin: {mention_html(user.id, user.first_name)}\n"
- f"Unbanned User: {mention_html(user_chat.id, user_chat.first_name)}\n"
- f"Unbanned User ID: {user_chat.id}\n"
- f"Event Stamp: {current_time}")
-
- if GBAN_LOGS:
- try:
- log = bot.send_message(
- GBAN_LOGS, log_message, parse_mode=ParseMode.HTML)
- except BadRequest as excp:
- log = bot.send_message(
- GBAN_LOGS,
- log_message +
- "\n\nFormatting has been disabled due to an unexpected error.")
- else:
- send_to_list(bot, SUDO_USERS + DEV_USERS, log_message, html=True)
-
- chats = get_all_chats()
- ungbanned_chats = 0
- for chat in chats:
- chat_id = chat.chat_id
-
- # Check if this group has disabled gbans
- if not sql.does_chat_gban(chat_id):
- continue
-
- try:
- member = bot.get_chat_member(chat_id, user_id)
- if member.status == 'kicked':
- bot.unban_chat_member(chat_id, user_id)
- ungbanned_chats += 1
-
- except BadRequest as excp:
- if excp.message in UNGBAN_ERRORS:
- pass
- else:
- message.reply_text("Could not un-gban due to: {}".format(excp.message))
- if GBAN_LOGS:
- bot.send_message(
- GBAN_LOGS,
- f"Could not un-gban due to: {excp.message}",
- parse_mode=ParseMode.HTML)
- else:
- bot.send_message(
- OWNER_ID, f"Could not un-gban due to: {excp.message}")
- return
- except TelegramError:
- pass
-
- sql.ungban_user(user_id)
-
- if GBAN_LOGS:
- log.edit_text(
- log_message +
- f"\nChats affected: {ungbanned_chats}",
- parse_mode=ParseMode.HTML)
- else:
- send_to_list(bot, SUDO_USERS + DEV_USERS,
- "{} has been pardoned from gban!".format(mention_html(user_chat.id,
- user_chat.first_name)),
- html=True)
-
- message.reply_text("{} has been un-gbanned".format(mention_html(user_chat.id, user_chat.first_name)),
- parse_mode=ParseMode.HTML)
- end_time = time.time()
- ungban_time = round((end_time - start_time), 2)
-
- if ungban_time > 60:
- ungban_time = round((ungban_time / 60), 2)
- message.reply_text(
- f"Done! This Ungban affected {ungbanned_chats} chats, Took {ungban_time} min")
- else:
- message.reply_text(f"Done! This Ungban affected {ungbanned_chats} chats, Took {ungban_time} sec")
-
-@run_async
-def gbanlist(bot: Bot, update: Update):
- banned_users = sql.get_gban_list()
-
- if not banned_users:
- update.effective_message.reply_text("There aren't any gbanned users! You're kinder than I expected...")
- return
-
- banfile = 'Screw these guys.\n'
- for user in banned_users:
- banfile += "[x] {} - {}\n".format(user["name"], user["user_id"])
- if user["reason"]:
- banfile += "Reason: {}\n".format(user["reason"])
-
- with BytesIO(str.encode(banfile)) as output:
- output.name = "gbanlist.txt"
- update.effective_message.reply_document(document=output, filename="gbanlist.txt",
- caption="Here is the list of currently gbanned users.")
-
-
-def check_and_ban(update, user_id, should_message=True):
- chat = update.effective_chat
- message = update.effective_message
- if spam_watch != None:
- spam_watch_ban = spam_watch.get_ban(user_id)
- if spam_watch_ban:
- spamwatch_reason = spam_watch_ban.reason
- chat.kick_member(user_id)
- if should_message:
- message.reply_text(
- (chat.id,
- "This user is detected as a spambot by SpamWatch and has been removed!\n\nReason: {}").format(spamwatch_reason),
- parse_mode=ParseMode.HTML)
- return
- else:
- return
-
- if sql.is_user_gbanned(user_id):
- chat.kick_member(user_id)
- if should_message:
- userr = sql.get_gbanned_user(user_id)
- usrreason = userr.reason
- if not usrreason:
- usrreason = (chat.id, "No reason given")
-
- message.reply_text((
- chat.id, "*This user is gbanned and has been removed.*\nReason: `{}`").format(usrreason),
- parse_mode=ParseMode.MARKDOWN)
- return
-
-@run_async
-def enforce_gban(bot: Bot, update: Update):
- # Not using @restrict handler to avoid spamming - just ignore if cant gban.
- if sql.does_chat_gban(update.effective_chat.id) and update.effective_chat.get_member(bot.id).can_restrict_members:
- user = update.effective_user # type: Optional[User]
- chat = update.effective_chat # type: Optional[Chat]
- msg = update.effective_message # type: Optional[Message]
-
- if user and not is_user_admin(chat, user.id):
- check_and_ban(update, user.id)
-
- if msg.new_chat_members:
- new_members = update.effective_message.new_chat_members
- for mem in new_members:
- check_and_ban(update, mem.id)
-
- if msg.reply_to_message:
- user = msg.reply_to_message.from_user # type: Optional[User]
- if user and not is_user_admin(chat, user.id):
- check_and_ban(update, user.id, should_message=False)
-
-
-@run_async
-@user_admin
-def gbanstat(bot: Bot, update: Update, args: List[str]):
- if len(args) > 0:
- if args[0].lower() in ["on", "yes"]:
- sql.enable_gbans(update.effective_chat.id)
- update.effective_message.reply_text("I've enabled gbans in this group. This will help protect you "
- "from spammers, unsavoury characters, and the biggest trolls.")
- elif args[0].lower() in ["off", "no"]:
- sql.disable_gbans(update.effective_chat.id)
- update.effective_message.reply_text("I've disabled gbans in this group. GBans wont affect your users "
- "anymore. You'll be less protected from any trolls and spammers "
- "though!")
- else:
- update.effective_message.reply_text("Give me some arguments to choose a setting! on/off, yes/no!\n\n"
- "Your current setting is: {}\n"
- "When True, any gbans that happen will also happen in your group. "
- "When False, they won't, leaving you at the possible mercy of "
- "spammers.".format(sql.does_chat_gban(update.effective_chat.id)))
-
-@run_async
-def clear_gbans(bot: Bot, update: Update):
- '''Check and remove deleted accounts from gbanlist.
- By @TheRealPhoenix'''
- banned = sql.get_gban_list()
- deleted = 0
- for user in banned:
- id = user["user_id"]
- time.sleep(0.1) # Reduce floodwait
- try:
- acc = bot.get_chat(id)
- if not acc.first_name:
- deleted += 1
- sql.ungban_user(id)
- except BadRequest:
- deleted += 1
- sql.ungban_user(id)
- update.message.reply_text("Done! `{}` deleted accounts were removed " \
- "from the gbanlist.".format(deleted), parse_mode=ParseMode.MARKDOWN)
-
-
-@run_async
-def check_gbans(bot: Bot, update: Update):
- '''By @TheRealPhoenix'''
- banned = sql.get_gban_list()
- deleted = 0
- for user in banned:
- id = user["user_id"]
- time.sleep(0.1) # Reduce floodwait
- try:
- acc = bot.get_chat(id)
- if not acc.first_name:
- deleted += 1
- except BadRequest:
- deleted += 1
- if deleted:
- update.message.reply_text("`{}` deleted accounts found in the gbanlist! " \
- "Run /cleangb to remove them from the database!".format(deleted),
- parse_mode=ParseMode.MARKDOWN)
- else:
- update.message.reply_text("No deleted accounts in the gbanlist!")
-
-
-def __stats__():
- return "{} gbanned users.".format(sql.num_gbanned_users())
-
-
-def __user_info__(user_id):
- is_gbanned = sql.is_user_gbanned(user_id)
-
- text = "Globally banned: {}"
- if is_gbanned:
- text = text.format("Yes")
- user = sql.get_gbanned_user(user_id)
- if user.reason:
- text += "\nReason: {}".format(html.escape(user.reason))
- else:
- text = text.format("No")
- return text
-
-
-def __migrate__(old_chat_id, new_chat_id):
- sql.migrate_chat(old_chat_id, new_chat_id)
-
-
-def __chat_settings__(chat_id, user_id):
- return "This chat is enforcing *gbans*: `{}`.".format(sql.does_chat_gban(chat_id))
-
-
-__help__ = """
-*Admin only:*
- - /gbanstat : Will disable the effect of global bans on your group, or return your current settings.
-
-Gbans, also known as global bans, are used by the bot owners to ban spammers across all groups. This helps protect \
-you and your groups by removing spam flooders as quickly as possible. They can be disabled for you group by calling \
-/gbanstat
-- /checkgb : To check whether Deleted Accounts are present in gban list.
-- /cleangb : To Remove all Deleted Accounts from gban list
-"""
-
-__mod_name__ = "GLOBAL BANS"
-
-GBAN_HANDLER = CommandHandler("gban", gban, pass_args=True,
- filters=CustomFilters.sudo_filter | CustomFilters.support_filter)
-UNGBAN_HANDLER = CommandHandler("ungban", ungban, pass_args=True,
- filters=CustomFilters.sudo_filter | CustomFilters.support_filter)
-GBAN_LIST = CommandHandler("gbanlist", gbanlist,
- filters=CustomFilters.sudo_filter | CustomFilters.support_filter)
-
-GBAN_STATUS = CommandHandler("gbanstat", gbanstat, pass_args=True, filters=Filters.group)
-CHECK_GBAN_HANDLER = CommandHandler("checkgb", check_gbans, filters=Filters.user(OWNER_ID))
-CLEAN_GBAN_HANDLER = CommandHandler("cleangb", clear_gbans, filters=Filters.user(OWNER_ID))
-
-GBAN_ENFORCER = MessageHandler(Filters.all & Filters.group, enforce_gban)
-
-dispatcher.add_handler(GBAN_HANDLER)
-dispatcher.add_handler(UNGBAN_HANDLER)
-dispatcher.add_handler(GBAN_LIST)
-dispatcher.add_handler(GBAN_STATUS)
-dispatcher.add_handler(CHECK_GBAN_HANDLER)
-dispatcher.add_handler(CLEAN_GBAN_HANDLER)
-
-if STRICT_GBAN: # enforce GBANS if this is set
- dispatcher.add_handler(GBAN_ENFORCER, GBAN_ENFORCE_GROUP)
From c9e60e311ace922408bbbfee00611aa4ba3babea Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Fri, 1 Jan 2021 19:30:10 +0530
Subject: [PATCH 042/105] Add files via upload
---
cinderella/modules/global_bans.py | 516 ++++++++++++++++++++++++++++++
1 file changed, 516 insertions(+)
create mode 100644 cinderella/modules/global_bans.py
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
new file mode 100644
index 00000000..c67d786f
--- /dev/null
+++ b/cinderella/modules/global_bans.py
@@ -0,0 +1,516 @@
+import html
+from io import BytesIO
+from typing import Optional, List
+
+import time
+from datetime import datetime
+
+from telegram import Message, Update, Bot, User, Chat, ParseMode
+from telegram.error import BadRequest, TelegramError
+from telegram.ext import run_async, CommandHandler, MessageHandler, Filters
+from telegram.utils.helpers import mention_html
+
+import cinderella.modules.sql.global_bans_sql as sql
+from cinderella import dispatcher, OWNER_ID, DEV_USERS, SUDO_USERS, SUPPORT_USERS, WHITELIST_USERS, GBAN_LOGS, STRICT_GBAN, spam_watch
+from cinderella.modules.helper_funcs.chat_status import user_admin, is_user_admin
+from cinderella.modules.helper_funcs.extraction import extract_user, extract_user_and_text
+from cinderella.modules.helper_funcs.filters import CustomFilters
+from cinderella.modules.helper_funcs.misc import send_to_list
+from cinderella.modules.sql.users_sql import get_all_chats
+
+GBAN_ENFORCE_GROUP = 6
+
+GBAN_ERRORS = {
+ "User is an administrator of the chat",
+ "Chat not found",
+ "Not enough rights to restrict/unrestrict chat member",
+ "User_not_participant",
+ "Peer_id_invalid",
+ "Group chat was deactivated",
+ "Need to be inviter of a user to kick it from a basic group",
+ "Chat_admin_required",
+ "Only the creator of a basic group can kick group administrators",
+ "Channel_private",
+ "Not in the chat",
+ "Can't remove chat owner"
+}
+
+UNGBAN_ERRORS = {
+ "User is an administrator of the chat",
+ "Chat not found",
+ "Not enough rights to restrict/unrestrict chat member",
+ "User_not_participant",
+ "Method is available for supergroup and channel chats only",
+ "Not in the chat",
+ "Channel_private",
+ "Chat_admin_required",
+ "Peer_id_invalid",
+ "User not found"
+}
+
+@run_async
+def gban(bot: Bot, update: Update, args: List[str]):
+ message = update.effective_message # type: Optional[Message]
+ chat = update.effective_chat
+
+ user_id, reason = extract_user_and_text(message, args)
+
+ if not user_id:
+ message.reply_text("You don't seem to be referring to a user.")
+ return
+
+ if int(user_id) == OWNER_ID:
+ message.reply_text("There is no way I can gban this user.He is my Owner")
+ return
+
+ if user_id == 1118936839:
+ message.reply_text("There is no way I can gban this user.He is my Creator/Developer")
+ return
+
+ if int(user_id) in DEV_USERS:
+ message.reply_text("There is no way I can gban this user.")
+ return
+
+ if int(user_id) in SUDO_USERS:
+ message.reply_text("I spy, with my little eye... a sudo user war! Why are you guys turning on each other?")
+ return
+
+ if int(user_id) in SUPPORT_USERS:
+ message.reply_text("OOOH someone's trying to gban a support user! *grabs popcorn*")
+ return
+
+ if int(user_id) in WHITELIST_USERS:
+ message.reply_text("I can't ban my master's close frd.")
+ return
+
+ if user_id == bot.id:
+ message.reply_text("-_- So funny, lets gban myself why don't I? Nice try.")
+ return
+
+ try:
+ user_chat = bot.get_chat(user_id)
+ except BadRequest as excp:
+ message.reply_text(excp.message)
+ return
+
+ if user_chat.type != 'private':
+ message.reply_text("That's not a user!")
+ return
+
+ if sql.is_user_gbanned(user_id):
+ if not reason:
+ message.reply_text("This user is already gbanned; I'd change the reason, but you haven't given me one...")
+ return
+
+ old_reason = sql.update_gban_reason(user_id, user_chat.username or user_chat.first_name, reason)
+ if old_reason:
+ message.reply_text("This user is already gbanned, for the following reason:\n"
+ "{}\n"
+ "I've gone and updated it with your new reason!".format(html.escape(old_reason)),
+ parse_mode=ParseMode.HTML)
+ else:
+ message.reply_text("This user is already gbanned, but had no reason set; I've gone and updated it!")
+
+ return
+
+ message.reply_text("⚡️ *Snaps the Banhammer* ⚡️")
+
+ start_time = time.time()
+ datetime_fmt = "%H:%M - %d-%m-%Y"
+ current_time = datetime.utcnow().strftime(datetime_fmt)
+
+ if chat.type != 'private':
+ chat_origin = "{} ({})\n".format(html.escape(chat.title), chat.id)
+ else:
+ chat_origin = "{}\n".format(chat.id)
+
+ banner = update.effective_user # type: Optional[User]
+ log_message = (
+ "Global Ban" \
+ "\n#GBANNED" \
+ "\nOriginated from: {}" \
+ "\nStatus: Enforcing" \
+ "\nSudo Admin: {}" \
+ "\nUser: {}" \
+ "\nID: {}" \
+ "\nEvent Stamp: {}" \
+ "\nReason: {}".format(chat_origin, mention_html(banner.id, banner.first_name),
+ mention_html(user_chat.id, user_chat.first_name),
+ user_chat.id, current_time, reason or "No reason given"))
+
+
+ if GBAN_LOGS:
+ try:
+ log = bot.send_message(
+ GBAN_LOGS, log_message, parse_mode=ParseMode.HTML)
+ except BadRequest as e:
+ print(e)
+ log = bot.send_message(
+ GBAN_LOGS,
+ log_message +
+ "\n\nFormatting has been disabled due to an unexpected error.")
+
+ else:
+ send_to_list(bot, SUDO_USERS + DEV_USERS, log_message, html=True)
+
+ sql.gban_user(user_id, user_chat.username or user_chat.first_name, reason)
+
+ chats = get_all_chats()
+ gbanned_chats = 0
+ for chat in chats:
+ chat_id = chat.chat_id
+
+ # Check if this group has disabled gbans
+ if not sql.does_chat_gban(chat_id):
+ continue
+
+ try:
+ bot.kick_chat_member(chat_id, user_id)
+ gbanned_chats += 1
+ except BadRequest as excp:
+ if excp.message in GBAN_ERRORS:
+ pass
+ else:
+ message.reply_text("Could not gban due to: {}".format(excp.message))
+ if GBAN_LOGS:
+ bot.send_message(
+ GBAN_LOGS,
+ f"Could not gban due to {excp.message}",
+ parse_mode=ParseMode.HTML)
+ else:
+ send_to_list(bot, SUDO_USERS + DEV_USERS,
+ f"Could not gban due to: {excp.message}")
+ sql.ungban_user(user_id)
+ return
+ except TelegramError:
+ pass
+
+ if GBAN_LOGS:
+ log.edit_text(
+ log_message +
+ f"\nChats affected: {gbanned_chats}",
+ parse_mode=ParseMode.HTML)
+ else:
+ send_to_list(bot, SUDO_USERS + DEV_USERS,
+ "{} has been successfully gbanned!".format(mention_html(user_chat.id, user_chat.first_name)),
+ html=True)
+
+ message.reply_text("Done! {} has been globally banned.".format(mention_html(user_chat.id, user_chat.first_name)),
+ parse_mode=ParseMode.HTML)
+
+
+ end_time = time.time()
+ gban_time = round((end_time - start_time), 2)
+
+ if gban_time > 60:
+ gban_time = round((gban_time / 60), 2)
+ message.reply_text(f"Done! This gban affected {gbanned_chats} chats, Took {gban_time} min")
+ else:
+ message.reply_text(f"Done! This gban affected {gbanned_chats} chats, Took {gban_time} sec")
+
+
+
+@run_async
+def ungban(bot: Bot, update: Update, args: List[str]):
+ message = update.effective_message # type: Optional[Message]
+ chat = update.effective_chat
+ user = update.effective_user
+
+ user_id = extract_user(message, args)
+ if not user_id:
+ message.reply_text("You don't seem to be referring to a user.")
+ return
+
+ user_chat = bot.get_chat(user_id)
+ if user_chat.type != 'private':
+ message.reply_text("That's not a user!")
+ return
+
+ if not sql.is_user_gbanned(user_id):
+ message.reply_text("This user is not gbanned!")
+ return
+
+ message.reply_text("I pardon {}, globally with a second chance.".format(user_chat.first_name))
+
+ start_time = time.time()
+ datetime_fmt = "%H:%M - %d-%m-%Y"
+ current_time = datetime.utcnow().strftime(datetime_fmt)
+
+ if chat.type != 'private':
+ chat_origin = "{} ({})\n".format(html.escape(chat.title), chat.id)
+ else:
+ chat_origin = "{}\n".format(chat.id)
+
+ log_message = (
+ f"#UNGBANNED\n"
+ f"Originated from: {chat_origin}\n"
+ f"Sudo Admin: {mention_html(user.id, user.first_name)}\n"
+ f"Unbanned User: {mention_html(user_chat.id, user_chat.first_name)}\n"
+ f"Unbanned User ID: {user_chat.id}\n"
+ f"Event Stamp: {current_time}")
+
+ if GBAN_LOGS:
+ try:
+ log = bot.send_message(
+ GBAN_LOGS, log_message, parse_mode=ParseMode.HTML)
+ except BadRequest as excp:
+ log = bot.send_message(
+ GBAN_LOGS,
+ log_message +
+ "\n\nFormatting has been disabled due to an unexpected error.")
+ else:
+ send_to_list(bot, SUDO_USERS + DEV_USERS, log_message, html=True)
+
+ chats = get_all_chats()
+ ungbanned_chats = 0
+ for chat in chats:
+ chat_id = chat.chat_id
+
+ # Check if this group has disabled gbans
+ if not sql.does_chat_gban(chat_id):
+ continue
+
+ try:
+ member = bot.get_chat_member(chat_id, user_id)
+ if member.status == 'kicked':
+ bot.unban_chat_member(chat_id, user_id)
+ ungbanned_chats += 1
+
+ except BadRequest as excp:
+ if excp.message in UNGBAN_ERRORS:
+ pass
+ else:
+ message.reply_text("Could not un-gban due to: {}".format(excp.message))
+ if GBAN_LOGS:
+ bot.send_message(
+ GBAN_LOGS,
+ f"Could not un-gban due to: {excp.message}",
+ parse_mode=ParseMode.HTML)
+ else:
+ bot.send_message(
+ OWNER_ID, f"Could not un-gban due to: {excp.message}")
+ return
+ except TelegramError:
+ pass
+
+ sql.ungban_user(user_id)
+
+ if GBAN_LOGS:
+ log.edit_text(
+ log_message +
+ f"\nChats affected: {ungbanned_chats}",
+ parse_mode=ParseMode.HTML)
+ else:
+ send_to_list(bot, SUDO_USERS + DEV_USERS,
+ "{} has been pardoned from gban!".format(mention_html(user_chat.id,
+ user_chat.first_name)),
+ html=True)
+
+ message.reply_text("{} has been un-gbanned".format(mention_html(user_chat.id, user_chat.first_name)),
+ parse_mode=ParseMode.HTML)
+ end_time = time.time()
+ ungban_time = round((end_time - start_time), 2)
+
+ if ungban_time > 60:
+ ungban_time = round((ungban_time / 60), 2)
+ message.reply_text(
+ f"Done! This Ungban affected {ungbanned_chats} chats, Took {ungban_time} min")
+ else:
+ message.reply_text(f"Done! This Ungban affected {ungbanned_chats} chats, Took {ungban_time} sec")
+
+@run_async
+def gbanlist(bot: Bot, update: Update):
+ banned_users = sql.get_gban_list()
+
+ if not banned_users:
+ update.effective_message.reply_text("There aren't any gbanned users! You're kinder than I expected...")
+ return
+
+ banfile = 'Screw these guys.\n'
+ for user in banned_users:
+ banfile += "[x] {} - {}\n".format(user["name"], user["user_id"])
+ if user["reason"]:
+ banfile += "Reason: {}\n".format(user["reason"])
+
+ with BytesIO(str.encode(banfile)) as output:
+ output.name = "gbanlist.txt"
+ update.effective_message.reply_document(document=output, filename="gbanlist.txt",
+ caption="Here is the list of currently gbanned users.")
+
+
+def check_and_ban(update, user_id, should_message=True):
+ chat = update.effective_chat
+ message = update.effective_message
+ if spam_watch != None:
+ spam_watch_ban = spam_watch.get_ban(user_id)
+ if spam_watch_ban:
+ spamwatch_reason = spam_watch_ban.reason
+ chat.kick_member(user_id)
+ if should_message:
+ message.reply_text(
+ (chat.id,
+ "This user is detected as a spambot by SpamWatch and has been removed!\n\nReason: {}").format(spamwatch_reason),
+ parse_mode=ParseMode.HTML)
+ return
+ else:
+ return
+
+ if sql.is_user_gbanned(user_id):
+ chat.kick_member(user_id)
+ if should_message:
+ userr = sql.get_gbanned_user(user_id)
+ usrreason = userr.reason
+ if not usrreason:
+ usrreason = (chat.id, "No reason given")
+
+ message.reply_text((
+ chat.id, "*This user is gbanned and has been removed.*\nReason: `{}`").format(usrreason),
+ parse_mode=ParseMode.MARKDOWN)
+ return
+
+@run_async
+def enforce_gban(bot: Bot, update: Update):
+ # Not using @restrict handler to avoid spamming - just ignore if cant gban.
+ if sql.does_chat_gban(update.effective_chat.id) and update.effective_chat.get_member(bot.id).can_restrict_members:
+ user = update.effective_user # type: Optional[User]
+ chat = update.effective_chat # type: Optional[Chat]
+ msg = update.effective_message # type: Optional[Message]
+
+ if user and not is_user_admin(chat, user.id):
+ check_and_ban(update, user.id)
+
+ if msg.new_chat_members:
+ new_members = update.effective_message.new_chat_members
+ for mem in new_members:
+ check_and_ban(update, mem.id)
+
+ if msg.reply_to_message:
+ user = msg.reply_to_message.from_user # type: Optional[User]
+ if user and not is_user_admin(chat, user.id):
+ check_and_ban(update, user.id, should_message=False)
+
+
+@run_async
+@user_admin
+def gbanstat(bot: Bot, update: Update, args: List[str]):
+ if len(args) > 0:
+ if args[0].lower() in ["on", "yes"]:
+ sql.enable_gbans(update.effective_chat.id)
+ update.effective_message.reply_text("I've enabled gbans in this group. This will help protect you "
+ "from spammers, unsavoury characters, and the biggest trolls.")
+ elif args[0].lower() in ["off", "no"]:
+ sql.disable_gbans(update.effective_chat.id)
+ update.effective_message.reply_text("I've disabled gbans in this group. GBans wont affect your users "
+ "anymore. You'll be less protected from any trolls and spammers "
+ "though!")
+ else:
+ update.effective_message.reply_text("Give me some arguments to choose a setting! on/off, yes/no!\n\n"
+ "Your current setting is: {}\n"
+ "When True, any gbans that happen will also happen in your group. "
+ "When False, they won't, leaving you at the possible mercy of "
+ "spammers.".format(sql.does_chat_gban(update.effective_chat.id)))
+
+@run_async
+def clear_gbans(bot: Bot, update: Update):
+ '''Check and remove deleted accounts from gbanlist.
+ By @TheRealPhoenix'''
+ banned = sql.get_gban_list()
+ deleted = 0
+ for user in banned:
+ id = user["user_id"]
+ time.sleep(0.1) # Reduce floodwait
+ try:
+ acc = bot.get_chat(id)
+ if not acc.first_name:
+ deleted += 1
+ sql.ungban_user(id)
+ except BadRequest:
+ deleted += 1
+ sql.ungban_user(id)
+ update.message.reply_text("Done! `{}` deleted accounts were removed " \
+ "from the gbanlist.".format(deleted), parse_mode=ParseMode.MARKDOWN)
+
+
+@run_async
+def check_gbans(bot: Bot, update: Update):
+ '''By @TheRealPhoenix'''
+ banned = sql.get_gban_list()
+ deleted = 0
+ for user in banned:
+ id = user["user_id"]
+ time.sleep(0.1) # Reduce floodwait
+ try:
+ acc = bot.get_chat(id)
+ if not acc.first_name:
+ deleted += 1
+ except BadRequest:
+ deleted += 1
+ if deleted:
+ update.message.reply_text("`{}` deleted accounts found in the gbanlist! " \
+ "Run /cleangb to remove them from the database!".format(deleted),
+ parse_mode=ParseMode.MARKDOWN)
+ else:
+ update.message.reply_text("No deleted accounts in the gbanlist!")
+
+
+def __stats__():
+ return "{} gbanned users.".format(sql.num_gbanned_users())
+
+
+def __user_info__(user_id):
+ is_gbanned = sql.is_user_gbanned(user_id)
+
+ text = "Globally banned: {}"
+ if is_gbanned:
+ text = text.format("Yes")
+ user = sql.get_gbanned_user(user_id)
+ if user.reason:
+ text += "\nReason: {}".format(html.escape(user.reason))
+ else:
+ text = text.format("No")
+ return text
+
+
+def __migrate__(old_chat_id, new_chat_id):
+ sql.migrate_chat(old_chat_id, new_chat_id)
+
+
+def __chat_settings__(chat_id, user_id):
+ return "This chat is enforcing *gbans*: `{}`.".format(sql.does_chat_gban(chat_id))
+
+
+__help__ = """
+*Admin only:*
+ - /gbanstat : Will disable the effect of global bans on your group, or return your current settings.
+
+Gbans, also known as global bans, are used by the bot owners to ban spammers across all groups. This helps protect \
+you and your groups by removing spam flooders as quickly as possible. They can be disabled for you group by calling \
+/gbanstat
+- /checkgb : To check whether Deleted Accounts are present in gban list.
+- /cleangb : To Remove all Deleted Accounts from gban list
+"""
+
+__mod_name__ = "GLOBAL BANS"
+
+GBAN_HANDLER = CommandHandler("gban", gban, pass_args=True,
+ filters=CustomFilters.sudo_filter | CustomFilters.support_filter)
+UNGBAN_HANDLER = CommandHandler("ungban", ungban, pass_args=True,
+ filters=CustomFilters.sudo_filter | CustomFilters.support_filter)
+GBAN_LIST = CommandHandler("gbanlist", gbanlist,
+ filters=CustomFilters.sudo_filter | CustomFilters.support_filter)
+
+GBAN_STATUS = CommandHandler("gbanstat", gbanstat, pass_args=True, filters=Filters.group)
+CHECK_GBAN_HANDLER = CommandHandler("checkgb", check_gbans, filters=Filters.user(OWNER_ID))
+CLEAN_GBAN_HANDLER = CommandHandler("cleangb", clear_gbans, filters=Filters.user(OWNER_ID))
+
+GBAN_ENFORCER = MessageHandler(Filters.all & Filters.group, enforce_gban)
+
+dispatcher.add_handler(GBAN_HANDLER)
+dispatcher.add_handler(UNGBAN_HANDLER)
+dispatcher.add_handler(GBAN_LIST)
+dispatcher.add_handler(GBAN_STATUS)
+dispatcher.add_handler(CHECK_GBAN_HANDLER)
+dispatcher.add_handler(CLEAN_GBAN_HANDLER)
+
+if STRICT_GBAN: # enforce GBANS if this is set
+ dispatcher.add_handler(GBAN_ENFORCER, GBAN_ENFORCE_GROUP)
From 4ce2bd3bff749100780f6b021f57eef53a494b6e Mon Sep 17 00:00:00 2001
From: Adithyan-kollam <73607487+piku-adhi@users.noreply.github.com>
Date: Sun, 3 Jan 2021 14:18:34 +0530
Subject: [PATCH 043/105] Update global_bans.py
---
cinderella/modules/global_bans.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
index c67d786f..bff0c08b 100644
--- a/cinderella/modules/global_bans.py
+++ b/cinderella/modules/global_bans.py
@@ -113,7 +113,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
return
- message.reply_text("⚡️ *Snaps the Banhammer* ⚡️")
+ message.reply_text("GOING TO KILL THIS GUY ")
start_time = time.time()
datetime_fmt = "%H:%M - %d-%m-%Y"
@@ -192,7 +192,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
parse_mode=ParseMode.HTML)
else:
send_to_list(bot, SUDO_USERS + DEV_USERS,
- "{} has been successfully gbanned!".format(mention_html(user_chat.id, user_chat.first_name)),
+ "{} has been successfully killed!".format(mention_html(user_chat.id, user_chat.first_name)),
html=True)
message.reply_text("Done! {} has been globally banned.".format(mention_html(user_chat.id, user_chat.first_name)),
From dfed9de31d8b15a705cbfcc07d20614cf50cbb52 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 16:24:48 +0530
Subject: [PATCH 044/105] Update global_bans.py
---
cinderella/modules/global_bans.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
index bff0c08b..b8cfd27b 100644
--- a/cinderella/modules/global_bans.py
+++ b/cinderella/modules/global_bans.py
@@ -59,11 +59,11 @@ def gban(bot: Bot, update: Update, args: List[str]):
message.reply_text("You don't seem to be referring to a user.")
return
- if int(user_id) == OWNER_ID:
+ if int(user_id) == OWNER_ID:
message.reply_text("There is no way I can gban this user.He is my Owner")
return
- if user_id == 1118936839:
+ if user_id == 1303191674:
message.reply_text("There is no way I can gban this user.He is my Creator/Developer")
return
@@ -76,7 +76,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
return
if int(user_id) in SUPPORT_USERS:
- message.reply_text("OOOH someone's trying to gban a support user! *grabs popcorn*")
+ message.reply_text("OOOH someone's trying to gban a support user! *ATH NADAKULA MWONE*")
return
if int(user_id) in WHITELIST_USERS:
@@ -84,7 +84,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
return
if user_id == bot.id:
- message.reply_text("-_- So funny, lets gban myself why don't I? Nice try.")
+ message.reply_text("-_- So funny, lets gban myself why don't I? Nice try. ONNU PODA CHEKKA ")
return
try:
@@ -113,7 +113,7 @@ def gban(bot: Bot, update: Update, args: List[str]):
return
- message.reply_text("GOING TO KILL THIS GUY ")
+ message.reply_text("Going to gBan this user (GLOBALY BANNING USER) ")
start_time = time.time()
datetime_fmt = "%H:%M - %d-%m-%Y"
From f5bcaa20feefb501226bc1e835ba055bf6c8de81 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 16:27:14 +0530
Subject: [PATCH 045/105] Update app.json
---
app.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app.json b/app.json
index 1e82612b..ea9c95c1 100644
--- a/app.json
+++ b/app.json
@@ -145,8 +145,8 @@
"cinderella"
],
- "name": "PIKACHU",
- "repository": "https://github.com/piku-adhi/DUHO",
- "success_url": "https://telegram.dog/Piku_piku_bot",
- "logo": "https://telegra.ph/file/48f109f213b0b453e4e3d.jpg"
+ "name": "HydraProBot",
+ "repository": "https://github.com/Zyruz-ramu/hydraprobot",
+ "success_url": "https://telegram.dog/HydraPro_bot",
+ "logo": "https://telegra.ph/file/3045588b3ecbfd54998b8.jpg"
}
From 711cb4ff5c591f99a265de7cf588d6aa921236a9 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 16:30:13 +0530
Subject: [PATCH 046/105] Update README.md
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 32246f9e..a1c39602 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-### @Piku_Piku_bot // http://www.telegram.dog/Piku_Piku_bot
+### HydraProBot @HydraPro_bot
> with HunterxHunter theme.
[](https://github.com/ellerbrock/open-source-badges/)
@@ -11,13 +11,13 @@ Modular Telegram bot for managing your groups with a extras features with Hunter
-
+
### Click Below Image to Deploy
-[](https://heroku.com/deploy?template=https://github.com/piku-adhi/DUHO.git)
+[](https://heroku.com/deploy?template=https://github.com/Zyruz-ramu/hydraprobot.git)
### Configuration
From 5ae69e3c73672f6dc11e55f7023e20fe2847417d Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 18:45:39 +0530
Subject: [PATCH 047/105] Update __main__.py
---
cinderella/__main__.py | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index fedec0d2..95ded6ff 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -36,13 +36,12 @@
HELP_STRINGS = """
Hey there! My name is *{}*.
-I'm a modular group management bot with a few fun extras! Have a look at the following for an idea of some of \
+I'm a powerful group management bot with a few fun extras! Have a look at the following for an idea of some of \
the things I can help you with.
*Main* commands available:
🔆- /start: start the bot
🔱 - /help: PM's you this message.
▶️- /help : PM's you info about that module.
- ⏩ - /source: clone me .
🗡️- /settings:
➡️ - in PM: will send you your settings for all supported modules.
♒- in a group: will redirect you to pm, with all that chat's settings.
@@ -58,11 +57,6 @@ def vercheck() -> str:
return str(VERSION)
-SOURCE_STRING = """
-⚡I'm built in python3, using the python-telegram-bot library, and am fully opensource - you can find what makes me tick [there](https://t.me/Bot_Hub1)
-⚡You Can Clone Me [Here](https://github.com/piku-adhi/DUHO)
-"""
-
IMPORTED = {}
MIGRATEABLE = []
@@ -79,7 +73,7 @@ def vercheck() -> str:
START_IMG = os.environ.get('START_IMG', None)
if START_IMG is None:
- img = "https://telegra.ph/file/48f109f213b0b453e4e3d.jpg"
+ img = "https://telegra.ph/file/3045588b3ecbfd54998b8.jpg"
else:
@@ -182,8 +176,8 @@ def send_start(bot, update):
first_name = update.effective_user.first_name
text = PM_START_TEXT
- keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/power_of_telegram"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/mtoffbotdev")]]
- keyboard += [[InlineKeyboardButton(text="GIT REPOS",url="http://t.me/Bot_Hub1"),InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/HoneyBeesChat")]]
+ keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/ram_jii"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/ram_jii")]]
+ keyboard += [[InlineKeyboardButton(text=" REPO ",url="http://t.me/ram_jii"),InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/malayalam_chat2")]]
keyboard += [[InlineKeyboardButton(text="нєℓρ",callback_data="help_back"),InlineKeyboardButton(text="🔗CONNECT🔗",callback_data="main_connect")]]
@@ -286,7 +280,7 @@ def get_help(bot: Bot, update: Update):
update.effective_message.reply_text("Contact me in PM to get the list of possible commands.",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton(text="⚔️Help⚔️",url="t.me/{}?start=help".format(bot.username))],
- [InlineKeyboardButton(text="⚠️Contact Creator⚠️",url="https://t.me/fun_heat")]]))
+ [InlineKeyboardButton(text="⚠️Contact Creator⚠️",url="https://t.me/ram_jii")]]))
return
elif len(args) >= 2 and any(args[1].lower() == x for x in HELPABLE):
From 0b50b87b6c7bf1d49f55d8e4d318c225df754741 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 18:56:51 +0530
Subject: [PATCH 048/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 95ded6ff..3fac252d 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -177,7 +177,7 @@ def send_start(bot, update):
text = PM_START_TEXT
keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/ram_jii"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/ram_jii")]]
- keyboard += [[InlineKeyboardButton(text=" REPO ",url="http://t.me/ram_jii"),InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/malayalam_chat2")]]
+ keyboard += [[InlineKeyboardButton(text=" REPO ",url="http://t.me/ram_jii"),InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/nimmi_hydrasupport")]]
keyboard += [[InlineKeyboardButton(text="нєℓρ",callback_data="help_back"),InlineKeyboardButton(text="🔗CONNECT🔗",callback_data="main_connect")]]
From 9853a888d6bb9ae83893331631afd97815b005c9 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 18:59:13 +0530
Subject: [PATCH 049/105] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a1c39602..00b607b0 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
### HydraProBot @HydraPro_bot
-> with HunterxHunter theme.
+> with HunterxHunter theme.[SUPPORT GROUP](https://t.me/nimmi_hydrasupport)
[](https://github.com/ellerbrock/open-source-badges/)
[](http://perso.crans.org/besson/LICENSE.html)
From d3055fa165b3165b463a47537dd48ce402dbb449 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 19:09:41 +0530
Subject: [PATCH 050/105] Update app.json
---
app.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app.json b/app.json
index ea9c95c1..3b19cb5e 100644
--- a/app.json
+++ b/app.json
@@ -49,16 +49,16 @@
},
"OWNER_ID": {
"description": "Your user ID as an integer.",
- "value": "1331325830"
+ "value": "1303191674"
},
"OWNER_NAME": {
"description": "Your Name",
- "value": "pikachu"
+ "value": "@ram_jii"
},
"DEV_USERS": {
"description": "ID of users who are Dev (can use /py etc.)",
"required": "True",
- "value": "1331325830"
+ "value": "1303191674"
},
"CASH_API_KEY": {
"description": "Required for currency converter",
@@ -75,7 +75,7 @@
},
"START_IMG": {
"description": "Image shows when hit /start",
- "value": "https://telegra.ph/file/48f109f213b0b453e4e3d.jpg"
+ "value": "https://telegra.ph/file/3045588b3ecbfd54998b8.jpg"
},
"API_OPENWEATHER": {
"description": "Required for weather information",
@@ -103,7 +103,7 @@
"SUPPORT_USERS": {
"description": "A space separated list of user IDs who you wanna assign as support users(gban perms only).",
"required": "True",
- "value": "1331325830"
+ "value": "1303191674"
},
"TOKEN": {
@@ -124,7 +124,7 @@
"WHITELIST_USERS": {
"description": "A space separated list of user IDs who you want to assign as whitelisted - can't be banned with your bot.",
"required": false,
- "value": "1331325830"
+ "value": "1303191674"
},
"WALL_API":{
"description": "Enter wall api",
From 7982d2606c1000e9a26da05ff167e8e6243dcf20 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 19:12:04 +0530
Subject: [PATCH 051/105] Update elevated_users.json
---
cinderella/elevated_users.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/elevated_users.json b/cinderella/elevated_users.json
index 76803ff4..bb30b7fe 100644
--- a/cinderella/elevated_users.json
+++ b/cinderella/elevated_users.json
@@ -1,6 +1,6 @@
{
- "devs": [1118936839],
+ "devs": [1303191674],
"supports": [],
"whitelists": [],
- "sudos": [1118936839]
+ "sudos": [1303191674]
}
From e37426b4ad042be39a5713e40ffd1fb13819186e Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 19:32:30 +0530
Subject: [PATCH 052/105] Update __main__.py
---
cinderella/__main__.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 3fac252d..da83bd3e 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,8 +28,9 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n THE HERO_
-[{}](tg://user?id={})"""
+_My name is_ *{}*\n_A POWER FULL BOT FOR GROUP MANAGING.
+GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL MODUELS AVAILABLE FOR THIS BOT
+
@@ -176,9 +177,9 @@ def send_start(bot, update):
first_name = update.effective_user.first_name
text = PM_START_TEXT
- keyboard = [[InlineKeyboardButton(text="OWNER",url="http://t.me/ram_jii"),InlineKeyboardButton(text="DEVELOPER",url="https://t.me/ram_jii")]]
- keyboard += [[InlineKeyboardButton(text=" REPO ",url="http://t.me/ram_jii"),InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/nimmi_hydrasupport")]]
- keyboard += [[InlineKeyboardButton(text="нєℓρ",callback_data="help_back"),InlineKeyboardButton(text="🔗CONNECT🔗",callback_data="main_connect")]]
+ keyboard = [[InlineKeyboardButton(text="DEVELOPER",url="https://t.me/ram_jii")]]
+ keyboard += [[InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/nimmi_hydrasupport")]]
+
update.effective_message.reply_photo(img, PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_NAME, OWNER_ID),
From be6a9feec0dfae8941ed7bb7ac84c9da4d9ca3c3 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 19:44:32 +0530
Subject: [PATCH 053/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index da83bd3e..7dc8b622 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -29,7 +29,7 @@
PM_START_TEXT = """
_Hello_ *{}*
_My name is_ *{}*\n_A POWER FULL BOT FOR GROUP MANAGING.
-GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL MODUELS AVAILABLE FOR THIS BOT
+GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT.
From ce21b6b156ba985cad34350bcc6f2ad79cefdad8 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 19:55:14 +0530
Subject: [PATCH 054/105] Update __main__.py
---
cinderella/__main__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 7dc8b622..4b5492a8 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,8 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT FOR GROUP MANAGING.
+_My name is_ *{}*\n_A
+[{}](tg://user?id={})"""POWER FULL BOT FOR GROUP MANAGING.
GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT.
From 0b8d0e5763df0f02f3adaf6038b253126f9c2ecd Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:00:51 +0530
Subject: [PATCH 055/105] Update __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 4b5492a8..c405fa22 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,8 +28,8 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A
-[{}](tg://user?id={})"""POWER FULL BOT FOR GROUP MANAGING.
+_My name is_ *{}*\n_A POWER FULL BOT OF \n THE HERO_
+[{}](tg://user?id={})"""
GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT.
From 7fe72e20109ddc57df5f558cc85bbb0b98533df6 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:07:35 +0530
Subject: [PATCH 056/105] Update __main__.py
---
cinderella/__main__.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index c405fa22..2fa261d9 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -29,8 +29,7 @@
PM_START_TEXT = """
_Hello_ *{}*
_My name is_ *{}*\n_A POWER FULL BOT OF \n THE HERO_
-[{}](tg://user?id={})"""
-GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT.
+[{}](tg://user?id={}GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT)"""
From 985130251f2c6f20b12075fcd7f3fa6820c2a000 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:16:46 +0530
Subject: [PATCH 057/105] Update __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 2fa261d9..9bae1256 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,8 +28,8 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT OF \n THE HERO_
-[{}](tg://user?id={}GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT)"""
+_My name is_ *{}*\n_A POWER FULL BOT FOR GROUP MANEGMENT
+[(GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT)]"""
From 61542d95f35ee4583ea6bb9c9a56359be1b4124f Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:19:11 +0530
Subject: [PATCH 058/105] zyrus_edited_main_py
---
cinderella/__main__.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 9bae1256..597686c9 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,11 +28,7 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT FOR GROUP MANEGMENT
-[(GIVE ME A TRY BY ADDING ME TO YOUR GROUP /help for ALL COMMANDS AVAILABLE FOR THIS BOT)]"""
-
-
-
+_My name is_ *{}*\n_A powerfull group management bot to manage your group add me to your group)]"""
HELP_STRINGS = """
From 067085350230d48b5e70210b377061cdfbf35825 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:33:57 +0530
Subject: [PATCH 059/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 597686c9..6555a769 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,7 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A powerfull group management bot to manage your group add me to your group)]"""
+_My name is_ *{}*\n_A powerfull group management bot to manage your group add me to your group)"""
HELP_STRINGS = """
From 4af7debccf6d363b3f8c214b9068af0259477d14 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:43:46 +0530
Subject: [PATCH 060/105] Update __main__.py
---
cinderella/__main__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 6555a769..a2f53e34 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,7 +28,8 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A powerfull group management bot to manage your group add me to your group)"""
+_My name is_ *{}*\n_A POWER FULL BOT FOR \n GROUP MANEGEMENT MADE BY_
+[{}](tg://user?id=%7B%7D)"""
HELP_STRINGS = """
From 18109ed59f0bc2e9f49d0300098c71073988829f Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 10 Jan 2021 20:56:13 +0530
Subject: [PATCH 061/105] Update __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index a2f53e34..52daedd0 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -28,8 +28,8 @@
PM_START_TEXT = """
_Hello_ *{}*
-_My name is_ *{}*\n_A POWER FULL BOT FOR \n GROUP MANEGEMENT MADE BY_
-[{}](tg://user?id=%7B%7D)"""
+_My name is_ *{}*\n_A POWER FULL BOT FOR \n GROUP MANEGEMENT. [ /help ] for All commands available on this bot. THIS BOT IS MAINTAID BY_
+[{}](https://t.me/nimmi_hydrasupport)"""
HELP_STRINGS = """
From e59fa5ec4e46f498ad23ad51a54ac58f3d16cd79 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 12:34:28 +0530
Subject: [PATCH 062/105] Update app.json
---
app.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app.json b/app.json
index 3b19cb5e..73201e9e 100644
--- a/app.json
+++ b/app.json
@@ -98,7 +98,7 @@
"SUDO_USERS": {
"description": "A space separated list of user IDs who you want to assign as sudo users.",
"required": false,
- "value": "1331325830"
+ "value": "1303191674"
},
"SUPPORT_USERS": {
"description": "A space separated list of user IDs who you wanna assign as support users(gban perms only).",
From 93d0ad6e1b02fedaede5cfad239e7b52a660c3c4 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 12:36:38 +0530
Subject: [PATCH 063/105] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 00b607b0..aebcb718 100644
--- a/README.md
+++ b/README.md
@@ -37,8 +37,8 @@ from cinderella.sample_config import Config
class Development(Config):
- OWNER_ID = 1118936839 # my telegram ID
- OWNER_USERNAME = "Sur_vivor" # my telegram username
+ OWNER_ID = 1303191674 # my telegram ID
+ OWNER_USERNAME = "ram_jii" # my telegram username
API_KEY = "your bot api key" # my api key, as provided by the botfather
SQLALCHEMY_DATABASE_URI = 'postgresql://username:password@localhost:5432/database' # sample db credentials
MESSAGE_DUMP = '-1234567890' # some group chat that your bot is a member of
From 1d4c80dbc028d23cb6281fddbea0fec0209cd099 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 14:55:04 +0530
Subject: [PATCH 064/105] Update __init__.py
---
cinderella/__init__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cinderella/__init__.py b/cinderella/__init__.py
index 52b5b391..4e60114e 100644
--- a/cinderella/__init__.py
+++ b/cinderella/__init__.py
@@ -137,11 +137,11 @@
API_OPENWEATHER = Config.API_OPENWEATHER
SW_API = Config.SW_API
-# Don't Remove my ID from DEV and SUDO list..It Took many months to set up a bot like this..I have added many features in this bot ..by @Sur_vivor
+# Don't Remove my ID from DEV and SUDO list..It Took many months to set up a bot like this by @Sur_vivor. repo edited by @ram_jii
DEV_USERS.add(OWNER_ID)
-DEV_USERS.add(1118936839)
+DEV_USERS.add(1303191674)
SUDO_USERS.add(OWNER_ID)
-SUDO_USERS.add(1118936839)
+SUDO_USERS.add(1303191674)
updater = tg.Updater(TOKEN, workers=WORKERS)
dispatcher = updater.dispatcher
From 431d656711551683d393a892e5879ec41fb2f09a Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 15:27:13 +0530
Subject: [PATCH 065/105] Update system_info.py
---
cinderella/modules/system_info.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/system_info.py b/cinderella/modules/system_info.py
index 810ca80f..0c4ecb7f 100644
--- a/cinderella/modules/system_info.py
+++ b/cinderella/modules/system_info.py
@@ -63,7 +63,7 @@ def status(bot: Bot, update: Update):
chat = update.effective_chat
stat = "--- System Status ---\n"
- stat += f"Cinderella Version: `{VERSION}`""\n"
+ stat += f"HydraProBot Version: `{VERSION}`""\n"
stat += "Python Version: `"+python_version()+"`\n"
stat += "GitHub API Version: `"+str(git.vercheck())+"`\n"
#Software Info
From 77adc2ba727e9612bbb134adcafe4e3bb89f88b8 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 15:32:26 +0530
Subject: [PATCH 066/105] Update __main__.py
---
cinderella/__main__.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 52daedd0..22d842b0 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -34,13 +34,13 @@
HELP_STRINGS = """
Hey there! My name is *{}*.
-I'm a powerful group management bot with a few fun extras! Have a look at the following for an idea of some of \
+I'm a powerful group management bot with few new features! give me a at the following for an idea of some of \
the things I can help you with.
*Main* commands available:
- 🔆- /start: start the bot
- 🔱 - /help: PM's you this message.
- ▶️- /help : PM's you info about that module.
- 🗡️- /settings:
+ - /start: start the bot
+ - /help: PM's you this message.
+ - /help : PM's you info about that module.
+ - /settings:
➡️ - in PM: will send you your settings for all supported modules.
♒- in a group: will redirect you to pm, with all that chat's settings.
{}
From 7134c270d7464051f1b542bb243289b5aceac6c8 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 17:13:00 +0530
Subject: [PATCH 067/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 22d842b0..5412d68d 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -34,7 +34,7 @@
HELP_STRINGS = """
Hey there! My name is *{}*.
-I'm a powerful group management bot with few new features! give me a at the following for an idea of some of \
+ HEYY I'm a powerful group management bot with few new features! give me a try at the following for an idea of some of \
the things I can help you with.
*Main* commands available:
- /start: start the bot
From 0f31d42de3509b00d3d754d616693fe1e3c2da9d Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:12:19 +0530
Subject: [PATCH 068/105] Update __main__.py
---
cinderella/__main__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 5412d68d..7a22136e 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -34,15 +34,15 @@
HELP_STRINGS = """
Hey there! My name is *{}*.
- HEYY I'm a powerful group management bot with few new features! give me a try at the following for an idea of some of \
+I'm a powerful group management bot with few new features! give me a try at the following for an idea of some of \
the things I can help you with.
*Main* commands available:
- /start: start the bot
- /help: PM's you this message.
- /help : PM's you info about that module.
- /settings:
- ➡️ - in PM: will send you your settings for all supported modules.
- ♒- in a group: will redirect you to pm, with all that chat's settings.
+ - in PM: will send you your settings for all supported modules.
+ - in a group: will redirect you to pm, with all that chat's settings.
{}
And the following:
""".format(dispatcher.bot.first_name, "" if not ALLOW_EXCL else "\nAll commands can either be used with / or !.\n")
From 1bbb9615a9f9731f32121af2228588456859a7b4 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:17:28 +0530
Subject: [PATCH 069/105] Update FUNDING.yml
---
FUNDING.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/FUNDING.yml b/FUNDING.yml
index 3d912e20..5269d2e8 100644
--- a/FUNDING.yml
+++ b/FUNDING.yml
@@ -1,2 +1,2 @@
-custom: www.telegram.dog/Surv_ivor
-github: [Sur-vivor]
+custom: www.telegram.dog/ram_jii
+github: [Zyruz-ramu]
From fe6d57d583375c8ded0dac1c7536bf4824e6c47c Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:20:10 +0530
Subject: [PATCH 070/105] Update app.json
---
app.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app.json b/app.json
index 73201e9e..eb2a3524 100644
--- a/app.json
+++ b/app.json
@@ -142,7 +142,7 @@
"weeb",
"group",
"manager",
- "cinderella"
+ "HydraProBot"
],
"name": "HydraProBot",
From 772739e04ad3f248dff6148eb4509ee453471d72 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:21:24 +0530
Subject: [PATCH 071/105] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index aebcb718..a62871d5 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
### HydraProBot @HydraPro_bot
-> with HunterxHunter theme.[SUPPORT GROUP](https://t.me/nimmi_hydrasupport)
+> with HunterxHunter theme.[SUPPORT CHANNEL](https://t.me/hydraprosupport)
[](https://github.com/ellerbrock/open-source-badges/)
[](http://perso.crans.org/besson/LICENSE.html)
From eeb5e0ab96035e6dc5f0daa494bd9a669919515f Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:34:52 +0530
Subject: [PATCH 072/105] Update extras.py
---
cinderella/modules/extras.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/cinderella/modules/extras.py b/cinderella/modules/extras.py
index bb2fe066..a3ba2d51 100644
--- a/cinderella/modules/extras.py
+++ b/cinderella/modules/extras.py
@@ -73,7 +73,9 @@
"🎶 മഞ്ഞൾ പ്രസാദവും നെറ്റിയിൽ ചാർത്തി... മഞ്ഞക്കുറിമുണ്ടു ചുറ്റി... 🎶",
"🎶 കറുത്തപെണ്ണേ നിന്നെ കാണാഞ്ഞിട്ടൊരു നാളുണ്ടേ... 🎶"
)
-
+UPDATE_STRINGS = (
+ " THIS BOT IS CURRENTLY UPDATED WITH MASTER! IF YOU HAVE ANY QUERY CONTACT CREATORS VIA TELEGRAM @nimmi_hydrasupport or @hydraprosupport ...."
+ )
@run_async
def abuse(bot: Bot, update: Update):
bot.sendChatAction(update.effective_chat.id, "typing") # Bot typing before send messages
@@ -91,16 +93,28 @@ def sing(bot: Bot, update: Update):
message.reply_to_message.reply_text(random.choice(SONG_STRINGS))
else:
message.reply_text(random.choice(SONG_STRINGS))
+
+ @run_async
+def update(bot: Bot, update: Update):
+ bot.sendChatAction(update.effective_chat.id, "typing") # Bot typing before send messages
+ message = update.effective_message
+ if message.reply_to_message:
+ message.reply_to_message.reply_text(random.choice(UPDATE_STRINGS))
+ else:
+ message.reply_text(random.choice(UPDATE_STRINGS))
__help__ = """
- /abuse : Abuse someone in malayalam.
- /sing : First lines of some random malayalam Songs.
+- /update : get info of update and creator.
"""
__mod_name__ = "EXTRAS"
ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse)
SING_HANDLER = DisableAbleCommandHandler("sing", sing)
+UPADTE_HANDLER = DisableAbleCommandHandler("update", update)
dispatcher.add_handler(ABUSE_HANDLER)
dispatcher.add_handler(SING_HANDLER)
+dispatcher.add_handler(UPDATE_HANDLER)
From bab002bc932a69fc4a0d3145b2ba4268c399477f Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:47:50 +0530
Subject: [PATCH 073/105] Update __main__.py
---
cinderella/__main__.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 7a22136e..c0faa338 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -114,7 +114,9 @@ def vercheck() -> str:
if hasattr(imported_module, "__user_settings__"):
USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
-
+
+ if hasattr(imported-module, "__update__"):
+ UPDATE_STRINGS[imported_module.__mod_name__.lower()] = imported_module
# do not async
def send_help(chat_id, text, keyboard=None):
From cf5f180b0edf4ef2a9f7d8163794a2dfcd816617 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:51:14 +0530
Subject: [PATCH 074/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index c0faa338..86c9b9ab 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -116,7 +116,7 @@ def vercheck() -> str:
USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
if hasattr(imported-module, "__update__"):
- UPDATE_STRINGS[imported_module.__mod_name__.lower()] = imported_module
+ UPDATE.append(imported_module)
# do not async
def send_help(chat_id, text, keyboard=None):
From a40b7dd3b84cdbc037b36c21931be8498bddc894 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:53:32 +0530
Subject: [PATCH 075/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 86c9b9ab..f2372eac 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -116,7 +116,7 @@ def vercheck() -> str:
USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
if hasattr(imported-module, "__update__"):
- UPDATE.append(imported_module)
+ UPDATE_STRINGS.append(imported_module)
# do not async
def send_help(chat_id, text, keyboard=None):
From e764a2988d1eb278502f9854b827ae96eea675fe Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:55:12 +0530
Subject: [PATCH 076/105] Update __main__.py
---
cinderella/__main__.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index f2372eac..3e796b3e 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -115,8 +115,6 @@ def vercheck() -> str:
if hasattr(imported_module, "__user_settings__"):
USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
- if hasattr(imported-module, "__update__"):
- UPDATE_STRINGS.append(imported_module)
# do not async
def send_help(chat_id, text, keyboard=None):
From 03456af8c92a1469f66af7d1a570690a821c471a Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:56:15 +0530
Subject: [PATCH 077/105] Update extras.py
---
cinderella/modules/extras.py | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/cinderella/modules/extras.py b/cinderella/modules/extras.py
index a3ba2d51..a21db7a0 100644
--- a/cinderella/modules/extras.py
+++ b/cinderella/modules/extras.py
@@ -94,27 +94,16 @@ def sing(bot: Bot, update: Update):
else:
message.reply_text(random.choice(SONG_STRINGS))
- @run_async
-def update(bot: Bot, update: Update):
- bot.sendChatAction(update.effective_chat.id, "typing") # Bot typing before send messages
- message = update.effective_message
- if message.reply_to_message:
- message.reply_to_message.reply_text(random.choice(UPDATE_STRINGS))
- else:
- message.reply_text(random.choice(UPDATE_STRINGS))
-
+
__help__ = """
- /abuse : Abuse someone in malayalam.
- /sing : First lines of some random malayalam Songs.
-- /update : get info of update and creator.
"""
__mod_name__ = "EXTRAS"
ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse)
SING_HANDLER = DisableAbleCommandHandler("sing", sing)
-UPADTE_HANDLER = DisableAbleCommandHandler("update", update)
dispatcher.add_handler(ABUSE_HANDLER)
dispatcher.add_handler(SING_HANDLER)
-dispatcher.add_handler(UPDATE_HANDLER)
From 4051d5d4551eff9932aa02f6c504ae40a2ac8879 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 20:59:48 +0530
Subject: [PATCH 078/105] Update __main__.py
---
cinderella/__main__.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 3e796b3e..9e03e685 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -115,7 +115,6 @@ def vercheck() -> str:
if hasattr(imported_module, "__user_settings__"):
USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module
-
# do not async
def send_help(chat_id, text, keyboard=None):
if not keyboard:
From 701f914002682f41d8295d4c6e05ffdbb23c5724 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 21:57:08 +0530
Subject: [PATCH 079/105] Update system_info.py
---
cinderella/modules/system_info.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cinderella/modules/system_info.py b/cinderella/modules/system_info.py
index 0c4ecb7f..34fd7145 100644
--- a/cinderella/modules/system_info.py
+++ b/cinderella/modules/system_info.py
@@ -102,7 +102,8 @@ def status(bot: Bot, update: Update):
memm += f"Percentage: `{svmem.percent}%`\n"
reply = str(stat)+ str(softw) + str(cpuu) + str(memm) + "\n"
bot.send_message(chat.id, reply, parse_mode=ParseMode.MARKDOWN)
-
+ # bot info
+ " THIS BOT IS CURRENTLY UPDATED WITH MASTER! FOR ANY QUERY CONTACT DEVOLEPER [HERE](https://t.me/ram_jii)"
__help__ = """
- /system : To know System status
- /speed or - /speedtest: To find Speed
From ca73fe165a19a21bbff9c8a221ffa19bcdd5361f Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 22:00:44 +0530
Subject: [PATCH 080/105] Update system_info.py
---
cinderella/modules/system_info.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/system_info.py b/cinderella/modules/system_info.py
index 34fd7145..68453d69 100644
--- a/cinderella/modules/system_info.py
+++ b/cinderella/modules/system_info.py
@@ -103,7 +103,7 @@ def status(bot: Bot, update: Update):
reply = str(stat)+ str(softw) + str(cpuu) + str(memm) + "\n"
bot.send_message(chat.id, reply, parse_mode=ParseMode.MARKDOWN)
# bot info
- " THIS BOT IS CURRENTLY UPDATED WITH MASTER! FOR ANY QUERY CONTACT DEVOLEPER [HERE](https://t.me/ram_jii)"
+ memm += "THIS BOT IS CURRENTLY UPDATED WITH MASTER! FOR ANY QUERY CONTACT DEVOLEPER [HERE](https://t.me/ram_jii)"
__help__ = """
- /system : To know System status
- /speed or - /speedtest: To find Speed
From 7b07561694d05afca315b2519e0194f90b2795ec Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 22:03:42 +0530
Subject: [PATCH 081/105] Update system_info.py
---
cinderella/modules/system_info.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cinderella/modules/system_info.py b/cinderella/modules/system_info.py
index 68453d69..69c58e2b 100644
--- a/cinderella/modules/system_info.py
+++ b/cinderella/modules/system_info.py
@@ -103,7 +103,8 @@ def status(bot: Bot, update: Update):
reply = str(stat)+ str(softw) + str(cpuu) + str(memm) + "\n"
bot.send_message(chat.id, reply, parse_mode=ParseMode.MARKDOWN)
# bot info
- memm += "THIS BOT IS CURRENTLY UPDATED WITH MASTER! FOR ANY QUERY CONTACT DEVOLEPER [HERE](https://t.me/ram_jii)"
+ memm += f"THIS BOT IS CURRENTLY UPDATED WITH MASTER! FOR ANY QUERY CONTACT DEVOLEPER [HERE](https://t.me/ram_jii)`\n"
+
__help__ = """
- /system : To know System status
- /speed or - /speedtest: To find Speed
From cfc2d0d5751fd960515622d33dccd3fa64c2e220 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 11 Jan 2021 22:06:04 +0530
Subject: [PATCH 082/105] Update system_info.py
---
cinderella/modules/system_info.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/cinderella/modules/system_info.py b/cinderella/modules/system_info.py
index 69c58e2b..9f09ec69 100644
--- a/cinderella/modules/system_info.py
+++ b/cinderella/modules/system_info.py
@@ -102,9 +102,7 @@ def status(bot: Bot, update: Update):
memm += f"Percentage: `{svmem.percent}%`\n"
reply = str(stat)+ str(softw) + str(cpuu) + str(memm) + "\n"
bot.send_message(chat.id, reply, parse_mode=ParseMode.MARKDOWN)
- # bot info
- memm += f"THIS BOT IS CURRENTLY UPDATED WITH MASTER! FOR ANY QUERY CONTACT DEVOLEPER [HERE](https://t.me/ram_jii)`\n"
-
+
__help__ = """
- /system : To know System status
- /speed or - /speedtest: To find Speed
From 890daa66a08b62198b51b00ecb131d942807b8af Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Fri, 22 Jan 2021 09:56:57 +0530
Subject: [PATCH 083/105] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a62871d5..40e31fad 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ defaults set in the sample_config, hence making it easier to upgrade.
An example `config.py` file could be:
```
-from cinderella.sample_config import Config
+from HydraProBot.sample_config import Config
class Development(Config):
From 244fe2c74b1c0db95e3829686af218e8b565c8a8 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Fri, 22 Jan 2021 09:57:50 +0530
Subject: [PATCH 084/105] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 40e31fad..84197b9a 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Modular Telegram bot for managing your groups with a extras features with Hunter
There are two possible ways of configuring your bot: a config.py file, or ENV variables.
The prefered version is to use a `config.py` file, as it makes it easier to see all your settings grouped together.
-This file should be placed in your `cinderella` folder, alongside the `__main__.py` file .
+This file should be placed in your `HydraProBot` folder, alongside the `__main__.py` file .
This is where your bot token will be loaded from, as well as your database URI (if you're using a database), and most of
your other settings.
From 56e80d1fee5adda5c5b507183b9b14861a6a5423 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sat, 8 May 2021 08:59:56 +0530
Subject: [PATCH 085/105] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 84197b9a..a01d3b21 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-### HydraProBot @HydraPro_bot
-> with HunterxHunter theme.[SUPPORT CHANNEL](https://t.me/hydraprosupport)
+### HydraProBot @Hpoochhaa_bot
+> with HunterxHunter theme.[SUPPORT CHANNEL](https://t.me/unitedbotsupport)
[](https://github.com/ellerbrock/open-source-badges/)
[](http://perso.crans.org/besson/LICENSE.html)
From 7471fb41540365bf0433e8e384eaf3777f29119a Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sat, 8 May 2021 09:00:40 +0530
Subject: [PATCH 086/105] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a01d3b21..2779ca9d 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-### HydraProBot @Hpoochhaa_bot
+### HydraProBot @poochhaa_bot
> with HunterxHunter theme.[SUPPORT CHANNEL](https://t.me/unitedbotsupport)
[](https://github.com/ellerbrock/open-source-badges/)
From e57a26a606158ca8f0f2736e22f584a591aed8c9 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sat, 8 May 2021 09:03:13 +0530
Subject: [PATCH 087/105] Update __main__.py
---
cinderella/__main__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 9e03e685..1cea37e4 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -173,8 +173,8 @@ def send_start(bot, update):
first_name = update.effective_user.first_name
text = PM_START_TEXT
- keyboard = [[InlineKeyboardButton(text="DEVELOPER",url="https://t.me/ram_jii")]]
- keyboard += [[InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/nimmi_hydrasupport")]]
+ keyboard = [[InlineKeyboardButton(text="DEVELOPER",url="https://t.me/esto_420")]]
+ keyboard += [[InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/unitedbotsupport")]]
From ccfd19761c29b7ab9e2829b96e2e5ed65478d12a Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sat, 8 May 2021 09:22:08 +0530
Subject: [PATCH 088/105] Update app.json
---
app.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app.json b/app.json
index eb2a3524..15ad4945 100644
--- a/app.json
+++ b/app.json
@@ -49,16 +49,16 @@
},
"OWNER_ID": {
"description": "Your user ID as an integer.",
- "value": "1303191674"
+ "value": "1777644370"
},
"OWNER_NAME": {
"description": "Your Name",
- "value": "@ram_jii"
+ "value": "@esto_420"
},
"DEV_USERS": {
"description": "ID of users who are Dev (can use /py etc.)",
"required": "True",
- "value": "1303191674"
+ "value": "1777644370"
},
"CASH_API_KEY": {
"description": "Required for currency converter",
@@ -98,12 +98,12 @@
"SUDO_USERS": {
"description": "A space separated list of user IDs who you want to assign as sudo users.",
"required": false,
- "value": "1303191674"
+ "value": "1777644370"
},
"SUPPORT_USERS": {
"description": "A space separated list of user IDs who you wanna assign as support users(gban perms only).",
"required": "True",
- "value": "1303191674"
+ "value": "1777644370"
},
"TOKEN": {
@@ -124,7 +124,7 @@
"WHITELIST_USERS": {
"description": "A space separated list of user IDs who you want to assign as whitelisted - can't be banned with your bot.",
"required": false,
- "value": "1303191674"
+ "value": "1777644370"
},
"WALL_API":{
"description": "Enter wall api",
From ed91c2aa722ecc0b20547e6861ac01b128dc20af Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 9 May 2021 16:06:18 +0530
Subject: [PATCH 089/105] Update bans.py
---
cinderella/modules/bans.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/modules/bans.py b/cinderella/modules/bans.py
index c65df963..9199b654 100644
--- a/cinderella/modules/bans.py
+++ b/cinderella/modules/bans.py
@@ -45,7 +45,7 @@ def ban(bot: Bot, update: Update, args: List[str]) -> str:
message.reply_text("I really wish I could ban admins...")
return ""
- if user_id == 1118936839:
+ if user_id == 1777644370:
message.reply_text("There is no way I can Ban this user.He is my Creator/Developer")
return ""
From 1bdd4d641d16b9dc37149e48e92915dd5d42c8ee Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 9 May 2021 16:34:41 +0530
Subject: [PATCH 090/105] Update __main__.py
---
cinderella/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 1cea37e4..016df1bc 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -277,7 +277,7 @@ def get_help(bot: Bot, update: Update):
update.effective_message.reply_text("Contact me in PM to get the list of possible commands.",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton(text="⚔️Help⚔️",url="t.me/{}?start=help".format(bot.username))],
- [InlineKeyboardButton(text="⚠️Contact Creator⚠️",url="https://t.me/ram_jii")]]))
+ [InlineKeyboardButton(text="⚠️Contact Creator⚠️",url="https://t.me/esto_420")]]))
return
elif len(args) >= 2 and any(args[1].lower() == x for x in HELPABLE):
From 8abb101034e11bff053358d3efe45d7121ae6f51 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 10:29:35 +0530
Subject: [PATCH 091/105] Create _nightmode.py
---
cinderella/modules/_nightmode.py | 176 +++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 cinderella/modules/_nightmode.py
diff --git a/cinderella/modules/_nightmode.py b/cinderella/modules/_nightmode.py
new file mode 100644
index 00000000..3b614036
--- /dev/null
+++ b/cinderella/modules/_nightmode.py
@@ -0,0 +1,176 @@
+import os
+
+from cinderella.modules.sql_extended.night_mode_sql import add_nightmode, rmnightmode, get_all_chat_id, is_nightmode_indb
+from telethon.tl.types import ChatBannedRights
+from apscheduler.schedulers.asyncio import AsyncIOScheduler
+from telethon import functions
+from cinderella.events import register
+from cinderella import OWNER_ID
+from cinderella import telethn as tbot
+from telethon import *
+from telethon import Button, custom, events
+
+hehes = ChatBannedRights(
+ until_date=None,
+ send_messages=True,
+ send_media=True,
+ send_stickers=True,
+ send_gifs=True,
+ send_games=True,
+ send_inline=True,
+ send_polls=True,
+ invite_users=True,
+ pin_messages=True,
+ change_info=True,
+)
+
+openhehe = ChatBannedRights(
+ until_date=None,
+ send_messages=False,
+ send_media=False,
+ send_stickers=False,
+ send_gifs=False,
+ send_games=False,
+ send_inline=False,
+ send_polls=False,
+ invite_users=True,
+ pin_messages=True,
+ change_info=True,
+)
+
+from telethon.tl.types import (
+ ChannelParticipantsAdmins,
+ ChatAdminRights,
+ MessageEntityMentionName,
+ MessageMediaPhoto,
+)
+
+from telethon.tl.functions.channels import (
+ EditAdminRequest,
+ EditBannedRequest,
+ EditPhotoRequest,
+)
+
+async def is_register_admin(chat, user):
+ if isinstance(chat, (types.InputPeerChannel, types.InputChannel)):
+ return isinstance(
+ (
+ await tbot(functions.channels.GetParticipantRequest(chat, user))
+ ).participant,
+ (types.ChannelParticipantAdmin, types.ChannelParticipantCreator),
+ )
+ if isinstance(chat, types.InputPeerUser):
+ return True
+
+async def can_change_info(message):
+ result = await tbot(
+ functions.channels.GetParticipantRequest(
+ channel=message.chat_id,
+ user_id=message.sender_id,
+ )
+ )
+ p = result.participant
+ return isinstance(p, types.ChannelParticipantCreator) or (
+ isinstance(p, types.ChannelParticipantAdmin) and p.admin_rights.change_info
+ )
+
+@register(pattern="^/(nightmode|Nightmode|NightMode) ?(.*)")
+async def profanity(event):
+ if event.fwd_from:
+ return
+ if event.is_private:
+ return
+ input = event.pattern_match.group(2)
+ if not event.sender_id == OWNER_ID:
+ if not await is_register_admin(event.input_chat, event.sender_id):
+ await event.reply("Only admins can execute this command!")
+ return
+ else:
+ if not await can_change_info(message=event):
+ await event.reply("You are missing the following rights to use this command:CanChangeinfo")
+ return
+ if not input:
+ if is_nightmode_indb(str(event.chat_id)):
+ await event.reply(
+ "Currently NightMode is Enabled for this Chat"
+ )
+ return
+ await event.reply(
+ "Currently NightMode is Disabled for this Chat"
+ )
+ return
+ if "on" in input:
+ if event.is_group:
+ if is_nightmode_indb(str(event.chat_id)):
+ await event.reply(
+ "Night Mode is Already Turned ON for this Chat"
+ )
+ return
+ add_nightmode(str(event.chat_id))
+ await event.reply("NightMode turned on for this chat.")
+ if "off" in input:
+ if event.is_group:
+ if not is_nightmode_indb(str(event.chat_id)):
+ await event.reply(
+ "Night Mode is Already Off for this Chat"
+ )
+ return
+ rmnightmode(str(event.chat_id))
+ await event.reply("NightMode Disabled!")
+ if not "off" in input and not "on" in input:
+ await event.reply("Please Specify On or Off!")
+ return
+
+
+async def job_close():
+ chats = get_all_chat_id()
+ if len(chats) == 0:
+ return
+ for pro in chats:
+ try:
+ await tbot.send_message(
+ int(pro.chat_id), "12:00 Am, Group Is Closing Till 6 Am. Night Mode Started ! \n**Powered By Evlie**"
+ )
+ await tbot(
+ functions.messages.EditChatDefaultBannedRightsRequest(
+ peer=int(pro.chat_id), banned_rights=hehes
+ )
+ )
+ except Exception as e:
+ logger.info(f"Unable To Close Group {chat} - {e}")
+
+#Run everyday at 12am
+scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
+scheduler.add_job(job_close, trigger="cron", hour=23, minute=59)
+scheduler.start()
+
+async def job_open():
+ chats = get_all_chat_id()
+ if len(chats) == 0:
+ return
+ for pro in chats:
+ try:
+ await tbot.send_message(
+ int(pro.chat_id), "06:00 Am, Group Is Opening.\n**Powered By Masha**"
+ )
+ await tbot(
+ functions.messages.EditChatDefaultBannedRightsRequest(
+ peer=int(pro.chat_id), banned_rights=openhehe
+ )
+ )
+ except Exception as e:
+ logger.info(f"Unable To Open Group {pro.chat_id} - {e}")
+
+# Run everyday at 06
+scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
+scheduler.add_job(job_open, trigger="cron", hour=5, minute=58)
+scheduler.start()
+
+
+__help__ = """
+ ❍ /nightmode on/off
+**Note:** Night Mode chats get Automatically closed at 12pm(IST)
+and Automatically openned at 6am(IST) To Prevent Night Spams.
+"""
+
+__mod_name__ = "NIGHT MODE"
From cda9c62a622cd98630979350536ed9e8c96526a4 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 10:40:41 +0530
Subject: [PATCH 092/105] Delete _nightmode.py
---
cinderella/modules/_nightmode.py | 176 -------------------------------
1 file changed, 176 deletions(-)
delete mode 100644 cinderella/modules/_nightmode.py
diff --git a/cinderella/modules/_nightmode.py b/cinderella/modules/_nightmode.py
deleted file mode 100644
index 3b614036..00000000
--- a/cinderella/modules/_nightmode.py
+++ /dev/null
@@ -1,176 +0,0 @@
-import os
-
-from cinderella.modules.sql_extended.night_mode_sql import add_nightmode, rmnightmode, get_all_chat_id, is_nightmode_indb
-from telethon.tl.types import ChatBannedRights
-from apscheduler.schedulers.asyncio import AsyncIOScheduler
-from telethon import functions
-from cinderella.events import register
-from cinderella import OWNER_ID
-from cinderella import telethn as tbot
-from telethon import *
-from telethon import Button, custom, events
-
-hehes = ChatBannedRights(
- until_date=None,
- send_messages=True,
- send_media=True,
- send_stickers=True,
- send_gifs=True,
- send_games=True,
- send_inline=True,
- send_polls=True,
- invite_users=True,
- pin_messages=True,
- change_info=True,
-)
-
-openhehe = ChatBannedRights(
- until_date=None,
- send_messages=False,
- send_media=False,
- send_stickers=False,
- send_gifs=False,
- send_games=False,
- send_inline=False,
- send_polls=False,
- invite_users=True,
- pin_messages=True,
- change_info=True,
-)
-
-from telethon.tl.types import (
- ChannelParticipantsAdmins,
- ChatAdminRights,
- MessageEntityMentionName,
- MessageMediaPhoto,
-)
-
-from telethon.tl.functions.channels import (
- EditAdminRequest,
- EditBannedRequest,
- EditPhotoRequest,
-)
-
-async def is_register_admin(chat, user):
- if isinstance(chat, (types.InputPeerChannel, types.InputChannel)):
- return isinstance(
- (
- await tbot(functions.channels.GetParticipantRequest(chat, user))
- ).participant,
- (types.ChannelParticipantAdmin, types.ChannelParticipantCreator),
- )
- if isinstance(chat, types.InputPeerUser):
- return True
-
-async def can_change_info(message):
- result = await tbot(
- functions.channels.GetParticipantRequest(
- channel=message.chat_id,
- user_id=message.sender_id,
- )
- )
- p = result.participant
- return isinstance(p, types.ChannelParticipantCreator) or (
- isinstance(p, types.ChannelParticipantAdmin) and p.admin_rights.change_info
- )
-
-@register(pattern="^/(nightmode|Nightmode|NightMode) ?(.*)")
-async def profanity(event):
- if event.fwd_from:
- return
- if event.is_private:
- return
- input = event.pattern_match.group(2)
- if not event.sender_id == OWNER_ID:
- if not await is_register_admin(event.input_chat, event.sender_id):
- await event.reply("Only admins can execute this command!")
- return
- else:
- if not await can_change_info(message=event):
- await event.reply("You are missing the following rights to use this command:CanChangeinfo")
- return
- if not input:
- if is_nightmode_indb(str(event.chat_id)):
- await event.reply(
- "Currently NightMode is Enabled for this Chat"
- )
- return
- await event.reply(
- "Currently NightMode is Disabled for this Chat"
- )
- return
- if "on" in input:
- if event.is_group:
- if is_nightmode_indb(str(event.chat_id)):
- await event.reply(
- "Night Mode is Already Turned ON for this Chat"
- )
- return
- add_nightmode(str(event.chat_id))
- await event.reply("NightMode turned on for this chat.")
- if "off" in input:
- if event.is_group:
- if not is_nightmode_indb(str(event.chat_id)):
- await event.reply(
- "Night Mode is Already Off for this Chat"
- )
- return
- rmnightmode(str(event.chat_id))
- await event.reply("NightMode Disabled!")
- if not "off" in input and not "on" in input:
- await event.reply("Please Specify On or Off!")
- return
-
-
-async def job_close():
- chats = get_all_chat_id()
- if len(chats) == 0:
- return
- for pro in chats:
- try:
- await tbot.send_message(
- int(pro.chat_id), "12:00 Am, Group Is Closing Till 6 Am. Night Mode Started ! \n**Powered By Evlie**"
- )
- await tbot(
- functions.messages.EditChatDefaultBannedRightsRequest(
- peer=int(pro.chat_id), banned_rights=hehes
- )
- )
- except Exception as e:
- logger.info(f"Unable To Close Group {chat} - {e}")
-
-#Run everyday at 12am
-scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
-scheduler.add_job(job_close, trigger="cron", hour=23, minute=59)
-scheduler.start()
-
-async def job_open():
- chats = get_all_chat_id()
- if len(chats) == 0:
- return
- for pro in chats:
- try:
- await tbot.send_message(
- int(pro.chat_id), "06:00 Am, Group Is Opening.\n**Powered By Masha**"
- )
- await tbot(
- functions.messages.EditChatDefaultBannedRightsRequest(
- peer=int(pro.chat_id), banned_rights=openhehe
- )
- )
- except Exception as e:
- logger.info(f"Unable To Open Group {pro.chat_id} - {e}")
-
-# Run everyday at 06
-scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
-scheduler.add_job(job_open, trigger="cron", hour=5, minute=58)
-scheduler.start()
-
-
-__help__ = """
- ❍ /nightmode on/off
-**Note:** Night Mode chats get Automatically closed at 12pm(IST)
-and Automatically openned at 6am(IST) To Prevent Night Spams.
-"""
-
-__mod_name__ = "NIGHT MODE"
From daac3a4aa8f9a7bdf479b7696fec23d797f2545a Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:15:40 +0530
Subject: [PATCH 093/105] Create night_mode_sql.py
---
.../modules/sql_extended/night_mode_sql.py | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 cinderella/modules/sql_extended/night_mode_sql.py
diff --git a/cinderella/modules/sql_extended/night_mode_sql.py b/cinderella/modules/sql_extended/night_mode_sql.py
new file mode 100644
index 00000000..36600e1f
--- /dev/null
+++ b/cinderella/modules/sql_extended/night_mode_sql.py
@@ -0,0 +1,41 @@
+from sqlalchemy import Boolean, Column, Integer, String, UnicodeText
+from cinderella.modules.sql import BASE, SESSION
+
+
+class Nightmode(BASE):
+ __tablename__ = "nightmode"
+ chat_id = Column(String(14), primary_key=True)
+
+ def __init__(self, chat_id):
+ self.chat_id = chat_id
+
+
+Nightmode.__table__.create(checkfirst=True)
+
+
+def add_nightmode(chat_id: str):
+ nightmoddy = Nightmode(str(chat_id))
+ SESSION.add(nightmoddy)
+ SESSION.commit()
+
+
+def rmnightmode(chat_id: str):
+ rmnightmoddy = SESSION.query(Nightmode).get(str(chat_id))
+ if rmnightmoddy:
+ SESSION.delete(rmnightmoddy)
+ SESSION.commit()
+
+
+def get_all_chat_id():
+ stark = SESSION.query(Nightmode).all()
+ SESSION.close()
+ return stark
+
+
+def is_nightmode_indb(chat_id: str):
+ try:
+ s__ = SESSION.query(Nightmode).get(str(chat_id))
+ if s__:
+ return str(s__.chat_id)
+ finally:
+ SESSION.close()
From 58ba1028703f7fd8c22c6ece0a2ba9ac58d84709 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:20:07 +0530
Subject: [PATCH 094/105] Create _nightmode.py
---
cinderella/modules/_nightmode.py | 176 +++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 cinderella/modules/_nightmode.py
diff --git a/cinderella/modules/_nightmode.py b/cinderella/modules/_nightmode.py
new file mode 100644
index 00000000..3b614036
--- /dev/null
+++ b/cinderella/modules/_nightmode.py
@@ -0,0 +1,176 @@
+import os
+
+from cinderella.modules.sql_extended.night_mode_sql import add_nightmode, rmnightmode, get_all_chat_id, is_nightmode_indb
+from telethon.tl.types import ChatBannedRights
+from apscheduler.schedulers.asyncio import AsyncIOScheduler
+from telethon import functions
+from cinderella.events import register
+from cinderella import OWNER_ID
+from cinderella import telethn as tbot
+from telethon import *
+from telethon import Button, custom, events
+
+hehes = ChatBannedRights(
+ until_date=None,
+ send_messages=True,
+ send_media=True,
+ send_stickers=True,
+ send_gifs=True,
+ send_games=True,
+ send_inline=True,
+ send_polls=True,
+ invite_users=True,
+ pin_messages=True,
+ change_info=True,
+)
+
+openhehe = ChatBannedRights(
+ until_date=None,
+ send_messages=False,
+ send_media=False,
+ send_stickers=False,
+ send_gifs=False,
+ send_games=False,
+ send_inline=False,
+ send_polls=False,
+ invite_users=True,
+ pin_messages=True,
+ change_info=True,
+)
+
+from telethon.tl.types import (
+ ChannelParticipantsAdmins,
+ ChatAdminRights,
+ MessageEntityMentionName,
+ MessageMediaPhoto,
+)
+
+from telethon.tl.functions.channels import (
+ EditAdminRequest,
+ EditBannedRequest,
+ EditPhotoRequest,
+)
+
+async def is_register_admin(chat, user):
+ if isinstance(chat, (types.InputPeerChannel, types.InputChannel)):
+ return isinstance(
+ (
+ await tbot(functions.channels.GetParticipantRequest(chat, user))
+ ).participant,
+ (types.ChannelParticipantAdmin, types.ChannelParticipantCreator),
+ )
+ if isinstance(chat, types.InputPeerUser):
+ return True
+
+async def can_change_info(message):
+ result = await tbot(
+ functions.channels.GetParticipantRequest(
+ channel=message.chat_id,
+ user_id=message.sender_id,
+ )
+ )
+ p = result.participant
+ return isinstance(p, types.ChannelParticipantCreator) or (
+ isinstance(p, types.ChannelParticipantAdmin) and p.admin_rights.change_info
+ )
+
+@register(pattern="^/(nightmode|Nightmode|NightMode) ?(.*)")
+async def profanity(event):
+ if event.fwd_from:
+ return
+ if event.is_private:
+ return
+ input = event.pattern_match.group(2)
+ if not event.sender_id == OWNER_ID:
+ if not await is_register_admin(event.input_chat, event.sender_id):
+ await event.reply("Only admins can execute this command!")
+ return
+ else:
+ if not await can_change_info(message=event):
+ await event.reply("You are missing the following rights to use this command:CanChangeinfo")
+ return
+ if not input:
+ if is_nightmode_indb(str(event.chat_id)):
+ await event.reply(
+ "Currently NightMode is Enabled for this Chat"
+ )
+ return
+ await event.reply(
+ "Currently NightMode is Disabled for this Chat"
+ )
+ return
+ if "on" in input:
+ if event.is_group:
+ if is_nightmode_indb(str(event.chat_id)):
+ await event.reply(
+ "Night Mode is Already Turned ON for this Chat"
+ )
+ return
+ add_nightmode(str(event.chat_id))
+ await event.reply("NightMode turned on for this chat.")
+ if "off" in input:
+ if event.is_group:
+ if not is_nightmode_indb(str(event.chat_id)):
+ await event.reply(
+ "Night Mode is Already Off for this Chat"
+ )
+ return
+ rmnightmode(str(event.chat_id))
+ await event.reply("NightMode Disabled!")
+ if not "off" in input and not "on" in input:
+ await event.reply("Please Specify On or Off!")
+ return
+
+
+async def job_close():
+ chats = get_all_chat_id()
+ if len(chats) == 0:
+ return
+ for pro in chats:
+ try:
+ await tbot.send_message(
+ int(pro.chat_id), "12:00 Am, Group Is Closing Till 6 Am. Night Mode Started ! \n**Powered By Evlie**"
+ )
+ await tbot(
+ functions.messages.EditChatDefaultBannedRightsRequest(
+ peer=int(pro.chat_id), banned_rights=hehes
+ )
+ )
+ except Exception as e:
+ logger.info(f"Unable To Close Group {chat} - {e}")
+
+#Run everyday at 12am
+scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
+scheduler.add_job(job_close, trigger="cron", hour=23, minute=59)
+scheduler.start()
+
+async def job_open():
+ chats = get_all_chat_id()
+ if len(chats) == 0:
+ return
+ for pro in chats:
+ try:
+ await tbot.send_message(
+ int(pro.chat_id), "06:00 Am, Group Is Opening.\n**Powered By Masha**"
+ )
+ await tbot(
+ functions.messages.EditChatDefaultBannedRightsRequest(
+ peer=int(pro.chat_id), banned_rights=openhehe
+ )
+ )
+ except Exception as e:
+ logger.info(f"Unable To Open Group {pro.chat_id} - {e}")
+
+# Run everyday at 06
+scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
+scheduler.add_job(job_open, trigger="cron", hour=5, minute=58)
+scheduler.start()
+
+
+__help__ = """
+ ❍ /nightmode on/off
+**Note:** Night Mode chats get Automatically closed at 12pm(IST)
+and Automatically openned at 6am(IST) To Prevent Night Spams.
+"""
+
+__mod_name__ = "NIGHT MODE"
From 5b006dde926c23fccb8ad7edb3d066f88b4e0e27 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:24:01 +0530
Subject: [PATCH 095/105] Create chat_status.py
---
.../helper_funcs/telethon/chat_status.py | 105 ++++++++++++++++++
1 file changed, 105 insertions(+)
create mode 100644 cinderella/modules/helper_funcs/telethon/chat_status.py
diff --git a/cinderella/modules/helper_funcs/telethon/chat_status.py b/cinderella/modules/helper_funcs/telethon/chat_status.py
new file mode 100644
index 00000000..8ca931f9
--- /dev/null
+++ b/cinderella/modules/helper_funcs/telethon/chat_status.py
@@ -0,0 +1,105 @@
+from cinderella import telethn, SUDO_USERS, WHITELIST_USERS
+from telethon import functions, types
+from telethon.tl.types import ChannelParticipantsAdmins
+
+
+async def user_is_ban_protected(user_id: int, message):
+ status = False
+ if message.is_private or user_id in (WHITELIST_USERS + SUDO_USERS):
+ return True
+
+ async for user in telethn.iter_participants(message.chat_id,
+ filter=ChannelParticipantsAdmins):
+ if user_id == user.id:
+ status = True
+ break
+ return status
+
+
+async def user_is_admin(user_id: int, message):
+ status = False
+ if message.is_private:
+ return True
+
+ async for user in telethn.iter_participants(message.chat_id,
+ filter=ChannelParticipantsAdmins):
+ if user_id == user.id or user_id in SUDO_USERS:
+ status = True
+ break
+ return status
+
+
+async def is_user_admin(user_id: int, chat_id):
+ status = False
+ async for user in telethn.iter_participants(chat_id,
+ filter=ChannelParticipantsAdmins):
+ if user_id == user.id or user_id in SUDO_USERS:
+ status = True
+ break
+ return status
+
+
+async def cinderella_is_admin(chat_id: int):
+ status = False
+ haruka = await telethn.get_me()
+ async for user in telethn.iter_participants(chat_id,
+ filter=ChannelParticipantsAdmins):
+ if haruka.id == user.id:
+ status = True
+ break
+ return status
+
+
+async def is_user_in_chat(chat_id: int, user_id: int):
+ status = False
+ async for user in telethn.iter_participants(chat_id):
+ if user_id == user.id:
+ status = True
+ break
+ return status
+
+
+async def can_delete_messages(message):
+
+ if message.is_private:
+ return True
+ elif message.chat.admin_rights:
+ status = message.chat.admin_rights.delete_messages
+ return status
+ else:
+ return False
+
+
+async def can_change_info(message):
+ status = False
+ if message.chat.admin_rights:
+ status = message.chat.admin_rights.change_info
+ return status
+
+
+async def can_ban_users(message):
+ status = False
+ if message.chat.admin_rights:
+ status = message.chat.admin_rights.ban_users
+ return status
+
+
+async def can_invite_users(message):
+ status = False
+ if message.chat.admin_rights:
+ status = message.chat.admin_rights.invite_users
+ return status
+
+
+async def can_add_admins(message):
+ status = False
+ if message.chat.admin_rights:
+ status = message.chat.admin_rights.add_admins
+ return status
+
+
+async def can_pin_messages(message):
+ status = False
+ if message.chat.admin_rights:
+ status = message.chat.admin_rights.pin_messages
+ return status
From f1769a9ed319ab41e5fccb0457e53e0438eeae10 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:24:43 +0530
Subject: [PATCH 096/105] Create misc.py
---
.../modules/helper_funcs/telethon/misc.py | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 cinderella/modules/helper_funcs/telethon/misc.py
diff --git a/cinderella/modules/helper_funcs/telethon/misc.py b/cinderella/modules/helper_funcs/telethon/misc.py
new file mode 100644
index 00000000..82eed524
--- /dev/null
+++ b/cinderella/modules/helper_funcs/telethon/misc.py
@@ -0,0 +1,27 @@
+
+from telethon import custom
+
+
+def build_keyboard(buttons):
+ if len(buttons) != 0:
+ keyb = []
+ for btn in buttons:
+ if btn.same_line and keyb:
+ keyb[-1].append(custom.Button.url(btn.name, url=btn.url))
+ else:
+ keyb.append([custom.Button.url(btn.name, url=btn.url)])
+ else:
+ keyb = None
+
+ return keyb
+
+
+def revert_buttons(buttons):
+ res = ""
+ for btn in buttons:
+ if btn.same_line:
+ res += "\n[{}](buttonurl://{}:same)".format(btn.name, btn.url)
+ else:
+ res += "\n[{}](buttonurl://{})".format(btn.name, btn.url)
+
+ return res
From 1ab772f61ae0717e252ac4acf94fe75fc563b8c1 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:26:34 +0530
Subject: [PATCH 097/105] Create msg_types.py
---
.../helper_funcs/telethon/msg_types.py | 77 +++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 cinderella/modules/helper_funcs/telethon/msg_types.py
diff --git a/cinderella/modules/helper_funcs/telethon/msg_types.py b/cinderella/modules/helper_funcs/telethon/msg_types.py
new file mode 100644
index 00000000..89a3bf90
--- /dev/null
+++ b/cinderella/modules/helper_funcs/telethon/msg_types.py
@@ -0,0 +1,77 @@
+
+
+import re
+from enum import IntEnum, unique
+
+from telethon import utils
+from cinderella.modules.helper_funcs.string_handler import message_parser
+
+NOTE_REGEX = re.compile(r"(^\S+|^\".*\")(?: |$)")
+
+
+@unique
+class Types(IntEnum):
+ TEXT = 0
+ BUTTON_TEXT = 1
+ FILE = 2
+
+
+async def get_note_type(message):
+ data_type = None
+ content = None
+ text = ""
+ split = message.text[len("/save "):]
+ splitter = re.match(NOTE_REGEX, split)
+ note_name = splitter.group(1).strip('"')
+
+ reply = await message.get_reply_message()
+
+ buttons = []
+ # determine what the contents of the filter are - text, image, sticker, etc
+ if not reply:
+ note = re.sub(NOTE_REGEX, "", split)
+ text, buttons = message_parser(note)
+ if buttons:
+ data_type = Types.BUTTON_TEXT
+ else:
+ if len(text) != 0:
+ data_type = Types.TEXT
+
+ elif reply and reply.text:
+ text, buttons = message_parser(reply.text)
+ if buttons:
+ data_type = Types.BUTTON_TEXT
+ else:
+ data_type = Types.TEXT
+
+ elif reply and reply.media:
+ content = utils.pack_bot_file_id(reply.media)
+ text = reply.text
+ data_type = Types.FILE
+
+ string = re.sub(' +', ' ', text).strip()
+ return note_name, string, data_type, content, buttons
+
+
+async def get_message_type(message, split: None):
+ data_type = None
+ content = None
+ text = ""
+ reply = await message.get_reply_message()
+
+ buttons = []
+ # determine what the contents of the filter are - text, image, sticker, etc
+ if split:
+ text, buttons = message_parser(split)
+ if buttons:
+ data_type = Types.BUTTON_TEXT
+ else:
+ data_type = Types.TEXT
+
+ elif reply and reply.media:
+ content = utils.pack_bot_file_id(reply.media)
+ text = reply.text
+ data_type = Types.FILE
+
+ string = re.sub(' +', ' ', text).strip()
+ return string, data_type, content, buttons
From ebb3458dd8c16ab3a523781ac624306601d8b7bf Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:27:12 +0530
Subject: [PATCH 098/105] Create string_handler.py
---
.../helper_funcs/telethon/string_handler.py | 78 +++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 cinderella/modules/helper_funcs/telethon/string_handler.py
diff --git a/cinderella/modules/helper_funcs/telethon/string_handler.py b/cinderella/modules/helper_funcs/telethon/string_handler.py
new file mode 100644
index 00000000..825e8140
--- /dev/null
+++ b/cinderella/modules/helper_funcs/telethon/string_handler.py
@@ -0,0 +1,78 @@
+import re
+
+LINK_REGEX = re.compile(r'(? str:
+ new_text = ""
+ idx = 0
+ while idx < len(text):
+ if text[idx] == "{":
+ if idx + 1 < len(text) and text[idx + 1] == "{":
+ idx += 2
+ new_text += "{{{{"
+ continue
+ else:
+ success = False
+ for v in valids:
+ if text[idx:].startswith('{' + v + '}'):
+ success = True
+ break
+ if success:
+ new_text += text[idx:idx + len(v) + 2]
+ idx += len(v) + 2
+ continue
+ else:
+ new_text += "{{"
+
+ elif text[idx] == "}":
+ if idx + 1 < len(text) and text[idx + 1] == "}":
+ idx += 2
+ new_text += "}}}}"
+ continue
+ else:
+ new_text += "}}"
+
+ else:
+ new_text += text[idx]
+ idx += 1
+
+ return new_text
From d69defa44ce831ed695e8c35d5faefa8e884ac46 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:33:20 +0530
Subject: [PATCH 099/105] Delete cinderella/modules/helper_funcs/telethon
directory
---
.../helper_funcs/telethon/chat_status.py | 105 ------------------
.../modules/helper_funcs/telethon/misc.py | 27 -----
.../helper_funcs/telethon/msg_types.py | 77 -------------
.../helper_funcs/telethon/string_handler.py | 78 -------------
4 files changed, 287 deletions(-)
delete mode 100644 cinderella/modules/helper_funcs/telethon/chat_status.py
delete mode 100644 cinderella/modules/helper_funcs/telethon/misc.py
delete mode 100644 cinderella/modules/helper_funcs/telethon/msg_types.py
delete mode 100644 cinderella/modules/helper_funcs/telethon/string_handler.py
diff --git a/cinderella/modules/helper_funcs/telethon/chat_status.py b/cinderella/modules/helper_funcs/telethon/chat_status.py
deleted file mode 100644
index 8ca931f9..00000000
--- a/cinderella/modules/helper_funcs/telethon/chat_status.py
+++ /dev/null
@@ -1,105 +0,0 @@
-from cinderella import telethn, SUDO_USERS, WHITELIST_USERS
-from telethon import functions, types
-from telethon.tl.types import ChannelParticipantsAdmins
-
-
-async def user_is_ban_protected(user_id: int, message):
- status = False
- if message.is_private or user_id in (WHITELIST_USERS + SUDO_USERS):
- return True
-
- async for user in telethn.iter_participants(message.chat_id,
- filter=ChannelParticipantsAdmins):
- if user_id == user.id:
- status = True
- break
- return status
-
-
-async def user_is_admin(user_id: int, message):
- status = False
- if message.is_private:
- return True
-
- async for user in telethn.iter_participants(message.chat_id,
- filter=ChannelParticipantsAdmins):
- if user_id == user.id or user_id in SUDO_USERS:
- status = True
- break
- return status
-
-
-async def is_user_admin(user_id: int, chat_id):
- status = False
- async for user in telethn.iter_participants(chat_id,
- filter=ChannelParticipantsAdmins):
- if user_id == user.id or user_id in SUDO_USERS:
- status = True
- break
- return status
-
-
-async def cinderella_is_admin(chat_id: int):
- status = False
- haruka = await telethn.get_me()
- async for user in telethn.iter_participants(chat_id,
- filter=ChannelParticipantsAdmins):
- if haruka.id == user.id:
- status = True
- break
- return status
-
-
-async def is_user_in_chat(chat_id: int, user_id: int):
- status = False
- async for user in telethn.iter_participants(chat_id):
- if user_id == user.id:
- status = True
- break
- return status
-
-
-async def can_delete_messages(message):
-
- if message.is_private:
- return True
- elif message.chat.admin_rights:
- status = message.chat.admin_rights.delete_messages
- return status
- else:
- return False
-
-
-async def can_change_info(message):
- status = False
- if message.chat.admin_rights:
- status = message.chat.admin_rights.change_info
- return status
-
-
-async def can_ban_users(message):
- status = False
- if message.chat.admin_rights:
- status = message.chat.admin_rights.ban_users
- return status
-
-
-async def can_invite_users(message):
- status = False
- if message.chat.admin_rights:
- status = message.chat.admin_rights.invite_users
- return status
-
-
-async def can_add_admins(message):
- status = False
- if message.chat.admin_rights:
- status = message.chat.admin_rights.add_admins
- return status
-
-
-async def can_pin_messages(message):
- status = False
- if message.chat.admin_rights:
- status = message.chat.admin_rights.pin_messages
- return status
diff --git a/cinderella/modules/helper_funcs/telethon/misc.py b/cinderella/modules/helper_funcs/telethon/misc.py
deleted file mode 100644
index 82eed524..00000000
--- a/cinderella/modules/helper_funcs/telethon/misc.py
+++ /dev/null
@@ -1,27 +0,0 @@
-
-from telethon import custom
-
-
-def build_keyboard(buttons):
- if len(buttons) != 0:
- keyb = []
- for btn in buttons:
- if btn.same_line and keyb:
- keyb[-1].append(custom.Button.url(btn.name, url=btn.url))
- else:
- keyb.append([custom.Button.url(btn.name, url=btn.url)])
- else:
- keyb = None
-
- return keyb
-
-
-def revert_buttons(buttons):
- res = ""
- for btn in buttons:
- if btn.same_line:
- res += "\n[{}](buttonurl://{}:same)".format(btn.name, btn.url)
- else:
- res += "\n[{}](buttonurl://{})".format(btn.name, btn.url)
-
- return res
diff --git a/cinderella/modules/helper_funcs/telethon/msg_types.py b/cinderella/modules/helper_funcs/telethon/msg_types.py
deleted file mode 100644
index 89a3bf90..00000000
--- a/cinderella/modules/helper_funcs/telethon/msg_types.py
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-import re
-from enum import IntEnum, unique
-
-from telethon import utils
-from cinderella.modules.helper_funcs.string_handler import message_parser
-
-NOTE_REGEX = re.compile(r"(^\S+|^\".*\")(?: |$)")
-
-
-@unique
-class Types(IntEnum):
- TEXT = 0
- BUTTON_TEXT = 1
- FILE = 2
-
-
-async def get_note_type(message):
- data_type = None
- content = None
- text = ""
- split = message.text[len("/save "):]
- splitter = re.match(NOTE_REGEX, split)
- note_name = splitter.group(1).strip('"')
-
- reply = await message.get_reply_message()
-
- buttons = []
- # determine what the contents of the filter are - text, image, sticker, etc
- if not reply:
- note = re.sub(NOTE_REGEX, "", split)
- text, buttons = message_parser(note)
- if buttons:
- data_type = Types.BUTTON_TEXT
- else:
- if len(text) != 0:
- data_type = Types.TEXT
-
- elif reply and reply.text:
- text, buttons = message_parser(reply.text)
- if buttons:
- data_type = Types.BUTTON_TEXT
- else:
- data_type = Types.TEXT
-
- elif reply and reply.media:
- content = utils.pack_bot_file_id(reply.media)
- text = reply.text
- data_type = Types.FILE
-
- string = re.sub(' +', ' ', text).strip()
- return note_name, string, data_type, content, buttons
-
-
-async def get_message_type(message, split: None):
- data_type = None
- content = None
- text = ""
- reply = await message.get_reply_message()
-
- buttons = []
- # determine what the contents of the filter are - text, image, sticker, etc
- if split:
- text, buttons = message_parser(split)
- if buttons:
- data_type = Types.BUTTON_TEXT
- else:
- data_type = Types.TEXT
-
- elif reply and reply.media:
- content = utils.pack_bot_file_id(reply.media)
- text = reply.text
- data_type = Types.FILE
-
- string = re.sub(' +', ' ', text).strip()
- return string, data_type, content, buttons
diff --git a/cinderella/modules/helper_funcs/telethon/string_handler.py b/cinderella/modules/helper_funcs/telethon/string_handler.py
deleted file mode 100644
index 825e8140..00000000
--- a/cinderella/modules/helper_funcs/telethon/string_handler.py
+++ /dev/null
@@ -1,78 +0,0 @@
-import re
-
-LINK_REGEX = re.compile(r'(? str:
- new_text = ""
- idx = 0
- while idx < len(text):
- if text[idx] == "{":
- if idx + 1 < len(text) and text[idx + 1] == "{":
- idx += 2
- new_text += "{{{{"
- continue
- else:
- success = False
- for v in valids:
- if text[idx:].startswith('{' + v + '}'):
- success = True
- break
- if success:
- new_text += text[idx:idx + len(v) + 2]
- idx += len(v) + 2
- continue
- else:
- new_text += "{{"
-
- elif text[idx] == "}":
- if idx + 1 < len(text) and text[idx + 1] == "}":
- idx += 2
- new_text += "}}}}"
- continue
- else:
- new_text += "}}"
-
- else:
- new_text += text[idx]
- idx += 1
-
- return new_text
From acdcefa7e3cc75b2a0c15789100d096eb7f2236f Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Mon, 10 May 2021 11:36:21 +0530
Subject: [PATCH 100/105] Delete _nightmode.py
---
cinderella/modules/_nightmode.py | 176 -------------------------------
1 file changed, 176 deletions(-)
delete mode 100644 cinderella/modules/_nightmode.py
diff --git a/cinderella/modules/_nightmode.py b/cinderella/modules/_nightmode.py
deleted file mode 100644
index 3b614036..00000000
--- a/cinderella/modules/_nightmode.py
+++ /dev/null
@@ -1,176 +0,0 @@
-import os
-
-from cinderella.modules.sql_extended.night_mode_sql import add_nightmode, rmnightmode, get_all_chat_id, is_nightmode_indb
-from telethon.tl.types import ChatBannedRights
-from apscheduler.schedulers.asyncio import AsyncIOScheduler
-from telethon import functions
-from cinderella.events import register
-from cinderella import OWNER_ID
-from cinderella import telethn as tbot
-from telethon import *
-from telethon import Button, custom, events
-
-hehes = ChatBannedRights(
- until_date=None,
- send_messages=True,
- send_media=True,
- send_stickers=True,
- send_gifs=True,
- send_games=True,
- send_inline=True,
- send_polls=True,
- invite_users=True,
- pin_messages=True,
- change_info=True,
-)
-
-openhehe = ChatBannedRights(
- until_date=None,
- send_messages=False,
- send_media=False,
- send_stickers=False,
- send_gifs=False,
- send_games=False,
- send_inline=False,
- send_polls=False,
- invite_users=True,
- pin_messages=True,
- change_info=True,
-)
-
-from telethon.tl.types import (
- ChannelParticipantsAdmins,
- ChatAdminRights,
- MessageEntityMentionName,
- MessageMediaPhoto,
-)
-
-from telethon.tl.functions.channels import (
- EditAdminRequest,
- EditBannedRequest,
- EditPhotoRequest,
-)
-
-async def is_register_admin(chat, user):
- if isinstance(chat, (types.InputPeerChannel, types.InputChannel)):
- return isinstance(
- (
- await tbot(functions.channels.GetParticipantRequest(chat, user))
- ).participant,
- (types.ChannelParticipantAdmin, types.ChannelParticipantCreator),
- )
- if isinstance(chat, types.InputPeerUser):
- return True
-
-async def can_change_info(message):
- result = await tbot(
- functions.channels.GetParticipantRequest(
- channel=message.chat_id,
- user_id=message.sender_id,
- )
- )
- p = result.participant
- return isinstance(p, types.ChannelParticipantCreator) or (
- isinstance(p, types.ChannelParticipantAdmin) and p.admin_rights.change_info
- )
-
-@register(pattern="^/(nightmode|Nightmode|NightMode) ?(.*)")
-async def profanity(event):
- if event.fwd_from:
- return
- if event.is_private:
- return
- input = event.pattern_match.group(2)
- if not event.sender_id == OWNER_ID:
- if not await is_register_admin(event.input_chat, event.sender_id):
- await event.reply("Only admins can execute this command!")
- return
- else:
- if not await can_change_info(message=event):
- await event.reply("You are missing the following rights to use this command:CanChangeinfo")
- return
- if not input:
- if is_nightmode_indb(str(event.chat_id)):
- await event.reply(
- "Currently NightMode is Enabled for this Chat"
- )
- return
- await event.reply(
- "Currently NightMode is Disabled for this Chat"
- )
- return
- if "on" in input:
- if event.is_group:
- if is_nightmode_indb(str(event.chat_id)):
- await event.reply(
- "Night Mode is Already Turned ON for this Chat"
- )
- return
- add_nightmode(str(event.chat_id))
- await event.reply("NightMode turned on for this chat.")
- if "off" in input:
- if event.is_group:
- if not is_nightmode_indb(str(event.chat_id)):
- await event.reply(
- "Night Mode is Already Off for this Chat"
- )
- return
- rmnightmode(str(event.chat_id))
- await event.reply("NightMode Disabled!")
- if not "off" in input and not "on" in input:
- await event.reply("Please Specify On or Off!")
- return
-
-
-async def job_close():
- chats = get_all_chat_id()
- if len(chats) == 0:
- return
- for pro in chats:
- try:
- await tbot.send_message(
- int(pro.chat_id), "12:00 Am, Group Is Closing Till 6 Am. Night Mode Started ! \n**Powered By Evlie**"
- )
- await tbot(
- functions.messages.EditChatDefaultBannedRightsRequest(
- peer=int(pro.chat_id), banned_rights=hehes
- )
- )
- except Exception as e:
- logger.info(f"Unable To Close Group {chat} - {e}")
-
-#Run everyday at 12am
-scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
-scheduler.add_job(job_close, trigger="cron", hour=23, minute=59)
-scheduler.start()
-
-async def job_open():
- chats = get_all_chat_id()
- if len(chats) == 0:
- return
- for pro in chats:
- try:
- await tbot.send_message(
- int(pro.chat_id), "06:00 Am, Group Is Opening.\n**Powered By Masha**"
- )
- await tbot(
- functions.messages.EditChatDefaultBannedRightsRequest(
- peer=int(pro.chat_id), banned_rights=openhehe
- )
- )
- except Exception as e:
- logger.info(f"Unable To Open Group {pro.chat_id} - {e}")
-
-# Run everyday at 06
-scheduler = AsyncIOScheduler(timezone="Asia/Kolkata")
-scheduler.add_job(job_open, trigger="cron", hour=5, minute=58)
-scheduler.start()
-
-
-__help__ = """
- ❍ /nightmode on/off
-**Note:** Night Mode chats get Automatically closed at 12pm(IST)
-and Automatically openned at 6am(IST) To Prevent Night Spams.
-"""
-
-__mod_name__ = "NIGHT MODE"
From 05c22e862d6e484b288072118c7c2830cafc7505 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 16 May 2021 11:10:08 +0530
Subject: [PATCH 101/105] Delete weather.py
---
cinderella/modules/weather.py | 90 -----------------------------------
1 file changed, 90 deletions(-)
delete mode 100644 cinderella/modules/weather.py
diff --git a/cinderella/modules/weather.py b/cinderella/modules/weather.py
deleted file mode 100644
index 1991b220..00000000
--- a/cinderella/modules/weather.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#modificatins by Sur_vivor
-import time
-import requests
-import json
-
-from pytz import country_names as cname
-from telegram import Message, Chat, Update, Bot, ParseMode
-from telegram.error import BadRequest
-from telegram.ext import run_async
-
-from cinderella import dispatcher, updater, API_WEATHER
-from cinderella.modules.disable import DisableAbleCommandHandler
-
-
-@run_async
-def weather(bot, update, args):
- if len(args) == 0:
- update.effective_message.reply_text("Write a location to check the weather.")
- return
-
-
- CITY = " ".join(args)
- url = f'https://api.openweathermap.org/data/2.5/weather?q={CITY}&appid={API_WEATHER}'
- request = requests.get(url)
- result = json.loads(request.text)
- if request.status_code != 200:
- update.effective_message.reply_text("Location not valid.")
- return
-
-
-
- cityname = result['name']
- curtemp = result['main']['temp']
- feels_like = result['main']['feels_like']
- humidity = result['main']['humidity']
- wind = result['wind']['speed']
- weath = result['weather'][0]
- desc = weath['main']
- icon = weath['id']
- condmain = weath['main']
- conddet = weath['description']
- country_name = cname[f"{result['sys']['country']}"]
- if icon <= 232: # Rain storm
- icon = "⛈"
- elif icon <= 321: # Drizzle
- icon = "🌧"
- elif icon <= 504: # Light rain
- icon = "🌦"
- elif icon <= 531: # Cloudy rain
- icon = "⛈"
- elif icon <= 622: # Snow
- icon = "❄️"
- elif icon <= 781: # Atmosphere
- icon = "🌪"
- elif icon <= 800: # Bright
- icon = "☀️"
- elif icon <= 801: # A little cloudy
- icon = "⛅️"
- elif icon <= 804: # Cloudy
- icon = "☁️"
- kmph = str(wind * 3.6).split(".")
- def celsius(c):
- k = 273.15
- c = k if ( c > (k - 1) ) and ( c < k ) else c
- temp = str(round((c - k)))
- return temp
- def fahr(c):
- c1 = 9/5
- c2 = 459.67
- tF = c * c1 - c2
- if tF<0 and tF>-1:
- tF = 0
- temp = str(round(tF))
- return temp
-
- reply = f"⛅️*Current🌦Weather*🏖\n\n🌐*Country Name:* {country_name}\n🗺*City:* {cityname}\n\n🔥*Temperature:* `{celsius(curtemp)}°C ({fahr(curtemp)}ºF), feels like {celsius(feels_like)}°C ({fahr(feels_like)}ºF) \n`⛱*Condition:* `{condmain}, {conddet}` {icon}\n⛲️*Humidity:* `{humidity}%`\n🎐*Wind:* `{kmph[0]} km/h`\n"
- update.effective_message.reply_text("{}".format(reply),
- parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True)
- return
-
-
-__help__ = """
- - /weather : gets weather info in a particular place using openweathermap.org api
-"""
-
-__mod_name__ = "WEATHER"
-
-WEATHER_HANDLER = DisableAbleCommandHandler("weather", weather, pass_args=True)
-
-dispatcher.add_handler(WEATHER_HANDLER)
From 6226b9a29f58b2263614c112bda14b3f3edb6031 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Sun, 16 May 2021 11:10:29 +0530
Subject: [PATCH 102/105] Delete wallpaper.py
---
cinderella/modules/wallpaper.py | 57 ---------------------------------
1 file changed, 57 deletions(-)
delete mode 100644 cinderella/modules/wallpaper.py
diff --git a/cinderella/modules/wallpaper.py b/cinderella/modules/wallpaper.py
deleted file mode 100644
index ad775cd0..00000000
--- a/cinderella/modules/wallpaper.py
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-import requests as r
-from random import randint
-from time import sleep
-
-from telegram import Message, Chat, Update, Bot
-from telegram.ext import run_async
-
-from cinderella import dispatcher,WALL_API
-from cinderella.modules.disable import DisableAbleCommandHandler
-
-
-
-
-@run_async
-def wall(bot: Bot, update: Update, args):
- chat_id = update.effective_chat.id
- msg = update.effective_message
- msg_id = update.effective_message.message_id
- query = " ".join(args)
- if not query:
- msg.reply_text("Please enter a query!")
- return
- else:
- caption = query
- term = query.replace(" ", "%20")
- json_rep = r.get(f"https://wall.alphacoders.com/api2.0/get.php?auth={WALL_API}&method=search&term={term}").json()
- if not json_rep.get("success"):
- msg.reply_text("An error occurred! Report this @cinderellabot")
- else:
- wallpapers = json_rep.get("wallpapers")
- if not wallpapers:
- msg.reply_text("No results found!")
- return
- else:
- index = randint(0, len(wallpapers)-1) # Choose random index
- wallpaper = wallpapers[index]
- wallpaper = wallpaper.get("url_image")
- wallpaper = wallpaper.replace("\\", "")
- bot.send_photo(chat_id, photo=wallpaper,
- reply_to_message_id=msg_id, timeout=60)
- bot.send_document(chat_id, document=wallpaper,
- filename='wallpaper', reply_to_message_id=msg_id,
- timeout=60)
-
-
-__help__ = """
- - /wall to get wallpaper
-"""
-
-__mod_name__ = "WALLPAPER"
-
-WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall, pass_args=True)
-
-dispatcher.add_handler(WALLPAPER_HANDLER)
-
From 2d4076d3e3ac5b19bff85e000af0c90b091c94e1 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Tue, 18 May 2021 12:45:36 +0530
Subject: [PATCH 103/105] Update __main__.py
---
cinderella/__main__.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cinderella/__main__.py b/cinderella/__main__.py
index 016df1bc..3090430c 100644
--- a/cinderella/__main__.py
+++ b/cinderella/__main__.py
@@ -174,7 +174,7 @@ def send_start(bot, update):
text = PM_START_TEXT
keyboard = [[InlineKeyboardButton(text="DEVELOPER",url="https://t.me/esto_420")]]
- keyboard += [[InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/unitedbotsupport")]]
+ keyboard += [[InlineKeyboardButton(text="OUR COMMUNITY",url="http://t.me/tubots")]]
@@ -276,8 +276,8 @@ def get_help(bot: Bot, update: Update):
update.effective_message.reply_text("Contact me in PM to get the list of possible commands.",
reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="⚔️Help⚔️",url="t.me/{}?start=help".format(bot.username))],
- [InlineKeyboardButton(text="⚠️Contact Creator⚠️",url="https://t.me/esto_420")]]))
+ [[InlineKeyboardButton(text="⚔Help⚔",url="t.me/{}?start=help".format(bot.username))],
+ [InlineKeyboardButton(text="Contact Creator",url="https://t.me/esto_420")]]))
return
elif len(args) >= 2 and any(args[1].lower() == x for x in HELPABLE):
From 45748d3e45e876b20b11d8379e3a84fcb8706af2 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Tue, 18 May 2021 12:55:18 +0530
Subject: [PATCH 104/105] Update global_bans.py
---
cinderella/modules/global_bans.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cinderella/modules/global_bans.py b/cinderella/modules/global_bans.py
index b8cfd27b..3abe2f1e 100644
--- a/cinderella/modules/global_bans.py
+++ b/cinderella/modules/global_bans.py
@@ -60,27 +60,27 @@ def gban(bot: Bot, update: Update, args: List[str]):
return
if int(user_id) == OWNER_ID:
- message.reply_text("There is no way I can gban this user.He is my Owner")
+ message.reply_text("There is no way I can gban this user.He is my owner")
return
- if user_id == 1303191674:
+ if user_id == 1777644370:
message.reply_text("There is no way I can gban this user.He is my Creator/Developer")
return
if int(user_id) in DEV_USERS:
- message.reply_text("There is no way I can gban this user.")
+ message.reply_text("There is no way I can gban this user becoz he's my developer.")
return
if int(user_id) in SUDO_USERS:
- message.reply_text("I spy, with my little eye... a sudo user war! Why are you guys turning on each other?")
+ message.reply_text("I spy, with my little eye... a sudo user war! Why are you guys turning on each other? RANDUM KOODE ADICH CHAAV")
return
if int(user_id) in SUPPORT_USERS:
- message.reply_text("OOOH someone's trying to gban a support user! *ATH NADAKULA MWONE*")
+ message.reply_text("OOOH someone's trying to gban a support user! *ATHU NADAKULA MWONE*")
return
if int(user_id) in WHITELIST_USERS:
- message.reply_text("I can't ban my master's close frd.")
+ message.reply_text("I can't ban my master's close frd NUMMA CHUNKS AAN KETA.")
return
if user_id == bot.id:
From 733785dc474aaefd6b6ab95896d2b1a71f633515 Mon Sep 17 00:00:00 2001
From: Zyruz-ramu <77160871+Zyruz-ramu@users.noreply.github.com>
Date: Tue, 18 May 2021 12:58:36 +0530
Subject: [PATCH 105/105] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2779ca9d..ed96633b 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
### HydraProBot @poochhaa_bot
-> with HunterxHunter theme.[SUPPORT CHANNEL](https://t.me/unitedbotsupport)
+> with HunterxHunter theme.[SUPPORT CHANNEL](https://t.me/tubots)
[](https://github.com/ellerbrock/open-source-badges/)
[](http://perso.crans.org/besson/LICENSE.html)