Added command logging to console
parent
1bc5d5c042
commit
dd05c26b5d
|
@ -22,6 +22,10 @@ class DiscordBot(commands.Bot):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log(f"Error loading Discord commands: {e}", "ERROR")
|
self.log(f"Error loading Discord commands: {e}", "ERROR")
|
||||||
|
|
||||||
|
async def on_command(self, ctx):
|
||||||
|
"""Logs every command execution at DEBUG level."""
|
||||||
|
self.log(f"Command executed: {ctx.command} by {ctx.author} in #{ctx.channel}", "DEBUG")
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
self.log(f"Discord bot is online as {self.user}", "INFO")
|
self.log(f"Discord bot is online as {self.user}", "INFO")
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,21 @@ class TwitchBot(commands.Bot):
|
||||||
# 2) Then load commands
|
# 2) Then load commands
|
||||||
self.load_commands()
|
self.load_commands()
|
||||||
|
|
||||||
|
async def event_message(self, message):
|
||||||
|
"""Logs and processes incoming Twitch messages."""
|
||||||
|
if message.echo:
|
||||||
|
return # Ignore bot's own messages
|
||||||
|
|
||||||
|
# Log the command if it's a command
|
||||||
|
if message.content.startswith("!"):
|
||||||
|
self.log(f"Command executed: {message.content} by {message.author.name} in #{message.channel.name}", "DEBUG")
|
||||||
|
|
||||||
|
# Process the message for command execution
|
||||||
|
await self.handle_commands(message)
|
||||||
|
|
||||||
|
async def event_ready(self):
|
||||||
|
self.log(f"Twitch bot is online as {self.nick}", "INFO")
|
||||||
|
|
||||||
async def refresh_access_token(self):
|
async def refresh_access_token(self):
|
||||||
"""
|
"""
|
||||||
Refreshes the Twitch access token using the stored refresh token.
|
Refreshes the Twitch access token using the stored refresh token.
|
||||||
|
@ -106,8 +121,6 @@ class TwitchBot(commands.Bot):
|
||||||
Run the Twitch bot, refreshing tokens if needed.
|
Run the Twitch bot, refreshing tokens if needed.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.log(f"Twitch bot connecting...", "INFO")
|
|
||||||
self.log(f"...Consider online if no further messages", "INFO")
|
|
||||||
await self.start()
|
await self.start()
|
||||||
#while True:
|
#while True:
|
||||||
# await self.refresh_access_token()
|
# await self.refresh_access_token()
|
||||||
|
|
Loading…
Reference in New Issue