new commands.Context

pull/6/head
bobloy 7 years ago
parent c36f90698e
commit 3f331e2016

@ -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

@ -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

@ -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`

@ -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

@ -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")

@ -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")

@ -1,6 +1,6 @@
import discord
from discord.ext import commands
from .utils.chat_formatting import pagify
from .utils.chat_formatting import box

@ -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

@ -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

@ -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:

@ -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

@ -1,7 +1,7 @@
import asyncio
import discord
from discord.ext import commands
from redbot.core import Config

@ -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.
"""

@ -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

@ -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

@ -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

Loading…
Cancel
Save