#TypeError send() got an unexpected keyword argument 'view'

1 messages · Page 1 of 1 (latest)

cerulean light
#

I'm rewriting the bot with discord.py on pycord started to redo the ticket system from scratch, but when trying to create a button to delete a ticket, the bot gives an error. I tried reinstalling pycord - it didn't help. Discord.py - deleted completely.

return await send(channel, *args, **kwargs)
TypeError: send() got an unexpected keyword argument 'view'
austere wharf
#

show the full code please

#

and your button with decorator is in your init

cerulean light
austere wharf
#

when does it thow the error? when you call /setup or when you click the buttons?

cerulean light
#

When I click on the button to create a ticket. A text channel is created, but a message from the bot is not sent causing an error

austere wharf
#

which version of pycord?

cerulean light
#

2.0.1

austere wharf
#

try commands.Bot() instead of discord

cerulean light
#

same error

austere wharf
#

whats the DiscordComponent() thing?

cerulean light
#

As I remember, I tried to use them earlier to create buttons on discord py at the moment it is used only in 1 line
DiscordComponents(bot)
Tried to remove it. The bot sent a message, but did not create a button to delete the ticket.

austere wharf
#

dont nest class in a function in a class

#

just do two classes beside and call the delete ticket class on button callback of the first

spring mirage
#

your close_ticket button is indented improperly

#

it's under __init__, it needs to be under the class

#

and remove DiscordComponents, you don't need it

austere wharf
spring mirage
#

if you're not going to help then don't say anything

austere wharf
#

please use this pseudocode to change your code @cerulean light

class create(view):
    def init():
        super()
    
    @button
    async def callback():
        view = close()
        await send(view=view)

class close(view):
    def init():
        super()
    
    @button
    async def callback():
        ...

@slashcommand()
async def create_ticket():
    view = create()
    await ctx.respond(view=view)

cerulean light
#

ty for help. I rewrote the code a bit and the button appeared