diff --git a/README.md b/README.md
index 4550aaa..0b32b7b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-# tgbot❤
+# samantha

-
+
@@ -11,22 +11,21 @@
Originally a simple group management bot with multiple admin features, it has evolved, becoming extremely modular and
simple to use.
-Can be found on telegram as [കൊച്ചുമുതലാളി](https://t.me/kochubot).
-
-Kochu and I are moderating a [support group](https://t.me/Keralabots), where you can ask for help setting up your
+Can be found on telegram as [जेहरिला कॉकरोच ](https://t.me/jehrilla_bot).
+jehrilla cockroach and I are moderating a [support group](https://t.me/jehrilla_support), where you can ask for help setting up your
bot, discover/request new features, report bugs, and stay in the loop whenever a new update is available. Of course
I'll also help when a database schema changes, and some table column needs to be modified/added. Note to maintainers that all schema changes will be found in the commit messages, and its their responsibility to read any new commits.
-Join the [news channel](https://t.me/Mo_Tech_YT) if you just want to stay in the loop about new features or
+Join the [our group](https://t.me/jehrilla_user) if you just want to stay in the loop about new features or
announcements.
Alternatively, [find me on telegram](https://t.me/jithumon)! (Keep all support questions in the support chat, where more people can help you.)
-[](https://heroku.com/deploy?template=https://github.com/MRK-YT/Rose-Bot)
-There is also a [tutorial video](https://youtu.be/wKL90i3cjPw) if you want any help on creating heroku clone.
-[](https://telegram.dog/keralabots)
-[](https://telegram.dog/kochuUpdates)
+[](https://heroku.com/deploy?template=https://github.com/famegfx/samantha_thebot)
+There is also a [tutorial video](https://youtu.be/FHzPM1bTWjQ) if you want any help on creating heroku clone.
+[](https://telegram.dog/jehrilla_supportr)
+[](https://telegram.dog/Jehrilla_user)
diff --git a/app.json b/app.json
index d75e72d..feb8f18 100644
--- a/app.json
+++ b/app.json
@@ -1,7 +1,7 @@
{
- "name": "Kochubot",
+ "name": "Samantha",
"description": "Telegram's sassiest group manager. Modular Telegram group management bot!",
- "logo": "https://telegra.ph/file/1925c7a2f601539ccde7a.png",
+ "logo": "https://te.legra.ph/file/11d176181d16b572ca380.jpg",
"keywords": [
"telegram",
"best",
@@ -12,7 +12,7 @@
"modular",
"productivity"
],
- "repository": "https://github.com/jithumon/tgbot",
+ "repository": "https://github.com/famegfx/samantha_thebot",
"env": {
"ENV": {
"description": "Setting this to ANYTHING will enable env variables. But, you need to understand the code to know what to set here!",
@@ -54,7 +54,7 @@
},
"DONATION_LINK": {
"description": "Optional: link where you would like to receive donations.",
- "value": "https://www.paypal.me/PaulSonOfLars"
+ "value": "https://youtu.be/FHzPM1bTWjQ"
},
"PORT": {
"description": "Port to use for your webhooks",
diff --git a/tg_bot/__main__.py b/tg_bot/__main__.py
index cbc60f8..516295c 100644
--- a/tg_bot/__main__.py
+++ b/tg_bot/__main__.py
@@ -19,18 +19,11 @@
PM_START_TEXT = """
-ഹായ് {}, എന്റെ പേര് {}! ഞാൻ [ഇദ്ദേഹം](tg://user?id={}) നോക്കി നടത്തുന്ന ഒരു അടിപൊളി അഡ്മിൻ ബോട്ടാണ്.
+Hey there! My name is Samantha - I'm here to help you manage your groups! Hit /help to find out more about how to use me to my full potential.
-എന്നെ നിർമ്മിച്ചിരിക്കുന്നത് python3 യിൽ python-telegram-bot ലൈബ്രറി ഉപയോഗിച്ചാണ്. ഞാൻ പൂർണ്ണമായിട്ടും ഓപ്പൺസോഴ്സ്ഡ് ആണ്. എന്റെ കോഡ് നിങ്ങൾക്ക് [ഇവിടെ](https://youtu.be/wKL90i3cjPw) കാണുവാൻ സാധിക്കും.
-
-എന്നെപ്പോലെ ഒരു അഡ്മിൻ ബോട്ടിനെ ഉണ്ടാക്കുവാൻ താഴെ കൊടുത്തിരിക്കുന്ന വീഡിയോ കാണുക.
-
-എന്റെ അപ്ഡേറ്റുകളെക്കുറിച്ചും പ്രവർത്തനത്തെപറ്റിയും അറിയുവാൻ അപ്ഡേറ്റ് ചാനൽ സബ്സ്ക്രൈബ് ചെയ്യുക.
-
-കൂടെ താഴെ കൊടുത്തിരിക്കുന്ന ടെക് ഗെയിമിംഗ് യൂട്യൂബ് ചാനൽ സബ്സ്ക്രൈബ് ചെയ്യാനും മറക്കേണ്ട.
-
-ലഭ്യമായ കമാന്റുകളെപ്പറ്റി അറിയുവാൻ /help അമർത്തുക.
+Join my channel or @jehrilla_support to get information on all the latest updates.
+Use the /privacy command to view the privacy policy, and interact with your data.
"""
HELP_STRINGS = """
@@ -47,13 +40,17 @@
- 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")
+""".format(
+ dispatcher.bot.first_name,
+ "\nAll commands can either be used with / or !.\n" if ALLOW_EXCL else "",
+)
+
DONATE_STRING = """Heya, glad to hear you want to donate!
-It took lots of work for [my creator](t.me/SonOfLars) to get me to where I am now, and every donation helps \
+It took lots of work for [owner](t.me/jehrilla_user) to get me to where I am now, and every donation helps \
motivate him to make me even better. All the donation money will go to a better VPS to host me, and/or beer \
(see his bio!). He's just a poor student, so every little helps!
-There are two ways of paying him; [PayPal](paypal.me/PaulSonOfLars), or [Monzo](monzo.me/paulnionvestergaardlarsen)."""
+There are two ways of paying him; [testing](t.me/jehrilla_user), or [Don't pay](t.me/jehrilla_user)."""
IMPORTED = {}
MIGRATEABLE = []
@@ -69,11 +66,11 @@
GDPR = []
for module_name in ALL_MODULES:
- imported_module = importlib.import_module("tg_bot.modules." + module_name)
+ imported_module = importlib.import_module(f"tg_bot.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:
+ if imported_module.__mod_name__.lower() not 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")
@@ -128,7 +125,7 @@ def test(bot: Bot, update: Update):
@run_async
def start(bot: Bot, update: Update, args: List[str]):
if update.effective_chat.type == "private":
- if len(args) >= 1:
+ if args:
if args[0].lower() == "help":
send_help(update.effective_chat.id, HELP_STRINGS)
@@ -147,15 +144,51 @@ def start(bot: Bot, update: Update, args: List[str]):
else:
first_name = update.effective_user.first_name
update.effective_message.reply_text(
- PM_START_TEXT.format(escape_markdown(first_name), escape_markdown(bot.first_name), OWNER_ID),
+ PM_START_TEXT.format(
+ escape_markdown(first_name),
+ escape_markdown(bot.first_name),
+ OWNER_ID,
+ ),
+ parse_mode=ParseMode.MARKDOWN,
+ reply_markup=InlineKeyboardMarkup(
+ [
+ [
+ InlineKeyboardButton(
+ text="🎉 Add me to your group",
+ url=f"t.me/{bot.username}?startgroup=true",
+ ),
+ InlineKeyboardButton(
+ text="don't click on this",
+ url="https://youtu.be/FHzPM1bTWjQ",
+ ),
+ ],
+ [
+ InlineKeyboardButton(
+ text="👥 Support Group",
+ url="https://t.me/jehrilla_support",
+ ),
+ InlineKeyboardButton(
+ text=" Update telegram group",
+ url="https://t.me/jehrilla_support",
+ ),
+ ],
+ [
+ InlineKeyboardButton(
+ text="👨💻 Make",
+ url="https://youtu.be/FHzPM1bTWjQ",
+ ),
+ InlineKeyboardButton(
+ text="🛠 Help",
+ url=f"https://t.me/{bot.username}?start=help",
+ ),
+ ],
+ ]
+ ),
+ )
- parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup(
- [[InlineKeyboardButton(text="🎉 Add me to your group", url="t.me/{}?startgroup=true".format(bot.username)), InlineKeyboardButton(text="🤖 Make Own Admin Bot", url="https://youtu.be/W6CLKrehy6w")],
- [InlineKeyboardButton(text="👥 Support Group", url="https://t.me/Mo_Tech_Group"), InlineKeyboardButton(text="🔔 Update Channel", url="https://t.me/Mo_Tech_YT")],
- [InlineKeyboardButton(text="👨💻 Make", url="https://youtu.be/wKL90i3cjPw"), InlineKeyboardButton(text="🛠 Help", url="https://t.me/{}?start=help".format(bot.username)) ]]))
else:
- update.effective_message.reply_text("ചത്തിട്ടില്ലാ...")
+ update.effective_message.reply_text("kya hai...")
# for test purposes
@@ -197,8 +230,11 @@ def help_button(bot: Bot, update: Update):
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__
+ text = (
+ f"Here is the help for the *{HELPABLE[module].__mod_name__}* module:\n"
+ + HELPABLE[module].__help__
+ )
+
query.message.reply_text(text=text,
parse_mode=ParseMode.MARKDOWN,
reply_markup=InlineKeyboardMarkup(
@@ -227,13 +263,11 @@ def help_button(bot: Bot, update: Update):
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:
+ if excp.message not in [
+ "Message is not modified",
+ "Query_id_invalid",
+ "Message can't be deleted",
+ ]:
LOGGER.exception("Exception in help buttons. %s", str(query.data))
@@ -245,17 +279,28 @@ def get_help(bot: Bot, update: Update):
# 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))]]))
+ update.effective_message.reply_text(
+ "Contact me in PM to get the list of possible commands.",
+ reply_markup=InlineKeyboardMarkup(
+ [
+ [
+ InlineKeyboardButton(
+ text="Help", url=f"t.me/{bot.username}?start=help"
+ )
+ ]
+ ]
+ ),
+ )
+
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__
+ text = (
+ f"Here is the available help for the *{HELPABLE[module].__mod_name__}* module:\n"
+ + HELPABLE[module].__help__
+ )
+
send_help(chat.id, text, InlineKeyboardMarkup([[InlineKeyboardButton(text="Back", callback_data="help_back")]]))
else:
@@ -266,7 +311,10 @@ 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())
+ f"*{mod.__mod_name__}*:\n{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)
@@ -274,18 +322,20 @@ def send_settings(chat_id, user_id, user=False):
dispatcher.bot.send_message(user_id, "Seems like there aren't any user specific settings available :'(",
parse_mode=ParseMode.MARKDOWN)
+ elif CHAT_SETTINGS:
+ chat_name = dispatcher.bot.getChat(chat_id).title
+ dispatcher.bot.send_message(
+ user_id,
+ text=f"Which module would you like to check {chat_name}'s settings for?",
+ reply_markup=InlineKeyboardMarkup(
+ paginate_modules(0, CHAT_SETTINGS, "stngs", chat=chat_id)
+ ),
+ )
+
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)
+ 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
@@ -301,55 +351,77 @@ def settings_button(bot: Bot, update: Update):
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))]]))
+ text = f"*{escape_markdown(chat.title)}* has the following settings for the *{CHAT_SETTINGS[module].__mod_name__}* module:\n\n" + 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=f"stngs_back({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)))
+ query.message.reply_text(
+ f"Hi there! There are quite a few settings for {chat.title} - go ahead and pick what you're interested in.",
+ 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)))
+ query.message.reply_text(
+ f"Hi there! There are quite a few settings for {chat.title} - go ahead and pick what you're interested in.",
+ 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)))
+ query.message.reply_text(
+ text=f"Hi there! There are quite a few settings for {escape_markdown(chat.title)} - go ahead and pick what you're interested in.",
+ 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:
+ if excp.message not in [
+ "Message is not modified",
+ "Query_id_invalid",
+ "Message can't be deleted",
+ ]:
LOGGER.exception("Exception in settings buttons. %s", str(query.data))
@@ -361,19 +433,27 @@ def get_settings(bot: Bot, update: Update):
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."
+ if chat.type == chat.PRIVATE:
+ send_settings(chat.id, user.id, True)
+
+ elif 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=f"t.me/{bot.username}?start=stngs_{chat.id}",
+ )
+ ]
+ ]
+ ),
+ )
else:
- send_settings(chat.id, user.id, True)
+ text = "Click here to check your settings."
@run_async
@@ -385,9 +465,11 @@ def donate(bot: Bot, update: Update):
update.effective_message.reply_text(DONATE_STRING, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True)
if OWNER_ID != 254318997 and DONATION_LINK:
- update.effective_message.reply_text("You can also donate to the person currently running me "
- "[here]({})".format(DONATION_LINK),
- parse_mode=ParseMode.MARKDOWN)
+ update.effective_message.reply_text(
+ f"You can also donate to the person currently running me [here]({DONATION_LINK})",
+ parse_mode=ParseMode.MARKDOWN,
+ )
+
else:
try:
@@ -421,9 +503,7 @@ def migrate_chats(bot: Bot, update: Update):
def kcfrsct_fnc(bot: Bot, update: Update):
query = update.callback_query
user = update.effective_user
- _match = re.match(r"rsct_(.*)_33801", query.data)
- # ensure no spinny white circle
- if _match:
+ if _match := re.match(r"rsct_(.*)_33801", query.data):
try:
from tg_bot.modules.sql.cust_filters_sql import get_btn_with_di
_soqka = get_btn_with_di(int(_match.group(1)))
@@ -484,5 +564,5 @@ def main():
if __name__ == '__main__':
- LOGGER.info("Successfully loaded modules: " + str(ALL_MODULES))
+ LOGGER.info(f"Successfully loaded modules: {str(ALL_MODULES)}")
main()