#discord-bots
1 messages · Page 774 of 1
seems like an internat error to me
do you use any other 3rd party library with it?
try reinstalling disnake
oh
how do i check what version is installed?
for disnake ?
disnake.__version__
>>> import disnake
>>> disnake.__version__
'2.2.1'```
looks good to me
Update to 2.3.0 maybe?
disnake/abc.py lines 1370 to 1372
channel = await self._get_channel()
state = self._state
content = str(content) if content is not None else None```
pip install --upgrade disnake
@slate swan Hey uh about multiple Nones in the input
I remember now.
async def addtrigger(self, ctx, trigger: str, title: str, description: str, color: discord.Color = None,
allowed_roles: commands.Greedy[discord.Role] = None,
channels: commands.Greedy[discord.TextChannel] = None):
Now that I think of it, you cant have more than 1 None right? Because how would it know which one is None.. How would I do this?
When I run it, if color is none the roles and channels might not be none
Idk how to explain it better
here , trigger , title , description and color become required args , the allowed_roles is optional and continues until it is able to convert roles
after that if its a channel , its fine , else an error would be raised
Right, so I cant have Roles as none but channels as certain channels right?
you can either have both None , or role exist but channel not
is this okay?
Cant I have role not exist but channel exist?
Is there an alternative way to do this?
role + channel : 
role : 
no role + no channel = 
no role + channel : 
The syntax of hikari just seems weird
Thanks
its just hard , and no doubt its better typed than other libraries so idts the syntax can be weird
also its around 2 times faster than generic dpy
Also, how do I save the discord.Color to my database since I get the error
InvalidDocument: cannot encode object: <Colour value=0>, of type: <class 'discord.colour.Colour'>
what does it mean to be better typed?
typehintings and other related things
hmm
!d discord.ext.commands.Context.bot
The bot that contains the command being executed.
this says it returns the bot object , but the return type isnt even typehinted
is typehinted as BotT instead
another things which makes hikari different from others is full/most acess to the cache and its settings
luckily I don't understand anything about the cache
unluckily dpy is a library highly dependent over cache
That is a typevar which is bounded to Bot or AutoShardedBot
yea but it still doesnt help with acessing the properites in a ide or editor
i noticed it later ^
that's not it's use case either tho ¯\_(ツ)_/¯
its actually defined in the __init__ of context object , excpected it to be a property function
still get this after updating
why a property
if you're a weird person like me you wont pass bot to the __init__ in a cog
:loading:
edits
But why tho, that's a design "limitation" (Which it clearly ain't), but how will you get access to your Bot object instead of creating new one
any idea? @slate swan
context.bot 
do you use any 3rd party library along with disnake?
context.bot in events? sure 
Anyone?
i have a single events cog
.
youre' making a discord.Embed in disnake
change discord to disnake
ohh
Why you have both disnake and discord in the same file 
If you really want to use the discord name just import disnake as discord
Shiki ryougiiiiii
@slate swan thanks!!!!
man of culture
😳
Also Edmond 
Best waifu
how to create url button? can i have the code(for disnake)
again
Import party
4th time , check recent pings
i literally wrote it for you
they are just here for code ;-;
understand ¯_(ツ)_/¯
Check the docs for buttons
where
mens
use a Button
check recent pings
this method cannot create a url button
read the note
yeah I read
examples/views/button/link.py line 28
self.add_item(disnake.ui.Button(label="Click Here", url=url))```
ok
shouldn't be like ButtonStyle.url ?
does it have to be in a class
yeah
yes it should be
but in the examples they didnt provide it
yes, my man 🫂

My My, I want to ask something now
welp
whats the difference between a url button and a normal button, lmao
Url buttons can have urls
Normal ones no as far as I know
it can redirect u to a url and will never raise this integeration failed error
and cannot have a callback as well :3
Imagine how dumb would be to have interaction error to a link
¯_(ツ)_/¯
what if I add a fishy link
discord always asks you before redirecting u to any url
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
oh yeah
its not this, the popout thingy-
Many people don't even read the link
How do you think so many getting scammed with free nitro
lmao yeah
yea but both of them work similarly
dumbness :))
uhuh, thats an embed
and popouts have buttons
atleast they didnt try to "install discord mod apk with nitro"

good idea :))
free
something close enough is bluecord
cof cof
!ot
but we dont talk about it here
ok so now im done with saving data about reaction roles , time for the events
hi
it has to be in a class right?
yes or an one liner instance
class Buton()
button = disnake.Button(style=disnake.ButtonStyle.url,label="Invite Bot",url=ctx.bot.invite_url, emoji=":link:" )
no
ok
the button variable is already a button
ok
You can use the init and super for kwargs
😔 and again , i said dont copy paste it
gonna ruin u
ok
just ```py
view = disnake.ui.View()
view.add_item(button)
await send(... , view=view)
so dont need class?
ok i will not put vclass
but it's kinda recommended to do so, and you can use the button on all commands you make
you just need to button = ClassName("Button name", "optional emoji") and that's it
yeah but i dont feel like making a class for a button possible in just a single line since it does not have a callback or anything
you can have button classes and do the callback inside the command
quite convenient because you can tie embeds to buttons without any problem
Oki, who asked? just who?

yo momma did

is there a way where i can make my command to have an alias
yes
use the aliases=[] kwarg in commands decorator
@client.command()
async def pay(ctx, price: int):
like i wanna do !pay and !pay2 it would use the same command
which takes a list as you can see
hmm so i just do
@client.command(aliases=['pay2'])
async def pay(ctx, price: int):
@client.command(aliases=["alias1", "alias2"])
correct
yes
aight lemme try
lovely pfp you got btw
!d discord.ext.commands.Bot.command cof cof
@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
slow poke
oh godd damn i did try that earlier and didnt work so i came again
agreed
good spelling
cry about it

lmao
thanks
Ashley is like okimii 2.0
im better
agreed
its fine, little one
i am a god🕴️
jk
is there a way to delete the command msg sent by user after the command has finished
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
yes
message.delete
Hey @hidden hazel!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
!d discord.Message.delete
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
Context.message.delete()

but what arg do i give it
look above
delete is a coro for a msg object
do i use await?
yes
it is a coroutine
look what i sent😔
dont be sad, little one 🫂
no
no
doesn't work
await interaction.message.delete in that case I think? idk about interactions much lol
in a interaction
its an interaction-
the heck are you doing? interaction with a command?
huh
argument naming
huh? 

new typehint
im so outdated with these new interactions lmao
they're*
dont remember any of them
Too bored to learn interactions
ok dad
that was a joke, I didnt mean it
cry about it
everything

your command doesnt make sense
why
a command takes context
not interaction
just you not me
im to smort for that
use context only and make msg a kwarg so it will eat all text
theirs limits which are pinned btw
youre doing something wrong
any error
show the embed
your embeds just dont like you, cry about it
i think youre way smorter than me
stop, both of you
no need for return btw
and make the second if an elif
no need for it
then why return?
fix it😤
and you can use return to send a msg btw
umm how?
simple questions require simple solutions
okimii
@bot.command()
async def echo(ctx, *, rep):
await ctx.send(rep)
never
maybe you edited the desc?
its really long ngl maybe it succeeds the limit
smartest piece of code
argument naming
and why have
return
print("")
if you can save a line
return print("")
it looks super cool

then dont 
😭
return print```
If different from ```py
return
print
you have a life, woah
Just saying
you're too smart, man
smort
the world would be a mess otherwise
exactly
🫂 aw c'mere, have a hug
:)
ashley the mental support thank you
🫂
I'll be your soda uwu
anyways
ot
you get hug no soda🫂
boi wut the hell boi
lol
ill be there for you <3
no👁️ 👁️
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
let me think harder
||never gonna give you up||
whats your problem actually?
wait
why the heck are you using sqlite????
sqlite isnt async
use this
yea but please dont eat apples 😔
ill eat germs to see you doctor😉
i mean , your issue please?
prob
its probably blocking
My bot has a headache in the stomach, doc

then stop talking
🧠
gib some more resources to it O.o
yeah, I was making a companion for my bot for valentine's day 
gtg to school bye guys
enjoy cya
relatable but i can replace 'my bot' with myself
byee , have fun
thank you guys!
oh and its okimii's birthday too 😳
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
do i need class
take classes to learn how discord's views work ;-;
so far done with only a check lol
do i need class
:)) good luck
no
I did
pls
okay sorry
do i need class
no
ok
so weird
you need a class , but you wont make it.
¯_(ツ)_/¯
anything in python is a class
ok
what else do you think the statement "python is an object oriented language" means
Hi I'm getting this error when using a proxy in discord.Client
Cannot connect to host discord.com:443 ssl:default [The parameter is incorrect]
client = discord.Client(proxy=proxy_url, proxy_auth=aiohttp.BasicAuth("login", "pass"))
@client.command()
async def BotInfo(ctx):
view = disnake.ui.View()
button = disnake.Button(style=disnake.ButtonStyle.url,label="Invite Bot",url="https://google.com")
view.add_item(button)
await ctx.send("ho", view=view)
its?
yes this works 🙂
Hello everyone, who can merge the code for me to create temporary voice channels, the lobby system is like on faceit
Please send codes
wat
*object
why is no work
disnake.ui.Button
ok
not disnake.Button
arent objects class?
no, but classes are objects
@pine crown on_voice_state_update
In this episode of our discord bot we start working on a custom voice channels that checks when users join it and then creates a new voice channel for them to move the users into. We also make sure that we understand how to check if a user starts streaming in a voice channel, or mutes/deafens themselves.
✪ About this course ✪
The ULTIMATE DISC...
👆
@pine crown
Wtf
I didnt mean it like that
i was wrong anyways lol
You dont need to watch a tutorial to do something so simple 
please tell me the code i ask you
But he can pay money, bribery flex
sure, give me the code, I'll send you back 
whats the issue though?
not broken , like me
lol, I dont feel you
🫂
ok i now need to make a jump_url
i mean discord.Message.jump_url and discord does not provide
the library does that for you
and im using hik~
why dont I understand some of the messages 
hey i have a quick question pls
Sure
could i return a global variable ?
disnake/message.py lines 604 to 611
@property
def jump_url(self) -> str:
""":class:`str`: Returns a URL that allows the client to jump to the referenced message.
.. versionadded:: 1.7
"""
guild_id = self.guild_id if self.guild_id is not None else "@me"
return f"https://discord.com/channels/{guild_id}/{self.channel_id}/{self.message_id}"```
why not 
i need to make this manually
oh
aight ty
thats it , lol
@client.command()
async def BotInfo(ctx):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="censored")
view.add_item(button)
await ctx.send(embed=embed, view=view)
how to make more button
just make it like the first one then add it to the view
no
make another button , and do view.add_item(button2)
ok
I'm too cruel 🙃
anyways, who cares
idts , but shore
uhuh
if i type
*embed hey there
it makes it two args, 1= hey,2=there (edited)
[5:01 PM]
how do i make it one arg but have space
async def embed(ctx , * , text)```
or , use your command like *embed "i can have as many text i want" wrapped inside the "s
f
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
yep!
wait_for(on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):?
payload = await bot.wait_for('raw_reaction_add')
this doesn't seem fun
where payload would be discord.RawReactionActionEvent object
no other way around though.
you can have check and timeout inside wait for too
payload = await bot.wait_for('raw_reaction_add')
if payload.emoji == "⚡":
print("hello")
how would something like that work
also I just realised this won't work so I need to do the start way since it time sout
hi i am trying to make bot add element to a list in the main code but it doesnt work
@bot.command()
async def add(ctx,id):
global list1
list1.append(id)
await ctx.send("done")
```
how do i make an argument optional?
Make it equal to something or use *, arg
Or use Optional from typing
prolly the best option
okay
Optional[arg] @quasi stag
why does this not trigger py @commands.Cog.listener() async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent): if payload.member.bot: print("hello") return else: channel = bot.get_channel(935100681629601802) await channel.send("hello") if str(payload.emoji) == "⚡": print("hello") 😭
If you are type hinting args it would look like:
arg: Optional[T]
is it possible to give boosters more entries in a giveaway ?
yea sure , check if member has the booster role...
!d discord.Guild.premium_subscribers
property premium_subscribers: List[discord.member.Member]```
A list of members who have “boosted” this guild.
so you can check if the member is in the list or not
got any idea why the event above doesn't trigger
@bot.command()
async def add(ctx,id):
global list1
list1.append(id)
await ctx.send("done")
```
it doesnt add the word when i type the command why??
for every member?
does it not respond anyways?
nope, no error nothing
whoever you want to check on
is the cog loaded?
!botvar dont use globals
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
what does this command even do
yes
if i were you , id multiply the number of booster's entries , so there are more chances of them being returned on random.choice
nope, I have multiple of these events
bro I hate the reaction thing, it like limits how many times you can check
for a thing
wiat
I just solved the problem smh
guys im new here , i just want to ask how do you show a part of a .py like this
when i type .add 'id' it addes the id to a list in the python code
but it doesnt work
type this ` 3 times then py and at the end type it 3 times again
so it automatically make it like a .py format?
note that some keyboards layouts dont have `
yea
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
for example im using the french layout azerty and we dont have it
it doesnt add the element to the list
Imagine global varibales that dont even exist
Is it sending done?
thats what im saying
Anyone
Can we see the full code?
!ot cof cof
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
🙃
Lmao
import discord
client=discord.Client(proxy=proxy, proxy_auth=aiohttp.BasicAuth('login', 'pass'))
@client.event
async def on_ready():
print('ready')
client.run(token)
Just that
Client eww
lmao
I don't need Bot for this so yh
Uh?
Cannot connect to host discord.com:443 ssl:default [The parameter is incorrect]
!d discord.Message.mentions
Are you on mac?
people ask for smth and delete their msg wtf
he forgor
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
if payload.member.bot:
return
if str(payload.emoji) == "⚡":
channel = bot.get_channel(payload.channel_id) or await bot.fetch_channel(payload.channel_id)
await channel.purge(limit=1)
casinoMessageReaction = discord.Embed(title = "SLOTS", description = "These are the current selected slots", color = discord.Color.blurple())
casinoMessageReaction.add_field(name = "Selection", value = "Please select the slots you want to roll from (click on the emojis)", inline=False)
casinoMessageReaction.add_field(name = "BLACKLISTED SLOTS", value = "", inline=False)
b = '\n'.join(map(str, Blacklisted))
embed_dict = casinoMessageReaction.to_dict()
for field in embed_dict["fields"]:
if field["name"] == "BLACKLISTED SLOTS":
field["value"] += str(b)
casinoMessageReaction.add_field(name = "Gates of Olympus", value = "⚡", inline=False)
casinoMessageReaction.set_thumbnail(url="https://i.imgur.com/7xDaaTf.png")
casinoMessageReaction.set_footer(text=f'Cosmic Overground',icon_url="https://i.imgur.com/7xDaaTf.png")
casinoMessageReaction.timestamp = datetime.datetime.utcnow()
await channel.send(embed=casinoMessageReaction)
started1 = True
if str(payload.emoji) == "🍀":
casinoMessageReaction.add_field(name = "Leprechuan goes WILD", value = "🍀")
await channel.purge(limit=1)
await channel.send(embed=casinoMessageReaction)``` Anyone got any ideas on how I can edit/change the embed when the clover is reacted to?
the zap has to be reacted to tho
pep8 is knocking at your door

💀
Camel case 💀

Why do people use camel case with python
How to get bot currently connected voice channel name
Snake case is so much easier to write and read
snake_case*
I think that's how
cool coders
!d discord.ext.commands.Contect.voice_client
No documentation found for the requested symbol.
Wait
!d discord.ext.commands.Context.voice_client
property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
!d discord.VoiceClient
spam
ctx.voice_client is best
The voice channel connected to.
That's how
This
The dpy doc's are fine
Lemee test
You just need to know how to read them
Discord.py is not supposed to be a beginner project
Yup im doi g that
Im doing it idk my code is dirty or not
If you're a beginner there are probably a lot of bad practices implemented
is there a function for like embedded messages
how to make slash commands with disnake? can i have a exmaple cuz when i make sl;ash commands with disnake its like a error and like im gettinbg
mad
What's the error?
Attribute error voice client gas no attribute channel
Done this
like
Let's see the code
Botchannel = discord.Voice.Client.channel
Well no
..
whjen i just do client.command() it works, but when i do with slash commands it dont work
Then
Okay but what's the error
What do i do
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="e")
button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="🌐 Website",url="e")
view.add_item(button)
view.add_item(button2)
await ctx.send(embed=embed, view=view)
this is code but when i run the command it sya application not respond
Have you read the getting started part of the docs?
No
Oh, wrong reply
Slash commands?
Wrong reply???
Not too experienced with voice channels I'm afraid
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(inter):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="e")
button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="🌐 Website",url="e")
view.add_item(button)
view.add_item(button2)
await inter.respose.send_message(embed=embed, view=view)
not work stil
Anyon else how to get current voice channel name bot connected too
Are there any errors?
tick the applications.commands scope from developer portal
nothing on console
but says application didnt respond
well, i enabled it. but the slash command appears, but just says application didnt respond when i try the command
Anyone know how to setup a discord bot with heroku?
(I am trying to load it into a GitHub repository and then use that in heroku for context)
You mean convert numbers to scientific notations?
from disnake.ext import menus ImportError: cannot import name 'menus' from 'disnake.ext' (unknown location)
??
there's nothing as menus in disnake.ext
¯_(ツ)_/¯
It's Select iirc
!d disnake.ui.Select
class disnake.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.
This is usually represented as a drop down menu.
In order to get the selected items that the user has chosen, use [`Select.values`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Select.values "disnake.ui.Select.values").
New in version 2.0.
Pls help none helping me
what do you need?
client isnt in a voice channel
easy, read the error
¯_(ツ)_/¯
how do i make my bot tag a user that have been tagged by another user
if msg.startswith("!hug"):
hugimgs =[
'https://i.imgur.com/cyyH17s.gif',
'https://i.imgur.com/Z6F1giB.gif',
'https://i.imgur.com/CW8GEF1.gif',
'https://c.tenor.com/OXCV_qL-V60AAAAC/mochi-peachcat-mochi.gif',
'https://c.tenor.com/CnTxN4UrdysAAAAM/boo-hug.gif'
'https://c.tenor.com/4ZKqZ_F2N18AAAAM/running-hug.gif'
]
hugs = random.choice(hugimgs)
x1 = str(message.content).split()[1]
embedMessage = discord.Embed( title=f" {username.split('#')[0]} hugged {x1} 💓", color=0x6166B7)
embedMessage.set_image(url=hugs)
await message.channel.send(embed=embedMessage)
from this code if some one do "!hug @shy mica"
the output from the bot will be an Embeded Message
but the Embeded Message title will be "Alief Hugged <@andbunchof numbers>"
how do i make my bot do "Alief Hugged @shy mica" instead of the user id
please start using commands
I don't think you can tag users in an embed title
really? so a bot usually cant tag a user?
What do i do
How to get voice channel name
Bots can tag users just not in an embed title
if it isnt connected to a voice channel, you cant do that
Its connected if
show your code and traceback
Ok now i understand
I already showed you
You're saying something else while your error says something else ¯_(ツ)_/¯
!d discord.VoiceClient.channel
The voice channel connected to.
Now i understand
¯_(ツ)_/¯
¯\_(ツ)_/¯
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="✅ Support Server",url="e")
button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="🌐 Website",url="e")
view.add_item(button)
view.add_item(button2)
await ctx.send(embed=embed, view=view)
why does this say application didnt responed
Imagine if people actually tried solving their problems by reading the errors cries
help
Im noob
ig I cant, sorry
I cant understand the error mainly
ok then thx for the info
url is supposed to be a valid url first of all
dk about the error
Can i use ctx.me.voice.channel instead
I want it to smh
and now?
then add them 😐
Yup i have to change all ;-;
I have been doing since 4 houra
Im thinking to do tmrw
If it is a fork, there shouldn't be a lot different, only added.
discord.py is discontinued, while disnake is the forked version of dpy and is maintained
How czn i add = none smh
Means it gives a bollean true or false
..
It would be easier
either you are confused and dont know how to explain or is my english so bad ;-;
Listen i want it to test if the bot is connect to smonething or not
!d discord.VoiceClient.is_connected
is_connected()```
Indicates if the voice client is connected to voice.
that return a bollean
@final ironah thanks
bollean 
new data type
To what.
chan= bot.get_channel(678048899893821444)
Can anyone tell me how can I add more than one channel id in brackets
No other way to add more than one channel id
i have a user's username , how to get their roles?
can i add a general error message, if i want to send error i just need to return error message. Can i make this?
How to upload images to an embed
because you can only do set_image(url='')
would the url be file:// or
that wouldnt work?
yes
so for example i have a "reboot" command and if i want to show error message,
@reboot.error
return error
should be like that?
ehh...
why
decorators are for functions 
maybe like
@reboot.error
async def error_oh_no(ctx, error):
if isinstance(error, commands.IDontKnowPutSomeRandomErrorHere):
# do shit
so can't i return error func?
idk, where are you returning it
i tried changing the title into a description , and yeah it works perfectly fine , thx for the info
i just want to make only a error message and it should be using for all commands so i need to make error func and use it with commands (idk did u understand me)
class MyButton(disnake.ui.View):
def __init__(self):
super().__init__()
button = disnake.ui.Button(label='Click Me', style=disnake.ButtonStyle.url, url='https://discord.com')
self.add_item(button)
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(inter: AppCmdInter):
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = MyButton()
await inter.send(embed=embed, view=button)
why does thi not work
No documentation found for the requested symbol.
!d discord.on_error
discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is printed to stderr and the exception is ignored. If you want to change this behaviour and handle the exception for whatever reason yourself, this event can be overridden. Which, when done, will suppress the default action of printing the traceback.
The information of the exception raised and the exception itself can be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.9)").
If you want exception to propagate out of the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") class you can define an `on_error` handler consisting of a single empty [raise statement](https://docs.python.org/3/reference/simple_stmts.html#raise "(in Python v3.9)"). Exceptions raised by `on_error` will not be handled in any way by [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
Define not work
Errors?
Well yeah.
how does it not work?
yes the bot's role
if you want to subclass button you need to have
class MyButton(Button)
not the view inside
Where is the callback for the button
!d discord.Guild.self_role
property self_role: Optional[discord.role.Role]```
Gets the role associated with this client’s user, if any.
New in version 1.6.
and use .edit
you dont need one
callback for an url button?
so guild.self_role.edit()
inter.send not a thing
it is
ok
!d disnake.ApplicationCommandInteraction.send
yep!
await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=False, delete_after=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
If the interaction hasn’t been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
Note
This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.ApplicationCommandInteraction.original_message "disnake.ApplicationCommandInteraction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if you’re sending a followup message.
Sorry, what is a “token”? I’m from c++ background knowledge.
bot token
The one you get on developer portal
Okey
whats the difference between a view and a component
!d disnake.ui.ActionRow for component
class disnake.ui.ActionRow(*items)```
Represents a UI action row. Useful for lower level component manipulation.
New in version 2.4.
and ui.View for view
what are action rows
similar to views , but less complex
yo anyone got an idea on how this should work, When someone reacts it should deleted the embed and send a new one with the slot name/symbol of the one they have choosen
https://gyazo.com/ea692d0b7170674a2d91543102ee462a I just have tried so many ways and can't figure out a good way on how this could work
Why not use buttons?
buttons?
discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View"), the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") being pressed and the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/api.html#discord.Interaction "discord.Interaction") you receive.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
bruh
!d discord.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
@slate swan
ty
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
await ctx.channel.purge(limit=limit, bulk=True)
await ctx.send('tbh Purged by {}'.format(ctx.author.mention))
await ctx.message.delete()
can someone help me that does not work
it says 404 not found
idk why
You are trying to delete an already deleted message
Simple debugging could have solved this issue
Ok
oh
File "main.py", line 6, in <module>
ADS.run("TOKEN")
TypeError: run() takes 1 positional argument but 2 were given```
I don't know why
This is happening
Please help
@quaint scaffold I think you can help
ADS.run(f"{TOKEN}")
Bud in the place of token my original discord token is there
What database should I use for discord bot? I need to save guild id and a channel id
aiosqlite rest your choice
It works fine
Thanks.
U can try mongo 
personal preference, I prefer sqlite
Your choice really
OK
it still gives error
which module you using
i legit just did await ctx.channel.purge(limit = amount + 1) and that’s it
what error? show the updated code too
Nope but if user types something
then it will delete
that
@slate swan
Once can you try await ctx.delete()
I think it will work
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount : int):
if amount > 999:
amount = 1000
await ctx.channel.purge(limit= amount + 1)
```there
kk
that doesn’t work
same error?
no
show the error then...
One error at a time please.
hmm

how do u make a thing where if u press a button and it tells how many times ive pressed it
idk
This will work
@client.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
await ctx.channel.purge(limit=limit, bulk=True)
msg = await ctx.send('tbh Purged by {}'.format(ctx.author.mention))
await msg.delete()
Here you go this code
kk lemme try that
is tested and working for me
kk
kk ty
ur code doesn’t work for me
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
await ctx.channel.purge(limit=limit, bulk=True)
await ctx.send('tbh Purged by {}'.format(ctx.author.mention),delete_after=5)
Ew, who does that
Just for explanation
!f-strings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
Use the delete_after arg when its provided ;-;
@slate swan
Use this
This will work for you
kk
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
await ctx.channel.purge(limit=limit, bulk=True)
await ctx.send('tbh Purged by {}'.format(ctx.author.mention),delete_after=5)
Also, this command breaks discord's TOS
No offense
how
HOW
I mean, it doesnt upto a point, but "you" can make it

How
OK
@slate swan thanks for telling
bruh still doesn’t work @zealous dagger
what is the error
you can make a say command be against discord's ToS cuz the whole server can spam it
🧠
error
@bot.command()
@commands.has_permissions(manage_messages=True)
async def purge(ctx, limit: int):
await ctx.channel.purge(limit=limit, bulk=True)
await ctx.send('tbh Purged by {}'.format(ctx.author.mention),delete_after=5)
``` Here you go fixed indentation issues
what's bulk
!d discord.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
bruh idk why it still doesn’t work
oh it's set to true by default
what is the variable
that u
are defining while using
wait 2 sec
yes
With the name of variable you are defining
and I can't get the error out of your context
for the bot or the client
Yes me too
bot
ok
so its like this
bot = commands.Bot(command_prefix="!")
Am I right
@slate swan
yh
ok
sorry I had to go
umm, because, its against discord's TOS for a bot to delete messages that are older than two weeks
@slate swan Can you
File "main.py", line 6, in <module>
ADS.run("my token")
TypeError: run() takes 1 positional argument but 2 were given```
can I see your code?
sure
from ads.core import bot
from os import getenv
if __name__ == "__main__":
ADS = bot.ADS()
ADS.run("my token")
Here you go
is ADS() a class?
Yes
did you define a run function in it?
Nope
Ahhhhh yes
Show it
brother?
best
cool
🤝
tbh
the bot gives me roles like this
[<Role id=933717532232269825 name='@everyone'>, <Role id=935119622112411689 name='bot'>]
how do check if someone has a role 'bot' ?
The ID for the role.
The name of the role.
use any one of those :)) using an ID is better
lemme see
@slate swan are you trash? i can’t tell
i mean trans?
no my question is , how do i put this
if this == 'bot':
do Smth
@slate swan
@slate swan are you straight or trans? i can’t tell.
I'm a girl

what sexual orientation
role.name == "bot":
kill(member)
bro
what sexual orientation
@slate swan Me back with new error
i can’t believe ur 15 and don’t know what sexual orientation means
File "main.py", line 6, in <module>
ADS.run()
File "bot.py", line 30, in run
self.setup()
File "bot.py", line 25, in setup
for filename in os.listdir("./cogs"):
FileNotFoundError: [Errno 2] No such file or directory: './cogs'```
This is my code
are you straight trans lesbian what
oh thanks!
idk if I'm understanding your question right
anyways, this is ot
bruh wtf if wrong with u
cogs/
you're being insanely weird, please stop, its uncomfortable
I am younger than you
i don’t give 5 fucks anyways bye
kk
@crimson pulsar offtopic discussion , you are mod right?
What the hell is wrong with you
?
yh in another server
i didnt know
doesn anyone have any alternatives to heroku?
I'll report you of you dont stop being rude and spit out profanities for no reason 
am i allowed to say n word in this server i’m not white
Still not working
aiii
but when I try this withought
send me your dir ss
the class
what would be a good free way to learn how to code a bot in python
It works @slate swan
it worked?
this chat now feels more like a place where people just argue :)
youtube
No
nvm
actually no its bad
show me your dir ss, and your code
OK
any alts to heroku?
Which one
https://vcokltfre.dev/ best one ❤️
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
your directory ss
tyty
and the code that is loading cogs
Here you go
def setup(self) -> None:
for filename in os.listdir("./cogs"):
if filename.endswith("py"):
self.load_extension(f"cogs.{filename[:-3]}")