|
|
@@ -1,4 +1,5 @@
|
|
|
-import logging, discord, asyncpg, random
|
|
|
+import logging, discord, asyncpg, random, sys
|
|
|
+
|
|
|
from discord.ext import commands
|
|
|
from query.guild import update_guild, get_report_deleted, get_output_channel
|
|
|
from query.channel import insert_channel, get_interact
|
|
|
@@ -16,17 +17,74 @@ class General(commands.Cog):
|
|
|
self.bot = bot
|
|
|
self.last_msg = None
|
|
|
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_raw_app_command_permissions_update(self, payload):
|
|
|
+ logging.info(f"Application command permissions are updated: {payload}")
|
|
|
+ await report(self.bot, f"Application command permissions are updated: {payload}", payload.guild)
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_app_command_completion(self, interaction, command):
|
|
|
+ logging.info(f"Application command completion: {interaction} - {command}")
|
|
|
+ await report(self.bot, f"Application command completion: {interaction} - {command}", interaction.guild)
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_connect(self):
|
|
|
+ logging.info("Connecting...")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_disconnect(self):
|
|
|
+ logging.info("Disconnecting...")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_shard_connect(self, shard_id):
|
|
|
+ logging.info(f"Connecting to chard: {shard_id}")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_shard_disconnect(self, shard_id):
|
|
|
+ logging.info(f"Disconnecting from chard: {shard_id}")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_error(self, event, *args, **kwargs):
|
|
|
+ logging.error(event, args, kwargs, sys.exc_info())
|
|
|
+ await report(self.bot, f"{event}, {args}, {kwargs}, {sys.exc_info()}")
|
|
|
|
|
|
@commands.Cog.listener()
|
|
|
async def on_ready(self):
|
|
|
logging.info("Logged in as %s - %i", self.bot.user.name, self.bot.user.id)
|
|
|
#await report(self.bot, f"Logged in as {self.bot.user.name} - {self.bot.user.id}.")
|
|
|
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_resumed(self):
|
|
|
+ logging.info("Resumed")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_shard_ready(self, shard_id):
|
|
|
+ logging.info(f"Chard ready: {shard_id}")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_shard_resumed(self, shard_id):
|
|
|
+ logging.info(f"Chard resumed: {shard_id}")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_guild_available(self, guild: discord.Guild):
|
|
|
+ logging.info(f"Guild available: {guild}")
|
|
|
+ #await report(self.bot, f"Guild available: {guild}.")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_guild_unavailable(self, guild: discord.Guild):
|
|
|
+ logging.info(f"Guild unavailable: {guild}")
|
|
|
+ await report(self.bot, f"Guild unavailable: `{guild}`.")
|
|
|
+
|
|
|
@commands.Cog.listener()
|
|
|
async def on_guild_join(self, guild: discord.Guild):
|
|
|
await update_guild(self.bot.pg, guild)
|
|
|
logging.info(f"Joined guild {guild}")
|
|
|
- await report(self.bot, f"Joined guild {guild.name}.")
|
|
|
+ await report(self.bot, f"Joined guild `{guild}`.")
|
|
|
+
|
|
|
+ @commands.Cog.listener()
|
|
|
+ async def on_guild_remove(self, guild: discord.Guild):
|
|
|
+ logging.info(f"Guild removed: {guild}")
|
|
|
+ await report(self.bot, f"Guild removed `{guild}`.")
|
|
|
|
|
|
@commands.Cog.listener()
|
|
|
async def on_message_delete(self, message: discord.Message):
|