#discord-bots
1 messages ยท Page 936 of 1
No its still not showing the button now
@bot.command()
async def breathe(ctx: commands.Context):
"""Starts a breathe for pressing."""
await ctx.send('Confirm to start guided breathing excerise.', view=YesButton(ctx.author))
time.sleep(5)
await ctx.reply('Are you in a comfortable position?', view=IamButton())```
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
and you spelled exercise wrong in the string lmao
just subclass the button
PLS
what
it is in the class
class YesButton(discord.ui.View):
def __init__(self, author: discord.Member) -> None:
super().__init__()
# When this button is pressed, it will respond with a Counter view that will
# give the button presser their own personal button they can press 5 times.
@discord.ui.button(label='Yes', style=discord.ButtonStyle.green)
async def receive(self, interaction: discord.Interaction, button: discord.ui.Button):
# ephemeral=True makes the message hidden from everyone except the button presser
await interaction.response.send_message('Start by finding a comfortable postion, either lying on the floor or sitting with your legs crossed.')
self.stop()```
its in the class init
no outside it but in the class
and your other button callback in the other view is outside it aswell
class YesButton(discord.ui.View):
def __init__(self, author: discord.Member) -> None:
super().__init__()
# When this button is pressed, it will respond with a Counter view that will
# give the button presser their own personal button they can press 5 times.
@discord.ui.button(label='Yes', style=discord.ButtonStyle.green)
async def receive(self, interaction: discord.Interaction, button: discord.ui.Button):
# ephemeral=True makes the message hidden from everyone except the button presser
await interaction.response.send_message('Start by finding a comfortable postion, either lying on the floor or sitting with your legs crossed.')
self.stop()
like so
yes I can see that now

I fixed it and the button is there thank you
but how do I make the thread private
to the author
@slate swan its still letting me react to the button more then one time
which View
both
you need to stop the view in your method in IamButto class
!d discord.ui.View.stop | with this
stop()```
Stops listening to interaction events from this view.
This operation cannot be undone.
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [Whatโs New in 3.10โs Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
use this. so it wont block your bot
I did
@bot.command()
async def breathe(ctx: commands.Context):
"""Starts a breathe for pressing."""
await ctx.reply('Confirm to start guided breathing excerise.', view=YesButton(ctx.author))
asyncio.sleep(5)```
ok
But do you have any idea how to make it so that it can make multiple buttons like how would you actually approach it
for example
a.breathe ( starts the exercise )
and then react to the yes button and then it will ask you something
and then another button will appear
in the same message?
nope so like
author: a.breathe
bot: Would you like to start a breathing exercise? ( yes button )
author: clicks the yes button
bot: ( bla bla bla )
bot: waits 5 seconds
bot: are you in a comfortable position ( I am button, I am not button )
e.t.c
what's the difference between [] and () in let's say commands?
isn't it that [] means you have to give an argument, for instance an user and that () is optional?
in what situation exactly?
for instance if i do .userinfo
if i wanna make a usage, i can just put () if it's optional
just edit the message with a different view
cus if i dont put a user in, it'll give you your own userinfor
an optional argument?
ye
How do I edit the message?
Did you have an example of how to do it. Im more of a visual learner
well you can add a empty tuple yes but i prefer to add None
i mean as in usage wise, wait let me get you an example
!d discord.Interaction.edit_original_message
await edit_original_message(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.
This method is also the only way to edit the original message if the message sent was ephemeral.
just add a instance of view
Ill try! thank you!

because some bots use [] as optional and some use ()
Do I do that in the yes button class?
so idk now which is which
they probably mean it like a user object
not like literally making the argument optional with an empty list or tuple
the method is a method bound to an instance of the interaction class
yeah i got that
ight thanks mate ๐ค
which you have it in your methods params
So why is it not defined then?

well i kinda explained it their
class YesButton(discord.ui.View):
@discord.ui.button(label='Yes', style=discord.ButtonStyle.green)
async def receive(self, interaction: discord.Interaction, button: discord.ui.Button):
# ephemeral=True makes the message hidden from everyone except the button presser
await interaction.response.send_message('Start by finding a comfortable postion, either lying on the floor or sitting with your legs crossed.')
self.stop()
await edit_original_message('Are you in a comfortable position?')
def __init__(self, author: discord.Member) -> None:
super().__init__()
# When this button is pressed, it will respond with a Counter view that will
# give the button presser their own personal button they can press 5 times.```
your method receive has interaction in its params, which the method edit_original_message is bound to an instance of the Interaction class so just use the instance of the class thats in your params so it would be await interaction.edit_original_message('Are you in a comfortable position?')
asyncio.sleep(5)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Ignoring exception in view <YesButton timeout=180.0 children=1> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Yes' emoji=None row=None>:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ui/view.py", line 393, in _scheduled_task
await item.callback(interaction)
File "/Users/alanabeaton/Auora Bot/main.py", line 30, in receive
await interaction.edit_original_message('Are you in a comfortable position?')
TypeError: edit_original_message() takes 1 positional argument but 2 were given
it only takes one positional argument the class instance and thats all which content is a kwarg hence why * is before all its arguments
as shown here^
i recommend you learn oop as it can be quite confusing https://www.youtube.com/watch?v=ZDa-Z5JzLYM&list=PL-osiE80TeTsqhIuOqKhwlXsIBIdSeYtc
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...
you dont need the asterisk in the arguments of the method.
!d disnake.Interaction.author
The user or member that sent the interaction.
But when I do it
this attr returns a member which the member class has that method
The bot does not send the next message and provides an error
Ignoring exception in view <YesButton timeout=180.0 children=1> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Yes' emoji=None row=None>:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ui/view.py", line 393, in _scheduled_task
await item.callback(interaction)
File "/Users/alanabeaton/Auora Bot/main.py", line 30, in receive
await interaction.edit_original_message('Are you in a comfortable position?')
TypeError: edit_original_message() takes 1 positional argument but 2 were given
you need to use the content kwarg
as shown here
yes but how would I do that?
you set the string to the kwarg?

do you want me to show you how
await interaction.edit_original_message(content='Are you in a comfortable position?')
here we satisfied the content kwarg with a string

!tags positional-keyword
Positional vs. Keyword arguments
Functions can take two different kinds of arguments. A positional argument is just the object itself. A keyword argument is a name assigned to an object.
Example
>>> print('Hello', 'world!', sep=', ')
Hello, world!
The first two strings 'Hello' and world!' are positional arguments.
The sep=', ' is a keyword argument.
Note
A keyword argument can be passed positionally in some cases.
def sum(a, b=1):
return a + b
sum(1, b=5)
sum(1, 5) # same as above
Somtimes this is forced, in the case of the pow() function.
The reverse is also true:
>>> def foo(a, b):
... print(a, b)
...
>>> foo(a=1, b=2)
1 2
>>> foo(b=1, a=2)
2 1
More info
โข Keyword only arguments
โข Positional only arguments
โข !tags param-arg (Parameters vs. Arguments)
thank you!

then just send a new message
help
how do I do that IN the same class
^
just send another message with the interaction class instance in your params?
can you show me how to do that to if thats ok
after that I should be able to figure it out by myself
sure
ok so, rn i have this code:
@role.group()
async def create(self, ctx, role : discord.Role):
await ctx.guild.create_role(name=role)
await ctx.send(f"role {role.name} has been created")
how do i make it so whenever i just input a random thing it'll create the role named whatever i put in. for instance: ,role create test
Change role's typehint to str
Then in the bottom just do "role role has been created"
so role: discord.Role = str
: for typehints
= is to assign
oh right
just do await interaction.original_message.send() iirc would be how its done im not sure as discord doesnt have that coroutine in the Interaction class which disnake does
Correct
so the code would be this then?:
@role.group()
async def create(self, ctx, role : discord.Role: str):
await ctx.guild.create_role(name=role)
await ctx.send(f"role {role} has been created")
@pliant gulch
so the code would be this?
@discord.ui.button(label='Yes', style=discord.ButtonStyle.green)
async def receive(self, interaction: discord.Interaction, button: discord.ui.Button):
# ephemeral=True makes the message hidden from everyone except the button presser
await interaction.response.send_message('Start by finding a comfortable postion, either lying on the floor or sitting with your legs crossed.')
await interaction.original_message.send()
await interaction.edit_original_message(content='Are you in a comfortable position?')
await interaction.original_message.send()```
yeah i think so im not sure if InteractionMessage has that method tho
it doesnt because its not working
yeah i see it @pliant gulch
๐ญ
Ok, once you fix that it should be working
Thank you so much for your time though! sorry for being a pain in the but for an hour
let me check src real quick
its await interaction.followup.send()
not a problem
how to use proxies for bot like import the proxies from proxies.txt
tysm !!
What would you need proxies for???
The only way it would be useful with discord bots is for nuking
Which is something we don't help with

anyone here can help
await bot.change_presence(activity=discord.Activity(application_id=APPID, name=name1, type=discord.ActivityType.playing, state=state1, details=detail1, assets={'large_image' : imagekey1, 'large_text' : 'image'}))
the image doesn't show
what d.py version is this?
latest version
i did python3 -m pip install -U discord.py
oh.. thats not the latest version
bots can't have activities with images lol
idts, brb
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.avatar "discord.User.avatar")
it dont say there
It does
can you show me a screenshot of the bots activity?
i tested it on user aswell
its not workin
the image doesn't load
does the image even exist on the application
yes
bruh its not working @final iron
!d discord.Member.display_avatar
property display_avatar```
Returns the memberโs display avatar.
For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.
New in version 2.0.
its in the asset
and my imagekey is correct
embed.set_image(url = member.display_avatar)
no
Refer to this.
i have member defined
Now itโs good
yeah not working lol
Define not working.
after i downloaded discord's latest version from git, now my bot is not responding to any commands i type
@client.command(aliases=["sav"]) # i will be adding this
async def avatar2(ctx, *, member: discord.Member=None):
if member is None:
member = ctx.author # ok wait im gonna do 2 and you cacn pick
guild = ctx.guild
embed=discord.Embed(color=color.color, description=f"`{member.name}'s avatar`")
embed.set_image(url = member.display_avatar)
await ctx.reply(embed=embed, mention_author=False)
this is the command
nether it is showing any errors
does your bot have message intents?
no
Ok but like is there any errors or anything?
yyes
Whatโs the error.
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'display_avatar'
what do i do to update
what should i do?
pip install -U git+https://github.com/Rapptz/discord.py
tysm
enable them
Does this even have to do with message intents?
The enforcement doesnโt start till late April.
Or has something changed.
how to send in a specific channel by using id?
idk what to do
Fetch/get it.
await (await bot.fetch_channel(id)).send("ahahah")
Small example
ow ok thx
can u make drop down meaus with 2.0.0
Yes
@client.command()
async def create(ctx, args):
perms = discord.Permissions(send_messages=True, read_messages=True, administrator=True, manage_roles = True)
await ctx.guild.create_role(name=args, permissions=perms)
await ctx.send("Role created")
@client.command()
async def add(ctx, user: discord.Member, role: discord.Role):
await user.add_roles(role)
await ctx.send("Role added")
here's my code it creates a role and adds it to a specific user, when i am running it and typing the command in the chat it is not doing anything neither it is giving any errors
Thatโs weird
ig not?
ty
Oh itโs no longer ui itโs interactions now.
oh oki
Do some simple debugging
Add a print statement inside the command to check if itโs even being called.
How can I check if a user has administrator with discord.py?
Without limiting the entire command to administrators
property guild_permissions```
Returns the memberโs guild permissions.
This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").
This does take into consideration guild ownership and the administrator implication.
Thanks
guild_permissions is not a method
It's just a property, don't call it
My bad. I had permissions_for() in mind for some reason
yeah i did that it's not printing anything in the console
You're commands arenโt even being processed then
Do you have an on_message() anywhere maybe?
yeah
Show pls
tell me how to uninstall it
pip uninstall -U git+https://github.com/Rapptz/discord.py
^
Usage:
C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\python.exe -m pip uninstall [options] <package> ...
C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\python.exe -m pip uninstall [options] -r <requirements file> ...
no such option: -U
did it install successfully ?
wait
altgraph==0.17.2
async-timeout==3.0.1
attrs==21.4.0
certifi==2021.10.8
cffi==1.15.0
chardet==4.0.0
charset-normalizer==2.0.12
discord==1.7.3
discord-ui==5.1.6
discord.py @ git+https://github.com/Rapptz/discord.py@0bcb0d0e3ce395d42a5b1dae61b0090791ee018d
ffmpeg==1.4
ffmpeg-python==0.2.0
future==0.18.2
idna==3.3
keyboard==0.13.5
MouseInfo==0.1.3
multidict==6.0.2
mutagen==1.45.1
mysql==0.0.3
mysqlclient==2.1.0
numpy==1.22.3
opencv-python==4.5.5.64
pefile==2021.9.3
Pillow==9.0.1
py-cord==1.7.3
PyAutoGUI==0.9.53
pycparser==2.21
pycryptodomex==3.14.0
PyGetWindow==0.0.9
pyinstaller==4.9
pyinstaller-hooks-contrib==2022.1
PyMsgBox==1.0.9
PyNaCl==1.4.0
pyperclip==1.8.2
PyRect==0.1.4
PyScreeze==0.1.28
pytube==11.0.2
pytweening==1.0.4
pywin32-ctypes==0.2.0
requests==2.27.1
six==1.16.0
typing_extensions==4.0.1
urllib3==1.26.8
websockets==10.1
yarl==1.7.2
yt-dlp==2022.2.4```
So you did install it
try without the u?
ok
wait it shld lok like this !?!
cause i just did a
pip install discord.py
and that worked for me
ERROR: You must give at least one requirement to uninstall (see "pip help uninstall")```
and even pip freeze shows
discord.py==<version>
thats just main
try pip uninstall discord.py
and you shouldnt have pycord and dpy
done
@slate swan Can you help me with my error^
i will uninstall them?
not sure ive never deployed my bots on heroku but check your logs
pardon?
sorry i cant really help with heroku deployment never done it before
thats ok
U can directly give the link too, no need to add discord.py in the start
self.bot.avatar_url
``` it says AutoShardedBot has no attribute avatar_url
how am i supposed to get the url?
iirc bot has a user attribute
!d discord.ext.commands.Bot.user
property user```
Represents the connected client. `None` if not logged in.
OHH YEA, i haven't coded in a while
self.bot.user.avatar_url
bit newer to working with discord bots, but to my knowledge I gave it 1 argument, the integer contained within the uid variable.
not sure what I borked.
what's your code
You need to fetch_user with that id
Or filter() with a guild member list, it seems, for a member
hm. no idea how to do that. seems i'm back to looking at api reference. thanks for the pointer.
no idea what it means by self, I think I've got the rest sorted, but this one bit is puzzling me.
Hey Guys, i need some help, if a word is said anywhere example, hi or hi how are you. it says the same response
how do i code that into my bot?
think theres something to do with "@something.event" and checking if thats in the content of the message. I don't know how thats done as I havent looked into it.
!d discord.ext.commands.Command.aliases
The list of aliases the command can be invoked under.
thats not how you quite do it. kinda basic oop
i dont understand from the website lmao
@Bot.command(aliases=["", ""])
not overly surprised. I just followed what the api reference said, and it gave an error asking for 2 arguments.
the B should not be caps
not my point.
lmao
whatโs the problem
it will be hard to follow then as you need to know oop for dpy
how?
my point is the deco needs an instance of the Bot class.
hm.
Hey Guys, i need some help, if a word is said anywhere example, hi or hi how are you. it says the same response
how do i code that into my bot?
wait wouldnโt it be a event?
yes
aliases
if the word hi is in anything it says hi back
@slate swan can you describe how you are trying to do this? , are you trying to make the bot reply if someone says hi?
okay, if any message contains hi, it doesnt matter if its, hi how are you or hi or hi hows it going, it always reply Hi back because the word "hi" is in those messages
oh yeah @slate swan wouldnโt that be a event lol?
im so confused do you mean aliases or echo?
@bot.event
aysnc def on_message(message):
wym?
it says the same response
same response as the same response like alias for a command or an echo command?
are you wanted us to type the whole command
not alias heโs saying like if someone says โhiโ bot replyโs with โhiโ
hi or hi hows it going or hi how are you
it doesnt matter, as long it has hi in the msssage
make a list
homie there is a bunch of stuff someone can do
welcome = [โhiโ,โhi how are youโ]
hi or hi how are you. it says the same response
how do i code that into my bot?
how is that not aliases?
bro iโm on mobile i canโt really help
those were examplles, man
i want it so the word hi if it is in any message it replys hi back
bro heโs not trying to do that, heโs trying to get a bot to reply to someone saying hi
btw those quotes arent correct
ik iโm on mobile
like if i say hi
i want it so the word hi if it is in any message it replys hi back
just check the content
yeah
not really my fault as the message was worded horribly (no offense to the author)
i have that for my one words tho
understandable
should use regex
how do i do that
ah alright
wdym "how do i do that"?
Regular expressions
Regular expressions (regex) are a tool for finding patterns in strings. The standard library's re module defines functions for using regex patterns.
Example
We can use regex to pull out all the numbers in a sentence:
>>> import re
>>> x = "On Oct 18 1963 a cat was launched aboard rocket #47"
>>> regex_pattern = r"[0-9]{1,3}" # Matches 1-3 digits
>>> re.findall(regex_pattern, foo)
['18', '196', '3', '47'] # Notice the year is cut off
See Also
โข The re docs - for functions that use regex
โข regex101.com - an interactive site for testing your regular expression
i have no life 
@slate swan i want something like this
`@client.event
async def on_message(message):
triggerWords = ("test", "test2", "test3")
if message.author == client.user:
return
if any(triggerWords in message.content.lower() for triggerWords in triggerWords):
await message.delete()
await message.channel.send(f"{message.author.mention}, you cannot say that here!")`
itโs okay tho
so a filter?
then use regex.
fr 
or just go on stack overflow and look for stuff there
unless I misunderstand what i just read about oop, a self like variable should already be given and defined without me having to do anything which is what I thought, however, i can't seem to find where that is, and the api reference seems to think I only need 1 argument. (could be in addition to the self thing)
Hi can anyone tell me some good python software for bot development
yes the method needs a instance of the Bot class hence why it needs the positional argument self to access the class
like what exactly?
like lib or editor?
like ive been using replit but it doesnt support nextcord so I wanna change to something else
issue is I can't find the predefined self, or how to properly call the bot class.
so an editor?
yeah
you mean an instance of the Bot class?
vsc is good
i'd think thats what is needed, but I don't know what to put in that self arugment thanks to the api not saying anything about it.
alright thanku :)
self gets satisfied when you use the method on the class
which self is used to access a class instance which if its given on a methods signature it bounds it to an instance of the class
@oblique pike heres a good playlist to learn oop https://www.youtube.com/watch?v=ZDa-Z5JzLYM&list=PL-osiE80TeTsqhIuOqKhwlXsIBIdSeYtc&index=1
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...
well i just read through a thing on oop, but i'd assume a number of classes are defined places I can't find and therefore don't know what to call and where. and due to the layout of the api reference, that too is useless.
given that they probably expect one to know oop fully, perhaps, but when one manages to gather a simple understanding of it, the way the reference seems to point things out, it requires a full understanding and thus is rather unintuitive for one who is learning it.
dpy is an advance lib which it depends on oop and async programming which isnt quite suitable for beginners or programmers who are missing such knowledge, this isnt dpys fault nor anyones. its just object oriented programming which everyone should know atleast inheritance as everything in python is an object. my point is the api references layout isnt bad at all but it might be scary to does who lack such knowledge.
well thats enough of me picking my brains out tryna code this for today. sorry if you think I know nothing, thats because youre right about that one, I can understand logic to some extent, but I guess python is less connect the dots style of understanding once you get into methods and classes. idk how people put up with my sorta crap, but thanks for trying to help.
well thats just how python works. it might be confusing at the start but afterwards its very easy its allot to take in and it takes time to master but its all about not giving up.
my button not working after bot restart how do i fix
persistent views
hu?
oh are you kidding me. i just took 1 more look and a capitalization error fixed it.
were all humans at the end of the day 
this is how i want my relationship
big msg
keep dreaming
i will
or make a bot thats your gf
๐ณ
^^^
welp thanks for the pointers, im through with this for one day. at least progress was made.
dont go too hard on yourself it took me a year to master everything im still learning after a year
iโm gonna do that
could say the same about blender I suppose...
make a task and make her say ily, gn and gm everyday
i will
name her clock
does anyone know the exact date for the new dpy update
your name.
self.bot.user.top_role:
it says no attribute top_role
not sure if their is any
user is not bound to a guild
yeah was gonna say that
guild.me would return the bots member object
๐ฏ
cogs is the best thing ever
welp im gonna go to sleep master can take over for me goodnight everyone
classes overall are amazing
good night
Yeah
Hm
Hi i need help with preistent view where to put
class ticket(commands.Cog):
"""huh4?."""
def __init__(self , bot: commands.Bot):
self.bot = bot
class Closetic2(disnake.ui.View):
def __init__(self , channel : disnake.TextChannel):
self.channel = channel
super().__init__(timeout=None)
@disnake.ui.button(label="Delete Ticket", style=ButtonStyle.blurple, custom_id="nos")
This is my cog
@slate swan
i see that repo but not sure where do i add that
afkdict = {}
@bot.command()
async def afk(ctx, *, message="No message provided"):
global afkdict
afkdict[ctx.message.author] = message
await ctx.send(f"**{ctx.author.mention}** is AFK")
msg = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
await ctx.reply(f"**{ctx.author.mention}** welcome back!")
@bot.event
async def on_message(message):
global afkdict
if message.author in afkdict:
afkdict.pop(message.author)
for member in message.mentions:
if member != message.author:
return
if member in afkdict:
afkmsg = afkdict[member]
await message.channel.send(f"**{member}** is currently AFK")
await bot.process_commands(message)
``` when i get pinged it doesnt send the "member is currently afk message", help?
Add it in the __init__ of the cog
The persistent view
In this case it would be bot.add_view
okay
class ticket(commands.Cog):
"""huh4?."""
def __init__(self , bot: commands.Bot):
self.bot = bot
bot.add_view(Closetic2())
didn't i need any custom id stuff
or thats it?
That should be good
ok
KeyError: 'ticket'
Full traceback
Wdym
wait ill show u
class Closetic2(disnake.ui.View):
def __init__(self , channel : disnake.TextChannel):
self.channel = channel
super().__init__(timeout=None)
@disnake.ui.button(label="Delete Ticket", style=ButtonStyle.blurple)
async def first_button3(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction):
await self.channel.delete()
and in another class Closetic class
await channelslogs.send(embed=emb,view=Closetic2(channelslogs))
Ok so what do you need again?
So when ur adding the persistent view you need the channel?
yes
You could save the id in a database and then use bot.get_channel to get the channel object
class ticket(commands.Cog):
"""huh4?."""
def __init__(self , bot: commands.Bot):
self.bot = bot
bot.add_view(Closetic2())
bot.add_view(Closetic())
bot.add_view(RowButtons())
yes
im already
with open("ownticket.json") as s:
logss2 = json.load(s)
guild_id = str(interaction.guild.id)
if guild_id in logss2.keys():
logsid = logss2[guild_id]
if a == logsid:
for channels in interaction.guild.text_channels:
if channels.name == str(a):
channelslogs = channels
@torn sail
So open the file, get the channel ids, get the channel objects, add the views
database
json*
๐ฟ
{
"957873296328765520": 950007321227055185,
"8329137183": 283193131298192,
"2318938123128391": 213819319313812
}
i'm making a ticket command and i want it to save the channel id : user id
when i do the 'ticket close' command i want it to delete "8329137183": 283193131298192, im quite confused how though? can someone help?
Json not databas but Iโll ignore that for now
i was wondering why you were ignoring it
Was a joke
h
you also can't tell that's a joke
SQLite is good for beginners
You could just iterate through all the bots guilds
SQL is easy to learn but schema is hard
Yea but schema needs to be correct
Which tbh I don't clearly know
I just use mongoDB
I don't like nosql DB's.. so automatically I don't like JSON too
they are way to similar to JS {}
There's a difference between JSON format and JSON files
yeah but one day I tried learning JS, and I couldn't bcz of the {}.. and ik for a fact that nosql DB's uses that syntax.. anyway we are going off topic
help?
..
del my_dict[key]
I want to make a whatsapp bot in python with menu and buttons and selectors
whatsapp bot?
my tree.sync() always returns [] meaning it doesnt sync anything, although i have the commands "registered" with the @tree.command decorator
dpy 2.0 btw
i want my bot to send a msg as soon as it is online.How can i do that
someone plz help
@wicked quest
plz help
!d discord.on_ready
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
@bot.event
async def on_ready():
print("...")
how do i make my bot send an emoji
Hello guys, Im adding a playing yt vids feature for my bot but its returning errors, can anyone help
async def getprefix(bot, message):
async with aiosqlite.connect("prefixs.db") as db:
async with db.cursor() as cursor:
await cursor.execute("SELECT prefix FROM prefixs WHERE guild = ?", (message.guild.id,))
data = await cursor.fetchone()
if data:
return data
else:
try:
await cursor.execute("INSERT INTO prefixs (prefix, guild) VALUES (?,?)",('!d', message.guild.id))
await cursor.execute("SELECT prefix FROM prefixs WHERE guild = ?", (message.guild.id,))
data = await cursor.fetchone()
if data:
cursor.execute("UPDATE prefixes SET prefix = ? WHERE guild = ?", (message.guild.id,))
except Exception:
return 'd!'
What the hell is this? there is no decorator
message is None there is what the error is saying
should i add client.event()?
No it is absolutely nothing, what do you wanted to do?
i wanna make a custom prefixs command
how do i make my bot send a custom emoji
then you have to do this before every command is executed
and i think that probably you just copied this code from somewhere else
either get the emoji using id, or <:emojiname:id>
!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.
doesn't work
Currently when someone sends a message and has the "Hunger" role, the bot gives them a countdown role (to stop the counting to repeat) and counts 60 seconds, then gives them the "dead" role. However, after the timer is done, it gives the "dead" role even if "hunger" has been taken away which I only want to happen if the user still has "hunger".
Anyone know how to stop this?
@client.event
async def on_message(message):
Hunger = message.guild.get_role(957207332134223892)
Counting = message.guild.get_role(957525791426637834)
Dead = message.guild.get_role(852087847917715457)
if Hunger in message.author.roles:
if Counting not in message.author.roles:
if Dead not in message.author.roles:
await message.author.add_roles(Counting)
time.sleep(60)
if Hunger in message.author.roles:
await message.author.add_roles(Dead)
await message.author.remove_roles(Counting)
!d discord.on_member_update
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change:
โข nickname
โข roles
โข pending...
yeah, thats what i used, except the 'dead' role gets added even without 'hunger' after the timer is done
if user_message.lower() == '.discord':
response = '<:discordbot:(id here)>'
await message.channel.send(response)
return
@heavy folio
hang on, just got what you meant
and what didnt work
yes
the emoji isnt shown
If i didn't get hosting for my bot , emoji can't know or what
Is there free hosting or paid and how much need money to host it
does the bot have access to the server the emote belongs to?
it has administrator
How much?
Well if you go with Aws there is a free trial for an year
But you need a credit card
How can i get it ?
Because i need to make one
And published
But i don't know about the hosting
From here ?
Thanks for your help
No problem
Guys what does that mean
How to host a discord bot
I see
help
oh yea my database browser is in another language
i mean i am trying to learn japanese but its not my main layout
and it switched to japanese
how can i change it
LOL wtf
i literally know like 5 words in japanesae
so i def dont even know where the change lang button is
i'll try to guide you, click the second word in the top bar, then click the last button from the dropdown menu that will appear
rip ik
sure
which one
If you want
no advertising
i hit save didnt do anything
lol
eezz
Why is it like this? It doesn't want to run my bot. Website: "repl.it"
Why can't it find main.py
Refresh the bot token
Your showing your token
I refreshed it alr
Mk then
wdym
!d discord.ext.commands.Bot.guilds
property guilds```
The guilds that the connected client is a member of.
requires guild intents i think
hi everyone
@bot.command()
async def rank(ctx):
userExp = showdata(ctx.author.id)
requiredExp = 100
level = 0
while True:
if requiredExp < userExp:
level += 1
userExp -= requiredExp
if userExp<=0:
userExp = 0
requiredExp += 100
else:
embed = discord.Embed(
title="LEVEL SYSTEM"
).add_field(
name="YOUR LEVEL => {}".format(level),value="AMOUNT OF EXP THAT YOU NEED => {}".format(requiredExp-userExp)
)
await ctx.reply(embed=embed)
break
when I use this as rank command
it just replies twice
I didnt understand why
maybe you have two instance of your bot running
btw with this you will always need 100 xp level, your increment method will increment requiredExp for the current instance, but when you call the command again requiredExp will be equal to 100
nah
yup trust me, you need to use a database for this
you see the userExp -= requiredExp thing
after that I have requiredExp += 100
it scales 100 exp every level
uhm maybe it sends it twice because of the while loop, now i can't check furthore maybe someone else will help
I think I found the problem wait
damn my dumb head..
I used bot.process_commans() twice in a on_message function
anyway thanks for helping
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
class ticket(commands.Cog):
"""huh4?."""
def __init__(self , bot: commands.Bot):
self.bot = bot
bot.add_view(Closetic2())
bot.add_view(Closetic())
bot.add_view(RowButtons())
oh shee mb
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโs robots.txt file; (b) with YouTubeโs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
in closetic2 class there is channel argument required which is in a sub class how do i get it there
i mean
after my bot restart my view button not working
so i add that
tried making the argument a property?
class Closetic2(disnake.ui.View):
def __init__(self , channel : disnake.TextChannel):
self.channel = channel
you mean channel?
with open("ownticket.json") as s:
logss2 = json.load(s)
guild_id = str(interaction.guild.id)
if guild_id in logss2.keys():
logsid = logss2[guild_id]
if a == logsid:
for channels in interaction.guild.text_channels:
if channels.name == str(a):
channelslogs = channels
em = disnake.Embed(title="Closed ur ticket",description=f"in server {interaction.guild.name}",color=aqua)
await interaction.send(embed=em)
await channelslogs.edit(overwrites=overwrites)
emb = disnake.Embed(color=aqua,title="Ticket closed",description="Click Delete ticket button to delete the ticket")
await channelslogs.send(embed=emb,view=Closetic2(channelslogs))
``` this class has the channel
class Closetic
You have to pass a textChannel as argument, inside a Cog class you have no channel parameter, you can get one by fetching it by id but then it will work only for that channel with that instance of your view
listen
Are you trying to use persistent views?
They don't act like that
i only need the first one
You need to store the view instance that you created first time
They won't work
You need to store the whole instance
class RowButtons(disnake.ui.View):
def __init__(self , bot: commands.Bot):
self.bot = bot
super().__init__(timeout=None)
@disnake.ui.button(label="Create ticket", style=ButtonStyle.blurple)
async def first_button(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction):
it looks like
Like
view = View()
await ctx.send("yo", view=view)
dB.store(view) #example
And when the bot starts
view = db.retrieve(view) #again example
bot.add_view(view)
@slate swan
im using json.
Ya
okay
add_view(view, *, message_id=None)```
Registers a [`View`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.View "discord.ui.View") for persistent listening.
This method should be used for when a view is comprised of components that last longer than the lifecycle of the program.
New in version 2.0.
hm?
I think I'm a bit wrong
Just don't mind what I said
Persistent views really are complex
Guys, idk if these is related to discord bots or anything, but I recently moved from Replit to vscode for bot dev. Everything's good except the flask server. Replit has a url which I can ping through uptimerbot. But vscode only has an ip on port 8080. Uptimerbot doesn't allow any port specifications. Any suggestions for another service or removeing port on Vscode?
if you need your bot to run 24/7 then you have to use a VPS
otherwise self-hosting
oh ok
@tough lance can u help?
What
^
Dunno how they work
okay
It's been 4 months since I coded in python
oh learning something new?
I once used them but I forgor
ok np
Nah I'm in college and a biology student so I don't usually have time
isnt this supposed to delete all from a database
guys this is my code
the bot basically is supposed to give the test role to the member who types okay in the chat
and the bot has roles itslef which gives it administrator perms and even while adding it to the server it had those perms
but still everytime i do it it shows iscord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
please help me
!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.
what
It does not have permissions to give the role, as the error says.
it does i gave it the roles and even in the perms calculator it shows that it can manage roles
give the full traceback.
Traceback (most recent call last):
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\dhruv\OneDrive\Desktop\Dhruv\simple.py", line 17, in on_message
await message.author.add_roles(role)
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 846, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 329, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
who are you trying to add roles to
You must have the manage_roles permission to use this, and the added Roles must appear lower in the list of roles than the highest role of the member.
import discord
from discord.ext import commands
from discord.ext.commands import Bot, Cog
from discord_slash import cog_ext, SlashContext
class Whois(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print(f"{self.__class__.__name__} Cog has been loaded\n-----")
@cog_ext.cog_slash(name="whois",description="Gives info about a user")
async def whois(self, ctx, member: discord.Member = None):
if not member:
member = ctx.author
member = ctx.auhor if not member else member
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)
embed.set_author(name=f"User Info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"Requested by {ctx.author} - https://daxbot.net", icon_url=ctx.author.avatar_url)
embed.add_field(name="ID:", value=member.id)
embed.add_field(name="User name:", value=member.display_name)
embed.add_field(name="Created at:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="Joined at:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))
embed.add_field(name="Top role:", value=member.top_role.mention)
await ctx.send(embed=embed)
def setup(client):
client.add_cog(Whois(client))
``` Why doesn't this slash command pop up
which ever person messages "okay" will get a role added to them
@spring flax can u help me with Persistent views
Whois cog?
maybe
ok then
yeah?
what is the question even?
hey
I REALLY WANNA KISS YOU
MY GOD YOU SOLVED MY PROBLEM IN SECONDS
THANK YOU SO FRICKIN MUCH
listen!
Got any idea
add the view when the bot is ready.
as easy as that?
class ticket(commands.Cog):
"""huh4?."""
def __init__(self , bot: commands.Bot):
self.bot = bot
RowButtons()
hm?
what is RowButtons?
view
if you're thinking to add the buttons like that, how is that going to work?
i just added that
you're just putting a class there, nothing more
wait its class
like I said, read this ^
in a function, add the following code
ok
!d discord.ext.commands.Bot.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the clientโs internal cache is all ready.
Warning
Calling this inside [`setup_hook()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.setup_hook "discord.ext.commands.Bot.setup_hook") can lead to a deadlock.
!d discord.ext.commands.Bot.add_view
add_view(view, *, message_id=None)```
Registers a [`View`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.View "discord.ui.View") for persistent listening.
This method should be used for when a view is comprised of components that last longer than the lifecycle of the program.
New in version 2.0.
just three lines, that's all
are you using discord.py?
self.bot.add_view and ready()
huh
it should be
class your_cog(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def a_function():
await self.bot.wait_until_ready()
self.bot.add_view(your_view)
thats what im doing
How fix to it?
class ticket(commands.Cog):
"""huh4?."""
def __init__(self , bot: commands.Bot):
self.bot = bot
async def setup(self):
await self.wait_until_read()
self.bot.add_view(view=RowButtons(self.bot))
uh
fine?
also
await self.bot.wait_until_ready()*
that need another class
more lines!!!
^
import simple xD
idk it works
no
i have used some old things for loading
bot = commands.Bot( command_prefix= (prefix),intents=intents)
hey all i need a help um I am making an economy bot so how i can store user data
database
um json or python mysql?
idk
:/
btw i want to create it like this
thanks
xyz thing : and the amount
*when u know what u want but u cant do it
ya lol
stocks
ignore that
Json is not a database
tell me how to do that
use dict as database
Use a database
python mysql.connector ?
Mysql, aiosqlite, postgresql, etc anything
Other than json
@supple thornbro can you plz tell me how to do this
xyz : amount
yzx : amount
;-;
anywhere?

cane?
You can easily do this in a database
Just learn how to use one
And it will be clear on what to do for your purpose
hey guys my
bot.run()
``` is empty
A person believed you earlier
Okay
class Sluppy(commands.Bot):
def __init__(self):
super().__init__(command_prefix=prefix, intents=intents)
def setup(self):
self.add_view(RowButtons(bot))
def run(self):
super().run(token=tokens)
self.setup()
bot = Sluppy()
lol
hey i want to ask that if want on_message(message) but after replaceing the & in the message with a then how would i do that
lol..
nvm guys
Good job cause i couldn't understand that
๐ฅซ ๐
anyone have any idea how to fix this, Ill be converting this into my discord bot after though xd
change it to int
ok ok
yes
ok
lets test the ticket command
from discord import everything
everything =
Jesus christ
That's longer than some of my command files
Is there anyway to check if the author is not connected to any voice channel
finally it worked xd
property voice```
Returns the memberโs current voice state.
Thanks
lmao
hey guys how can i code a program in htis way that if a person doesn't send a catchphrase in 24 hours the role will be removed
Can you me give an example of an if statements that shows the message author of the join command is not connected to any voice channels, that would be grateful
Use the datetime module and have a variable that has the time when the catchphrase was last said and check it with the current time every second or 5 seconds if it's been 24 hours yet
yea ik tho how will i check if it ' has been 24 hours '
from datetime import datetime, timedelta
times_up = datetime.utcnow() + timedelta(days=1)
catchphrase = False
while catchphrase is False:
if datetime.utcnow() > times_up:
catchphrase = True
...
break
That is an example
Missed something damn
ty
lol i was commenting it but i've lost hope xD
Thanks
Commenting on the example?
well nothing too excessive of course, it is not wrong but...
import datetime
from datetime import datetime, timedelta
D_D
I was panicking
hahahahaha
Must be the first one to answer
i've not seen hunter today, it is not the same without him
right hahaha
Anyone?
normally slash commands takes up to 1 hour to be registered globally
dunno how it works for discord_slash
that might be it idk
the question should be "why are you using dpy when disnake exists?"
how?
Why are you running it from cmd ๐ณ
And pretty sure the real extension of whitelist.txt isn't .txt
it is
ide?
Btw what IDE are you using
whats an ide
Code editor
Use code editor for god's sake
im good
Pycharm, visual studio code
i have vs code but it keeps running my old code even after saving, so i cbf messing with it
Etc
Do you delete your terminal when rerunning
i CTRL C
I was making a minecraft status checker using mcstatus, currently I am stuck with how to refresh my message ```py
class Refresh(disnake.ui.View):
def init(self):
super().init()
self.value = None
@disnake.ui.button(label="Refresh", style=disnake.ButtonStyle.green, emoji='๐')
async def confirm(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction):
await interaction.response.send_message("Refreshing", ephemeral=True)
self.value = True
self.stop()
@bot.command(hidden=True, description='deploys status checker.')
async def deploy(ctx):
view = Refresh()
off = disnake.Embed(title="Status for GG Network", description="Oh! no the server is offline", color=ctx.author.color, timestamp=datetime.utcnow())
off.set_footer(icon_url=ctx.guild.icon, text=ctx.guild.name)
msg = await ctx.send(embed=off, view=view)
await view.wait()``` I want to refresh using button and there's an if statement to check whether the server is offline or online if status.players_max="1" then the server will be offline.
You can assign a message to an attribute of your class
Nvm it's interactions
Then assign an interaction
Simple OOP
self.inter = interaction```
In the confirm method
And then you can do like
!d disnake.ApplicationCommandInteraction.edit_original_message
await edit_original_message(*, content=..., embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original, previously sent interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionMessage.edit "disnake.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.
This method is also the only way to edit the original message if the message sent was ephemeral.
Note
If the original message has embeds with images that were created from local files (using the `file` parameter with [`Embed.set_image()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_image "disnake.Embed.set_image") or [`Embed.set_thumbnail()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_thumbnail "disnake.Embed.set_thumbnail")), those images will be removed if the messageโs attachments are edited in any way (i.e. by setting `file`/`files`/`attachments`, or adding an embed with local files).
let me try
anyone got a ready ticket system?
why would anyone keep that
u gotta do urself
no, but we can help you to make a ticket system
ok
what are you confused about for making a ticket system? or are you just confused about the concept in general
see the message went fine
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'edit_original_message'```
! made it like py await view.wait() if status.players_max == 1: await msg.edit_original_message(embed=off) else: await msg.edit_original_message("Server is on.")
what is msg set to?
ohh, I see why. the documentation provided is for an interaction (eg what returns back in a callback for buttons, slashcmds, etc.)
msg = await ctx.send(embed=off, view=view)```
await edit(**fields)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
Note
If the original message has embeds with images that were created from local files (using the `file` parameter with [`Embed.set_image()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_image "disnake.Embed.set_image") or [`Embed.set_thumbnail()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_thumbnail "disnake.Embed.set_thumbnail")), those images will be removed if the messageโs attachments are edited in any way (i.e. by setting `file`/`files`/`attachments`, or adding an embed with local files).
@honest shoal there ya go
you were treating msg as if it was a slash commands interaction
if I remove the message variable can I use edit_original_message?
so the Message counterpart of it would just be msg.edit rather than msg.edit_original_message
hmm, they told me to do so
I think they might've assumed you were using a slash commands or an interaction, when you're just bounding it (msg) to a simple message sent
hey If I restart the bot, will the button of old command stop working?
ahh, I want to make it permanent
buttons only last for 3 minutes though before it times out
but I've seen the role pickers and all have permanent buttons?
oh interesting
which do not get timed out
maybe there's a way to do it, let me try and find it
oh
Ok so whos using mariadb for the bots?
My commands arent syncing (The output of tree.sync() is [])
code: https://www.toptal.com/developers/hastebin/pehoginafo.py
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Depends on case, you can handle this with simple try-except ig
hm
Or just make sure that you are connected every time you play something
Aren't you supposed to make the slash command above the tree.sync method?
You put it at the end no matter what
No
Bots can't stream videos
What's the easiest way to get slash commands without changing a lot of your code
Search+replace
Yeah but whats the easiest way
I dunno any other ways
Thats the easiest way to do it
No but to get the slash commands
Like what library etc
Just replace the decorators, ctx's, some typehints, do some linting and find if anything was replaced in a wrong way
discord.py, disnake, nextcord, py-cord, hikari
How do I make a list global, I have tried using global queue but when I use it in a command, the program brokes unless I declare that variable in the command part
define the list in the global scope




