|
26 | 26 | import function as func |
27 | 27 |
|
28 | 28 | from discord.ext import commands, tasks |
29 | | -from datetime import datetime |
30 | 29 | from addons import Placeholders |
31 | 30 |
|
32 | 31 | class Task(commands.Cog): |
@@ -56,18 +55,21 @@ async def activity_update(self): |
56 | 55 |
|
57 | 56 | try: |
58 | 57 | act_data = func.settings.activity[(self.current_act + 1) % len(func.settings.activity) - 1] |
59 | | - |
60 | 58 | act_original = self.bot.activity |
61 | | - act_type = self.act_type.get(list(act_data.keys())[0].lower(), discord.ActivityType.playing) |
62 | | - act_name = self.placeholder.replace(list(act_data.values())[0]) |
| 59 | + act_type = getattr(discord.ActivityType, act_data.get("type", "").lower(), discord.ActivityType.playing) |
| 60 | + act_name = self.placeholder.replace(act_data.get("name", "")) |
| 61 | + |
| 62 | + status_type = getattr(discord.Status, act_data.get("status", "").lower(), None) |
63 | 63 |
|
64 | 64 | if act_original.type != act_type or act_original.name != act_name: |
65 | 65 | new_act = discord.Activity(type=act_type, name=act_name) |
66 | | - await self.bot.change_presence(activity=new_act) |
| 66 | + await self.bot.change_presence(activity=new_act, status=status_type) |
67 | 67 | self.current_act = (self.current_act + 1) % len(func.settings.activity) |
68 | 68 |
|
69 | | - except: |
70 | | - pass |
| 69 | + func.logger.info(f"Changed the bot status to {act_name}") |
| 70 | + |
| 71 | + except Exception as e: |
| 72 | + func.logger.error("Error occurred while changing the bot status!", exc_info=e) |
71 | 73 |
|
72 | 74 | @tasks.loop(minutes=5.0) |
73 | 75 | async def player_check(self): |
|
0 commit comments