#discord-bots

1 messages · Page 368 of 1

patent hull
#

and that

stone fractal
#

How can i start to learn discord bots with python plz?

patent hull
#

first learn python with that ^

slim bloom
#

skibidi dop dop yes yes dabaru dabaru

slim bloom
#

@pale zenith what is the error? py embed = discord.Embed(color=color_lace) embed.set_image(url=pfp_url) embed.set_footer(text=f"{self.bot.user.name} | autopfp", icon_url=self.bot.user.avatar.url) embed.timestamp=discord.utils.now()

spice warren
#

@pale zenith what is the error sir 👌

pale zenith
#

@pale zenith excuse me, what is the error

slim bloom
#

@pale zenith heya, what is the error

pale zenith
#

everyone asks what is the error, nobody asks how is the error 😔

slim bloom
pale zenith
#

anyway

#

send the error lol, idk what you expect me to say from that

#

actually I do. it is discord.utils.utcnow() not .now()

#

and both bot.user and user.avatar are optional

slim bloom
slim bloom
#

@pale zenith my love language

spice warren
#

@pale zenith i love u

pale zenith
pale zenith
#

send a traceback

slim bloom
#

thanks sir leonardo for help me

slate swan
#

help?

Traceback (most recent call last):
  File "C:\Users\ethan\Downloads\Downloads\Tools\My Tools\Whitey Selfbot\Whitey Selfbot\Whitey Selfbot\main.py", line 1656, in <module>
    leakedsb.run(token, bot=False)
TypeError: Client.run() got an unexpected keyword argument 'bot'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000249B4CE5250>

C:\Users\ethan\Downloads\Downloads\Tools\My Tools\Whitey Selfbot\Whitey Selfbot\Whitey Selfbot>
#

my friend needs help and idk where to ask

cosmic spoke
#

Anyone interested in making a anime bot

blissful crane
#

All self bot related features have been deprecated since dpy 1.7.3 and removed later on

#

And I don't think helping with self bots is allowed

torn solar
#

!paste

unkempt canyonBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

torn solar
#
@bot.tree.command(name="start", description="Start a player")
async def start(interaction: discord.Interaction, member: discord.Member):
    embed = discord.Embed(description=f'{member.mention} has been made a starter.', timestamp=datetime.now(), color=discord.Color.from_rgb(0,255,0))
    guild = interaction.guild
    role = discord.utils.get(guild.roles, id=1241892185457033236)
    await member.add_roles(role)
    await interaction.response.send_message(embed=embed)```
#

idk why im getting error but i am

sick birch
blissful crane
#

Or your bot doesn't have permissions to add role to anyone

copper flume
#
?jsk py 
ow = discord.PermissionOverwrite()
ow.send_messages=False
await channel.set_permissions(guild.default_role, overwrite=ow)```
discord.py==2.3.2

According to me this code is supposed to set only send_messages to False, but it also resets other permissions along with setting send_messages to False. How do I prevent this?
unkempt canyonBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

slim bloom
#

selfbot 😂

meager rock
copper flume
#

ok

distant fulcrum
#
@bot.tree.command(name="raid", description="Find nations to raid")
async def raid(interaction: discord.Interaction):
    await interaction.response.defer(ephemeral=True)  
    db = DatabaseUser()
    user_id = interaction.user.id
    nation_id = await db.get_user_nation_id(user_id)
    if nation_id is None:
        await interaction.followup.send(
            "Error message",
            ephemeral=True
        )
        return
    query = kit.query("nations", {"id": int(nation_id)}, "score")
    result = query.get()
    if result and "nations" in result:
        nation = result["nations"][0]
        score = nation["score"]
    else:
        await interaction.followup.send(
            "Unable to retrieve your nation score.",
            ephemeral=True
        )
        return

    min_score = int(score) * 0.75
    max_score = int(score) * 1.75
#
    query = kit.query("nations", {
        "min_score": min_score,
        "max_score": max_score,
        "vmode": False,
        "color": ["blue", "yellow", "black", "orange", "red", "green", "white", "purple", "brown", "gray", "lime", "aqua", "pink", "maroon"], 
        "first": 1000
    }, """
        id, nation_name, score, wars{def_id, def_resistance, att_money_looted}, alliance{name}, alliance_position_info{name}, num_cities, vacation_mode_turns, soldiers, tanks, aircraft, ships, color, leader_name, last_active
    """)
    result = query.get()

    if result and "nations" in result:
        nations = result["nations"]
        # Filter and sort nations based on ended wars and money looted
        filtered_nations = []
        for nation in nations:
            total_money_looted = sum(
                war["att_money_looted"]
                for war in nation["wars"]
                if war["def_resistance"] == 0 
 wars
            )
            if total_money_looted > 0:
                filtered_nations.append((nation, total_money_looted))
        filtered_nations.sort(key=lambda x: x[1], reverse=True)
        top_nations = filtered_nations[:10]

        embed = discord.Embed(title="Top Nations to Raid", color=discord.Color.blue())
        for nation, money_looted in top_nations:
            embed.add_field(
                name=nation["nation_name"],
                value=(
                    f"**Score:** {nation['score']}\n"
                    f"**Money Looted:** ${money_looted}\n"
                    f"**Alliance:** {nation['alliance']['name'] if nation['alliance'] else 'None'}\n"
                    f"**Leader:** {nation['leader_name']}\n"
                    f"**Cities:** {nation['num_cities']}\n"
                    f"**Last Active:** {nation['last_active']}\n"
                ),
                inline=False
            )```
#
        await interaction.followup.send(embed=embed, ephemeral=True)
    else:
        await interaction.followup.send(
            "Unable to retrieve nations for raiding.",
            ephemeral=True
        )```
#

Huh, 3 parts, btw I'm getting an error: Argument of type 'Result' is not iterable
In console

nova vessel
#

How'd I get the channel ID a command was invoked in?

wispy falcon
#

what is
await Bot.process_commands(message)
?

upbeat otter
upbeat otter
distant fulcrum
distant fulcrum
upbeat otter
distant fulcrum
#

I didn't got any output in discord but I was expecting to get

upbeat otter
distant fulcrum
#

But I have other commands wait

#
                query = kit.query(
                    "nations", {"id": int(nation_id)},
                    """nation_name, leader_name, color, num_cities, vacation_mode_turns, soldiers, tanks, aircraft, ships, alliance { name }, alliance_position_info { name }, date"""
                )
                result = query.get()

                if result and result.nations:
                    nation = result.nations[0]
#
                    embed = discord.Embed(
                        title="Registration Info",
                        description=f"Registered with nation ID: {nation_id}",
                        color=discord.Color.orange()  
                    )
                    embed.add_field(name="🇺🇳Nation Name",
                                    value=nation.nation_name,
                                    inline=True)
                    embed.add_field(name="👑Leader Name",
                                    value=nation.leader_name,
                                    inline=True)
                    embed.add_field(name="⏳Created",
                                    value=f"`{creation_message}`",
                                    inline=False)
                    embed.add_field(name="🎨Color",
                                    value=nation.color.capitalize(),
                                    inline=True)
                    ```
#
embed.add_field(name="🏙️Cities",
                                    value=nation.num_cities,
                                    inline=True)
                    embed.add_field(
                        name="📴Vacation Mode",
                        value=f"{nation.vacation_mode_turns} Turns",
                        inline=True)
                    if nation.alliance:
                        embed.add_field(name="🕍Alliance",
                                        value=nation.alliance.name,
                                        inline=True)
                    if nation.alliance_position_info:
                        embed.add_field(
                            name="💼Alliance Position",
                            value=nation.alliance_position_info.name,
                            inline=True)
                    embed.add_field(name="💂Soldiers",
                                    value=nation.soldiers,
                                    inline=True)
                    embed.add_field(name="🚜Tanks",
                                    value=nation.tanks,
                                    inline=True)
                    embed.add_field(name="🛩️Aircraft",
                                    value=nation.aircraft,
                                    inline=True)
                    embed.add_field(name="🚢Ships",
                                    value=nation.ships,
                                    inline=True)```
shrewd apex
#

whats kit here?

distant fulcrum
#

kit = pnwkit.QueryKit(os.environ["Key"])

shrewd apex
#

looks ind of like graphql query

distant fulcrum
#

Key in that is my API key

shrewd apex
#

why are u not using the async api for kit tho

#

result = await query.get_async()

distant fulcrum
#

Ok

shrewd apex
distant fulcrum
#

Has errors bro

#

Operator "in" not supported for types "Literal['nations']" and "Result"

shrewd apex
#

in the line before the error lol

#

just do print(result)

distant fulcrum
distant fulcrum
shrewd apex
#

??

distant fulcrum
#
import pnwkit

# Initialize pnwkit with your API key
kit = pnwkit.QueryKit("key")

query = kit.query("nations", {
        "min_score": 500,
        "max_score": 1000,
        "vmode": False,
        "color": ["blue", "yellow", "black", "orange", "red", "green", "white", "purple", "brown", "gray", "lime", "aqua", "pink", "maroon"], 
        "first": 300
    }, """
        id, nation_name, score, wars{def_id, def_resistance, att_money_looted}, alliance{name}, alliance_position_info{name}, num_cities, vacation_mode_turns, soldiers, tanks, aircraft, ships, color, leader_name, last_active
    """)
result = query.get()
print(result)```
river mason
#

Anyone know how lazy servers work?

#

Like the ones you don't get msgs by just connecting you gotta send a packet

distant fulcrum
shrewd apex
#

and the result is?

distant fulcrum
#

@shrewd apex whats next?

unkempt canyonBOT
#

pnwkit/new.py line 966

class Result:```
shrewd apex
#

can u do print(result.nations)

distant fulcrum
distant fulcrum
# shrewd apex can u do `print(result.nations)`
import pnwkit

# Initialize pnwkit with your API key
kit = pnwkit.QueryKit("key")

query = kit.query("nations", {
        "min_score": 500,
        "max_score": 1000,
        "vmode": False,
        "color": ["blue", "yellow", "black", "orange", "red", "green", "white", "purple", "brown", "gray", "lime", "aqua", "pink", "maroon"], 
        "first": 300
    }, """
        id, nation_name, score, wars{def_id, def_resistance, att_money_looted}, alliance{name}, alliance_position_info{name}, num_cities, vacation_mode_turns, soldiers, tanks, aircraft, ships, color, leader_name, last_active
    """)
result = query.get()
print(result)
nation_name = result.nations[0]["nation_name"]
print(nation_name)```
shrewd apex
#

bruh stop spamming the code

#

just send the result that was printed

distant fulcrum
shrewd apex
#

yeah so the query works

#
if result and "nations" in result:
        nations = result["nations"]

this however is wrong because result is not a dictiorary of such data it is a class

#

what u want to do is just

nations = result.nations
distant fulcrum
#

From the code?

unkempt canyonBOT
#

pnwkit/data.py lines 102 to 106

def __getitem__(self, name: str) -> Any:
    try:
        return self.__getattribute__(name)
    except AttributeError as e:
        raise KeyError(name) from e```
hushed galleon
#

oh wait nevermind, the other data classes inherit that method but not result itself

distant fulcrum
#

Do I have to remove that from the code then?

shrewd apex
#

yep

distant fulcrum
#

Ok

shrewd apex
copper flume
#
0|bot  | Traceback (most recent call last):
0|bot  |   File "/path/to/venv/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
0|bot  |     await coro(*args, **kwargs)
0|bot  |   File "/root/core/errors.py", line 130, in on_command_error
0|bot  |     raise error
0|bot  |   File "/path/to/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
0|bot  |     ret = await coro(*args, **kwargs)
0|bot  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
0|bot  |   File "/root/cogs/moderation.py", line 665, in nick
0|bot  |     await member.edit(nick=nick)
0|bot  |   File "/path/to/venv/lib/python3.11/site-packages/discord/member.py", line 914, in edit
0|bot  |     return Member(data=data, guild=self.guild, state=self._state)
0|bot  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0|bot  |   File "/path/to/venv/lib/python3.11/site-packages/discord/member.py", line 348, in __init__
0|bot  |     self._user: User = state.store_user(data['user'])
0|bot  |                                         ~~~~^^^^^^^^
0|bot  | TypeError: string indices must be integers, not 'str'```
```py
async def nick(self, ctx: Context, member: discord.Member, nick: str = None):
    await member.edit(nick=nick)```

My nick command used to work fine but I don't know why I am getting this error today.
@pale zenith
shrewd apex
#

they took conciseness to another level

copper flume
#

shouldn't be

shrewd apex
#

and ur basically trying to do "some_string"['user']

copper flume
#

but member is discord.Member object

shrewd apex
#

yeah interesting lemme take a look

copper flume
hushed galleon
shrewd apex
#

yep

shrewd apex
#

this is a bit weird

copper flume
#

oh, it works

#

but gives error

hushed galleon
#

what discord.py version are you using? it kind of looks like the API response was malformed

#

hmm, looks like 2.3.2 as usual...

shrewd apex
#

is the error reproducible?

hushed galleon
unkempt canyonBOT
#

discord/member.py lines 912 to 914

if payload:
    data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
    return Member(data=data, guild=self.guild, state=self._state)```
copper flume
hushed galleon
copper flume
#

ok

hushed galleon
#

not even an empty line?

copper flume
hushed galleon
#

i would expect at least something to be printed, even if it was an error

hushed galleon
#

oh, at least that means the code did run

#

presumably it returned an empty string... that doesnt seem right

shrewd apex
#

lemme try to reproduce this lol

hushed galleon
#

i tested a minute ago and couldnt repro it

shrewd apex
#

hmm

hushed galleon
# copper flume

can you yield (type(data), repr(data)) just to be certain that its an empty string?

#

afterwards you can include the result of that command in your bug report

copper flume
#

wait

#

(<class 'str'>, "''")

#

a string inside a string?

#

lol

hushed galleon
#

do you think it could be an intents thing? your intents are quite minimal, but the most important one is guilds which you have, plus the api docs dont describe a situation where editing a member would return an empty body...

copper flume
#

does the work, but gives the error

#

in the edit() function

copper flume
#

i got this error today only

shrewd apex
#

nope couldnt reproduce

copper flume
#

💀

pale zenith
#

@copper flume nvm

#

I'm so confused.

copper flume
#

.

#

actually

pale zenith
#

you should mention that in your issue too...

copper flume
#

ok

pale zenith
#

that is probably your issue btw. whatever the fuck that library is doing is fucking with the api. consider not using it?

spice warren
#

mfw raising it here instead of answering on the github issue they made

pale zenith
#

they pinged me here directly

copper flume
#

check

spice warren
#

this person is already being helped, feel free to disregard
they are also banned from discord.py for being rude and offensive to helpers, do with that information what you will

pale zenith
#

noted

hushed galleon
#

wait, so this twilight-http-proxy is a discord API mock?

spice warren
#

no

spice warren
#

middleman for requests for """faster and better handling"""

#

its just a http proxy

copper flume
#

handles request in a better way which doesn't cause CF Bans

pale zenith
#

http-proxy looks to be the proxy itslef, while twilight-http-proxy seems to be a handler for twighlight-http which accounts for the fucked up api responses that the proxy returns

spice warren
#

This is not how you avoid CF bans at all, lol

#

Discord.py already does what it can to prevent you getting banned, but terrible user code often wins
You were told this numerous times and the arguments that ensued are what led to your ban

pale zenith
#

Oh I remember this peson now

spice warren
#

Yep

pale zenith
#

antiraid bot innit

spice warren
#

Yep

pale zenith
copper flume
timber dragon
#

Aka reverting something that someone did with permissions that they shouldn't have

torn orchid
#

Hi guys. Help pls. How to create a ephemeral message?

quick gust
#

ephemeral = True

torn orchid
timber dragon
#

Or in ctx.send if its a hybrid command

slate swan
#

Hi guys!
How do i install discord.py in replit? Using python

upbeat otter
slate swan
#

Ooohhh

quick gust
slate swan
#

Okay thank you thank god

upbeat otter
#

god 💀

rain hedge
timber dragon
# torn orchid

You can only send an ephemeral on response to an interaction

#

So when invoking that command via the slash menu

Setting the prefix to "/" doesn't do anything special

azure glacier
#

Hello, does anyone have good tutorial about slash commands in Cogs? I wrote simple bot with one cog and run into error which i cant fix. I tried every possible solution on internet but nothing worked. I created post on python-help but noone answered. Can someone help me with this?

azure glacier
#

OK i found my problem, i pass server id as string not int 🤣

fast osprey
#

You also should not be syncing in on_ready (or probably doing anything in it)

azure glacier
#

yeah, i've already move those parts to setup hook

wanton current
#

not better 💀

hushed galleon
azure glacier
wanton current
#

"works" and "is optimal" are two different things

shrewd apex
azure glacier
hushed galleon
wanton current
#

What does being self-taught have to do with it, aren't we all self-taught since you can't really take a university course on discord.py? Anyway, wouldn't you strive for the best, and not settle with something that works? It's of course up to you, but I'm just saying that there's a better way to do things.

shrewd apex
#

dpy uni course 💀

#

first class debate on different libraries dpy vs disnake vs pycord/nextcord (honorable mention hikari)

wanton current
#

only really different one being hikari

azure glacier
unreal quest
#

could anyone help me with slash commands?

#

i am trying to make a command which returns the pfp of the user

unreal quest
#
@client.tree.command(name="image", description="Displays the avatar of a user.")
async def avatar(ctx, member: discord.Member = None):
    if member == None:
        member = ctx.author
    embed = discord.Embed(title = member).set_image(url = member.avatar.url)
    await ctx.send(embed = embed)
slate swan
#

slash commands dont have context

unreal quest
#

so how would i send the image?

slate swan
#

they have Interaction

#

and it has .user property

#

!d discord.Interaction.user

unkempt canyonBOT
unreal quest
#

thanks

wanton current
unreal quest
#

instead of ctx

mossy stream
#

wait

#

you can code discord bots with pythn?

unreal quest
#

yea

slate swan
#

await interaction.response.send_message(...)

mossy stream
#

cool

wanton current
slate swan
#

nextcord

glad cradle
slate swan
#

i know what you want to hear

glad cradle
slate swan
#

na

wanton current
#

say it

blissful crane
#

Say it right now

stone gate
#

hey! i want to make a function of my bot to just stop if its on a thread this is for a very specific reason that will take me a while to explain, lets say i just want to say:

    return```
fast osprey
#

Can check the type of message.channel

stone gate
#

do you have any reference for that? :0

fast osprey
#

!d discord.Message.channel

unkempt canyonBOT
fast osprey
#
  • using isinstance to see if it's type is Thread
stone gate
#

so, like this? if isinstance(message.channel, discord.Thread):

#

it worked, thanks!

slim bloom
#

@pale zenith great dear sir, could you help me? please

slate swan
#

Does anyone have a bot like restorcord?

slate swan
#

that's so weird... it just doesn't send the image for me. :/

distant fulcrum
#
async def create_table_roles(self):
        conn = await self.get_connection()
        async with conn.cursor() as cursor:
            await cursor.execute('''CREATE TABLE IF NOT EXISTS roles (
                                    guild_id INTEGER PRIMARY KEY,
                                    members TEXT,
                                    leader TEXT
                                  )''')
            await conn.commit()

async def add_guild_members(self, guild_id, members):
        conn = await self.get_connection()
        async with conn.cursor() as cursor:
            await cursor.execute("INSERT OR REPLACE INTO roles (guild_id, members) VALUES (?, ?)", (guild_id, members))
            await conn.commit()

    async def add_guild_leader(self, guild_id, leader):
        conn = await self.get_connection()
        async with conn.cursor() as cursor:
            await cursor.execute("INSERT OR REPLACE INTO roles (guild_id, leader) VALUES (?, ?)", (guild_id, leader))
            await conn.commit()

    async def get_guild_roles(self, guild_id):
        conn = await self.get_connection()
        async with conn.cursor() as cursor:
            await cursor.execute("SELECT members, leader FROM roles WHERE guild_id=?", (guild_id,))
            result = await cursor.fetchone()
        return {"members": result[0], "leader": result[1]} if result else None```
#

Command 1

@bot.tree.command(name="roles", description="Set roles with Dominion")
@app_commands.describe(members="Role for your alliance members", leader="Role for your alliance leader")
async def roles(interaction: discord.Interaction, members: discord.Role, leader: discord.Role):
    if not interaction.user.guild_permissions.administrator:
        return await interaction.response.send_message("You do not have permission to use this command.", ephemeral=True)
    
    guild_id = interaction.guild.id

    # Add roles in the database as text
    await db.add_guild_members(guild_id, str(members.id))
    await db.add_guild_leader(guild_id, str(leader.id))
    
    await interaction.response.send_message("Roles added successfully!", ephemeral=True)```
#

Command 2

@bot.command(name="check")
async def check(ctx):
    guild_id = ctx.guild.id
    roles = await db.get_guild_roles(guild_id)
    
    if roles:
        members_role_id = roles.get("members")
        leader_role_id = roles.get("leader")
        await ctx.send(f"Members Role ID: {members_role_id}, Leader Role ID: {leader_role_id}")
    else:
        await ctx.send("No roles found for this guild.")
#

It says roles added successfully but when I retrieve roles then it says members as none

slate swan
#

how to make a discord selfbot to auto accept friend requests

spice warren
#

You don't get selfbot help anywhere, they're against ToS.

copper flume
#

Why the check @commands.bot_has_permissions(move_members=True) returns False even if the bot has admin permission but not with @commands.bot_has_guild_permissions(move_members=True)

#

@spice warren

spice warren
#

I refuse to help racist and rude people

timber dragon
copper flume
timber dragon
#

Also text vs voice channel

#

move_members will be False in a text channel iirc

#

Idk how exactly perms work

copper flume
#

oh

fast osprey
#

Your bot should not have admin

unkempt canyonBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

copper flume
lyric solar
#

can i somehow make private threads??

midnight oracle
#

If it's yours

hushed galleon
lyric solar
copper flume
hushed galleon
# lyric solar huhh?? i thought it creates a public thread

type (Optional[ChannelType]) – The type of thread to create. If a message is passed then this parameter is ignored, as a thread created with a message is always a public thread. By default this creates a private thread if this is None.

lyric solar
midnight oracle
lyric solar
#

is there a minimum archive minute thing

#

auto_archive_duration=15
i have it set to 15

copper flume
lyric solar
midnight oracle
#

That's what I'm saying xd

copper flume
#

why will i remove admin permission?

lyric solar
#

safety

midnight oracle
hushed galleon
midnight oracle
#

In my opinion, that's a thing of preference

copper flume
#

my question is, the bot has admin permission which means the bot has all the permissions

#

but still it says that the bot doesn't have the permissions

#

and check is failed

midnight oracle
#

Did you invited the bot with admin permissions?

midnight oracle
#

also enabled all the intents?

copper flume
#

not presence intent

midnight oracle
#

can I see the error message, that's weird

copper flume
#
?jsk py channel.permissions_for(ctx.me).move_members```
#

got it, move_members is false for text channels and not for voice channels as said above by soheab.

lyric solar
hushed galleon
#

you can tell cause the error you got was 400 Bad Request, which only comes from sending the discord API something invalid

unreal quest
#

how do i check if someone has reacted to a message the that bot has add reactions to, in a @app_commands.command

#

I am making a quiz game, and the bot reacts with 4 emojis, and i want it to detect if you choose the correct one

fast osprey
#

There is no reason, literally, to give a bot more permissions than it needs to do its stated purpose besides laziness

#

If you are optimizing on saving 5 whole ass minutes of scrutinizing what your bot needs to do, your priorities are hilariously wrong

lyric solar
#

@hushed galleon sorry for disturbing but how can i give my bot like 4 shards?

lyric solar
#

hi leonardo

hushed galleon
pale zenith
pale zenith
hushed galleon
#

ive wondered that too, dpy doesnt mention using any form of IPC or whatnot with sharding

lyric solar
#

like 4 shards will act like 1 shard?

hushed galleon
#

what is the point of AutoShardedClient then? for bots in 2500+ guilds that arent yet performance constrained?

pale zenith
#

More like you don't gain any performance increase by using a single auto sharded client. It's still a single event loop and a single process

pale zenith
#

Friend of mine had a bot in 100k guilds on a single process, then it was too much and had to do actual, proper clustering and shit, and now he's rewriting the entire bot

hushed galleon
#

huh, dpy's shard support must be simpler than i imagined

#

definitely sounds like it'd be a tough journey restructuring a single process bot for that scale

#

well, i guess it depends on how much shared memory / cached stuff you were relying on

pale zenith
hushed galleon
unkempt canyonBOT
#

src/discord_ws/client/client.py lines 239 to 250

try:
    async with self._connect(gateway_url) as ws:
        await self._handle_connection(session_id=session_id)
except* ConnectionClosed as eg:
    # Multiple errors should still be from the same connection,
    # so we're only interested in handling the first occurrence
    e = _unwrap_first_exception(eg)
    assert e is not None
    reconnect = self._handle_connection_closed(e) and reconnect
except* (GatewayInterrupt, HeartbeatLostError):
    if not reconnect:
        raise```
hushed galleon
#

and that was only for one connection, im still not sure how i'd rewrite it to avoid exception groups here

lyric solar
#

dyno's coded in python right?

#

nvm

#

its in nodejs

copper flume
#
class IDK(discord.ui.View):
    def __init__(self,
                 bot
                 ):
        self.bot = bot
        ...

        self._panel_pending = False

        self.pending_panel_message: discord.Message = None
        super().__init__(...)

    @discord.ui.select(
        ...
        )
    async def callback(self, intr: intr, select: Select):
        
        if self._panel_pending is True:
            await self.pending_panel_message.delete()
            self.pending_panel_message.components[0].stop()
        
        view = Panel(...)
        self.pending_panel_message = await intr.response.send_message(
            ...
            view=view
            )
        print(self.pending_panel_message)
        self._panel_pending = True
        await view.wait()
        self._panel_pending = False```
how is self.pending_panel_message None?
shrewd apex
#

u set it to None?

copper flume
#

but should be changed

shrewd fjord
#

sup fellas XD

shrewd apex
#

hell

copper flume
#

did my python3.11 interpreter die

shrewd apex
shrewd fjord
copper flume
#

no not any example

#

i coded myself

shrewd fjord
#

?

shrewd apex
#

nvm point is send_message returns None

shrewd apex
#

u need to use original_response()

shrewd fjord
#

^

#

!d discord.Interaction.original_response

unkempt canyonBOT
#

await original_response()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Fetches the original interaction response message associated with the interaction.

If the interaction response was a newly created message (i.e. through [`InteractionResponse.send_message()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionResponse.send_message) or [`InteractionResponse.defer()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionResponse.defer), where `thinking` is `True`) then this returns the message that was sent using that response. Otherwise, this returns the message that triggered the interaction (i.e. through a component).

Repeated calls to this will return a cached value.
shrewd apex
#

!d discord.InteractionResponse.send_message

unkempt canyonBOT
#

await send_message(content=None, *, embed=..., embeds=..., file=..., files=..., view=..., tts=False, ephemeral=False, allowed_mentions=..., suppress_embeds=False, silent=False, delete_after=None, poll=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Responds to this interaction by sending a message.
shrewd fjord
#

coro

copper flume
#

i see

pale zenith
#

that is cool though

lyric solar
#

how do i put a cooldown on a bot.tree.command

#

😭

patent hull
#

iirc it should be @app_commands.checks.cooldown

lyric solar
#

and how do i set it

#

@app_commands.checks.cooldown(60)?

hushed galleon
#

!d discord.app_commands.checks.cooldown

unkempt canyonBOT
#

@discord.app_commands.checks.cooldown(rate, per, *, key=...)```
A decorator that adds a cooldown to a command.

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns are based off of the `key` function provided. If a `key` is not provided then it defaults to a user-level cooldown. The `key` function must take a single parameter, the [`discord.Interaction`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction) and return a value that is used as a key to the internal cooldown mapping.

The `key` function can optionally be a coroutine.

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandOnCooldown) is raised to the error handlers.

Examples

Setting a one per 5 seconds per member cooldown on a command:
hushed galleon
#

so at least 2 args, rate/per

slate swan
#
-- Code goes up there

                    if contentEnabled and embedEnabled and buttonEnabled is True:
                        try:
                            await member.send(content = contentText.format(member = member, guild = guild), embed = embed, view = view)
                            console.success(f"Sent message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX})")
                        except Exception as e:
                            console.error(f"Failed to send message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX}) {e}")
                    elif embedEnabled and buttonEnabled is True:
                        try:
                            await member.send(embed = embed, view = view)
                            console.success(f"Sent message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX})")
                        except Exception as e:
                            console.error(f"Failed to send message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX}) {e}")
                    elif contentEnabled and buttonEnabled is True:
                        try:
                            await member.send(content = contentText.format(member = member, guild = guild), view = view)
                            console.success(f"Sent message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX})")
                        except Exception as e:
                            console.error(f"Failed to send message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX}) {e}")
                    elif contentEnabled and embedEnabled is True:
                        try:
                            await member.send(content = contentText.format(member = member, guild = guild), embed = embed)
                            console.success(f"Sent message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX})")
                        except Exception as e:
                            console.error(f"Failed to send message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX}) {e}")
                    elif contentEnabled is True:
                        try:
                            await member.send(content = contentText.format(member = member, guild = guild))
                            console.success(f"Sent message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX})")
                        except Exception as e:
                            console.error(f"Failed to send message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX}) {e}")
                    elif embedEnabled is True:
                        try:
                            await member.send(embed = embed)
                            console.success(f"Sent message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX})")
                        except Exception as e:
                            console.error(f"Failed to send message to: {Fore.MAGENTA}{member}{Fore.LIGHTBLACK_EX} ({Fore.MAGENTA}{member.id}{Fore.LIGHTBLACK_EX}) {e}")```

How could I make the bot leave the guild it's messaging users on once it's finished
#

I tried using guild.leave but it didn't seem to work

lyric solar
lyric solar
slate swan
patent hull
slate swan
#

^

patent hull
#

o

#

nvm, guild.leave should work fine

lyric solar
slate swan
slate swan
patent hull
#

:fall:

slate swan
#

print still sends tho

#

saying "left ... server"

patent hull
#

no errors raised?

slate swan
#

nope

patent hull
#

you aren't consuming/handling the errors?

slate swan
#

dont think so

lyric solar
#

thegamecracks has been typing for a while now lol

hushed galleon
#

yas im thinking

lyric solar
#

okay

hushed galleon
# pale zenith first time I've ever seen except*

ah i remember now, the receive loop and heartbeat run in different tasks so my TaskGroup wraps it in an exception group in case both fail at the same time... im still not sure how i would write a handler that would check every exception instead of ignoring the rest... i guess .subgroup(predicate) would be involved?

hushed galleon
lyric solar
#
@bot.tree.error
async def on_error(interaction: discord.Interaction, error: app_commands.AppCommandError) -> None:
    if isinstance(error, app_commands.CheckFailure):
        try:
            await interaction.response.send_message(f"No permission!")
        except discord.InteractionResponded:
            await interaction.followup.send(f"No permission!")
    else:
        raise error```
#

did this a while ago idk if it'll still work

hushed galleon
#

the cooldown doc has an example that includes a local error handler for the command, but putting it in your global handler would be a good idea: py @bot.tree.error async def on_tree_error(interaction: discord.Interaction, error: app_commands.AppCommandError): if isinstance(error, app_commands.CommandOnCooldown): await interaction.response.send_message(f"You're on cooldown for {error.retry_after} seconds!", ephemeral=True) else: raise error

#

!d discord.app_commands.CommandOnCooldown

unkempt canyonBOT
#

exception discord.app_commands.CommandOnCooldown(cooldown, retry_after)```
An exception raised when the command being invoked is on cooldown.

This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CheckFailure).

New in version 2.0.
hushed galleon
#

right, attributes dont show in the embed... well anyway the exception has a .cooldown attribute if you want to show the rate/per limit too

slate swan
#

how do you like untimeout someone 💀

slate swan
unkempt canyonBOT
#

await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta).

You must have [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members) to do this.

This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit).
slate swan
#

If None is passed then the timeout is removed

nova vessel
#

How can I implement set values for an argument, using interaction

wind phoenix
#

Heyyy, anyone want to get reputation on stack overflow

copper flume
#
if entry.action == discord.AuditLogAction.channel_delete:
                channel  = entry.target```
why is channel an Object and not a text/voice channel
#
0|bot  | [2024-05-22 06:57:19] [ERROR   ] discord.client: Ignoring exception in on_audit_log_entry_create
0|bot  | Traceback (most recent call last):
0|bot  |   File "/path/to/venv/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
0|bot  |     await coro(*args, **kwargs)
0|bot  |   File "/root/Events/", line 401, in antinuke_audit_log_entry
0|bot  |     new_channel = await channel.clone()
0|bot  |                         ^^^^^^^^^^^^^
0|bot  | AttributeError: 'Object' object has no attribute 'clone'```
upbeat otter
#

you can get the id of the channel and getch it

copper flume
#

ok

copper flume
#
if entry.action == discord.AuditLogAction.channel_delete:
                channel  = entry.target```
upbeat otter
copper flume
wispy cave
#

Can I ues python let the arduino development board recognize the QR code and trigger specific actions based on different QR codes, such as controlling the switch and brightness of the light?

copper flume
#

do i need to store it in cache in the on_guild_channel_delete event?

drowsy thunder
#

Hello guys wassup

blissful crane
naive briar
#

Pure hope

copper flume
#

I got the solution

#

I stored it in cache

#

in on_guild_channel_delete event

gritty thorn
#

if i send the command the bot respond me twice, and i cant put await because is a traceback

fast osprey
#

You shouldn't be doing those things in on_ready. That event fires repeatedly and randomly

shrewd apex
fast osprey
#

What library and version are you using?

gritty thorn
gritty thorn
#

@bot.setup_hook

timber dragon
#

Subclass Bot and override it

fast osprey
#

Adding cogs is async as of 2.0

gritty thorn
#

some sample?

timber dragon
#

Instead of doing async setup in on_ready, or using a task which may lead to events being called before that task runs, you can overwrite Client/Bot.setup_hook.

For example: ```py

subclassing commands.Bot

class MyBot(commands.Bot):
# overriding setup_hook and doing our stuff in it
async def setup_hook(self):
# self is the bot here
print(f"Logged in as: {self.user}")
# can load your extensions here:
# await self.load_extension(...)

using the class:

bot = MyBot(command_prefix=..., intents=..., ...)

notice how we previously used:

bot = # commands.Bot(command_prefix=..., intents=..., ...)

but now our subclass.

Docs: https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.setup_hook
gritty thorn
#

-_- im dumb

gritty thorn
#

was trying hook, but isnt work prob my error

#

cant fix

timber dragon
#

What isn't working?

fast osprey
#

Also, show more code. You most likely have an on_message listener somewhere

gritty thorn
#

Ok wait

#

I open the pc and record

fast osprey
#

If you're adding cogs, we're going to need that code too

gritty thorn
#

wait

#

main.py

from discord.ext import commands
from variables import TOKEN, ACTIVIDAD,PREFIX 
from comandos.general.help import Help
intents = discord.Intents.all() #all / default
bot = commands.Bot(command_prefix=PREFIX, intents=intents)
cogs = [Help]
@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Streaming(name=(ACTIVIDAD), url="https://www.youtube.com/) #Streaming/Idle/Playing
    print(f'¡Bot {bot.user.name} conectado!')
    for cog in cogs:
         bot.add_cog(cog(bot))
bot.run(TOKEN)```
commands/general/help.py

from discord.ext import commands
import discord

class Help(commands.Cog):
def init(self, bot):
self.bot = bot

@commands.command()
async def help(self, ctx):
    await ctx.send(f'Enviado a {ctx.author.mention}')

def setup(bot):
bot.add_cog(Help(bot))```

#

cogs= [help, meme, search,...]

fast osprey
#

Take all of the code out of on_ready and put it in the right place, first

#

Any of these cogs could be changing behavior

twilit grotto
#

your class name isnt Help

gritty thorn
twilit grotto
#

ik i was just pointing that out

gritty thorn
#

i just forgot, just sample

#

the bot send me twice

dusk violet
#

hi i need a little bit help.

#

So i made a bot in python on windows he works perfectly but on my rpi to host it, it doesn't work cuz the font i use for the welcome message

#

Idk how i can fix it ping me

#

I use a custom font .ttf

fast osprey
#

What does "welcome message" mean here

gritty thorn
dusk violet
fast osprey
#

So you're generating an image then? With something like PIL?

fast osprey
#

What's the error?

dusk violet
#

But on my rpi the .ttf font doesn't work

#
  File "/home/ju/Desktop/FEBOT/myenv/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/ju/Desktop/FEBOT/bot.py", line 71, in on_member_join
    await send_welcome_message(member, welcome_channel)
  File "/home/ju/Desktop/FEBOT/bot.py", line 78, in send_welcome_message
    welcome_image_path = await create_welcome_image(member, welcome_message)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ju/Desktop/FEBOT/bot.py", line 91, in create_welcome_image
    font = ImageFont.truetype(font_path, 20)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ju/Desktop/FEBOT/myenv/lib/python3.11/site-packages/PIL/ImageFont.py", line 807, in truetype
    return freetype(font)
           ^^^^^^^^^^^^^^
  File "/home/ju/Desktop/FEBOT/myenv/lib/python3.11/site-packages/PIL/ImageFont.py", line 804, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ju/Desktop/FEBOT/myenv/lib/python3.11/site-packages/PIL/ImageFont.py", line 244, in __init__
    self.font = core.getfont(
                ^^^^^^^^^^^^^
OSError: cannot open resource
#

Bro i'm dumb asf, linux systems send an error when the syntax isn't good like a capital.

fast osprey
#

You have shared one file

shrewd apex
dusk violet
gritty thorn
fast osprey
#

I don't help in dms

#

And especially not downloading zips from randos lol

gritty thorn
#

lol

fast osprey
#

GitHub or mystbin would be ideal

turbid shard
#

anyone know how to check if someones a thread owner?

fast osprey
#

!d discord.Thread.owner

unkempt canyonBOT
turbid shard
#

how do i use choices cuz im struggling

fast osprey
#

in what sense?

slate swan
#

hello im creating a discord bot for a slash command blah blah anyways how can i make it ask for an image when using / command?

#

my friend said something about being able to upload a 25mb image

#

any hints? 🙂

#

im using hybrid for slash commands

fading marlin
#

Add a parameter to your command callback and set the type-hint to discord.Attachment

slate swan
#

thanks

upbeat otter
#

it's good to give them the flexibility to either give a url Or an image

slate swan
#

wow this is the deadest ive seen the chat

subtle jolt
#

How do I mention a role in a select menu?
Ive tried the following:
discord.SelectOption(label=role.mention)
discord.SelectOption(label=role)
discord.SelectOption(label=role.name)

#

is that even a discord bots related problem?

slate swan
#

thanks gang

subtle jolt
#

😉

quick gust
upbeat otter
#

!d discord.ui.RoleSelect

unkempt canyonBOT
#

class discord.ui.RoleSelect(*, custom_id=..., placeholder=None, min_values=1, max_values=1, disabled=False, row=None, default_values=...)```
Represents a UI select menu with a list of predefined options with the current roles of the guild.

Please note that if you use this in a private message with a user, no roles will be displayed to the user.

New in version 2.1.
young dagger
#

How can I reach the latest message from each channel in a category on on_ready?

#
lfg_category_id = 1204554345815875606
last_user_message = {}

class MyClient(commands.Bot):
    async def on_ready(self):

        for guild in self.guilds:
            # Find the category by ID
            category = discord.utils.get(guild.categories, id=lfg_category_id)

            if category:
                for channel in category.text_channels:
                    # Fetch the latest message for each text channel
                    async for msg in channel.history(limit=1):
                        last_user_message[channel.id] = msg
#

Or is there any better way to do it?

fast osprey
#

Cmon

#

!d discord.on_ready

unkempt canyonBOT
#

discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.guilds) and co. are filled up.

Warning

This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
fast osprey
#

Short of it is no, you shouldn't use on_ready for 99.9% of things

upper kiln
#

print(“hello world”)

wanton current
#

syntax error

young dagger
light glen
#

i need help pls :

bot.py :

import discord
from discord.ext import commands
import commandes

intents = discord.Intents().all()

bot = commands.Bot(command_prefix='+', intents=intents)

@bot.event
async def on_ready():
    print(f'Le bot {bot.user.name} est prêt !')

# Charge la cog Commandes
bot.load_extension("commandes")

bot.run('TOKEN')```
#
import discord
from discord.ext import commands

class Commandes(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def addeleve(self, ctx, classe: str, nom_eleve: str):
        """Ajoute un élève à une classe spécifique."""
        # Code pour ajouter l'élève à la base de données et afficher un message de confirmation
        await ctx.send(f"{nom_eleve} a été ajouté à la classe {classe} avec succès !")

    @commands.command()
    async def listeclasses(self, ctx):
        """Affiche la liste des classes."""
        # Code pour afficher la liste des classes
        await ctx.send("Voici la liste des classes :\n- Classe 1\n- Classe 2\n- Classe 3")

    @commands.command()
    async def listeeleves(self, ctx, classe: str):
        """Affiche la liste des élèves d'une classe spécifique."""
        # Code pour afficher la liste des élèves d'une classe
        await ctx.send(f"Voici la liste des élèves de la classe {classe} :\n- Élève 1\n- Élève 2\n- Élève 3")

    @commands.command()
    async def supprimeleve(self, ctx, nom_eleve: str):
        """Supprime un élève de la base de données."""
        # Code pour supprimer l'élève de la base de données
        await ctx.send(f"{nom_eleve} a été supprimé de la base de données avec succès !")

#

@commands.command()
    async def menu(self, ctx):
        """Affiche le menu des commandes."""
        # Code pour afficher le menu des commandes
        embed = discord.Embed(title="Menu des commandes", description="Voici la liste des commandes disponibles :", color=0x00ff00)
        embed.add_field(name="+addeleve", value="Ajoute un élève à une classe spécifique", inline=False)
        embed.add_field(name="+listeclasses", value="Affiche la liste des classes", inline=False)
        embed.add_field(name="+listeeleves <classe>", value="Affiche la liste des élèves d'une classe spécifique", inline=False)
        embed.add_field(name="+supprimeleve <nom_eleve>", value="Supprime un élève de la base de données", inline=False)
        await ctx.send(embed=embed)

def setup(bot):
    bot.add_cog(Commandes(bot))
#

my error :

discord.ext.commands.errors.CommandNotFound: Command "menu" is not found```
#

or other commands

fast osprey
#

What library and version are you using?

slim bloom
#

For shards do you only need Autoshandebot or do you need to do something else?

hushed galleon
hushed galleon
slim bloom
hushed galleon
#

split your bot into multiple processes and coordinate their sharding so they each handle a subset of the guilds your bot is in

#

a database, message queue, or some other form of IPC may be necessary to make certain features of your bot work properly under that architecture
running those processes on separate computers might also help if you're starting to exceed the capabilities of a single system, but at that point you might want some orchestration software like kubernetes or whatev (tbh horizontal scaling is beyond my knowledge)

young dagger
shrewd apex
hushed galleon
hushed galleon
shrewd apex
#

does it haven't used sharding much at all would discord send requests to particular shards to which a guild is assigned which that particular bot shard would receive directly?

#

what happens if a particular shard is down does it get forwarded to some other shard?

hushed galleon
#

presumably if a shard goes down, you don't get to receive events from that subset of guilds

shrewd apex
#

i see ty 😄

#

this might be a bit interesting to test and play with I'll try it out this weekend

#

whats some common refactoring do u reckon sharded bots would require

young dagger
hushed galleon
young dagger
#

We just need to compare it with the latest message

hushed galleon
#

a different thing, if you're only handling on_message then you dont need to check that their message IDs are different

young dagger
#

That is actually true

hushed galleon
#

also wouldnt that mean mapping author ID to message ID is unnecessary?

#

just mapping channel ID to author ID would be enough to know if a new message is consecutive

#

well i guess message ID too for deletion

young dagger
hushed galleon
#

oh right, still need message to delete it

#

{channel ID: message obj} then, which is also kinda close to the built-in channel.last_message

#

though the latter is a bit less reliable since it uses the bot's message cache, capped to 1k messages by default

vapid parcel
#
    @commands.hybrid_command()
    @commands.guild_only()
    @app_commands.describe(emoji="Please give a discord Emoji.")
    async def clone(
        self, ctx: commands.Context, emoji: discord.PartialEmoji, name=None
    ):
        """
        Clone any emoji you would like from any server even if the bot isn't in the server!

        **Usage:** clone <emoji> [name]
        """

        view = discord.ui.View()
        button = discord.ui.Button(
            label="Download", style=discord.ButtonStyle.link, url=f"{emoji.url}"
        )
        view.add_item(button)

        if ctx.author.guild_permissions.manage_emojis:
            add_button = AddEmojiButton(
                emoji,
                ctx,
                name,
                label="Add To Server",
                style=discord.ButtonStyle.primary,
            )
            view.add_item(add_button)

        await ctx.send(emoji.url, view=view)```
#

How can you allow emoji to support links too..? but also support discord.PartialEmoji?

glad cradle
#

at least, that's what a "friend" of mine does for his bot

shrewd apex
#

sure that would be cool planning to write a bunch of guides once i figure out the stuff myself

#

send it in devconnect

nova vessel
#
message_lines.append(f"Game: {game_name}, Whitelisted: {whitelisted}, Discord Mention: {}, Discord ID: {discord_id}")

How can I place the user's mention using the user's Discord ID?

wanton current
#

<@id>

nova vessel
#

Was expecting some nautical line haha

wanton current
#

lol

vapid parcel
#

Is there a limit to how many apps can be in a team?

slate swan
#

this isnt tachinally related, but im curious can you not use emojis with weebhooks anymore? im trying to make a webhook with emojis. but it wont let me. seems like its not supported? any alternatives

#

i just made my own embed and when i do the emoji it just sends as the name. its in my serverf

#

how can i make it send emojis in webhook/embed builder?

slate swan
#

stupid asf

pale zenith
#

Guess you could make the webhook using your user account though

slate swan
#

discord always gotta remove some dope shit

pale zenith
#

I think they respect the crator's emoji list?

slate swan
#

i saw people use ticket bot for it, but i like to use my own bots

pale zenith
#

Idk tbh

#

Yeah that doesn't work anymore

#

They changed it like a few years ago

slate swan
#

idk if its stil <::>

pale zenith
#

Discord will remove the format if your bot doesn't have access to the emoji of course. That's what is going on currently. But the format has not changed.

slate swan
#

odd then. for me it doesnt work in embeds. for anything. although other servers are? im using their same bot too

#

not sure why discord gotta make my life so HARD

frail badger
#

Anyone know how to code a script so staff members can manage their shift?

fast osprey
#

"Staff members", "manage", and "shift" are all not discord native concepts that you'll have to define what they mean

subtle jolt
# unkempt canyon

This is however limited to 25 options or so, correct? Is there any way to bypass this or to have multiple select menus with a different set of 25 roles?

glad cradle
subtle jolt
glad cradle
#

that's the same for User select menus

copper flume
#

what could be the reason for sending 3 messages at a time on executing a command in a particular server?

#

Like if I use snipe command it replies thrices instead of once and it only happens with that particular server RARELY

#

same in case of welcomer, sometimes it sends 3 welcome message and sometimes 2 and sometimes 1

#

when the bot was newly added there it used to send welcome message thrice everytime but these days it has reduced and it only happens with that server and no other server.

upbeat otter
#

does this happen for every command and event

copper flume
upbeat otter
copper flume
#

no double hosting

upbeat otter
rain hedge
#

i don't know how to make one, but know the general idea of how it should look like

#

I reccomend using an already existing one like trident

upbeat otter
nova vessel
#
await interaction.guild.fetch_member(self.user_id).add_roles(await interaction.guild.get_role(1176333330095022101))

Would this work?

#

Instead of grabbing the user object and role object, storing them in variables, could I get the user objects when I invoke the add_roles command or would this not work?

wanton current
#

fwiw you can just give add_roles a abc.Snowflake created with a discord.Object instead

#

also get_role is not a coro

nova vessel
wanton current
#

it would error since you can't await a Role

nova vessel
#

ah

wanton current
#

It'd work otherwise (probably)

nova vessel
#

I've never really worked with the snowflake thing before.

wanton current
#

it's basically just the most slimmed down version of a discord object with only the id

undone arch
#

hi, im having problems with modals
it does what it's supposed to, but it still says "Something went wrong" for some reason

#

no errors either

#

do i js send my code here?

wanton current
#

you need to respond to the interaction in your on_submit

#

/ your modal callback

undone arch
#

oh

alpine kelp
#

guys quick question, how do i remove a specific option from a Select?

shrewd apex
#

then edit the message with the new view

slate swan
#

yo any1 that can tell me how hard this is to do dm for more info [ pls help]

wanton current
#

why dm

slate swan
wanton current
#

thanks for the clarification

slate swan
#

idk rlly

pale zenith
wanton current
#

leo definitely knows

pale zenith
#

You can just send here lol???

slate swan
#

ok

#

so like idk anything about python but im tryna make this bot its gonna like show ur yt data ur twitter data and like if u are in a like 1 of the cords: 1130674447691563098 949885234713874512 1164702469599809567 934502745799540806 878071596793868338 889555844532940821 1125049907665977344 950298999481577472 1079391058724655104 1130712939100393563 1176629172597162065 1127414115523104830 1005535080065806347 1020151586133114941 1174999989433405450 1233573788243988540 1187299258618085396 1236703778086981744 1191502660696817664 1191502660696817664 859302615547117629

so is that hard to make

pale zenith
slate swan
pale zenith
#

Then you can access it in your website's backend and store it somewhere.

slate swan
#

to ur discord right?

shrewd apex
#

only if u get access to it via appropriate oauth scopes

pale zenith
#

As stated before, you need to use oauth to access the linked accounts, not with a bot. It is impossible using only a bot.

slate swan
shrewd apex
#

meaning u need to make some form of discord dashboard prompting users to login

slate swan
#

data yk subs like tweets stuff like that

pale zenith
#

The way to get the linked accounts (connections)

slate swan
#

but like how hard is it bc idk anything about python

pale zenith
#

Not easy but probably not too hard, but it will require the knowledge of setting up a website to receive the oauth2 response

#

Also, that's off-topic for this channel, because it's not a discord bot.

wanton current
#

definitely difficult if you have no prior python knowledge

shrewd apex
#

i doubt he got the concept of what oauth is

slate swan
pale zenith
#

it would definitely require the knowledge of how to make a website so yeah, not easy lol

shrewd apex
slate swan
shrewd apex
#

disboard?

#

ever seen sites with option like "login with discord"?

slate swan
#

i dont use disboard y

shrewd apex
#

nvm

alpine kelp
slate swan
#

anyone knows how to do this with app_commands ?

#

the role selection thing

glad cradle
slate swan
#

how do i make certain roles be able to use .gen please someone help me

async def gen(ctx, amount):
    key_amt = range(int(amount))
    f = open("keys.txt", "a")
    show_key = ''
    for x in key_amt:
        key = str(uuid.uuid4())
        show_key += "\n" + key
        f.write(key)
        f.write("\n")

    if len(str(show_key)) == 37:
        show_key = show_key.replace('\n', '')
        await ctx.send(f"Key: {show_key}")
        return 0
    if len(str(show_key)) > 37:
        await ctx.send(f"Keys: {show_key}")
    else:
        await ctx.send("Somthings wrong")```
tired cradle
#

@slate swan Python

fast osprey
#

!d discord.ext.commands.has_any_role

unkempt canyonBOT
#

@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check) that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return `True`.

Similar to [`has_role()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.has_role), the names or IDs passed in must be exact.

This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingAnyRole) if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage) if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure).

Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingAnyRole) or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage) instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure)
slate swan
#

@glad cradle do you know if i can filter the roles in the selection ?

glad cradle
#

you can use an autocomplete for that but you'll provide roles names, not as fancy as this one

inner glade
karmic oriole
#

how can i convert this to a slash command, i dont know any other method of puring besides ctx.channel.purge

@commands.cooldown(1, 5, commands.BucketType.user)
@bot.command(aliases=get_config("purge_aliases"))
async def purge(ctx):
    allowed_roles_ids = [str(role_id) for role_id in get_config("allowed_purge_roles")]
    user_role_ids = [str(role.id) for role in ctx.author.roles]

    if any(role_id in allowed_roles_ids for role_id in user_role_ids):
        await ctx.channel.purge()
        await ctx.send(f"{ctx.author.display_name}, Messages purged!", delete_after=5)
    else:
        await ctx.send(f"{ctx.author.display_name}, You are NOT allowed to do that!", delete_after=5)
nova vessel
#

Is there a way to get the label assigned to a forum post?

fast osprey
#

The tags? Yes

blissful crane
karmic oriole
#

Oh

#

Thanks

vapid parcel
#

YouTube is the only streaming service/platform that is against Music bots correct..?

karmic oriole
#

using slash commands, how do i check if the user running the command has the manage messages commands?

vapid parcel
karmic oriole
vapid parcel
twilit grotto
#

otherwise you could always check ctx.author.guild_permissions

#

i think*

karmic oriole
vapid parcel
karmic oriole
vapid parcel
twilit grotto
vapid parcel
#

same way.

twilit grotto
#

interaction = ctx

karmic oriole
#

Oh

vapid parcel
twilit grotto
vapid parcel
#

No bro

karmic oriole
#

It don’t even work

vapid parcel
#

Just no

twilit grotto
#

ok egotard just keep saying no

#

aint even let me type my response

vapid parcel
#

Interaction and ctx are completely different...

They are for differen't thing. Can ctx do buttons? I don't think so. Interaction can. Ctx can't do half the things interaction can do.

twilit grotto
#

yes i understand that but i meant to say some people just name the parameter ctx even in slash commands

karmic oriole
#

ok so just how do i the error handeling myself i want to use an if statment to check for manage_messages=True

vapid parcel
karmic oriole
#

WHAT

twilit grotto
#

being a douche doesn't help him

vapid parcel
red palm
karmic oriole
red palm
#

sorry

karmic oriole
#

ONE COMMAND

red palm
#

my mind just went fr

karmic oriole
#

thats not what i want to do

red palm
#

oops @vapid parcel alr sent it

vapid parcel
#

@karmic oriole what are you using?

karmic oriole
#

wdym

vapid parcel
#

show me your command?

karmic oriole
#
@commands.cooldown(1, 5, commands.BucketType.user)
@bot.tree.command(name="purge", description="Purges messages from the channel.")
async def purge(interaction: discord.Interaction):  
    if check for command fr:
        await interaction.response.send_message("Channel purged", ephemeral=True)
        await interaction.channel.purge()
    else:
        await interaction.response.send_message(f"You are NOT allowed to do that!", ephemeral=True)
#

using an error handler would be like 2 lines longer and i dont know how to use those and dont care about learning em

red palm
# karmic oriole ```python @commands.cooldown(1, 5, commands.BucketType.user) @bot.tree.command(n...

dis is mine


    @commands.hybrid_command(name="purge", description="Purges a specified number of messages")
    @commands.guild_only()
    @commands.has_permissions(manage_messages=True)
    async def purge(self, ctx, amount: int, *, reason: str):
        if amount <= 0:
            embed = discord.Embed(
                title="Purge Error",
                description="Please specify a valid number of messages to purge (1 or more).",
                color=0xFF0000
            )
            await ctx.send(embed=embed, ephemeral=True)
            return
        elif amount > 100:
            embed = discord.Embed(
                title="Purge Error",
                description="You can only purge up to 100 messages at a time.",
                color=0xFF0000
            )
            await ctx.send(embed=embed, ephemeral=True)
            return

        try:
            await ctx.send(f"Purging {amount} messages...", ephemeral=True)

            deleted = await ctx.channel.purge(limit=amount)

            embed = discord.Embed(
                title="Purge Messages",
                description=f"Purged {len(deleted)} previous messages.",
                color=0x5865F2
            )
            embed.add_field(name="Reason", value=reason, inline=False)
            embed.set_footer(text=f"By: {ctx.author.display_name}", icon_url=ctx.author.avatar.url)

            await ctx.send(embed=embed)
        except Exception as e:
            await ctx.defer()
            await ctx.send(f"An error occurred: {e}")

vapid parcel
#
@commands.cooldown(1, 5, commands.BucketType.user)
@bot.tree.command(name="purge", description="Purges messages from the channel.")
async def purge(interaction: discord.Interaction):
    if interaction.user.has_guild_permissions(manage_messages=True):
        await interaction.response.send_message("Channel purged", ephemeral=True)
        await interaction.channel.purge()
    else:
        await interaction.response.send_message(f"You are NOT allowed to do that!", ephemeral=True)```
#

woah

#

boom

#

there you go

red palm
#

just use the @commands.has_permissions(manage_messages=True) decorator

karmic oriole
#

thankyou lol

red palm
#

ope

#

dang

vapid parcel
#

He could also use the decorator yes. But idk why he isn't shrug

red palm
karmic oriole
karmic oriole
# vapid parcel ```py @commands.cooldown(1, 5, commands.BucketType.user) @bot.tree.command(name=...

i broke it or som

Traceback (most recent call last):
  File "C:\Users\gabri\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 828, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\gabri\OneDrive\Documents\vscode\discordbot\discordbot.py", line 75, in purge
    if interaction.user.has_guild_permissions(manage_messages=True):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Member' object has no attribute 'has_guild_permissions'. Did you mean: 'guild_permissions'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\gabri\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\gabri\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gabri\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\app_commands\commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'purge' raised an exception: AttributeError: 'Member' object has no attribute 'has_guild_permissions'
vapid parcel
#

just put guild_permissions

#

maybe read the error.

red palm
karmic oriole
vapid parcel
#

simpler

karmic oriole
# vapid parcel just put guild_permissions

ok i read it this time

  File "c:\Users\gabri\OneDrive\Documents\vscode\discordbot\discordbot.py", line 75, in purge
    if interaction.user.guild_permissions(manage_messages=True):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Permissions' object is not callable

still dont know

vapid parcel
karmic oriole
vapid parcel
#
@commands.cooldown(1, 5, commands.BucketType.user)
@bot.tree.command(name="purge", description="Purges messages from the channel.")
async def purge(interaction: discord.Interaction):
    if interaction.user.guild_permissions.manage_messages:
        await interaction.response.send_message("Channel purged", ephemeral=True)
        await interaction.channel.purge()
    else:
        await interaction.response.send_message(f"You are NOT allowed to do that!", ephemeral=True)```
red palm
#

ITS BETTER AND ""simpler""

vapid parcel
#

try this ig

#

womp womp

slate swan
#

I love using decoraters.

karmic oriole
#

shutup desu

slate swan
#

I'm a decorator fanatic

vapid parcel
red palm
vapid parcel
#

Decorator wouldve been faster 😁

#

just saying shrug

red palm
#

Yep and simpler

#

but he doesnt like simpler things

vapid parcel
#

Gabriel in a nutshell ^

slate swan
vapid parcel
#

YouTube is the only streaming service/platform that is against Music bots correct..?

glad cradle
shrewd apex
#

everything except SoundCloud

upbeat otter
#

Don't use music bots overall

#

💀

#

Just get a subscription. You can listen along with others with superior audio quality and more control

slate swan
#

does anyone have a bot like this

slate swan
copper flume
#

bruh ok

slate swan
copper flume
#

special issue for the x server

limber jolt
#

Can I have some help In my post?

slate swan
patent hull
# slate swan

Please don't use AI to help, elaborate your answers yourself.

patent hull
naive briar
unkempt canyonBOT
#

10. Do not copy and paste answers from ChatGPT or similar AI tools.

vale wing
formal basin
#

Hello, I have an Anti-nuke system but it is spamming once the nuker is banned

if len(self.author_msg_times3[author_id]) > self.max_msg_per_window:
             key3 = f'antinuke:{message.guild.id}'
             exists = await self.check_exists(key3)
             if exists:
              await message.guild.ban(author, reason="nuking the server")
              embed = discord.Embed(title="User Banned", description=f"{author.mention} has been banned", color=discord.Color.blue())
              print(f"spam channel detected: {message.guild.id}")
              await message.delete()
              embed.add_field(name="Reason", value="Tried to Nuke the server")
              log = await self.bot.redis.get(f"logs:{str(message.guild.id)}")
              log2 = int(log)
              logging_channel = self.bot.get_channel(log2) or await self.bot.fetch_channel(log2)
              await logging_channel.send(embed=embed)
#

Its spamming the await logging_channel.send(embed=embed)

blissful crane
#

you'll need to show more code

wispy falcon
#

what can i add to the code to stop the spam?
because once i sent 'test', it started spamming and not sending it only once

blissful crane
wispy falcon
#

ohhhh

#

thanks

#

works thx

formal basin
wary jolt
#

Hey, I'm using discord.ffmpegpcmaudio to stream audio in a voice channel. Is there any way to figure out when the audio has stopped playing? Like an event or such?

pale zenith
#

!d discord.VoiceClient.play

#

Why is this showing the master branch docs? yert

wary jolt
#

thanks

polar hearth
#

hello

slim bloom
#

!d discord.VoiceClient.play

unkempt canyonBOT
#

play(source, *, after=None, application='audio', bitrate=128, fec=True, expected_packet_loss=0.15, bandwidth='full', signal_type='auto')```
Plays an [`AudioSource`](https://discordpy.readthedocs.io/en/latest/api.html#discord.AudioSource).

The finalizer, `after` is called after the source has been exhausted or an error occurred.

If an error happens while the audio player is running, the exception is caught and the audio player is then stopped. If no after callback is passed, any caught exception will be logged using the library logger.

Extra parameters may be passed to the internal opus encoder if a PCM based source is used. Otherwise, they are ignored.

Changed in version 2.0: Instead of writing to `sys.stderr`, the library’s logger is used.

Changed in version 2.4: Added encoder parameters as keyword arguments.
wary jolt
shrewd vapor
#

Hiii, anyone know how to remove this command ? The command is not anymore in my code and i have put a new command but the new don't display and the old don't delete

#

the command is deleted since 1 weeks

karmic oriole
#

it should just need to reinitialize, when it didnt work for me i just deleted and recreated the bot from discord developer page entirly

#

and make sure you have somthing like this

@bot.event
async def on_ready():
    print(f"Running as {bot.user.name}")
    try:
        synced = await bot.tree.sync()
        print(f"synced {len(synced)} command(s)")
    except Exception as e:
        print(e)
shrewd vapor
#

yes but i can't make a new bot when this one is on Taylor Swift France server

#

and i do that

@bot.event
async def setup_hook():
    await bot.add_cog(cog)```
#

i try to add the sync in my on_ready

#

i have forget that

karmic oriole
shrewd vapor
#

Now he don't found any command 😦

#

but the command work with the prefix

#

i know why

#

my fault

karmic oriole
#

lol

shrewd vapor
#

Ok everythings was just because i don't have put the correct arguments

#

thanks for the help

karmic oriole
#

ye no prob

#

just got active developer badge pog

young dagger
#

Any other ways to do it?

"Channel" + ("s" if len(channel_ids) > 1 else "")
wispy falcon
#

Im confused

round crater
karmic oriole
#
@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{client.guilds} servers"))

i am trying to display how many servers the discord bot is in, in google i found you can use client.guilds, the problem is that client isn't defined

Traceback (most recent call last):
  File "C:\Users\gabri\AppData\Local\Programs\Python\Python312\Lib\site-packages\discord\client.py", line 441, in _run_event 
    await coro(*args, **kwargs)
  File "c:\Users\gabri\OneDrive\Documents\vscode\discordbot\bot.py", line 13, in on_ready
    await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{client.guilds} servers"))
                                                                                                    ^^^^^^
NameError: name 'client' is not defined

i also need it to update every once in a while

mild token
#

You defined your client as bot so u need to use bot

karmic oriole
#

I’m making had to use len() for anyone who sees this and needs the same thing

finite apex
#

hello

#

i have a problem

#

😟

finite apex
short tinsel
#

yes

finite apex
#

@bot.command(name:"myid")
async def id_user(ctx, user: discord.Member):
   await ctx.send(user.id)
short tinsel
finite apex
#

this documentation is confusing

wispy falcon
#

How do I delete the bots own message?

fast osprey
#

Same way you delete any message, calling .delete() on it

wispy falcon
inner glade
wispy falcon
#

send

inner glade
#

parameter delete_after=<int>

#

ctx.send("Message response", delete_after=10)

wispy falcon
#

thanks

patent hull
inner glade
#

in a respond it would be different, but yeah prefixed commands are the same

blissful crane
patent hull
inner glade
#

Next thing you're going to tell me is there's one in ui.View 🤣

inner glade
#

lol

patent hull
#

like, if i didn't knew dpy internals

chilly cloud
#

yo guys, how do you have different profile pictures for yout bot across different discord servers?

blissful crane
#

Bots that do this don't just send an http request

chilly cloud
#

some server made a rip off bot, my bad

#

another question, whats the best option to host your discord bot?

fast osprey
#

entirely depends on what your needs are . discord bots aren't a single monolith that all behave the same way

chilly cloud
#

like what services are good for what purposes

fast osprey
#

Depends on what the bot is doing. What resources it requires

limber jolt
#

How do you install PM2?

chilly cloud
limber jolt
fast osprey
#

Do you know the resource usage of your bot? Primarily memory and cpu

chilly cloud
chilly cloud
limber jolt
patent hull
#

wasnt that a js module

chilly cloud
limber jolt
patent hull
#

if you know what that does why dont you just search how to install it

chilly cloud
limber jolt
patent hull
vapid parcel
#

Do embeds really not support discord.Files..?

patent hull
vapid parcel
#

How..?

chilly cloud
patent hull
# vapid parcel How..?
f = discord.File("some_file_path", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)```
Note that the filename in the File constructor and the filename in the URL must match, and must be alphanumeric.

*From the discord.py server*
vapid parcel
#

I am trying to set the file in the set_image but using discord.Files

limber jolt
#

But I live with my parents so no problem for me.

chilly cloud
vapid parcel
#

So basically the embed can't use it

chilly cloud
#

wait, can the bot run on someone elses pc if I send them a converted exe file?

patent hull
#

attachment://your_file_name.extension

patent hull
#

if they have the deps yeah

chilly cloud
#

oops caps

slim bloom
#

How can I use proxies with aiohttp?

wispy falcon
#

Makes sense

marble rampart
#

lets say i have a slash command in a cog (also a sub command) how would i be able to make it a normal command as well

slate swan
#

does anybody have a bot like this

formal basin
#

!paste

unkempt canyonBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

formal basin
#

Its spamming the await logging_channel.send(embed=embed)

fast osprey
#

How is someone adding channels "nuking" the server

timber dragon
#

someone with the manage channels permission*

formal basin
fast osprey
#

And if someone legitimately needs to make a couple of channels for an event or something and your bot randomly bans them out of nowhere?

blazing beacon
upbeat otter
#

wdym?

drowsy thunder
#

Him be like:
Anyone knows how to use insomnia to keep typing forever like NTTS and break discord ToS

limber jolt
#

Can I have some help In my post?

upbeat otter
limber jolt
upbeat otter
limber jolt
limber jolt
digital current
#

the links in this pin lead to a 404 ;-;

timber dragon
digital current
digital current
ashen crystal
#

Hi i'm on a adkynet server python and i have this error but everything is import somebody have a idea ?
CONSOLE:
ERROR: Could not find a version that satisfies the requirement json (from versions: none)
ERROR: No matching distribution found for json
WARNING: There was an error checking the latest version of pip.
Traceback (most recent call last):
File "/home/container/maine.py", line 4, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
container@pterodactyl~ Server marked as offline...
[AdKyNet SAS Daemon]: ---------- Detected server process in a crashed state! ----------
[AdKyNet SAS Daemon]: Exit code: 1
[AdKyNet SAS Daemon]: Out of memory: false
[AdKyNet SAS Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.

fast osprey
#

You don't have a discord library installed on this python installation

ashen crystal
#

i have install that the problems

fast osprey
#

How?

ashen crystal
#

in requirement file and with import because the file is on a server

fast osprey
#

Putting things in a requirements file doesn't do anything on its own

#

Unless something installs from that file, and then you run python from that same installation

ashen crystal
#

Additional Python packages
python-dotenv discord asyncio load_dotenv discord-ext-bot discord.gateway PyNaCl Numpy datetime json
Install additional python packages. Use spaces to separate

#

i have the same error with that

#

then i have change for requirement file

#

it was still working a few days ago without touching anything

fast osprey
#

Is this one of those shitty panels that doesn't actually let you hit the command line?

ashen crystal
#

its a free server because i dont have money i'm young

stuck hare
#

Does any one have a free nuke bot

fast osprey
#

There are student credits you can apply for

#

A host that doesn't let you access the command line is honestly just going to get in your way, good luck though

fast osprey
slim bloom
#

!d discord.Member.timeout

unkempt canyonBOT
#

await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta).

You must have [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members) to do this.

This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit).
upbeat otter
slim bloom
slim bloom
slate swan
unkempt canyonBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

#

The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.

young dagger
slate swan
#

!rule 1 :)

unkempt canyonBOT
languid jungle
#

!ban 1230851876929667143 30D You have to follow our rules if you wish to participate in our server. If you do rejoin the server after your ban is over, make sure you've read our rules carefully.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @stuck hare until <t:1719324347:f> (30 days).

slate swan
#

thanks vivek

slate swan
#

most likely that .timeout looks more obvious what it does when you read code after 1 year

#

but for example

#

if you were to change user nickname when he is timed out

#

you could use one line of code (.edit(nick="MUTED | ...", timed_out_until=...)) and not two (.edit(...); .timeout(...))

young dagger
#

So is not that await timeout was implemented later?