Fixed some bugs
This commit is contained in:
@@ -191,9 +191,6 @@ class Basic(commands.Cog):
|
||||
await interaction.response.send_message((f"`{texts[0]}`" if tracks[0].is_stream else "") + (texts[1].format(tracks[0].title, tracks[0].uri, tracks[0].author, tracks[0].formatted_length, position) if position >= 1 and player.is_playing else texts[2].format(tracks[0].title, tracks[0].uri, tracks[0].author, tracks[0].formatted_length)), allowed_mentions=False)
|
||||
except voicelink.QueueFull as e:
|
||||
await interaction.response.send_message(e)
|
||||
|
||||
except Exception as e:
|
||||
return await interaction.response.send_message(e, ephemeral=True)
|
||||
|
||||
finally:
|
||||
if not player.is_playing:
|
||||
|
||||
@@ -36,7 +36,6 @@ class Task(commands.Cog):
|
||||
self.cache_cleaner.start()
|
||||
|
||||
self.current_act = 0
|
||||
self.last_activity: discord.Activity = None
|
||||
self.placeholder = Placeholders(bot)
|
||||
|
||||
def cog_unload(self):
|
||||
@@ -50,15 +49,15 @@ class Task(commands.Cog):
|
||||
|
||||
try:
|
||||
act_data = func.settings.activity[(self.current_act + 1) % len(func.settings.activity) - 1]
|
||||
act_original = self.last_activity or self.bot.activity
|
||||
act_original = self.bot.activity
|
||||
act_type = getattr(discord.ActivityType, act_data.get("type", "").lower(), discord.ActivityType.playing)
|
||||
act_name = self.placeholder.replace(act_data.get("name", ""))
|
||||
|
||||
status_type = getattr(discord.Status, act_data.get("status", "").lower(), None)
|
||||
|
||||
if act_original.type != act_type or act_original.name != act_name:
|
||||
self.last_activity = discord.Activity(type=act_type, name=act_name)
|
||||
await self.bot.change_presence(activity=self.last_activity, status=status_type)
|
||||
self.bot.activity = discord.Activity(type=act_type, name=act_name)
|
||||
await self.bot.change_presence(activity=self.bot.activity, status=status_type)
|
||||
self.current_act = (self.current_act + 1) % len(func.settings.activity)
|
||||
|
||||
func.logger.info(f"Changed the bot status to {act_name}")
|
||||
@@ -112,4 +111,4 @@ class Task(commands.Cog):
|
||||
func.USERS_BUFFER.clear()
|
||||
|
||||
async def setup(bot: commands.Bot):
|
||||
await bot.add_cog(Task(bot))
|
||||
await bot.add_cog(Task(bot))
|
||||
Reference in New Issue
Block a user