mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Telegrambot improvements
This commit is contained in:
parent
804ca43175
commit
3b44100fcf
1 changed files with 15 additions and 10 deletions
|
@ -7,6 +7,8 @@ import stagismo
|
||||||
from telegram import Bot, Update, InlineKeyboardMarkup, InlineKeyboardButton
|
from telegram import Bot, Update, InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
|
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
|
||||||
from discord import Status as DiscordStatus
|
from discord import Status as DiscordStatus
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
# Init the config reader
|
# Init the config reader
|
||||||
import configparser
|
import configparser
|
||||||
|
@ -16,15 +18,17 @@ config.read("config.ini")
|
||||||
discord_connection = None
|
discord_connection = None
|
||||||
|
|
||||||
# Find the latest git tag
|
# Find the latest git tag
|
||||||
import subprocess
|
if __debug__:
|
||||||
import os
|
version = "Dev"
|
||||||
old_wd = os.getcwd()
|
else:
|
||||||
try:
|
# Find the latest git tag
|
||||||
|
old_wd = os.getcwd()
|
||||||
|
try:
|
||||||
os.chdir(os.path.dirname(__file__))
|
os.chdir(os.path.dirname(__file__))
|
||||||
version = str(subprocess.check_output(["git", "describe", "--tags"]), encoding="utf8").strip()
|
version = str(subprocess.check_output(["git", "describe", "--tags"]), encoding="utf8").strip()
|
||||||
except:
|
except Exception:
|
||||||
version = "v???"
|
version = "❓"
|
||||||
finally:
|
finally:
|
||||||
os.chdir(old_wd)
|
os.chdir(old_wd)
|
||||||
|
|
||||||
|
|
||||||
|
@ -366,6 +370,7 @@ def process(arg_discord_connection):
|
||||||
u.dispatcher.add_handler(CommandHandler("vote", cmd_vote))
|
u.dispatcher.add_handler(CommandHandler("vote", cmd_vote))
|
||||||
u.dispatcher.add_handler(CommandHandler("ban", cmd_ban))
|
u.dispatcher.add_handler(CommandHandler("ban", cmd_ban))
|
||||||
u.dispatcher.add_handler(CallbackQueryHandler(on_callback_query))
|
u.dispatcher.add_handler(CallbackQueryHandler(on_callback_query))
|
||||||
|
u.bot.send_message(config["Telegram"]["main_group"], f"ℹ Royal Bot {version} avviato e pronto a ricevere comandi!")
|
||||||
u.start_polling()
|
u.start_polling()
|
||||||
u.idle()
|
u.idle()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue