Giter VIP home page Giter VIP logo

slash_util's Issues

slash_util.Bot.get_context() raising `TypeError` on custom class

Hi! I'm trying to migrate from discord.py 2.0 to slash_util, but in my class which I use to add an attribute to my context (and it works on 2.0) is raising a TypeError: __init__() got an unexpected keyword argument 'prefix'
This is my current code. The only things I've changed were commands.Bot to slash_util.Bot and commands.Context to slash_util.Context.

class Noether(slash_util.Bot):
    async def get_context(self, message, *, cls=slash_util.Context):
        ctx = await super().get_context(message, cls=cls) 
        # ... more code

And this is the full traceback:

Ignoring exception in on_message
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "bot.py", line 404, in on_message
    await bot.process_commands(message)
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", line 1030, in process_commands
    ctx = await self.get_context(message)
  File "bot.py", line 54, in get_context
    ctx = await super().get_context(message, cls=cls)
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", line 935, in get_context
    ctx = cls(prefix=None, view=view, bot=self, message=message)
TypeError: __init__() got an unexpected keyword argument 'prefix'

I also tried and saw that changing slash_util.Context back to commands.Context makes it work, but that would be pointless since I could not use most of the features of the library.

Bot events don't work anymore

bot events don't work anymore:
@bot.event def on_ready(): # something
returns error: TypeError: event() missing 1 required positional argument: 'coro'
And bot is my slash_util init cog

Support new Attachment parameter

Will be accomplished as the following:

@slash_util.slash_command()
async def slash(self, ctx, file: discord.Attachment):
    # basically equivalent to checking the message attachments i guess?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.