All Questions
Tagged with python-3.x discord.py
3,261
questions
1
vote
0
answers
61
views
Need to call an async instance method from a sync instance method
send_message() gets called from a thread. Since my_channel.send() is async, I think it is necessary to have a synchronous send_message() call the asynchronous asend_message(). How can it be done?
#@...
-4
votes
1
answer
47
views
Discord-py-api program is completely not work
When I wrote a discord auto replier with python lib discord-py-api it looks like it didnt detect the message received...
My code:
import discord
class MyClient(discord.Client):
async def ...
0
votes
0
answers
75
views
How to create log message for commands on discord bot
I try to create a channel where the bot post the commands used but nothing I tried worked.
from discord import *
from discord.ext import commands
intents = discord.Intents().all()
client = discord....
1
vote
0
answers
27
views
Error in verify_key function from discord_interactions library for Python: Signature was forged or corrupt
I have this code snippet:
def interactions_view(request):
if request.method == 'POST':
try:
raw_body = request.body
signature = request.headers.get('X-Signature-...
-2
votes
0
answers
31
views
How do I start a thread only once in discord.py (task.loop decorator)
So I'm getting this error tried debugging and I already asked chatgpt what I'm doing wrong it did suggest me what to do but I'm still getting this error.please anybody help me understand what I'm ...
0
votes
1
answer
52
views
Handle internet connection errors while running bot with bot.run()
What is a proper way to handle internet connection errors while running a Discord bot with bot.run()?
from discord.ext import commands
token = "my_token"
intents = discord.Intents.default()
...
0
votes
1
answer
48
views
Why Won't My Discord Client Sync Commands?
So I've had a live functioning discord bot for around 10 months now, various kinds of commands, some including Options and all has worked seamlessly including syncing commands.
Yesterday I tried to ...
0
votes
1
answer
71
views
How can i check if a discord user finished onboarding?
In discord.py 2.0, I do onboarding when a user first enters the server.
I'm curious if there is a d.py 2.0 reference to check whether onboarding was completed properly.
Can I get some reference, API ...
1
vote
0
answers
44
views
Discord bot running on local machine, but when running on a web-server, my array returns empty
I'm using beautiful soup to scrape prices of cards, when running on my Macbook Air (M3), the program returns my array with the values expected. When running on a web server, my array returns empty. ...
0
votes
1
answer
42
views
Text files, how to write, delete and update lines in a text file
I am writing a small discord bot for me and my friends but I have gotten carried away with it's feautres and right now am trying to create commands that will allow the user to ask to look at a "...
-2
votes
1
answer
67
views
How can I fix an error in discord.py with Loops (in Tasks)?
If I run my Discord bot I have this error:
Traceback (most recent call last):File "c:\Users\progi\Documents\GitHub\discord_bot\main.py", line 221, in <module>bot.add_cog(MyCog(bot))^^^^...
-2
votes
1
answer
58
views
No module named 'discord.commands'
Traceback (most recent call last):
File "D:\Redacted\path\main.py", line 8, in <module>
from commands import setup_commands
File "D:\Redacted\path\commands.py", line ...
0
votes
1
answer
33
views
Storing and deleting Discord UserID in a .txt file
I need to make a bot that stores the user's UserID in a txt file, and then deletes that UserID when the user does a command.
This code looks at the text file with all the users' UserID's. Then it ...
0
votes
1
answer
22
views
How can I add a role to someone while ignoring the permissions of the command user?
My code:
@bot.command()
async def giverole(ctx, person):
guild = ctx.guild
role = discord.utils.get(ctx.guild.roles, name="role")
if discord.utils.get(ctx.guild.roles, name="...
0
votes
1
answer
66
views
How to modify a response message adding an image with discord.py [duplicate]
I send a response with text, image and select menu view, with the choice I edit_message with new text and new view (buttons), with the choice I edit_message with new view (select menu), with the ...