Hey so this code works completely fine but my problem is that it gets info of all the servers that the bot is in. This code is for logs so I want it to have different logs for each server. For example, I don’t want to show a server that I’m not in if I changed avatar or anything. Any
Tag: discord.py
In which way can I make an Auto-React feature for a discord bot that I’m writing in the discord.py API?
Basically, I’d like my discord bot to react with an emote to messages that have keywords in them. I tried tutorials, using if-statements, and both of those didn’t work. Answer This is a simple function, if you want it to use a random emoji from the server, you would have to get the emoji id, but you can do this.
on_guild_join data doesn’t save on my database
I test-ran my code using on_guild_join to fetch data from a server it joined and save it in a specific db file, but when I checked that, it was empty, no data was saved in it. I checked that on_guild_join part was working, and gave all intents. Here’s the code: class for command ‘execute’, ‘multiexec’: Answer In Sqlite3 you need
Discord.py read list
I have a file with a list called wbanned.txt which contains forbidden words. I want every message sent to be read and if it contains one of the forbidden words in the txt list (Every word is on a new line from list) to be deleted. I tried something but all it does is delete it only if it contains
Translation in discord.py bot doesn’t work
I’ve been trying to make my discord bot translate texts using a module called googletrans. It seems fairly simple and it should have worked without any hassle, or so I thought. So after my import statements, I have translator = Translator(). My following cog code is: But it shows this error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: ‘NoneType’ object has
how i can count members in python i need full code
i want to count members in discord but how using async await message.channel.send(f”””# of Members: {id.member_count}”””) i try i know this is copy code my code is Answer To get the amount of members from a guild can be retrieved with member_count, with this you also need to properly define guild or just simply using ctx.guild.member_count This is an example
Discord py cryptocurrency API command not working
I have a command that is supposed to get the price of a given cryptocurrency but it’s not working. Heres the code: When I run the command it triggers the Invalid cryptocurrency or API error. Answer Execute your code, line by line then you will see the error. usdprice = json_stats[“usd”] will always return an error. Do something like usdprice
Discord.py commands always says as existing command, even when it’s completely random
I’m trying to write a Discord bot in discord.py that just responds to commands, like when you type =!firewall it says Hello! Here’s my code: However, when I try to run the command with =!firewall in Discord, the console returns this: As it is pretty obvious, chickennuggets is not a default command, nor a command used by any other libraries
Am I using the on_guild_leave function correctly?
So I looked at many sources saying that on_guild_leave is how it is used, but I can’t get it to work. Here is my code: Can anyone seem to help? on_guild_join works, but on_guild_leave doesn’t. Answer on_guild_leave doesn’t exist, use on_guild_remove instead. Docs for on_guild_remove
I am struggling with dming members with a certain role in discord.py
Here’s the code and then DMing I have already tried same thing with IDs, but no progress It says the error Answer I believe your problem is you are using server, as it is not defined, it is giving you an error AttributeError: ‘Message’ object has no attribute ‘server’ and it states it is not an attribute of message. red_role