I have a problem: I can’t send message in a @tasks.loop() function. When I try to get the channel object with self.client.get_channel(channlid), it return me a Nonetype variable. My code : my error: Can you help me ? Answer Problem You’re calling client.get_channel before the client is ready. So, …
Tag: discord.py
mention user from string(name#discriminator) discord.py
I have an user in str format, for example: I want to convert it into a member to be able to do: I tried: and: both make member NoneType, the name and discriminator are fine. Answer If you have both the username and discriminator, the best way to get that member would be like this: ALSO: Make sure you have
discord.py – Get channel permissions of user
I am trying to create a command that lists the permissions that the user has in the current channel. I have tried using a function that adds permissions to a list and calling it in the command. Unfortunately, this command sends all of the permissions that a member could possibly have, rather than the permissi…
How to display the title of the song in the embed?
Here’s my code (The bot answers are in Spanish) I was trying to put the self.info[‘title’] in the embed description but it was an error that said ‘music_cog’ object has no attribute ‘info’: Answer Write song = self.search_yt(query) before the embed initialization and …
result1 sends what’s in it weird (picture below)
Everything works fine, but now when the amount is sent it looks like this: when I try the {result1[1]}(where the money is at) the command doesn’t even work. What am I missing? Answer The tuple is of length 1, so you should be using {result1[0]} rather than {result1[1]}.
discord.py: too big variable?
I’m very new to python and programming in general, and I’m looking to make a discord bot that has a lot of hand-written chat lines to randomly pick from and send back to the user. Making a really huge variable full of a list of sentences seems like a bad idea. Is there a way that I can store the
In Discord.py, is it possible to wait for a variable to change from a different part of the code than the variable changes?
I tried using time.sleep(), but instead of waiting for the variable it paused the whole code, not allowing the variable to change. This is my code: I can’t figure out what to replace time.sleep(1.0) with. Answer You can use await asyncio.sleep(1) instead. Asyncio.sleep works like time.sleep, but it does…
How can I send a message to a user out of a JSON file?
Probably a very easy question to answer, but I want to send a message to a user after a certain time. For this I read his ID from a JSON. Problem with this? You cannot append a send to a str or this error is then spit out. I have already tried to convert the whole thing, but without success.
FIXED – on_message raising SyntaxError when called
This code normally works for me when I use it, but it stopped working. First with other async definitions, but now on_message isn’t working! WizBot is the name of my bot.Also if it is helpful, I am using repl.it. on_ready() works though, but I get a pyflakes SyntaxError for the d in the def on_message(m…
discord.py avatar command bringing up error
I am running an avatar command which worked before, but every time I try to run it now it gives me the error : I feel I am doing something dumb, but what is going wrong? Here is the code: Thanks in advance for the help. Answer If you’ve updated your discord.py then avatar_url got replaced with avatar.ur…