#discord-bots
1 messages · Page 854 of 1
imagine that it is english
No
but it is
Wanna ping mods and see what they think?
xd
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
You say you have git installed, by process of elimination, that means you don't have it in your PATH
what would be the correct code to add an embed image ?
Embed.set_image
🗿 yes, i added 14 days on the created_at and i checked if it exceeds the current time, means the account has been made under 2 weeks, that was my goal
yeah thats not working idk t
why*
show
@commands.command()
async def creator(self, ctx: commands.Context):
await ctx.send (embed = discord.Embed (title=f"9''' Management Bot Creator", description= "Creator of 9''' Management Bot",
Embed.set_image "https://tenor.com/view/pooh-shiesty-gif-19804375" ))
lol
How to get the number of all channels that are on the servers where the bot is located?
im new to dis dont judge me yet
embed = discord.Embed (title=f"9''' Management Bot Creator", description= "Creator of 9''' Management Bot")
embed.set_image("https://tenor.com/view/pooh-shiesty-gif-19804375" )
await ctx.send (embed=embed)
o shoot
so i did the whole thing wrong
but it still sent the other things just not the image
Put your embed object in a seperate variable
embed = discord.Embed(...)
embed.set_image(...)
await ctx.send(...)
len(ctx.guild.channels) ?
A bot can be in multiple servers, which server do you want to get the channels of?
This is to get the number of channels on only one server, but I need from all that have a bot
So every channel in every server?
Number of channels on all servers
do for in bot guilds and sum it
yea
sum(len(guild.channels) for guild in client.guilds)
``` somethin like that
yeah that will work
thanks you
.say has been deprecated
and use f strings
and you need context
oof
the thing is. my last project it wouldn't even respond to anything either
had f-strings n all that
!d discord.ext.commands.Bot.process_commands
await process_commands(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
prolly should process commands in your message listener
you mean event? and use a listener
its better imo
shit i just noticed that, added it all changed say to send still doesn't work
try add this in event
!d discord.ext.commands.Context.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=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.9)") 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.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
That's not a feature for bots unfortunately (i might be mistaken)
You could probably implement it, but it would probably take a while
is their even an endpoint for it?
Looping through the history of every channel
oh
Wdym by that
True, but isnt that how discord itself does it? Just in a faster lang
how to reset cooldown of a specific user 🗿
Yeah true, sometimes takes like 10 seconds to load
Okay let me rephrase what I said, there's no native discord way or endpoint to do it, you can do it by getting the history of a channel and filtering, but that's very slow
If you specify None then no
Like chat message cd?
thats slowmode
Yeah, i dont think you can change the length of slowmode per user
🗿 not slowmode
hes not talking about that lol
Was gonna say lol
ok, that one not work
🗿 ok, how
:v
command.reset_cooldown(ctx)
but that's just for me right? i wana be a specified one, like command.reset_cooldown(dat_one_user)
🗿 yes
ok :v
a name of a comand ofc 🗿
nope, i dont use class, confusing 🗿
what
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
ik that one 🗿
but how to reset cooldown of a specified user
wur
wut
????? that's what i ask from the begining
...
Their question was always reset the cooldown of a user
heey is someone able to create a bot for us in discord like a price bot we are a crypto company and we want our price chart / buy & sells (idk if we allow to hire someone) anyway dm me 🙂
🗿 can't reset a specific user cd? (also not slowmode)
!rule 9
wait, so command_name.reset_cooldown(dat_user[not_me]) is not exist?
we want to create a bot that shows the price chart / sell/buys
in Telegram there are so much bots for that
even poocoin supports them
but for discord there are none so we have to create one from scratch
use API 🗿 (that's the easiest way)
LOL
then create ur own 🗿
🗿 so that's doesn't exist... ok then :moyai_sad:
what
whose crypto is it then 🗿
c r e a t e a n e w o n e
maybe thats why we are looking for people to help us ?
hey can someone pretend I know nothing about making a discord bot and explain the concept of it?
????
oop thanks
well thats something i can work with instead of everybody attacking lol
thanks will continue on Fiverr than
have a nice day
🗿 what
give dis hooman a novel writer role 🗿
🗿
Snowflakes contain the creation time of said snowflakes
Im trying to get all the guild id's and store them in a variable so i can use slash commands
serverIDS = []
for guild in bot.guilds:
serverIDS.append(guild.id)```
^ My code
The error is the image
(snowflake >> 22) + 1420070400000)
``` epoch
What is >>?
wait to fix this would i have to int() it?
!e
for i in range(8):
print(1 << i)
@sick birch :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
003 | 4
004 | 8
005 | 16
006 | 32
007 | 64
008 | 128
sort of
00000001 is 1 in binary
00000001 << 1 = 00000010
00000001 << 2 = 00000100
00000001 << 3 = 00001000
etc...
Yeah conversion between bin and dec
discord API really likes their bitshifts 😔
yep
429 errors means too many requests that the user sent and the API cannot handle. For discord.py the rate limit is 50. Since you are hosting on replit i will tell you something. Replit uses a shared ip to host. So if someone is a spammer who is hosting their bot in one of their ips the API wil temp ban everyone on that ip. Tbh i dont think there is a way to put rate limits on our project in replit. The only way that i can give you is whenever you are being rate limited just go to the replit shell and type kill 1 and then run again
Thank you
Best advice i have is dont use replit lol
Well ik that i am gonna change the hosting of my music bot and my original bot next month from replit to oracle
not quite the Api ratelimits request to handle other clients and to not abuse there api the global ratelimit is 50 yes but each endpoint has different ratelimits which are handled by buckets which are dynamic
oh ok
yay dynamicness 😔
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
i did🗿

how do i make it so i can do @bot.event(or command) instead of client i see ppl using bot.(event, command)
do you know python?
yeah
oof
changing the variable name doesn't do anything if you still instantiate discord.Client
He hinted to the fact he’s using commands.Bot because he said he was using bot.event and bot.command() those aren’t possible on discord.Client
🗿
You named your commands.Bot instance client
💀
Which is incorrect
how can i detect when a nickname was changed + the user who did it?
It should be named bot
yes
As discord.Client exists
oh alr
!d discord.on_member_update
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change:
• nickname
• roles
• pending...
ty
File "c:\Users\thoma\Desktop\New folder\bot.py", line 26, in <module>
client = commands.Bot(command_prefix = '!', intents = intents)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 126, in __init__
super().__init__(**options)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 1183, in __init__
super().__init__(*args, **kwargs)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 287, in __init__
self._connection: ConnectionState = self._get_state(**options)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 312, in _get_state
return ConnectionState(dispatch=self.dispatch, handlers=self._handlers,
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\state.py", line 205, in __init__
raise TypeError(f'intents parameter must be Intent not {type(intents)!r}')
TypeError: intents parameter must be Intent not <class 'discord.flags.Intents'>``` Any one know what this means?
show code
Show intents
import nextcord
import datetime
import json
import asyncio
import os
from discord import FFmpegPCMAudio
from discord.ext import commands
from discord_components import DiscordComponents
from nextcord.ext import commands
intents = discord.Intents.default()
intents.members = True
queues = {}
def check_queue(ctx, id):
if queues[id] != []:
voice = ctx.guild.voice_client
source = queues[id].pop(0)
player = voice.play(source)
client = commands.Bot(command_prefix = '!', intents = intents)
client.remove_command("help")
🗿
what looks good?
What is this
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
ohh maybe import Intents
Try only using nextcord
pain
Yeah because i am making my help command using nextcord
bro what
what
LMFAO
Just use nextcord for everything
use one fucking lib for it all
🗿
I'm curious. How many 429s can a bot get before it gets permanently banned?
@slim ibex remember when i talked about the embed that i wanted to do for my server?
Is this the right structure of the code @client.command() async def start(ctx): embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00) embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False) try: await ctx.send('what is favorite color') except discord.HTTPException: msg = await client.wait_for('message') await ctx.send(embed=embed)
why would you put wait_for in an except
ohh wait i got it sorry
pip install git+https://github.com/Rapptz/discord.py
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
try:
await ctx.send('what is favorite color')
msg = await client.wait_for('message')
except discord.HTTPException:
await ctx.send(embed=embed)```
How do i get the await in an embed?
copied from the official dpy docs, what am i doing wrong? the bot sends multiple messages so which message is it looking for the reaction?
You would want to wait for message inside ur command not embed??? And also format your damn code when you send it here wtf
you can first do wait_for and then make the embed
im running this in a cog, so client doesnt work in a cog, replaced it for bot = commands.Bot(command_prefix='$') is that not correct? whats a cog alternative for client
Unless you specify in the check, any message
client doesn't have cogs
so how do i specify a message? the embed in my example, and can i make the bot react to its own message with the reactions its looking for? so that the user can quickly click on it and it would still be detected
exactly
whats an alternative
what i mean is
whats the docs referring to when it mentions client
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
try:
await ctx.send('what is favorite color')
msg = await client.wait_for('message')
except discord.HTTPException:
await ctx.send(embed=embed)``` Well i am trying have the ctx.send in an embed. So?
You can get a message you send by assigning it to a variable msg = await ctx.send(…) and to ur check add reaction.message == msg
!d discord.Message.add_reaction
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
where would i add the reaction.message == msg
im sending an embed, so would msg = await ctx.send(embed=embed) work?
in a check.
wait_for() can take a callback to a function that you can use to check if the message that’s being reacted to is a specific message, if the reactor is a bot, if the reactor is the command author, etc. it’s really up to you.
If you look at the wait_for() documentation there’s two different examples that implement wait_for(). One being for a message and another being reactions.
Anyone?
Do you mind rephrasing your question. The way it’s asked now doesn’t make too much sense.
Are you asking how to send an embed?
await ctx.send('what is favorite color') When the bot sends this message. i want it to send in an embed. like this
And also see if the user has his dms turned on or not
So build yourself an embed with that content in it and pass it in.
await ctx.send(embed=discord.Embed(description="Example"))
Sends an embed with the description as Example
i genuently have no idea how to phrase this: i want to make it so if the person says !order, it will paste a tesmplate, then wait for their next message. paste it back. then it will say "are you sure you want to do this, if yes, say !yes, to redo do !redo"(then make branches for !yes and !redo). can anyone help me?
!d discord.Client.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.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
how can i make it work with multiple reactions? in my example i want it to react to 3 different emojis (green circle, orange circle, and red circle)
i also dont really understand what you mean.. sorry...
@supple crescent make use of this
See the example in the documentation. It should help you to a significant extent.
will do, apricate it
Do you mind restating your entire purpose or how this command is supposed to work.
user runs command to check on the status of a server, bot replies with the current info in an embed, then bot reacts to that embed with 3 different emojis (red, yellow, and green circles) then im trying to make the bot do different things depending on which circle was reacted with
i already did that part with an http API request
what the heck is the status of a server
By status of the server do you mean just, information about it.
lmao
Like member count, owner, how many channels, etc?
Oh wait. I thought the status code a web server sends back lol
you can use wait_for and wait for a reaction in the event
not talking about discord server, im talking about a private computer running game servers/bots/etc (hosting)
!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.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
and good morning
i know.. i just dont understand how that works / how to do it
rip
Won't say that rn. Going in and out and in and out of sleep lol
relatable
well yes too, kind of
it waits for an event to be dispatched. Events being like on_message, on_reaction_add, etc.
If I sleep, my parents gonna kill me but I am sleepy still ;-;
What’s the best data base for a eco bot?
If it’s small sqlite, if it’s meant to be a bigger bot use postgres
does anyone know why this code doesn't execute anything?
@commands.command(aliases=["mute"])
async def freeze(self, ctx, target: disnake.Member, dur, reason="No reason."):
if "m" in dur:
duration = dur[:-1] * 60
elif "h" in dur:
duration = dur[:-1] * 3600
elif "d" in dur:
duration = dur[:-1] * 86400
reason = reason
MUTEROLE = disnake.utils.get(ctx.guild.roles, id=882121435437490247)
await target.add_roles(MUTEROLE)
# mute embed
muted = disnake.Embed(color=ecolor, description=f"**Frozen** | *{dur}* | <@{target.id}> has been frozen for {reason}.")
muted.set_footer(text=f"by {ctx.author.name}")
muted.timestamp = dt
await bot.channel.send(embed=muted)
await asyncio.sleep(duration)
await target.remove_roles(MUTEROLE)
unmuted = disnake.Embed(color=ecolor, description=f"**Unfrozen** | <@{target.id}>.")
await bot.channel.send(embed=unmuted)```
Alright figured I’d ask cuz all these vids are using json and all the comments say json sucks
Error?
ok, why is the docs example not working for me?
it doesn't seem to add role to the target
right now im trying to make the docs example work
use dummy prints if no error is found
Would mongo be better? Just another popular one I’m seeing
#databases welcome
aight wait
Print the mute role
Oh shit thanks lol
alright
this code can be cleaned up a lot
Because the example provided in the docs has a different purpose than the one you have right now.
File "c:\Users\thoma\Desktop\New folder\bot.py", line 6, in <module>
from discord.ext import commands
ImportError: cannot import name 'commands' from 'discord.ext' (unknown location)```
Its saying this
Reinstall
Dont you use nextcord
the red is what im trying to get to work
Not any more
isnt it nextcord.ext.commands
I uninstalled nextcord
Uh huh.
Don't listen to this guy btw ^^. Nextcord is one of the less favored forks.
Leaving bot making >>>>>> doing bot making
Idk never used it much
🗿
true though
Wait what? The devs said they were gonna rewrite in rust
For real
The old dev was rewriting it in rust and stopped with it
The new cool ones are doing it with pycord
imagine
Yea the main dev was doing that
The new team isn't
Oh well seems like am a useless discord bot too
imagine adding a bot. real chads make them 😎
Damn
Time to stop using Carl bot ig
And only the 1% verify them
Are you reacting with that exact emoji. Theres no check to see if its a specific message or not. So you can react to any message as long as its in the message cache with the emoji
im still lost, any ideas?
yes, thumbs up
dw, you arent getting your bot verified anytime soon
you shouldn't define functions in if/elif statements
god of s-
wtf
yeah ik my bot is wayyyyy to niche and tailored to mr
Ikr
what do you mean...
in the check kwarg, you can use a lambda iirc
will be back when the chat is normal.
nah just a chad name
you define a check function inside your elif block
we'll handle it
Thanks
yeah because its the official docs example...
shoulda been ceo, thats the common one
I changed it
the check is from the docs
send the part of the docs its in
real chad here
No thanks
can i get an autograph?
wait_for
Let's keep things respectful please
Do you have member intents enabled?
ehh whatever its fine
mf USername typing a whole ass thesus
calm down?
Same applies to you
There's no need for that
what do u get outta doing that why does it concern u u act as if u will get something outta of it
no, should it?
server members intent?
Can you please leave it? @bitter depot, uhhh
dont start and argument mannnnnnnnnnn its just gonna get u muted
Yes, reaction_add event needs members intents enabled both on Portal and your code
yeah ur right
Just let it go please
how do i activate it in my code, i just activated it on the portal
🤝 good man
!intents here
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
People have a right to report users they believe aren't following our rules (including for nicknames)
I thought we were leaving this behind but yeah sure whatever
That's a default one nah?
Just use Intents.default()
I get it
Not sure tbh.
It is a default intent, yes
and i would do that in the main bot file, not a cog, correct?
Only members and presence intent isn't
It is, only member , presence and message are privelaged intents so far
I just use Intents.all() and call it over with.
same
Yea in your main file, just like the code in the embed
intents = pycord.Intents.default()
intents.members=True
intents.guilds=True
intents.presence=True
this is better /s
Theres not really a better.
pycord is not the import, that shit uses the discord namespace.
hikari.Intents.ALL go brrrr
I was kidding smh
Am I weird?
I did that on purposeee
Yes, for posting a light mode image.
^
Guilds will turn on automatically in default
!zen 1
Explicit is better than implicit.
The VPS got a light theme
Thats nasty
imagine
Then just do Intents.none() in the first line
ok, should i set intents.messages = true? as only members is set to true right now
xD
messages intent is not priveleged yet
It's gonna be one from April iirc
got 1-2 more months
What version of dpy are you using, if it's the PyPi version
Message is a default intent
30
1.7.3
rip
When discord becomes more of a corporation rather than its original plan to be just a passion project, it releases shit like message intent
Cool
1.7.3
You don't need to do that then
Indeed
It's included in the .default
But meh, we don't talk bout that
Honestly just set your intents to all and get it over with. Lot of hassle over just enabling intents.
commands.Bot(intents=discord.Intents.all())
still wont work, im getting really confused now with the whole intents thing...
Lmao for some reason I enabled Intents.members but I disabled chunking to prevent huge memory uses
Rn, my bot only takes like 60 MB RAM
show your bot object , did you add intents=intents to it?
Just think of them as permissions. They determine what events you will receive over the gateway.
yes, which i just replaced for what @sage otter said by setting them all
embed=discord.Embed(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
embed=discord.Embed(name= f"Name", value='Input Name', inline=False)``` what?
embed.add_field
Yeah i did that but when i try to start the command it wont send me the embed
does the command get trigerred? debug it using some print statement to see till what point is the code working
!d discord.Embed.add_field
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style chaining.
it does get triggered... the check_for is not working..
after the timeout it sends the thumbs down
which happens when there is a timeout error...
as per the example in the docs
Remove the check and try again
So completely get rid of the check=check part and try again.
if it works that means the conditions of your check wasnt being met.
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
msg = await client.wait_for('message')
await ctx.send(embed=embed)
print("The embed has been send")
```
It waits for a reaction until the timeout is hit yea
still doesnt
Are you sure you completely enabled intents
yes, i enabled everything, even presence intent since discord bugged me about it: discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Enable all three intent sliders on the panel
Members
Presence
Message Content
Enable all execpt bot oath
scroll down, you will see a message intents too
ah damn, didnt see it
Yeah the command doesnt get triggered
did you restart the bot?
Me yes
really.
ohh nvm
once again another restart
Idk then. If its hitting the timeout and you're reacting and theres no check for the wait_for() the bot isnt getting the reaction for some reason.
Reasons:
Intents - You arent receiving the event through the gateway
Cache Limiting - The message thats being reacted to isnt in the bots message cache.
yes its timing out
Hello someone
reaction and user are not used, could that be affecting it??
you have a high latency, that may be an issue as well 700-800ms uk
that latency does not matter
its latency to my API
not discord message latency
in sending and receiving response yes
how do i call one discord command from another? I'm able to get a dropdown menu working in a regular chat command, but i want it to run in a slash command. this is my code:
@bot.command()
async def test_menu(ctx):
msg = await ctx.send(
"This message has a select menu!",
components=[
SelectMenu(
custom_id="test",
placeholder="Choose up to 2 options",
max_values=2,
options=[
SelectOption("Option 1", "value 1"),
SelectOption("Option 2", "value 2"),
SelectOption("Option 3", "value 3")
]
)
]
)
# Wait for someone to click on it
inter = await msg.wait_for_dropdown()
# Send what you received
labels = [option.label for option in inter.select_menu.selected_options]
await inter.reply(f"Options: {', '.join(labels)}")
@slash.slash(name='test',description='temp',guild_ids=[917640265475440681])
async def TEST(ctx):
await asyncio.run(test_menu(ctx))
in this specific example, yes,
Because me and Ashley thought you were talking about discord servers
not discord servers, i said that before
im checking the status of a hosted server through my api
Guess I didnt catch that
So why are you waiting for a reaction for again
what are you doing after the wait_for
waiting for a reaction
I guessed that correct in the first place then
and then?
to then run more code based on that reaction
AKA
an http request
to then start, stop or restart that specific hosted server
Either way you still the face the problem of your bot not recieving the reaction even though you're reacting
my quesiton is
In your case it was likely an intents problem.
is bot correct here?? in the docs it uses client, since cogs (which is where im running this in) dont have client, im using bot, which is bot = commands.Bot(command_prefix='$', intents=discord.Intents.all())
Yes it is
ok, and the fact its running inside a cog doesnt matter?
let me copy and paste the whole example from the docs and test if it works in another command
dont
??
a cog, my fren
Took it the opposite way
sad
this is the command
Yea then just do ctx.bot.wait_for
the top starting
You sleepy I thought they meant that the example is using cogs
Use ctx.bot
and you thought copy and pasting would work?
i feel like dying tbh its alright
He didn't do it tho
yeps, I do that too, idk python
Stay in there
no? i meant see if it even works in the first place from the offical docs..
outside of a cogs
using default values, to make sure it even works and see if it running in a cog would be an issue
I guess you have the amount of brain to interpret what is being done in those and incorporate them yourself
That's why just lay down for a few min lol
How tho. Your timeout was getting triggered so in reality that method was working.
I’m so confused right now.
yeah but i think it didnt know what message to look for??
now i can add back the check, right?
Yea
Lmao
you mentioned i should not have a check inside of an elif, why?
ok
moai*
i dont really have another option either, so
I mean do whatever works.
Using 🗿better
Worry if it’s good or bad practice later.
binds best
ok, yes, it works correctly now
Cool
Add it in the check
it doesnt
ij ust copy paste everything and change the check emoji?
!d discord.Message.reactions
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
^^
Yes
Nevermind then. I guess I didn’t understand the question
no, dont do stuffs multiple times, just use one wait_for event ffs
Calm down
am I being too rude/aggressive?
how can 1 wait_for check for multiple emojis though...
imagine learning conditionals
await ctx.author.ban(reason="Running a Bot Command")```
so put the check in an if condition??
no
That "ffs" was a bit rude
uhm, my bad
it gives off the same vibe who think this channel is a peanut gallery and just shits on new people for no reason.
await ctx.author.ban(reason="Totally not abusing my powers") ezzz
It's fine, u r sleep drunk lol
relatable 
probably period mood swings
okimii relates, see?
It’s kinda sad really how people act in this channel. Their attitude can be rather discouraging to newer developers.
Lolol

lmao
still confused on how to make the check for multiple different emojis
I gave you small example earlier tho
👁️👁️
def check(reaction, user):
if reaction.emoji not in [list_of_emojis]:
return False
if reaction.emoji == "your emoji"
#do stuff
elif ...........
return True
Whom u talking bout tho?
Sorry?
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
msg = await client.wait_for('message')
await ctx.send(embed=embed)
print(f"The embed has been send")
``` someone help me please
lambda reac, user: reaction.emoji in list
Ezzz
this is not getting triggered
Ig? Not sure
95% of the people who help in this channel that have a superiority complex
lmao I'm done with lambda for the est of my life
lol
a what🗿
I call out the myself and the way I used to be a while ago as wells
Rip, am I included? probably yes
They are fun tbh
A superiority complex?
wuts that🏃
People who believe they are superior in short
I dont think you are, just towards the people who really have the superiority issue take me for an example
depends on the person, I'm fine with normal functions
I don't really think you got one tbh. U just acting like this rn cz of, uhhh, u know menstrual problems lol
ah

Anyways
lol
Haha let's just leave it Tylerr. The mods can't be everywhere
....?
They also got their own lives lol
(greet:=(lambda x:"Hello, "+[x+"!","my love!"].__getitem__(ord(x[-1]).__eq__(121))))
by andy🏃
Never said they didn’t 
#esoteric-python thanks
not esoteric
Haha left just leave this
It is tho
I'll have a cardiac arrest in my hand now, stop
That’s 100 esoteric
Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
rip
anyone know why?
install ffmpeg
Okay. oki, tell me something
How is it related to the topic of this channel?
(lambda s,d=0:''.join([chr(sum(map(ord,c)))for c in[s[i:i+2]for i in range(0,len(s),2)]]if d else[(lambda x:chr(x)+chr(ord(c)-x))(__import__('random').randrange(0,ord(c))if ord(c)else 0)for c in s]))
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
this is esoteric
ik 🗿

alright, done for today?
Okimii you didn’t just send a lambda you sent a low level piece of python code. Low level python is considered esoteric
anyways
If u r going to a doctor to get your heart checked, then, uhh, take me with u cz I already have a heart attack seeing that piece of code
sure, we'll rip out you arteries and-
nvm
I'm going insane
Lmao
bro
Anyways
nvm it worked
@lost lichen yr issue fixed?
Okimii if you bro me one more time I think I might quite literally go into a seizure.
lolooooll
maybe, about to test it in a few seconds
Ikrrr, feels weird when he says bro
Okay cool
why u do this to me
The whole gang is here
And I can sense us getting warned by mods again
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
see, I'm bored uhh
Then just take everyone to #ot2-never-nester’s-nightmare and yes don't u dare call me Hinter
also, did some-random-api stop receiving requests or something?
This whole entire conversation is off topic. And you decide to rule 7 water when he sent one message 😭
Get used to it
Can i please ask a question please?
Sure
totally a no
Ur jk right
idk, whenever I run it with a bot command it doesnt work and when I simply use the link and open it, it works
@jade tartan what's the question
ofc smh
Well if i want the user to add his name. How do i make it do that?
well since this isn't really related to dbots that much, you can go in their support server and I'll attempt to help you
reaction, user
because you need to check the user too
what if somebody else reacts other than the user who invoked the command
str(user)
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value=":white_check_mark:Verified 18+:white_check_mark:", inline=False)
embed.add_field(name="Name", value="value")
await ctx.send(embed=embed)
print(f"The embed has been send")```
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
Bro
🗿
yeah i removed it because it wasnt being used, and i dont mind if another user reacts
It was used in a discord bot tho, and @quick gust already answered
works for me
didnt work tested all
Just add the user arg too
at least see what's written after that
Where do i add that?
yeah i did
oh alrighty
No 🗿
embed.add_field(name="Name", value="str(ctx.author)", inline=False) Right?
no, value=str(ctx.author)
Does it have to be in a string?
It returns a string
ctx.author is not a string, the value passed for add_field is converted into a string
by putting str() around a value, it turns the whole value into a string, even if its a number value
I meant once you do str() its a string
very informative
lol
Sorry i mean double quoted?
@slate swan did you ever sleep? 
Like str("")
https://github.com/Rapptz/discord.py/blob/45d498c1b76deaf3b394d17ccf56112fa691d160/discord/embeds.py#L572-L577 thats not even required, add_field method does that for you
discord/embeds.py lines 572 to 577
field = {
'inline': inline,
'name': str(name),
'value': str(value),
}```
yeah, for 52 minutes to be exact
but yea, true.
Oh okay thanks

Oo i didn't know that
wait, im doing something wrong..
xD
def check(reaction, user):
if reaction.emoji not in [reaction.emoji for reaction in message.reactions]:
return False
#see the example above
wait, how tf did I use a list comp smh
using a list comp isn't a bad thing
It's actually faster in some cases than simple for loops tho
idk, I never worked with those practically just theoretically or maybe the amount of list comps I have seen here have affected me

Lmao u r just sleepy and don't have control on yr fingers
drinking is injurious to health
Juice
that's a juice box smh
even shinchan referred to beer as juice atleast it was when I saw it on youtube once
lol
Hmmm, ikr
lmao
BTW, how r u here arl? Yesterday sadru was here, now arl... Who's next? EQ?
does this seem like a bug to y'all, I don't think utils.get should be erroring if something in that iterable doesn't have an attribute
I've been in here for months, just never came to this channel smh
then learned y'all advocate for disnake like crazy
really biased ngl
lmao
took these screenshots yesterday
i dont think the check is working correctly, AttributeError: 'Context' object has no attribute 'reactions'
More of, it's cz the features are pushed faster ¯_(ツ)_/¯
I don't really use any fork anyways
what do you use hunter?
Here as in, in this channel lol
store the send method in a vairable and use the reactions method on that
I don't make bots, forgot?
ic
shit, my bots exist now to provide support and help with python code
i'm in a catch 22
.message.reactions
im really lost right now
yes, agree definitely 
ctx.message.reactions
i might just work on this tomorrow, its quite late and im not understanding 90% of what everyone is telling me
ctx.message returns this object, and it has a reactions property
Lol it's fine
reactions
!d discord.Message.reactions
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
yea 😔 i forgot the s for the doc command
Ok
i'll be honest I don't think that we have every feature first, but they're well tested when they're added 
one of the big reasons we don't have our api v10 support pull request merged right now is because i found api bugs with discord when testing it
discord:
- makes api v10 enforce message content
- does not enforce message content intent on v10
because some people sit downstairs, and some upstairs
uhhh its a reference from a discord's yt channel video lmao
oh lol
You're maintaining a fork?
one of the maintainers of one of them, yes
Which?
yeah 
Don't know what to say except continue the great work
import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
print('Message from {0.author}: {0.content}'.format(message))
client = MyClient()
client.run('TOKEN')
Is this good so far
import discord
class MyClient(commands.Bot):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
print('Message from {0.author}: {0.content}'.format(message))
client = MyClient()
client.run('TOKEN')
Would it look like that?
if its subclassing commands.Bot you should probably name the class Bot
and there is no initializer
import discord
Bot MyClient(commands.Bot):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
print('Message from {0.author}: {0.content}'.format(message))
client = MyClient()
client.run('TOKEN')
Would it look like that?
Oh
if you don't know OOP, learn it before making a discord bot
Ok
In this Python Object-Oriented Tutorial, we will begin our series by learning how to create and use classes within Python. Classes allow us to logically group our data and functions in a way that is easy to reuse and also easy to build upon if need be. Let's get started.
Python OOP 1 - Classes and Instances - https://youtu.be/ZDa-Z5JzLYM
Python...
Just understand Attributes and Methods
Thanks
From there you can learn to read the docs
Ok I appreciate it
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\Andrew\Desktop\a\main.py", line 567, in on_message
users = json.load(f)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Add {} in the JSON file
Hi
Im trying to make a timer command so how to take the name of the command which has been ended
lemme put this into a context
I am trying to make a timer command that whenever the timer message is reacted on, it should ping the users who reacted when the timer is over.
so i cant make a new command like on_reaction_add
because it will take every message which has a reaction on it
i dont know if i added the on_reaction_add command in my timer command that if it will work
will api reference work?
wait_for
i tried it, but syntax error
Are you using any synchronous stuffs?
Idk if you still would want help from me judging by the fact how I was behaving last night
im saying that
I deeply apologise for that
Do you have any while true loop or show me your external imports too
Ah, do you have anything like- requests, cv2 or anything
hmm
I dont really know who misguided you so much, but i dont understand what you're trying to achieve
Good
Well i cant really tell you whats happened, goodluck
ok , listen, you see that theres a reaction command there?
so i want it so whoever clicks on that reaction
should get pinged when the timer is over
idk
so i cant make a new command like on_reaction_add
because it will take every message which has a reaction on it
Well that on_reaction_add function is neither a valid command, nor an event
plus its awaiting two times
yes so ig there is a delay
how do we turn a code into a bot
how to make a bot with code?
nvm
Lmao what?
i misguided myself XD
Ypu can actually use message reactions, I could just spoonfeed code instead of wasting time ngl
lol
How do I make a error handler for when a bot doesnt have a permission to do something ? Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions ?
wait
!d discord.on_command_error
nvm
is it if isinstance(error, commands.BotMissingPermissions):?
i cant remember
!d discord.ext.commands.BotMissingPermissions
exception discord.ext.commands.BotMissingPermissions(missing_permissions, *args)```
Exception raised when the bot’s member lacks permissions to run a command.
This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
async def on_reaction_add(reaction, user):
await
await ctx.send(content=f"{ctx.author.mention}",embed=discord.Embed(title="Timer", description=f"Your countdown Has ended!",colour=discord.Colour.random()))
except ValueError:
await ctx.reply(embed=discord.Embed(title="Timer", description="Must be a number!",colour=discord.Colour.random()))
```instead of this, do this-
```py
message = await ctx.send(embed=whateverembed)
#when loop breaks
reaction_users = await message.reactions.users.flatten() #converts the message reactors into a list
mentions = [user.mention for user in reaction_users] #user mentions in a list
mentions_to_send = ", ".join(mentions) #makes a string of all mentions which you can include in the content of the send method later
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Expected discord.Colour, int, or Embed.Empty but received str instead.
I think that is only for the check bot_has_permissions. If I remember correctly you would use CommandInvokeError then isinstance(error.original, discord.Forbidden)
At last u finished the timer?
U need to do color=discord.Colour.blue() instead of "blue'
ig yeah
?
Cool
i did color = 'code'
Hi
i turned #03fcb1 to 0x03fcb1
Mhm
okay?
Yea
ok thx
Rip, your About Me has something against ToS
Remove it then lol
about me doesnt ban
i do not have my selfbot enabled
i dont enable it anytime
ik its against tos
i just had to create for experience
We don't talk bout it here
ok
how do we code a bot
!d discord
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
Use this module
i wanna mention a role with my bot, how to do it with role id?
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
!d discord.Role.mention
property mention: str```
Returns a string that allows you to mention a role.
can you tell me the whole statement, i wanna add in the embed
ok thanks
@maiden fable role = guild.get_role(role_id, /939794298633871371)
this okay?
No
so?
role = guild.get_role(id)
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
im tryna make everyone surprised
in my server
but i need help with my code
@client.command()
async def testpoo1(ctx):
guild = ctx.guild
members = ctx.guild.members
for member in members:
await member.edit("clan member")
my error is raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: edit() takes 1 positional argument but 2 were given
what
edit(nick="clan member")
OH LOL
Also rate limit goes brrrrrrr
ok ty ill try
i had put it correct in my code lol
okay
i tried doing in a test server but it only changed 2 ppls nickanme
me and my alts nickname didnt get changed
put your bot's role above the roles the members have
That too
hey guys I making a command to pick a winner for me like if i say !wonder it should say you won or better luck next time but the chances should be very low of winning what should i write in if statement or is there an another way to do that?
!d random.random use this
random.random()```
Return the next random floating point number in the range [0.0, 1.0).
but idon't want numbers in it

