Questions tagged [discord.py]

'discord.py' is a Python 3.8+ library for interfacing with the official Discord API. This tag should only be used when referring to the discord.py library. If using the [nextcord] or [pycord] fork, please use these tags instead if the question refers to them specifically; otherwise, please use both the fork's tag and [discord.py]. Please check if all necessary intents are enabled in the code and your Discord Developer Portal.

discord.py
Filter by
Sorted by
Tagged with
-1 votes
0 answers
8 views

The bot does not send notifications at certain times

The bot does not create a reminder, although it should. he just doesn't see time. I want it to just work, in 24 hour format. # Reminder notes = {} @bot.command() async def note(ctx, time_str: str, *, ...
Domi's user avatar
  • 1
0 votes
1 answer
24 views

Interaction failed on discord.py after some time

I have an error on discord.py Interaction failed only dont works after some time But when i try do /add_button works in the first 5 minutes after that dont work anymore the button Idk why any help on ...
Rodopoulos X Games's user avatar
1 vote
1 answer
21 views

Discord.py "on_message_edit" method for a message that was sent while a discord bot was offline/after restart

I'm attempting to create a Discord bot (using discord.py) that can extract data from a message containing an editable embed, which receives updates. The bot functions correctly if the bot already ...
user24442827's user avatar
0 votes
1 answer
19 views

Import Error: cannot import 'SlashCommand' from 'discord.app_commands'

Here is my code: import discord from discord import app_commands from discord.app_commands import SlashCommand from discord import Client, Intents intents = discord.Intents.all() intents....
Gamer2000's user avatar
1 vote
0 answers
20 views

E bot.ftech_channel raises error with pytest AttributeError: '_MissingSentinel' object has no attribute 'is_set'

I have a discord bot which needs to fetch guild and channels. If I get none from bot.get_guild(), I try to fetch_guild through api. The code looks something like this: async def get_or_fetch_guild(...
Aarti Joshi's user avatar
-3 votes
2 answers
31 views

Issue with Discord bot after upgrading from Discord Version 1.7.3 to 2.3.2: Role function not working correctly

Recently, I updated my Discord bot from Discord Version 1.7.3 to the latest version, 2.3.2. However, after the update, the bot ceased to function as expected. I attempted to resolve the issue by ...
Dr.Oliver's user avatar
0 votes
1 answer
38 views

How to make Discord bot edit it's own previous message via a command?

I can't seem to figure out how to make a user's command edit the Discord bot's previously sent message. I am using discord.py. I'm creating a bot that reserves players for nations in a grand-strategy ...
user24391360's user avatar
0 votes
0 answers
14 views

"%c[LoginQRSocket] font-weight: bold; color: purple; [40919ms] remote auth handshake started, awaiting ticket/cancel.", source: https://discord.co

Hello i have some problems maybe someone can help me it will be very cool: from PIL import Image from bs4 import BeautifulSoup from selenium import webdriver import base64 import pyfiglet import time ...
user24378800's user avatar
0 votes
0 answers
23 views

discord bot problems with external host

I have this python code for a discord bot, if I use the code on my PC to make the bot appear everything works perfectly without problems, but if I use it on external hosts like replt or a vps it ...
A _ L _ E's user avatar
0 votes
0 answers
11 views

DIscord Music bot not queing

I am trying to make a music bot for my own Discord server. Everything seems to be working and I get no error messages. But songs that are added to the que does not seem to start playing once the ...
Adrian Knuutinen's user avatar
0 votes
1 answer
20 views

I am using discord py and trying to return the users avatar and if they dont have one return a default

I was trying to run the code embed.set_thumbnail(url=interaction.user.avatar.url) in a command yet whenever a user without a pfp tried to use the command it resulting in an error of discord....
obesttellez's user avatar
-1 votes
0 answers
26 views

Yt dlp python api stuck hanging no matter the video at download 0.1% ~

In my simple python discord bot I have made a groovy like function that uses youtube dlp to download a video to play with the bot. and it was working just fine downloading till randomly one day ...
jethrothelion's user avatar
0 votes
1 answer
20 views

DIscord Bot message deleting

I have made a discord bot(with discord.py) that will ping a certain role if there is any new message in a certain channel. But I want the bot to delete the ping immediately. How can I do that ? I ...
Cpsbd66's user avatar
0 votes
0 answers
18 views

Error interacting with the button in the discord bot

Bot throws this interaction error: Error interacting with the button in the discord bot I've done everything in my power, but nothing helps. Button click handler "Send report" @bot.event ...
Domi's user avatar
  • 1
0 votes
1 answer
13 views

After changing my discord server to Community Server my own bot doesn't work

So when I activated the community server, my commands like on_member_joun() or on_member_remove() stopped working, but when I turned back to the friend server, it worked. The question is next: Do I ...
Денис Піддубний's user avatar
0 votes
0 answers
30 views

TypeError: Constructor parameter should be str; Failure when trying to download more than one file at once from a website

Relatively new to Python and, by definition, the Discord API. The second part doesn't really matter. I am trying to grab any number (1-10) of posts from a website using their API and am unable to and ...
Meolsei's user avatar
-1 votes
0 answers
25 views

How to run a command while running a loop with threading ONLY when necessary?

So, I have a discord bot with multiple slash commands. One of them contains a while loop (I will call it loop command). And whenever I start running the loop command, the bot will not give any respond ...
ChanHY's user avatar
  • 15
-1 votes
1 answer
25 views

Discord.py bot Create Role Issue

When I create new roles, they are created above the bot role. Which makes it impossible to change their position. Because due to the role hierarchy, the bot does not have permission to do this. I have ...
Tweedle's user avatar
-1 votes
0 answers
21 views

Dict inside the postgreqsl table

I have a code like making a discord.py bot which is used to do some economy stuff. I've been using pg for database and i now need to do like assemble some user_ids into 1 query. await connection....
arielle's user avatar
  • 21
-2 votes
0 answers
29 views

Button not showing, Python [closed]

I'm extremely new to Python, but somehow my code doesn't work. Why isn't the button included? I've also been inspired by other codes, but it just doesn't work. import discord import discord.ui from ...
silviocov's user avatar
-1 votes
0 answers
19 views

How to get data from the database in app_commands.Choice?

Get name list and put in app_commands.Choice I want to make sure that when I enter /a, it displays a list that it will receive from the music.db database. At the moment he is like this click I need to ...
akmal mine's user avatar
-1 votes
1 answer
19 views

discord.py how make update command

How to make a command in discord.py that will update all slash commands and add new slash commands, but without using cogs, I found a way only if I change the value of one of the current slash ...
howa's user avatar
  • 7
-1 votes
1 answer
25 views

Discord.py how do I fetch related user info, if the function seemingly has no connection to it?

Trying to add a part to a bot, where certain users, due to easy abuse, can't create new roles. Using on_guild_role_create(role) works fine when removing the newly created roles, but it's inconsiderate,...
Iirus's user avatar
  • 1
0 votes
1 answer
27 views

The bot doesn't work with commands. [discord.py]

I'm trying to learn about discord.py and create bots on Discord, but I'm having a curious problem because my bot responds to commands in DMs, but it doesn't respond in the server channel even though I'...
Margot Paon Garcia's user avatar
-1 votes
0 answers
17 views

Why is the setup function in my cog using discord.py not work?

The error that I have been encountering has to do with the setup function of the bot, where I add the cog to the main file. This is the music.py file where I put the cog, I did this by using a ...
Fisho's user avatar
  • 1
0 votes
1 answer
26 views

Py-Cord function not responding when accessing permissions

This is the strangest problem I have ever had with this library. My code works fine, but this command (below) does not respond with anything. However, the program does not output any error. @admin....
TheMineCommander's user avatar
0 votes
0 answers
13 views

How do I automatically copy the newest message in a channel into my clipboard? [closed]

That's why I want to copy the most recent message to my clipboard from a particular Discord channel. How can I go about doing that? Whether I have to have the channel open or closed is irrelevant; ...
Toasty's user avatar
  • 1
-1 votes
1 answer
29 views

Why does my discord bot display the gif links in ['link_of_gif'] format instead of just the link itself

First, I created a json file where I stored all the links I want the bot to display { "yup": [ "https://tenor.com/view/mourinho-jose-mourinho-yes-yes-yes-yes-oh-yes-gif-...
LiMinHeng's user avatar
0 votes
1 answer
24 views

Disabling a button in another message, how to fix it?

The bottom line is, I wrote a report code, after the completed form it is sent to a certain channel, there with this report form, 2 buttons appear, Accept or Reject. After clicking on the Accept ...
akmal mine's user avatar
0 votes
1 answer
38 views

"The application did not respond" when running "Purge" command with a discord bot. Why is this happening?

Everytime I run my command "purge" on my Discord bot, I keep seeing "The application did not respond" after the command runs and deletes the limited messages. I'm using discord....
Opressive Extenz's user avatar
0 votes
0 answers
26 views

Schazamio Python

I use this code example. I added it to the next loop. by listening to the audio stream every 2 seconds, 5-second segments of the recording. After running the code it freezes after some time. I can't ...
Stefan Majowski's user avatar
-2 votes
1 answer
36 views

"This interaction failed" error when i click on button

So i have a code and after running,when i click in Discrord i receive this problem "This interaction "failed import discord from discord.ext import commands class MyView(discord.ui.View): ...
Денис Піддубний's user avatar
-4 votes
0 answers
35 views

How do I call a method for a discord bot from another file

I created a simple discord bot that can upload an image to a server. All I want to do is to be able to call the send_image method from a different file but thats where I run into some truble. When the ...
Shay Cohen's user avatar
-2 votes
1 answer
21 views

Why doesn't execute code under if not prefix statement in discord.py?

@commands.command(aliases=['префикс']) async def prefix(self, ctx, prefix): if not prefix: await ctx.send(f"Current prefix - {self.client.command_prefix}") else: self....
DamAnD's user avatar
  • 3
-1 votes
1 answer
30 views

how to get rid of discord.Object(is="My guild id") without breaking everything in discord.py

I create a discord bot in slash but with each command I have to specify the server id, which is very annoying for everything that is inter-server compatibility (if I do not specify the object guild=...
ItsPyDevs's user avatar
-1 votes
1 answer
42 views

I'm getting a "AttributeError: "Context" object has no attribute response" error when I'm running my code, any other way to get it running?

So I'm creating a simple discord modal using discord.py. But whenever I run my code I get an attributeError saying that the 'context' object doesn't have a response attribute. I know this is true, but ...
Detective Aurora's user avatar
-2 votes
1 answer
29 views

AttributeError: 'Guild' object has no attribute 'icon_url'

guild = bot.get_guild(guild_id) thumbnail = guild.icon_url if guild.icon_url else None Error: thumbnail = guild.icon_url if guild.icon_url else None ^^^^^^^^^^^^^...
stack srevia's user avatar
-1 votes
0 answers
22 views

Why does the execution of the command of my Discord bot stop after it sent the first message?

async def change_nickname(interaction, member: discord.Member, nick): """ str, str, str --> str Changes a member's nickname to the nickname given. """ try: ...
pokelouloute57's user avatar
0 votes
1 answer
21 views

delete a message only if a specific member uses the command and the message is from someone using discord.py

cant seem to figure this out code to delete the message, its supposed to only let me delete a specific persons messages, but it doesnt work async def deletemessage(interaction : discord.Interaction, ...
Scar's user avatar
  • 3
0 votes
2 answers
44 views

Discord Bot, does not run. But why?

I don't know why, but my bot is not responding to my command... Do you know why? The bot is online and connected to my server and has all the necessary permissions to write texts. But unfortunately ...
cxyro's user avatar
  • 21
-1 votes
0 answers
27 views

How i can close modal window in discord.py?

I have a problem because I cannot close the window of this modal in any way. Basically, I'm trying to influence an ephemeral message sent using interactions in other pieces of code. Maybe someone has ...
Conor's user avatar
  • 1
0 votes
1 answer
22 views

Discord.py slash command private reply

I have just worked out how to run a slash command using my Discord bot. However, I want the bot to reply to the user in a way that only they can see the message (Example below). enter image ...
Cristiano's user avatar
0 votes
0 answers
56 views

Discord bot is connecting to the voice channel but not playing the music with YouTube URL

I am making a discord bot and trying to add some music related commands to my bot. The Main issue is that the bot is connecting to the voice channel where the user is but not playing the music from ...
Xeschoz's user avatar
  • 11
0 votes
1 answer
19 views

Discord Bot reply to my messege with text and provided data. Python

I want write command "!addpoints "numOfPoints"" and bot should reply to this message this: You added "numOfPoints" points. I tried make it, like it is on photo:code but I ...
Vovchik 0528's user avatar
0 votes
1 answer
51 views

discord.py Bot adds reaction when user adds specific reaction to message

My code already makes it work Other emojis work fine But when I use "❤" my code str(emo.emoji) == '❤' return false I tried using print() to debug print(type(emo.emoji)) #return str print(emo....
林雍智's user avatar
1 vote
0 answers
31 views

How to make a Discord bot multithreaded for multiple servers?

I have a discord bot (discord.py) with a mafia game algorithm. Is there any way to make the code multi-threaded, so that several servers can start the game without interfering with other people's ...
RUBICK's user avatar
  • 11
-1 votes
0 answers
9 views

Seeking Assistance with Discord.py Ticket System Implementation

Sure, here's an expanded version of your request with additional details: I'm attempting to implement a ticket system in my Discord bot using discord.py, but I'm encountering issues with the command. ...
MemeBro's user avatar
0 votes
3 answers
36 views

How can I write and format descriptions/messages over multiple lines with Discord Bots in Python?

I am currently trying to code an embed for a discord bot in python and I am wondering how I can spread the text over or format the message so that it goes over multiple lines. Essentially being able ...
Daniel's user avatar
  • 9
-1 votes
1 answer
28 views

Bot to kick members out of the server with specific roles and send a message in the bot staff records channel and the user's DM (who was kicked)

I'm currently developing a bot that can kick out members from the server based on specific roles. It's designed to send a message to the staff records channel and also notify the user via direct ...
XylaN xD's user avatar
0 votes
3 answers
38 views

Updating variable every 24 hours [duplicate]

I'm trying to add 1 to a variable every (2 seconds for this example). Problem is, the variable only ever updates to 1. Am I overlooking something? Code: import discord from discord.ext import commands,...
Mashhhyyy's user avatar

1
2 3 4 5
322