diff options
author | 2019-08-16 10:41:10 +0200 | |
---|---|---|
committer | 2019-08-16 10:41:10 +0200 | |
commit | bafbcc9c07e2e63702ff0c2a725913ce0f7ab6d5 (patch) | |
tree | d8ad07697a433260d421384057545ea7bfa94b45 | |
parent | Adding missing function annotations (diff) |
Kaizen: Change all string concats to f-strings
-rw-r--r-- | bot/cogs/sync/cog.py | 8 | ||||
-rw-r--r-- | bot/cogs/sync/syncers.py | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/bot/cogs/sync/cog.py b/bot/cogs/sync/cog.py index 999cb1e09..a17d712d5 100644 --- a/bot/cogs/sync/cog.py +++ b/bot/cogs/sync/cog.py @@ -63,7 +63,7 @@ class Sync: async def on_guild_role_delete(self, role: Role) -> None: """Deletes role from the database when it's deleted from the guild.""" - await self.bot.api_client.delete('bot/roles/' + str(role.id)) + await self.bot.api_client.delete(f'bot/roles/{role.id}') async def on_guild_role_update(self, before: Role, after: Role) -> None: """Syncs role with the database if any of the stored attributes were updated.""" @@ -74,7 +74,7 @@ class Sync: or before.position != after.position ): await self.bot.api_client.put( - 'bot/roles/' + str(after.id), + f'bot/roles/{after.id}', json={ 'colour': after.colour.value, 'id': after.id, @@ -106,7 +106,7 @@ class Sync: try: # First try an update of the user to set the `in_guild` field and other # fields that may have changed since the last time we've seen them. - await self.bot.api_client.put('bot/users/' + str(member.id), json=packed) + await self.bot.api_client.put(f'bot/users/{member.id}', json=packed) except ResponseCodeError as e: # If we didn't get 404, something else broke - propagate it up. @@ -122,7 +122,7 @@ class Sync: async def on_member_leave(self, member: Member) -> None: """Updates the user information when a member leaves the guild.""" await self.bot.api_client.put( - 'bot/users/' + str(member.id), + f'bot/users/{member.id}', json={ 'avatar_hash': member.avatar, 'discriminator': int(member.discriminator), diff --git a/bot/cogs/sync/syncers.py b/bot/cogs/sync/syncers.py index 23dd09d43..9f6dc997d 100644 --- a/bot/cogs/sync/syncers.py +++ b/bot/cogs/sync/syncers.py @@ -94,7 +94,7 @@ async def sync_roles(bot: Bot, guild: Guild) -> Tuple[Set[Role], Set[Role], Set[ for role in roles_to_update: await bot.api_client.put( - 'bot/roles/' + str(role.id), + f'bot/roles/{role.id}', json={ 'id': role.id, 'name': role.name, @@ -105,7 +105,7 @@ async def sync_roles(bot: Bot, guild: Guild) -> Tuple[Set[Role], Set[Role], Set[ ) for role in roles_to_delete: - await bot.api_client.delete('bot/roles/' + str(role.id)) + await bot.api_client.delete(f'bot/roles/{role.id}') return len(roles_to_create), len(roles_to_update), len(roles_to_delete) @@ -221,7 +221,7 @@ async def sync_users(bot: Bot, guild: Guild) -> Tuple[Set[Role], Set[Role], None for user in users_to_update: await bot.api_client.put( - 'bot/users/' + str(user.id), + f'bot/users/{user.id}', json={ 'avatar_hash': user.avatar_hash, 'discriminator': user.discriminator, |