Make Python Discord Bot send a message if on cooldown

I'm trying to set a command to a python discord bot that has a 3 second cooldown and will send a message if the command is used before the cooldown. How would I do this? This is the code for the...

How to send a message on the bot startup to every server it is in?

So i want to send a announcement to all the servers my bot is in. I found this on github, but it requires a server id and a channel id. @bot.event async def on_ready(): server =...

on_ready not called when running Discord Bot (Python)

I've been writing my first Discord bot in Python, and it's been working just fine. I decided to refactor my code into two modules instead of just one. It looks like this: Proj - src --...

(discord.py) Detecting certain keywords in messages

I was planning to make a grammar bot for fun, and I want it to find certain keywords inside a message, rather than just asking if it is ONLY that keyword. I haven't found anything close to what I...

Run Discord bot inside Django

I would like to have a discord bot that accesses a Django DB. An obvious solution is to have 2 separate scripts. I would like to know if there is a way to make the discord-bot part of the Django...

Remove 'command not found' error discord.py

In a discord.py rewrite bot, if someone types the bots prefix and then any text after it, if the text is not found as a command you will get Ignoring exception in command...

Discord.py (async) How to edit channel names?

I want it so when someone joins my server, my bot edits the name of the channel id given in the code, to the new member count. But it doesn't work. Could someone help me? Code @bot.event async def...

How do I call a discord.py function multiple times for each item in a list?

Im using discord API in python to manage a Discord bot. This command creates a list of people in a certain discord channel. I have a function: async def attendance(ctx, channel): # code here...

discord.py handling multiple exceptions

In my try block I have added 2 exceptions. One if the bot does not have permission and another exception for everything else. However, the code below does not show the exception for permission...

AttributeError: 'Client' object has no attribute 'command'

I have added this code: @client.command(pass_context=True) async def name(ctx): username = ctx.message.author.display_name On to the end of my line of code, and I get this error when trying to...

Python Discord Display link

I have a problem on my embedded discord, I would like to display the link in a tweet. It's a monitor which monitors some Twitter account to send a notification on discord when the user posts...

Why can I not import load_dotenv?

I'm trying to code a simple discord bot in python, but it says i cant import load_dotenv, instead giving me this error: Traceback (most recent call last): File "/home/pi/Rotomi/Rotomi.py", line...

Discord.py on_message() but only for private messages

So, I'm working on a discord bot. And am using the on_message() event, which works both on private messages and on servers. I want this to only work in private messages and am unsure on how to go...

discord.py: How to get the first letter of a user's name?

I want to make a "ticket-system" and want the channel it creates to have the name of the first letter of the user. So, I already have this: @client.event async def...

SyntaxError: Non-UTF-8 code starting with '\xe2' in file {the location of the thing} line 138, but no encoding declared; see http://python.org/

I have a list named quotes, with a lot of JoJo quotes, and I get that error there when I try to execute. The same error happens when I change all the ' to ". quotes = ['Perhaps… Perhaps the...

Discord.py - Reply to DM with a specific message

trying to make my bot reply to DMs with "this is a dm" but no luck, here's my code: @client.event async def on_message(message): if message.guild == null: await...

RuntimeError: PyNaCl library needed in order to use voice

Traceback (most recent call last): File "C:\Users\Pradeep Tejwani\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 892, in invoke await...

Discord.py ban all members

I am trying to make code that bans all members in a server. This is for educational reasons, do not plan on doing it in a real server. My current code is: @client.command() async def d(ctx): ...

I have a problem with my code for a discord bot, it keeps showing the same error

I followed a youtube video for this code and it just doesn't work, this is the part of the code where the error is: @client.command(name='queue', help='This command adds a song to the...

Discord.py - Allow command in specific channel

i need to use my discord command in specific channel , I'm using @client.command() I mean if i used my command in another channel will be not working @client.command() async def w(ctx): ...

Python Discord Bot Create Channel

I'm trying to make a discord bot using the discord.py module. I have structured my code in so called Cogs and now want to make one for creating text channels. The Bot has the permissions it...

Discord.py Listening for a Message after a Command

I've been trying to create a bot command that listens for a message after the command is sent. This is meant to be used to create a profile of the command author to later store in a JSON...

Heroku SSL connection error unsupported protocol

I have been using Heroku for a while to host my Discord bot. It has been connecting to a MySQL database hosted on ClearDB successfully. However, very recently, whenever I use the bot and it tries...

Discord.py - Streaming Youtube Live into Voice

I'm back on the stacks, was banned from asking questions because they were terrible apparently, but I need help on something I've done a lot of research on but cannot find my answer; I need to be...

Discord Attachments Link

Well if you would like to get the attachments from a Discord message, you can do it by the following way: attachements = message.attachments But it cannot get attachments which are sent with a...

Discord.py - How to get member count not including bots?

I want to make a command that shows member count but not including bots. My code: @bot.command() async def members(ctx): await ctx.send(f"Members in {ctx.guild.name}:...

discord.py, send message by channel id without on_message() event?

i made a class for my bots config and general things in my code, im tidy so, client is discord.Client() and bot. is my class in my bot class i stored some channel ids and then i noticed...

DM a specific user in discord.py

I'd like to know how to dm a specific person that will always be the same. I've tried many StackOverFlow posts and the official discord.py documentation but none of them worked. I have discord.py...

TypeError: 'coroutine' object is not subscriptable

I am trying to create a discord bot with python as language and mongodb as database. I am creating this command to update the troops amount but when I run this command it shows TypeError:...

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'dislike_count'

Ignoring exception in command play: Traceback (most recent call last): File "C:\Users\rcesa\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in...