#discord-bots

1 messages · Page 296 of 1

slate swan
#

yeah, that makes no sense

finite sage
#

no its not

#

dumbass

onyx elk
finite sage
#

because you are dumb

onyx elk
slate swan
finite sage
finite sage
slate swan
#

So please stop asking questions about this project, we wont help with it

finite sage
#

no

slate swan
#

!rules

unkempt canyonBOT
#

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.

onyx elk
slate swan
onyx elk
finite sage
onyx elk
onyx elk
finite sage
onyx elk
slate swan
# finite sage no

Well if you wanna take the hard way
<@&831776746206265384> can you please apply some infraction

onyx elk
# finite sage what

Your underage… NO ONE and i mean NO ONE above 13 would say i dont care if you dont care

finite sage
#

you said "i dont care".... so? if you dont care, i wil still speak.

#

Because i dont care if you dont care

finite sage
slate swan
onyx elk
toxic meteor
#

L||ol||

slate swan
#

Anyways @onyx elk are you sure you invoke it on Member and not Message?

plain pollen
#

@finite sage that's no way to talk to people in this server, and we don't help with selfbots.

finite sage
#

it is bot

slate swan
onyx elk
#

oh shoot

#

i found it thanks for helping

slate swan
#

👍

plain pollen
# finite sage it is bot

The only reason you'd get that error is if your token isn't a valid bot token, i.e its either straight-up invalid, or is a user account token - and you also said above that its a selfbot

finite sage
#

haha

#

i dont know

#

that code is not wrong, i dont know why i get error. I use it 2 months ago and it work

mighty pilot
#

Well the error says wrong token. So whatever token you're using isn't correct according to discord

vocal snow
#

It's not, that's what the error says

#

Ok

mighty pilot
#

Idk why you're so adamant that it's correct when the error coming from discord says otherwise. Maybe because it's being pasted, the encoding isn't what the system expects so you have unknown characters

slate swan
#

If it would be correct you wouldnt get such error 🗿

finite sage
#

I don't know why you think I would come in and lie for no reason

slate swan
#

I dont know why you think library would raise exception when you provided valid token

mighty pilot
#

Ok, here is discord telling you your token is wrong. You came here for help man, stop acting like you're better than everyone when you're here troubleshooting some code you copied and pasted

slate swan
#

Cause its incoreect

finite sage
#

That is why I made the post

meager chasm
#

That's a user account

#

And we don't help with selfbots

slate swan
mighty pilot
#

And that's why it's an improper token. User accounts aren't supported.

slate swan
#

So you just admitted 4th time its self bot

mighty pilot
#

Use a PROPER token and it'll work

slate swan
#

While saying its not

finite sage
meager chasm
#

And you've been told that we don't help with selfbots 10 times as well

finite sage
#

It is not selfbot

slate swan
#

!rule 5

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.

glad cradle
#

i mean this should come to an end <@&831776746206265384>

mighty pilot
slate swan
#

Please dont ask questions about this project anymore

finite sage
#

It is not illegal

slate swan
mighty pilot
#

Still against rules

finite sage
#

and it is not selfbot, stop lying or I will report you for defamation

finite sage
glad cradle
meager chasm
#

It's just another script kiddy lmao

finite sage
velvet compass
#

!shh

unkempt canyonBOT
#

✅ silenced current channel for 4 minute(s).

velvet compass
#

!warn 915149040931463218 We will not help with self bots. You have been told this previously. Using your user token to automate your account is selfbotting, which is bannable both here and by Discord

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @finite sage.

velvet compass
#

Now lets get back on track

#

!unshh

unkempt canyonBOT
#

✅ unsilenced current channel.

mighty pilot
#

🙏

honest shoal
#

can I use channel.edit for renaming threads? (in disnake)

west escarp
#

yes

slate swan
#

!d disnake.Thread.edit

unkempt canyonBOT
#

await edit(*, name=..., archived=..., locked=..., invitable=..., slowmode_delay=..., auto_archive_duration=..., pinned=..., flags=..., applied_tags=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the thread.

Editing the thread requires [`Permissions.manage_threads`](https://docs.disnake.dev/en/latest/api/permissions.html#disnake.Permissions.manage_threads). The thread creator can also edit `name`, `archived`, `auto_archive_duration` and `applied_tags`. Note that if the thread is locked then only those with [`Permissions.manage_threads`](https://docs.disnake.dev/en/latest/api/permissions.html#disnake.Permissions.manage_threads) can unarchive a thread.

The thread must be unarchived to be edited.
slate swan
#

Pass name ^

honest shoal
#

thanks!

slate swan
#

👍

finite sage
#

All these in this channel are dumb

mighty pilot
#

Dude just drop it

finite sage
#

What

plain pollen
#

Either you're pasting the wrong thing in as the token, or you're lying about not trying to run a selfbot
Where are you getting the token from?

plain pollen
#

which console?

finite sage
#

The application tab

#

when you click Ctrl + shift + I

mighty pilot
finite sage
#

no that is for bot

plain pollen
#

from within the discord app itself? that's going to be your user token, which bots don't work with

velvet compass
mighty pilot
#

That's why you're having problems. You're trying to use a bot without a bot token.

velvet compass
#

If you are not using a bot account, you are self botting

finite sage
#

The token is that one for my account

#

not the BOT

velvet compass
#

That is the definition of self botting

finite sage
#

Why I did not break the rules

buoyant quail
#

Automating normal user accounts (generally called "self-bots") outside of the OAuth2/bot API is forbidden, and can result in an account termination if found.

finite sage
velvet compass
#

!ban 915149040931463218 seeking help for self botting

mighty pilot
#

They won't find out because you can't run your code

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @finite sage permanently.

mighty pilot
#

Finally

buoyant quail
#

lmao

honest shoal
#

its not working, im not sure if Im doing anything wrong

buoyant quail
#

I robbed the bank but no one will know that i did it, so i didn't break any rules

slate swan
lyric sigil
#

How can my bot send a dm after a slash command ?

slate swan
unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File) objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list) of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed) objects. **Specifying both parameters will lead to an exception**.
slate swan
#

!d discord.Interaction.user

unkempt canyonBOT
onyx elk
#

YO I GOT AN EMAIL SAYING IM OFFICIALLY UNBANNED FROM DISCORD DEVELOPER BADGE LETS GO

lyric sigil
# unkempt canyon

error : ``` await user.send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)
SyntaxError: iterable argument unpacking follows keyword argument unpacking

slate swan
lyric sigil
#

oh

slate swan
#

Its only there to show you what arguments it takes

lyric sigil
#

so what do i need to write in my code if its not that

#

that was my question

#

or i will reformulate it

slate swan
#

You use .send method on User you want to message

lyric sigil
#

i have a mute slash command and i want my bot to send a dm to the persons mentioned in the mute command

onyx elk
#

await interaction.member.send(embed=embed)

#

@lyric sigil

#

u dont gotta do embed

#

it may not work if u have member differently although idk why u would

slate swan
#

Its interaction.user

onyx elk
slate swan
onyx elk
#

oh

lyric sigil
onyx elk
slate swan
onyx elk
lyric sigil
slate swan
onyx elk
slate swan
#

No such thing

onyx elk
#

weird

#

blud said Nah.

slate swan
#

Not even in disnake

lyric sigil
lyric sigil
#
@client.tree.command(name="mute", description="add role 'mute' to someone")
async def mute(ctx, member: discord.Member):
    # Rôle "Muted"
    muted_role = discord.utils.get(ctx.guild.roles, name="Muted")
    newbie = discord.utils.get(ctx.guild.roles, name="Newbie")
    if not muted_role:
        muted_role = await ctx.guild.create_role(name="Muted")
        # Apply Restriction
        permissions = discord.Permissions(send_messages=False, speak=False)
        await muted_role.edit(permissions=permissions)
    # Add "Muted" to member
    await member.add_roles(muted_role)
    print((f"{member.mention} Has been Muted."))
    discord_channel=1139570394089660470
    channel = client.get_channel(discord_channel)
    await ctx.user.member.send("Test")(content=None)
    await channel.send("User Muted :white_check_mark:")
    await member.remove_roles(newbie)
onyx elk
mighty pilot
#

It makes sense. You have to be in guild to use interaction so there doesn't need to be any distinction

slate swan
#

Like i said its .user only

lyric sigil
slate swan
lyric sigil
#

nah

#

lokk i only def ctx

#

not interaction; discord.Interaction

slate swan
#

If you name a varriable ctx doesnt make it Context

#

Slash commands use Interactions

lyric sigil
#

ik but this one works with ctx

slate swan
#

So your ctx varriable is actually an Interaction

lyric sigil
#

yes but since interaction not defined that won't work

slate swan
#

?

mighty pilot
#

Didn't you originally ask how to send a message to a user after using a slash command

lyric sigil
#

hold on

slate swan
#

..

#

No they dont

lyric sigil
#
@client.tree.command(name="commands")
async def commands(interaction: discord.Interaction):
    embed=discord.Embed(title="IG-Commands", description="/sethome homename (sets an home) \n \n /home homename (teleports you to your home) \n \n /hub (teleports you to the hub)")
    await interaction.response.defer()
    await interaction.response.send_message(embed=embed)
slate swan
#

Just print out type(ctx)

lyric sigil
#

this one use interaction

mighty pilot
#

I see that you put ctx at the top, but you still need an interaction because that's what a slash command is

onyx elk
# lyric sigil yes but my slash command use ctx
@client.tree.command(name="mute", description="add role 'mute' to someone")
async def mute(interaction: discord.Interaction, member: discord.Member):
    # Role "Muted"
    muted_role = discord.utils.get(interaction.guild.roles, name="Muted")
    newbie = discord.utils.get(interaction.guild.roles, name="Newbie")
    if not muted_role:
        # Create the "Muted" role with necessary permissions
        muted_role = await interaction.guild.create_role(name="Muted", permissions=discord.Permissions(send_messages=False, speak=False))

        # Apply the "Muted" role to the default text channels (optional)
        for channel in interaction.guild.text_channels:
            await channel.set_permissions(muted_role, send_messages=False)

    # Add the "Muted" role to the member
    await member.add_roles(muted_role)
    print(f"{member.mention} has been muted.")

    # Send a DM to the muted user
    embed = discord.Embed(title="You have been Muted", description="You have been muted in the server.")
    await interaction.user.send(embed=embed)

    # Send a message using interaction response
    response_embed = discord.Embed(title="User Muted", description=f"{member.mention} has been muted :white_check_mark:")
    await interaction.response.send_message(embed=response_embed)

    # Remove the "Newbie" role (optional)
    await member.remove_roles(newbie)
slate swan
slate swan
lyric sigil
#

and i didnt ask for but thx

onyx elk
slate swan
lyric sigil
#

Nah

slate swan
#

No matter if you changed 2 lines or 20

lyric sigil
#

no way that's working

onyx elk
mighty pilot
#

It's almost like he used interaction instead of ctx

#

I love it

lyric sigil
lyric sigil
#

that i showed you in DM

slate swan
#

My discord bot is not showing me correct stats. What should I do?

onyx elk
#

send the code

onyx elk
turbid condor
#

You have members intent enabled?

meager rock
severe sonnet
#

okay guys

#

i discovered that there are two different ids that don't matches

slate swan
#

client => your bot, you probably don't want your bot's ID

naive briar
severe sonnet
#

i want user id

#

like who sent the interaction

slate swan
#

So author ID is, as you've guessed - the other one

severe sonnet
slate swan
#

Why bot

#

Forget about bot, forget about client

severe sonnet
#

oh okay

slate swan
#

where do you see self.bot.author.id in that message

severe sonnet
#

okay so since in my case i'm in an app_command

#

i need an alternative way to grab user id

#

like, there is no context

#

so there is discord.Interaction

#

so i don't know how to grab in a slash command without nexting

#

*nesting

#
@_character_default.app_command.command(name = "image_set_by_prompt",)
    async def _character_default_image_set_by_prompt_slash(self, ctx: discord.Interaction, prompt: str, image1: discord.Attachment | None, image2: str | None):
        user = discord.Interaction
        url = image1.url if image1 else image2

        result = await self.client.database.quick_search_default_character(user_id=user, prompt_prefix=prompt, new_image=url)

        if result is None:
            await ctx.response.send_message(f"you have no characters with prompt {prompt}")
        else:
            await ctx.response.send_message(f"image set to {url}")
#

i'm trying to grab user id here

onyx elk
#

what game is this for

severe sonnet
#

that's a roleplay character

#

it's a super tool for discord roleplay servers

#

roleplay super tool

#

i'm trying to grab the member user id

onyx elk
naive briar
naive briar
unkempt canyonBOT
onyx elk
naive briar
#

And so do everyone else

#

Maybe even me

meager rock
unkempt canyonBOT
mighty pilot
#

Most people name their discord.Interaction 'interaction' to make life easier for everyone

radiant shuttle
#

can i use google sheets as database for example saving name of users and a amount os money for example?

quick brook
#

You will run into rate limiting issues, data corruption, etc etc

#

Use an proper DB such as SQLite or Postgres

#

General choices for SQL databases:
sqlite- a liteweight SQL variant, single file, no server. Lacks some features. The choice of driver for this is asqlite
postgresql - Standard-weight SQL server, very capable, good sql lib. The choice of driver is asyncpg

GitHub

A simple async wrapper for sqlite3. Contribute to Rapptz/asqlite development by creating an account on GitHub.

GitHub

A fast PostgreSQL Database Client Library for Python/asyncio. - GitHub - MagicStack/asyncpg: A fast PostgreSQL Database Client Library for Python/asyncio.

severe sonnet
#

!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.

slate swan
#

@meager rock @onyx elk

meager rock
#

yea?

quick brook
severe sonnet
#

okay so how do i check if the author is a webhook?

meager rock
unkempt canyonBOT
#
NEGATORY.

No documentation found for the requested symbol.

tall temple
#

what's the function to revoke someone's timeout ? (i coulnd't find in the docs and sof)

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).
quick brook
#

Just set the timeout until to none

tall temple
#

oh ok thanks

slate swan
#

until (Optional[Union[datetime.timedelta, datetime.datetime]]) – If this is a datetime.timedelta then it represents the amount of time the member should be timed out for. If this is a datetime.datetime then it’s when the member’s timeout should expire.** If None is passed then the timeout is removed.** Note that the API only allows for timeouts up to 28 days.

tall temple
#

i didn't see sorry

#

tysm

severe sonnet
#

okay guys how do i grab by code the message response?

#

i'm planning this for responding to a person, edit a webhook message or switch webhook name by erasing it and re-writing the message inside an embed

#

maybe i also need to grab description from embed

severe sonnet
#

now my bot won't grab webhooks

tall temple
#
Traceback (most recent call last):
  File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
  File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 982, in _invoke
    await self.callback(ctx, **kwargs)
  File "c:\Users\Medra\Desktop\kalker\main.py", line 384, in memberinfos
    if member.joined_at == None :
AttributeError: 'User' object has no attribute 'joined_at'

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

Traceback (most recent call last):
  File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\Medra\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'User' object has no attribute 'joined_at'```
quick brook
tall temple
final iron
#

It's impossible for a user to have joined_at

tall temple
#

oh ok my bad

final iron
#

Why is your User object called member

tall temple
#

let's use if statement to check if he's in the members list

slate swan
#

Just check if its type is Member?

tall temple
final iron
#

huh

#

It's the same speed

tall temple
#

now i'm trynna speed the process up to open this project

slate swan
#

Reason to use github

tall temple
severe sonnet
#

i'm planning to do this

severe sonnet
#

!discord.Message.interaction

#

!d discord.Message.interaction

unkempt canyonBOT
slate swan
unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

severe sonnet
#

thought

#

how do i manipulate this i don't know

#

but i'm not memeing, you really helped me

zealous lance
#

im trying to fix my code but idk why it wont send the embeds to the channels in that file

                    embed = discord.Embed(title=game['title'], description="", color=discord.Color.blue())
                    embed.add_field(name='', value=description, inline=False)
                    embed.add_field(name='', value="", inline=False)
                    embed.add_field(name='Price:', value=price_text, inline=False)
                    embed.add_field(name='', value="", inline=False)
                    embed.add_field(name='Expires:', value=timestamp_format, inline=False)
                    embed.add_field(name='', value="", inline=False)
                    embed.set_image(url=game['keyImages'][0]['url'])
                    embed.add_field(name='** **', value=f"** **", inline=False)
                    embed.add_field(name='** **', value=f'[Support](https://discord) **-** [Add Me](https://discord.com/api/oauth2/authorize?s) **-** [Donate](h)', inline=False)
                    with open('epicenable.txt', 'r') as file:
                        channel_ids = file.read().splitlines()
                    for channel_id in channel_ids:
                        channel = bot.get_channel(int(channel_id))
                        if channel:
                            try:
                                await channel.send(embed=embed, view=epic)
                            except Exception as e:
                                print(f"Error sending message to channel {channel_id}: {e}")
    except Exception as e:
        print(f"Error fetching data from Epic Games Store API: {e}") ```
#

no errors

slate swan
severe sonnet
#

this one is confuse

#

MessageReference.cached_message

eager mural
#

hello can you help me ? ```py
import discord

from discord.ext import commands

class serverinfo(commands.Cog):
def init(self, bot: commands.Bot) -> None:
self.bot = bot

@commands.Cog.listener()        
async def on_ready(self) -> None:
    print("commande serveur info charger [2]")

@commands.command()
async def serverinfo(self, ctx: commands.Context) -> None:
    boost_count = guild.premium_subscription_count
    boost_level = guild.premium_subscription_level
    channel_count = len(ctx.guild.text_channels)
    vocal_channels = [channel for channel in ctx.guild.channels if isinstance(channel, discord.VoiceChannel)]
    vocal_count = len(vocal_channels)
    guild = ctx.guild
    embed = discord.Embed(title=f"serverinfo", description="voici les information du serveur", color=0xffffff)
    embed.add_field(name=f"Nom du serveur", value=f"{guild.name}", inline=False)
    embed.add_field(name="Membre", value=f"{guild.member_count}", inline=True)
    embed.add_field(name="ID du serveur", value=f"{guild.id}", inline=True)
    embed.add_field(name="Nombre de channel", value=f"{channel_count}", inline=True)
    embed.add_field(name="nombre de vocal", value=f"{vocal_count}", inline=False)
    embed.add_field(name="Nombre de boost", value=f"{boost_count}", inline=False)
    embed.add_field(name="Level du serveur", value=f"{boost_level}", inline=False)
    embed.set_footer(text=f"by Space")
    
    await ctx.channel.send(embed=embed)

async def setup(bot: commands.Bot):
await bot.add_cog(serverinfo(bot))```

#

when I do +serverinfo laf command does not display anything on the terminal or on the channel

wanton current
severe sonnet
#

i think you forgot the ctx in guild @eager mural

#

cus boost_count and boost_level don't have much association

eager mural
#

no

severe sonnet
#

what is guild then?

eager mural
#

oh sry

severe sonnet
#

it's suppose to be ctx.guild

eager mural
#

can you modify my code?

#

?

severe sonnet
#
import discord

from discord.ext import commands


class serverinfo(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
 
    @commands.Cog.listener()        
    async def on_ready(self) -> None:
        print("commande serveur info charger [2]")

    @commands.command()
    async def serverinfo(self, ctx: commands.Context) -> None:
        boost_count = ctx.guild.premium_subscription_count
        boost_level = ctx.guild.premium_subscription_level
        channel_count = len(ctx.guild.text_channels)
        vocal_channels = [channel for channel in ctx.guild.channels if isinstance(channel, discord.VoiceChannel)]
        vocal_count = len(vocal_channels)
        guild = ctx.guild
        embed = discord.Embed(title=f"serverinfo", description="voici les information du serveur", color=0xffffff)
        embed.add_field(name=f"Nom du serveur", value=f"{guild.name}", inline=False)
        embed.add_field(name="Membre", value=f"{guild.member_count}", inline=True)
        embed.add_field(name="ID du serveur", value=f"{guild.id}", inline=True)
        embed.add_field(name="Nombre de channel", value=f"{channel_count}", inline=True)
        embed.add_field(name="nombre de vocal", value=f"{vocal_count}", inline=False)
        embed.add_field(name="Nombre de boost", value=f"{boost_count}", inline=False)
        embed.add_field(name="Level du serveur", value=f"{boost_level}", inline=False)
        embed.set_footer(text=f"by Space")
        
        await ctx.channel.send(embed=embed)


async def setup(bot: commands.Bot):
    await bot.add_cog(serverinfo(bot))
#

@eager mural there

eager mural
#

okk

#

still not

#

@severe sonnet

severe sonnet
#

okay, that is strange

eager mural
#

do you know the error?

severe sonnet
#

with my limited knowlege no

eager mural
#

okk

severe sonnet
#

thought i need help with MessageReference

#

i have the object but i don't know how to manipulate it

#

i have thi

#

*this

#

but i want is to grab the message content

#

like user name, ping and message

eager mural
#

the basic code works just when I add the guild boost etc.

slate swan
#

embed = discord.Embed(
title="title",
description=text

#

how do i make an text under "test"

#

I see no test here

slate swan
quick brook
slate swan
river plank
#

So, I have a issue where i have an embed with button code which works alright when I used in replit but when i switched it into a technically faster host, the same code doesnt work. it sends the embed and the button but whenever its clicked gives me the unknown interaction error
https://paste.pythondiscord.com/XYTQ

formal basin
#

how can I use auto mod in my bot

quick brook
#

did you not read the docs?

formal basin
formal basin
quick brook
quick brook
#

that's not how it works

formal basin
quick brook
formal basin
quick brook
formal basin
#

yeah

cloud dawn
quick brook
cloud dawn
#

So you're saying that classes aren't objects?

quick brook
cloud dawn
#

Well this isn't Java.

quick brook
quick brook
#

a class is a blueprint, and an object/instance is that class running in memory

quick brook
#

now within your guild, you can create automod rules

river plank
#

should i put it outside

formal basin
quick brook
quick brook
formal basin
#
@bot.event
async def on_automod_(rtd):
#

like this

buoyant quail
#

xdd

quick brook
#

lol rtd stands for read the docs

river plank
#

😭

formal basin
#

oh

quick brook
#

that's the actual term btw

river plank
quick brook
#

and there is no need to delay the command by 30 seconds

#
Name, Type, Image, Number, Logo, CarImage, Series, Max, Game = RandomALL()
RType, Style, Icon = GenRarity()

What the hell are even these variable names?

#

pep8 pep8 my dude

torn arch
#

!d discord.User

river plank
quick brook
gray junco
#

Can someone explain how voice connection works

#

I read the docs but i dont understand

river plank
#

i know my bot is shittingly messy

cloud dawn
quick brook
#

ok

gray junco
# cloud dawn What have you got so far?

Join vc channel command

@bot.slash_command()

error async def join(interaction: Interaction):
if interaction.user.voice:
channel = interaction.user.voice.channel
await channel.connect()
else:
await interaction.response.send_message("You are not in a voice channel")
print(f"I joined: {interaction.user.voice}")

#

The spot where error is is a error

#

Idk why

glad cradle
#

maybe share the error

shrewd apex
#

imagine if its actually
error async def in code

glad cradle
shrewd apex
#

3.14 reveal

gray junco
glad cradle
#

bro lives in 3000

gray junco
#

Whats this 😭 i fixed old error

meager rock
glad cradle
#

pip install -U "discord[voice]"

iirc

meager rock
gray junco
glad cradle
glad cradle
shrewd apex
#

i use zsh

meager rock
glad cradle
#

i use fish

meager rock
#

normally you can simply use discord.py[voice] but it would error out in zsh

glad cradle
#

iirc it error out in fish too

meager rock
#

maybe, yet to try fish

glad cradle
#

it's good

gray junco
#

@torpid dew

glad cradle
#

yeah it's discord.ext.commands.Bot

gray junco
#

Ok

#

@rocky grail when i remove commands it shows same but with Bot

slate swan
#

print this to console discord.__version__

gray junco
#

It printed 2.3.2

#

@slate swan

slate swan
gray junco
slate swan
#

Nope its python script

gray junco
#

Ok

gray junco
slate swan
#

its to run only once

gray junco
#

It think snipy ruined my code

meager rock
glad cradle
glad cradle
#

yeah

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client) you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin) to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
gray junco
glad cradle
#

command_prefix is required

meager rock
glad cradle
#

intents too

gray junco
#

Im just a starter sorry for many questions

glad cradle
#

so you don't know how to pass parameters to functions and classes

gray junco
#

Whats that

meager rock
unkempt canyonBOT
#
Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.

gray junco
#

Ok

#

Ty

#

What if i use

#

Slash cmd?

meager rock
# unkempt canyon

concern why is this example still using command_prefix as a kwarg lol, some linters might get angry

meager rock
#

it will ask you only for intents

gray junco
#

Ok

gray junco
#

!d discord.Client

unkempt canyonBOT
#

class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.

async with x Asynchronously initialises the client and automatically cleans up.

New in version 2.0.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client).
glad cradle
#

i mean you have it already

gray junco
glad cradle
#

you just need to use it

gray junco
#

Is this good?

glad cradle
#

no

#

bot is not defined, also aclient_command doesn't exist

#

and why are you waiting the client to be ready in the on ready?

gray junco
#

Bro my brain isnt braining anymore

polar dawn
#

there's a lot of mistakes in your code

gray junco
polar dawn
#

why use aclient_command

gray junco
#

Idk

polar dawn
#

it is undefined

#

unless you define what is it

polar dawn
glad cradle
gray junco
#

Thats all i need and i can fix other stuff

glad cradle
polar dawn
#

ngl you should learn a bit of python first

glad cradle
polar dawn
#

bot = commands.Bot(command_prefix="!", intents=intents)

polar dawn
gray junco
#

Server guild id or user?

torpid dew
glad cradle
real oriole
#

guys

#

i have a script but the commands doesntshow when i run it

mighty pilot
real oriole
#

how?

mighty pilot
#

Is it too large to type here?

real oriole
#

yep

mighty pilot
#

!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.

real oriole
#

its like 220 line

#

@mighty pilot i pasted it there what now?

mighty pilot
real oriole
#

@mighty pilot

#

i hope somebody helps me and i make it today

mighty pilot
#

None of your commands are slash commands they're text commands

#

Are you saying they don't show anything when you use them?

real oriole
#

like

#

i run it and type / i dont see the bot commands

#

how do i make them slash commands

mighty pilot
#

Because they aren't slash commands

real oriole
#

how do i make them ones

#

can you help?

mighty pilot
#

Bot.tree.command() and interactions

real oriole
#

the first one only?

#

where do i add thewm

#

sry im a bit new to bots

mighty pilot
#

Look at the last block of code there where it starts with @bot.tree.command()

real oriole
#

that?

#

bot/exts/utilities/rfc.py

#

uh

#

omg

#

ive been trying to do it for 1-2 monthz

#

😭

mighty pilot
#

Here's some other good examples

real oriole
#

can you make it on that script i sent and stream for me

#

its a bit confusing

mighty pilot
#

I'm not going to make it for you

real oriole
#

ok

mighty pilot
real oriole
#

done

#

wait

#

thats what happened when i added the slash cmd

mighty pilot
#

Did you read it

real oriole
#

yep

#

but i didnt really understand the problem

mighty pilot
#

It's expecting an indented block

    Like
        This```
real oriole
#

u mean the spaces?

mighty pilot
#

4 spaces is one indent

naive briar
#

Python always expected functions to have something in it

real oriole
#

k

naive briar
#

(comments don't count)

real oriole
real oriole
#

thats good right?

naive briar
#

!e

def a_function():

@a_deco()
def another_function(): ...
unkempt canyonBOT
#

@naive briar :x: Your 3.11 eval job has completed with return code 1.

001 |   File "/home/main.py", line 3
002 |     @a_deco()
003 |     ^
004 | IndentationError: expected an indented block after function definition on line 1
real oriole
#

now its like this

#

the first one is now line 90 instead of 94

#

i added function

naive briar
#

Same error, same solution

real oriole
#

i added

naive briar
#

Look for an empty function at the line the error says, and add something to it

real oriole
#

ok fixed that

#

xd

#

but new error

#

@naive briar @mighty pilot can u also help me solve this xd

naive briar
#

Just wait for someone to answer

real oriole
#

ok

mighty pilot
#

Are you using disnake?

real oriole
#

no

#

replit

mighty pilot
#

Which discord are you importing

real oriole
#

ppy

mighty pilot
#

I've only used discord.py so anything aside from that I'm unfamiliar with. It's saying line 2 , that location doesn't exist that you're trying to import

real oriole
#

its .py

#

not ppy

#

i missclicked

mighty pilot
#

I understand the language is python

real oriole
#

should i try that:
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_option

shrewd apex
naive briar
#

!d discord.interactions.Interaction

unkempt canyonBOT
#

class discord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
shrewd apex
#

what are you even trying to do?

naive briar
#

It does ducky_sphere

#

But not as an extension module, that's for sure

real oriole
shrewd apex
mighty pilot
shrewd apex
#

ic

real oriole
#

ye

mighty pilot
#

Doesn't fully understand what's going on so at this point it's hitting run and finding the next error

real oriole
#

lol

#

I MADE IT

#

IT WORKED

severe sonnet
#

okay guys, how do tupperbox have the user who sent the tupper stored?

#

i need that for when a person needs to edit a webhook message

#

i don't know how tupperbox keep track of who sent the webhook

#

through the bot

mighty pilot
#

That sounds like a question for the devs of that bot

severe sonnet
#

unless i store their message ID

#

like a log

#

so peoples can edit the message related wqebhook

#

*webhook

gray junco
#

Can anyone help me

exotic island
tepid dagger
#

whats the method for creating a channel

tepid dagger
# gray junco Can anyone help me

can you show the code, but that should mean that there's no mines command or you didn't create it properly (correct me if im wrong)

glad cradle
unkempt canyonBOT
#
await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel) for the guild.

Note that you must have [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels) to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict) of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role)) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite) as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit) will be required to update the position of the channel in the channel list...
tepid dagger
#

how do you define a guild again

glad cradle
#

you either get it with an api request or using the Context or Interaction objects

tepid dagger
#

how do you do it with interaction

glad cradle
#

!d discord.Interaction.guild

unkempt canyonBOT
tepid dagger
#

so its just

guild = interaction.guild
```?
glad cradle
#

yep

polar dawn
gray junco
#

@glad cradle how do i make the bot join VC

glad cradle
unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>, self_deaf=False, self_mute=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceClient) to establish your connection to the voice server.

This requires [`voice_states`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.voice_states).
gray junco
gray junco
mighty pilot
#

so my bot can create a guild? that makes the bot the guild owner? even though you cant manually transfer leadership to a bot account

glad cradle
gray junco
glad cradle
mighty pilot
#

guess im gonna try it out and see what happens lol

glad cradle
# gray junco So is discord.Voiceconnect for the bot to join a random voice channel or the voi...

no, VoiceChannel is the python representation of a discord voice channel, using a specific object and calling the .connect method you can join and connect to it

i suggest to learn python OOP before trying to build a Bot https://realpython.com/python3-object-oriented-programming/

In this tutorial, you'll learn all about object-oriented programming (OOP) in Python. You'll learn the basics of the OOP paradigm and cover concepts like classes and inheritance. You'll also see to how instantiate an object from a class.

mighty pilot
exotic island
mighty pilot
#

or the code inside the link

glad cradle
#

oh what you're referring to is a guild template link yep

gray junco
glad cradle
#

sigh, you don't define it, you get it in a command

#

the library creates it and pass it as a command argument

eager mural
#

wtf

cold sonnet
#

!d discord.Embed.set_thumbnail

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing `None` removes the thumbnail.
cold sonnet
#

my man

eager mural
#

ty

cold sonnet
#

it doesn't work like that at all

eager mural
#

!d discord.Guild.icon

unkempt canyonBOT
eager mural
#

embed.set_thumbnail(url=guild.icon)

cold sonnet
#

guild.icon.url

eager mural
#

aaaa

#

Always not

#

Do you want my full code?

cold sonnet
#

yes

eager mural
#
import discord

from discord.ext import commands


class serverinfo(commands.Cog):
    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot
 
    @commands.Cog.listener()        
    async def on_ready(self) -> None:
        print("commande serveur info charger [2]")

    @commands.command()
    async def serverinfo(self, ctx: commands.Context) -> None:
        guild_icon = ctx.guild_icon.url
        boost_count = ctx.guild.premium_subscription_count
        boost_level = ctx.guild.premium_tier
        channel_count = len(ctx.guild.text_channels)
        vocal_channels = [channel for channel in ctx.guild.channels if isinstance(channel, discord.VoiceChannel)]
        vocal_count = len(vocal_channels)
        guild = ctx.guild
        embed = discord.Embed(title=f"serverinfo", description="voici les information du serveur", color=0xffffff)
        embed.add_field(name=f"Nom du serveur", value=f"{guild.name}", inline=False)
        embed.add_field(name="Membre", value=f"{guild.member_count}", inline=True)
        embed.add_field(name="ID du serveur", value=f"{guild.id}", inline=True)
        embed.add_field(name="Nombre de channel", value=f"{channel_count}", inline=True)
        embed.add_field(name="Nombre de vocal", value=f"{vocal_count}", inline=True)
        embed.add_field(name="Nombre de boost", value=f"{boost_count}", inline=True)
        embed.add_field(name="Level du serveur", value=f"{boost_level}", inline=True)
        embed.set_thumbnail(url=guild.icon.url)
        embed.set_footer(text=f"by Space")
        
        await ctx.channel.send(embed=embed)


async def setup(bot: commands.Bot):
    await bot.add_cog(serverinfo(bot))```
cold sonnet
#

you did _ instead of . there

#

oh you didn't use that var

eager mural
#

Can you correct it?

cold sonnet
#

looks good to me

eager mural
#

a

#

h

cold sonnet
#

so you don't get an error?

#

and nothing happens

eager mural
#

I have no error and nothing appears

cold sonnet
#

do you have an error handler

#

like an on_command_error

glad cradle
#

ctx.guild_icon.url ?

cold sonnet
#

hold on we're saving bro from future errors

glad cradle
#

ok

eager mural
cold sonnet
#

I don't know how to save bro then

cold sonnet
#

hold on

#

did you load the cog

eager mural
cold sonnet
#

show me that

eager mural
#

the code works without the embed.set_thumbnail(url=guild.icon.url) and launches

#

@bot.event
async def on_command_error(e):
print(e)

#

bro ?

cold sonnet
#

I dunno

eager mural
#

OK

#

r.i.p

severe sonnet
#

how do i edit the own bot message or webhook by the own bot code?
Note: The message contains Enbed

#

*Embed

cold sonnet
#

you wanna edit the embed?

severe sonnet
#

yes

#

and keep the message content

cold sonnet
#

if you have the message object

#

you can get message.embeds[0]

severe sonnet
#

i see

cold sonnet
#

change its value end then edit with the edited embed object

severe sonnet
#

how edit command works?

cold sonnet
#

!d discord.Message.edit this?

severe sonnet
#

like, is there a command that edit messages

unkempt canyonBOT
#

await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) instead of `InvalidArgument`.
severe sonnet
#

oh i see

#

so it's discord.Message.reference.edit?

cold sonnet
#

I suppose that's alright

#

unless you have to refetch the message

severe sonnet
#

refetch?

cold sonnet
#

well try it

#

no I think you don't have to refetch it

unkempt canyonBOT
#

discord/message.py line 991

data = await self._state.http.edit_message(self.channel.id, self.id, params=params)```
lyric sigil
#
@client.event
async def on_message(message:discord.Message): 
    if any(x in message.content for x in blockedWords):
        await message.delete()
    await client.process_commands(message)

@client.event
async def on_message(message:discord.Message):
    if message.author == client.user:
        return
  
    pattern = re.compile(f"<@!?{client.user.id}>") # The exclamation mark is optional

    if pattern.match(message.content.lower()) is not None: # Checking whether the message matches our pattern
        await message.channel.send(f"**I am going to implode.** {message.author.mention}" , reference=message)

I have a problem with my code , i have this 2 client.event and only one is working

turbid condor
#

Both have same name

buoyant quail
#

Of course. You are just overwriting first with second

x = 5
x = 3

don't you expect x to be 3 and 5 and the same time?

turbid condor
#

So 2nd one overrides the first function

buoyant quail
#

!d discord.ext.commands.Bot.listen
use this with name arg

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready)

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Example...
lyric sigil
#

so if i wrote on_message2 its gonna work ?

turbid condor
#

Use the method told by vitness above

buoyant quail
lyric sigil
#

yes that was what i was thinking

turbid condor
#

And use listen() instead of event

lyric sigil
# turbid condor And use listen() instead of event

so like this ?

@client.listen(name="words")
async def on_message(message:discord.Message):
    if message.author == client.user:
        return
  
    pattern = re.compile(f"<@!?{client.user.id}>") # The exclamation mark is optional

    if pattern.match(message.content.lower()) is not None: # Checking whether the message matches our pattern
        await message.channel.send(f"**I am going to implode.** {message.author.mention}" , reference=message)
buoyant quail
#

name should be the name of the event

turbid condor
buoyant quail
#

and function name anything you want

lyric sigil
#

changed it into mention

buoyant quail
#

mention pithink

lyric sigil
turbid condor
#

Nope

buoyant quail
#

there is no such event

lyric sigil
buoyant quail
#

on_message

lyric sigil
#

yes

turbid condor
#

Xd

buoyant quail
#

it's the name of the event

lyric sigil
#

i need to rename it with listen ?

mighty pilot
#

I want to make a bot to mess with people on April fools. Right now I have 1/10 chance for a sent message to delete, and a 1/10 chance of the user getting a 1 minute timeout. Trying to get 8 more functions anybody got ideas?

turbid condor
lyric sigil
#

so if i want to do another i will name it f2 ?

severe sonnet
#
ERROR    discord.client Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 86, in on_message
    discord.Message.reference.resolved.edit(embed=embed)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'member_descriptor' object has no attribute 'resolved'
turbid condor
#

Yes

lyric sigil
#

okay thanks guys

turbid condor
buoyant quail
severe sonnet
#
elif message.content.startswith("##edit->"):
                    belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
                    if belongs_to:
                        edition_message = message.content.replace("##edit->", "")
                        embed = discord.Embed(
                            description=edition_message
                        )
                        discord.Message.reference.resolved.edit(embed=embed)
cloud dawn
severe sonnet
mighty pilot
turbid condor
#

That isn't the relevant part

cloud dawn
buoyant quail
mighty pilot
#

Vc isn't used much in my server, that's a good one though

severe sonnet
#

!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.

buoyant quail
#
discord.Message.reference.resolved.edit(embed=embed)
cold sonnet
#

in our server sometimes people asked to be moved when they played 2v2 in brawlhalla and couldn't go to another voice channel in the moment

severe sonnet
#

https://paste.pythondiscord.com/NDAA

ERROR    discord.client Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 86, in on_message
    discord.Message.reference.resolved.edit(embed=embed)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'member_descriptor' object has no attribute 'resolved'
cold sonnet
#

that would be impossible

cold sonnet
#

where would you get the message object from

cloud dawn
#

@mighty pilot don't have good idea's with text channels..

severe sonnet
cold sonnet
#

do you want to edit it in the same command that that was sent in

#

like after a couple seconds

mighty pilot
mighty pilot
#

Ah damn. I could play jeopardy music on repeat and randomly make people join lol

cold sonnet
#

stalking on another level

#

imagine someone's having sex and you make them join a voice channel

exotic island
#

Im making review system
Can someone explain my mistakes ? I need to send last Review author , in embed
But it sends only first review author

https://paste.pythondiscord.com/2UBA - code

cold sonnet
# severe sonnet yes

so when you do send you're gonna save the message and then use that message object you sent

message = await ctx.send(embed=discord.Embed(title="1"))
embed = message.embeds[0]
embed.title = "2"
await message.edit(embed=embed)
#

this would send an embed with title 1 then edit it to 2 directly

severe sonnet
#

thought i'm grabbing the message to edit by reference

severe sonnet
#

this response should edit my message

cold sonnet
#

but that wouldn't be in the same command

#

it's only possible if you use an on_message

#

and check if the message that was responded to is sent by the bot

cloud dawn
severe sonnet
#

take a look at this:

elif message.content.startswith("##edit->"):
                    belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
                    if belongs_to:
                        edition_message = message.content.replace("##edit->", "")
                        embed = discord.Embed(
                            description=edition_message
                        )
                        discord.Message.reference.resolved.edit(embed=embed)
buoyant quail
#

I already answered what the problem is

#

You are doing it on class which doesn't have any data.
It should be done from Message instance
The message object, from which you want to take reference

severe sonnet
#

oh so message instance

#

don't on_message message already the message instance

#

sorry i'm confuse

buoyant quail
#

Yes

#

But you are doing discord.Message

#

which is not an instance

#

it's a class

severe sonnet
#

now i see where i mistook

#

a stupid misstake

#

do resolved includes in?

#

or just reference

buoyant quail
#

Ye, you'd need it
(Though PartialMessage would be safer if you don't need to get some data from it, just edit, because resolved can fail sometimes)

severe sonnet
#

i see

#

thought for webhook edition seems i need to change something here:

ERROR    discord.client Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 87, in on_message
    await message.reference.resolved.edit(embed=embed)
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\message.py", line 2283, in edit
    data = await self._state.http.edit_message(self.channel.id, self.id, params=params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 738, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50005): Cannot edit a message authored by another user
#
elif message.content.startswith("##edit->"):
                    belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
                    await message.channel.purge(limit=1)
                    if belongs_to:
                        edition_message = message.content.replace("##edit->", "")
                        embed = discord.Embed(
                            description=edition_message
                        )
                        await message.reference.resolved.edit(embed=embed)
#

since the message is a webhook

buoyant quail
#

how was it sent?
the message that you try to edit

severe sonnet
#

it was sent by webhook

#

it's sent like:
prompt: Message

#

then pops out a webhook with "Message" in an embed

buoyant quail
#

Show the code.
It works fine for webhook from interaction followup for example
Though it's not integrations webhook, if you meant this

severe sonnet
#

!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.

severe sonnet
buoyant quail
#

I guess you want this

severe sonnet
#

there ya go

buoyant quail
#

!d discord.Webhook.edit_message

unkempt canyonBOT
#

await edit_message(message_id, *, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None, thread=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits a message owned by this webhook.

This is a lower level interface to [`WebhookMessage.edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.WebhookMessage.edit) in case you only have an ID.

New in version 1.6.

Changed in version 2.0: The edit is no longer in-place, instead the newly edited message is returned.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) instead of `InvalidArgument`.
buoyant quail
#

Edits a message owned by this webhook.

severe sonnet
#
ERROR    discord.client Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\User\Documents\GitHub\RP-Utilities\cogs\ActionCog.py", line 87, in on_message
    await message.reference.resolved.webhook.edit(embed=embed)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Message' object has no attribute 'webhook'
buoyant quail
#

You need to get your webhook
As you did for example around lines 90

And then use it's edit_message with message id from the reference

severe sonnet
#

how doo i grab webhook from reference?

buoyant quail
#

You can get the name and find it in the webhooks list

#

(But the name is always the same by you as i can see so you can just look for it)

severe sonnet
#

uhmm

#

🤔

#

can i see an example of webhook being edited from reference?

#

like, in code

#

?

fading granite
#

hi. i have a bot that has a verification setup and checks for emails in a csv file and gives a role. i want the bot to delete the message as soon as it gets verified so i used message.delete().. but I also want to delete any message the user sends in that verification channel. I used on_message() event but seems like the command isn't getting called itself and the event gets called and deletes the message. Is there a way around?

buoyant quail
#

You get the webhook with any way you want, like you did before, reference doesn't give you something. Except the name if you don't have it

severe sonnet
#

okay so, i'm trying to find the attribute or instance that grabs the user name:
discord.Message.reference.resolved.user_name

buoyant quail
#

.author.name

severe sonnet
#

!webhook.edit

#

what?

dusk dagger
#

if you have the member or user object

severe sonnet
#

@buoyant quail how do i make the document reference command?

buoyant quail
#

?

severe sonnet
#

like, i'm trying to grab the webhook edit thing

#

and i'm planning to it edit my message ID

buoyant quail
#
await webhook.edit_message(message.reference.message_id, embed=embed)
severe sonnet
#

okay soo, i don't know if i will need the webhook name sinceit already has a name

#
elif message.content.startswith("##edit->"):
                    belongs_to = await self.client.database.webhook_log_confirm(user_id = message.author.id, message_id = message.reference.message_id)
                    await message.channel.purge(limit=1)
                    if belongs_to:
                        edition_message = message.content.replace("##edit->", "")
                        embed = discord.Embed(
                            description=edition_message
                        )
                        webhooks = await message.channel.webhooks()
                        webhook = discord.utils.find(lambda webhook: webhook.token is not None, webhooks)

                        await webhook.edit_message(message.reference.message_id, embed=embed)
severe sonnet
#

oh i see

#

worked

fading granite
#

I'm unable to work with forums from my bot currently. I tried updating discord py also, but it seems to be not working. For example, if i run guild.forums -- bot returns no attribute called forums. How do i proceed?

naive briar
#

!d discord.Guild.forums

unkempt canyonBOT
#

property forums```
A list of forum channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
slate swan
#

or just python -m discord -v

slate swan
#

its not up to date then

slate swan
fading granite
slate swan
#

means most likely you have more than one python version

fading granite
#

the version is still at 1.7.3

#

yeah, ig there's 2.7 running too.. not sure tho

slate swan
#

how did you check the version?

#

pip show discord.py?

fading granite
#

yes

slate swan
#

!dashm how about you use this

unkempt canyonBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

fading granite
slate swan
fading granite
slate swan
#

what os?

fading granite
fading granite
slate swan
#

try using python3 instead of python

#

ah you mean python 2.x

fading granite
slate swan
#

mhm

fading granite
slate swan
#

python3 cant really point to Python 2.x

#

how about python3 -V

fading granite
#

3.7.8

#

i used pip3 to install too

slate swan
#

discord.py requires 3.8

fading granite
#

oh.. i'd mistaken when i read "discontinued for 3.7 and earlier" in the docs. i thought 3.7 is included. thanks

spark nimbus
#

Hello! What's up?
I want to start my own discord bot but, I don't know the basic staff. If some one have a tutorial of the basic (preffered a video one. I can learn easier this way) I would love if you could send me.

mighty pilot
mighty pilot
#

Can bots see the "about me" section on profiles?

slate swan
#

no

mighty pilot
#

Sussott wack

quick brook
# spark nimbus Hello! What's up? I want to start my own discord bot but, I don't know the basi...
  1. Before even attempting to create a discord bot, please learn python (?tag lp)
  2. To install discord.py, please run python3 -m pip install discord.py (linux), or py -3 - m pip install discord.py (windows)
    If you wish to use voice functionality, please use discord.py[voice] instead of discord.py
  3. Take a look at https://github.com/Rapptz/discord.py/blob/master/examples/basic_bot.py Mess around.
  4. When you start making your bot, use the commands ext: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html
    or if you wanna use slash commands: https://gist.github.com/AbstractUmbra/a9c188797ae194e592efe05fa129c57f
  5. The library documentation is available at https://discordpy.readthedocs.org/en/latest/

If you need help please make a post in our #985299059441025044 Forum if its related to Python and/or Discord.py

If you are migrating from the old version of this library (1.7.x) to version 2.XX.XX please follow the migrating guide https://discordpy.readthedocs.io/en/latest/migrating.html

meager rock
#

!resources ( there's no tag LP here )

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

mighty pilot
#

Is the discord.py[voice] required to do things with voice channels? Haven't tried anything with vc yet

quick brook
quick brook
sick birch
mighty pilot
#

Might have to check that out

normal lava
#

I made a bot it's on verification it's need identiy card what to do now

normal lava
meager rock
#

Do you not have a valid identity card or are you under 16?

final iron
normal lava
final iron
#

Would a passport work?

normal lava
#

No

#

Else ?

meager rock
normal lava
#

Ohk

#

@meager rock thanks bro

meager rock
#

No worries

normal lava
#

@meager rock can I also use friends ?

meager rock
normal lava
#

Ohk

desert kiln
#

I need help with making seperate files for different commands, can anyone help

desert kiln
quick brook
#

see example

#

what cogs are essentially is a place to store your commands. A cog houses one category of commands (so if I had a cog which is Economy, this cog would house all of my economy related commands)

desert kiln
#

oh boy, I'm gonna lose more braincells

quick brook
desert kiln
#

I just put all my commands in 1 file mane 😭

sick birch
#

It is highly recommended to be experienced in Python if you're using discord.py

quick brook
#

this ^

desert kiln
#

I'll suffer it's fine :)

#

it's 3:29am oops

sick birch
#

Being highly determined and motivated is a sufficient substitution for experience/skill

#

Can you give more context?

#

Preferably the code of that function that's failing

desert kiln
quick brook
#

channel is probably None

sick birch
#

Noted, however that does not really matter much

desert kiln
#

It looks to me, where it's failing is, it can't find the channel it's trying to send the message to

#

at least that's what I can say from that

quick brook
#

if you want to basically send like logs of members joining, then you probably want to ensure that the channel is not none bc there is a chance that get_channel is None

desert kiln
#

I code on PyDroid, I made a simple calculator, because I was bored, but I'm gonna work on my bot

desert kiln
quick brook
desert kiln
#

Dam

mighty pilot
dusty marsh
#

question, what do you guys use for databases for your bots?

mighty pilot
#

I use mariadb, most use some sort of sql or mongodb

dusty marsh
#

use an ORM or?

quick brook
quick brook
#

SQLite and PostgreSQL are the two you probably want to look into

#

nonetheless, i'll shift my priorities to proving why Amethyst is incorrect by writing a PR for connection pooling support

dusty marsh
#

lol, I was using sql alchemy to help me visualize the tables cause im really bad at sql, but i had a lot of problems using the relationships

quick brook
dusty marsh
#

i found that out

quick brook
#

honestly before you even attempt using ORMs, you should at the very least know SQL

#

ORMs pretty much take away your control on how you want your queries to function, and you end up losing productivity because of that. I essentially lost one whole year of productivity working on my main bot just because I was fighting with the ORMs i was using at that time

dusty marsh
#

do you create your own classes and write helper functions or just directly execute statements in your bots commands?

quick brook
#

i write the raw sql queries myself

sick birch
quick brook
#

sql injection is not a worry bc I pretty much use substitution values that asyncpg uses to clean up the code so sql injection doesn't happen

sick birch
#

SQLAlchemy

mighty pilot
quick brook
#

I've completed 4 different full rewrites of my bot so far

mighty pilot
mighty pilot
#

Definitely need to fix the vulnerability and definitely need to seperate into cogs lol

quick brook
#

oh ok

#

I need to merge some cogs together and then finish up an IPC health check system

mighty pilot
#

I think when I rewrite mine I'm also going to expand on it. Right now it's a split tree leveling system with 3 paths. I want to branch it out into a full scale 3 tier tree with 40 different role options. All configurable from either in server or a web dashboard.

#

But, I procrastinate. Lol

#

Also my irl job exists

quick brook
#

Makes sense

#

I still have classes and other stuff that I have to deal with so I don't often get the chance to work on my bot

final iron
#

There's so much shit I need to do for my bot

#

My job is killing me

#

They overwork me tbh

mighty pilot
#

I feel that. I've been working 10 hour days at a job site 2 hours from home. I pretty much get home and pass out so the weekends are the only time I have. And even then I'm busy with life. But I enjoy the problem solving

mighty pilot
final iron
#

Nah u got it worse

#

Most days I just get home and pass out

#

Get home at 6 eat, pass out until like 11

mighty pilot
#

I leave my house at 4am, get home at 6pm

final iron
#

Bro doesn't sleep