[+] Create ls command
This commit is contained in:
+7
@@ -2,6 +2,13 @@
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="JpaDataSourceORMInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N802" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SqlResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
|
||||
@@ -36,6 +36,7 @@ if __name__ == '__main__':
|
||||
|
||||
# Register commands
|
||||
dispatcher.add_handler(CommandHandler('start', start))
|
||||
dispatcher.add_handler(CommandHandler('ls', ls))
|
||||
|
||||
# Start bot
|
||||
updater.start_polling()
|
||||
|
||||
+17
-2
@@ -1,4 +1,6 @@
|
||||
# Help message
|
||||
from src.bot import database
|
||||
from src.utils import toJson
|
||||
|
||||
helpMsg = """
|
||||
Welcome! This bot monitors http changes!
|
||||
|
||||
@@ -21,4 +23,17 @@ Welcome! This bot monitors http changes!
|
||||
|
||||
|
||||
def start(update, context):
|
||||
context.bot.send_message(chat_id=update.effective_chat.id, text=helpMsg, parse_mode="markdown")
|
||||
chat = update.effective_chat
|
||||
database.checkUser(chat.id)
|
||||
|
||||
# Send help
|
||||
context.bot.send_message(chat_id=chat.id, text=helpMsg, parse_mode="markdown")
|
||||
|
||||
|
||||
def ls(update, context):
|
||||
chat = update.effective_chat
|
||||
database.checkUser(chat.id)
|
||||
|
||||
requests = database.userRequests[chat.id]
|
||||
|
||||
context.bot.send_message(chat_id=update.effective_chat.id, text="Your requests: " + toJson(requests))
|
||||
|
||||
Reference in New Issue
Block a user