Skip to content

Commit

Permalink
Bot: Cleanup & Improve Notes output message!
Browse files Browse the repository at this point in the history
Signed-off-by: Yasir-siddiqui <[email protected]>
  • Loading branch information
Yasir-siddiqui authored and MD Raza committed Jul 17, 2020
1 parent d056644 commit a14f5c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 251 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tgbot
# Joker
A modular telegram Python bot running on python3 with an sqlalchemy database.

Originally a simple group management bot with multiple admin features, it has evolved, becoming extremely modular and
Expand Down
12 changes: 7 additions & 5 deletions tg_bot/modules/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,25 @@ def clear(bot: Bot, update: Update, args: List[str]):

@run_async
def list_notes(bot: Bot, update: Update):
chat = update.effective_chat # type: Optional[Chat]
chat_id = update.effective_chat.id
note_list = sql.get_all_chat_notes(chat_id)
chat_name = update.effective_chat.title
chat_name = chat.title

msg = "*Notes in chat:*\n"
msg = "*Notes in {}:*\n"
for note in note_list:
note_name = escape_markdown(" - {}\n".format(note.name))
note_name = " • `{}`\n".format(note.name)
if len(msg) + len(note_name) > MAX_MESSAGE_LENGTH:
update.effective_message.reply_text(msg, parse_mode=ParseMode.MARKDOWN)
msg = ""
msg += note_name

if msg == "*Notes in chat:*\n":
if not note_list:
update.effective_message.reply_text("No notes in this chat!")

elif len(msg) != 0:
update.effective_message.reply_text(msg, parse_mode=ParseMode.MARKDOWN)

update.effective_message.reply_text(msg.format(chat_name), parse_mode=ParseMode.MARKDOWN)

def __import_data__(chat_id, data):
failures = []
Expand Down
244 changes: 0 additions & 244 deletions tg_bot/modules/rss.py

This file was deleted.

2 changes: 1 addition & 1 deletion tg_bot/modules/sql/welcome_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from tg_bot.modules.helper_funcs.msg_types import Types
from tg_bot.modules.sql import SESSION, BASE

DEFAULT_WELCOME = "Hey {mention}}, how are you?"
DEFAULT_WELCOME = "Hey {first}, how are you?"
DEFAULT_GOODBYE = "Goodbye's Are not Forever!"


Expand Down

0 comments on commit a14f5c4

Please sign in to comment.