Fixed bugs

This commit is contained in:
Choco
2025-01-24 10:26:01 +08:00
parent 87ace628df
commit 1910c7e0b6
2 changed files with 6 additions and 5 deletions

View File

@@ -197,13 +197,12 @@ if (LOG_FILE := LOG_SETTINGS.get("file", {})).get("enable", True):
file_handler = TimedRotatingFileHandler(filename=f'{log_path}/vocard.log', encoding="utf-8", backupCount=LOG_SETTINGS.get("max-history", 30), when="d") file_handler = TimedRotatingFileHandler(filename=f'{log_path}/vocard.log', encoding="utf-8", backupCount=LOG_SETTINGS.get("max-history", 30), when="d")
file_handler.namer = lambda name: name.replace(".log", "") + ".log" file_handler.namer = lambda name: name.replace(".log", "") + ".log"
file_handler.setFormatter(logging.Formatter('{asctime} [{levelname:<8}] {name}: {message}', '%Y-%m-%d %H:%M:%S', style='{')) file_handler.setFormatter(logging.Formatter('{asctime} [{levelname:<8}] {name}: {message}', '%Y-%m-%d %H:%M:%S', style='{'))
logging.getLogger().addHandler(file_handler)
for log_name, log_level in LOG_SETTINGS.get("level", {}).items(): for log_name, log_level in LOG_SETTINGS.get("level", {}).items():
_logger = logging.getLogger(log_name) _logger = logging.getLogger(log_name)
_logger.setLevel(log_level) _logger.setLevel(log_level)
logging.getLogger().addHandler(file_handler)
# Setup the bot object # Setup the bot object
intents = discord.Intents.default() intents = discord.Intents.default()
intents.message_content = False if func.settings.bot_prefix is None else True intents.message_content = False if func.settings.bot_prefix is None else True

View File

@@ -38,7 +38,8 @@ from discord import (
Message, Message,
PartialMessage, PartialMessage,
Interaction, Interaction,
errors errors,
ChannelType
) )
from discord.ext import commands from discord.ext import commands
@@ -851,7 +852,8 @@ class Player(VoiceProtocol):
rv = {key: func() if callable(func) else func for key, func in self._ph.variables.items()} rv = {key: func() if callable(func) else func for key, func in self._ph.variables.items()}
status = None if remove_status else self._ph.replace(text=template, variables=rv) status = None if remove_status else self._ph.replace(text=template, variables=rv)
# if self.channel.status != status: # if self.channel.status != status:
await self.channel.edit(status=status) if self.channel.type == ChannelType.voice:
await self.channel.edit(status=status)
except Exception as e: except Exception as e:
self._logger.error( self._logger.error(