#discord-bots
1 messages · Page 84 of 1
It makes you look like a fool no offense, given old code as "help"
This isnt even python?
Thats not python
ok but still can someone actually help me w my pasted code like fr i was playing around but stil
We already helped u
Why r u guys helping such an obvious troll lol, just ignore them
invalid syntax at 2 dots and 1 ,
troll?? im litreallyaskig for help ur to quick to assume
The dots represent the other parameters like command_prefix
You don't put them there literally
i can still send dms to bot and its still replying
those dots are to be replaced by you, like you put ur prefix and other kwargs which you mightve passed in before
dots 😔
async def luckboost(ctx):
pfp = ''
em = discord.Embed(color=800000)
em.set_thumbnail(url=pfp)
em.set_footer(text="d")
em.add_field(name= "Luckboost")
await ctx.reply(embed=em) ``` **Someone please tell me where i put the value **
which value?
ok
the em.add_field
idk what the value is

bro im so confused
value is any text
!d discord.Embed.add_field
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style chaining. Can only be up to 25 fields.
you wanna show under the name of the field
how do i make a bot ignore dms? or close dms
BRO NOW IVE GOT A ERROR IM ABT TO CRY OML
!d discord.ext.commands.guild_only
@discord.ext.commands.guild_only()```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a guild context only. Basically, no private messages are allowed when using the command.
This check raises a special exception, [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
If used on hybrid commands, this will be equivalent to the [`discord.app_commands.guild_only()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.guild_only "discord.app_commands.guild_only") decorator. In an unsupported context, such as a subcommand, this will still fallback to applying the check.
value must be a string
Here UwU is the name while the text below it is the value
also, the value has to be a string or a reference variable that points to an str object
I made a tic tac toe bot with python :P
ok
ellipsis😳
dead on
Ur acting like i know python
Ellipses seems so cool to just say 😳
reference variables aren't even a python thing y'know
it is not beginner friendly
. Why cant yall copy that and put the value in it so i can carry on to what i was doing w my bot 
Because that is spoonfeeding, here we discuss about discord bots, resolve problem/issue, help people to learn
We do not spoonfeed 
THANKSSSS
ye can yall spoonfeed me for a second
i literally gave you the docs, just read it 
where
baby!
Here a grown ashley feeding her code
and u cant ban me for that since its a medical term
@slate swan don't use ableist language
and please be less rude and annoying to people that you're asking for help
you can check out our #code-of-conduct if you have questions about our expectations
no ones actually help there just telling me to add random stuff thats giving me f* errors
you can either ask for help or not, that's up to you
following our code of conduct is not optional though
as i just said ive asked for help everyones giving me code that gives me errors
we helped you, but your python, generally coding, knowledge is not enough, you'll have to study more, and in this discord you will found people that will help you learn, but if we just give you some code that you don't even understand you will never learn
It's clear your Python ability doesn't match your ambition to create a bot. This is not a slight, Discord bots aren't considered a beginner project. May I suggest you get up to speed with something like Automate the Boring Stuff or other beginner resources.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
no
yes
Being so stubborn and ignorant wont make you any better or get you any help so please refer to the help given to you by the small group of people over being annoying to others.
Help please!?
Discord bots aren't beginner projects? I learned python through bots

How to make a bot send a embed at first then delete it?
How do imake a discord bot send a embed
idk
i told u idk how ur code works
I meant generally. I personally think a determined beginner can create a bot, but that doesn't apply to everyone.
How to make a bot send a embed first then delete it?
!e print(this_variable_does_not_exist)
@sick birch :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'this_variable_does_not_exist' is not defined
Look familiar?
How to make a bot send a embed first then delete it?
What's a more advanced project that doesn't require tons of maths knowledge
!d discord.TextChannel.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
^ it has a delete_after kwarg, use that
Please help
@slate swan discord fucked my reply sorry, here it is
whats a varabile
There’s the problem
Making discord bots is not a good idea if you don’t know what variables are
In short it’s a container that holds a value
!kindling
Kindling Projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
Neat, thanks
thanks for luck, I won in drawn or even lost position :)
Thanks so much fixed it after 2 hours of non stop no help LOL
We are helping, you’re just not very receptive, no offense
That analogy is quite horrible i must say and is quite incorrect.
Hello guys I am trying to make a command in Nextcord which helps me type thru the bot. (the command is in a cog) Whenever I run the command I get this error:
nextcord.ext.commands.errors.BadArgument: Converting to "nextcord.channel" failed for parameter "channel_id".```
And this is the code:
```python
@commands.command()
@commands.has_permissions(manage_messages=True)
async def send(self, ctx, channel_id: nextcord.channel,*,msg):
channel=self.bot.get_channel(channel_id)
await channel.send(f"{msg}")```
I know, don’t want to confuse a beginner with the actual thing
int for an ID
not nextcord.channel
No it's not.
A better definition would be a unique street sign pointing to a street
and I think it's nextcord.Channel
Since when is a variable a container?
As far as a high level programmer is concerned a box that holds a valid is good enough even if that’s not what it actually is
It has always been. You're referring to an identifier
Variables have always referred to spaces in memory which hold data.
?
If you were a rust programmer for instance, this would be much better
If you look into what he said:
a container with a value
which isnt correct, the unique identifier does point to the stack in that memory address, which is a container, yes.
And the container is called a variable. So how was he wrong
Yooo tysm, it worked. But is there a way to not always search for the id and just like type #channel
battle essays about variables
typehint channel as nextcord.Channel and don't get it via get_channel
I agree it’s not entirely correct, but the point was to explain how it can be thought of on a higher level
A container pointing to an address, meaning its a variable thats a "container" and points to a value what?
I didn't say its a container pointing to an address.
An identifier points to some space in memory. That space (container) is the variable.
You don’t need to know how references to mem addresses work, just that it holds a value to be able to use it
Yeah, robin did!?!?
You're literally proving my point, please read up on my points as maybe you misunderstood my point
i think this is not the topic of this channel 🗿
it's a container that holds a value
i.e, a variable
A variable is a unique name that points to a value, a pointer, no?
No, i would consider that as the identifier/address
Thats literally what i said
Although I suppose while talking about programming those two terms are used quite interchangeably

☺️
Variables in python are like variables in math 🗿
Just keep using synonyms of my points i dont mind
You don't have to worry about whats happening behind the scenes
bruh what are you all talking about 
e := 911
u := {e, 1, 2, 3}
j := {e, 4, 5, 6}
u ⋂ j = e
@commands.command()
async def hi(self, ctx):
await ctx.send('hi')```
why am I getting this error
TabError: inconsistent use of tabs and spaces in indentation```
!pep8
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
• PEP 8 document
• Our PEP 8 song! :notes:
only when discord bans accounts themselves
im talking ab bots banning ppl from guilds
they just use alts to join back
so for ppl who self bot ect, i need to ip ban them
you can't ipban
but it is possible, i saw bots doing that with their premium
no, u can just make an alt discord
and thats the problem i have, i got ppl joining pormoting financial scams, ppl cookie logging/ beaming server members acc
bruh what's this error pls tell me
Senev is right, bans are ip-based
what does it even mean
if they join again probably the selfbot are under VPN
bro i have like 7 discord alts
when u get banned from a guild u can just use an alt
ik, but its better than nothing if it blocks half the scammers i ban

Bruh if you want to prevent scammers and self-bot just add an Anti-nuke feature to your bot
Like a captcha verification or something
no, discord can ban users ip
true, but i got a lot of ppl manually beaming accounts
so is ip banning from my server feasible
with a discord bot

listen, when u ban a member from your discord server
it isnt an ip ban
when u report a person to discord support and that they ban them, then it is ip ban
my case is: banning scammers from my server
though they can rejoin
so im looking at possibilities to ip ban individuals
since when
did that come out last week?
then maybe, otherwise it has never been the case bruh
have u even tried yourself
u rly think i would talk ab this without knowing ppl can rejoin
bruh
but if i ip ban them, itll surely stop some
even if others use vpn
ig i can also make it so, ppl using vpns cant use the server
by collecting ips of free vpns
Bro when you ipban someone you ban that account and you don't let other people with the same ip joining the server
but if the one that has the same ip changes that ip, it will be able to join with another account
yh, but when its for serious reasons it doesnt matter
just to clarify:
let me ask you, have u ever gotten banned somewhere, and tried rejoining with an alt
i have user_1 in my guild, i ban him
now user_1 create the account user_2 and tries to join my guild with user_2, he can't because he has the same ip as user_1
Now, him joins a VPN, so his IP has now changed, now he can join the guild again using the account user_2
ok but have u ever done it yourself
the ipban doesn't mean that it bans all the users with that ip, it just bans the account that is banned, then deny the same ip to join the guild again
i have 7 alts, ive gotten banned like 10 times in places, every time i could rejoin with an alt with the same ip
what i mean is that if you check the user ban list in your guild you will only see the one banned
yall saying i dont listen but yall clearly havent tried yoursleves
and ive done it like 20 times
You tried it from a guild of yours?
ive been doing that since 2019 with a bunch of alts bruh
i got banned so often in servers
and rejoined with same ip
but if you havent done it urself why u keep contradicting me
i have 3 years of experience with what im talking ab
Let's just drop this...
Hello! I have some issue right now with my bot. "**chunk = f'{len(chunk):X}\r\n'.encode('ascii') + chunk \ **
TypeError: can't concat dict to bytes
Do you guys know what happens? (So my bost isn't responding over discord once I've type the command)
guys u can join from alt if u got bannedby using a vpn @faint sapphire
if u got banned from s erver
not even
with same ip im saying
so u agree normal ban with discord command doesnt actually ip ban
hol up where
dynobot carl bot i think
is that new?
or wick
oh u need premium right
How does that IP ban somebody?
wait i need to find this command
man u a clown at this point
this guy just confirmed
i just found carl bot has hackban
let me tell u my honest opinion , it happens that some countries have default ip ban and some dont
https://discord.com/moderation/360060487093-443:-Ban-Evasion-and-Advanced-Harassment
Discord uses IP bans to prevent users from creating new accounts, but VPNs can be used to circumvent these bans.
i think its possible to get passed vpns to get ips
can we settle that and let this channel return to it's topic now?
yes
is that doable lol
@faint sapphire dm
if they ask the vpn provider directly, then it still depends on the laws where that vpn provider is registered
Hello guys I am trying to make a command in a cog, using Nextcord and wait_for is playing with me. On this command
@commands.command()
@commands.has_permissions(manage_messages=True)
async def embedsend(self, ctx):
def check(message):
return message.author == ctx.author and message.channel == ctx.channel
await ctx.send('Waiting for a title')
title = await self.bot.wait_for('message', check=check)
await ctx.send('Waiting for a description')
desc = await self.bot.wait_for('message', check=check)
await ctx.send('Channel ID')
channel_id = await self.bot.wait_for('message', check=check)
channel = self.get_channel(int(channel_id.content))
embed = nextcord.Embed(title=title.content, description=desc.content, color=nextcord.Color.green())
await channel.send(embed=embed)```
I get this error: https://paste.nextcord.dev/?id=1663170800138361
And if someone know how to deal with it please help me I'm so stuck
can you send your full code?
it's 2k+ lines in different cogs
are you using threading/multiprocessing anywhere?
Sorry, I don't know what is that.
are you creating more than one event loop?
I think yes
could you show where (and why)
I am not sure why, but I got it in my moderation cog (where is the command) and my main.py file
This is it python asyncio.set_event_loop(asyncio.new_event_loop())
that would explain things
you should remove that, it is causing the problem
only have it in the main.py file where you're probably creating the main event loop
I get the same error If both are removed and if it's only in main.py
the error shows when I run the command
will send in dms
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Hello, i'm using discord.py library for make a bot. I'm using cogs for the music bot, but when i do command like !join !play appear an error: discord.ext.commands.errors.CommandNotFound: Command "play" is not found.
Someone can help me?
(Please tag me)
We don't help with music bots.
It violates YouTube terms of service.
And in any case this problem arises for every cog 👀
guys i need help
with my disc bot, i can use the bots loop, to couroutine a "wait 1 hour" function to run another function every hour yh?
or is it rly that much better to use another bot in a server, that sends a message
every hour, that triggers my bot to run the desired function
(dyno can send messages every hour automatically)
I can’t
but then i rely on dyno so idk
well 2 legit bots have ip ban command for premium users, bloxlink and rover
and a server using one of them, made it so i was actually ip banned
unlike others
An IP ban is a regular ban, not sure why they put that under premium lol
well other servers using carl bot, dyno, ect, never rly ban me
easy scam lmao
Fr
any opinions
Use the tasks extension
from asyncio?
No discord.py
ok
Well I guess big bots that have people connect their account to their website could get a connection between ip and the discord user to essentially ip ban you.
so i have to make 2 functions yh
one that lasts 1 hour
then the desired function
actually both in one
Regular discord bans are already IP though
Are they?
iirc they aren't.
An IP ban is not very effective because many home consumer IPs are very dynamic
this is rly weird
Yeah I can’t join any of my banned servers with an alt
yh, how prevalent are dynamic ips
The second I turn on a VPN though..
That isn't very true, yes they could but not very often.
are like 50% of routers using dynamic?
ISP dependent
Probably more.
Most home routers will because a static IP costs extra and 1) people don’t know what that is and 2) people don’t care enough to pay unless you’re self hosting
like using same wifi, same device, i could rejoin servers with alts
but in a server using ip ban premium command, with same wifi, same device, i couldnt rejoin with alt
Can you provide an example of a bot with a premium ip ban command?
As far as I know the API doesn’t take any options as to IP banning or not
rover, and bloxlink
I’ve never heard of those 2
check this though
Either placebo, bullshit, or both
rover and bloxlink are roblox based bots, they require u to go on their website to verify ur roblox acc
so thats how ig
Well in the EU it's free to assign a static IP address if you know how to in your router settings.
Probably how
Yeah like I said -> #discord-bots message
Regardless IP banning a bot account spamming your server ain’t going to do much to abate it
a guy said bans arent ip bans everywhere
so prob not in eu
Well they would also ban your roblox account so not many people would even hassle to get around it. Also we're talking about <14 people
actually youre right
theyre prob using the verified roblox accounts to determine they can rejoin
Not that, that would stop me.. i.. like to watch it burn 🐒
ok what u on ab
Double trouble.
im lost lol
how to i mention a user without ctx
Do you have their ID?
Let's just say at the age of around 12 I didn't exactly play by the rules or the intendent way to play a game.
I don’t think any of us were very intelligent at 12
member.mention
at 12, best thing i had was a nintendo ds
actually i had an archos tablet, but yh lol
member not defined
my best friend tho, was programming on a mac since he was 8 lol
You assuming my smartyness at the age of 12?
Well yeah you would need to get/ fetch the member with the id but then you can also do @languid forge
Ouch mac.
mac is okay wuab
uh ur dumb
idk his parents gave him their spare comp
Same, tbh if I were to gave gotten a mac I most likely would use a mac as well.
how do i mention a user without ctx
so theres no point for me to find a way to fetch the ip of a person i wanna ban
cause it would be exactly the same thing as discord guild bans
but those bans clearly almost never work (apparently bc they got dynamic ips)
so anyone got an idea how i could more effectively keep banned members away?
through a website ig, with cookies?
why so many ppl use slash commands
You passed the class as text, do view=view
It's gut.
True but you are passing the repr of the object since you send it as a string. So inside the ctx.response use the view kwarg to specify that what you are passing is a drop down menu.
In the console type py -m pip install discord.py\
ig with a requirements file
use heroku instead btw
replit uses poetry
idk why theres so many haters (i read the first message in discord bot hosting), but heroku is great for me
if u just a beginner its cool
ik it stops its free thing in november, but they say they have plans for student benefits
Free thing?
free working dyno hours
aka free hosting
idk bro, just use message.content lmfao
poetry add discord.py==1.7.3
slash commands arent necessary
its easier to use prefixes imo
on my phone slash commands dont work too, might be cause discord aint up to date idk
i havent manually updated it since 2020
no? slash commands have auto complete, each parameter has well defined types so user can't mess up
true
i wasnt answering to something in ur code directly, i was talking ab a diff method
and not to mention, your bot gets a cool logo when you add them 😉
Slash commands have their own GUI abstractions over prefixed message commands like how isnt that enough to know they are better?
you aren't instantiating the DropdownColours class
You use parentheses and pass the parameters required by it
Like how you call a function
Might want to check out https://youtu.be/ZDa-Z5JzLYM
In this Python Object-Oriented Tutorial, we will begin our series by learning how to create and use classes within Python. Classes allow us to logically group our data and functions in a way that is easy to reuse and also easy to build upon if need be. Let's get started.
Python OOP 1 - Classes and Instances - https://youtu.be/ZDa-Z5JzLYM
Python...
i did... instantiate the class
hi nova
how are you doing
bussin
:D
^^
what do you mean "no" lol
nvm lol why do i even bother helping people here
@client.event
async def on_member_join(member):
with open('guilds.json', 'r', encoding='utf-8') as f:
guilds_dict = json.load(f)
channel_id = guilds_dict[str(member.guild.id)]
await client.get_channel(int(channel_id)).send(f'{member.mention} welcome to the Otay! Support server! Enjoy your stay!:tada:')
@client.command(name='welcome')
async def set_welcome_channel(ctx, channel: discord.TextChannel):
with open('guilds.json', 'r', encoding='utf-8') as f:
guilds_dict = json.load(f)
guilds_dict[str(ctx.guild.id)] = str(channel.id)
with open('guilds.json', 'w', encoding='utf-8') as f:
json.dump(guilds_dict, f, indent=4, ensure_ascii=False)
await ctx.send(f'Sent welcome channel for {ctx.message.guild.name} to {channel.name}')
Saves a welcome channel but doesn't send a message when someone arrives.
'startTime is not defined'
can you show the line above on_ready?
hmm?
because you aint sending message bro
await client.get_channel(int(channel_id)).send(f'{member.mention} welcome to the Otay! Support server! Enjoy your stay!🎉')
oh im blind
enclose client.get_channel in brackets
await (client.get_channel(int(channel_id))).send(f'{member.mention} welcome to the Otay! Support server! Enjoy your stay!:tada:')
it does not change anything, it still does not send
if there were errors, I would not write here and it just isn't
do you have any error handlers
no
I just don't know what the error is
do u have member intents enabled
yes
in code and dev protal
yeah
jeff is there an on_raw for this event 🤔
No ☺️
Hey there im trying to create a command that creates a channel named Transaction, however i want it to also add a value e.g. Transaction1 if there is already a channel created called Transaction
That way there is never the same name for the new channel, it has a value added to it so it can be differentiated from the other channels
How can i go about doing this? Many thanks
is there anyway you can have a interaction last for a certain amount of time only? (timeout only works after an interaction is made, it counts down that amount of time)
I tried by doing something like so...```py
class JoinView(disnake.ui.View):
message: Optional[disnake.Message]
def check_timeout(self) -> float:
seconds = (self.end - datetime.datetime.now()).total_seconds()
if seconds < 1:
self.end += datetime.timedelta(seconds=1)
return seconds if seconds > 1 else 1
@disnake.ui.button(label="Join", emoji="📥", style=disnake.ButtonStyle.blurple)
async def button_join(self, _: disnake.ui.Button, interaction: disnake.MessageInteraction):
await interaction.response.defer()
self.timeout = self.check_timeout()
but it's very unreliable, ticks over too far, and just... it works, but if and/or when it wants to instead of should
anyone have any ideas?
(ping if/when responding please)
iterate through the servers channels and check if their name is whatever you want. If its the name just return or else you create the channel
acc nvm what i said i didnt read ur message correctly ^
Its alright ty tho
From that code of creating the channel, i want to be able to get the bot to automatically say something in the new channel, how can i go about this?
where you add the await guild.create_text_channel… assign it to a variable like channel so like
channel = await guild.create_text_channel…
then under your ctx.send just add in await channel.send() and whatever you want inside it.
Sorry if this looks weird im typing this on mobile currently so its hard asf
await
Not sure what it means by awaited
Ohh understood
np
Tyvm
np
Hey!
I am making an error message but i want it to make it so the only person who can see it is the author
Like: https://cdn.apilol.pics/ඞඞඞඞඞ
Code:
if not owner(ctx)
response
else:
code
What have you got so far?
that code
if not owner(ctx)
response
else:
code
I only see pseudo code.
It's not an if statement.
It's called ephemeral messages used by interaction.
It's added when sending a message not in the embed.
how the embed is:
await ctx.respond(
embed=discord.Embed(embed shit yk)
)
after the brackets?
thank you <3
Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory: '2.webp
Does 2.web exist?
already fixed
@cloud dawnlong time no see panda 
# Classes:
class Button(discord.ui.View):
def __init__(self) -> None:
super().__init__(timeout = None)
# Left
@discord.ui.button(label = 'Left', style = discord.ButtonStyle.blurple, custom_id = 'Left')
async def Left(self, interaction: discord.Interaction, button: discord.ui.Button):
if OCCUPIED['OWNERS'][interaction.user.id] is not None and OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('left')
# Up
@discord.ui.button(label = 'Up', style = discord.ButtonStyle.blurple, custom_id = 'Up')
async def Up(self, interaction: discord.Interaction, button: discord.ui.Button):
if OCCUPIED['OWNERS'][interaction.user.id] is not None and OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('up')
# Down
@discord.ui.button(label = 'Down', style = discord.ButtonStyle.blurple, custom_id = 'Down')
async def Down(self, interaction: discord.Interaction, button: discord.ui.Button):
if OCCUPIED['OWNERS'][interaction.user.id] is not None and OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('down')
Why does this code disable every button for 3 seconds, upon a first button being clicked?
After every other button press, it works perfectly.
Does anyone know why?
What code you have? The usual way to do it is
embed.set_image(url="https://www.linktoiamgemyreallycoolimage.com/reallycoolimage.jpg")
Looks fine, except you haven't created embed
set_image is a method of a discord.Embed object, which usually people put in a variable named embed, or something similar
You need to instantiate an object from there
uhh how can I run something when a forum post is created?
!d discord.on_guild_channel_create
discord.on_guild_channel_delete(channel)``````py
discord.on_guild_channel_create(channel)```
Called whenever a guild channel is deleted or created.
Note that you can get the guild from [`guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.guild "discord.abc.GuildChannel.guild").
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
Forums are just channels, so they fall under this event. Just isinstance
I think on_thread_create might be it. Forum channels use threads, not channels.
how do i make a welcome command in a specific channel?
async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our main chat!", delete_after=30)```
im using pycord, and my previous code no longer works...
In what way does it not work? If it's just not triggering, you may just need to enable member intents
its not triggering
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
its enabled already
same im sure goes for pycord
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = discord.Bot(intents=intents)
Try putting a print statement in the event, see if it's triggering
that code was from discord.py,
and i moved to pycord so its not working
Why did you move?
@umbral palm pls help here
For slash commands.
no errors, nothing
its just not triggering
If you copied this over and it worked before, that means the IDs have to be the same...
yeah its the same thing from my v1 code
discord.py has slash commands
i know.. but i still wanted to switch. cuz discord.py is no longer maintained
discord.py is maintained though?
It was no longer maintained, until the guy came back
that retirement was not even six months in length
yeah, was more surprised by the comeback than the retirement
eeyup
its discountinued already
According to what
search on google
because the github is still getting issues
and the master branch got merged onto like 2 days ago
it's plenty active
so how esactly do i fix this issue? in pycord
That's what I want to find out as well... it's small, so there shouldn't be that many places to look
is the code correct though?
it worked on discord.py
https://discordpy.readthedocs.io/en/stable/migrating.html
maybe because of this?
no, since the new libs came up around the time v2.0 was released
and likely implemented the planned changes as a starting point
no meaning?
no meaning it's not likely to be the source of the problem in my eyes
then how do i fix it? if there are no errors
I'm trying to figure it out
ok
At face value from the information you have given us, it looks like there could only be two issues as to why it doesn't trigger. You could either have passed the intents incorrectly, or member.guild.id is being compared to the wrong guild ID
how can i await a forum tag edit and check to see if it has a specific tag
I would suggest doing print(dict(bot.intents)) To verify intents are valid
If you 100% know it still wouldn't hurt to check
And be sure to check the id you are comparing member.guild.id too
its all correct
Can you show the output of the print?
You didn't await the bot.fetch_channel
i did?
Warning (from warnings module):
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
RuntimeWarning: coroutine 'Client.fetch_channel' was never awaited
Ignoring exception in on_member_join
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43, in on_member_join
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
TypeError: coroutine.send() takes no keyword arguments
!e
from asyncio import run
async def some_func():
return [10]
async def main():
await some_func().append(0)
run(main())
See catgal's answer
Weird
The errors don't lie
await (await fetch()).send(...)
I'm not sure if it's needed to even fetch for each member joined
The cache should be valid for the guild
Since GUILD_CREATE events
ok thanks, will test now
async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await (await bot.fetch_channel(971319830064017458)).send(f"Welcome {member.mention}, this is our main chat!", delete_after=30) #main channel```
its still not triggering
not triggering or not sending?
i realised something
i realised that i forgot to import tasks from discord.ext 😅
i have an error which includes the word tasks
might as well try importing that too lmaooo
nop
How do I complete an interaction?
Respond to it or defer it
Doesnt deferring it respond to it?
I do defer but then how come it doesnt work?
Making it fall to the point of "Respond"
@sick birch @primal token I fixed the issue of my buttons disabling 🙂
I just hadd to add interaction.response.defer() at the top
now... the only issue
is that there is a delay 😭
async def protocol(self) -> None:
while self.lost is False:
await self.move()
await asyncio.sleep(self.DELAY)
when I click a button
the thing doesn't update until after the move is done
What does the move do? How long does it take?
Here.
async def move(self) -> None:
# Update head
y, x = self.DIRECTIONS.get(self.direction, (0, 0))
self.head = (self.head[0] + y, self.head[1] + x)
# Loss detection
if self.head[0] < 0 or self.head[0] > (self.COLUMNS - 1):
self.lost = True
await self.CTX.channel.send(f'You lost! Your score was: {self.score}')
return None
elif self.head[1] < 0 or self.head[1] > (self.ROWS - 1):
self.lost = True
await self.CTX.channel.send(f'You lost! Your score was: {self.score}')
return None
# Apple eating
if self.head == self.apple:
self.body.insert(len(self.body) - 1, self.previous_head)
self.generate_apple()
self.score += 1
# Body trail
self.body.insert(0, self.previous_head)
previous_body = self.body.pop()
self.board[previous_body[0]][previous_body[1]] = ':black_medium_square:'
self.previous_head = self.head
# Update board
self.update_board()
await self.post(edit = True)
This is the function that changes direction.
Does it take a significant amount of time? Should only be a second or less right?
async def update_direction(self, direction: str) -> None:
# Guardian statements
if self.check_direction(direction) is False:
return None
self.direction = direction
if self.started is False:
self.started = True
await self.protocol()
The direction change should be instant, but the movement should have a delay to give time for the user.
await asyncio.sleep(self.DELAY)
you have a delay set here, that's why your button won't update until this is done. I'm not fully understanding the issue at hand though
Okay, I'm sorry for not explaining it well.
I get that there is a delay
but is there a way to make the direction update instantly, so that its not affected by the delay?
It theoretically shouldn't since it's before the asyncio.sleep()
hmm
Do you want to test it out?
Weird question, I know, but maybe that'll help explain it? Maybe I'm not doing it right
I dunno. I'd rather have you just explain it
Okay, let me see if I can try to explain it better, again I apologize for how stupid I am.
No no, just a failure to communicate. If you can explain the problem I'll try my best to assist
Okay I got it!
Basically, when I press a button,
It takes like 1 second to respond, and there are random delays in the game for some reason.
I do edit the message every 0.75 seconds, is that an issue? (This is only for one or two servers)
Yeah rate limits
I do believe you only get 5 message edits per 5 seconds
I want the game to be uh.. as accurate to the real snake as possible, bt I get that discord is not the best game engine
Ah okay, so 1 edit a second?
Probably a bit more just to be safe
Or you could do a thing where the snake moves each time you press a button, might be better. Design choice so it's up to you though
I did the one where it moves each time you press a button 4 times, but each time I had a tester they said that was weird.
so I'm trying to make it as accurate as possible to real snake.
RIGHT NOW IT WORKS PERFECTLY, so thanks robin 🙂
You were a huge help in my discord.py journey!
My pleasure. Let me know if there's anything else I can help with 😄
🙂 ❤️ Have a good night or day depending where you are from.
Thanks. I've been having a rough day, that really helped
Guys how can I make my bot collect reactions from comamnd user till 2 minutes?
Wow looks good game 👍
If your snake goes to top and if you press top arrow do it gives game over?
yes.
Oh cool
Whats the maximum discords my bot can be in before I am forced to use slash commands?
100 iirc
ik this is for intents but does that apply to / cmds?
At 100 you're required to get your bot verified if you want the message content intent, if you don't have a valid reason for it then you have to switch to slash commands
gotcha, thnx
im trying to migrate my bot to my pc. what does Import "import name" could not be resolved Pylance(reportMissingImports) mean?
its giving me this error, even though i installed the modules through shell. how do i fix this?
!pypi keep_alive
Is this what you're using? Are you sure it's installed?
Did u do pip install keep_alive or pip install keep-alive
i did pip install keep_alive in my shell
windows command prompt
says requirement already satisfied
!dashmpip
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
And then run your python script with python script.py
What python verssion u usng
code:
@bot.event
async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
await bot.fetch_channel(987268323731439646).send(f"{member.mention}, pls check out these giveaway channels!", delete_after=30) #giveaways info channel
await bot.fetch_channel(971319847352950835).send(f"Welcome to the server! Please do remember to get reaction roles in #⟡💫・reaction-roles channel!") #main chat
error when someone joins:
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
TypeError: coroutine.send() takes no keyword arguments
now ive migrated to pycord, and im using slash commands
pls help here with my code
Didn't you just ask this like yesterday?
cuz i didnt figure it out
I did a Google and it look like it's get_channel not fetch_channel
You're awaiting the send() but not the fetch_channel
get and fetch are two different methods, get does a lookup within the internal cache, if it founds the required object, then the object is returned
fetch is an API call
@bot.event
async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await (await bot.get_channel(971319830064017458)).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
await (await bot.get_channel(987268323731439646)).send(f"{member.mention}, pls check out these giveaway channels!", delete_after=30) #giveaways info channel
await (await bot.get_channel(971319847352950835)).send(f"Welcome to the server! Please do remember to get reaction roles in [#971319865623318528](/guild/267624335836053506/channel/971319865623318528/) channel!") #main chat
is it like this?
Yeah, like that
No
ok then ill ask my friend to help, thanks anyways
interesting, I always wondered why
await (await bot.get_channel(971319830064017458)).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
TypeError: object TextChannel can't be used in 'await' expression
https://github.com/DisnakeDev/disnake/blob/master/disnake/client.py#L1241-L1254 get
https://github.com/DisnakeDev/disnake/blob/master/disnake/client.py#L2214-L2266 fetch
get_channel is not a coroutine
so how do i fix it?
@bot.event
async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await bot.get_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
await bot.get_channel(987268323731439646).send(f"{member.mention}, pls check out these giveaway channels!", delete_after=30) #giveaways info channel
await bot.get_channel(971319847352950835).send(f"Welcome to the server! Please do remember to get reaction roles in #⟡💫・reaction-roles channel!") #main chat
so is it like this?
Ye
u sure this will work?

it works thanks so much @naive briar
ballresponses = ['It is certain',
'It is decidedly so',
'Without a doubt',
'Yes, definitely',
'You may rely on it',
'As I see it, yes',
'Most likely',
'Outlook good',
'Yes, signs point to yes',
'Dont count on it',
'My reply is no',
'My sources say no',
'Very doubtful',
'Reply hazy, try again',
'Ask again later',
'Better not tell you now',
'Cannot predict now',
'Concentrate and ask again']
@bot.slash_command(name="8ball", description="ask anything!")
@commands.cooldown(1, 10, commands.BucketType.user)
async def eightball(self, question):
await ctx.respond(random.choice(ballresponses))
error:
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NameError: name 'ctx' is not defined
You didn't define ctx
And u dont have ctx in a slasg command anyways
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
did u finally learn about lists?
is it like this
@bot.slash_command(name="8ball", description="ask anything!")
@commands.cooldown(1, 10, commands.BucketType.user)
async def eightball(ctx, self, question):
await ctx.respond(random.choice(ballresponses))```
like this?

Btw @placid skiff while converting that Java code, did u get Overflow errors? 👀
He's using py-cord
Because sized arrays
Idk why they call it ctx
Because it's... py-cord
so how do i fix it
True 🤠
fixed it already thanks
async def eightball(ctx, question):
Yup, i had to do this essentially to make them "adimensional"
public void adimensionalArrays() {
int totalLength = 0;
File dist = new File("some_dist/");
File[] toSearch = dist.listFiles();
while(toSearch.length != 0) {
File nextFile = toSearch[toSearch.length -1];
toSearch = removeValue(toSearch, nextFile); //This is a method that i used to remove the last element from the array, it returns the same array without that elemet
if(nextFile.listFiles().length != 0) {
totalLength = toSearch.length + nextFile.listFiles().length;
File[] toAdd = nextFiles.listFiles();
File[] result = new File[totalLength];
System.arraycopy(toSearch, 0, result, 0, toSearch.length);
System.arraycopy(toAdd, 0, result, toSearch.length, toAdd.length);
toSearch = result;
}else{
//The rest of the code
}
}
}
Thanks for the overflowing information I have lost the ability to understand anything now
Now you've lost years of experience too
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
em = discord.Embed(title=f"Hey, please slow it down!", description=f"Try again in {error.retry_after:.2f}s")
await ctx.respond(embed=em)```
this isnt working
instead of letting it send "application did not respond"
when user on cooldown, i want it to send this embed
pls help here
btw this reminded me when I had to handle the millis overflow with an Arduino Nano 
I had a sort of timer handled with the uC internal timer, so I made a function to check, when the millis goes overflow, if x time was passed from max_internal_timer to actual_internal_timer smth like that
It's because another error is raised but you are not handling it, you are only handling one exception ignoring all the others.
You will need to add an else statement that will handle all unhandled exception, using this code to get the traceback of the error
import sys, traceback
#your code
else:
print(f"Ignoring exception in {ctx.command.name}", file=sys.stderr)
traceback.print_exception(type(e), e, e.__traceback__, file=sys.stderr)
await ctx.send("An unknown error occurred while executing this command")
Then you can check your console for the full traceback
wat
Probably he wanted to mention me 

Anyone wanna help me test my discord bot? Note: you will be invited to a server. If so please dm me
oh
@vocal plover ^^^
import requests
t = ''
url = 'https://discord.com/api/v10/users/@me'
print(f'Authorization: Bot {t}')
print(requests.get(url, headers={'Authorization': f'Authorization: Bot {t}'}).json())
im trying to get the current users info
t is the bot token
{'message': '401: Unauthorized', 'code': 0}
I don't think you have to put Authorization: there
headers={'Authorization': f'Bot {t}'}
it works
How to add custom emoji from a server that has the bot into SelectOption?
who is they
I dont have time to read a ton of messages of context 
See the image above it
So the question being asked is why the word 'ctx' is used in commands?
in slash commands, in py-cord lol
It's easier to just ask me what you want to know rather than sending me on a game of cat and mouse looking for messages
its an ApplicationContext ez
idk I don't use or maintain pycord
my assumption would be that people are familiar with it so they keep using it
I've never touched pycord's code
mb sorry
how to send a message as embed?then it delete itself then apears another embed
Guys i want to make a game in my discord bot
Can anyone give me suggestion?
terrible attempt at changing the subject but it worked i guess
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response.
</body></html>
: 0```
@commands.command()
async def status(self, ctx):
r = requests.get("http://iphere/players.json")
data = r.json()
players = data["players"]
embed = discord.Embed(title="UCRP FiveM Status", description="UCRP FiveM Status", color=0x00ff00)
embed.add_field(name="Players", value=players, inline=False)
print(players)
await ctx.send(embed=embed)
Pls anyone suggest me idea
snake game, 3D renderer
tic tac toe
hi im making a discord bot and this is my embed
@bot.command()
async def payments(ctx, member:discord.Member = None):
if member == None:
member = ctx.author
name = member.display_name
avi = member.display_avatar
embed = discord.Embed(title="Payment Methods", color=discord.Colour.dark_purple())
embed.add_field(name="PayPal", value="  ``simonmorari@gmail.com``", inline= False)
embed.add_field(name="Bitcoin", value="``17CneTWFPa1kfpAE1fL7TLV2g8hLgiJX1z``", inline= False)
embed.add_field(name="Ethereum", value="``0xF39eF56a40b9BCadafc7e088499149970Fa75073``", inline= False)
embed.add_field(name="Litecoin", value="``ltc1q2qkfakfzua4mawjt76lgvdwf79wnnrlwrupgaw``", inline= False)
embed.add_field(name="Bitcoin Cash", value="``qpzqkmhcap5pltzskd3cr4tgn52a4xey2gm9mq3gaw``", inline= False)
embed.add_field(name="Monero", value="``43eJkg3f9PqEsazFjEnDX1dib6AVJiBrtdCq5VmvJVyUghDtTTV5N1i2ZPBpxkom9UUtu6kkATN6wQ8YMpgB7AH8PizoDot``", inline= False)
await ctx.reply(embed=embed)
bot.run('token removed for safety')``` and you can see im trying to put custom emoji in the footer for paypal but this is what it shows when command is ran ":Paypal : blah blah blah it doesnt show the emoji
Whats 3d renderer?
it's an error with the response of the request, http 502 means that the server where you sent the request had timeout or the response has errors
I was joking about the 3D renderer
I can try making tic tac toe
Yesterday i had a dream that i made a flappy bird game in dpy
do it
Floppy bird very hard to make?
!d discord.Guild.get_emoji get the emoji with this and then just cast the value that you get to a string emoji = guild.get_emoji(12345), send(str(emoji))
depends on your experience
assuming by your past messages it would probably be really hard for you
its a fiveM server ip
!d discord.ext.commands.Bot.get_emoji
get_emoji(id, /)```
Returns an emoji with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
yeah but it is a problem with that, your command doesn't have anything wrong
errors
bruh really?
yea
guild must be a guild object (discord.Guild), the id must be a valid emoji id and send is the method of the channel or the context (discord.TextChannel, discord.ext.commands.Context)
and the method is this
And maybe if i made game it can get me tooo many requests api error
mhm
what
im new idk what ur saying
!resources then you should study this first. discord.py is not beginner friendly
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I want to make snake game
Can you help me?
I mean not to give me code
I just need some help
How can I make the game board?
Hello, is it possible to pass a lists on args of a slash commands ?
something like when we pass async def member(ctx, member: discord.Member) but replace member with a lists ?
you mean that you want to take a list of members for example?
it is not possible either for a slash commands or a message command, with the slash you will have to take a string, tell the user that he has to mention one or more member, then use the split method and try to convert that mentions to a Member object, with the message command is pretty the same except for the argument that you set in the command
Greedy should work imo
Slash commands don't support variadic arguments out of the box
yes exactly, like name ["", "", "", ""] et pass it on args of a commands
i try it but TypeError: unhashable type: 'list'
it does lmao, but you will have a lot of checks to do
Or you can try to ask the user to send something like this and then use the builtin method eval to get the list
!e
print(eval("[' ', ' ', ' ', ' ']"))
@placid skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
[' ', ' ', ' ', ' ']
but you will need to get a string anyways, and then convert the string to a discord object
eval 👀
i've suggested, now is up to him 
???

oh that's not I want but thanks
I was going to reply to him with a for loop in asm
ok tarsier
why not just make a custom converter lmao
It's the same thing, with a converter you will just have a converter that does it lmao
but anyways you will have to convert n strings to objects
really easy, but ok
I didn't want to make you feel dumb 
Except that who will use the command could be dumb and you have to make the command foolproof 
that depends on how far you can think of
My teacher taught me to think as the dumbest person in the world 
understandable why
File "c:\Users\rifat\Documents\Code\Discord Bots\mikkellind\cogs\example_cog.py", line 40, in confirm_button_callback
await user.add_roles(role)
AttributeError: 'User' object has no attribute 'add_roles'
why does inter.author.add_roles(role) not work?
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
user = inter.author btw
disnake
because inter.author is returning a User object and Users are NOT associated with servers and there are no roles without servers either. You need a Member object in order to add roles.
the command that raised the error lmao
Yeah the command the user sent is via private dm's with the bot
anyway to get past this issue?
oh so that's why
@commands.slash_command()
@commands.dm_only()
async def pro(self, inter:disnake.CommandInteraction, email):
if db.check_if_pro_role_request(inter.author.id) is True:
await inter.send(f"You already sent a request. Wait for an admin to review your request", ephemeral = True)
return
db.add_pro_role_request(inter.author.id)
user = inter.author
channel:disnake.TextChannel = self.bot.get_channel(config.CHANNEL_ID)
approve_button = Button(label="Confirm", style=disnake.ButtonStyle.green)
deny_button = Button(label="Deny", style=disnake.ButtonStyle.danger)
view = View()
async def confirm_button_callback(interaction:disnake.CommandInteraction):
#### Embed you want to send
embed = disnake.Embed(description = f"Your request has been accepted by {interaction.author.mention}", color = disnake.Color.green())
####
await inter.author.send(embed=embed)
approve_button.disabled = True
deny_button.disabled = True
embed = disnake.Embed(description = f"Pro role request", colour = disnake.Color.blurple())
embed.add_field(name = f"User ID: {inter.author.id}", value = f"User:{inter.author.mention}\nEmail: {email}\nhttps://test.tld/{email}")
embed.set_author(name=f"{inter.author.name}", icon_url=inter.author.display_avatar)
embed.set_footer(text = f"Request has been approved by {interaction.author.name}#{interaction.author.discriminator}")
await interaction.response.edit_message(embed=embed, view=view)
role = interaction.guild.get_role(config.ROLE_ID)
print(role)
await user.add_roles(role)
db.remove_pro_role_request(inter.author.id)
if the user cast the command in the guild it will return the member
oh is dm_only
then you will have to convert that user into a member
How can I?
!d disnake.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
Btw, no, d.py maybe, disnake is not stupid, if the command is casted in a guild it returns the member object 
.author should automatically return a Member if it was a guild context tho
you'll have to manually get/fetch the guild Bot.get_guild and then get/fetch the member from that guild Guild.get_member
!d disnake.Interaction.author
The user or member that sent the interaction.
when did I say it returns a User object in guilds
the user "or member" 🦀
don't know, you have emphasize USER so i taught of that 
ahh fair enough, ty
yeah makes sense,
I tried this but gave me
AttributeError: 'User' object has no attribute 'guild'
so ashley i believe will work
yeah you will need a guild object 
"ashley I believe will work" that sounds so wrong lmao
so I can use autocomplete
discord.ext.comands.Bot
wlcm
if you have subclassed the Bot class then it is that class, otherwise disnake.ext.commands.Bot
where do you think you most commonly use self.bot within a class in disnake smh
you use self.bot in cogs too 
where else do you guys use it 💀
await interaction.response.edit_message(embed=embed, view=view)
role = interaction.guild.get_role(config.ROLE_ID)
print(role)
guild = self.bot.get_guild(inter.author.guild.id)
member = guild.get_member(inter.author.id)
await member.add_roles(role)
db.remove_pro_role_request(inter.author.id)
This is what I have but it's not really working
guild = self.bot.get_guild(inter.author.guild.id)
AttributeError: 'User' object has no attribute 'guild'
wait im dumbasf
interaction.guild_id mb
where else do you use it fr 💀 sarth has a point
What the
tvrsier is very helpful yes
I literally can't type tvrsier properly in the first try but works with an a instead of v smh
very informative
i think that my nickname is older than you 
Any bot idea I can work on? or can contribute to any not so advanced python project
no
yes very old
nah it's not that old, but it has more than 10 years so far 
cringe
You can't say that it is cringe, you don't even know what a tarsier is 
Cuz it is cuuute
lmao
lmaoo
lmao
speak of the devil
?
nuthin ☺️
imagine laughing at yourself
But i'm not him......?
wasn't pointing you out
But you're directing a point undirectly?!?
we arent talking about u dw
^
ok
yeah, people here only talk about me, or hunter, or sarth, or okimi 
Yeah, its weird how they talk all about them but never actually care about them, its odd and weird

btw, that's because i'm a joke 
jokes are supposed to have a meaning
OH ROASTED
if you want it on the right you'd have to draw it on the image itself and make it wider
also, how the heck are you planning to make snake work on discord?
snake game
I already have, want to try it?
It's kinda bad... but I'm still trying 😦
i mean, at scale my man
Oh no, this is only for 2 discord servers.
It's just a personal project
sure
They're supposed to have a punch line which is a point that has humor in it.
ok noid
Yeah indeed, I've been working a lot and now I'm going to school again, last year for graduation. Serious business, on top of that I also work 1 day.
Tryna make a HackBan Cmd. Here's the code:
@commands.command(name="hack-yeet")#, description="Usage: Ban @user")
@commands.has_any_role("Shuma ヽ(💢`Д´)ノ︵ ┻━┻","Head Administrator 🌪" , "Administrators 🗝", "ꔫ・˚꒱Staff ° .", "≧ω≦")
@commands.has_permissions(administrator=True)
async def HackYeet(self, inter, user: int, reason='No Reason provided'):
guild = disnake.Guild
if user in guild.members:
embed = disnake.Embed(title="", description=f":RAB: Kant be Kicced as User is in Server", colour = disnake.Colour.random())
await inter.send(embed=embed, delete_after=10)
else:
await inter.guild.ban(disnake.Object(user), reason=reason)
embed = disnake.Embed(title="", description=f"**:PAL: Reason: __{reason}__**", colour=disnake.Colour.random())
embed.set_image(url= "https://cdn.discordapp.com/attachments/953108903049191424/1011220166232780830/BanHammer_2.gif")
await inter.send(embed=embed, delete_after=30, content=f":BanHammer: <@{user}> has been Yeeted with a Ban Hammer")
And here's the Error:
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: argument of type 'property' is not iterable
What I'm trying to do here is check if the user is in the server. If User is in server returns True, then it will send the Code in the if statement there. How can I make that work out?
Also, don't mind the Inter in the parameters. Will convert it to Slash Cmd after I fix this
Good to know I'm not the only one sticking around, al tough I've not seen someone here as long as me besides staff members.
Full error?
Ignoring exception in command hack-yeet:
Traceback (most recent call last):
File "C:\Users\Alliah\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\disnake\ext\commands\core.py", line 172, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Alliah\Desktop\VS Code\Neko-Nyan\Testing\TestCmds.py", line 55, in HackYeet
if user in guild.members:
TypeError: argument of type 'property' is not iterable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Alliah\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\disnake\ext\commands\bot_base.py", line 578, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Alliah\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\disnake\ext\commands\core.py", line 914, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Alliah\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\disnake\ext\commands\core.py", line 181, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: argument of type 'property' is not iterable
Ah well yeah but why are you checking if the user is in the guild?
It's so that the bot won't be banning admins lol.
It's a replacement for this piece of code
if member.guild_permissions.administrator or member.top_role >= inter.author.top_role: — Since this won't really work since User: int has no such attributes
The bot will just ban users even if they're admins if that piece of code is not implemented
Why not use a member converter by typehints? I also recommend consistency on those.
from disnake import Member
@commands.command(name="hack-yeet")#, description="Usage: Ban @user")
@commands.has_any_role("Shuma ヽ(💢`Д´)ノ︵ ┻━┻","Head Administrator 🌪" , "Administrators 🗝", "ꔫ・˚꒱Staff ° .", "≧ω≦")
@commands.has_permissions(administrator=True)
async def HackYeet(self, inter, user: Member, reason: str = "No Reason provided"):
if not member:
await inter.send("This member could not be found.", delete_after=10)
...
I'd also typehint inter but I don't know the object rq.
This works since the Member object is an object converter when type hinted in a command decorator.
I think -> disnake.Interaction or : disnake.Interaction.
Will try this one. See if it works
!d disnake.ext.commands.MemberConverter
class disnake.ext.commands.MemberConverter(*args, **kwargs)```
Converts to a [`Member`](https://docs.disnake.dev/en/latest/api.html#disnake.Member "disnake.Member").
All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.
The lookup strategy is as follows (in order)...
These converters also exists when type hinting: Flag, Game, Role, User, Emoji, Guild, Colour, Invite, Member, Thread, Message, Permissions, TextChannel, ForumChannel, GuildChannel, GuildSticker, PartialEmoji, StageChannel, VoiceChannel, PartialMessage, CategoryChannel, GuildScheduledEvent
Will look into these later. Thanks! Appreciate the help.
But since you can also get another object if you really want to follow the book a member typehint would look something like this.
from disnake import Interaction, Member
@commands.command(name="hey")
async def test(self, inter: Interaction, member: Member | None, reason: str = "No Reason provided") -> None:
...
| meaning or ... and -> None: meaning the return keyword doesn't return anything in the function, aka void.
Python 3.10 else it's member: Optional[Member] = None -> from typing import Optional
np if you run into any issues further, most people here would take the time to help, you can also ping me but I don't guarantee a quick response.
yeah, they're pretty cool. Really appreciate the help though. For now, I'll try out what u told me
How to get the mentioned participant in interaction?
How is this participant defined?
Well .... at the mention should. i just found interaction.user
How do I get a discord user's username from their ID
is that possible?
cannot import name 'handle_message_parameters' from 'discord.http' (C:\Users\antho\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py)
File "C:\Users\antho\OneDrive\Bureau\scrap\ebay.py", line 1, in <module>
import discord```
I don't understand this error if someone can help me (first time it happened to me)
!d discord.Client.fetch_user
await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Note
This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.get_user "discord.Client.get_user") instead.
Changed in version 2.0: `user_id` parameter is now positional-only.
hmm
Can you give me an example of how do use it?
what is the code for giving a person a role? cant seem to get it......
user = await client.fetch_user(id)
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
I don't have client
then what do you have
tank u tank u
class Bot(commands.Bot):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
async def setup_hook(self) -> None:
self.tree.copy_global_to(guild = discord.Object(id = 994773768482336828))
await self.tree.sync(guild = discord.Object(id = 994773768482336828))
self.add_view(Button())
I use commands.Bot not discord.Client
???
would it still work for both?
commands.Bot inherits from discord.Client
you have to download discord.py from commandprompt
yes
just open it and type pip install discord
its usual walk though
do you have any third party libraries installed
ah okay thanks.
Basically me when I asked a question got confused, asked again, still confused but ah okay.
hmm it's possible
but I couldn't say which ones
No, I got it
Oh okay. lol
@vocal snow Just making sure, this returns the user object, correct?
So I'd still have to do User.name?
it doesn't change anything
can you send your code, just to make sure?
ye
kk
import micromania
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='/', intents=intents)
@client.event
async def on_ready():
print('le bot est prêt !')
client.run('token')
@slate swan
pip freeze and check
what code editor are you using?
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
@vocal snow
visual studio code
yes?
is there an underline under import discord?
I'm sorry but scraping ebay is against their terms of service.
@vocal snow I am also sorry to keep pinging you but
@Host.tree.command()
async def leaderboard(interaction: discord.Interaction) -> None:
toPost = ''
for ID in SCORES:
person = Host.fetch_user(ID)
toPost += person.name + ': '
toPost += str(SCORES[ID]) + '\n'
await interaction.response.send_message(embed=discord.Embed(
title='Leaderboard:',
colour = 0xf7df05,
description=toPost
))
toPost += person.name + ': '
AttributeError: 'coroutine' object has no attribute 'name'
is it not .name?
fetch_user is a coro, you need to await it
ahh im so stupid man
why scraping ebay?
no
ohhhhhhhh roasted, gj for catching that
haa yes that no I am not scrap ebay at all it was before I just wanted to test something but it did not work
Okay just letting you know.
OK LAST THING GUYS
IM SO FUCING SORRY TO BUG YOU ALL BUT AFTER THIS, IM DONE!
@Host.tree.command()
async def snake(interaction: discord.Interaction) -> None:
"""Play snake on discord!"""
# Miscellaneous:
CTX = await commands.Context.from_interaction(interaction)
GUILD_ID = interaction.guild.id
NEED_CHANNEL = PERMISSIONS.get(GUILD_ID, False)
# Main:
if NEED_CHANNEL is True:
# Guardian statements:
if CTX.channel.id != SETTINGS.get(GUILD_ID, 0):
return
if OCCUPIED['GUILDS'].get(GUILD_ID, False) is False:
OCCUPIED['GUILDS'][GUILD_ID] = True
OCCUPIED['OWNERS'][interaction.user.id] = Snake(CTX)
await OCCUPIED['OWNERS'][interaction.user.id].initiate()
else:
await interaction.response.send_message('Sorry, this command is already being used by someone else in your server.', ephemeral = True)
else:
if OCCUPIED['GUILDS'].get(GUILD_ID, False) is False:
OCCUPIED['GUILDS'][GUILD_ID] = True
OCCUPIED['OWNERS'][interaction.user.id] = Snake(CTX)
await OCCUPIED['OWNERS'][interaction.user.id].initiate()
else:
await interaction.response.send_message('Sorry, this command is already being used by someone else in your server.', ephemeral = True)
Ok you see that 1 command?
When I use it, it pops up an embed but it does it in a class, which means it does not respond
What is wrong with interaction.channel and interaction.user.id lol
nothing is wrong with it
I use it
Ohhh
I see now, well I can change it if you want
I need it for the class
I don't understand "it pops up an embed but it does it in a class".
Like the repr inside of the embed..?
Okay basically the snake game is in a class
I send the CTX
it uses the CTX to post embeds and edit them
if I send an interaction, I wont be able to edit the message or have it returned to me.
I need the message instance
it's just easier to use CTX in that case.
I see a lot of dupe code lemme clean it up first.
ok
@Host.tree.command()
async def snake(interaction: discord.Interaction) -> None:
"""Play snake on discord!"""
# Miscellaneous:
CTX = await commands.Context.from_interaction(interaction)
GUILD_ID = interaction.guild.id
NEED_CHANNEL = PERMISSIONS.get(GUILD_ID, False)
# Main:
if NEED_CHANNEL and CTX.channel.id != SETTINGS.get(GUILD_ID, 0):
return
if not OCCUPIED['GUILDS'].get(GUILD_ID, False):
OCCUPIED['GUILDS'][GUILD_ID] = True
OCCUPIED['OWNERS'][interaction.user.id] = Snake(CTX)
await OCCUPIED['OWNERS'][interaction.user.id].initiate()
else:
await interaction.response.send_message('Sorry, this command is already being used by someone else in your server.', ephemeral = True)
code:
def __init__(self):
super().__init__(timeout=None)
@nextcord.ui.button(label="Accept", style=nextcord.ButtonStyle.blurple, custom_id="Accept")
async def Accept(self, button: nextcord.ui.Button, interaction: nextcord. Interaction):
embed = nextcord.Embed(
title="Application Accepted",
description="The role the person is applying for is now added", color = nextcord.Color.from_rgb(3,200,255)
)
await interaction.channel.send(embed=embed)
@bot.slash_command(description="Opens the application menu and perform actions on an application", guild_ids=[948651326865285171])
async def appliction(ctx):
embed=nextcord.Embed(
title=":construction_worker: Application Menu",
color = nextcord.Color.from_rgb(3, 200, 255)
)
embed.add_field(name="Applicant", value=f"{ctx.user.mention}")
embed.add_field(name="Applying for", value=f"Role")
embed.add_field(name="Status", value="Pending")
embed.add_field(name=":white_check_mark: Accept Application", value="Accepts the person")
embed.add_field(name=":x: Deny Application", value="Denieds the persons application")
embed.add_field(name=":wastebasket: Close Appication", value="Closes the application")
await ctx.send(embed=embed, view=accept)```
Error:
```missing 1 required positional argument: 'self'```
Please help! i been sitting with this 2 days now.
I think it another error to
class accept(nextcord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@nextcord.ui.button(label="Accept", style=nextcord.ButtonStyle.blurple, custom_id="Accept")
async def Accept(self, button: nextcord.ui.Button, interaction: nextcord. Interaction):
embed = nextcord.Embed(
title="Application Accepted",
description="The role the person is applying for is now added", color = nextcord.Color.from_rgb(3,200,255)
)
await interaction.channel.send(embed=embed)
@bot.slash_command(description="Opens the application menu and perform actions on an application", guild_ids=[948651326865285171])
async def appliction(ctx):
embed=nextcord.Embed(
title=":construction_worker: Application Menu",
color = nextcord.Color.from_rgb(3, 200, 255)
)
embed.add_field(name="Applicant", value=f"{ctx.user.mention}")
embed.add_field(name="Applying for", value=f"Role")
embed.add_field(name="Status", value="Pending")
embed.add_field(name=":white_check_mark: Accept Application", value="Accepts the person")
embed.add_field(name=":x: Deny Application", value="Denieds the persons application")
embed.add_field(name=":wastebasket: Close Appication", value="Closes the application")
await ctx.send(embed=embed, view=accept)
@slate swan So the message doesn't get send here, can you see inside the Snake class where the message does get send?
# Post
async def post(self, edit=False) -> None:
self.update_board()
if edit is False:
self.generate_apple()
self.update_board()
embed = discord.Embed(
description=self.generate_board(),
colour = 0x05f138,
title = f'{self.CTX.author.name}\'s Snake Game',
)
self.instance = await self.CTX.channel.send(embed=embed, view = Button())
else:
embed = discord.Embed(
description=self.generate_board(),
colour = 0x05f138,
title = f'{self.CTX.author.name}\'s Snake Game',
)
await self.instance.edit(embed=embed, view = Button())
Since interaction doesn't really allow for rapid edits, it does have an edit from original message.
What exactly does it send?
It sends this
Please provide the full traceback.
Does it get edited once a button has been pressed?
it edits every 1 second after a button is pressed
mean this
Traceback (most recent call last):
File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 820, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\discordBot.py\Virus.py", line 204, in appliction
await ctx.send(embed=embed, view=accept)
File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\interactions.py", line 523, in send
return await self.response.send_message(
File "C:\Users\josep\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\interactions.py", line 836, in send_message
payload["components"] = view.to_components()
TypeError: View.to_components() missing 1 required positional argument: 'self'
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: TypeError: View.to_components() missing 1 required positional argument: 'self'``` ?
I'm failing to see the issue lol I can see a snake game there.
Nono it works 🙂
Wait im so sorry my mind is foggy
Did I say there was an issue
Also thanks for polishing my code
I have a quick question Panda
last line py await ctx.send(embed=embed, view=accept) you need to initialize the class so ```py
await ctx.send(embed=embed, view=accept())
Yes?
