diff options
-rw-r--r-- | bot/cogs/cogs.py | 5 | ||||
-rw-r--r-- | bot/cogs/eval.py | 2 | ||||
-rw-r--r-- | bot/cogs/reddit.py | 5 | ||||
-rw-r--r-- | bot/cogs/reminders.py | 7 | ||||
-rw-r--r-- | bot/cogs/snekbox.py | 3 | ||||
-rw-r--r-- | bot/cogs/superstarify/__init__.py | 7 | ||||
-rw-r--r-- | bot/cogs/utils.py | 7 | ||||
-rw-r--r-- | bot/cogs/verification.py | 5 |
8 files changed, 24 insertions, 17 deletions
diff --git a/bot/cogs/cogs.py b/bot/cogs/cogs.py index fcb987a07..0caf503a8 100644 --- a/bot/cogs/cogs.py +++ b/bot/cogs/cogs.py @@ -1,7 +1,8 @@ import logging import os +from typing import Optional -from discord import Colour, Embed +from discord import Colour, Embed, Message from discord.ext.commands import Bot, Cog, Context, group from bot.constants import ( @@ -145,7 +146,7 @@ class Cogs(Cog): @cogs_group.command(name='reload', aliases=('r',)) @with_role(*MODERATION_ROLES, Roles.core_developer) - async def reload_command(self, ctx: Context, cog: str) -> None: + async def reload_command(self, ctx: Context, cog: str) -> Optional[Message]: """ Reload an unloaded cog, given the module containing it. diff --git a/bot/cogs/eval.py b/bot/cogs/eval.py index 2ae543d83..45638d295 100644 --- a/bot/cogs/eval.py +++ b/bot/cogs/eval.py @@ -123,7 +123,7 @@ class CodeEval(Cog): return res # Return (text, embed) - async def _eval(self, ctx: discord.Context, code: str) -> None: + async def _eval(self, ctx: discord.Context, code: str) -> Optional[discord.Message]: """Eval the input code string & send an embed to the invoking context.""" self.ln += 1 diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index fa66660e2..2bc6fa58e 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -3,8 +3,9 @@ import logging import random import textwrap from datetime import datetime, timedelta +from typing import Optional -from discord import Colour, Embed, TextChannel +from discord import Colour, Embed, Message, TextChannel from discord.ext.commands import Bot, Cog, Context, group from bot.constants import Channels, ERROR_REPLIES, Reddit as RedditConfig, STAFF_ROLES @@ -54,7 +55,7 @@ class Reddit(Cog): async def send_top_posts( self, channel: TextChannel, subreddit: Subreddit, content: str = None, time: str = "all" - ) -> None: + ) -> Optional[Message]: """Create an embed for the top posts, then send it in a given TextChannel.""" # Create the new spicy embed. embed = Embed() diff --git a/bot/cogs/reminders.py b/bot/cogs/reminders.py index ff0a6eb1a..a96684db3 100644 --- a/bot/cogs/reminders.py +++ b/bot/cogs/reminders.py @@ -4,9 +4,10 @@ import random import textwrap from datetime import datetime from operator import itemgetter +from typing import Optional from dateutil.relativedelta import relativedelta -from discord import Colour, Embed +from discord import Colour, Embed, Message from discord.ext.commands import Bot, Cog, Context, group from bot.constants import Channels, Icons, NEGATIVE_REPLIES, POSITIVE_REPLIES, STAFF_ROLES @@ -122,7 +123,7 @@ class Reminders(Scheduler, Cog): await ctx.invoke(self.new_reminder, expiration=expiration, content=content) @remind_group.command(name="new", aliases=("add", "create")) - async def new_reminder(self, ctx: Context, expiration: ExpirationDate, *, content: str) -> None: + async def new_reminder(self, ctx: Context, expiration: ExpirationDate, *, content: str) -> Optional[Message]: """ Set yourself a simple reminder. @@ -178,7 +179,7 @@ class Reminders(Scheduler, Cog): self.schedule_task(loop, reminder["id"], reminder) @remind_group.command(name="list") - async def list_reminders(self, ctx: Context) -> None: + async def list_reminders(self, ctx: Context) -> Optional[Message]: """View a paginated embed of all reminders for your user.""" # Get all the user's reminders from the database. data = await self.bot.api_client.get( diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py index 927afe51b..3e6f9299a 100644 --- a/bot/cogs/snekbox.py +++ b/bot/cogs/snekbox.py @@ -5,6 +5,7 @@ import textwrap from signal import Signals from typing import Optional, Tuple +from discord import Message from discord.ext.commands import Bot, Cog, Context, command, guild_only from bot.constants import Channels, STAFF_ROLES, URLs @@ -167,7 +168,7 @@ class Snekbox(Cog): @command(name="eval", aliases=("e",)) @guild_only() @in_channel(Channels.bot, bypass_roles=STAFF_ROLES) - async def eval_command(self, ctx: Context, *, code: str = None) -> None: + async def eval_command(self, ctx: Context, *, code: str = None) -> Optional[Message]: """ Run Python code and get the results. diff --git a/bot/cogs/superstarify/__init__.py b/bot/cogs/superstarify/__init__.py index 7a29acdb8..6278beaa3 100644 --- a/bot/cogs/superstarify/__init__.py +++ b/bot/cogs/superstarify/__init__.py @@ -1,8 +1,9 @@ import logging import random from datetime import datetime +from typing import Optional -from discord import Colour, Embed, Member +from discord import Colour, Embed, Member, Message from discord.errors import Forbidden from discord.ext.commands import Bot, Cog, Context, command @@ -154,7 +155,7 @@ class Superstarify(Cog): @with_role(*MODERATION_ROLES) async def superstarify( self, ctx: Context, member: Member, expiration: ExpirationDate, reason: str = None - ) -> None: + ) -> Optional[Message]: """ Force a random superstar name (like Taylor Swift) to be the user's nickname for a specified duration. @@ -224,7 +225,7 @@ class Superstarify(Cog): @command(name='unsuperstarify', aliases=('release_nick', 'unstar')) @with_role(*MODERATION_ROLES) - async def unsuperstarify(self, ctx: Context, member: Member) -> None: + async def unsuperstarify(self, ctx: Context, member: Member) -> Optional[Message]: """This command will the superstarify entry from our database, allowing the user to change their nickname.""" log.debug(f"Attempting to unsuperstarify the following user: {member.display_name}") diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index 1539851ea..e27559efe 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -3,8 +3,9 @@ import re import unicodedata from email.parser import HeaderParser from io import StringIO +from typing import Optional -from discord import Colour, Embed +from discord import Colour, Embed, Message from discord.ext.commands import Bot, Cog, Context, command from bot.constants import Channels, STAFF_ROLES @@ -23,7 +24,7 @@ class Utils(Cog): self.base_github_pep_url = "https://raw.githubusercontent.com/python/peps/master/pep-" @command(name='pep', aliases=('get_pep', 'p')) - async def pep_command(self, ctx: Context, pep_number: str) -> None: + async def pep_command(self, ctx: Context, pep_number: str) -> Optional[Message]: """Fetches information about a PEP and sends it to the channel.""" if pep_number.isdigit(): pep_number = int(pep_number) @@ -84,7 +85,7 @@ class Utils(Cog): @command() @in_channel(Channels.bot, bypass_roles=STAFF_ROLES) - async def charinfo(self, ctx: Context, *, characters: str) -> None: + async def charinfo(self, ctx: Context, *, characters: str) -> Optional[Message]: """Shows you information on up to 25 unicode characters.""" match = re.match(r"<(a?):(\w+):(\d+)>", characters) if match: diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py index 6446dc80b..a437992ee 100644 --- a/bot/cogs/verification.py +++ b/bot/cogs/verification.py @@ -1,4 +1,5 @@ import logging +from typing import Optional from discord import Message, NotFound, Object from discord.ext.commands import Bot, Cog, Context, command @@ -95,7 +96,7 @@ class Verification(Cog): @command(name='subscribe') @in_channel(Channels.bot) - async def subscribe_command(self, ctx: Context, *_) -> None: # We don't actually care about the args + async def subscribe_command(self, ctx: Context, *_) -> Optional[Message]: # We don't actually care about the args """Subscribe to announcement notifications by assigning yourself the role.""" has_role = False @@ -120,7 +121,7 @@ class Verification(Cog): @command(name='unsubscribe') @in_channel(Channels.bot) - async def unsubscribe_command(self, ctx: Context, *_) -> None: # We don't actually care about the args + async def unsubscribe_command(self, ctx: Context, *_) -> Optional[Message]: # We don't actually care about the args """Unsubscribe from announcement notifications by removing the role from yourself.""" has_role = False |