#discord-bots

1 messages Β· Page 1107 of 1

slate swan
shrewd apex
#

πŸ’€

paper sluice
slate swan
#

ok

#

I am going to try

#

you don't really need to make cogs for an event in another file tbh

#

if you don't want prefix/hybrid commands, stay on discord.Client

slate swan
#

only?

slate swan
shrewd apex
slate swan
#

why cogs when you can make simple functions and use them as listeners

#

is the command_prefix in commands.Bot optional now?

#

!d discord.ext.commands.Bot

#

i need slash system to verify my 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 "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 "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 "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), This class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "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.
slate swan
#

yes

slate swan
#

thanks bro

#

bro my bot can't have prefixes without being slash

#

but thanks

#

i'm just passing everything to slash because i need to check my bot for it to be able to join more than 100 servers

shrewd apex
#

does it require only slash to verify bots now i still see quite a few bots with prefix commands

slate swan
#

and for me it is very difficult to change everything

#

because there are many mistakes that make no sense to me

abstract kindle
#

any easy way to convert :chicken: format of emoji to unicode?

#

The SelectOption needs a unicode emoji for the emoji attribute I think..

slate swan
#

yes it prevents but only prevents from August 31, 2022

#

discord developer

#

but there has to be a special reason

#

and I have no special reason

#

ok

slim spoke
#

I want to send a message on guild join so I used this code to send a message in general but some servers don't have general or changed the name so it won't work.
is there a way to get the first text channel in the server? the first one on the top

@client.event
async def on_guild_join(guild):
    general = find(lambda x: x.name == 'general',  guild.text_channels)
    if general:
        await general.send('Hello! type g!channel to set a channel for the games')
paper sluice
#

guild.text_channels[0]?

slate swan
paper sluice
#

and put it in an async func as well

#

?

slate swan
#

sry

#

bot.add_cog(onready(bot)) the error says the problem is here

#

and says to activate tracemalloc

#

I will use this

#
for f in os.listdir("./cogs"):
    if f.endswith(".py"):
        bot.load_extension("cogs." + f[:-3])
wispy sequoia
#

welp

#

I've been talking with a guy in #help-chocolate about something not happening

#

there's a function in the main file that doen't run, and the guy said that I have an old version of dpy

#

is there something I can do?

wispy sequoia
#

Fore is from colorama, you don't really need it

wispy sequoia
#

your directory should look like this

#
\
     main.py
     \cogs
             extensions.py
slate swan
wispy sequoia
#

uhh

#

I don't get what's the issue then

#

my directory is like this and it works fine

slate swan
#
    bot.add_cog(Cog(bot)) ```
#

where do i have to put this?

wispy sequoia
#

oh

dense swallow
#

at the bottom of the cog

wispy sequoia
#

inside the cogs\file.py at the bottom

dense swallow
#

also are u using 2.0 or 1.7.3?

slate swan
dense swallow
#

then use this```py
async def setup(bot):
await bot.add_cog(Cog(bot))

wispy sequoia
slate swan
dense swallow
dense swallow
# slate swan

can u show me the full side bar which includes all the files, not just the cogs

dense swallow
#

ah

#

try this method of loading the bot.. put main.py outside (ie: it shouldn't be in any folders)

wispy sequoia
#

it is I think

dense swallow
slate swan
dense swallow
#

hm, whats the error once again?

wispy sequoia
#

ah

slate swan
wispy sequoia
#

bro you forgot to await

#

await bot.load_extension()

#

I think

#

bc that's what the error says

slate swan
wispy sequoia
#

wtf

slate swan
#

async def setup(bot):
await bot.load_extension()
await bot.add_cog(onready(bot))

wispy sequoia
#

umm show it again

#

ah

dense swallow
#

no no

wispy sequoia
#

bro, load_extension must be in main.py only

dense swallow
#

yeah ^^

slate swan
#

sry

wispy sequoia
#

dw it happens

#

I'm a beginner too πŸ˜‚

slate swan
# wispy sequoia dw it happens

File "c:\Users\franc\Desktop\codelab\main.py", line 17, in <module>
bot.load_extension()
TypeError: BotBase.load_extension() missing 1 required positional argument: 'name'

wispy sequoia
#

@dense swallow have you found what my issue could be? could it be that I'm on 1.7.3?

dense swallow
#

from my experience 1.7.3 is not that strict at async/await.. but 2.0 is

slate swan
#

bot.load_extension(required name)

wispy sequoia
#

use it as it is

slate swan
wispy sequoia
#

keep only the for

dense swallow
# slate swan

after try block do this: ```py
await bot.load_extension("cogs." + extension)

slate swan
wispy sequoia
#

bro you just need to keep the for loop

#

this only

wispy sequoia
dense swallow
#

ok, so can u paste that whole code here

#

including the for loop

wispy sequoia
#

!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 floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

dense swallow
#

it isnt that big, so np

wispy sequoia
#

Idk why setup_hook() isn't running, and that guy said that it's probably dpy version

slate swan
dense swallow
slate swan
#

my code without cogs is about 1800 lines

dense swallow
#

cogs is just better for management purposes

slate swan
#

but it doesn't work lol

dense swallow
#

@slate swan is this how ur loading ur cogs? ```py
for extension in [f.replace('.py', '') for f in os.listdir("cogs") if os.path.isfile(os.path.join("cogs", f))]:
try:
bot.load_extension("cogs." + extension)
except (discord.ClientException, ModuleNotFoundError):
print('Failed to load extension: ' + extension)

tired hinge
#

sending a message every 5 minutes or so wouldn't get me rate limited, right?

wispy sequoia
dense swallow
# slate swan yep

ok so try this then ```py
async def setup_hook():
for extension in [f.replace('.py', '') for f in os.listdir("cogs") if os.path.isfile(os.path.join("cogs", f))]:
try:
await bot.load_extension("cogs." + extension)
except (discord.ClientException, ModuleNotFoundError):
print('Failed to load extension: ' + extension)

tired hinge
dense swallow
#

if ur bot is sub-classed it needs self

slate swan
#

the file is not loading

wispy sequoia
#

doesn't run

#

right?

slate swan
wispy sequoia
#

yup, same issue

slate swan
dense swallow
paper sluice
slate swan
dense swallow
#

u need to have another on_ready func

#

that on_ready is for that cog

wispy sequoia
slate swan
dense swallow
wispy sequoia
#

hmm

paper sluice
dense swallow
slate swan
wispy sequoia
dense swallow
#

self

wispy sequoia
#

k

slate swan
#

okay I got ignored again

dense swallow
#

no, pretty sure bot.load.. wont work

slate swan
#

Β―_(ツ)_/Β―

dense swallow
#

i saw ur msg

wispy sequoia
#

it is

slate swan
paper sluice
slate swan
#

i saw the wrong message nvm

wispy sequoia
dense swallow
#

error?

wispy sequoia
#

no errors

#

just frozen

dense swallow
#

!d discord.ui.Button.callback

unkempt canyonBOT
#

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

The callback associated with this UI item.

This can be overridden by subclasses.
wispy sequoia
wispy sequoia
slate swan
wispy sequoia
#

self.bot maybe?

slate swan
#

there are things i can't understand on discord.py omg

paper sluice
slate swan
wispy sequoia
slate swan
#

Hi

wispy sequoia
slate swan
slate swan
slate swan
wispy sequoia
paper sluice
dense swallow
# wispy sequoia <@710247495334232164>

ok try this way of loading cogs.
put all the cogs as a list and then name them like this

COGS = [
    'cogs.name',
    'cogs.name2' #etc
]
``` if u have another file of cogs, do the same but with different variable name ```py
OWNER_COGS = [
    'owner.name',
    'owner.name2'
]
``` and do it like that for every cog u have. this method gives u the most control over loading cogs, and is used in many bots...
then in setup_hook() do this: ```py
async def setup_hook():
    await bot.load_extension(COGS) # this will load the files in cogs folder
    await bot.load_extension(OWNER_COGS) # you can do the same for other cogs
slate swan
dense swallow
#

all that typing for nothing lol

wispy sequoia
#

how do I update?

slate swan
paper sluice
slate swan
#

try pip show discord.py @wispy sequoia

wispy sequoia
#

how do I update to 2.0?

paper sluice
#

python -m pip install git+https://github.com/rapptz/discord.py

slate swan
#

i wish there was something like tags here kannapogg

dense swallow
#

yeah

wispy sequoia
slate swan
paper sluice
#

no

paper sluice
slate swan
#

add an -U before git+... else it won't update lol

dense swallow
slate swan
paper sluice
#

i dont work for danny Β―_(ツ)_/Β―

slate swan
paper sluice
#

࢞ @slate swan

slate swan
#

ASKannaSpook nothing sus fr fr

wispy sequoia
#

ig

#

ok nvm πŸ˜‚ it's updating

wispy sequoia
#

ok nvm it launches but the bot doesn't reply

#

tf is going on .-.

#

@paper sluice am I doing something wrong here?

split solstice
#

Any GitHubs that have a real command for discord.py

vocal snow
split solstice
#

Eval not real

slate swan
vocal snow
paper sluice
wispy sequoia
#

wait

wispy sequoia
split solstice
wispy sequoia
#

even if it's started

paper sluice
wispy sequoia
#

whatever it's cogs

#

I can show you the main file maybe there's something wrong in there

slate swan
split solstice
slate swan
#

since discord 2 requires message content intent (for message commands) and is privileged

#

discord v2*

wispy sequoia
#

oh so

astral flare
#

Hi guys :(

wispy sequoia
paper sluice
slate swan
wispy sequoia
#

yeah

#

lemme rq

split solstice
slate swan
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: components must be a list of Component What does this error mean?

paper sluice
#

u passed in components, it should be list of Components

wispy sequoia
paper sluice
#

read the error πŸ˜”

paper sluice
slate swan
wispy sequoia
# paper sluice just do `discord.Intents.all()`

discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

slate swan
slate swan
uncut jacinth
#

Any body knows all Userflags? like badges

paper sluice
slate swan
slate swan
# slate swan components should be a list
    await ctx.send(
        embed=embed,
        components=[
            Button(
                style=ButtonStyle.green,
                emoji="βœ…",
                custom_id='on'
            ),
            Button(
                style='Button.red',
                emoji="β›”",
                custom_id="off"
                
            )
        ]
)

``` like that?
#

yes.

slate swan
#

IDS?

uncut jacinth
#

For example UserFlags.hypesquad_bravery

slate swan
uncut jacinth
#

What is the one for staffs or other things like bug hunter

slate swan
#

I still get the same error

slate swan
#

hm lemme see

paper sluice
# uncut jacinth I mean the IDS for them in discord.py
class UserFlags(Enum):
    staff = 1
    partner = 2
    hypesquad = 4
    bug_hunter = 8
    mfa_sms = 16
    premium_promo_dismissed = 32
    hypesquad_bravery = 64
    hypesquad_brilliance = 128
    hypesquad_balance = 256
    early_supporter = 512
    team_user = 1024
    system = 4096
    has_unread_urgent_messages = 8192
    bug_hunter_level_2 = 16384
    verified_bot = 65536
    verified_bot_developer = 131072
    discord_certified_moderator = 262144
    bot_http_interactions = 524288
    spammer = 1048576
slate swan
slate swan
#

oh wait, add that inside a list too

#

components=[components]

slate swan
#
    components=[
        Button(
            style=ButtonStyle.green,
            emoji="βœ…",
            custom_id='on'
        ),
        Button(
            style='Button.red',
            emoji="β›”",
            custom_id="off"
            
        )
    ]

    await ctx.send(embed=embed,components=[components])```
slate swan
# slate swan guilds is a coroutine object

@slate swan if you dont call a coroutine it would call a function object (coroutine_name) if you do call it, it would return a coroutine object (coroutine_name()) and if you call it and await it you would get the result of such coroutine (await coroutine_name())

slate swan
#

Traceback (most recent call last):
File "main.py", line 18, in <module>
from discord.slash import SlashCommand
ModuleNotFoundError: No module named 'discord.slash'

slate swan
lyric apex
#

How to check mentioned role is a bot's role or not?

slate swan
slate swan
#

since youre trying to index its result no?

lyric apex
#

!d discord.Role

unkempt canyonBOT
#

class discord.Role```
Represents a Discord role in a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild")...
odd mango
slate swan
#

So await get_guild()?

odd mango
#

yeah

slate swan
#

and python doesnt lie on errors

odd mango
#

await it

slate swan
slate swan
wispy sequoia
slate swan
#

ctx.guild.icon.url or ctx.guild.avatar.url

#

For guild icon url

slate swan
odd mango
slate swan
slate swan
wispy sequoia
#

Am I missing something?

    @commands.command()
    async def invite(self, ctx):
        embed = discord.Embed()
        embed.title = "Click the link! \U0001f447"
        embed.color = 0xdda7ff
        embed.set_thumbnail(url=self.bot.user.avatar_url)
        embed.add_field(name="»»————-   β˜…   β€”β€”β€”β€”-««",
                        value=f"https://discord.com/api/oauth2/authorize?client_id={self.bot.user.id}&permissions=8&scope=bot")
        await ctx.channel.send(embed=embed)
slate swan
#

avatar.url

dense swallow
wispy sequoia
dense swallow
#

my head hurts, after helping so much people at once lol

odd mango
#

its . in dpyv2

wispy sequoia
#

lord I gotta check every command since I updated to 2.0

slate swan
dense swallow
#

yup

paper sluice
slate swan
#

which may be breaking

slate swan
#

whyyyyy

dense swallow
#

they wanna focus on speed so..

slate swan
paper sluice
slate swan
#

’NoneType’ object has no attribute β€˜url’

#

anything which is not pycord

slate swan
slate swan
slate swan
slate swan
unkempt canyonBOT
#

property self_role```
Gets the role associated with this client’s user, if any.

New in version 1.6.
slate swan
#

this gives the bot's role, check if its equal

lyric apex
#

What is is_bot_managed?

slate swan
lyric apex
slate swan
slate swan
lyric apex
lyric apex
slate swan
slate swan
slate swan
#

!d discord.Role.is_bot_managed

unkempt canyonBOT
#

is_bot_managed()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.10)"): Whether the role is associated with a bot.

New in version 1.6.
wispy sequoia
#

what in the f-

#

umm it literally shows it's awaited

paper sluice
#

its trying to await the first value of fecthone, fetchone hasn't been awaited yet

wispy sequoia
#

and the bot says this

slate swan
#

Traceback (most recent call last):
File "main.py", line 18, in <module>
from discord.slash import SlashCommand
ModuleNotFoundError: No module named 'discord.slash'

#

from discord.slash import SlashCommand

slash = SlashCommand(client, sync_commands=True)

@slash.slash(name="ping", description="ping commands")
async def ping(ctx):
    await ctx.send("pong")
#

use main!

paper sluice
slate swan
#

what?

wispy sequoia
# paper sluice do `(await ...)[0]`

where exactly?

import discord
from discord.ext import commands
import random
from utils.economy_functions import add_user, fetch_user, fetch_bank, fetch_wallet, delete_user, update_wallet, update_bank


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

    @commands.command()
    async def newaccount(self, ctx):
        cursor = await self.bot.connection.cursor()
        if await fetch_user(cursor, ctx.author.id) == ctx.author.id:
            await ctx.channel.send('You already have an account!')
        else:
            await add_user(self.bot.connection, ctx.author.id)
            await ctx.channel.send(f"{ctx.author.name}'s account added.")
        await cursor.close()


async def setup(bot):
    await bot.add_cog(Economy(bot))

https://paste.pythondiscord.com/asuqebofud

slate swan
#

you should use dpy2.0

#

me?

#

yes u

wispy sequoia
#

I don't get what's wrong

paper sluice
#

(await cursor.fetchone())[0]

wispy sequoia
#

wtf

#

isn't it exactly as it is?

paper sluice
wispy sequoia
#

oooohhh

slate swan
#

hey guys, how to get a list of all user's id in a particular server

wispy sequoia
slate swan
paper sluice
slate swan
paper sluice
slate swan
wispy sequoia
wispy sequoia
#

I don't get what's wrong

slate swan
slate swan
paper sluice
paper sluice
slate swan
#

python3 -m pip install -U discord.py = this dpy 2.0?

paper sluice
wispy sequoia
slate swan
paper sluice
slate swan
#

thx

wispy sequoia
slate swan
#

still same error

#
from discord.slash import SlashCommand

slash = SlashCommand(client, sync_commands=True)

@slash.slash(name="ping", description="ping commands")
async def ping(ctx):
    await ctx.send("pong")
unkempt canyonBOT
#
Huh? No.

No documentation found for the requested symbol.

slate swan
#

Traceback (most recent call last):
File "main.py", line 18, in <module>
from discord.slash import SlashCommand
ModuleNotFoundError: No module named 'discord.slash'

paper sluice
slate swan
wispy sequoia
wispy sequoia
paper sluice
wispy sequoia
slate swan
#
@bot.command(aliases=['od'])
async def ownerdm(ctx, message):
    try:
        user_ids = [member.id for member in discord.Guild.members]
        for i in user_ids:
            m = bot.get_user(i)
            await m.send(message)

    except Exception as e:
        print(e)
        await ctx.send("ERR_ERROR_OCCURED")

why does this give me 'property' object is not iterable

paper sluice
paper sluice
wispy sequoia
# paper sluice huh?
    @commands.command()
    async def newaccount(self, ctx):
        cursor = await self.bot.connection.cursor()
        if await fetch_user(cursor, ctx.author.id) == ctx.author.id:
            await ctx.channel.send('You already have an account!')
        else:
            await add_user(self.bot.connection, ctx.author.id)
            await ctx.channel.send(f"{ctx.author.name}'s account added.")
        await cursor.close()

I don't get what you're asking so this is supposed to be the command

paper sluice
slate swan
#

@paper sluicehow to uninstall dpy 2.0?

#

i love disnake kkkkkk xd

paper sluice
unkempt canyonBOT
#

The with keyword triggers a context manager. Context managers automatically set up and take down data connections, or any other kind of object that implements the magic methods __enter__ and __exit__.

with open("test.txt", "r") as file:
    do_things(file)

The above code automatically closes file when the with block exits, so you never have to manually do a file.close(). Most connection types, including file readers and database connections, support this.

For more information, read the official docs, watch Corey Schafer's context manager video, or see PEP 343.

fading marlin
slate swan
#

correct?

wispy sequoia
# paper sluice !with this is a contextmanager

ohhh so it's a problem from another function, this one

async def add_user(db, user, wallet=0, bank=0):
    cursor = await db.cursor()
    with db:
        await cursor.execute('INSERT INTO eco VALUES (:user_id, :wallet, :bank)', {
            'user_id': user, 'wallet': wallet, 'bank': bank})
    await cursor.close()

what's wrong?

slate swan
#

@paper sluice say?

paper sluice
#

and if ur using a cm, u dont need to manually call close, thats the whole point of using cm. they close stuff for u

paper sluice
slate swan
wispy sequoia
#

wait

paper sluice
wispy sequoia
paper sluice
wispy sequoia
#

yeah I'm sure

#

I wrote that stuff after watching a 30 mins tutorial and exercising on sqlite3 for 2 hours

wispy sequoia
slate swan
#

disnake

#

~/-hosted-one$ pip uninstall 2.0
WARNING: Skipping 2.0 as it is not installed.
~/-hosted-one$ pip uninstall 2.0.0a4367+g64849ebc
ERROR: Invalid requirement: '2.0.0a4367+g64849ebc'
~/-hosted-one$

#

@paper sluice

slate swan
wispy sequoia
slate swan
#

i want to uninstall 2.0

slate swan
slate swan
paper sluice
uncut jacinth
#

I got all userflags in my code and i get every badge detected except for certified moderator anybody know why?

slate swan
slate swan
slate swan
#

done

slate swan
slate swan
slate swan
wispy sequoia
#

aiosqlite

slate swan
#

same thing

wispy sequoia
#

then what

paper sluice
wispy sequoia
#

python? nah just sqlite

paper sluice
#

anyways, just know async with is needed in this case

#

if u want to know why, look into async context managers

slate swan
#

Hi

slate swan
#

nvm

paper sluice
slate swan
paper sluice
#

still ejected?

shrewd apex
#

πŸ‘‹

slate swan
#

why does everybody slap each other here

slate swan
#

btw hi sparky and asher

paper sluice
#

get used to it πŸ”«

slate swan
shrewd apex
shrewd apex
slate swan
#

πŸ‘‹ πŸ‘‹

slate swan
#

Why

#

bored

#

U trying to eat stick

shrewd apex
#

atleast a lollipop would be a better choice

#

do ice cream even last 30min?

slate swan
#

I remember eating one for 7 hours once

cerulean folio
#

embed = discord.Embed(color = color) doesn't work with color = 0x00ffff I don't get why. It says TypeError: Expected discord.Colour, int, or None but received str instead.
Someone know what to do? :o

slate swan
lapis breach
#

hey i need help, im using disnake and trying to download an attachment that a user sends when he calls the command, can any1 help me?

slate swan
shrewd apex
slate swan
#

In the dustbin

shrewd apex
slate swan
#

string?

shrewd apex
#

no

slate swan
#

Oh

unkempt canyonBOT
paper sluice
slate swan
#

lamo

slate swan
lapis breach
#

thats for discordpy

zenith mural
#

ok

shrewd apex
slate swan
unkempt canyonBOT
lapis breach
#

and i also cant get it to work in discordpy, yes i have read the docs

paper sluice
#

imagine being a discord bot

slate swan
#

Imagine

lapis breach
shrewd apex
slate swan
#

it return a list of attachments

slate swan
#

Yes

wicked atlas
unkempt canyonBOT
#

await save(fp, *, seek_begin=True, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Saves this attachment into a file-like object.
wicked atlas
#

Give it an opened file, and you should be good

cerulean folio
# slate swan color=discord.Colour(0x00ff)

Still doesn't work. Problem comes from the fact I'm returning colour = '0x00ff00' which is a a string. and the function expects a discord.Colour or an int.
Also tried discord.Colour(colour), doens't work also !
How could 0x00ff00 be an int??

slate swan
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

12819
slate swan
#

Wow

#

See this

paper sluice
#

its just a way to show hex, internally its just an int

slate swan
#

!e
print(True+True)

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

2
shrewd apex
#

value of true is 1

slate swan
#

yeah since True = 1

shrewd apex
#

binary

paper sluice
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

True
slate swan
#

False+False will be 0

lapis breach
slate swan
#

I'm out

slate swan
#

use*

cerulean folio
#

I tried color = int(color) it says ValueError: invalid literal for int() with base 10: '0xff0000' I'm so confused

wicked atlas
lapis breach
slate swan
#

Can a human brain be a cpu for a bot like Dyno

shrewd apex
# slate swan I'm out

computers work on digital signal and all their circuits are logic gates basically hence it's often said computer only knows 0 and 1

paper sluice
slate swan
slate swan
slate swan
cerulean folio
slate swan
#

What's history behind the use of foo

cerulean folio
lapis breach
slate swan
#

traceback

paper sluice
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

001 | 291
002 | 291
slate swan
#

AH makes sense then

cerulean folio
#

ayeee :D

lapis breach
#

huh, strange, i remember doing that yesterday

#

this doesnt work thoughCommand raised an exception: OSError: [Errno 22] Invalid argument: '/mp3Files/'

#

fixed it

#

now its this one

#

Command raised an exception: PermissionError: [Errno 13] Permission denied: 'mp3Files/'

#

wow

#

it... didnt work

slate swan
#

Dear. what to enter here to connect the bot to the server?

maiden fable
#

What server?

#

U don't mess with that

slate swan
#

To my server

slate swan
#

It does not generate

#

U messed up

maiden fable
slate swan
#

His. discord server

slate swan
#

Where is she?

#

she?

maiden fable
slate swan
#

link

sick birch
#

<@&831776746206265384>

slate swan
#

<@&831776746206265384>

maiden fable
#

<@&831776746206265384> raid

#

Nice

sick birch
#

here they come

slate swan
maiden fable
#

Highly unlikely tbh

slate swan
#

He login and

shrewd apex
shrewd apex
slate swan
#

Hacking not easy task

maiden fable
#

No mod lemon_pensive

slate swan
sick birch
#

phew, deleted

slate swan
#

Nice

#

Screenshot it

#

Robin chat snipe btw

sick birch
#

hm?

slate swan
sick birch
#

@slate swan If you click on "bot" under "scopes" then click on whatever you want for "bot permissions" you should have a link at the bottom

slate swan
sick birch
#

You're under the wrong tab

#

Click "oauth2" then "URL generator"

shrewd apex
#

basically it will ask u to QR code scan and if u scan gg untill u change ur password or enable 2fa

sick birch
#

QR code scanning bypasses 2fa and password entirely

#

personally I think it's a security issue but I suppose discord believes convenience > security on that front

shrewd apex
slate swan
#

no link😭

#

Sad

sick birch
#

Odd it shouldn't ask you for one

slate swan
sick birch
#

Have you looked at their documentation?

slate swan
#

What's popcat api

sick birch
#

Any decent API will have documentation

slate swan
sick birch
#

Maybe ask in their discord server?

#

Ah no documentation but you can figure it out pretty easily by looking at the URL

faint void
sick birch
#

Vast majority of APIs will use JSON, yes

#

Why? Popcat works just fine

#

Look at the URLs, it's easy to figure out

lapis breach
#

guess not....

slate swan
#
@client.event
async def on_guild_channel_update(after, channel):
  reason = "Anti Channel Update"
  guild = after.guild
  logs = await guild.audit_logs(limit=1, action=discord.AuditLogAction.channel_update).flatten()
  logs = logs[0]
  await logs.user.ban(reason=reason)
``` this is correct?
slate swan
#

Not working that's why I sent this

sick birch
#

"Not working" can you be more specific?

lapis breach
#

how do i fix permission denied error?

fading marlin
unkempt canyonBOT
#

discord.on_guild_channel_update(before, after)```
Called whenever a guild channel is updated. e.g. changed name, topic, permissions.

This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
faint void
lapis breach
slate swan
swift pumice
#

how to make that if something other then a specific message is wroted that it will auto delete the message? like i want that if they write !verify its ok and if they write something other i want that it auto deletes the message.

#

could anyone help me out?

lapis breach
swift pumice
lapis breach
slate swan
swift pumice
lapis breach
#

its not discord perms its application perms i think

lapis breach
slate swan
#

Is bot online

lapis breach
#

of course, if it wasnt there woulnt be an error

slate swan
#

I forgot that missing perms will raise other error

slate swan
slate swan
#

Can u show the code. @lapis breach

lapis breach
slate swan
#

Can u show the error

#

Full traceback

fading marlin
#

you should either pass a filename or a file-like object to fp, not a directory?

lapis breach
#

isnt fp filepath?

swift pumice
#

how to make that if something other then a specific message is wroted that it will auto delete the message? like i want that if they write !verify its ok and if they write something other i want that it auto deletes the message.

lapis breach
#

so... what do i put? a namer?

prime ibex
#

Just how does this exist hmm

swift pumice
#

what? like if they write no or like something other that it will auto delete the message

swift pumice
fading marlin
#

!d discord.on_message

unkempt canyonBOT
#

discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") is created and sent.

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.

Warning

Your bot’s own messages and private messages are sent through this event. This can lead cases of β€˜recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
swift pumice
#

no , this will only be in one channel, the verify channel

#

btw how can i set that it will only work in one channel?

#
async def verify(ctx):
        guild = ctx.guild
        role = guild.get_role(985205310740389918)
        await ctx.author.add_roles(role)
        await ctx.send(f'{ctx.author.mention} you are now verified')
        await asyncio.sleep(3)
        await message.delete()
        await ctx.message.delete()
        
        ```this is my current code
slate swan
swift pumice
#

okay thanks

#

thank youu :) you guys are so helpful :)

fading marlin
swift pumice
lapis breach
#

works but how do i save it to a specific file

swift pumice
#

idk

prime ibex
lapis breach
#

what?

slate swan
#

Hello how i can fix ?

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

wait

prime ibex
# slate swan Hello how i can fix ?

Three things:

  1. that if is way off, it should be idented under the function
  2. that embed.timestamp should be idented under the other embed variables
  3. use @client.command() for making commands instead of using events as that’s made to make ur job easier
#

And tidier

lapis breach
#

like this?

#

doesnt work

fading marlin
#

await ctx.send !!

brazen raft
#

Wait what is this await on file saving

lapis breach
swift pumice
#
async def verify(ctx, nextcord.on_message(message)):
    if message.channel.id == 987651665492586568:
        guild = ctx.guild
    role = guild.get_role(985205310740389918)
    await ctx.author.add_roles(role)
    await ctx.send(f'{ctx.author.mention} you are now verified')
    await asyncio.sleep(3)
    await message.delete()
    await ctx.message.delete()

``` like this?
brazen raft
#

How does one manage asynchronous file/resource handling like this

lapis breach
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Attachment' object has no attribute 'endswith'

fading marlin
#

you're looking for Attachment.filename

lapis breach
#

like that

fading marlin
slate swan
#

@slate swan done?

lapis breach
#

espaΓ±ol?

fading marlin
unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

lapis breach
#

k works

swift pumice
lapis breach
#

thx

fading marlin
swift pumice
#

ok wait let me try

#

thanks

#
async def on_message(message):
    if message.channel.id == 987651665492586568:


@bot.command()
async def verify(ctx):
        guild = ctx.guild
        role = guild.get_role(985205310740389918)
        await ctx.author.add_roles(role)
        await ctx.send(f'{ctx.author.mention} you are now verified')
        await asyncio.sleep(3)
        await message.delete()
        await ctx.message.delete()
```like this?
fading marlin
#

well yeah

#

but you'd want to do stuff after your if in your on_message

left vector
#

how do i make a discord bot delete a message

fading marlin
#

!d discord.Message.delete

unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
swift pumice
#

thanks

odd mango
#

@swift pumice ^^

swift pumice
keen grove
#

i see no run buttons

swift pumice
#

then click on it and then run

keen grove
#

what-

swift pumice
#

yes like on the file

left vector
#
async def on_message(msg):
  if 'test' in msg.content:
    await msg.channel.send('you said somting')
    (deletes the message)```
how do i make this work
#

like delete the message

slate swan
keen grove
#

yes

swift pumice
#

BRO THIS WAS SOOOO HELPFUL , like omg. thank you sooo much

left vector
#

how do i make it delete the message

keen grove
slate swan
left vector
#

message triggering

slate swan
#

await

left vector
#
async def on_message(msg):
  if 'test' in msg.content:
    await msg.channel.send('you said somting')
    await msg.delete()```
#

alright thakn you

#

ill check if it works

fading marlin
#

oh, it's in on_message

left vector
#

AHHHHHH thank you man

swift pumice
#

its says expected :

#

where?

left vector
#

one last check before i sleep

#

it got deleted..

#

@bot.listen()
async def on_message(msg):
  if words in msg.content:
    await msg.channel.send('you said somting')
    await msg.delete()```
swift pumice
#

oh okay thanks

left vector
#

does that work?

keen grove
left vector
#

you are very nice gigacat

#

thank youu i can now sleep as it is 1:30 am

swift pumice
#

hello

#
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        await message.send("please only write !verify and not something other")
        await asyncio.sleep(3)
        await message.delete()
        await bot.process_commands(message)``` how do i make that it deletes the bot message too? like that it doesnt just delete the users message
swift pumice
fading marlin
#

you probably want to outdent your bot.process_commands

left vector
#

yes

slate swan
#

sorry, but i dont understand how i can fix : //

swift pumice
#

thanks

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

swift pumice
#

yes ig

fading marlin
fading marlin
#

keyword argument

swift pumice
#

oh ok

lean raven
#

Hello

#

How is it going

#

Nice to be hear

swift pumice
#
async def on_message(message,ctx):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        msg = await ctx.send(f'{message.author.mention}please only write !verify and not something other')
        await message.delete()
        await asyncio.sleep(3)
        await msg.delete()
        await bot.process_commands(message)```
#

what is the problem

#

ok wait

#
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        msg = await message.send(f'{message.author.mention}please only write !verify and not something other')
        await message.delete()
        await asyncio.sleep(3)
        await msg.delete()
        await bot.process_commands(message)
``` like this?
fading marlin
#

outdent your bot.process_commands, otherwise other commands won't get invoked

#

discord.Message doesn't have a send method, you're looking for message.channel.send

fading marlin
swift pumice
#

thanks

fading marlin
#

opposite of indent?

swift pumice
#
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        msg = await message.send(f'{message.author.mention}please only write !verify and not something other')
        await message.delete()
        await asyncio.sleep(3)
        await msg.delete()
                          await bot.process_commands(message)``` like this?
#
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        msg = await message.send(f'{message.author.mention}please only write !verify and not something other')
        await message.delete()
        await asyncio.sleep(3)
        await msg.delete()
        



await bot.process_commands(message)``` or like this?
swift pumice
#

thank you

fading marlin
#

you gotta add else/return too

#

otherwise other commands will get invoked too

swift pumice
#

oh ok wait

#

ill try(btw im new at programming) sry for being dumb

fading marlin
#

no worries

#

however if you're new, consider doing some less-advanced stuff before you tackle dpy

swift pumice
swift pumice
# fading marlin you gotta add else/return too
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        await message.delete()
    else:
        return
        await message.channel.send(f'{message.author.mention}please only write !verify and not something other', delete_after=3)

    await bot.process_commands(message)``` like this?
fading marlin
#

no, your else should be in your bot.process_commands

fading marlin
#
if ...:
  ...
else:
  await bot.process_commands(message)
#

!d discord.ext.commands.Bot.wait_for this is what you're looking for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
swift pumice
# fading marlin ```py if ...: ... else: await bot.process_commands(message) ```
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        await message.delete()
        return
        await message.channel.send(f'{message.author.mention}please only write !verify and not something other', delete_after=3)
    else:
        await bot.process_commands(message)``` like this right?
fading marlin
#

correct

#

remove the return though

swift pumice
#

oh okay

rocky veldt
#

I'm having trouble sending files with discord.py. Is it discontinued or something?

fading marlin
#

nope

#

could you be more specific with 'having trouble'?

rocky veldt
#
    await ctx.send("generating url")
    word1 = (lingo.get_audio_url(word))
    print (f"Url: {word1}")
    await ctx.send(f"Url: {word1}")
    URL = (word1)
    await ctx.send("generating file")
    FILE_TO_SAVE_AS = "myvideo.mp3" # the name you want to save file as


    resp = requests.get(URL) # making requests to server

    with open(FILE_TO_SAVE_AS, "wb") as f: # opening a file handler to create new file 
        f.write(resp.content) # writing content to file
    await ctx.send("Sending File")
    await ctx.send(file = discord.File("myvideo.mp3"))``` is the code
#

it stops atawait ctx.send("Sending File")

fading marlin
#

consider using aiohttp instead of requests

#

sure

rocky veldt
fading marlin
#

not exactly

#

are you getting any tracebacks?

rocky veldt
#

wdym?

fading marlin
#

errors?

rocky veldt
#

nope

swift pumice
#
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        await message.delete()
        await message.channel.send(f'{message.author.mention}please only write !verify and not something other', delete_after=3)
    else:
        await bot.process_commands(message)``` i have a problem , it kinda works, but rugged like it spamms the f'{message.author.mention}please only write !verify and not something other'  and then instantly deletes the message you know?
rocky veldt
#

ignore the leave messages, it's from on_member_remove

swift pumice
#

like its really weird

rocky veldt
#

this is all it sends

fading marlin
fading marlin
swift pumice
#
async def on_message(message):
    if message.channel.id == 987651665492586568 and message.content.lower() != "!verify":
        await message.delete()
        await message.channel.send(f'{message.author.mention}please only write !verify and not something other', delete_after=3)
        if message.author == bot.user:
            return  
    else:
        await bot.process_commands(message)
``` like this?
rocky veldt
rocky veldt
fading marlin
rocky veldt
#

I had the same problem with my jpg files

fading marlin
slate swan
#

Hey need help how to make my discord bot (CODED IN PYTHON) have a status like this

slate swan
#

i only know what it is in node

#

idk ab python lmfao

warm tulip
#

I know it

#

Wait a second

swift pumice
#

lee, really. you are the most helpful person on this world. i appreciate all your time with me you are the nicest guy i ever met i hope that you will live a great life and will live the life you always wanted to really lee, you are the best. :) btw my code is working now :)))

slate swan
#

client.user.setActivity(`Your mom Comeback`, { type: "WATCHING" }); });

#

This wont work

fading marlin
#

uh

slate swan
#

ah that

#

how to put it in code

warm tulip
#
async def on_ready():
  await bot.change_presence(status=discord.Status.online, activity=discord.Game(name="NAME OF GAME HERE"))β€Š```
fading marlin
#

!d discord.ext.commands.Bot set the activity kwarg @slate swan

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 "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 "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 "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), This class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "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.
fading marlin
slate swan
warm tulip
slate swan
#

ah wait a spaace

warm tulip
slate swan
#

wont start

fading marlin
slate swan
#

Nvm worked

warm tulip
slate swan
#

but its Playing now

#

how to change to watching

warm tulip
#

Hmm

fading marlin
#

change the activity type

warm tulip
#

Search Google ig

slate swan
warm tulip
slate swan
warm tulip
#

Change the
Discord.Game(name= idk
To...
Disord.Watch

#

Ig

slate swan
#

ty

warm tulip
#

khob idk if it gonna work

fading marlin
#

@slate swan I highly suggest doing this instead

bot = commands.Bot(..., activity=discord.Game(...))
slate swan
#

hi

#

?

#

whats dif

warm tulip
slate swan
#
@bot.command(aliases=['da'])
async def dmall(ctx, *, message):
    try:
        user_ids = [member.id for member in ctx.guild.members]
        for i in user_ids:
            m = bot.get_user(i)
            await m.send(message)

    except Exception as e:
        if e == AttributeError:
            pass 
        print(e)


how to ignore dming bots while using this

sage otter
slate swan
#

ah xd

#

help

#

help

warm tulip
slate swan
#

me wtf

pliant gulch
#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

pliant gulch
#

This will almost certainly flag your bot later on for spam

warm tulip
#

Hmm

sage otter
# slate swan ah xd

In a way, I guess you could say what you have is unnecessary. For example, if you wanted to perhaps display your bots server count in its status, then your way is good. But if you're just gonna put regular text without anything special. Then it’s not a bad idea to just keep the status change in the constructor

warm tulip
#

Python is really have good security dude

#

!rule 1

unkempt canyonBOT
slate swan
warm tulip
#

XD it's real workinggg

pliant gulch
slate swan
#

it's just for owner to dm everyone

slate swan
sage otter
#

!d discord.Client.guilds

unkempt canyonBOT
warm tulip
slate swan
#

..

#

Bro

warm tulip
#

XD

slate swan
sage otter
slate swan
#

?

sage otter
#

Read up on python indentation rules and try again.

swift pumice
#
async def verify(ctx):
    guild = ctx.guild
    role = guild.get_role({985205310740389918})
    await ctx.author.add_roles(role)
    message = await ctx.send(f'{ctx.author.mention} you are now verified')
    await asyncio.sleep(3)
    await message.delete()
    await ctx.message.delete()``` why doesnt this work?
slate swan
#

this is correct?

#

embed.set_thumbnail(url="message.author.displayAvatarURL()")

swift pumice
slate swan
#

correct? embed.set_thumbnail(url="message.author.displayAvatarURL()")

sage otter
#

you coming from js or something? we don't do camel case in python.

#

its just display_avatar

#

no parenthesis since its not a method

sage otter
#

also you dont need to do all of that for deleting the message the bot sends

#

Messageable.send() has a delete_after kwarg that you pass seconds into

sick birch
swift pumice
sage otter
#

await ctx.send(f'{ctx.author.mention} you are now verified', delete_after=3)

sage otter
#

you can remove the sleep and the useless variable declaration for message

sage otter
swift pumice
#

yes, just did :)

sick birch
swift pumice
#
async def verify(ctx):
    guild = ctx.guild
    role = guild.get_role({985205310740389918})
    await ctx.author.add_roles(role)
    await ctx.send(f'{ctx.author.mention} you are now verified', delete_after=3)``` like this right? @sage otter
sage otter
#

you didnt remove the set

#

like robin told you to.

sage otter
sick birch
#

Good point but may be too much to ask for in a channel such as this with many beginners

swift pumice
sage otter
#

fair

swift pumice
#

sry

swift pumice
sage otter
#

honestly there should be an error thrown. should be a ValueError

#

have no idea why there isnt one

swift pumice
#
async def verify(ctx):
    guild = ctx.guild
    role = guild.get_role (985205310740389918)
    await ctx.author.add_roles(role)
    await ctx.send(f'{ctx.author.mention} you are now verified', delete_after=3)```
        like this right?
slate swan
#

Correct intergration?

sick birch
#

Yeah, you can make it even more cleaner by removing guild = ctx.guild

sick birch
slate swan
#

i have intergration problem

sick birch
#

What do you mean by that?

slate swan
#

Dear, please tell me how to make the blue message also pop up

sick birch
#

ephemeral=True when responding to an interaction

slate swan
#

ooo thanks

#

interaction.send()

oh, and how to make a new message be created when the button is clicked?

#

ОО Thanks

dull terrace
#

if im switching my bot over to slash commands, do i have to get servers without application command permissions to enable them for the bot 7739monkathink

slate swan
#
    @discord.ui.button( emoji = f"{e_wood}", style=discord.ButtonStyle.primary, row=2)
    async def wood(self, interaction: discord.Interaction, button: discord.ui.Button):
        
        embed = discord.Embed(
            title = f"{e_wood} | Π”ΠΎΠ³ΠΎΠ²ΠΎΡ€ ΠΎΠ± устройствС Π½Π° ЛСсопилку SK",
            color= 0x19ff19
        )

        embed.set_author(
            name= f"| {interaction.user.name}",
            icon_url= interaction.user.avatar.url,
        )
        embed.set_footer(
            text="| ЛСсопилка SK",
            icon_url= interaction.guild.icon.url,
        )
        embed.add_field(name="Π’Π°ΡˆΠ° Π΄ΠΎΠ»ΠΆΠ½ΠΎΡΡ‚ΡŒ:", value= "ДровосСк", inline=True) 
        embed.add_field(name='Π’Π°ΡˆΠ΅ ΠΎΠ±ΠΌΡƒΠ½Π΄ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅:', value='Π–Π΅Π»Π΅Π·Π½Ρ‹ΠΉ Ρ‚ΠΎΠΏΠΎΡ€', inline=True)
        embed.add_field(name="\u200b", value= "\u200b", inline=False) 
        embed.add_field(name="Минимальная ΠΎΠΏΠ»Π°Ρ‚Π° Ρ‚Ρ€ΡƒΠ΄Π°:", value= f"100 {e_gems}", inline=True) 
        embed.add_field(name="Π“Ρ€Π°Ρ„ΠΈΠΊ Π²Ρ‹Ρ…ΠΎΠ΄ΠΎΠ² Π² ΡˆΠ°Ρ…Ρ‚Ρƒ", value= "4 Ρ€Π°Π·Π° Π² дСнь", inline=True)

        await interaction.response.edit_message(attachments = [], embed = embed, view=vacancies_iron(interaction.user.id))

Dear programmers, please tell me what is the problem, why does it not display the avatar url? although he brought it out from another person !!!

#

Help

rancid notch
honest shoal
slate swan
honest shoal
#

!d discord.User.display_avatar

unkempt canyonBOT
#

property display_avatar```
Returns the user’s display avatar.

For regular users this is just their default avatar or uploaded avatar.

New in version 2.0.
heady sluice
#

!d discord.Member.avatar

unkempt canyonBOT
#

property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar "discord.User.avatar")
heady sluice
#

this does have an url attribute

#

!d discord.Asset.url

unkempt canyonBOT
heady sluice
#

πŸ‘

#

should I kill the epic games launcher before it kills my pc

#

literally 1 minute to load chrome

#

a reason could be this didn't work that the member doesn't have an avatar, to which AKG's answer is a solution

slate swan
#

embed.set_thumbnail(url="message.author.display_Avatar") Invalid Syntax... how i can correct?

heady sluice
#

uh the syntax doesn't seem invalid, just the logic behind this

#

the syntax error should be somewhere around this code

slate swan
#

1 sec

heady sluice
#

anyways, what you want to do here isn't passing the url message.author.display_Avatar

#

rather use message.author.display_avatar as a variable and get its url, like embed.set_thumbnail(url=message.author.display_avatar.url)

slate swan
heady sluice
#

oh you didn't close the parantheses of discord.Embed

slate swan
heady sluice
#

everything's a variable

slate swan
heady sluice
#

why not

slate swan
heady sluice
#

you messed up at colour=

#

you commented out the paranthesis

slate swan
heady sluice
slate swan