#discord-bots
1 messages Β· Page 1087 of 1
Don't encourage people who give discord money ay
He isn't a regular nitro buyer
did you pass it in the bot class?
i never bought one myself
imagine buying it 
Is this ur first nitro? Btw
7+ times
oh lol Nice
I have also got nitro like 4-5 times, everytime it was a gift
Lucky
Indeed
show full code
@bot.command()
async def daykey(ctx, amount):
await asyncio.sleep(1)
await ctx.send(f"i worked")
@heavy folio
is that after bot.run()
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
i have this func ```py
def convert_to_stars(overall):
ratings = []
stars = {1 : "full" , 0.75 : "three quater " , 0.5 : "half" , 0.25 : "quater"}
for star in stars:
n = int(overall//star)
ratings.extend([stars[star]] * n)
overall -= star * n
return ratings
And based on the outcome of the func, I want it to send emojis from these:
FULL_STAR = bot.get_emoji(982990723660005436)
HALF_STAR = bot.get_emoji(982991530442784798)
THREE_QUARTER_STAR = bot.get_emoji(982991395595890758)
QUARTER_STAR = bot.get_emoji(982991561161838632)
this is what the func returns
What's the issue?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
https://paste.pythondiscord.com/ezikacuxuj
no errors in terminal
the embed is sent without the select menu
add the item first, then call the super().init
class Select2(discord.ui.Select):
def __init__(self):
options=[
discord.SelectOption(label="Deny",emoji=":cross8:",description="Choose to decline the donation"),
discord.SelectOption(label="Hold",emoji=":load:",description="Choose to put the donation on hold"),
discord.SelectOption(label="Accept",emoji=":tick:",description="Choose to accept the donation")
]
self.add_item(options)
super().__init__(placeholder="Choose an option here.",max_values=1,min_values=1,options=options)
async def callback(self, interaction: discord.Interaction):
if self.values[0] == "Deny":
await interaction.response.send_message(f"Your donation has been denied by {interaction.user.mention}")
elif self.values[0] == "Utility Commands":
await interaction.response.send_message(f"Your donation has been put on hold by {interaction.user.mention}")
elif self.values[0] == "Moderation Commands":
await interaction.response.send_message(f"Your donation has been accepted by {interaction.user.mention}")
``` this?
not that, in ur view class
k
class SelectView1(discord.ui.View):
def __init__(self, *, timeout = 180):
self.add_item(Select2())
super().__init__(timeout=timeout)
```?
yep try this
Still the same
hey everyone, wanting to figure out if discord has a function that allows me to read a users custom activity messages im using it to Quarantine users who custom messages in there profile that have curse words or anything hurtful/racist/harmful to other users. anyone know of a way ?
Yes I think there's an attribute
was thinking of using the CustomActivity
@bot.command()
async def mycustomstatus(ctx):
for s in ctx.author.activities:
if isinstance(s, discord.CustomActivity):
await ctx.send(s)
I don't remember which one lemme check it out
mountains wouldn't show how grateful i would be β€οΈ
@slate swan ^
@fresh ferry so basically you are trying to get member's status text right?
yeah and then code my to constantly detect from all users in the server to detect banned words and then ill code it to remove all roles and add a "Quarantine" like role
Ok haven't ever worked with statuses lemme seek some info
really weird, the syntax looks fine enough
First call the super() then add
Got the same code for my help command
It works there
making her go in circles π sarth told her to put it above and now you
though it should be below
π
class SelectView1(discord.ui.View):
def __init__(self, *, timeout = 180):
super().__init__(timeout=timeout)
self.add_item(Select2())
no errors?
Yea
No errors
weird, might as well ask in the dpy server
hm k
thank you thank you, its sort of a problem iv been wanting to sort out as once said bot is made i want to release it on github, discord doesn't ban harmful words via the custom activity and i cant tell you some of the stuff iv come across... want a way to moderate these problems.
i however have a bot already coded up ready to be posted to github regarding the custom presences of a profile 'for example' β user is playing call of duty | user changes name of call of duty to harmful/hateful word or words. β my bot will then remove said users roles and give a Quarantine role where all other members will not see said Quarantined user so owner can further investigate the matter
@fresh ferry ok yeah you were right, you just need to get CustomActivity activity and access its name attribute
I guess it will always be first activity in activities list
Also don't forget to enable presences intent on dev portal and in code
Games have different activity type and don't inherit from CustomActivity iirc
How do i put βfooterβ in my embed?
!d discord.Embed.set_footer
set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Thank you
or you can use this
embed=discord.Embed(title="title", description="description", color=0xff0000)
embed.set_author(name="name", url="url", icon_url="icon")
embed.set_thumbnail(url="thumbnail")
embed.add_field(name="field", value="value", inline=False)
embed.set_footer(text="footer")
await ctx.send(embed=embed)
set_footer that's it
yeah, and i guess my problem is i want to try and read this
FYI im using a moderator in this server as an example of the idea im trying to achieve
Your way of reading status was correct
He's not setting presence but reading it from users
thats weird cause ur code works for me
oh well
status = ctx.author.activities[0].name```
@fresh ferry seems like status activity will always be the first in this list but I am unsure of this
i changed the emojis cause they won't work for me
Or ctx.author.activity
might have worked, ill update you if it is, just testing now
do you by any chance have SelectView1 or Select2 defined again?
can i see a screenshot of the command usage
could i message you my source to check over to make sure it makes sense ?
Sure
dmed you π
tru adding a print statement in the view's and select'a init to see if the classes are initialised or not
hm k
Nothing is printed
Added print at end of the class
Below self.add_item(Select2())

hm it seems like those classes don't get initialised then
can you ctrl+f and type SelectView1
So I installed discord slash commands through pip but its not showing up in vscode I guess?
dont use discord_slash
use discord.py 2.0, has buttons, selects, app commands and more
pip install -U git+https://github.com/Rapptz/discord.py
oh alright
and uninstall discord slash

can you send the complete file? it will be easier to figure out the issue
π
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
ill dm the link
How to create role that will be displayed separately, have red color and will be at the top?
Why do my slash commands not appear when I sync to a certain guild?
!d discord.Guild.create_role
await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") for the guild.
All fields are optional.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to do this.
Changed in version 1.6: Can now pass `int` to `colour` keyword-only parameter.
New in version 2.0: The `display_icon` keyword-only parameter was added...
check the tree's commands
hoist=True, color=discord.Color.red
What lib
how?
!d discord.app_commands.CommandTree.walk_commands
thx
I'll try tomorrow, thanks.
await fetch_commands(*, guild=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Fetches the applicationβs current commands.
If no guild is passed then global commands are fetched, otherwise the guildβs commands are fetched instead.
Note
This includes context menu commands.
the color doesn't work
is there something like setup_hooks in hikari/lightbulb or do i have to do it in the init dunder?
what you wanna do?
use hikari.StartedEvent, its called only once in the complete runtime
ah ok
( actually StartingEvent )
the startedevent is like on_ready which may get triggered multiple times if your bot reconnects to the gateway
?
what about while subclass lightbulb.BotApp?
does it need to be async?
no
use the init dunder then
aight
subclassing BotApp/GatewayBot is better cuz they wont allow you to add custom attributes to them with the bot= lightbulb.BotApp(); bot.apple = "banana" method due to the presence of __slots__
ya i noticed that
you can use bot.d.attribute tho d here is a dataclass ( added in lightbulb only )
yeah, cause they are mostly __init__.py files
ya its good for me, i prefix files with _ if they are not finished
if there is like a syntax error or something in the one of the extensions, will it raise syntax error or what?
hmm nice
The one thing I will never understand, why does discord.py use so many generics
Like, commands.Bot is generic, iirc?
Cogs are generic, context is generic
There are probably more, I could look into it, but I'm too lazy
Do you think its better to make a new .py file for every command or to have files under a specific category and then have all commands relating to that category in a single file
i make a file for each file, i feel its easier to manage. But if ur commands are very small and if it makes sense to have them in one file then go for it
thank ya
still an issue?
yes
alright, I need full traceback and relevant code
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
How would I get a bots activity
I know you can do change_presence but that just changes it?
just restart the vsc
I already solved that one ty tho
sir!
music bot?
bot.user.activity
ty
oe maybe bot.activity would work too
based on python
and that one for sure doesn't make an API call
yes
y?
anyone have an idea on how to make a command that would message a member?

!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
ctx.guild.me.activity

!d discord.Member.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
sorry....
lmao
is spotify wrapper legal?
welp idk abt that i am not exactly following tos anyway
As long as u do only what the docs say
Downloading songs or doing stuff which isn't in the API docs isn't
you basically download songs when you play them in vc
my bad
...
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
it is tho
no
Hello
hello
welp its fine as long as i dont help others or show how to do the same
I need the bot to write in the status looks for the "number" of servers
len(bot.guilds)
what variable is responsible for the number of servers
but i dont think the quality will be as good as on phone/pc will it?
Thanks
u want for members as well?
I heard stories saying you can't even automatize spotify because of the song frequency

but I doubt this
Yes
bot.members if i dont remember wrong
Ok thanks π
!d discord.Client.users
property users```
Returns a list of all the users the bot can see.
!d discord.Client.get_all_members :)
for ... in get_all_members()```
Returns a generator with every [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") the client can see.
This is equivalent to:
```py
for guild in client.guilds:
for member in guild.members:
yield member
stop-
yeah thats the one
I don't like this
they are different things
this returns the wrong number of users btw
it will have duplicate members too
yes
is this how you count in how many servers from the bot's ones a member is in
just use set on it :0, len(set(Bot.get_all_member()))
Heyo, is it possible to get every slash commands registered in each cog ? (I would want to make an help command with commands packed per cog)
what library?
discord.py does not have cog-to-app-commands bindings
?
there was something like this
!d discord.ext.commands.Cog
class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.
A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html#ext-commands-cogs) page.
When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
its app_command
Confused on what the int argument is?
a whole ass token leaked
its fine its not like the bot doesnt anything lol
you made a typo too
application_id
thank ya
reset your token in discord.com/developers
it should be an error in the cog name general
o
ooh that makes more sense
I think there was something wrong with main other than the misspellin
if I do asyncio.sleep on the bottom of this, will it, like ignore some reactions doing nothing? I don't want the overload the bot
@bot.listen()
async def on_reaction_add(reaction, user):
if (
reaction.message.channel.id != 957291513522585652
or
user == bot.user
or
reaction.message.author != bot.user
):
return
all_reactions = reaction.message.reactions
sum_of_all = 0
for idx, r in enumerate(all_reactions, start=1):
product = idx * (r.count - 1)
sum_of_all += product
avg_rating = sum_of_all / sum(single_reaction.count -1 for single_reaction in all_reactions)
overall_stars = convert_to_stars(avg_rating)
e = reaction.message.embeds[0]
e.description = f"""
Current Community Rating: {overall_stars}
{ONE} Poor
{TWO} Fair
{THREE} Good
{FOUR} Very Good
{FIVE} Excellen
"""
await reaction.message.edit(embed=e)
no that is just gonna wait for x seconds before running that code again
it pauses all work on the code in mean time
yeah, in that process, will it ignore the reactions that happened while asleep, or will it wait for the duration and handle those missed reactions
but it will eventually run it
It won't ignore those afaik
ignore
They would be ignored?
yeah
My bad then, really sorry
but if the user leaves a reaction like his name is there then there would be data like this user reacted and stuff in the reaction object
also, when I restart the bot, that code doesn't work when i react
but any event handler or reaction won't work
yeah reactions aren't persistent u have to use buttons for that it will be easier
message not in the cache
altho that can be done
u have to store the message id and fetch the message using that id
wait what, why
with fetching the message object u can get the reaction object replated to it too
because buttons are new in 2.0 and there is an neat example for persistent button in dpy docs
no i mean why doesn't the on_reaction_add get triggered after a bot restart
u just have to have a custom Id and set timeout = none i believe for that
an on_reaction_add() takes in an payload object
which is basically like the message object and checks if reactions are added
the payload or message object gets reset on bot restart
what would be the ideal way to store the message ID, then
yep small
yeah then json
i will have multiple polls at once, would this affect?
if i want to hide certain cmds from help, i will have to do hidden=True in @lavish micamands.command() right?
dont ping people randomly please
i didnt lol
and yes
@commands.command
it was not working
^^
okay. thanks
if hidden is true it will return a true else false
hm ok ill try that thanks
Asher's smort
don't use json.
also the longest error, remember, Asher?
i fixed it
small scale bot
oh yeah what was the reason?
bad if the data is modified frequently
yeah, there will just be 10 polls at specific times
did asyncio.run() in wrong place
but I think I just have to store and fetch, not modify
store reaction count too?
nope
yeah but 10 is not frequent i would say it's fine for most cases unless like json exceeds 1mb
just the message ID
oh well then
i think
nicetbh
then u gonna fetch the msg?
class discord_status(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@app_commands.command(
name="setbotstatus",
description="Change the bots active status.")
@app_commands.describe(
Status = "Bot Status"
)
@app_commands.choices(stat=[
Choice(name='online', value='online'),
Choice(name='idle', value='idle'),
Choice(name='dnd', value='dnd')
])
@app_commands.checks.has_permissions(manage_messages=True)
async def setbotstatus(
self, interaction: discord.Interaction,
stat: str):
mapping = {
"online": (discord.Status.online, "Working"),
"idle": (discord.Status.idle, "Updating"),
"dnd": (discord.Status.do_not_disturb, "Offline")
}
if not stat in ('idle', 'online', 'dnd'):
print('Invalid argument')
else:
await self.client.change_presence(
status=mapping[stat[1]],
activity=discord.Game(mapping[stat[2]]))
await interaction.response.send_message(f'Status updated.')
Getting an error for TypeError: unknown parameter given: Status
what else do you think?
I dont know which status its talking about
i guess what is what I need to do to make it work, yeah
show traceback
better was to store the whole message payload but for some reason Danny didn't want to provide access to it π
Well, make sure u don't get ratelimited
which part? fetching the message?
Danny.....no comments about that man
yea
oh wait, it would fetch the message each time. Yeah that's bad
what are alternatives do i have?
This?
Cuss Dandy on why tf does he not give access to the JSON Payload
Build discord bot using discord.py based on images. - Discord.py-Bot-Series/poll.py at main Β· DevStrikerTech/Discord.py-Bot-Series
Lemme see
u can just load it once
this one's pretty similar with what u are making
disnake
do you mind pointing to the exact line? the file is a bit long
not each time just on startup
the json part u can go thru it when u have time
No way tbh
My bad, Danny*
yeah I went through it briefly and didn't understand a thing. i'll look at it later
okay so that github code uses a lot of json.
I'm not looking to entirely change my code, I just want to store and fetch the message in a single json
sorry
nah lmao i was just finding it funny not offended in any wayπ€£
so whenever a poll is being created put the message id in a json
This is a weird question, but if you have a function that's low priority is there a way to make it only take up a small amount of cpu and run slower
no
oh i could just do sleeps i guess
small amount of cpu should be possible ig
Okay - but I don't get how I only do this on start up
u could check os lib on that not really sure
in on_ready ig not really sure i haven't really ever tried persistent reactions on bot restart i have only used them in a bot wait for
Actually I mean, I don't know how not to keep fetching the message
just fetch it once on on ready
Ash would prolly know better on this than me
u can ask her
How to do this? Like i send a cmd help and edited the message to addemoji then the bot's message was also changed this follow as many time we edit it
"DELETE FROM submissions, likes WHERE link = ?" is this how you delete from two tables at once
ew
don't think you can delete from multiple tables like that
where else can u do it? (asking srsly coz i never did b4)
...
make a task that you only start once
just use asyncio.run before bot.run instead dude, if u r making a task with 1 count
hmm yeah
@maiden fable could you help with this?
^^^
just as hunter said u just have to fetch the message object once u can do that before bot.run by creating an async function for those messages and running it using asyncio.run()
Oh okay didn't know that was for me
u could do it in on_ready also but it doesn't seem professional ig
I also didn't know I sent that for yr issue
Yeah, api calls on the on_ready event aren't suggested
btw if u are using bot.start u can just await the asynchronous function
you're looking for a startup task I suppose?
Yeah Im still confused what to do
only bad thing is just sending duplicate request thats all really
Maybe I'd be better off creating a help channel
I'll look for a screenshot
Thanks, basically what I want is the on_reaction_add to be triggered after a bot restart on each poll (there will be 10 polls happening simultaneously)
this can be done when extending a botclass too... depends on when you want to run the startup task
In v2, yes
v2 is just a setup hook...
I remember someone not being able to access it
They on disnake
Ah, big F ig
And idk what changes disnake still has, from dpy
u can do bot.loop ig i just did that day before yesterday
cog_load exists for cogs, why not use it? π
yea just realized u can do that in disnake sorry
!d disnake.ext.commands.Cog.cog_load
await cog_load()```
A special method that is called as a task when the cog is added.
well when u think of it properly there are prolly loads of ways u can do it
Yeah other than making the loop, I just dont know what the loop func should have
night
I know that I should put the message ID of each poll to json. But not sure what to do with it
good nightttt
Night Hunter, have a good sleep
can discord bot own his storage ?
whoa whoa whoa what's that above
Replit 
"discord bot has his own storage", uh?
.
...?
Post full code and the entire traceback, not a picture of it
I believe it wasn't required in 1.7 either
Yeah
Yes but please post your entire code
Yep
I'm not sure what the while True: await on_guild_channel_... stuff above it is
actually the kwarg existed but it was not a required one, but now it doesn't exist at all
but we need to get that fixed
run(*args, **kwargs)```
A blocking call that abstracts away the event loop initialisation from you.
If you want more control over the event loop then this function should not be used. Use [`start()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.start "discord.Client.start") coroutine or [`connect()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.connect "discord.Client.connect") + [`login()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.login "discord.Client.login").
Roughly Equivalent to:
```py
try:
asyncio.run(self.start(*args, **kwargs))
except KeyboardInterrupt:
return
```...
Ah okay, that's pretty common where it exists but isn't required, removed in later updates. I believe it was the same deal for self bots
bare exceptπ
what is this name
that was indeed used for self-boting
nice event
what name
no thanks
reported for impersonation of staff π
recursion
π³
is that a raiding thing?
i mean nuke bot
I'm not sure what the while True: await on_guild_channel_create(channel) is going to do except cause a recursion error
Robin i added my real name is that ok
no xd, it just triggers the event multiple times
creating 500 "Spam Channels"
Someone
good
That's good
Can the Discord bot work offline?
What a good guy
use on_message_update, and use await bot.process_commands(message) if there's a change in message.content, thats all
if you need help with an actual bot, feel free to come again
No
yes they can
Actually I agree
why
No, it needs access to the websocket
just change the status π§
And you need internet access to connect to the websocket, as obviously, it's over the web
Ah lemmie see that any docs?
Robin, would it be a bother if I ask you to check #help-rice
well, it can work offline technically
^
One moment, i'll check it out
Probably not very useful however
why it needs access to the websocket
It won't even be a discord bot anymore if it cannot even connect to Discord
well yeah, overlooking the gateway feature, it still will work
!f discord.on_message_update
well yeah
You are not allowed to use that command here. Please use the #bot-commands channel instead.

!d discord.on_message_edit
discord.on_message_edit(before, after)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") receives an update event. If the message is not found in the internal message cache, then these events will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.
If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_message_edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_message_edit "discord.on_raw_message_edit") event instead.
The following non-exhaustive cases trigger this event...
Discord's API works almost entirely off the websocket
oh, π its MessageUpdateEvent in hikari so uh lmao
@slate swan if i do this i have to check that if message author is client right?
would it be faster to:
for link, future_time in decay:
if future_time <= time_stamp:
try:
for prompt_type, user_data in submissions.items():
for id in user_data:
del submissions[prompt_type][id][link]
except:
pass
await c.execute(delete_queries["submissions"], (link,))
await c.execute(delete_queries["likes"], (link,))```
or rebuild everything after
```py
for link, future_time in decay:
if future_time <= time_stamp:
await c.execute(delete_queries["submissions"], (link,))
await c.execute(delete_queries["likes"], (link,))
await c.execute("SELECT * FROM submissions")
for link, id, prompt_type, future_time in await c.fetchall():
if id in submissions[prompt_type]:
submissions[prompt_type][id][link] = []
else:
submissions[prompt_type][id] = {link: []}
await c.execute("SELECT * FROM likes")
for link, id, prompt_type in await c.fetchall():
submissions[prompt_type][id][link].append(id)```
yes
nope, you just gotta check if there's an change in message.content or not
you mean the gateway
might use timeit to measure the time
or time.perf_counter
bit difficult without a ton of data
Ohk lemmie try , btw ty
The gateway, yes. They also have a RESTful API, should've clarified
The Internet is storage devices and cables connected between them, is this true? If Discord Bot has its own storage device, why does it need access to other devices (internet)

not quite, the internet is like a tree of connections between the world in a sense
Oh god
so much love in this channel right now, i love it
I believe you're grossly misunderstanding how it works
can we take this to an ot channel?
damn hunter doesnt like loveπ
The internet, in a very simplified manner, is a world wide connection of smaller networks, not wires and storage devices
oh ok
actually from previous tests it's about 10x faster searching data and changing it rather than building dictionaries so ill go off of that 
wires and storage devices seem like a server
i dont understand
The internet can be quite difficult to get your head around. I've been studying networking for a while now and picked it as my chosen career and still don't understand it fully
world wide connection of smaller networks.. isnt storage devices
https://www.youtube.com/watch?v=UXsomnDkntI this is a good example it showed me allotπ
Dr Binocs will explain, "How The Internet Works? | What Is Internet? | How Internet Works | Internet | Kids Learning Video | Technology "
Make sure you watch the whole video to know all the answers to your curious questions about internet and how internet works.
For more fun learning videos SUBSCRIBE to Peekaboo Kidz: http://bit.ly/SubscribeTo...
Your home network, for instance, is a small network in and of itself
The home networks of everyone on this world together could be considered an "internet"
nice
so its small storage and world storage , right?
A network is then composed of multiple hosts and intermediate devices, switches, hubs, hosts (computers, phones, laptops), routers, etc
the internet is just cables carrying a bunch of signals with some complicated switches in the middle
Not really, storage devices are only part of a host
We do have some cables (transatlantic cables, for instance), but more times than not you'll be contacting other devices wirelessly
its not just some cables~
And switches are part of an internal network (assuming we're talking about layer 2 switches)
You can assign a IP for maintenance on their VLAN port, other than that they operate exclusively off MAC addresses on layer 2
Well, what does websocket have that no one else has like discord? Within all of this
Websockets aren't exclusive to discord
You can build your own websocket client/server without much effort
client/server not storage right?
so discord dont have client/server
websockets is like a phone you first have to call the person which is like a handshake and then you talk with them sorta like sending heartbeats so the conversation doesnt get all silent
They do, most things do
so why discord bot cant work offline
Websockets are special because they're live, and discord tells you whenever there's an event (new message, new channel, etc)
If you're offline, your computer can't connect to discord's servers
ok
because it needs a medium to send and receive data from/to the remote discord servers
What does Discord Bot need on my device?
and i can't put it in his Discord for storage
If you're offline, your computer can't connect to discord's servers
why it need my computer , discord bot have one or more
None, just a wrapper (which in itself you don't need), and obviously a programming language
you don't save the discord bot in your storage? you just have a token which is like an API Key, you send requests to discord with that token as headers, like "hey, this is my bot's identity and i wanna do X operation"
Yeah I believe you're also misunderstanding how a discord bot works, as it's not a file or folder that you can put on your computer
So everything the bot needs can be transferred from my computer to its own computer, and it works in an offline state
You need to tell Discord's server what you want your bot to do, for example you can tell it "hey, can you make my bot say X in channel Y? thanks"
oh
For this reason a storage device isn't even necessary to run a discord bot (serverless computing)
and the file you save on your device, its just a way to communicate to the API using a programing langauge
(You need to tell Discord's server what you want your bot to do), Is it possible to set a programming to tell the discords server to do this automatically?
That's exactly what your code is
so no need to me to tell him and no need to me online
When you do this for example:
await ctx.send("Hello, world!")
That's instructions for discord on what it should do to your bot
You tell discord, not your bot
And when you save your .py file on your computer, that's a list of instructions on to tell discord
Let's say one of the things I tell Discord to do is launch the bot
Right
Is it possible to put an automatic command for Discord somewhere that has it (launch the bot)
its a method 
Can it be made temporary or automatically without my intervention?
It is, but I don't want to confuse them more than I've already done
lmao
As long as they get the general concept now the details can come later
Robin is tryna make someone understand how Discord Bots work
okay sire
π€ It's possible, similar to how when you turn on your computer certain apps will run by themselves
how can i put this to role by ID?
if payload.emoji.name=='Muted':
role = discord.utils.get(guild.roles,name="Muted")
if role is not None:
member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
if member is not None:
await member.add_roles(role)
So, i want to delete Muted and solve with Muted role id
.get_role(id)? Unless I'm misunderstanding
I replace myself and my device with another temporary or automatic code that is inside a discord server or somewhere there , is this make it will work offline? offline = without me and my device
π i try to understand , sorry
Ah okay, I was misunderstanding what you meant by "offline". If you want your bot to run without you or your device, that's 100% possible
and how can i use it in my code?
Buy a VPS and put your code on it, and your bot will always be up regardless of if you have your device or not
role = guild.get_role(id)
oooo i so dumb!
Returns the discord.Role object from ID
ty sir!
Also same deal for member, use guild.get_member(id)
can i ask more thing
Don't ask to ask, this channel is for questions only
and thanks for your time, and your care to teach me
who say this , did he want people not learn anything?
Huh?
discord have VPS ?
Nope
VPS is like an online computer which runs 24/7 and u gotta pay companies to rent those VPS out to u
No, you need to get one yourself
online computer? 
That is the crux, yes
How much time does it take to verify a bot ? I just submitted my id to Stripe but discord keeps saying this : We are unable to verify your identity because one or more of the documents you provided are invalid. Please try again.
Seems like an issue with ID Verification. Try clicking a clear pic
Does anyone know how you'd be able to get a message ID from a message your bot sends?
Read it's something like this
edited = await channel.history() ...
how do you even describe an online computer 
@commands.command(name='time', pass_context=True)
async def _time(self, ctx):
now = datetime.datetime.now()
current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)
await ctx.send('Date is: **{0}**\nTime is: **{1}**'.format(time.strftime("%A, %B %d, %Y"), time.strftime("%H:%M:%S %M")))#("%I:%M:%S %p")))
ind_time = datetime.datetime((timezone("Asia/Kolkata")).strftime('%H:%M:%S'))
await ctx.send(f"IST: {ind_time}")
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Asia/Kolkata' object has no attribute 'strftime'
A computer which u access via an online panel?
I mean that is the easiest way to say it
how to send ist time ?
How much time does it take to verify if the id is clear
Is it instant
Instant
So I have to keep trying ?
For more questions, they can help u better- https://discord.gg/discord-developers
Thanks but Im happy here lol
Haha that is the official discord server and its basically made so that people can ask questions related to Bot Verification and other discord products, that is why I suggested it
I know, but I might not be welcomed there
?
Could be like so
Everyone who has questions related to bot verification is welcome there
how can i make a video fun with command? i have a white wall mp4 video, and if i write >hello asd the bot send one video with my white wall but write to the wall "asd"
@client.command()
async def hello(ctx,*,szoveg="hello"):
clip = VideoFileClip("crab.mp4")
clip = clip.subclip(0, 5)
clip = clip.volumex(0.5)
txt_clip = TextClip(szoveg, fontsize = 75, color = 'green')
txt_clip = txt_clip.set_pos('bottom').set_duration(5)
video = CompositeVideoClip([clip, txt_clip])
file = File(filename="crab.png")
await ctx.send(file=file)
i try this with moviepy
I went through the id part but now I have need a terms of service url
Does it have to be a link to a website or can it be a link to a file
I dont have a website
I had to leave it
Because they say in the rules dont put a link to your bot in bio so i will remove it now
just create a website, what Hunter π
Wait
My friend has vps where my bot is hosted
Might start a flask server that points to the terms of service
Would that be ok
Because I only have ip
Dude I am not good when it comes to websites
What is there to laugh...
What you said about websites
She just said what Discord expects us to do, not a thing to laugh on if I or anyone else doesn't like it
U can still make websites in Python fyi
I know and Im planning to use flask
I might even start the server when the bot starts
Like in repl
cool, so yea no need to laugh on anyone here, who knows u hurt whom
I was just wondering if I could use an ip link instead of a domain
Threading?
plain html and css would work fine for the purpose
plain CSS hyperventilating noises
from discord.ext import tasks
hey guys, what does it mean?)
just host the website on replit or github (if static)?
no one even reads the ToS and Privacy Policy before he/she gets into a situation
Simple, really, imports the tasks extension
and what does tasks do?
this was my qua)
Ahh, it's an extension to help dealing with interval based things easier, for example if you wanted to run a function every 2 minutes, you'd use the tasks extension
Sort of like background polling if that makes sense
tasks are just asynchronous loops that do not block your code and are helpful in running things multiple times without your bot being blocked
uhh
oka thx
for example
@tasks.loop(seconds=1) #ofc not gonna run it ever second
async def _():
c = get_channel(...) or await fetch_channel(...)
await c.send("uwu")
_.start()
await _[0]()
what have i done
so , dose discord own a VPS ?
Haven't I already answered the question?
They have their own servers
hunter what do you think of this?
Most likely from cloud service providers as having your own large scale datacenter is difficult
So, the Discord program that we are using ..can work without VPS
seems cursed so i will put it as my name
The discord program you are using right now is just a regular old application, like anything else on your computer
It communicates to discord's server via their user API, however
aka a client
Your bot does the same thing, except using the bot API
The discord API is more or less a way for bots to be able to use discord sort of like you are
Very valuable information, I do not know how to thank you for your time and interest, and all those who shared the knowledge with me
I do agree that Robin is great at explaining things
look who's saying that
. I will make sure this information comes to fruition that would be a thank you
The one who says VPS is just an online computer 
No problem, feel free to ask anytime. I do love explaining how things work more than I like fixing problems
I'll gladly ignore that opinion
either way, I ain't really as good as Robin when it comes to explaining stuff
inarguable
I know it's hard to explain how things work, because the listener, or the reader, doesn't have the same terminology, but I try as much as I can.
Nice
looks like _ is a list/tuple of coros? or atleast the first element is 
that is so.
not coros but function objects
Imagine calling a string
point of awaiting them?
it has either to be a coro, or return a coro
its a function object until you call them which makes them a coro and then you await it
or am i wrongπ
You are correct
im using a decorator to make a list of decorated coros and then i index the list and i call them
[{identifier: functionobject}]
something like this
the underscore makes it look cursed.
its lovely
nice readiblity tho
!e
from datetime import datetime as _
from datetime import timedelta as __
def ___():
____ = _.utcnow() + __(seconds=10)
return ____
print(___())
@slate swan :white_check_mark: Your eval job has completed with return code 0.
2022-06-05 19:22:39.386592
ah
Ashley, just use __import__ and lambda and go to #esoteric-python for that code next time
lmao
I need help
It keeps saying this and it keeps me from getting my bot online and it is so dam annoying
Like deadass, someone help me fix this stupid error. Nothing is wrong with my code this error happens out of nowhere ong
Looks like you may be getting rate limited?
How would i be getting rate limited? any ideas?
Hard to tell though, can you paste the entire thing into a pastebin?
Well yeah, it's replit. Not much you can do as the service is pretty crappy tbh
using replit is one of the reasons
In this case the only reason
you guys got any other good coding softwares? with webserver support?
Unless you're doing something in your code that's getting ratelimited which I doubt
You're looking for a VPS, not an editor then
i'll suggest writing the code on ur device, and deploying it later on a vps
alr
try it?
so im guessing, if i were to get a vps synced with the replit service it would run off the vps and not replits service?
global slash commands take upto an hour to get registered
ok
sure, i'll just used github integeration in that case
open the github repo in my repl,
code my stuff
test it
push it in the repo
and set my vps to automatically update with the triggers in the repo
i had added a cmnd 2-3 days back but still not registered
what library are you using?
dear, please help me how to attach a link from a disk to a laptop?
embed.set_image(url = )
!local-file
Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:
# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")
# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
file = discord.File(f)
When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.
discord.Embed instances have a set_image method which can be used to set an attachment as an image:
embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png") # Filename here must be exactly same as attachment filename.
After this, you can send an embed with an attachment to Discord:
await channel.send(file=file, embed=embed)
This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.
in case you mean a local image
this is how i defined my buttons, how do i delete it after interaction?
@discord.ui.button(label='Cancel', style=discord.ButtonStyle.red)
async def Cancel(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_message('Profile Cancelled', ephemeral=True)
self.can = True
self.stop()
isnt there something like .clear_items
let me check
file = discord.File("C:/bot py/Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(url = "attachment://file.png")
Please help me why is it throwing an error?π₯Ί
the file path you mentioned is wrong
hmmm. how about specifying the path?
@bot.on("READY")
async def connect(payload: dict[str, "Any"]) -> None:
print(payload)
what do you guys think?π€
sarthak check the impl, pls
go to that file and just copy the path from its properties
this looks noice, but why raw payloads, you can make dataclasses for events
i will soon
sounds good then
i have allot to doπ
yea i'll help ya:
first import os (at the top of the file):
import os
second get the current path:
path = f"{os.path.dirname(os.path.abspath(__name__))}/"
now lets get the image:
file = discord.File(f"{path}Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(url = "attachment://file.png")
this should work
assuming your folder structure:
C:/bot py/
-> Π±Π°Π½
-> main.py
-> -> clear.png"
path = f"{os.path.dirname(os.path.abspath(__name__))}/"
file = discord.File(f"{path}Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(url = "attachment://file.png")
This program doesn't love me
show your work dir
yea that doesnt look right
from pydoc import describe
from turtle import title
from urllib import response
import discord
from discord.ext import commands
from PIL import Image
import requests
from requests import request
from PIL import Image, ImageFont, ImageDraw, ImageOps # ΠΠ»Ρ ΡΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΊΠ°ΡΡΠΎΡΠΊΠΈ ΠΡΡΠ΅ΡΡΠ²Π΅Π½Π½ΠΎ
import io
import os
import sys
class pillow(commands.Cog):
def __init__(self, bot) -> None:
self.bot = bot
@commands.command( name = '123', aliases = ["321"])
async def command_123(self, ctx,):
img = Image.new('RGBA', (8000,4800), '#232934' )
embed = discord.Embed(
title="ΠΡΠ» Π·Π°Π±Π°Π½Π΅Π½ ΠΠΠΠΠΠ ",
color= 0xff0000
)
embed.set_footer(
text="| ΠΡΠ°Π²ΠΈΡΠ΅Π»ΡΡΡΠ²ΠΎ SK",
icon_url= ctx.guild.icon_url,
)
path = f"{os.path.dirname(os.path.abspath(__name__))}/"
file = discord.File(f"{path}Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(url = "attachment://file.png")
embed.add_field(name="ΠΠ°Π½ Π²ΡΠ΄Π°Π½:", value="China", inline=True)
embed.add_field(name="Π‘ΡΠΎΠΊ Π±Π°Π½Π°:", value="2 Π΄Π½Ρ", inline=True) # ΠΏΠΎ ΠΎΡΠ΅ΡΠ΅Π΄ΠΈ ΠΏΠΎΡΠΎΠΌΡΡΡΠΎ Π² ΠΊΠΎΠ½ΡΠ΅ True
embed.add_field(name='\u200b', value='\u200b', inline=False)
embed.add_field(name="ΠΡΠΈΡΠΈΠ½Π° ΠΠ°Π½Π°:", value="ΠΡΠΈΡΠΈΠ½Π°", inline=True)
embed.add_field(name="ΠΠ°ΡΠ° Π²ΡΠ΄Π°ΡΠΈ:", value="ΠΠ°ΡΠ°", inline=True)
await ctx.send(embed=embed)
def setup(bot):
bot.add_cog(pillow(bot))
i said your work directory not your cog?
have i got that correcly
i recommend not using absolute paths
And how then?
you would check the path relatively
I followed this path
:))
# Discod Module
import discord # ΠΠΎΠ΄ΡΠ»Ρ Π΄ΠΈΡΠΊΠΎΡΠ΄Π°
from discord.ext import commands # ΠΡΠ½ΠΎΠ²Π½ΡΠ΅ ΠΊΠ°ΠΊΠΈΠ΅ ΡΠΎ ΠΌΠΎΠ΄ΡΠ»ΠΈ
# Installed modules
import random # ΠΡΠΎ ΠΏΠΎΡΡΠ΅Π±ΡΠ΅ΡΡΡ Π΄Π»Ρ Π½Π°ΡΠΈΡΠ»Π΅Π½ΠΈΡ ΠΎΠΏΡΡΠ°
import requests # ΠΡΠΎ Π΄Π»Ρ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π°Π²Π°ΡΠ°ΡΠ° ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ
from io import BytesIO # Π£ΠΆΠ΅ Π½Π΅ ΠΏΠΎΠΌΠ½Ρ, Π²ΡΠΎΠ΄Π΅ Π΄Π»Ρ ΠΊΠΎΠ½Π²Π΅ΡΡΠ°ΡΠΈΠΈ Π°Π²Π°ΡΠ°ΡΠΊΠΈ
from PIL import Image, ImageFont, ImageDraw, ImageOps # ΠΠ»Ρ ΡΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΊΠ°ΡΡΠΎΡΠΊΠΈ ΠΡΡΠ΅ΡΡΠ²Π΅Π½Π½ΠΎ
# Import SQLITE Module
import sqlite3 # ΠΠ£ ΠΈ ΠΏΡΠΈΠΌΠΈΡΠΈΠ²Π½Π°Ρ ΠΠ°Π·Π° Π΄Π°Π½Π½ΡΡ
)
# Installed modules
import os # ΠΡΠΈΡΡΠΊΠ° ΠΊΠΎΠ½ΡΠΎΠ»ΠΈ
# Cliear console [Linux]
os.system("cls") # ΠΡΠΈΡΡΠΊΠ° ΠΊΠΎΠ½ΡΠΎΠ»ΠΈ ΠΎΡ ΠΌΠΎΡΡΡΠ°
# Cosg list
cogs = [ # ΠΠΎΠ³ΠΈ ΠΈΠ· Π½Π°ΡΠ΅ΠΉ ΠΏΠ°ΠΏΠΊΠΈ
"mod",
"pillow"
]
# Class Main
class Main(commands.Bot): # ΠΠ±ΠΎΠ·Π½ΠΎΡΠ°Π΅ΠΌ ΡΡΠΎ Π½Π°Ρ ΠΎΡΠ½ΠΎΠ²Π½ΠΎΠΉ ΡΠ°ΠΉΠ» ΡΠ²Π»ΡΠ΅ΡΡΡ ΠΎΡΠ½ΠΎΠ²Π½ΡΠΌ
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# ΠΠ°ΡΠΌ ΠΏΠΎΠ½ΡΡΡ ΡΡΠΎ Π΄Π°Π»ΡΡΠ΅ ΠΌΡ Π±ΡΠ΄Π΅ΠΌ ΠΎΠ±ΡΠΎΡΡΡΡΡ ΠΊ client
client = Main(
help_command = None, # Π£Π±ΠΈΡΠ°Π΅ΠΌ help
command_prefix = ".", # ΠΡΠ΅ΡΠΈΠΊΡ Π±ΠΎΡΠ°
intents = discord.Intents.all()) # Intenst ΠΈΠ»ΠΈ ΠΊΠΎΡΠΎΡΠΊΠΎ ΡΠ°Π·ΡΠΈΡΠ΅Π½ΠΈΡ Π΄Π»Ρ Π±ΠΎΡΠ° ΠΠΎΠ±ΡΠΎΠ±Π½Π΅Π΅ Π·Π΄Π΅ΡΡ "https://discord.com/developers/applications"
@client.event
async def on_ready():
print("READY!")
# ΠΡΠ΅ΡΠ΅Π΄Π½Π°Ρ ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° Π½Π° ΠΎΠ±ΠΎΠ·Π½ΠΎΡΠ΅Π½ΠΈΡ ΡΠ°ΠΉΠ»Π° ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΡΠΊΠΈΠΌ Π° ΡΠΎΠ΅ΡΡΡ ΠΎΡΠ½ΠΎΠ²Π½ΡΠΌ
if __name__ == "__main__":
# ΠΠΡΠ°Π»Π° Π·Π°Π³ΡΡΠ·ΠΊΠΈ ΠΊΠΎΠ³ΠΎΠ²
for extension in cogs:
cog = f"cogs.{extension}"
# ΠΠ°Π³ΡΡΠΆΠ°Π΅ΠΌ ΡΠ°ΠΉΠ» ΠΊΠΎΠ³ΠΎΠ²
try:
client.load_extension(cog)
# ΠΡΠ»ΠΈ ΠΏΡΠΎΠ΅Π·ΠΎΡΠ»Π° ΠΎΡΠΈΠ±ΠΊΠ° ΠΏΡΠΈΠ½ΡΠ°Π½ΡΡ Π² ΠΊΠΎΠ½ΡΠΎΠ»Ρ
except Exception as e:
print(e)
client.run( "Token" )
This?
i said your work directory! e.g
ββββVideos
ββββCaptures
videos is a folder and captures is a subfolder!
that is called a directory!
i want to know where the photo is compared to your cog so i know its location and i can show you the relative path!
Hope. Just don't hit me
"../imageO/clear.png"
this should work
having all the media in your bot project's directory is always an better idea
oh, it is
or even better in the dir where you need themπ³
oh, where do you put it?
well youre using it here no?
is should be Image0/my keyboard doesnt support that language/clear.png
path = f"{os.path.dirname(os.path.abspath(__name__))}/"
file = discord.File(f"{path}Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(url = "attachment://file.png")
"../imageO/Π±Π°Π½/clear.png"
this is the correct one right?
@client.command()
async def help(ctx):
embed = discord.Embed(title=" ", color=0xff7b00)
embed.set_author(name="Help", icon_url="https://s2.coinmarketcap.com/static/img/coins/200x200/14481.png")
embed.add_field(name="_inputbruteforce (_ibf)", value="Bruteforce all possible inputs for a straight momentum.",
inline=True)
embed.add_field(name="_inputbruteforce45 (_ibf45)",
value="Bruteforce all possible inputs for a facing 45 momentum.", inline=True)
embed.set_footer(text="uwu")
await ctx.send(embed=embed)``` can someone help me finding what is wrong in this embed ?
i keep getting error messages
image0 is already a top level package so no need to .. it
send the error
does windows have a tree command in their cmd?
right right mb, my brain is all over the place thank god a smart person like you is here
yes
they could just use it and send their file structure here, quite easier to help then
File "C:\Users\arsbu\Documents\CODE\PKbot\main.py", line 353, in <module>
async def help(ctx):
File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 1263, in decorator
self.add_command(result)
File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 1149, in add_command
raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
Process finished with exit code 1
i was thinking about it but idk if they know about it
because that path totally depends on their bot.py
Β―_(γ)_/Β―
in your bot constructor set help_command to none
path = f"{os.path.dirname(os.path.abspath(__name__))}/"
file = discord.File(f"{path}../imageO/Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(url = "attachment://file.png")
π
remove the 2 periods
that was my fault
and dont add the path variable
no need for it
file = discord.File("/imageO/Π±Π°Π½/clear.png", filename="file.png")
this is enough
need help
Hooray. it doesn't throw an errorβ€οΈ
nice
this is working, tysm !
roles
thanks
because you set the image not correctly
embed.set_image(file=file)
this should work
and you probably want to iterate through the member's role's instead of checking if they only have the 'perms' role
Hey
file = discord.File("/imageO/Π±Π°Π½/clear.png", filename="file.png")
embed.set_image(file = file)
π
help me pls
Guys I was told before that people can get ur bot counterfeited , it was quite a bit ago , can someone explain what they mean by that
can role ids work?
also how do i add lots of it?
sure
wdym?
can you show me how to add it?
add what?
can you show me how to add it?
Python wants me to start crying
i recommend you check your path correctly
print out your cwd and start figuring out the path to your file from there
??
I dont know how to add it
a good way to do it is using the command tree in cmd
what do you want to add?
ctx.author.roles returns a list of the roles that the member has
comparing an int to a stringπ€¨
again, ctx.author.role isn't a thing
how do you do roles id?
So here's the way. He is correctπ₯Ί
i think you should check out docs (https://discordpy.readthedocs.io/en/stable/), youre giving poor lee a strokeπ
read the docs on Member.roles, and what you're trying to do is some basic list comprehension
okay
!d discord.Member.roles here's the link
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [β@everyone](mailto:'%40everyone)β role.
These roles are sorted by their position in the role hierarchy.
windows + r and then type in cmd and then type inside the console tree and you will see your computers directory
Any way to make a discord bot that replys with a file when someones says !file? Please dm me or respond hereπ ( TAG ME )
Guys has Ashley quitted
!d discord.Message.reply
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message").
New in version 1.6.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.
tree
Thank uβ€β€β€
I'd recommend first changing to the directory where your bot file is, otherwise you're gonna get a whole lot of useless directories
navigate to the bot's folder first
π funny joke
^^^
@slate swan
just tell the person to find the parent folder and send the dir its easier to helpπ
i'd just upload it to a cdn and use its url
So. he gave me a tree. Do I need to find the final clear.png file?
yes find the parent directory where your whole bot is in and send the directory
python files
find the parent directory where your whole bot is in and send the directory
only the bot!
something from this
no no, the folder named bot py
Good evening, does the function Cog.get_commands() provides the list of slash commands or only standard commands ?
standard only
By any chance, do you know if there is a way to gather a list of slash commands contained in a cog ?
weird its named differently in dpy?
docs don't show it
but a pro programmer move is to get a Cog instance, write a dot and scroll through the attributes
ah dpy doesnt have it
get_application_commands()```
Returns a list of application commands the cog has.
So I guess it would be possible to scroll in its attributes and check if its a slash command (by checking if it's an instance of ..) ?
no I meant maybe there's an undocumented thing
i mean yeah something unique that specifies all methods that use slash commands and checking the class's attribute with dir is a good idea ig
what's the tree class called
!d discord.app_commands.CommandTree
class discord.app_commands.CommandTree(client, *, fallback_to_global=True)```
Represents a container that holds application command information.
get_commands(*, guild=None, type=None)```
Gets all application commands from the tree.
Yep, I already saw it and I think I'll just send every commands sorted per name, I'd love to sort them by cog and something with a dropdown menu but it seems.. tricky to find them per cog xD
Would it be possible to do cog.__cog_app_commands__?
dunno, that's why we suggested dir
@slate swanI checked a couple of times and couldn't find it. copied to vs clicked replace bot py. he did not find. or did i do something wrong?
discord.errors.NotFound: 404 Not Found (error code: 0): Interaction is unknown (you have already responded to the interaction or responding took too long) Possible solutions for this error?
I think its try: except discord.NotFound: something like this
how can I add multiple buttons?
async def command_dashboard(interaction: discord.Interaction,) -> None:
embed = discord.Embed(
colour=0xa1cbf0, title="Social Media", description="."
)
embed.set_footer(text="snkrsgroup | by", icon_url=")
view = discord.ui.View()
view.add_item(discord.ui.Button(style = discord.ButtonStyle.url, url= "url", label="Twitter"))
await interaction.response.send_message(embed=embed, view=view)```
The same way you added the first one
just copy, paste?
View.add_item yea
ah yea. I also copied view = disc... . thats the mistake
Can anyone help me make a discord bot?
how do i send a message to a user with a given ID outside of a command in an async function? Right now I have this code but it doesn't work. 
async def onVote(userid):
def isUserAvailable():
return userid not in farmusers
condition = asyncio.Condition()
await condition.wait_for(isUserAvailable)
user = bot.get_user(int(userid))
print(user)
if user is not None:
await user.send('Thanks for voting!')
The last line seems to be causing the error.
The error is Timeout context manager should be used inside a task
hello! im looking for some documentation about roles.. i want my bot to check if someone went into streamer mode and is live on twitch, then assign the Live role.. would that work? im trying this so far
# checks if discord activity is streaming, if true, assign LIVE role, if Flase, remove LIVE role
@loop(seconds=90)
@bot.event
async def set_live_role():
for user in discord.Guild.fetch_members():
if discord.Member.activity == "Streaming":
how do i pass in an arg in wait_for? also how do i loop it to constantly wait on smth else
How can I pass an arg in a task?
No documentation found for the requested symbol.
you ever write like 100 lines of code and then realise everything you've written is completely unnecessary and delete it 
you can pass in the args to task.start
many times, but i dont delete it
I need to find a channel with utils inside of the task
@slate swan How do I do it with a task?
just do it like you do normally?
I use ctx.guild.channels but there is no ctx so I dont rlly get how else u do it
!d discord.Client.get_guild
get_guild(id, /)```
Returns a guild with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
I want to use utils though
discord.utils.get(ctx.guild.channels, name="test")
@slate swan ?
can I see an example?
guild = bot.get_guild(guild_id)?
thats all.
what if it's in more than one server
what do you want to do?
just to get the id of a certain channel by name inside of a tasks.loop
anyone can help? does it look like im going somewhere with this? im trying to print the member list of my discord, no luck so far lol
# checks if discord activity is streaming, if true, assign LIVE role, if Flase, remove LIVE role
@loop(seconds=90)
@bot.event
async def set_live_role():
members_list = discord.guild.members
print(members_list)
for member in members_list:
if discord.ActivityType == "streaming":
pass
how do i make an embed look like this?
- Why are you using
eventandlooptogether? They don't work like that.eventis for events sent from discord, you can't loop what you can't control - Why are you doing
discord.guild.members? If you wanna get the members of a guild you'd need an instance ofGuild.. doing what you did won't work - Why are you checking if a class is equal to a string?
Which part?
That doesn't look like an embed, more so it's an ANSI codeblock
Well, the coloured stuff at least, the rest is a regular embed
what so with a title and thats just the description?
hey everyone,
how can one make the bot give a role once a if statement was detected ?
i have said bot removing roles when the user as used a banned word but needing help to find a solution to have it give a role once that original role was taken, for clarification its a quarantine role im trying to give to said user
#discord-bots message check this message out for ANSI codeblocks
The description is the ANSI codeblock, yes
ok thank you
π
Keep in mind, discord ANSI support is limited, you'll only have the basic colours and different styles but not all styles & colours
That should still be more than enough to make something good looking though
- that looks cursed on mobile phones
Mobile is bad anyways
π
Are there are discord bots that can help with banning recent bot raids?
hey guys i have a question i always get this error:
from discord_slash import SlashCommand
ModuleNotFoundError: No module named 'discord_slash'
this is what the lines where the error is looks like:
from discord_slash import SlashCommand
i already tried several time
pip install discord-py-slash-command
Make sure it's installing in the right version
Besides you don't really need it, since discord.py in itself has slash commands
Because you didn't actually use the right character
You need to copy paste the character, the one you just sent only works when the bot does it from code






NOOOOO
get the guild using this