Skip to content
This repository was archived by the owner on Jun 18, 2022. It is now read-only.

Commit 7ff0d8b

Browse files
Merge pull request #191 from AnimeKaizoku/shiken
More upgrades to master version
2 parents 4930cab + b8670ce commit 7ff0d8b

18 files changed

+296
-138
lines changed

SaitamaRobot/modules/backups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ def get_chat(chat_id, chat_data):
368368
__help__ = """
369369
*Only for group owner:*
370370
371-
× /import: Reply to the backup file for the butler / emilia group to import as much as possible, making transfers very easy! \
371+
/import: Reply to the backup file for the butler / emilia group to import as much as possible, making transfers very easy! \
372372
Note that files / photos cannot be imported due to telegram restrictions.
373373
374-
× /export: Export group data, which will be exported are: rules, notes (documents, images, music, video, audio, voice, text, text buttons) \
374+
/export: Export group data, which will be exported are: rules, notes (documents, images, music, video, audio, voice, text, text buttons) \
375375
376376
"""
377377

SaitamaRobot/modules/blacklist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def __chat_settings__(chat_id, user_id):
439439

440440

441441
def __stats__():
442-
return "× {} blacklist triggers, across {} chats.".format(
442+
return " {} blacklist triggers, across {} chats.".format(
443443
sql.num_blacklist_filters(), sql.num_blacklist_filter_chats())
444444

445445

SaitamaRobot/modules/blacklist_stickers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def __chat_settings__(chat_id, user_id):
459459

460460

461461
def __stats__():
462-
return "{} blacklist stickers, across {} chats.".format(
462+
return "{} blacklist stickers, across {} chats.".format(
463463
sql.num_stickers_filters(), sql.num_stickers_filter_chats())
464464

465465

SaitamaRobot/modules/connection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,13 @@ def connect_button(update, context):
374374
Sometimes, you just want to add some notes and filters to a group chat, but you don't want everyone to see; This is where connections come in...
375375
This allows you to connect to a chat's database, and add things to it without the commands appearing in chat! For obvious reasons, you need to be an admin to add things; but any member in the group can view your data.
376376
377-
× /connect: Connects to chat (Can be done in a group by /connect or /connect <chat id> in PM)
378-
× /connection: List connected chats
379-
× /disconnect: Disconnect from a chat
380-
× /helpconnect: List available commands that can be used remotely
377+
/connect: Connects to chat (Can be done in a group by /connect or /connect <chat id> in PM)
378+
/connection: List connected chats
379+
/disconnect: Disconnect from a chat
380+
/helpconnect: List available commands that can be used remotely
381381
382382
*Admin only:*
383-
× /allowconnect <yes/no>: allow a user to connect to a chat
383+
/allowconnect <yes/no>: allow a user to connect to a chat
384384
"""
385385

386386
CONNECT_CHAT_HANDLER = CommandHandler("connect", connect_chat, pass_args=True)

SaitamaRobot/modules/cust_filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def list_handlers(update, context):
7575
return
7676

7777
for keyword in all_handlers:
78-
entry = " × `{}`\n".format(escape_markdown(keyword))
78+
entry = " `{}`\n".format(escape_markdown(keyword))
7979
if len(entry) + len(filter_list) > telegram.MAX_MESSAGE_LENGTH:
8080
send_message(
8181
update.effective_message,
@@ -492,7 +492,7 @@ def get_exception(excp, filt, chat):
492492

493493

494494
def __stats__():
495-
return "× {} filters, across {} chats.".format(sql.num_filters(),
495+
return " {} filters, across {} chats.".format(sql.num_filters(),
496496
sql.num_chats())
497497

498498

SaitamaRobot/modules/disable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def commands(update: Update, context: CallbackContext):
305305
build_curr_disabled(chat.id), parse_mode=ParseMode.MARKDOWN)
306306

307307
def __stats__():
308-
return f"{sql.num_disabled()} disabled items, across {sql.num_chats()} chats."
308+
return f"{sql.num_disabled()} disabled items, across {sql.num_chats()} chats."
309309

310310
def __migrate__(old_chat_id, new_chat_id):
311311
sql.migrate_chat(old_chat_id, new_chat_id)

SaitamaRobot/modules/feds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ def welcome_fed(update: Update, context: CallbackContext):
19961996
def __stats__():
19971997
all_fbanned = sql.get_all_fban_users_global()
19981998
all_feds = sql.get_all_feds_users_global()
1999-
return "{} banned users across {} Federations".format(
1999+
return "{} banned users across {} Federations".format(
20002000
len(all_fbanned), len(all_feds))
20012001

20022002

SaitamaRobot/modules/global_bans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def gbanstat(update: Update, context: CallbackContext):
460460

461461

462462
def __stats__():
463-
return f"{sql.num_gbanned_users()} gbanned users."
463+
return f"{sql.num_gbanned_users()} gbanned users."
464464

465465

466466
def __user_info__(user_id):

SaitamaRobot/modules/helper_funcs/msg_types.py

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,24 +89,21 @@ def get_welcome_type(msg: Message):
8989
content = None
9090
text = ""
9191

92-
args = msg.text.split(None,
93-
1) # use python's maxsplit to separate cmd and args
94-
95-
buttons = []
96-
# determine what the contents of the filter are - text, image, sticker, etc
97-
if len(args) >= 2:
98-
offset = len(args[1]) - len(
99-
msg.text) # set correct offset relative to command + notename
100-
text, buttons = button_markdown_parser(
101-
args[1], entities=msg.parse_entities(), offset=offset)
102-
if buttons:
103-
data_type = Types.BUTTON_TEXT
92+
try:
93+
if msg.reply_to_message:
94+
if msg.reply_to_message.text:
95+
args = msg.reply_to_message.text
96+
else:
97+
args = msg.reply_to_message.caption
10498
else:
105-
data_type = Types.TEXT
99+
args = msg.text.split(
100+
None, 1) # use python's maxsplit to separate cmd and args
101+
except AttributeError:
102+
args = False
106103

107-
elif msg.reply_to_message and msg.reply_to_message.sticker:
104+
if msg.reply_to_message and msg.reply_to_message.sticker:
108105
content = msg.reply_to_message.sticker.file_id
109-
text = msg.reply_to_message.caption
106+
text = None
110107
data_type = Types.STICKER
111108

112109
elif msg.reply_to_message and msg.reply_to_message.document:
@@ -135,6 +132,32 @@ def get_welcome_type(msg: Message):
135132
text = msg.reply_to_message.caption
136133
data_type = Types.VIDEO
137134

135+
elif msg.reply_to_message and msg.reply_to_message.video_note:
136+
content = msg.reply_to_message.video_note.file_id
137+
text = None
138+
data_type = Types.VIDEO_NOTE
139+
140+
buttons = []
141+
# determine what the contents of the filter are - text, image, sticker, etc
142+
if args:
143+
if msg.reply_to_message:
144+
argumen = msg.reply_to_message.caption if msg.reply_to_message.caption else ""
145+
offset = 0 # offset is no need since target was in reply
146+
entities = msg.reply_to_message.parse_entities()
147+
else:
148+
argumen = args[1]
149+
offset = len(argumen) - len(
150+
msg.text) # set correct offset relative to command + notename
151+
entities = msg.parse_entities()
152+
text, buttons = button_markdown_parser(
153+
argumen, entities=entities, offset=offset)
154+
155+
if not data_type:
156+
if text and buttons:
157+
data_type = Types.BUTTON_TEXT
158+
elif text:
159+
data_type = Types.TEXT
160+
138161
return text, data_type, content, buttons
139162

140163

SaitamaRobot/modules/locks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,10 @@ def build_lock_message(chat_id):
541541
locklist.sort()
542542
# Building lock list string
543543
for x in locklist:
544-
res += "\n × {}".format(x)
544+
res += "\n {}".format(x)
545545
res += "\n\n*" + "These are the current chat permissions:" + "*"
546546
for x in permslist:
547-
res += "\n × {}".format(x)
547+
res += "\n {}".format(x)
548548
return res
549549

550550

0 commit comments

Comments
 (0)