#discord-bots
1 messages · Page 1099 of 1
ye i said no late
what about this??
i did wrong
?
maybe it will help me in future
that works, for normal messages
ctx.send gives you a discord.Message object
intereaction.response.any_send_method gives you None
ohkay
thanks 👍
also dont mind whats interaction.send lol its context i forgot to rename it
use what
!d discord.ui.Select
class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.
This is usually represented as a drop down menu.
In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Select.values "discord.ui.Select.values").
New in version 2.0.
I am using them only
@client.group(invoke_without_command=True)
async def help(ctx):
embed_hm = disnake.Embed(title="Categories",description="Please use the Select Menu below to explore the corresponding category")
async def slct1_callback(interaction):
await interaction.send("working")
async def slct2_callback(interaction):
await interaction.send("working2")
slct = Select(placeholder="Select the command category you want to see",custom_id="20")
sct_ct1 = SelectOption(label="Moderation",description="For Admins and Mods")
sct_ct2 = SelectOption(label="Fun",description="Games and other fun commands")
#sct_ct1.callback = slct1_callback
#sct_ct2.callback = slct2_callback
slct.append_option(sct_ct1)
slct.append_option(sct_ct2)
view = View()
view.add_item(slct)
await ctx.send("Testing selects for help command!",embed=embed_hm,view=view)
slct.custom_id
@slate swan
@slate swan
how can I use them
wdym by use them
i'm not sure how disnake works, but help commands are special. i imagine if you try to redefine help as an ordinary command group without reference to the built in help at all, it will either:
a) not work at all
OR
b) break horribly when the normal help routines are called
try it first with another name of the command other than help. async def myhelp(ctx): or so.
or that, yeah.
(i've done something similar to do custom help with Red)
not with interactions yet, though.
what i meant by this advice is if you just want to see if the select menu works. otherwise yes, if you want to do custom help, you'll need to do something fancier like the tutorial linked above.
possible to increase bot latency?
but why =.=
Better network
Or travel to California near discord servers
lower latency = lower ping :/
increase?
50 mbps
@slate swan do u mean reduce bot latency?
ya
not increase
I mean reduce
Hahaha
mb
thats why im having visible confusion
Just shift to California @slate swan
LOL
Ezzzz
💀
Or get into a discord data center, plug in yr bot and run it. And if someone asks who's Hunter, u don't know me
That's good
Wym that's the best idea
Sorry now i have to get the location of a data center, cya
but i live in south east asia
and my bot ping is always lower than 50ms
Same, the last time I checked
Send us a pic when u reach there!
💀
1 ms > 50 ms
how can i make that only user’s with a specific permission can use the command? @bot.command() and @bot.command.has_permission(‘send_messages’)
kekw
i mean only people that has permission to send message can send command right?
i change the permission then bur for the example yes
i forgot it
ah i found it @bot.has_permissions(kick_user = True)
!d discord.Permissions.kick_members
Returns True if the user can kick users from the guild.
it's plural buddy
heya, atm im trying to improve my save system im using for my bot. i'm currently "saving" by converting a class instance to a json file.
My issue atm is that whenever i add a variable to that class, the save command wont add the new variable to the save overwrite.
This only occurs when someone loads a current out-of-date save. As far as i understand it, when i load an instance of the game from a save, its pulling the variables from the saved file, and not the updated class.
If anyone can make sense of the above statement, does anyone have a suggestion how i can get the load game to add the new variables (perhaps compare to the class?). Because atm anytime a 'loaded' game reaches a variable in my code that doesnt exist in the save, it crashes that instance, resulting in all progress since the game was loaded being lost
How's yr trip going on?
same goes to for reactions, files, threads, webhooks, emojis, stikers, links, events, messages and activities
The only exception are invites
the create_invite permission is singular lmao
Damn u discord
view_channel 
I think that they could add a method to set the permission by giving the raw value of that permission lmao
in hikari you can just do hikari.Permissions(value) 
cool
thats the only way
discord/permissions.py lines 399 to 402
@flag_value
def read_messages(self) -> int:
""":class:`bool`: Returns ``True`` if a user can read messages from all or specific text channels."""
return 1 << 10```
i would just READ_MESSAGES = 1 << 10 in the Permission class
Help code
Seems like some sort of log from request
it means ur keep_alive is working
Thankyou
np
?
oh okay
Custom help command can you give me?
yeah
!customhelp
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
Yes i use it
Yes
ight so ill show you how you can do it
@bot.remove_command('help')
@bot.command()
async def help(ctx):
m = await ctx.reply('Sent `help` to your DMs!')
await asyncio.sleep(2)
await m.delete()
await ctx.message.delete()
!d discord.Guild.bans check if the user is in this iter
async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/latest/api.html#discord.BanEntry "discord.BanEntry").
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list.
Examples
Usage...
this is from a discord bot i have made in the past
How to use it give me some example pls
to use help commands within discord.ext, you have to firstly remove the help command and then make a new one
okay
Because i did't understand that
could you show me how your code looks like btw
like how you wrote the lines with the commands functions
Embed
Line by line
Like catogory 1
Catogory 2
Yes
okay
But maybe that not work some times
so basically, make a new line and paste this code i made
Give me a example pls
okay
How can i downgrade aiohttp to Version 3.7.1.post0 ?
for example
Let's say this is your bot event to listen if your bot is online
@bot.event
async def on_ready():
print("The bot is online")
(Here is a new line, which means you can put the help command code here so it looks like this)
@bot.remove_command('help')
@bot.command()
async def help(ctx):
m = await ctx.reply('Sent `help` to your DMs!')
await asyncio.sleep(2)
await m.delete()
await ctx.message.delete()
Because discord-py-slash-commands only works with that version and my bot doesn't run with the latest version of aiohttp
stop using that library. its outdated and unmaintained, will stop working soon
Which lib do you mean?
discord-py-slash-command
that gives you a list you can use user in list?, isnt that some basic python knowledge
But how should I replace it
discord.py beta has slash commands already
I need command like that
!customhelp @glacial glacier
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
also ignore the content of async def help():
oh
I don't know how to use
you looking for how to make an embed?
Yes
right, i would like to check your code. So i can show you how to use it
Not dm
Is there any video, which shows how that works?
because it's not so easy for me to describe how to use it
dont show the token of your bot tho
I coded that but delete because won't work
Okay thank you
send a screenshot instead
of the code
Can i send a image which like me need?
or no actually, send a hastebin
I need code which work like that@leaden solar
oh you dont even have a bot rn?
It's not like we have that code
Even if someone does i don't think that he will sent the whole project to you
https://pokeapi.co/ most probably that bot is using those API, start studying and you will be able to create a bot like that
oh did he mean that he wanted the exact code from that bot that he talked about?
then i have missunderstod this
My bot based on pokemon
the code that the bot you talked about is not easy to get
all code in public discord bots are not available for the public to get
i think scraping the pokeapi then using the json would be better than using pokeapi itself saves some time for reqs ...
poketwo is public u can see that
it doesn't matter what it's based on if u wanna use discord.py u need to learn python
class Reddit(commands.Cog):
def __init__(self, bot):
self.time_dict = {}
does theself.time_dict hold data persistently after bot restarts?
I feel like making a tutorial for discord bots without learning python
nope
it's stored in the temp memory
okay - so how would i make it persistent?
maybe make a task which updates a json file every other minute with the time_dict data and load the data into the time_dict on boot
eh u prolly know more python than me ||u so smort|| go for it if u want too
I'm not smart.........I'm stupid af, imagine betting so much on me
make a bot in javascript, at least you won't need to learn python 😔 that's what I was thinking
lmao 😂
u pretty good have confidence in urself👍
Ewwww
javascript sure is better for api stuff
but okay
how can i set a command to say if a command is not found?
does anyone know the “color code” for neon green for embeds? Normal green is 0x2ecc71 But i need neon or light green
.color hex #00FF00
I need to make command like that how can i make? But message and catogory is changed and command
I'm sorry, I don't have a good tutorial for how to make commands
th hex doesn’t work
replace the # with 0x
@slate swan I pinged u by mistake
um
just type hex color picker in google
Ye
copy it and replace the # to 0x
This should also work with 0x00FF00
that was like just 10 colors , use this 😳 https://github.com/sarthhh/anya/blob/main/core/colors.py
thanks
only with 0x
credits to okimii
😳
we shall make this with all the 16m colors
Wow more than 100
Ye
16m damn
how can i create a pattern for my auth command, which takes 1d or 1y or 1m or 2m for example and i wanna get the time unit and the number standalone
!e ```py
inputted = "10d"
print(inputted[:-1], inputted[-1:])
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
10 d
!e
timestamps = {"s": 1, "m": 60, "h": 60*60, "d": 60*60*24}
time = "2h"
time_unit, time_stamp = time[:-1], time[-1]
print(time_unit, time_stamp)
print(f"there are {int(time_unit)*timestamps[time_stamp]} seconds in {time} hours")
@placid skiff :white_check_mark: Your eval job has completed with return code 0.
001 | 2 h
002 | there are 7200 seconds in 2h hours
@commands.command(aliases = ["баланс"])
async def ballans(self, ctx, member: discord.member):
await ctx.send(
f"""Твой баланс **{cursor.execute("SELECT cash FROM users WHERE id = {}".format(ctx.author.id)).fetchone()[0]}** рублей"""
)
Dear please tell me what is wrong
discord.Member
!sql-fstrings also this
SQL & f-strings
Don't use f-strings (f"") or other forms of "string interpolation" (%, +, .format) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection.
Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, safely.
For example, the sqlite3 package supports using ? as a placeholder:
query = "SELECT * FROM stocks WHERE symbol = ?;"
params = ("RHAT",)
db.execute(query, params)
Note: Different database libraries support different placeholder styles, e.g. %s and $1. Consult your library's documentation for details.
See Also
• Extended Example with SQLite (search for "Instead, use the DB-API's parameter substitution")
• PEP-249 - A specification of how database libraries in Python should work
#help-bagel if someone want to help me ! ^^
Oh thank you. it's such a stupid mistake it's embarrassing
its alright, you can blame your linter's autocomplete for that
member is actually the .py file which has the Member class, the full path is discord.member.Member 
Oh it's hard😅
injection attacks💉
Hi I hope someone knows a solution to this problem:
I use discord.py 1.7.3 and supplementary discord-py-slash-command. (I know, that there is a way to update discord.py to 2.0.0, but I don't want to do that) So I uninstalled discord-py-slash-command accidentally and then, when I wanted to install it again, it doesn't work, because of the "not compatibility" with the version of aiohttp. I need the version 3.7.1.post0, but it always installs 3.7.4.post0 or 3.8.1
And my bot doesn't work, because of this and I'm a bit desperate, because of trying everything, but it doesn't work 😅
Please let me know, if someone knows a way to figure it out
Is there any specific reason that you don't want to update to discord.py 2.0.0?
Yes, because it's quite different from the old version and I'm not really familiar with it yet. It also always worked before.
it will get deprecated sooner or later change now so u don't have to be in hurry later...
Yes, but I have to watch how it works first and meanwhile the bot should still be running
ic
Ah, if that's just it learning how it works sounds like a good idea
I see what you mean by having the bot be online though
pip install using strong equality operator
like pip install xyz==a.b.c
u could also manually install their releases as well
np
guys dont name your file enum.py and use typing in it or else typing will raise a partially initialized module error😵💫
crazy how your own file name can break some stuff😭
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
bro
Never had issues with it, and I've done it multiple times
The same exact name
really? weird my interpreter had naming clashes
hence the error being raised
odd
switching it up 😳
why a parse method? i just pass all events to a class and i manage them inside them e.g parse them
Because that's how I'm designing rin rewrite to work, it'll be based off multiple states each with a internal queue which contains the inbound data ```py
client = rin.GatewayClient(TOKEN, Intents.GUILD_MEMBERS | Intents.GUILDS)
@client.messages.on(rin.Events.MESSAGE_CREATE)
async def message(...) -> None:
...
async for event in client.messages.listen():
...
@client.shard.on(rin.Events.HEARTBEAT)
async def heartbeat(...) -> None:
...
You'll have things, such as ```py
client.messages(...)
await client.messages.create(...)
await client.channels.create(...)
interesting design non the less
What theme and editor is that?
Reminds me of atom
But the theme monkai
Gruvbox & Neovim
Spacevim is nice, but I always recommend using your own configs
Home court advantage, you get you know every single thing about your editor
It makes it easier to code
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Can someone please try to help me here: https://stackoverflow.com/questions/72595178/checking-the-value-of-a-json-file-with-a-discord-bot-command?noredirect=1#comment128237895_72595178
it was invoked in a dm, hence why guild is None
Can someone PLEASE help? Bot was online like 3 minutes ago until I did git add ., git commit -m "update" and git push heroku master
its offline now
aint coming online
could anybody help?
Hey hanks to those who had feedback last time. I've improved the sidebar and table of contents slightly since. Anyways I am asking again to cover different times.
Please take a look at the tutorial I made for interaction bots and let me know if you have any feedback:
https://wumpy.readthedocs.io/ does not work on mobile
thanks*
will anybody ever help
this was the first thing(the image below) i noticed tbh and i kinda feel like it shouldnt be taking much of my attention it kinda feels like those websites that ask for your permission that they use cookies for a better experience, maybe a simple arrow with the number of which page you are on? maybe you can add some custom images in the side of the page, it kinda feels blan, maybe custom images of clyde and wumpus playing together? thats a very friendly environment and it suits your slogan. i really shouldnt be talking much as my docs arent good, but thats all that bothers me really, everything looks good.
Sorry I had to put the ice cream I was making in the freezer!
I do find it weird that you see the footer first? It's not supposed to take any attention hence why it is so small.
As for custom images, I fully agree. I would really like to have some big image there but that would need to be drawn by someone, and right now I'd rather spend time on other things!
is it weird when the docs for the command is bigger than the command itself 
Anybody? Bruh.
ah thats fine, well i saw it mainly because it pops out from the white background and isnt quite following the white and blue theme, well i recommend you find someone that works with picture editing!
not really, it happens allot
ya starting to notice that pattern quiet alot in my code xD
yep
for me it is
Not tryna get sued either 💀
I would need to draw my own Wumpus image and not Photoshop one from an existing Discord image.
yeah maybe change colors or something😭
@minor totem maybe this in the bottom but make the numbers centered and clickable
whatever you want im just giving ideas!
Yeah sure I've been considering icons, but then I need to get that setup and all 😅
Best of luck!
💙
Hi. How can I make it not required?
I thought it was just
async def help(self, inter, *input):
instead of
async def help(self, inter, input):
but then it doesn't show up as a param at all
set a default to input or type hint Optional to it
a default doesn't make it completely optional, does it?
type hint Optional to it
could you show what you mean by this?
it does
from typing import Optional
arg: Optional[str] = None
arg can optionally be a string or it can be None
as opposed to
arg: str = ""
where arg should be a string
yeah but then it will be 3.10 only if you import __future__.annotations then it would be 3.7 over just importing typing.Optional which is 3.5
wdym by "a cog's command description"?
use the description kwarg
!d disnake.ext.commands.slash_command
@disnake.ext.commands.slash_command(*, name=None, description=None, dm_permission=None, default_member_permissions=None, options=None, guild_ids=None, connectors=None, auto_sync=None, extras=None, **kwargs)```
A decorator that builds a slash command.
imagine using disnake
I had the quotes in the wrong spot
pov: you changed to hikari
perhaps self.bot.get_cog is a better alternative?
I still prefer dpy more
why
I did a moderate amount of research to decide on disnake
no....havent you seen its syntax
disnake sounded like the best option for someone like me who wants up-to-date features without too much hassle. Probably not the most powerful choice, but I'm happy enough with it
well, that too is fine
and thankfully dpy added basic logging when using Client.run
is your point saying that is similar or different i cant tell
hikari is rewlly different
like completely
i know? but how do you prefer dpy more?
because of originality, hikari is full different
huh? I just said that I prefer dpy over the forks if not for hikari
now it makes more sense, i would disagree tho
hm
i like disnakes implementation and helpers
i feel like dpy isnt as professional as disnake
both of them suck, that's why I use hikari with lightbulb meh
not really, the only thing that sucks in disnake is the old dpy codebase
just make your own wrapper
why make a wrapper meh, just implement a bot without a wrapper
save the hastle for another time
would be a pain to connect to the gateway and making request lmao
that's what I hate
just use a wrapper ez, nakano
requests.get("discord/api/uwuversion") \n time.sleep(69) professional get request maker
🗿
no wrapper's fine enough according to this channel lmao
and nakano? not in my worst senses
🗿
I'd want to try it though
but dont think itll be worth it
since there are a million others
i still need to make allot of library abstractions e.g cache and ratelimiter
yep, that's the issue, it's gonna be a nice amount of time and I've stopped with discord bots anyways
so whatever idc what I prefer
lmao
just contribute to it
meh, I was on a vacay, now im tired as hell
good morning
morning, 😔 i just found out that theres a discord api wrapper for php too
ofc
theres a list of wrappers for all langs in the unofficial official discord api server
go back to sleep
the point is. it can't have a gateway conection
its rest only
im stoodying
sadily
i mean php can do that, but that wrapper doesn't do it
i got an entrance exam in a month so yeah
go study
even for assembly?
iirc yes
meh who even cares about assembly, most of people just use nodejs, python or rust for making bots
cpp like: 
||rust >cpp||
syntax wise yes
memory allocation
yes
speed too
allow me to introduce you to julia
nothing wrong with that, i am too🕴️
i don’t simp language. I simp women okimii. Smh.
python is a women
😳
*woman
bro its the same creature
😔
women are creatures
woman is creature
chill
woman*
oh no
rust's documentation makes me wanna learn it
just learn the documentation
i would like to but idk i dont really like compiled langs
i want to try out js but its syntax is something else
python gets compiled to byte code too iirc 
what NO
js is easier than python
how does that work🗿
based
Uh huh.
but is is crappy i agree
interesting thanks
i mean, i += 1 have a look at this lol, kinda same
sad c++ noises
and i++ is not only used in js , but cpp and some other langs like java too iirc
Can you show me an implementation of this really quick. Idk python so idk this.
!e a = 1; a+=1; print(a) # 
@slate swan :white_check_mark: Your eval job has completed with return code 0.
2
i mean in a loop
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
004 | 3
005 | 4
006 | 5
oh. i see now. i was having a hard time understanding what you meant earlier for some reason
the second input in a for loop for those langauge is more like a while statement
question (because I have no clue what I'm doing):
when I type
self.bot.cogs[cog].__doc__
where does __doc__ come from? it doesn't pop up when I type the .
How do I find other members that don't autocomplete? Can I write something like
for member in self.bot.cogs[cog].(something):
print(member)
?
conditional
Are you able to control how much it increments i by or does it only allow to increment by 1
you can set it to whatever you want
@commands.Cog.listener()
async def on_message(self, message):
if message.author.bot:
return
else:
if "#Selfi" in message.content:
if "private" in message.channel.type:
await message.channel.send(f"{message.attachments[0].url}")
Error:
IndexError: list index out of range
If I output message.attachments I get: [<Attachment id=986051038941437962 filename='1519855918965.jpg' url='https://cdn.discordapp.com/attachments/98603435xxxxxxxxxx/98605103xxxxxxxxxx/xxxxxxxxxxxxx.jpg%27%3E]
class Foo:
"""this is Foo.__doc__"""
read ths error, have fun
I have this:
class Foo:
"""this is Foo."""
how does the computer know this is .__doc__?
yeah, i = i+ increment or something
I still don’t really like the implementation. I’m ngl.
because that string is meant for documentation?
okay lol
The Python interpreter takes care of making that connection.
I see
If I output message.attachments I get:
[<Attachment id=986051038941437962 filename='1519855918965.jpg' url='https://cdn.discordapp.com/attachments/98603435xxxxxxxxxx/98605103xxxxxxxxxx/xxxxxxxxxxxxx.jpg%27%3E]
I know what this error means
How do I url the url in an object? (Maybe a stupid question, I'm sorry)
[<Attachment id=986051038941437962 filename='1519855918965.jpg' --**url='https://cdn.discordapp.com/attachments/98603435xxxxxxxxxx/98605103xxxxxxxxxx/xxxxxxxxxxxxx.jpg'> **]
if you want the url only you would use the attribute
!d discord.Attachment.url
The attachment URL. If the message this attachment was attached to is deleted, then this will 404.
ok
how do i remove a view from a message when i edit a message?
ex sending a message with a view then editing it, to remove the view
set the view kwarg to None
ohh okay ty
It has been [0] days without a heroku-caused issue
For reasons, see ?tag noheroku or?tag dannycalmlyexplainswhyherokuisbador?tag dannyexplainswhyherokuisbadbutitsnotdannyitsdevonssignificantlyandobjectivelybettertag
the tags
omg💀
This channel's been kind of dry today
Maybe that's a good thing, because people are getting better with these things and need less help
this channel is as dry as your codebase
😳
Hey anyone help me
Iam trying to add a cmmd to ban members and admins
Members cmmd is working but admin command not working showing error when running
hello👋
''' Module 'discord' has no attribute admin '''
ye it doesnt have
can u show code
u cant ban owner 😑
Can u help
Not owner just admins
change the discord.owner -> discord.Member
Thanks bro now it's working 🙏
👍
Bro do you know how to make a help cmmd
!custom-help
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
bruh
why does this have to be in the one place where it won't work
@commands.slash_command()
async def cog(self, inter, module: str = commands.Param(name="Cog", choices=[self.bot.cogs])):
the last self is invalid
what can I do?
I need catogory command
thats not how functions in python work
I know lmao
you cant access an argument in another argument
that's the problem
you can do that statically, or maybe use an autocomplete
Thanks bro help cmmd is working now
either write the choices manually, or use autocomplete
I just don't know what you mean by the autocomplete
eh wait
lol
examples/slash_commands/autocomplete.py lines 30 to 38
@bot.slash_command()
async def languages(inter: disnake.CommandInteraction, language: str):
...
@languages.autocomplete("language")
async def language_autocomp(inter: disnake.CommandInteraction, string: str):
string = string.lower()
return [lang for lang in LANGUAGES if string in lang.lower()]```
got it working, tyvm
@cog.autocomplete("module")
async def module_autocomplete(self, inter, module):
cogs = []
for cog in self.bot.cogs:
cogs.append(cog)
return cogs
you could have just return self.bot.cogs.items()
nah, throws some funky errors
File "C:\Users\carso\AppData\Local\Programs\Python\Python310\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type Avatar is not JSON serializable
notice the .items() 🤡
code?
literally word for word I put
return self.bot.cogs.items()
anyway this works:
return list(self.bot.cogs)
my bad, needs to be key lol
I need catogory command
clarify your question
is there a way to restrict the users who can use the slash command, or that needs to be checked inside the function ?
permission v2 allows that in your server settings
for a particular command i mean, guess its the latter then ?
for a particular command, yes
the server integrations' permission settings allow that
i see, thanks
how do i check what permissions the bot has and make a new role with the same permissions?
!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...
!d discord.Member.guild_permissions
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/latest/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").
This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.
Changed in version 2.0: Member timeouts are taken into consideration.
so like ```py
await create_role(
name=...,
permissions=member.guild_permissions
)
and member is the bot?
property me```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
this is a Member instance of your bot
that's the Class
i mean... guild.me
so permissions=guild.me.guild_permissions?
yeah
that's given that guild is an instance of discord.Guild
How to bypass if statement for guild owner?
it didnt work, 'NoneType' object has no attribute 'guild_permissions'
-_- nuke
?
Yes
what nuke
Ye ye ye
but yet, we dont
I have nuke now
But ineed ban all
we will not have a discussion about nuking here so pls take it somewhere else.
Members
fr
-_-
yes?
show your full code
guildd = await client.fetch_guild(int(gid))
await guildd.create_role(name="a", permissions=guildd.me.guild_permissions())
why are you fetching guild, i dont think you get everything from a fetched guild
!d discord.Client.fetch_guild
await fetch_guild(guild_id, /, *, with_counts=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") from an ID.
Note
Using this, you will **not** receive [`Guild.channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.channels "discord.Guild.channels"), [`Guild.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.members "discord.Guild.members"), [`Member.activity`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.activity "discord.Member.activity") and [`Member.voice`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.voice "discord.Member.voice") per [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member").
Note
This method is an API call. For general usage, consider [`get_guild()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.get_guild "discord.Client.get_guild") instead...
bot.get_guild.
!d help
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
!d help discord Client.help
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
!d help command
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
!customhelp
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
@glacial glacier #bot-commands
How to make a error like that a wrong command do P!help for see all commands
How would I make it so if a user did .ban for example, instead of using context, it would display a help command showing them what they need to put to make the command work
What might i be doing wrong, other than the 'description' lol.
Object of type SelectOption is not JSON Serializable.
depends if you wanna do it only for that command or for every command of your bot
what does bpt mean
You can do that only for a specific command or you can do that for every commands that your bot has, it depends on you
👀
how can i host my bot for free any other alternatives than heroku please
host it on your pc 
well am doing that rn
but need it to be on a website
it should be disnake.Option not disnake.SelectOption
whats the problem with heroku tho
can't set up git properly
check pins in #965291480992321536
i see
if you have a credit card you can get free micros from aws or Google cloud free fkr a year
I see this method for the first time. Isn't it supposed to be
need: str = commands.Param(choices=options_for_el, description="choose one")```
I might be wrong, haven't ever seen the method you use
OptionChoice was the correct thing, SelectOption was wrong as sarth said above
!d disnake.OptionChoice
class disnake.OptionChoice```
Represents an option choice.
i had tried that i think some days back, didnt work well for me
how would typehinting help 
You might have actually typehinted with commands.Param and not set it to default value, that's a common mistake most people can't recognise
do you mind explaining a bit
Might is usable for past tense right
yeah
from enum import Enum
class SomeChoice(Enum):
one = 1
two = 2
amo = 69
...
async def nice_cmd(inter, choice: SomeChoice):
choice = SomeChoice(choice) # iirc it won't give the enum itself but the value of an enum, so if you really need the enum you can get it from value. In the options the names of the enums will be displayed```
def cmd(yes: int) # typehint
def cmd(yes = 20) # default value
def cmd(yes: int = 20) # typehint + default value```
I understand, thanks for the explaination
Np
huh?
can i keep different prefixes for different cogs?
yeah 😳, it's possible but not that simple.
you mean in the cache?
yes the members get added/updated to the cache by discord.py internals until you have member intents
and your memory doesn't creates an issue
@client.event
async def on_message(message):
if message.content.startswith('p!help','P!help'):
embedVar=discord.Embed(title="test", description="description", colour=0x00ff00)
embedVar.add_field(name="name1",value="value1", inline=False)
await message.channel.send(embed=embed)
Whats wrong in that command?
@slate swan pls
!customhelp
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
Just tell me whats wrong?
@slate swan
ur await message.channel.send(embed=embed) is outside the function
!indent
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
How to fix it?
by learning python before making a discord bot
Ok
!d discord.Message.edit
await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
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.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
you set again the embed here as the parameter after you've modified it
ok let me know
@desert cosmos
How to solve await?
what
How can i end that?
return
@client.event
async def on_message(message):
if message.content.startswith('p!help','P!help'):
embedVar=discord.Embed(title="test", description="description", colour=0x00ff00)
embedVar.add_field(name="name1",value="value1", inline=False)
await message.channel.send(embed=embed)
Well it's not like you will have a prefix for every cog, you would change the command prefix everytime a cog command is casted 
Return?
wdym
whats the error
how do we end await wdym
@client.event
async def on_message(message):
if message.content.startswith('p!help','P!help'):
embedVar=discord.Embed(title="test",
description="description",
colour=0x00ff00
)
embedVar.add_field(name="name1",value="value1", inline=False)
await message.channel.send(embed=embed)
Thats telling outside funtion
maybe because of indentations
Bruh do you want an hint?
Learn python, you can't use d.py if you don't know python syntax and OOP concepts
Yes put it inside
ok how ?
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
i can 't do it using that command prefix function right cuz it has nothing to do with command invocation
!d discord.ext.commands.Bot.command_prefix
The command prefix is what the message content must contain initially to have a command invoked. This prefix could either be a string to indicate what the prefix should be, or a callable that takes in the bot as its first parameter and discord.Message as its second parameter and returns the prefix. This is to facilitate “dynamic” command prefixes. This callable can be either a regular function or a coroutine.
An empty string as the prefix always matches, enabling prefix-less command invocation. While this may be useful in DMs it should be avoided in servers, as it’s likely to cause performance issues and unintended command invocations.
!d discord.Message.edit
await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
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.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
How can I use this command
any example
I want to change the embed of discord message after I send it
right after you send it ? i mean in the same command ?
Yup
.
This is an indent issue lmfao
In this case embedVar.add_field(name="name1",value="value1", inline=False) is outside the if statement
msg = await ctx.send("hello")
await msg.edit(content = "hi")
you mean you want to edit in other command invocation ?
yup
for that you can have a workaround like saving the message as bot attribute but i don't think that is a good way to do
async def cmd1(self, ctx):
self.todelete = await ctx.send("hello")
async def cmd2(self, ctx):
if hasattr(self, "todelete"):
await self.todelete.edit()
you can also do it using fetch message
ughh
!d discord.ext.commands.Context.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") from the destination.
That one?
Idk, I actually came here to ask a question tho, is there a way to check for a reply ping?
i would imagine something like a try-finally or a contextmanager for specific commands where u set prefix to something, and finally set it back to default
ns
but I don't know why
this is showing
an error
in discord
I made a callback
show code
Sure
async def btn_callback(interaction):
await send.edit(embed=embed_hm)
This is the callback for button
i don't know how to dynamically change bot prefix
besides that if you are saying to do so in a cog
won't it be a trouble to get the command be invoked ?
u need to hook the callback to the option as well, like <ur ui object>.callback = btn_callback
This is the callback for select menu
async def slct_callback(interaction):
if select.values[0] == "Music":
await send.edit(embed=embed_hm_music)
elif select.values[0] == "Fun":
await send.edit(embed=embed_hm_fun)
ya thats the problem, for the cm to work the command has to be invoked first, or you could overwrite the default thing for invoking the command. But that seems ** A LOT ** of work
You mean this
sadly
btn_back.callback = btn_callback
select.callback = slct_callback
ya, can u show the whole command at once, its hard to keep track of the order
!paste if too long
Ok
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 don't think i am proficient enough to do that :/
I will delete the code after my problem is fixed
Is that ok @paper sluice
do you use strip_after_prefix?
no
ya? idc
indeed, just overriding the get_prefix works
cool, lemme write some pseudocode
alr
@client.group(invoke_without_command=True)
async def help(ctx):
embed_hm = disnake.Embed(title="Categories",description="Please use the Select Menu below to explore the corresponding category")
embed_hm_music = disnake.Embed(title="Music", description="Commands for music")
embed_hm_music.add_field(name="`k!play`", value="This command plays music", inline=True)
embed_hm_music.add_field(name="`k!volume`", value="This command controls volume", inline=True)
embed_hm_music.add_field(name="`k!pause`", value="This command pauses the music", inline=True)
embed_hm_music.add_field(name="`k!resume`", value="This command resumes the music ", inline=True)
embed_hm_music.add_field(name="`k!stop`", value="This command stops the music", inline=True)
embed_hm_music.add_field(name="`k!queue`", value="This command adds music to queue", inline=True)
embed_hm_music.add_field(name="`k!view`", value="This command shows the queue", inline=True)
embed_hm_music.add_field(name="`k!remove`", value="This command removes music from queue", inline=True)
embed_hm_fun = disnake.Embed()
select = Select(options=[
disnake.SelectOption(label="Fun",emoji=":person_bouncing_ball:",description="Games and other fun commands"),
disnake.SelectOption(label="Music",emoji=":musical_note:",description="Commands for music features"),
],placeholder="Select the command category you want to see")
async def slct_callback(interaction):
if select.values[0] == "Music":
await send.edit(embed=embed_hm_music)
elif select.values[0] == "Fun":
await send.edit(embed=embed_hm_fun)
async def btn_callback(interaction):
await send.edit(embed=embed_hm)
btn_back = Button(label="Back",style=disnake.ButtonStyle.gray)
btn_back.callback = btn_callback
select.callback = slct_callback
view=View()
view.add_item(select)
view.add_item(btn_back)
send = await ctx.send("Testing selects for help command!",embed=embed_hm,view=view)
there must be some error in terminal ?
nope
all clear
all I see is this error in discord
@desert cosmos
not in discord
in terminal where your code is running
there must be some error
use interaction.response instead of editing send
!d disnake.InteractionResponse
class disnake.InteractionResponse```
Represents a Discord interaction response.
This type can be accessed through [`Interaction.response`](https://docs.disnake.dev/en/latest/api.html#disnake.Interaction.response "disnake.Interaction.response").
New in version 2.0.
interaction.response calls InteractionResponse
and embed_hm_fun is an empty embed, so that might cause it to not send
do you have an error handler?
@desert cosmos i got it working this way, ofcourse thats too basic and you can make your own improvements.
https://paste.pythondiscord.com/udivabugiw
i noticed that this only works for command names and not aliases but you can modify it 
and its disnake, but in case you use any other library, the way still remains same
👀 nice
Dear tell me why it gives errors?
#help-burrito plz
Can u show the on_ready event code
@commands.Cog.listener()
async def on_ready(self):
DiscordComponents(client)
print("READY!")
await self.client.change_presence( status= discord.Status.online, activity= discord.Game(".хелп"))
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
name TEXT,
id INT,
cash BIGINT,
rep INT,
lvl INT
)""")
for guild in self.client.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 0, 0, 1)")
else:
pass
conn.commit()
try adding a comma after the third button, else restart your ide
lol
👀 you database can be dropped only by the username of a member~
!rules 5 noone's helping with it
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
why delete it?
!sql-fstrings
SQL & f-strings
Don't use f-strings (f"") or other forms of "string interpolation" (%, +, .format) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection.
Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, safely.
For example, the sqlite3 package supports using ? as a placeholder:
query = "SELECT * FROM stocks WHERE symbol = ?;"
params = ("RHAT",)
db.execute(query, params)
Note: Different database libraries support different placeholder styles, e.g. %s and $1. Consult your library's documentation for details.
See Also
• Extended Example with SQLite (search for "Instead, use the DB-API's parameter substitution")
• PEP-249 - A specification of how database libraries in Python should work
read this
cursed example-
Im using holy water to wash my eyes
i.e. instead of f"" Use .format?
@untold anchor
Im here
Ask here
Ask what exactly
@commands.Cog.listener()
async def on_ready(self):
DiscordComponents(client)
print("READY!")
await self.client.change_presence( status= discord.Status.online, activity= discord.Game(".хелп"))
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
name TEXT,
id INT,
cash BIGINT,
rep INT,
lvl INT
)""")
for guild in self.client.guilds:
for member in guild.members:
query = "SELECT id FROM users WHERE id = {member.id}"
params = ("RHAT",)
if cursor.execute(query, params) is None:
cursor.execute(f"INSERT INTO users VALUES ('{member}', {member.id}, 0, 0, 1)")
else:
pass
conn.commit()
I didn't quite understand how
click on not sure what to do and read it
Set the language to Python and iirc, u gotta set the configuration to python main.py
@commands.command(aliases = ["123"])
async def asd(self, ctx):
await ctx.send(
"123",
components = [
Button(style = ButtonStyle.green, label = 'Да'),
Button(style = ButtonStyle.red, label = 'Нет'),
Button(style = ButtonStyle.blue, label = 'А')
]
)
responce = await client.wait_for('button_click', check = lambda message: message.author == ctx.author)
if responce.components.label == 'Да':
await responce.respond(content = 'Деньги успешно переведены!')
elif responce.components.label == 'Нет':
await responce.respond(content = 'Вы отменили перевод.')
else:
await responce.respond(content = 'Б')
Dear, why when I click on the button, an error pops up?
http.client does not have an attribute called wait_for
Typo?
dont use 3rd party libraries
Need to remove one?
Why doesn't he see?
Who
visual studio does not see write_for
Can you please tell me what I need to do to avoid the error?
I did not understand
!d http.client
Source code: Lib/http/client.py
This module defines classes which implement the client side of the HTTP and HTTPS protocols. It is normally not used directly — the module urllib.request uses it to handle URLs that use HTTP and HTTPS.
@slate swan use self.client or ctx.bot instead of client
AAA, exactly. I keep forgetting about self
why is it not interacting?🥺
@commands.command(aliases = ["123"])
async def asd(self, ctx):
await ctx.send(
"123",
components = [
Button(style = ButtonStyle.green, label = 'Да'),
Button(style = ButtonStyle.red, label = 'Нет'),
Button(style = ButtonStyle.blue, label = 'А')
]
)
responce = await self.client.wait_for('button_click')
if responce.components.label == 'Да':
await responce.respond(content = 'Деньги успешно переведены!')
elif responce.components.label == 'Нет':
await responce.respond(content = 'Вы отменили перевод.')
else:
await responce.respond(content = 'Б')
well, you see, third party libraries.
someone has experience with twitchIO?
which one to remove?
uninstall discord-components
The bug on my bots verification is finally fixed by discord but it took 3 weeks so now it's off all of the new pages and it never grew enough to reach the top pages 
gonna have to drop money on ads to stand any chance now
(((

pip install -U git+https://github.com/Rapptz/discord.py
pip install disnake
Issued at startup
no go away with your forks
🤣
full code
true, stop using forks!
oh yeah andyou need message_content intents for 2.0
||HIKARI exists||
fr, either dpy or hikari 🗿

im interested in nextcord v3 too, but I won't be using it anyways
are you telling me to get forked
🍴
disnake is pretty good 
forks aren't as bad as 3rd party libs...
i needed a bunch of stuff discord.py didn't have yet
token = os.getenv(DC_TOKEN)
NameError: name ‘DC_TOKEN’ is not defined
i have a folder called .env with my discord token called DC_TOKEN thi
load the env folder first
use strings
pip install python-dotenv then from dotenv import load_dotenv
how im using pebble host
they should have some environment variables
I have maked a pokemon bot
put ur token there

use strings...
gratz but also why
thatt too
Where do i find theirs
that's like the only problem
bruh let the guy be happy
so token = str(token)?
sorry 
he worked all morning
token = os.getenv("DC_TOKEN")
It says Improper Token has been passed now
you store a wrong token in the env or it returned None
@commands.command(aliases = ["123"])
async def asd(self, ctx):
await ctx.send(
"123",
components = [
Button(style = ButtonStyle.green, label = 'Да'),
Button(style = ButtonStyle.red, label = 'Нет'),
Button(style = ButtonStyle.blue, label = 'А')
]
)
responce = await self.client.wait_for('button_click')
if responce.components.label == 'Да':
await responce.respond(content = 'Деньги успешно переведены!')
elif responce.components.label == 'Нет':
await responce.respond(content = 'Вы отменили перевод.')
else:
await responce.respond(content = 'Б')
i did token = 45.)/$;$::727:7;/$hsjshdsi
but instead of the spam it was my tolen
do i need to make it a string too
it says it, go to discord.com/developers and enable the intents you're requesting
i just made it DC_TOKEN = “x”
and it still doesn’t work
What to include?
what you request
@sonic flax
oop i pinged asher too ig, sorry for da ping
and make sure you also request it in the code
ah np
intents = discord.Intents.default()
intents.members = True
if you wanted to add the members intent for example
just do .all() saves some trouble for beginners
I need help how to add a image in the end of command?
also a way
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.
Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
Dear, I did not quite understand what I need to do?
How do i do that on pebblehost
u enable all the intents in ur dev page
then in code do
intents=discord.Intents.all()
he dosent have token set in env how will it work
what
he saved it to token in code
oh
Now he writes
then he didn't load the env file
In replit my environmental variables worked
How do i load it what
but when u host ur bot they create their own venv generally heroku does atleast
so they would have a place for storing env variables for heroku it's in settings -> config var
idk pebble host never used
in dpy 2.0 cog loading is now async
async def setup(bot):
await bot.add_cog(cog)
Do i use heroku then
load_dotenv()
TOKEN = os.getenv("TOKEN")```
ok
or whatever your name is in the .env file
in load dotenv ur file path goes
make sure to import os
to env file
add python-dotenv to requirements.txt
that too
do i just type python-dotenv there
...
lol
pip install python-dotenv
then do pip freeze
se which version was installed
then copy paste that part in the txt
This?
💀
i bet 5 bucks he gonna ask where next
remove the pip install
python-dotenv==0.20.0
yay
most petrodactyl hosts trigger requirements.txt automatically on runtime, so you don't need to run the pip command yourself
💸
Still an error(((
NameError: load_dotenv is not dfined
wait why do they have discord and dpy
did u import in the code
No
...
class mod(commands.Cog):
def __init__(self, client: discord.Client):
self.client = client
#commands
async def setup(bot):
await bot.add_cog(mod(bot))
cogs = [
"mod"
]
# Class Main
class Main(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
await client.load_extension
No module named load_dotenv
from dotenv import load_dotenv
Ok
wait wtf did discord.py setup logging by default?
this part is fine in ur main bot code how are u loading the cogs
await client.load_extension('mod')
that wasn't for you lmao
remove that dotenv part, asher was answering to dew
i though china was demonstrating to dew this was like 3 different levels of thinking going on here
either ur tokens wrong or the way u stored ur token is wrong
in .env
token=abcd1234
this is how u are supposed to store
where to write it down?
don't put the token in string in the env file
Ohh
wherever u are loading the cog in ur code
image=https://media.discordapp.net/attachments/986212628810580018/986223675726528602/749aa4e23c7b2a6f72d1f9a63cb8c890530e74fd23d19fa930e5bf8dd909cce9.0.JPG
That work? For image?
embed.set_image(url='your url')
embed.set_image(url='https://media.discordapp.net/attachments/986212628810580018/986223675726528602/749aa4e23c7b2a6f72d1f9a63cb8c890530e74fd23d19fa930e5bf8dd909cce9.0.JPG')
yeah
but do consider learning python first and checking discord.py docs before jumping into discord bots
highly reccomended
I keep getting unproper token bas been passed when I literally pasted a new one in and it isnt a string
ur tokens wrong then

the tags



