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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

I have a TraceBack Error on my Discord.py Bot

I'm a French beginner developer. Recently I've been thinking about making a Discord Bot in Python. So I watched a few videos but no matter how much I copied what they were doing, I kept getting errors ...
Yasuo ousaY's user avatar
0 votes
1 answer
19 views

Unable to strip brakets from string lists and convert them into an integer list

Today i was trying to expand my code a little by automating when the user goes online. To do this, I use players.json from a FiveM server, the output looks like this: {"endpoint":"127.0....
Planetech's user avatar
-1 votes
0 answers
24 views

made this tempban command using discord.py but when it bans the user it doesnt unban them after the time nor does it say they get unbanned in dms

@client.command() @commands.has_permissions(ban_members=True) async def tempban(ctx, member: discord.Member, duration, *, reason=None): guild = ctx.guild await member.ban(reason=reason) ...
sigma skibidi's user avatar
0 votes
0 answers
15 views

How to make discord.py bot pull mentioned user's profile picture with a command

I want to make my botpull mentioned user's profile picture with a command like "!pfp @user" Due to my lacking knowledge in python and discord bots in general i tried many ways but i still ...
Vailecia's user avatar
0 votes
0 answers
11 views

discord.py v2.0 listening event logging for channel overwrite changes

I am trying to listen for updates to a channel (logging event features for a discord bot). The main thing I want to listen for are updates to the role permissions in the channel (overwrites). I don't ...
Ori's user avatar
  • 31
0 votes
1 answer
38 views

Why does this jail command not work? The bot is online but it still wont work "other commands work btw"

I made a discord jail command and it doesn't work the bot is online but it doesn't work for some reason "Other commands work" @client.command() @commands.has_permissions(administrator=True) ...
sigma skibidi's user avatar
-2 votes
0 answers
24 views

starting of Minecraft server blocking heartbeat from bot to Discord

import discord import os #this is a seperate .py file used to close the server from cmdtest import find_and_type_in_console import threading import time server_info = False intents = discord.Intents....
Sean Mckenzie's user avatar
0 votes
1 answer
26 views

(Discord.py) How Do I Alter Pre-Existing JSON to add a new Parameter?

I'm trying to add a new item to a shop in my discord, and I have it set to where people have to open an account before they can participate in the economy. Here is what I currently have in way of code ...
Ethan's user avatar
  • 5
0 votes
1 answer
17 views

Get a Discord Role by Id. Discrod.py

How do I get a Role object by the role's id using "discord.Guild.get_role()"? I use it like this role = discord.Guild.get_role(role_id=config.ROLE_ID) but I have a error after: Traceback (...
Ya_SoVuH's user avatar
0 votes
0 answers
25 views

A problem with sound reproduction in the voice channel

I have code that can work without errors and the bot can join the voice channel, but when it joins it doesn't do anything. And he doesn't send anything either. My ffmpeg.exe file is in the same ...
Vlad's user avatar
  • 1
-1 votes
1 answer
23 views

my button have an Interaction failed error | discord.py

I created a button on my discord bot using various tutorials, but it still doesn't work. I've tried everything, but it still gives the error Interaction failed my code: import discord from discord.ext ...
kot_v_palto's user avatar
0 votes
0 answers
27 views

Discord bot doesn't play music but still responds to commands

The bot responds to all commands, connects to the channel, but does not play the song I tried using the open source DingoLingo bot from github, it also responded to commands but did not play music. ...
Ruslan's user avatar
  • 1
0 votes
0 answers
31 views

Errorless problems with discord.ext.tasks

This is my first time using this and whenever I r un the code below, it prints "waiting..." but nothing else. As I said I haven't really used discord.ext.tasks before so I'm not 100% sure on ...
DRags's user avatar
  • 66
0 votes
2 answers
59 views

How would I add spaces in Discord application command names (slash commands)? [nextcord/discord.py]

I'm trying to create a command "/channellink" that links messages between text channels. The command has three options: "initiate", "terminate" and "list", but ...
Kyrzhen's user avatar
1 vote
1 answer
44 views

Storing embeds in function for later discord.py

Is it possible? I have a seperate file _embeds.py with discord.py imported. I have the embed setup in the function with a return embed at the end, but when calling, it sends <discord.embeds.Embed ...
Mashhhyyy's user avatar
1 vote
1 answer
51 views

how to make an echo bot that turns on on command and turns off when user say stop | discord.py

I need the bot to start repeating the user's messages after the k!echo command until he says stop I tried using bot.wait_for() but it didn't work code: async def echo(ctx, *args): channel = ctx....
kot_v_palto's user avatar
-1 votes
0 answers
35 views

discord.py selfbot not printing messages [closed]

printing problem I got the discord.py 1.7.3 because its the last version that supported selfbots and I don't know why its only priting my messages and not other people messages. Code: https://paste.ee/...
GodNpc's user avatar
  • 1
-5 votes
0 answers
55 views

In python Discord bot what is input()? [closed]

i made this guessing game and tried to put it into my discord bot but when i run it, it sends everything because of the input(), does anyone know how to replace input so that the bot reads the ...
Wave's user avatar
  • 1
-1 votes
1 answer
36 views

How do I make my discord.py bot play a sound effect?

My bot is supposed to be some sort of jeopardy quiz show type of bot. /joinvc makes the bot connect to the call, however, I cant seem to make the bot make noise when its in a vc. Here's some of the ...
Kronik71's user avatar
0 votes
2 answers
54 views

discord.py not matching with ==, even when manually checking

I have a discord bot that writes to a file object, and deletes a message, when a specific message, '!bypass', is sent by a specific user. However, the following code will not run if that user sends ...
eesatss's user avatar
0 votes
1 answer
34 views

Registering hybrid command group trees for discord.py

I've run into a problem with the following hybrid command group I'm trying to create in discord.py: @commands.hybrid_group(name='event', description='Lists events attended by character') @...
madruk20's user avatar
-1 votes
1 answer
39 views

discord.py can't get new message with on_message method

import discord intents = discord.Intents.default() intents.messages = True intents.message_content = True client = discord.Client(intents=intents, proxy='http://127.0.0.1:10810') @client.event async ...
祝靖雲's user avatar
-1 votes
1 answer
25 views

My discord bot throws error for missing 'event' argument, when trying to read a respond

My bot should do the following: After !number the bot asks for a number between 0 and 1000. Then the user has to write down a number and the bot checks if its the one that was randomly generated. ...
NirvanaGirl's user avatar
-1 votes
1 answer
43 views

Python Discord Bot Image Edit

the bot does not respond to the image I sent with the command. @bot.event async def on_message(message): print(f"message from {message.author} what he said {message.content}") @bot....
Fox Recoil's user avatar
-3 votes
0 answers
65 views

Deleting a channel if it remains without users. Disnake, Discord.py

How to make a channel deleted after some time after there are no users left on it, but if someone comes to this channel, the timer will disappear or resume if there is no one on this channel? You can ...
Xalwer's user avatar
  • 1
0 votes
0 answers
37 views

My discord bot say in terminal: invalid syntax (<string>, line 1)

I have question why my code when i send command on chat !lek (drug) [name of the drug] in terminal say: invalid syntax (, line 1). I don't know what to do. This is my code: import discord from discord....
Darklord's user avatar
0 votes
1 answer
29 views

Discord.py app_commands send_message not being recognised

When making app commands i always see peaople do @app_commands.command() async def first_command(interaction: discord.Interaction): await interaction.response.send_message("Text", ...
Elmerwi's user avatar
-1 votes
0 answers
30 views

I'm trying to resolve an issue with my bot's buttons, it always says "This interaction failed"

I've tried using AI to help me fix the error and I can't, I've done everything I know and I can't. I've tried using logging. DEBUG but no error appears. I'm using these My goal with the code was, when ...
K1ng_pt's user avatar
  • 11
-1 votes
0 answers
26 views

how to make discord bot pull a gif from tenor with an user given search term with python?

This is my first time on stack overflow so sorry if i make mistakes. I have little knowledge in python and discord bots in general, so it'd be so nice to get answers with nice explanations (but i did ...
Vailecia's user avatar
0 votes
1 answer
52 views

discord.py - How to automatically convert certain text to a value and ACTUALLY show it? (ex: {member_mention} = @user )

I'm working on a welcome module. I want a user to be able to mention the member with {member_mention}. I've tried doing that, but it just sends " {member_mention}. " I want it to be ...
As2Bax's user avatar
  • 113
0 votes
0 answers
24 views

Why is my discord bot not playing any audio when joining VC?

I'm really new to coding and don't really understand it much but I have been trying to build a bot that will join VC and play audios that are saved as mp3s on my PC, as well as join VC and play Text-...
ahmarabeh's user avatar
0 votes
1 answer
55 views

How Do I Find Members Not In my server? (d.py)

I've been attempting to solve an issue I have in my server's economy where the leaderboard still shows stats of players who left. To this end, I am trying to create a clean_economy command, where the ...
Ethan's user avatar
  • 5
0 votes
1 answer
32 views

Is there any way to split commands between different shards

I am currently making a bot to spread over a couple servers of my discord community, and I want to be able to broadcast a message to every server with a command. I have tried to figure out how to do ...
Xenan's user avatar
  • 1
0 votes
0 answers
49 views

How can I update the View from a Button in Discord.py?

I created a discord bot for one game using discord.py library. One of the bot function is to display a message with buttons below. Once one of the buttons is pressed, the message is edited. The ...
gh0sty's user avatar
  • 1
0 votes
1 answer
33 views

discord buttons discord py

class StaffView1(discord.ui.View): def __init__(self): super().__init__(timeout=None) self.bot = bot @discord.ui.button(label="▶️", style=discord.ButtonStyle.blurple,...
Cornelius Glanzer's user avatar
0 votes
1 answer
58 views

Why can't I define this?

the code do run well before I moved codes in class and it didn't run :( class Clear(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def ...
NyanCat's user avatar
0 votes
0 answers
27 views

I am making a discord bot and have it check if a message sender is itself but I get: NameError: name 'message' is not defined

I have this @bot.event async def on_message(self): # don't respond to ourselves if message.author == self.user: return if message.content == 'ping': await message....
Mee Bacon's user avatar
0 votes
1 answer
39 views

Discord.py's interaction.response has no send_message method

I was transitioning my old discord bot from 1.7.3 (before slash commands) to 2.3 and encountered an error when trying to send a message upon the use of a command. I have seen tutorials and they all ...
History Project's user avatar
0 votes
0 answers
20 views

ERROR discord.ext.commands.bot Ignoring exception in command give

import discord from discord.ext import commands intents = discord.Intents.default() intents.members = True intents.message_content = True #v2 bot = commands.Bot(command_prefix='!', intents=intents) ...
wari's user avatar
  • 1
0 votes
1 answer
29 views

Attaching file in embed from sqlite3 database

I would like to send an embed with a picture, originating from a sqlite3 database. I am correctly fetching the file but it won't display it in the embed. def init_embed(title, description, colour, ...
Chris Ze Third's user avatar
0 votes
1 answer
27 views

Can't delete bot message discord.py / pycord)

I am having trouble deleting discord bot's message. Here is the code to replicate the problem I am having: import discord from tools.config import TOKEN bot = discord.Bot() @bot.event async def ...
syrok's user avatar
  • 133
1 vote
1 answer
39 views

Check if message was sent in a thread (discord.py / pycord)

I need my discord bot to check if slash command is being executed in a thread or not. Couldn't find anything related in the discord.py docs https://discordpy.readthedocs.io/en/stable/api.html and ...
syrok's user avatar
  • 133
-1 votes
0 answers
28 views

Music Discord bot does not work and deos not respond to my commands

I'm making a discord bot for my friend. I followed a tutorial online and after i was done it didn't respond to test commands. I'm new to programming in general i have no idea what is wrong with this ...
RUN00455's user avatar
0 votes
2 answers
39 views

How would I convert a mention to a string in d.py?

I created a custom event for a twitter feed on my server. It works great so far, but I keep running into one issue: whenever a user mentions someone, the text outputs it as the <@1234...> format,...
Ethan's user avatar
  • 5
1 vote
0 answers
20 views

How to modify an user permissions for a specific channel nextcord

I want to create a channel where just me and who wrote the command can send messages. So far i have this code: @commands.command() async def ticket(self, ctx, title, context): guild = ctx....
Alin Ene's user avatar
-1 votes
0 answers
13 views

await member.add_roles(verified_role) not working

i tried lots of ways to define the member and none worked there might be something wrong with my packages, i uninstalled all discord related packages and only installed discord.py this is the console ...
yeetboi's user avatar
-3 votes
0 answers
33 views

I can't understand why the vote command is not working

from aiohttp import client import nextcord import sqlite3 from nextcord.ext import commands , tasks import aiohttp , os import topgg import time vote_api = { "topgg_api" : "https://...
Coder Divyanshu's user avatar
0 votes
0 answers
25 views

Music Bot started giving strange errors

import discord from discord.ext import commands import youtube_dl import asyncio import random intents = discord.Intents.all() intents.members = True intents.messages = True bot = commands.Bot(...
Domi's user avatar
  • 1
0 votes
1 answer
46 views

discord.py - How to make bot events still work after my discord bot restarts?

I'm making a logging system for my Discord bot. Everything works perfectly fine. There's one small problem with it though: If my bot restarts, the previous messages will not be logged. The messages ...
As2Bax's user avatar
  • 113
0 votes
1 answer
17 views

How do I fix my discord bot only responding in DM's?

My discord bot is only responding in DMs. Even when using commands in a server, the bot still only responds in DMs. This is the code: https://replit.com/@okapikit/goosidk I searched online for similar ...
Amy Wang's user avatar

1
2 3 4 5
318