I want to give one role named helper to multiple users whose user id’s are in a list called user_id Here is my code: This is the error I got: Answer I started by renaming some of the variables for clarity. I then got the member object using the user_ids and then added the role. Finally, I moved the await
Tag: discord
What is the difference between having a main bot class versus no class on discord py?
With discord python bots, I can’t seem to find a great answer on this and the documentation actually uses both examples randomly. What is the main difference between using a bot class in your bot.py versus starting your bot without a class? See below for an example Example bot with a class: Example of a regular bot without the class:
discord.py Set a command to only work if the user doesn’t have a certain role
I’m trying to set up a verification command that gives a role upon its use, but I want to set it so the user can only use the command if they don’t already have the role. This is my code: Answer One thing you could do is to retrieve rolegiven at the very beginning of your code. You can then
How to make a sub command without trigger discord.ext.commands.errors.MissingRequiredArgument?
(This is my first post by the way <3) I am making a discord.py bot and I want a command that will either list warnings (warnings list ) for a user, clear warnings for a user (warnings clear ) or give a help message for the command (anything that does not fit the other two commands)! Here is the code:
my leveling bot(discord) seems to gives a error Command raised an exception: AttributeError: ‘tuple’ object has no attribute ‘find_one’
My code: Connection to the db code: Error: Command raised an exception: AttributeError: ‘tuple’ object has no attribute ‘find_one’ Answer You should change the connection to the db code to:
When logging deleted messages, how can I log the deleted image attachments reliably?
So my current event listener will log deleted messages just fine, the problem I’m having right now is that if the message that was deleted has an image attachment to it, most of the time it won’t display properly because the image url cannot be accessed anymore. You will just see the discord loading image forever. I want to ask
Discord.py with threads, RuntimeError: Timeout context manager should be used inside a task
So I’m creating a discord bot that is constantly scraping a webpage, checking if the item is in stock. When the item becomes in stock, send a message in the chat. Since the scraping is in a constant loop, I figured I would put that in a thread, one for each page that needs to be scraped. The problem is
Discord.py – which way should I pick? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 1 year ago. Improve this question Recently I’ve known that developers are able to code Discord.py bot in 2 ways (or even more): To code every command
How do I listen for new chat messages in text channels using a discord bot in python?
I’ve designed a system to loop through all the channels and check to see if the last few messages are the same as they were at the previous check, but that’s slow and unnecessary. If there’s any way to do it through a function, or a simpler, faster way, let me know. Thanks! Answer You can use the event on_message,