Fixed dashboard weather, better status.
This commit is contained in:
@@ -20,8 +20,12 @@ class Help(BotFunc):
|
||||
CallbackQueryHandler(self.choose_specific, pattern="^specific$"),
|
||||
CallbackQueryHandler(self.print_one, pattern='func-'),
|
||||
],
|
||||
# ConversationHandler.TIMEOUT : [
|
||||
# CallbackQueryHandler(self.timeout)
|
||||
# ]
|
||||
},
|
||||
fallbacks=[CommandHandler('help', self.entry_point)],
|
||||
# conversation_timeout=5,
|
||||
)
|
||||
return conv_handler
|
||||
|
||||
@@ -83,3 +87,19 @@ class Help(BotFunc):
|
||||
parse_mode = ParseMode.MARKDOWN_V2
|
||||
)
|
||||
return ConversationHandler.END
|
||||
|
||||
|
||||
|
||||
def timeout(self, update: Update, context: CallbackContext) -> None:
|
||||
"""For dying conversation. Currently unused."""
|
||||
|
||||
query = update.callback_query
|
||||
name = query.data.replace("func-", "")
|
||||
query.answer()
|
||||
|
||||
message = name + ": `" + self.available_commands[name] + "`"
|
||||
query.edit_message_text(
|
||||
text= "EHHHHH",
|
||||
parse_mode = ParseMode.MARKDOWN_V2
|
||||
)
|
||||
return ConversationHandler.END
|
@@ -5,6 +5,7 @@ import requests
|
||||
import socket
|
||||
import numpy as np
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
FIRST = 1
|
||||
@@ -59,6 +60,7 @@ class Status(BotFunc):
|
||||
message += "Reboots: `" + str(self.persistence["global"]["reboots"]) + "`\n"
|
||||
message += "IP (public): `" + ip + "`\n"
|
||||
message += "IP (private): `" + str(local_ips) + "`\n"
|
||||
message += "URL: `" + str(self.get_ngrok_url()) "`\n"
|
||||
|
||||
tot_r = np.array(self.persistence["bot"]["receive_activity"]["count"]).sum()
|
||||
message += "Total messages read: `" + str(tot_r) + "`\n"
|
||||
@@ -80,4 +82,18 @@ class Status(BotFunc):
|
||||
with open("persistence/complete.log") as l:
|
||||
query.message.reply_document(l)
|
||||
|
||||
return ConversationHandler.END
|
||||
return ConversationHandler.END
|
||||
|
||||
|
||||
def get_ngrok_url(self):
|
||||
try:
|
||||
url = "http://localhost:4040/api/tunnels/"
|
||||
res = requests.get(url)
|
||||
res_unicode = res.content.decode("utf-8")
|
||||
res_json = json.loads(res_unicode)
|
||||
for i in res_json["tunnels"]:
|
||||
if i['name'] == 'command_line':
|
||||
return i['public_url']
|
||||
break
|
||||
except:
|
||||
return "Not available"
|
Reference in New Issue
Block a user