#discord-bots
1 messages · Page 962 of 1
one thing people don't like about pycord is the effort
But I suppose lurking all the same
the pypi ver it is
but pycord has voice receiving doesn't it
why, why can't pycord have the same class and reference naming as literally every other fork
Or is there still more work before they're in full parity?
!d disnake.ext.commands.Bot
class disnake.ext.commands.Bot(command_prefix=None, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") and as a result anything that you can do with a [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.GroupMixin "disnake.ext.commands.GroupMixin") to provide the functionality to manage commands.
why?
disnake is definitely one of those
Neat
but I always think dpy is just more developed
and after the long break, they'll catch up
once....
well, the official pypi ver of dpy is quite outdated and basically atm the forks are ahead with features
it's cool tho
yeah, that's why i said disnake it's easier, idk what was danny thinking about with that tree stuff when implementing slash
With more hands on the project now, I could see it getting cleaned up. For dpy I mean
Now that it's not solely Danny calling the shots
(unless he retook full control)
Laaaaaaaaaame
danny has the most contact to discord out of all forks
I think he can see into the future
nah, he just has really good ping
If that was the case he'd be swapping more towards api calls
Like leaning into that more than some of the intents and stuff
api calls are the future
Exactly
no more getting, only fetching
discord doesn't allow that many
For now
if discord would allow that many api calls, they wouldn't force slash commands onto us
they just wanna spare
Fair point
did I say something stupid
the admins shall decide your fate
nah I guess I didn't
irony
Oh thank god
how this makes sense? i mean, bro, that's contradictory
Haven't actually peeked at the slash command integration
but most of my code does use api calls, i do use get occasionally say looping through members to unban for a temp ban command.
Danny didn't like slash commands but that doesn't mean he'll make it harder so you don't use it

... right?
right
discord adding slash commands so devs will switch from classic prefix commands
danny just mixing them together and make slash commands dependent on the prefix commandsthat's quite stupid because in september the enforcement for message intent will kick in
discord adding slash commands so devs will switch from classic prefix commands
danny just mixing them together and make slash commands dependent on the prefix commands :mikedone: that's quite stupid because in september the enforcement for message intent will kick in
but how do you use slash commands with multiple bots
without prefixes
Carefully
Sorry, bad joke
you can't have the same command in two bots?
I think it'll list both commands, right?

maybe
Otherwise you'd have mad conflicts when another bot joins with a similar/same command
let's ask him
well, he hates slash commands anyway, that's why he quit the development first time lol
I like it
cursed
I don't.... HATE it
I don't like how you make both embeds anyway
but Idk I just like it
maybe I'm too positive
it should be illegal to like it
wait... do famous bots have slash commands already?
most of them
they didn't rewrite, they just added the slash commands on top of the prefix ones
since it's a moderation bot, most probably got the message intent
same for dyno and other popular bots
🗿 tbh, i kicked both dyno and mee6 from my servers and just coded my own custom moderation bot, now i feel free that i have absolute control
The channel’s topic. None if it doesn’t exist.
alright
Eh, to a point
At least for us, being able to easily track infractions is not something we could live without
No warn system just yet
Willing to bet that’s coming up soon
Discord will never make a voice channel maker voice channel or a birthday system, my bot stays alive

i have a log channel for everything lmao, deleted/edited messages, bad word time out, server edit (channels name, perms, roles) discord can't beat that yet 
audit log is bad
🗿 that's maybe too strict
I have trouble finding staff channels when it’s right between regular channels and help channels
Overshoot so easily
Right? Imagine all the ones I can see as admin.... It's really obnoxious sometimes
We should move them either all the way up top or all the way down bottom 😉
the logs are pretty vague, for example with deleted messages, they show you they've been deleted, but not their content, or message editing
It would make it so much worse for us
Where as that's something we do track in our message log
Also it’s spotty. It’s a 50 50 if it shows certain things
Very very handy when folks are spamming or dropping nsfw shit then deleting it real quick
they be like "
haha you will never see what i said" then you just go in your holy message logs
And it's not like we even hide it!
We don't obfuscate that we have this level of tracking
But folks just don't think about it
And metricity is open source too isn’t it
I think so?
Let me double check
Logging them off-platform is (I think)
But we restrict it to just being tossed in that channel
yo can someone help me with something
i need a cmd to remove everyone from a role so basically
;removerole and itll automatically remove everyone from the member role
Discord won't accept those logs for reporting, though
@fossil aspen Why?
Seems like it'd only be used for malicious purposes
Easy. Loop through role.members
its for my server for event purposes
i don't think so it is as long as you have your own server Privacy policy where you tell people about it like where you store those messages or for how long
True, but that's a level of GDPR hassle I'd rather not have to deal with
idk how i would go through with making it i dont really do much py
just delete the role then 🗿
for member in role.members:
# remove role
no im using something else w role ids
so where do i put the role id or name of the role
Nevermind
🗿 that's so cursed, imagine no cogs and all your code in your main file
You can seperate them into files
yea idk what this means i dont do py nor am i a coder
i just need the cmd made so i can copy nd paste yk
I suggest you at least get decent understanding before proceeding then
🗿 we don't just offer code to copy and paste, for this maybe it's better to go on
maybe?
I'm also not overly comfortable with us just giving a command like that
It seems more likely to be used maliciously than usefully
its not malicious
If you decide to start learning (i encourage you to!), don't do youtube tutorials before you go down that rabbit hole
i dont do that shit i just need it for event purposes
!resources can get you started
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
tbh, i started with youtube tutorials, but then slowly as i learned more i realized they are dumb and bad practice what they did in there
Depends on the channel/presenter. We've got a couple channels earmarked in our resources that we trust
Yup. Unfortunately it seems the mediocre ones snag SEO for searches like "discord bot tutorial"
What's seo?
And personally I find the whole medium of videos to be lackluster when it comes to learning
Search engine optimization. Doing certain things with your content to get it higher ranking
For example, putting a lot of random keywords into your descriptions to get your video hoisted in the search results
And also making long titles with lots of common words
if I'm reading this right the shard represented by ShardInfo is a 'cluster'/parent with sub-shards/children? https://discordpy.readthedocs.io/en/master/api.html?highlight=get_shard#discord.ShardInfo
what's the non-dumb way to check if 3 days has passed since the saved date 
Wth is this
try timedelatapy from datetime import timedelta if your_thing_to_check < timedelta(days=3):
Use datetime module
how's your discord bot tutorial going?
It would be much easier
(datetime.now() - your_saved_date).days```
And you could store dates as timestamps
you mean strings?
!e py from datetime import datetime print(datetime.now().timestamp())
@vale wing :white_check_mark: Your eval job has completed with return code 0.
1649360091.528525
For sqlite it would be real but you'd have to convert it to actual datetime class every time
In postgres you can just use TIMESTAMP type its convenient as heck
hmm okay thanks, ill give this a shot 
Ask panda
I’m waiting for panda to finish the base infrastructure
bots cant get changes in on_user_update if the user is bot.user? - like if the bot itself changes avatar or something the event wont pick up the data?
also:
if u have 2 on_connect event in 1 cog will both work?
cog 'events' are just listeners
so as long as you have a different function name it will work just fine
!e
print(poop)
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'poop' is not defined
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | SyntaxError: 'await' outside function
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | NameError: name 'ctx' is not defined
#bot-commands
ok dude
but its not working
i had 2 on_connect events when the bot get connected only 1 event works
¯_(ツ)_/¯
Hello everyone, I am trying to build a bot which buys new coins on gate.io, but I can't get the data from the website via request (or maybe I'm a bit dumb). Could anyone please help me?
i dont get it
Hi there, so I'm currently writing a bot, and I need him to take inputs from the user one after another. But for some reason it just spams the input messages and doesn't take what the user sends in
await ctx.send('Enter the description of the character: ')
desc = bot.wait_for('message', check=check, timeout=30)
await ctx.send(f"{name}'s description added")``` Imagine that I have several of this consecutively
and then I want to add those information in a dictionnary like this
with open(f'{name}.json') as file:
content = json.load(file)
content[name] = {'age': age,
'gender': gender,
'picture': picture,
'hex': hex,
'desc': desc,
'universe': universe
}
await ctx.send('Character successfuly added to the database!')```
but as I said it seems to be broken
What I get is the following
so would anyone have an idea about what's going on?
and how to let the bot take the information in and store before moving on to the next question
man
i have 4 discord bots
that i was hosting on replit/uptimerobot
but now i see that uptime robot has stopped hosting replit servers
desc.content basically this is going to save the user's inputs aka message
what does that mean?
U got it?
I feel like hex is supposed to be an internal command
maybe that's why?
yeah still buggy
Just add `.content.
Command raised an exception: OSError: [Errno 22] Invalid argument: '<coroutine object wait_for at 0x000002BDCC9BD140>.json'
where
with open(f'{name}.json') as file:
content = json.load(file)
content[name] = {'age': age,
'gender': gender,
'picture': picture,
'hex': hex,
'desc': desc.content,
'universe': universe
}
await ctx.send('Character successfuly added to the database!')```
And then try again
No
yes
with open(f'{name}.json') as file:
content = json.load(file)
content[name] = {'age': age,
'gender': gender,
'picture': picture,
'hex': Hex,
'desc': desc,
'universe': universe
}
U typed {"desc" : desc} but it should be desc.content
why?
it will save the "message"
await ctx.send('Enter the description of the character: ')
desc = bot.wait_for('message', check=check, timeout=30)
await ctx.send(f"{name}'s description added")
```
that's the description part
Im talking abt the saving part
Just try it and you'll see
It does😭
look here I still have the same issue
the bot just spams the input without letting me input anything
and with that weird coroutine stuff
how so
or else it will return a coroutine object and not the return value of the coroutine
I assume the with is the problem

u used with to open the json file
!d discord.ext.commands.Bot.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
await what
a coroutine
what is self.client
I think I get it
bro

self.client = client
desc = await bot.wait_for('message', check=check, timeout=30) innit?
and client is the bot instance that gets passed in the cog?
yes
🥺
so what is not working
omg of course
Well, the full command is a transcript command. It is supposed to give a list of all the users that talked in the channel but only showed the user that used the command
you can just check the channel history and check all the authors
well now it works
lol
yes but that is not what I want
I just have this issue Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory
what do you want
lol
well it can't find the file
How did u define name?
yeah lol, well thank okimii !
👍
I forgot to change the name to database lmao
Oh

welp I don't know why it can't find the file honestly
Figure I'll ask again since it's a new batch of folks here. I'm wanting to make a server bootstrapping script. One that will let people give a server layout (categories, channels, roles, etc) as a script to make it easier to develop for a bot. I was wondering if anyone knew of a way to test something like that without having to actually make x number of guilds during testing. Rather not have to make a server, delete it, make a server, delete it, rinse and repeat. Anyone know of anything like that?
Something like a testing endpoint for this or a ready made Discord API mockup that you can test requests like this against
welp I'm sorry but I don't know at all, I hope you'll find an answer
as you can see I don't know why my bot can't find a json file so this is beyond my level of expertise haha
so youre trying to make a script/bot that makes a guild layout?
i expect a script and not a public bot.
Generates a guild based on a configuration file, yeah. I know how I'm going to do that bit (and yeah it's going to be a script)
It's just the testing I'm not stoked about
ah
Since I don't want to be constantly making guilds and deleting them
well im not quite sure on how i would be tested, i would suggest you check the developer portal and the idea seems limited to newer bots
Nah, the functionality has been around for creating guilds like this. At worst I might just have to mockup my own API to make sure I'm getting the right stuff but ehhhhh
well testing it without actually making a request i doubt you could, searching for an endpoint that is for testing i doubt the api has one. the idea of running a script for developers seems idk limited as people are scared of token loggers and it would be limited to bots that are in 30 or less guilds iirc
It'd mostly be useful for us here on PyDis
It's so that people can set up a dev server for themselves when they fork the repo
Especially since our bot config has a fuck ton of channels that need to be made and IDs retrieved
well i would check dev portal but i cant use my pc rn. but you probably could just create a guild and then just loop through channels etc which is very easy in discord.py and you wouldnt need to connect to websockets and send hb etc
Yep, I know
thats mostly what i would do.
uh so
okay so this is now the problematic code :
with open(os.getcwd() + f'\{database}.json') as file:
content = json.load(file)
content[name] = {'age': age,
'gender': gender,
'picture': picture,
'hex': Hex,
'desc': desc,
'universe': universe
}
with open(os.getcwd() + f'\{database}.json', 'w+') as file:
json.dump(content, file)```
after asking the user for information I want to take the database file (`json file` with inside just `{}`) and add a key with the corresponding dictionnary inside but I feel like this won't work at all
and it's also not working, otherwise I would be here complaining haha
!d discord.Guild.create_template what about a template?
await create_template(*, name, description=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a template for the guild.
You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to do this.
New in version 1.7.
!d discord.Template
class discord.Template```
Represents a Discord template.
New in version 1.4.
or should I put the content inside the with?
Templates can easily create mock guilds without making for loops for channels etc.
then how am I sure the content of the json has been updated ?
Doesn't help with gathering the IDs
That's where most of the work is
Expecting property name enclosed in double quotes: line 1 column 2 (char 1) okay then python...
What id's are you after?
And I'll likely be trying to send it as a single large post request when I create it.
The IDs for the generated channels and roles
A template sends in everything at once and using discord.Guild.channels and discord.Guild.roles should give you every id.
Sure but I'm not planning on using dpy for this, just direct API calls.
https://discord.com/developers/docs/resources/guild#create-guild has essentially everything I need
Oh yeah def.
nice
Object of type Message is not JSON serializable that's nice
how is this not working:
with open(os.getcwd() + f'\{database}.json', 'r') as file:
Content = json.load(file)
Content[f'{name}'] ={'age': age,
'gender': gender,
'picture': picture,
'hex': Hex,
'desc': desc,
'universe': universe
}
with open(os.getcwd() + f'\{database}.json', 'w') as file:
json.dump(Content, file)
await ctx.send('Character successfuly added to the database!')
```
How
Put in the id
await ctx.send('Enter the value of the character (format is 0xFFFFFF): ')
value= await bot.wait_for('message', check=check, timeout=30)
``` I have to convert those to `str`?
Fetch it if you need it.
if (time_stamp - self.date).days >= 1:
AttributeError: 'float' object has no attribute 'days'```
both made with
```python
datetime.now().timestamp()```
Hex.content will do
haaaaa

THATS WHY
You need to convert timestamp into the datetime with datetime.fromtimestamp
!d datetime.datetime.fromtimestamp
classmethod datetime.fromtimestamp(timestamp, tz=None)```
Return the local date and time corresponding to the POSIX timestamp, such as is returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time"). If optional argument *tz* is `None` or not specified, the timestamp is converted to the platform’s local date and time, and the returned [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") object is naive.
If *tz* is not `None`, it must be an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass, and the timestamp is converted to *tz*’s time zone.
Timestamps are floats
ahh okay thanks
lemme test
Don't convert them to timestamp
gotta save em in a db
A SQL DB has datetime store option.
haha another error
Datetime objects are the only object you can store in a database.

hmm can just do the conversion once when i take it out i suppose
The best way to store datetime in sqlite is int timestamp cuz it takes the least memory
and put it in
!d datetime.fromtimestamp
!d datetime.datetime.fromtimestamp
classmethod datetime.fromtimestamp(timestamp, tz=None)```
Return the local date and time corresponding to the POSIX timestamp, such as is returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time"). If optional argument *tz* is `None` or not specified, the timestamp is converted to the platform’s local date and time, and the returned [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") object is naive.
If *tz* is not `None`, it must be an instance of a [`tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass, and the timestamp is converted to *tz*’s time zone.
And the only better way is ||use another db that supports datetime||
I mean nothing wrong with fromtimestamp
and timestamp - timestamp = amount of seconds
it works but it gives me stuff like user ids, guild id etc
and I just want to input
despite the .content
if (time_stamp - self.date) / 60 / 60 / 24 >= 1:
{"<Message id=the_id channel=<TextChannel id=the_id name='test' position=7 nsfw=False news=False category_id=the_id> type=<MessageType.default: 0> author=<Member id=the_id name='This is Chris' discriminator='1095' bot=False nick='ChrisZeThird' guild=<Guild id=the_id name='Chris & Bo' shard_id=None chunked=False member_count=39>> flags=<MessageFlags value=0>>": {"age": "19", "gender": "male", "picture": "url_pic", "hex": "0xffffff", "desc": "no desc lol", "universe": "life"}}
but I just want {"age": "19", "gender": "male", "picture": "url_pic", "hex": "0xffffff", "desc": "no desc lol", "universe": "life"} to be added
You made the key an object.
how did I do that
By force converting it to string
is the timestamp literally just how many seconds so far since year 0?
1970 it's unix
so in the content[f'{name}] ?
that's kind of wild. isn't it going to be way too long in 100 years 
with open(os.getcwd() + f'\{database}.json', 'r') as file:
Content = json.load(file)
Content[f'{name}'] ={'age': age.content,
'gender': gender.content,
'picture': picture.content,
'hex': Hex.content,
'desc': desc.content,
'universe': universe.content
}
with open(os.getcwd() + f'\{database}.json', 'w') as file:
json.dump(Content, file)
await ctx.send('Character successfuly added to the database!')```
Current time stamp is 1649366165 if we were to add a 0 it's the year 2492 and another 0 would be around the year 12000
one day tho, one day
I think after 2300 we will have a solution lol
how so?
"<Message id=the_id channel=<TextChannel id=the_id name='test' position=7 nsfw=False news=False category_id=the_id> type=<MessageType.default: 0> author=<Member id=the_id name='This is Chris' discriminator='1095' bot=False nick='ChrisZeThird' guild=<Guild id=the_id name='Chris & Bo' shard_id=None chunked=False member_count=39>> flags=<MessageFlags value=0>>"
!d discord.Message
class discord.Message```
Represents a message from Discord.
x == y Checks if two messages are equal.
x != y Checks if two messages are not equal.
hash(x) Returns the message’s hash.
year 2300 we will be using telekinesis instead of numbers 
Unix is a way for computers but it's pretty inaccurate compared to atomic clocks.
ye I don't want that thing
I will be more scared by January 19, 2038
you gotta be doing something pretty wild to need atomic time
On this date the Unix Time Stamp will cease to work due to a 32-bit overflow. Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems which will buy the time stamp a "bit" more time. 
Why?

I do not understand how to fix that 
name.id?
sounds like another Y2K coming up where everyone panics and nothing happens 
I mean most old operating systems would fail
what old operating system is going to be running in 2038 though
anyone know how to use start? Everytime I want to use it, it says one positional argument is required: 'self'. Whenver I put it in (test.start(self)) it says 'self' is not definied
still having issues understanding why this won't work as intended
and this as well
whats name;
name is just a string
await ctx.send('Enter the name of the character: ')
name = await bot.wait_for('message', check=check, timeout=30)```
this
hold up
I'm an idiot
I forgot to add .content to name
idiot me
lol
sometimes yes
thank you for this question because I wouldn't have seen it
see ya !
Can you make the bot do something when someone adds it to their server
!d discord.on_guild_join
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
anyone know how to use start? Everytime I want to use it, it says one positional argument is required: 'self'. Whenver I put it in test.start(self) it says 'self' is not definied
show me the task
the errors are from test.start() everytime
show me where your using test.start
async def test(ctx):
if not minigame_queue:
minigame_queue.append(ctx.author)
return
other_player = minigame_queue.pop(0)
vs = Minigame(sbot, [ctx.author, other_player])
geto = sbot.get_channel(other_player)
await Minigame.start()```
hm why do you need self?
await Minigame.start() TypeError: start() missing 1 required positional argument: 'self'
yea but why do you need self in the task
What Minigame looks like
a boring 1vs1 

I think to solve it
or is there a other way @boreal ravine ?
so I have this function py async def guild_events(self, guild: Guild, event: str): embed = Embed( title="Guild {event.title}", timestamp=datetime.utcnow(), description=f"{guild.name} ({guild.id})", ) if event == "JOIN": embed.colour = Colour.green() if guild.id in self.bot.banned_guilds: await guild.leave() async with self.bot.pool.acquire() as conn: await conn.execute() elif event == "LEAVE": embed.colour = Colour.red() embed.set_footer(text=f"{len(self.bot.guilds)} servers") if self.bot.config.join_channel: await webhook_constructor(self.bot.config.join_channel, embed)which handles my guild events (such as on_guild_join and on_guild_remove), this func is outside of a class and yet I need to pull data from self.bot inside this func. Should I be passing the self of the actual event into the func like thispy @commands.Cog.listener() async def on_guild_join(self, guild: Guild): await guild_events(self, guild, "JOIN")or should I be importing my bot var from my main file and calling bot instead of self.bot?
so pass self.bot into the func call and use bot.thing_to_get_from_bot, not import bot from main file
okay thanks for the help
So I've got big on type hinting (I think that's the right term) all my funcs including eventspy @commands.Cog.listener() async def on_message_delete(self, message: Message):and I want to type hint my on_bulk_message_delete event, would it just be py @commands.Cog.listener() async def on_bulk_message_delete(self, messages: list[Message]):
what do i need to do to host a bot on a raspberry pi
and is it feasible to have the bot send me a dm with any errors that happen rather than spitting them into console/printing to console?
what about making a command to actually relaunch the bot through dms
basically, what can i do to reach a functional product with ways remote control and tracking of issues
literally 0 reason to do that though?
annotations are all useless but are helpful
yes that is correct.
!d discord.on_bulk_message_delete
discord.on_bulk_message_delete(messages)```
Called when messages are bulk deleted. If none of the messages deleted are found in the internal message cache, then this event will not be called. If individual messages were not found in the internal message cache, this event will still be called, but the messages not found will not be included in the messages list. 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/master/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_bulk_message_delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_bulk_message_delete "discord.on_raw_bulk_message_delete") event instead.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
in docs its a list of message objects so yes youre correct, you should read docs or check src if you ever doubt types
Anime avatar? 😳
🤨 📸
Well I checked the dpy docs on what type it should be, I just wasn't sure if the way it was shown in docs was proper syntax and if it wasn't, what the proper syntax was so thanks for clarifying it for me
well its quite clear as it shows the types in the params category or you can just check its src code on github which thats what i mostly do
!pep 484 @flat solstice heres more info on typehints!
thank you 👍
you just enable it on your account and it will apply to your bot
Is that a thing?
yeah certain moderation permissions can be enforced by 2FA requirement in the server's moderation settings
if you check a permissions calculator like this https://discordapi.com/permissions.html you'll see them highlighted, but basically its kick/ban/administrator, and any most permissions starting with "Manage"
Thanks :)
How is it possible to make a DM group with discord.py?
I know how to send a DM to a single user but how is it possible to send to multiple users?
Question: I currently sort through my mongo database to check for the top 5 users in the 'money' category
This is how I create my leaderboard for the top users in the server
How would I sort the top in 2 categories combined?
For example, in 'money' and 'bank'
I'm currently doing this
cursor = self.bot.db.find().sort("money", pymongo.DESCENDING).limit(6)
top_users = await cursor.to_list(length=6)
I am using:
def disable_all_buttons(self):
for button in self.children:
button.disabled = True
in my button class, though when I try to use self.disable_all_buttons() in my command class it doesn't work, but gives me no error. How can I disable a button from the command class?
you can't with a bot, since group DMs are only usable by user accounts
you need to edit the message with the updated view to tell discord about your changes
await interaction.message.edit dont work
and neither does await msg.edit("...", view=self)
doesnt work as in NameError: name 'interaction' is not defined? or still no error
does your view have an on_error?
i have a command error handler
but not for the view
if x >= crashNum:
x = crashNum
viewOneInstance.x = round(x, 2)
self.disable_all_buttons()
await interaction.message.edit(view=self)
break
thats my code, I am making an econemy bot with a crash game
hm i would suggest adding print statements across your view's code to see whats happening
oh
prints just before and after your if-statement might be a good place
Can anyone help me?
don't ask to ask
how to unban user with dev id and username in discord py bot
@supple thorn fyi, we don't allow that link because it's often dropped in a rude manner. if you need to express it, it's a lot more welcoming to say it yourself.
ok fine
yeah just found out
scroll up maybe 1 scroll
see lol
this is why i ask, can anyone help me. I don't wanna spam my question, but when I ask, it goes silent lol

Is there a way to disable/enable buttons on discord
!d discord.ext.commands.Context.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/master/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/master/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/master/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/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
!d discord.ui.Button.disabled
property disabled```
Whether the button is disabled or not.
so to enable it back would be enabled?
no its a property that takes boolean
use ids and only ids
Question: I currently sort through my mongo database to check for the top 5 users in the 'money' category
This is how I create my leaderboard for the top users in the server
How would I sort the top in 2 categories combined?
For example, in 'money' and 'bank'
I'm currently doing this
cursor = self.bot.db.find().sort("money", pymongo.DESCENDING).limit(6)
top_users = await cursor.to_list(length=6)
Here you go @supple thorn
boolean?
ok so to enable would be disabled = False
that is so
yes now the waiting game
@bot.command()
@commands.has_permissions(ban_members=True)
async def mute(ctx,member: discord.User,time: float = None ,*,reason=None):
if reason == None:
reason = 'Spamming! '
if time == None:
time = 900
await ctx.channel.purge(limit = 1)
await member.timeout(duration=time,reason=reason)
if time >= 60:
timee = time/60
rem = time % 60
time2 = math.floor(timee)
await ctx.channel.send(f"{member} has been silenced in the class for {time2} minutes and {rem} seconds because of {reason}")
await member.send(f'You have been muted in ' + f'{ctx.guild.name}' + ' for ' + str(time2) + ' minutes ' + str(rem) + ' seconds because of ' + reason)
else:
await member.send(f'You have been muted in ' + f'{ctx.guild.name}' + ' for ' + str(time) + ' seconds' + ' because of ' + reason)
await ctx.channel.send(f"{member} has been silenced in the class for {time} seconds because of {reason}")
Hi , can anyone tell if somethings wrong with this code cuz it aint workinng
wish i could help but i use sql which theres statements that make it easy to do as well😔
is there a way to make a command that enables and disable it
rip
on button callbacks or just access children
just access
define not working
like on a button click or a separate command?
like it just purges 1 message as written in the code but doesnt timeout the member
seperate command
do you have intents?
yes
ViewSubclass.children[0].disabled = bool
show your bot instance signature
I heard from another guy that is should not be discord.User and should be disnake.User but discord-disnake isnt compatible
nah
in this case it would be discord.Member if youre using dpy as the User class is a discord user and not a member of a guild which the Member class has the timeout method
alright i'll try to change it to discord.Member
thx
@commands.command()
async def leaf_enable(self, ctx):
MyView.disabled = bool```
Like this?
not quite
bool should be a literal bool and children must be used as it returns a list of components in a view which then you index the list of components to disabled the button you want in this case.
MyView.children[0].disabled = True
if its your first component and you want to disable it that is so
but you would need to edit the view.
which probably is impossible
so the whole command is useless
ah so there is no way to edit it with a command
afaik no
i think you could with a slash command im not sure
you could fetch the message and edit it with an interaction and send a new view with the current instance that has the button disabled idk
cant really try out sorry
what is afaik
as far as i know
was about to clown
what does idk mean tho
🤨
i dont know what does it mean?
no idea
what does smh mean?
¯_(ツ)_/¯
😧
Lol
is it wise to log command usages (logging.info) in on_command
if i'd like to log it through a webhook to a discord channel, how would i do it (using the logging module)
i think using the logging.handlers.QueueHandler with an asyncio.Queue and having a background task relay messages from it to your webhook would be a fair idea
assuming you dont log too much that is
im planning on sending it every 15 minutes
or when the length of list hits 30
then proceed to send it
someone did told me about making a logging handler but i still dont get it
for batching your logs a MemoryHandler subclass would also be another option
class logging.handlers.MemoryHandler(capacity, flushLevel=ERROR, target=None, flushOnClose=True)```
Returns a new instance of the [`MemoryHandler`](https://docs.python.org/3/library/logging.handlers.html#logging.handlers.MemoryHandler "logging.handlers.MemoryHandler") class. The instance is initialized with a buffer size of *capacity* (number of records buffered). If *flushLevel* is not specified, `ERROR` is used. If no *target* is specified, the target will need to be set using [`setTarget()`](https://docs.python.org/3/library/logging.handlers.html#logging.handlers.MemoryHandler.setTarget "logging.handlers.MemoryHandler.setTarget") before this handler does anything useful. If *flushOnClose* is specified as `False`, then the buffer is *not* flushed when the handler is closed. If not specified or specified as `True`, the previous behaviour of flushing the buffer will occur when the handler is closed.
Changed in version 3.6: The *flushOnClose* parameter was added.
ty
also how do i add a handler if i used logging.basicConfig
use the handlers= kwarg https://docs.python.org/3/library/logging.html#logging.basicConfig
o
https://www.toptal.com/developers/hastebin/favazocomu.py Any idea why I am getting command not found errors?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
The cog is loaded
download
🗿
what?
which command?
or all commands?
All commands
did you make sure the cog is loaded?
Well how do I make sure?
load it in
I did
did it work
do you have any confirmation that it loaded properly?
No
lmao
Actually wait, I do
okay
So? 
well i'm trying to search your cog for mistakes but it all looks normal to me
Same here.. maybe ill try rebooting the bot again
have you tried unloading and loading te cog again?
you're using ls?
This is in the shell, used jishaku.. I actually use modmails core and build plugins on that so if it shows here that means its imported.. all my other cogs work
Rebooting didnt do anything either smh
For the first time when I think I write perfect code 
How do I make sure the emoji the bot adds to a message, doesnt count? So i mean. If the bot ads the emoji, the action doesnt start. Only if a member ads it.
use a check
check if what?
are you using on_reaction_add?
toptotal is safe
!d discord.on_reaction_add
discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.
Note
To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
Note
This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
If the user is a bot account.
okay but i still won't click on it
It’s literally hastebin, lol
There is no download, discord just thinks it is a download because of .py
clicking links cant do much
hmm so instead of cogs now we combine client and command groups
Hi there. I just would like to know what method is the best when you want to check user permissions before running a command. Basically only admin can use a specific command so is it better to use try /except or a simple if/else condition
And then put everything the bot has to perform in the if
you can use a check decorator to check if the user has a specific permission
So def check(m) :
no, there’s built in checks to check weather or not a user has a permission
Ho
this will work perfectly fine to check if the use has a administrator permissions.
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
So @commands.has_any_role('Library Devs', 'Moderators', 492212595072434186) for example
And then for the roles I put the one that can use the command
In the has_permission do I just have to put 'administrator '?
no
Or is it administrator=True?
yes
how do i edit the message which has the button ?
i tried edit_original_message but it edited the sent message
Screenshot?
The issue was I was on dpy1.7 but somehow was using the async to setup which was introduced in 2.0
solved
hello
my code doesnt work
@bot.command(aliases= ["nrules", "funnyrules"])
async def newrules(ctx):
embed = nextcord.Embed(title = "**NEW RULES**")
embed.set_image(url="https://cdn.discordapp.com/attachments/838867332641849404/943992738393751602/rules.mp4")
await ctx.reply(embed = embed)
the output is
just that
someone help
embeds cannot have mp4’s.
this is a discord api limitation
oh ok
^^
async def on_guild_join(self):
``` Do you use any other parameters for this
!d discord.on_guild_join
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
Guild
yes ofc, the guild
^^
Oh
Yeah okay
I just assumed you were on 2.0 since your add_cog method was a courotine now
How do you get the guild ID when someone added the bot with a on_guild_join
Yeah it was a dumb mistake on my part 💀 I was used to coding my plugins in 2.0 because I was getting ready for migration but had to make this quickly
The guild’s ID.
use the guild parameter which is the Guild object
yes
Alright ty
@quick gust another question, how do you get the membercount of that server that its added to?
how to make bot send video without link showing up
!d discord.Guild.member_count
property member_count```
Returns the member count if available.
Warning
Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.
Changed in version 2.0: Now returns an `Optional[int]`.
nono
video too big to make into gif
also has audio
you can't
Nice
it is better to have all cogs in a single folder, so you can import all of them at once
how do I fetch a message
!d discord.TextChannel.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/master/api.html#discord.Message "discord.Message") from the destination.
!d discord.Member.fetch_message if you need a specific member 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/master/api.html#discord.Message "discord.Message") from the destination.
!d discord.ext.commands.Context.fetch_message you could use this too
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/master/api.html#discord.Message "discord.Message") from the destination.
await ctx.channel.fetch_message(961911342489567262)
How can I edit a view
I am trying to get the message id and edit the view
send the new view
while editing
use the view kwarg
@commands.command()
async def leaf_enable(self, ctx):
channel = await ctx.channel.fetch_message(961911342489567262)
view = MyView2()
await channel.edit(view=view)```
Uh like this?
I made a bot with a console but i tried to put a cpu state view on the console with while True: but commands not working ??
async def on_ready():
bot.process_command
while True:
#my script
Like this
its a command? then make it @bot.command
Its not a command
@client.command()
async def img(ctx):
image = Image.new(mode="RGB" (255,255,0), size=(100,100), color=0xffff00)
image.save(format="PNG")
await ctx.send(file = discord.File(filename="image.png"))```
Command raised an exception: TypeError: 'str' object is not callable
?
I mean when i put while True: in @bot.event its just will print CPU and GPU state %
(i hided the script to print CPU and GPU btw)
And when i start my bot, its working but all commands are not responding
Its just do while true: and don't process command of my bot
strange
async def on_ready():
bot.process_commands
while True:
#script
#print ``` if someone want to see how looks my bot.event
Ofc i just changed my script to #script and the print to #print
there is no need to use process_commands in on_ready event
and fyi it's a coro
btw if even without it the commands doesn't work try to use the listen decorator
So i put my while true: to a bot.listen() ?
But idk its will print when i start the bot
hm
Still not working
i don't recommend you using loops in on_ready and in general overcomplicated code, because it might take hours to run, depends when the on_ready kicks in
I already removed on_ready
And just put async def background_task():
With aioconsole but still not work so maybe i give up
Should i put await asyncio.sleep() ?
:oooo its working
Hi , can anybody tell me how to ping everyone in an embed
put @everyone in the embed description
i did but that doesnt ping everyone
oh you want it to ping
yes
await ctx.send("@everyone", embed=embed)
TYSM that worked
class discord.ui.Modal(*, title=..., timeout=None, custom_id=...)```
Represents a UI modal.
This object must be inherited to create a modal popup window within discord.
New in version 2.0.
Examples...
!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.
you can set a local file as the embed image/thumbnail this way
Why isn’t my setup command not working
ty bro
Is wavelink music against tos?
Dict doesn't have a append method
I fixed my error but it won’t dump anything into the json file
Write into it then
Open it using write mode
And dump the things you need
Ok
Not working still
What do you mean by not working
Won’t dump anything
Won’t dump anything
No errors?
Nope
Also i strongly and highly suggest using an actual database for storing data
😔
But I’m trying to learn how to use json files
Learn to use them for something else
Because storing data in json will bite you in the ass
I can also see you're using json to store money and bank data
Yes
Try reload replit
Ok
Because i can't see the line where dump is
Replit has a bug where it can sometimes doesn't save your changes
And what your looking at is ghost code
Why is your dump indented
Inside the opening of the file
You have the with open indented in your first with open
Bruh
?
Why are you sending unrelated images
You said send the dump thing
@discord.ui.button(label="Request Leaf", style=discord.ButtonStyle.green, emoji = "🍃", custom_id="persistent_view:leaf")
async def button_callback(self, button, interaction):
button.disabled = True```
What send the dump thing
@commands.command()
async def leaf_disable(self, ctx):
channel = await ctx.channel.fetch_message(961911342489567262)
view = MyView2()
await channel.edit(view=view)```
Here
button doesn't get disabled, it shows interaction failed
It's because i'm looking at your repl
how can i disable it using the command
Look at it
All the way at the bottom of main.py
Is my verify stuff

Your code is like this
with open("verify.json") as json_load:
data = json.load(json_data)
with open("verify.json", "w") as f:
json.dump(data, f)
help
Also you're not writing anything
Into the json file
You're dumping data which is the blank json into the same json
You're writing {}
Blvck help please
json, replit, if he is newbie at python this would be the best combo
😔
Explain it better than me i need help
i don't even know what he wants to do lol 
someone help me with this
help
Write data into a json file
await logs1.delete()
AttributeError: 'coroutine' object has no attribute 'delete'
delete a channel
He's actually writing {} though
pls help me?
Yeah I need to dump stuff into my json file but it won’t work
It's because you're dumping nothing
Okay look
@supple thorn help me pls
it shows interaction failed because there is no interaction, also i'm sure that interaction is the first argument passed when a button is pressed 
Data is now {}
await logs1.delete()
AttributeError: 'coroutine' object has no attribute 'delete'
Yes
Because verify.json is blank
Ok
well, how would I fix that
Now when what you're dumping into the hson file is {}
You're legit dumping the same old data from itself
Dunno, read the docs i use views for components 
You're not dumping anything new
Then how do dump stuff
logs1 is not a channel
What
That’s what I dump?
Yes
I'm guessing that's what you dump
yes
Cause why would you have a variable that's a dictionary
The id and the name is what I’m trying to dump
When it dumps it does this {}
There is.
pip install black
black .
``` in the shell.
There is?
I don't usually mess with replit's configuration when testing
I'll try that next time i try shit i don't want on my laptop
@commands.Cog.listener()
async def on_guild_join(self, guild):
channel = self.client.get_channel(961913538832658492)
embed = Embed(title=f"Added to server", color=0x00ff00)
embed.add_field(name=f"Server ID:", value=guild.id, inline=False)
embed.add_field(name=f"Owner ID:", value=guild.owner_id, inline=False)
embed.add_field(name=f"Membercount:", value=guild.member_count, inline=False)
await channel.send(embed=embed)
``` why doesnt this give me a error or send a message when someone added it to their server
so I see that discord.Intent.messages and discord.Intent.message_content both apply toon_message() (both guilds and DMs) on_message_edit() (both guilds and DMs) on_message_delete() (both guilds and DMs) on_raw_message_delete() (both guilds and DMs) on_raw_message_edit() (both guilds and DMs)I presume I need discord.Intent.messages for events such as on_message_edit and on_messsage_delete to even fire and then I need discord.Intent.message_content to see the content of the msg that was deleted/edited? so if I only wanted to know that a message was deleted/edited but not what the msg actually was I'd just the discord.Intent.messages
Any errors?
nope
messages intent applies to message events, message_content intent is used to retrieve content of mostly message object
How to make preview like this any idea?
?
the image provides embed info
There is an api for random colors but idk how to apply the color on the image
The side color of dyno logo?
Yeah
Ah
Idk then
-.-
!d discord.Colour
class discord.Colour(value)```
Represents a Discord role colour. This class is similar to a (red, green, blue) [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)").
There is an alias for this called Color...
Anyone know what this means
This one
https://api.popcat.xyz/color/{}.format(myhexcolor)```
My default image color will change like this?
Eh nope
But it has an jmage
How i do that
I maked that with pillow 
I have no clue 🙏

I think this is going to help u
Select each and every pixel of image using Numpy with a specified color and change it to a different color.
Find the code in this link:
https://github.com/venkateshganu/opencv-basics/blob/master/black_to_red.py
Hi, Can someone help me out.
I am trying to send messages in Private thread using BOT
!d discord.Thread
class discord.Thread```
Represents a Discord thread.
x == y Checks if two threads are equal.
x != y Checks if two threads are not equal.
hash(x) Returns the thread’s hash.
str(x) Returns the thread’s name.
New in version 2.0.
Not familiar with Threads but it still a channel so you'll need to use get_channel or discord.utils.get
me
why? what's the point of this? color/{}.format(myhexcolor) when you can just color/{hexcode} not to talk about f strings are faster than formatting and looks better
I thought he wants to get an image color + hex color so thats why i gave him that api
^
Its because idk lmao
Yeah something like this i was talking
most probably dyno has some image manipulation code, otherwise, you can get a pic with the color and put it inside your embed
Yeah but which module would i use to make something like that
something like this
just do a request to the endpoint
well, so you want what exactly? put the hex color over a certain pic
@discord.ui.button(label="Request Leaf", style=discord.ButtonStyle.green, emoji = "🍃", custom_id="persistent_view:leaf")
async def button_callback(self, button, interaction):
button.disabled = True```
How can edit the view without waiting for an interaction
i'm trying to add slash commands in a cog and dont know what do do with this error
self.bot
and, please, switch to dpy 2
dont use discord_components
it's quite confusing what;s in there
well, it's not officially released on pypi, but it's in development
you can install it using - pip install git+https://github.com/Rapptz/discord.py
there are some breaking changes though
without waiting for an interaction
So when/where exactly do you want to edit the view?
store the message object in the view when you first send it and use that to make edits when you dont have an interaction
or using your interaction's followup webhook with edit_original_message() might also be suitable, though i would save that for ephemeral views
Isnt there a except for cogs? Like
try:
load_extension("cog")
except ExtensionAlreadyLoaded:
...```
nah you have to write that try/except yourself
tho if you use the jishaku extension their load command handles it for you
can discord bot upload emojis
yes, using the Guild's create_custom_emoji() method
Thanks
!d discord.Guild.create_custom_emoji
await create_custom_emoji(*, name, image, roles=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.
You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
and the image should a bytes object
cant it be a local file or a bytes like obj?
im not quite sure
Sure
it has to a bytes or a bytes-like yes
yeah i just checked
im to lazy to check docs on mobile since its so slow
inarguable
Readthedocs issue
yeah
And laggy😭
it takes a solid sec for it to load
and its not my wifi😡
who knows
I'm fairly certain it's because of readthedocs being slow
it is im just joking
mine opens right away ngl
on mobile?
yeah
just tried
🧢
search's hyperlinks work fine enough
it takes a solid sec for it to load the endpoint compared to the desktop ver
and there we go, now it doesnt even redirect me to the docs
it died as usual
How?
Even on laptop mine is slow
And searching is more slow
your wifi is just bad at that point
That's how okimii beats me
is discord's styling changed or is it just me?
😉
lmfao
lmao
that's quite stupid because in september the enforcement for message intent will kick in
