All Questions
Tagged with python-3.x discord.py
3,456
questions
0votes
1answer
18views
checking if message author has a certain role
I am making an automatic banning system with a discord bot.
So once a message with a steam id is placed into the channel, it will run through an API and ban them (I've got this working)
what I am ...
0votes
0answers
20views
TypeError: The error handler must be a coroutine. sys:1: RuntimeWarning: coroutine 'Command.__call__' was never awaited
I try to run my code and have this error , I was trying to do an error handeler on my discord py bot but it seems not working:
@A_lot_of_errors.error
async def error_handler(ctx , error):
coderror ...
-1votes
2answers
35views
How to solve "unexpected indent" and "traceback" errors?
I'm trying to code a bot for Discord and can't get my "help" command to work.
This is the code I started with:
@client.command(pass_context=True,name="help")
async def help(ctx):
...
0votes
1answer
41views
Is there any way to make a command both text-based and slash-based in Pycord?
I've made a music bot in Pycord, and I want to make the commands both slash and text-based. I've implemented slash commands using discord.Bot in a cog and used the slash_command decorator.
All the ...
0votes
1answer
15views
Detecting specific reactions to a message without on_reaction_add
Constraints of the problem:
My python bot needs to iterate through a list of messages to find reactions (I have that implemented and working), so I cannot use "on_reaction" or async's ...
0votes
1answer
14views
How can I make permission for a special Id
I am building a public discord.py bot and I want that I can use every feature even if I don't have the rights on that server like:
I am on a server and they're using my bot but I have no rights but I ...
0votes
0answers
29views
The application does not respond when you enter the slash command "/invite"
when I enter the command "/ invite" writes that "The application is not responding" the screen below
click
My code
import discord
from discord.ext import commands
from ...
-1votes
1answer
16views
Getting the view() object from message
so my problem is that i have a view from a message right, and im saving the message id in a database for a later time
when that time comes around i want to make the view buttons disabled, but I need ...
-1votes
0answers
24views
I was creating a bot to snipe hypixel api discord bot but its creating a error by channel.send_message ,
done = default_timer() - START_TIME
if op:
winsound.Beep(500, 500) # emits a frequency 500hz, for 500ms
for result in results:
profit = result[1] - result[0][2]
print("/...
0votes
0answers
15views
How to make a discord bot send post request with a cron job
I recently decided to get a status page for my website https://status.microwavebot.tech (Betteruptime is used) but I also wanted to show my bot on there and the only way I can do is a heartbeat which ...
-1votes
1answer
32views
discord python error TypeError: unhashable type: 'list'
Im making a discord bot but its giving me a TypeError: unhashable type: 'list' error, i tried to fix it in alot of ways but still didnt work at all, yall mind helping me?
Code:
import discord
from ...
1vote
1answer
33views
How to send text within username input field on a https://discord.com/register webpage with Selenium and Python3
I'm trying to select the username text box in the https://discord.com/register website I tried:
driver.find_element ( by=By.CSS_SELECTOR ...)
driver.find_element ( by=By.CLASS_NAME ...)
driver....
0votes
0answers
33views
Module Wavelink Has no attribute Client
import discord
import wavelink
from discord.ext import commands
#Please help me
class Bot(commands.Bot):
def __init__(self):
super(Bot, self).__init__(command_prefix=['audio ', 'wave ','aw '])...
1vote
1answer
30views
Install ssl certificates for discord.py in an app
I am making a python-based mac app that uses discord.py to do stuff with discord. As I knew from previous experience making discord bots, running discord bots requires that you run Install ...
-1votes
2answers
18views
discord.py bot having async def load error
So I've been trying to fix this problem for a few hours but whenvever I do I just pop out more errors so I've resigned to asking the internet for help this is my code that is having the problem. this ...
0votes
0answers
29views
Why is this sqlite trying to create a new column?
So I have this function called tag
def tag(name,response,creator):
#TAG CREATION
name = name.lower()
conn = sqlite3.connect('tags.db')
c = conn.cursor()
inp = "(\""+...
0votes
1answer
58views
Pycord Discord bot Read DM History, How to get DM Channel History
I am using pycord and am trying to have my discord bot look through its dm messages with a particular user to know if it has already sent a specific message to that user or not. Is this possible?
I ...
0votes
1answer
49views
You need to display more than 2 hints in the discord bot using slash commands
Question in English
Hi all. My code is attached below, I want to make the user enter the "/invite" command, it pops up not one argument, but
two. An example will be in the screenshots. I did ...
0votes
0answers
54views
My command doesn't work on cog (discord.py)
My cog loads correctly but when I execute the code and use my "!test" command nothing happens...
edit: My problem is solved
I went into the settings of my bot and I activated all the ...
-1votes
1answer
33views
How to use Discord Permission on Create Embed Command?
How can I use this?
if (not ctx.author.guild_permissions.manage_messages):
await ctx.send("Please ask a Supporter")
return
for this:
@bot.command()
async def cembed(ctx):
def ...
0votes
1answer
21views
Discord bot runs differently when called in-file and from outside file
I am trying to integrate a discord bot into an app such that when the user of the app does something, it calls a function that uploads something to discord. This means that the bot only has an ...
-1votes
1answer
36views
If Discord.py Bot gets dm
Dear stackoverflow community.
I want to add a little 'Easter egg' to my discord.py bot. If one gets a DM from a user, he should reply something like "No private messages while at work". Is ...
-2votes
0answers
43views
discord.py - how to pass async def into thread
ct = ''
@client.event
async def on_message(ctx):
if ctx.content == 'run':
global lt
lt = ctx.guild
async def logs():
while True:
global lt
...
-1votes
1answer
41views
Bot won't leave voice channel when left alone
I have a personal music bot that plays music for me and friends, I only have a play and leave commands which both work perfectly, but I was wondering if a little upgrade to the bot automatically ...
2votes
1answer
33views
How to add cooldown mapping to users who reacted first?
Im currently working on a cart manager where users has a chance of a giveaway prize (First come first serve). Basically I will automatically post some embeds and the person who reacts first will get ...
0votes
0answers
21views
Running discord bot using quart python
I am trying to create a discord bot with two features.
To update everyone in the server about some info (this is done by using webhook and a uptimerobot to call the webhook)
Community in the server ...
-1votes
0answers
24views
discord.py Delete latest message in channel
I am using a command that deletes the latest message in the channel. How would I do this?
I am using client:
import discord
client = discord.Client()
-1votes
0answers
36views
discord.py Get channel id from name
I want to get the id of a channel or somehow access the channel from the name. Because I am making a command and the first argument of it is the channel and everything after that is what they want to ...
0votes
1answer
40views
discord.py get member object by id
I want to do something with my discord bot where it can get members by their ids, so if I had an example id 1234, I would do something like:
user = # where the way to get the user would be
# then...
...
-1votes
1answer
23views
Discord.py new member role code not working [duplicate]
I want my bot to add a role to members that have just joined; however, my code seems to not react at all. I get 0 responses on both Discord and console.
The bot's role is on the top of the role list.
@...
0votes
1answer
46views
Discord py components, interaction failed issue
So, I am having a issue with my button interactions. The first button named "Music" correctly triggers the button_click interaction and works perfectly. However, when I added a interaction ...
-1votes
0answers
21views
discord.py embed don't send on user dm
The message is not created and no error pops up in the console.
I tried to choose:
client.send
member.send
#!/usr/bin/python
import os
import discord
from discord.ext import commands
from discord....
0votes
0answers
53views
Discord Slash Message Command Not Working
I am trying to implement a discord "message slash" command https://discord.com/developers/docs/interactions/application-commands#message-commands
There doesnt seem to be any tutorials ...
-1votes
1answer
51views
Discord py read data from a google sheet
So, I currently have a command I created that will go through a text file and tell you if the content in your message is found in the txt file.
So people will do !stake (username), and it the bot will ...
0votes
2answers
46views
Python search for string from list in string
This is what i have so far:
from discord import Embed
import os
import discord
bot=discord.Client()
nichDat=["|","~",".",",","!","pls"]
@...
0votes
1answer
34views
Discord.py v1.7.3: Retrieving every embed from a channel and 'randomly' picking one to send as a message
What I'm trying to do: I am attempting to create a command that searches the history of a specific discord channel, creates an index of every embed in it, and then 'randomly' selects one. Once it had ...
-1votes
2answers
16views
How to get suggestions when writing python code (discord api)
I am making a discord bot for fun and have run into some inconvenience. For example in this function
@client.event
async def on_message(message):
When I write message. PyCharm (does this work in ...
0votes
1answer
60views
I have discord.py bot and tried the new integrations (with discord_components), but it doesn't want to listen to the selection event
Here is my color command:
@bot.command()
async def color(ctx):
await ctx.send(
"hello!",
components=[
Select(
placeholder="Pick a color&...
1vote
3answers
52views
Is there any way to convert the hex code from string to hex colour which discord.py supports?
I am trying to figure this out for so long,
but I am not able to convert the hex code from string to actual hex code like this 0xFFFFFF
since discord.py doesn't take hex code in str datatype.
Code ...
-1votes
3answers
26views
Pandas not appending values to data frame
I have a file called balance.csv. It contains user data such as their discord ID number, their account balance, and the amount of stocks that they own. I'm trying to create a simple command using ...
0votes
1answer
38views
'ActionRow' object has no attribute 'get'
I'm trying to send a message with buttons, but it gives an error
Before that, the code was in one file and worked, but as soon as I wanted to move everything to cog, this error came out
File "/...
0votes
1answer
25views
How do you make someone admin using discord.py?
I tried using this:
await name.Permissions.administrator()
but it didn't work any suggestions?
-1votes
2answers
72views
discord py bot has no attribute slash_command
That is all of the imports I have, it works on my pc however when I tried to run it on my pi4 I got the error saying no attribute slash_command, I installed all the packages I thought I needed which ...
0votes
1answer
62views
Discord py Number guess command
So, I have a number guess bot that I need some help adding on to.
How it works is that I have the command
!FinalBalance = !finalbalance (number), and based on whatever number is given it will go ...
0votes
1answer
52views
NotFound: 404 Not Found (error code: 10007): Unknown Member
@commands.command(name='rostercheck', aliases=['rc'])
async def rostercheck(self, ctx, dept_name):
for dept_name in self.roster.keys():
print(dept_name)
...
0votes
3answers
47views
discord.py problems with on_member_join()
What am I doing wrong?
@bot.event
async def on_member_join(member):
print(f"{member} join")
role_1 = member.guild.get_role(start_role_id)
await member.add_roles(role_1)
I ...
0votes
1answer
77views
AttributeError: 'NoneType' object has no attribute 'get_member'
So this is my code:
class Rostercheck(commands.Cog, name='Rostercheck'):
def __init__(self, bot):
self.bot = bot
self.roster = {
"sast" : {"roster": ...