Merge branch 'release-v0.5' into 'main' #3
@@ -1,32 +0,0 @@
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from cogs.base_cog import Base_Cog
|
||||
|
||||
import logging
|
||||
from utils.portal import Portal
|
||||
|
||||
class About_Command(Base_Cog):
|
||||
def __init__(self, bot:commands.Bot):
|
||||
self.__bot = bot
|
||||
super().__init__(logging.getLogger("cmds.about"))
|
||||
|
||||
@app_commands.command(name = "about", description = "Provides general information about the bot")
|
||||
@app_commands.check(Maintenance_Command.handle_check)
|
||||
async def about(self, ctx: discord.Interaction):
|
||||
portal:Portal = Portal.instance()
|
||||
embed = discord.Embed(title=f"POST IT - `{portal.PROGRAM_VERSION}`",
|
||||
description="### Übersicht der Befehle\n- `/post` Veröffentlicht einen Post einer anderen Plattform, mit beliebigen Bildern als Anhang\n- `/help` Zeigt diese Übersicht an\n- `/settings` Persönliche Einstellungen für das verhalten des Bots\n- `/stats` Zeigt persönliche und globale Statistiken\n- `/debug` Erweiterte Informationen zum Betriebszustandes des Bots",
|
||||
colour=0x5a5a5a)
|
||||
|
||||
embed.add_field(name="Status des Bots",
|
||||
value="Fehlerfrei :green_circle:",
|
||||
inline=True)
|
||||
embed.add_field(name="Besitzer der Bot Instanz",
|
||||
value=f"<@{portal.bot_config['DISCORD']['OWNER_ID']}>",
|
||||
inline=True)
|
||||
|
||||
await ctx.response.send_message(embed = embed, ephemeral = True)
|
||||
|
||||
async def setup(bot:commands.Bot):
|
||||
await bot.add_cog(About_Command(bot))
|
||||
+1
-6
@@ -32,7 +32,6 @@ from utils.portal import Portal
|
||||
import asyncio
|
||||
from typing import Union
|
||||
from platforms.reddit import Reddit_Adapter
|
||||
from cogs.maintenance import Maintenance_Command
|
||||
|
||||
source_path = Path(__file__).resolve()
|
||||
base_path = source_path.parents[1]
|
||||
@@ -52,7 +51,7 @@ class MyBot(commands.Bot):
|
||||
|
||||
async def setup_hook(self):
|
||||
# Register cogs to handle commands
|
||||
for cog_name in ["maintenance", "about", "debug", "reload", "post"]:
|
||||
for cog_name in ["about", "debug", "reload", "post"]:
|
||||
await self.load_extension(f"cogs.{cog_name}")
|
||||
await self.tree.sync()
|
||||
|
||||
@@ -79,8 +78,6 @@ class MyBot(commands.Bot):
|
||||
async def on_connect(self):
|
||||
"""A coroutine to be called to setup the bot, after the bot is logged in but before it has connected to the Websocket"""
|
||||
if not self.__first_on_ready:
|
||||
instance: Maintenance_Command = self.get_cog("Maintenance_Command")
|
||||
instance.enable_global_maintenance()
|
||||
startup_logger.info(f"Beginning startup routine ...")
|
||||
routine_begin = datetime.now().timestamp()
|
||||
await self.change_presence(status = discord.Status.dnd, activity = discord.CustomActivity("Executing pre startup routine"))
|
||||
@@ -100,8 +97,6 @@ class MyBot(commands.Bot):
|
||||
|
||||
await self.change_presence(status = discord.Status.online, activity = None)
|
||||
startup_logger.info(f"Startup routine finished after {get_elapsed_time_milliseconds(datetime.now().timestamp() - routine_begin)}")
|
||||
|
||||
instance.disable_gloabal_maintenance()
|
||||
self.__first_on_ready = True
|
||||
else:
|
||||
startup_logger.info("Startup routine allready executed, omitting this execution")
|
||||
|
||||
Reference in New Issue
Block a user