diff --git a/ccrole/ccrole.py b/ccrole/ccrole.py index 2459b6e..d8c17f6 100644 --- a/ccrole/ccrole.py +++ b/ccrole/ccrole.py @@ -2,8 +2,9 @@ import asyncio import re import discord -from discord.ext import commands + from redbot.core import Config, checks +from redbot.core import commands from redbot.core.utils.chat_formatting import pagify, box diff --git a/chatter/chat.py b/chatter/chat.py index 32d83a3..dce136f 100644 --- a/chatter/chat.py +++ b/chatter/chat.py @@ -2,8 +2,9 @@ import asyncio from datetime import datetime, timedelta import discord -from discord.ext import commands + from redbot.core import Config +from redbot.core import commands from chatter.chatterbot import ChatBot from chatter.chatterbot.trainers import ListTrainer @@ -75,7 +76,7 @@ class Chatter: return True @commands.group() - async def chatter(self, ctx: RedContext): + async def chatter(self, ctx: commands.Context): """ Base command for this cog. Check help for the commands list. """ @@ -83,7 +84,7 @@ class Chatter: await ctx.send_help() @chatter.command() - async def age(self, ctx: RedContext, days: int): + async def age(self, ctx: commands.Context, days: int): """ Sets the number of days to look back Will train on 1 day otherwise diff --git a/coglint/coglint.py b/coglint/coglint.py index cf93402..10861c7 100644 --- a/coglint/coglint.py +++ b/coglint/coglint.py @@ -1,10 +1,11 @@ import discord -from discord.ext import commands -from redbot.core import Config, checks, RedContext + +from redbot.core import Config, checks from redbot.core.bot import Red from pylint import epylint as lint +from redbot.core import commands from redbot.core.data_manager import cog_data_path @@ -32,7 +33,7 @@ class CogLint: self.config.register_guild(**default_guild) @commands.command() - async def autolint(self, ctx: RedContext): + async def autolint(self, ctx: commands.Context): """Toggles automatically linting code""" curr = await self.config.lint() @@ -41,7 +42,7 @@ class CogLint: await ctx.send("Autolinting is now set to {}".format(not curr)) @commands.command() - async def lint(self, ctx: RedContext, *, code): + async def lint(self, ctx: commands.Context, *, code): """Lint python code Toggle autolinting with `[p]autolint` diff --git a/fight/fight.py b/fight/fight.py index 931c7c9..b050de8 100644 --- a/fight/fight.py +++ b/fight/fight.py @@ -4,7 +4,7 @@ import math # from typing import Union import discord -from discord.ext import commands + from redbot.core.utils.chat_formatting import pagify from redbot.core.utils.chat_formatting import box diff --git a/hangman/__init__.py b/hangman/__init__.py index 2168fdf..88598f8 100644 --- a/hangman/__init__.py +++ b/hangman/__init__.py @@ -6,4 +6,4 @@ def setup(bot): n = Hangman(bot) data_manager.load_bundled_data(n, __file__) bot.add_cog(n) - bot.add_listener(n._on_react, "on_reaction_add") + bot.add_listener(n.on_react, "on_reaction_add") diff --git a/hangman/hangman.py b/hangman/hangman.py index 766177f..4958eac 100644 --- a/hangman/hangman.py +++ b/hangman/hangman.py @@ -2,8 +2,9 @@ from collections import defaultdict from random import randint import discord -from discord.ext import commands + from redbot.core import Config, checks +from redbot.core import commands from redbot.core.data_manager import cog_data_path, load_basic_configuration @@ -245,7 +246,7 @@ class Hangman: await self._reprintgame(message) - async def _on_react(self, reaction, user): + async def on_react(self, reaction, user): """ Thanks to flapjack reactpoll for guidelines https://github.com/flapjax/FlapJack-Cogs/blob/master/reactpoll/reactpoll.py""" @@ -331,8 +332,3 @@ class Hangman: await self._reactmessage_menu(message) await self._checkdone(channel) - -def setup(bot): - n = Hangman(bot) - bot.add_cog(n) - bot.add_listener(n._on_react, "on_reaction_add") diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py index eee3f35..019c014 100644 --- a/howdoi/howdoi.py +++ b/howdoi/howdoi.py @@ -1,6 +1,6 @@ import discord -from discord.ext import commands + from .utils.chat_formatting import pagify from .utils.chat_formatting import box diff --git a/leaver/leaver.py b/leaver/leaver.py index a4a2b23..2aff2ac 100644 --- a/leaver/leaver.py +++ b/leaver/leaver.py @@ -1,7 +1,7 @@ import discord import os from datetime import datetime -from discord.ext import commands + from .utils.dataIO import dataIO from .utils import checks diff --git a/lseen/lseen.py b/lseen/lseen.py index c4c0c42..43c56ea 100644 --- a/lseen/lseen.py +++ b/lseen/lseen.py @@ -2,9 +2,10 @@ from datetime import datetime import dateutil.parser import discord -from discord.ext import commands -from redbot.core import Config, RedContext + +from redbot.core import Config from redbot.core.bot import Red +from redbot.core import commands class LastSeen: @@ -37,13 +38,13 @@ class LastSeen: return d @commands.group(aliases=['setlseen'], name='lseenset') - async def lset(self, ctx: RedContext): + async def lset(self, ctx: commands.Context): """Change settings for lseen""" if ctx.invoked_subcommand is None: await ctx.send_help() @lset.command(name="toggle") - async def lset_toggle(self, ctx: RedContext): + async def lset_toggle(self, ctx: commands.Context): """Toggles tracking seen for this server""" enabled = not await self.config.guild(ctx.guild).enabled() await self.config.guild(ctx.guild).enabled.set( @@ -54,7 +55,7 @@ class LastSeen: "Enabled" if enabled else "Disabled")) @commands.command(aliases=['lastseen']) - async def lseen(self, ctx: RedContext, member: discord.Member): + async def lseen(self, ctx: commands.Context, member: discord.Member): """ Just says the time the user was last seen diff --git a/reactrestrict/reactrestrict.py b/reactrestrict/reactrestrict.py index 0141ab3..87b50a3 100644 --- a/reactrestrict/reactrestrict.py +++ b/reactrestrict/reactrestrict.py @@ -2,10 +2,11 @@ import asyncio from typing import List, Union import discord -from discord.ext import commands + from redbot.core import Config from redbot.core.bot import Red +from redbot.core import commands class ReactRestrictCombo: @@ -79,10 +80,6 @@ class ReactRestrict: async def add_reactrestrict(self, message_id: int, role: discord.Role): """ Adds a react|role combo. - - :param int message_id: - :param str or int emoji: - :param discord.Role role: """ # is_custom = True # if isinstance(emoji, str): @@ -177,10 +174,6 @@ class ReactRestrict: -> Union[discord.Message, None]: """ Tries to find a message by ID in the current guild context. - - :param ctx: - :param message_id: - :return: """ channel = self.bot.get_channel(channel_id) try: diff --git a/sayurl/sayurl.py b/sayurl/sayurl.py index ce81409..c536b41 100644 --- a/sayurl/sayurl.py +++ b/sayurl/sayurl.py @@ -1,7 +1,7 @@ import aiohttp import html2text -from discord.ext import commands -from redbot.core import Config, RedContext + +from redbot.core import Config from redbot.core.bot import Red from redbot.core.utils.chat_formatting import pagify @@ -28,7 +28,7 @@ class SayUrl: self.config.register_guild(**default_guild) @commands.command() - async def sayurl(self, ctx: RedContext, url): + async def sayurl(self, ctx: commands.Context, url): """ Converts a URL to something readable diff --git a/secrethitler/secrethitler.py b/secrethitler/secrethitler.py index 9e98c09..edee4d0 100644 --- a/secrethitler/secrethitler.py +++ b/secrethitler/secrethitler.py @@ -1,7 +1,7 @@ import asyncio import discord -from discord.ext import commands + from redbot.core import Config diff --git a/stealemoji/stealemoji.py b/stealemoji/stealemoji.py index 8c96fbe..a55d2c9 100644 --- a/stealemoji/stealemoji.py +++ b/stealemoji/stealemoji.py @@ -1,9 +1,8 @@ import aiohttp import discord -from discord.ext import commands -from redbot.core import Config, RedContext +from redbot.core import Config, commands from redbot.core.bot import Red @@ -41,7 +40,7 @@ class StealEmoji: self.config.register_global(**default_global) @commands.group() - async def stealemoji(self, ctx: RedContext): + async def stealemoji(self, ctx: commands.Context): """ Base command for this cog. Check help for the commands list. """ diff --git a/werewolf/builder.py b/werewolf/builder.py index c673e3f..28b22ea 100644 --- a/werewolf/builder.py +++ b/werewolf/builder.py @@ -3,9 +3,11 @@ from collections import defaultdict from random import choice import discord -from discord.ext import commands + # Import all roles here +from redbot.core import commands + from werewolf.roles.seer import Seer from werewolf.roles.vanillawerewolf import VanillaWerewolf from werewolf.roles.villager import Villager diff --git a/werewolf/game.py b/werewolf/game.py index 438659f..9c0a8b4 100644 --- a/werewolf/game.py +++ b/werewolf/game.py @@ -2,7 +2,7 @@ import asyncio import random import discord -from discord.ext import commands +from redbot.core import commands from werewolf.builder import parse_code from werewolf.player import Player diff --git a/werewolf/werewolf.py b/werewolf/werewolf.py index 65e73c1..e312312 100644 --- a/werewolf/werewolf.py +++ b/werewolf/werewolf.py @@ -1,8 +1,9 @@ import discord -from discord.ext import commands + from redbot.core import Config, checks from redbot.core.bot import Red +from redbot.core import commands from werewolf.builder import GameBuilder, role_from_name, role_from_alignment, role_from_category, role_from_id from werewolf.game import Game