0
Attribute Error: 'Aru' object has no attribute 'message'
So I've been making my new discord bot... and everything works fine besides this command: https://code.sololearn.com/c1hUWCSc9U0D/#py Line 15 is this "bad" one... And I don't know how to resolve this...
4 odpowiedzi
0
I've tried both
await ctx.bot.delete_message(message)
and
await bot.delete_message(message)
but it gives the other error:
'str' object has no attribute 'channel'
What I guess is that I might have not imported something important to _init_ ... but I have no clue what I've forgot about and how should I do it... it's my first time working on classes like this...
(well, this command worked when I had a bit more simple bot without Music class... but now as I had to put this command to class... (because without it bot doesn't even recognize it as a command))
0
So... I forgot to add to the call "self". And yea, I should put "message" in front of "*args". I also had to delete 13 line >.< though... now it "eats" the first argument... and I don't know how to deal with it...
- 2
in init you store bot into self.bot but at line 15 no "bot" exists, you shoud try ctx.bot, also there is no ctx.message, there is just message (await ctx.bot.delete_message(message) )
line 16 may have same problem
- 2
Oh, I noticed it now, when checking the code again.
Problem: you might have swapped arguments in function call. Shoudn't it be (ctx, message, *args) ?
Why I think so: the error says that class string have no attribute channel, so it expects other class, also you act with args like it is an array of strings, so it would mach that way.