aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/bigbrother.py14
-rw-r--r--bot/cogs/defcon.py2
-rw-r--r--bot/cogs/doc.py2
-rw-r--r--bot/cogs/information.py2
-rw-r--r--bot/cogs/modlog.py5
-rw-r--r--bot/cogs/reminders.py6
-rw-r--r--bot/cogs/superstarify/__init__.py16
-rw-r--r--bot/cogs/tags.py7
-rw-r--r--bot/utils/moderation.py2
-rw-r--r--tests/cogs/sync/test_roles.py2
-rw-r--r--tests/cogs/sync/test_users.py1
-rw-r--r--tox.ini2
12 files changed, 23 insertions, 38 deletions
diff --git a/bot/cogs/bigbrother.py b/bot/cogs/bigbrother.py
index a6962efea..df7a0b576 100644
--- a/bot/cogs/bigbrother.py
+++ b/bot/cogs/bigbrother.py
@@ -4,10 +4,12 @@ import re
from collections import defaultdict, deque
from typing import List, Union
-from discord import Color, Embed, Guild, Member, Message, TextChannel, User
+from discord import Color, Embed, Guild, Member, Message, User
from discord.ext.commands import Bot, Context, group
-from bot.constants import BigBrother as BigBrotherConfig, Channels, Emojis, Guild as GuildConfig, Keys, Roles, URLs
+from bot.constants import (
+ BigBrother as BigBrotherConfig, Channels, Emojis, Guild as GuildConfig, Roles
+)
from bot.decorators import with_role
from bot.pagination import LinePaginator
from bot.utils import messages
@@ -73,12 +75,11 @@ class BigBrother:
)
self.watched_users.remove(user.id)
del self.channel_queues[user.id]
- await channel.send(
+ await self.channel.send(
f"{Emojis.bb_message}:hammer: {user} got banned, so "
f"`BigBrother` will no longer relay their messages."
)
-
async def on_message(self, msg: Message):
"""Queues up messages sent by watched users."""
@@ -100,7 +101,7 @@ class BigBrother:
log.trace("Begin consuming messages.")
channel_queues = self.channel_queues.copy()
self.channel_queues.clear()
- for user_id, queues in channel_queues.items():
+ for _, queues in channel_queues.items():
for queue in queues.values():
while queue:
msg = queue.popleft()
@@ -219,13 +220,12 @@ class BigBrother:
if user.id in self.watched_users:
return await ctx.send(":x: That user is already watched.")
- created_infraction = await post_infraction(
+ await post_infraction(
ctx, user, type='watch', reason=reason, hidden=True
)
self.watched_users.add(user.id)
await ctx.send(f":ok_hand: will now relay messages sent by {user}")
-
@bigbrother_group.command(name='unwatch', aliases=('uw',))
@with_role(Roles.owner, Roles.admin, Roles.moderator)
async def unwatch_command(self, ctx: Context, user: User):
diff --git a/bot/cogs/defcon.py b/bot/cogs/defcon.py
index 8fa80020a..29979de83 100644
--- a/bot/cogs/defcon.py
+++ b/bot/cogs/defcon.py
@@ -5,7 +5,7 @@ from discord import Colour, Embed, Member
from discord.ext.commands import Bot, Context, group
from bot.cogs.modlog import ModLog
-from bot.constants import Channels, Emojis, Icons, Keys, Roles, URLs
+from bot.constants import Channels, Emojis, Icons, Keys, Roles
from bot.decorators import with_role
log = logging.getLogger(__name__)
diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py
index 860ec7f62..d427acc3a 100644
--- a/bot/cogs/doc.py
+++ b/bot/cogs/doc.py
@@ -13,7 +13,7 @@ from markdownify import MarkdownConverter
from requests import ConnectionError
from sphinx.ext import intersphinx
-from bot.constants import Keys, Roles
+from bot.constants import Roles
from bot.converters import ValidPythonIdentifier, ValidURL
from bot.decorators import with_role
from bot.pagination import LinePaginator
diff --git a/bot/cogs/information.py b/bot/cogs/information.py
index 476820feb..92b2444a3 100644
--- a/bot/cogs/information.py
+++ b/bot/cogs/information.py
@@ -4,7 +4,7 @@ import textwrap
from discord import CategoryChannel, Colour, Embed, Member, TextChannel, VoiceChannel
from discord.ext.commands import Bot, Context, command
-from bot.constants import Emojis, Keys, Roles, URLs
+from bot.constants import Emojis, Keys, Roles
from bot.decorators import with_role
from bot.utils.time import time_since
diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py
index 911b5da03..66e80e778 100644
--- a/bot/cogs/modlog.py
+++ b/bot/cogs/modlog.py
@@ -3,7 +3,6 @@ import logging
from datetime import datetime
from typing import List, Optional, Union
-from aiohttp import ClientResponseError
from dateutil.relativedelta import relativedelta
from deepdiff import DeepDiff
from discord import (
@@ -16,9 +15,7 @@ from discord.abc import GuildChannel
from discord.ext.commands import Bot
from bot.constants import (
- Channels, Colours, Emojis,
- Event, Guild as GuildConstant, Icons,
- Keys, Roles, URLs
+ Channels, Colours, Emojis, Event, Guild as GuildConstant, Icons, URLs
)
from bot.utils.time import humanize_delta
diff --git a/bot/cogs/reminders.py b/bot/cogs/reminders.py
index b86fecd5c..fa1be307c 100644
--- a/bot/cogs/reminders.py
+++ b/bot/cogs/reminders.py
@@ -5,19 +5,17 @@ import textwrap
from datetime import datetime
from operator import itemgetter
-from aiohttp import ClientResponseError
from dateutil.relativedelta import relativedelta
from discord import Colour, Embed
from discord.ext.commands import Bot, Context, group
from bot.constants import (
- Channels, Icons, Keys, NEGATIVE_REPLIES,
- POSITIVE_REPLIES, Roles, URLs
+ Channels, Icons, NEGATIVE_REPLIES, POSITIVE_REPLIES, Roles
)
from bot.converters import ExpirationDate
from bot.pagination import LinePaginator
from bot.utils.scheduling import Scheduler
-from bot.utils.time import humanize_delta, parse_rfc1123, wait_until
+from bot.utils.time import humanize_delta, wait_until
log = logging.getLogger(__name__)
diff --git a/bot/cogs/superstarify/__init__.py b/bot/cogs/superstarify/__init__.py
index e14336b52..efa02cb43 100644
--- a/bot/cogs/superstarify/__init__.py
+++ b/bot/cogs/superstarify/__init__.py
@@ -8,14 +8,10 @@ from discord.ext.commands import Bot, Context, command
from bot.cogs.moderation import Moderation
from bot.cogs.modlog import ModLog
-from bot.constants import (
- Icons, Keys,
- NEGATIVE_REPLIES, POSITIVE_REPLIES,
- Roles, URLs
-)
+from bot.cogs.superstarify.stars import get_nick
+from bot.constants import Icons, POSITIVE_REPLIES, Roles
from bot.converters import ExpirationDate
from bot.decorators import with_role
-from bot.cogs.superstarify.stars import get_nick
from bot.utils.moderation import post_infraction
log = logging.getLogger(__name__)
@@ -117,8 +113,7 @@ class Superstarify:
forced_nick = get_nick(infraction['id'], member.id)
await member.edit(nick=forced_nick)
end_timestamp_human = (
- datetime.fromisoformat(response['expires_at'][:-1])
- .strftime('%c')
+ datetime.fromisoformat(infraction['expires_at'][:-1]).strftime('%c')
)
try:
@@ -157,8 +152,7 @@ class Superstarify:
@command(name='superstarify', aliases=('force_nick', 'star'))
@with_role(Roles.admin, Roles.owner, Roles.moderator)
async def superstarify(
- self, ctx: Context, member: Member,
- expiration: ExpirationDate, reason: str = None
+ self, ctx: Context, member: Member, expiration: ExpirationDate, reason: str = None
):
"""
This command will force a random superstar name (like Taylor Swift) to be the user's
@@ -180,7 +174,6 @@ class Superstarify:
f"See infraction **#{active_superstarifies[0]['id']}**."
)
-
infraction = await post_infraction(
ctx, member,
type='superstar', reason=reason or ('old nick: ' + member.display_name),
@@ -256,7 +249,6 @@ class Superstarify:
":x: There is no active superstarify infraction for this user."
)
-
[infraction] = active_superstarifies
await self.bot.api_client.patch(
'bot/infractions/' + str(infraction['id']),
diff --git a/bot/cogs/tags.py b/bot/cogs/tags.py
index 5a0198db8..bb4d6ba71 100644
--- a/bot/cogs/tags.py
+++ b/bot/cogs/tags.py
@@ -2,13 +2,10 @@ import logging
import time
from discord import Colour, Embed
-from discord.ext.commands import (
- BadArgument, Bot,
- Context, group
-)
+from discord.ext.commands import Bot, Context, group
from bot.constants import Channels, Cooldowns, Keys, Roles
-from bot.converters import TagContentConverter, TagNameConverter, ValidURL
+from bot.converters import TagContentConverter, TagNameConverter
from bot.decorators import with_role
from bot.pagination import LinePaginator
diff --git a/bot/utils/moderation.py b/bot/utils/moderation.py
index 2611ee993..fcdf3c4d5 100644
--- a/bot/utils/moderation.py
+++ b/bot/utils/moderation.py
@@ -6,7 +6,7 @@ from aiohttp import ClientError
from discord import Member, Object, User
from discord.ext.commands import Context
-from bot.constants import Keys, URLs
+from bot.constants import Keys
log = logging.getLogger(__name__)
diff --git a/tests/cogs/sync/test_roles.py b/tests/cogs/sync/test_roles.py
index 7def815cc..18682f39f 100644
--- a/tests/cogs/sync/test_roles.py
+++ b/tests/cogs/sync/test_roles.py
@@ -1,4 +1,4 @@
-from bot.cogs.sync.syncers import get_roles_for_sync, Role
+from bot.cogs.sync.syncers import Role, get_roles_for_sync
def test_get_roles_for_sync_empty_return_for_equal_roles():
diff --git a/tests/cogs/sync/test_users.py b/tests/cogs/sync/test_users.py
index ecf1d3926..a863ae35b 100644
--- a/tests/cogs/sync/test_users.py
+++ b/tests/cogs/sync/test_users.py
@@ -1,5 +1,6 @@
from bot.cogs.sync.syncers import User, get_users_for_sync
+
def fake_user(**kwargs):
kwargs.setdefault('id', 43)
kwargs.setdefault('name', 'bob the test man')
diff --git a/tox.ini b/tox.ini
index c6fa513f4..c84827570 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,5 +2,5 @@
max-line-length=120
application_import_names=bot
exclude=.cache,.venv
-ignore=B311,W503,E226,S311
+ignore=B311,W503,E226,S311,T000
import-order-style=pycharm