Skip to content

Commit db911a2

Browse files
committed
v2.13.10 fixed activity/status problem
1 parent da30693 commit db911a2

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# v2.13.10
8+
9+
### Fixed
10+
- Fixed an issue where status and activity does not work if they were modified wrongly in the database.
11+
- This was especially an issue for older Modmail users, as the old `status` configuration variable clashes with the new `status` variable.
12+
713
# v2.13.9
814

915
### Fixed

bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = '2.13.9'
25+
__version__ = '2.13.10'
2626

2727
import asyncio
2828
import logging

cogs/utility.py

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ''):
430430
self.bot.config['activity_type'] = None
431431
self.bot.config['activity_message'] = None
432432
await self.bot.config.update()
433-
await self.set_presence(log=False)
433+
await self.set_presence()
434434
embed = Embed(
435435
title='Activity Removed',
436436
color=self.bot.main_color
@@ -440,14 +440,12 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ''):
440440
if not message:
441441
raise commands.UserInputError
442442

443-
try:
444-
activity, msg = (await self.set_presence(
443+
activity, msg = (await self.set_presence(
445444
activity_identifier=activity_type,
446445
activity_by_key=True,
447-
activity_message=message,
448-
log=False
449-
))['activity']
450-
except ValueError:
446+
activity_message=message
447+
))['activity']
448+
if activity is None:
451449
raise commands.UserInputError
452450

453451
self.bot.config['activity_type'] = activity.type.value
@@ -480,21 +478,19 @@ async def status(self, ctx, *, status_type: str.lower):
480478
if status_type == 'clear':
481479
self.bot.config['status'] = None
482480
await self.bot.config.update()
483-
await self.set_presence(log=False)
481+
await self.set_presence()
484482
embed = Embed(
485483
title='Status Removed',
486484
color=self.bot.main_color
487485
)
488486
return await ctx.send(embed=embed)
489487
status_type = status_type.replace(' ', '_')
490488

491-
try:
492-
status, msg = (await self.set_presence(
489+
status, msg = (await self.set_presence(
493490
status_identifier=status_type,
494491
status_by_key=True,
495-
log=False
496-
))['status']
497-
except ValueError:
492+
))['status']
493+
if status is None:
498494
raise commands.UserInputError
499495

500496
self.bot.config['status'] = status.value
@@ -512,8 +508,7 @@ async def set_presence(self, *,
512508
status_by_key=True,
513509
activity_identifier=None,
514510
activity_by_key=True,
515-
activity_message=None,
516-
log=True):
511+
activity_message=None):
517512

518513
activity = status = None
519514
if status_identifier is None:
@@ -528,10 +523,7 @@ async def set_presence(self, *,
528523
except (KeyError, ValueError):
529524
if status_identifier is not None:
530525
msg = f'Invalid status type: {status_identifier}'
531-
if log:
532-
logger.warning(error(msg))
533-
else:
534-
raise ValueError(msg)
526+
logger.warning(error(msg))
535527

536528
if activity_identifier is None:
537529
if activity_message is not None:
@@ -548,10 +540,7 @@ async def set_presence(self, *,
548540
except (KeyError, ValueError):
549541
if activity_identifier is not None:
550542
msg = f'Invalid activity type: {activity_identifier}'
551-
if log:
552-
logger.warning(error(msg))
553-
else:
554-
raise ValueError(msg)
543+
logger.warning(error(msg))
555544
else:
556545
url = None
557546
activity_message = (
@@ -575,10 +564,7 @@ async def set_presence(self, *,
575564
url=url)
576565
else:
577566
msg = 'You must supply an activity message to use custom activity.'
578-
if log:
579-
logger.warning(error(msg))
580-
else:
581-
raise ValueError(msg)
567+
logger.warning(error(msg))
582568

583569
await self.bot.change_presence(activity=activity, status=status)
584570

0 commit comments

Comments
 (0)