aboutsummaryrefslogtreecommitdiffstats
path: root/bot/bot.py
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-03-29 13:30:30 +0200
committerGravatar kwzrd <[email protected]>2020-03-29 13:30:30 +0200
commitc97a75a12999f638cd413d8e0dbd623102cdd1b8 (patch)
tree4dd2e80b5ba6c81dbe0af9e802ced4427bb13dca /bot/bot.py
parentDeseasonify: re-order command defs for consistency with doc (diff)
Deseasonify: remove unused `set_username` method
The method is a left-over from the old seasonal system. We no longer use it, the bot's username never changes, only the nickname. The amount of internal branching logic makes it difficult to maintain.
Diffstat (limited to 'bot/bot.py')
-rw-r--r--bot/bot.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/bot/bot.py b/bot/bot.py
index 3e20e3ab..b9ebb7f2 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -137,36 +137,6 @@ class SeasonalBot(commands.Bot):
return await resp.read()
@mock_in_debug(return_value=True)
- async def set_username(self, new_name: str, nick_only: bool = False) -> Optional[bool]:
- """
- Set the bot username and/or nickname to given new name.
-
- Returns True/False based on success, or None if nickname fallback also failed.
- """
- old_username = self.user.name
-
- if nick_only:
- return await self.set_nickname(new_name)
-
- if old_username == new_name:
- # since the username is correct, make sure nickname is removed
- return await self.set_nickname()
-
- log.debug(f"Changing username to {new_name}")
- with contextlib.suppress(discord.HTTPException):
- await bot.user.edit(username=new_name, nick=None)
-
- if not new_name == self.member.display_name:
- # name didn't change, try to changing nickname as fallback
- if await self.set_nickname(new_name):
- log.warning(f"Changing username failed, changed nickname instead.")
- return False
- log.warning(f"Changing username and nickname failed.")
- return None
-
- return True
-
- @mock_in_debug(return_value=True)
async def set_nickname(self, new_name: str = None) -> bool:
"""Set the bot nickname in the main guild."""
old_display_name = self.member.display_name