Add help and ping commands
Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
f83ab444d2
commit
b69e009661
|
|
@ -3,23 +3,45 @@ from bot import dispatcher, LOGGER, updater, aria2
|
||||||
import bot.mirror, bot.list, bot.mirror_status, bot.cancel_mirror
|
import bot.mirror, bot.list, bot.mirror_status, bot.cancel_mirror
|
||||||
from bot.helper import fs_utils
|
from bot.helper import fs_utils
|
||||||
import signal
|
import signal
|
||||||
|
import time
|
||||||
|
from bot.helper.message_utils import *
|
||||||
|
|
||||||
|
|
||||||
@run_async
|
@run_async
|
||||||
def start(update, context):
|
def start(update, context):
|
||||||
print(update)
|
print(update)
|
||||||
context.bot.send_message(chat_id=update.message.chat_id, text="I'm a bot, please talk to me!")
|
sendMessage("This is a bot which can mirror all your links to Google drive!\n"
|
||||||
|
"Type /help to get a list of available commands", context, update)
|
||||||
|
|
||||||
|
|
||||||
LOGGER.info('__main__.py')
|
@run_async
|
||||||
|
def ping(update, context):
|
||||||
|
start_time = int(round(time.time() * 1000))
|
||||||
|
reply = sendMessage("Starting Ping", context, update)
|
||||||
|
end_time = int(round(time.time()*1000))
|
||||||
|
editMessage(f'{end_time - start_time} ms', context, reply)
|
||||||
|
|
||||||
|
|
||||||
|
@run_async
|
||||||
|
def bot_help(update, context):
|
||||||
|
help_string = f'/help: To get this message\n' \
|
||||||
|
f'/mirror [download_url][magnet_link]: Start mirroring the link to google drive\n' \
|
||||||
|
f'/cancel: Reply to the message by which the download was initiated and that download will be cancelled\n' \
|
||||||
|
f'/status: Shows a status of all the downloads\n' \
|
||||||
|
f'/list [search term]: Searches the search term in the Google drive, if found replies with the link'
|
||||||
|
sendMessage(help_string, context, update)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
start_handler = CommandHandler('start', start)
|
start_handler = CommandHandler('start', start)
|
||||||
|
ping_handler = CommandHandler('ping', ping)
|
||||||
|
help_handler = CommandHandler('help', bot_help)
|
||||||
dispatcher.add_handler(start_handler)
|
dispatcher.add_handler(start_handler)
|
||||||
LOGGER.info("Bot Started!")
|
dispatcher.add_handler(ping_handler)
|
||||||
|
dispatcher.add_handler(help_handler)
|
||||||
updater.start_polling()
|
updater.start_polling()
|
||||||
|
LOGGER.info("Bot Started!")
|
||||||
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
|
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue