I made my own counting bot on discord to practice coding. The bot will work fine if messages are sent within about an hour of the last message. After a hour sometimes my bot will work, sometimes won’t and the data on my sqlite table will be reverted to previous data. This causes the bot to think that the number
Tag: discord.py
How do I give user roles in discord when the user types a command?
I am having trouble assigning a role to a user when they type in a command Code: When the user types “!BMOrole”, I want to give them a role called, “BMO” and also display a message. The error I’m receiving is: Answer you forget set a default user:
Command raised an exception: AttributeError: ‘Context’ object has no attribute ‘id’ discord.py
I want to delete the Guild ID in a JSON file with an Command. This is my code: This is the Error Message: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: ‘Context’ object has no attribute ‘id’ How can i fix this? Answer The first parameter in each command is ctx or context the represents discord.ext.commands.Context object, which as you can see,
changing the embed’s footer
i have this code that would change an embed’s footer and resend it to the log channel, but now it doesn’t work anymore for somereason this is the code: and this is the error i get: Answer The argument for set_footer is keyword-only:
(discord.py) change discord avatar with someone’s avatar url
I’m trying to change my bot’s avatar with the avatar url of someone in my server. The code isn’t working. Any help? Answer The other answer says you have to have a bytes-like object, which is true. Adding onto it though: you can retrieve the image as a bytes-like object with requests like: img = requests.get(url).content which you can then
How to give one role to multiple discord user using the user id
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
Discord wait_for() how to add multiple responses from the author?
Currently my discord bot responds to one message. !add 12345 bot responds “Do you wish to add this item? y/n user writes y or n (currently only works with 1 response if user writes y (bot responds “it was added”), if user writes n (bot responds “it was not added”) How would I go about adding the “n” response? Here
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 this command work with all users
guys my command only working for my bot, can someone help me? to explain better: *fake @mybot blabla (works) *fake @SrWonka blabla (dotn work) Code: Soucebin:https://sourceb.in/rkhH6YdTCx Answer Changed made: The way you were getting your user is not the optimal way I used Typing.union you can see the docs below. display_name it will show the nickname if there if not
discord.py the bot doesn’t give the role provided upon member join
I tried to set up this bot event where it would give a role to the member that joins. For some reason, it doesn’t give the role, but it doesn’t give any error output either. Answer There are a few issues with your code in line 2, the function is not async, discord.py events need to be async so replace