#discord-bots

1 messages Β· Page 961 of 1

steady ember
#

need to send message but for in loop is taking much time to

#

send message to all webhooks

#

😦

pliant citrus
#

4 line await ctx.send(f'Successfully delete {amount} messages')

supple thorn
#

He already fixed it an hour ago

steady ember
#
webhook_list = []
for webhooks in webhook_list:
    try:
          book=Webhook(webhooks)
          print(book)
          book.send("Hello!")
    except:
          print("Invalid Hook")  
          pass```
pliant citrus
steady ember
#

This For method is taking much time what to do
I want to send it in like a sec!

maiden fable
supple thorn
#

!d discord.Webhook.send

unkempt canyonBOT
#
await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects to send.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.
maiden fable
#

That too

steady ember
#

yeah how to do in coroutine!

#

i tried its giving invalid syntax!

supple thorn
#

Await it

#

Also why are you using an exclamation mark everytime

steady ember
#

Idk πŸ˜…

#

await asyncio.gather(*coroutines)
^ SyntaxError: invalid syntax

supple thorn
maiden fable
#

Whole error plz

supple thorn
#

Above

steady ember
#

coroutines = [channel.send(embed=embed) for channel in fetchedchannel]
await asyncio.gather(*coroutines)

supple thorn
#

Probably

steady ember
#

i trying this method!

#

but How to adjust that Webhook(Hook)

steady ember
steady ember
#

but i though it can work for webhook too

#

Can you help please with eg how can i do it?

#

using coroutines

supple thorn
#

I cba to explain everything to him

little ivy
#

How do i make sure it prints when an option is chosen in the dropdown?

maiden fable
placid skiff
#

he can't subclass Bot how do you pretend he can subclass SelectMenu πŸ˜†

little ivy
maiden fable
maiden fable
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.
placid skiff
little ivy
placid skiff
#

and another fun fact
respond doesn't exist too D_D

maiden fable
placid skiff
#

see the capital i? yeah, when you code lowercase and uppercase matters

little ivy
#

Also doesnt work

little ivy
#

yeah, but its the interaction that gives an error

#

capital I or not, still the same error

placid skiff
#

yup still lowercase i

#

if the error is still there with the capital I then you're not using d.py 2.0

little ivy
final iron
#

Because

#

on_button_click doesn't exist

little ivy
heavy folio
#

uninstall discord-components

#

@little ivy

little ivy
#

Euh

#

yeah

wintry bronze
#

hello, im trying to make it look like this (with the persons avatar and on the bottom say who typed the command) but its only doing this (no avatar and it doesnt say who did the command on the bottom)

little ivy
gilded gust
#

hey, I have a quick question. Is the @task.after_loop run after every loop or after the loop is completed (as in after is stops/gets cancelled)

heavy folio
wintry bronze
#

ahhhh yeah didnt realise that

#

ty for the help :)

narrow grail
#

it sounds so simple but I don't get it how to do that

wintry bronze
maiden fable
#

Before string starts

#

f"{1}"

slate swan
#

Hunter is smart

wintry bronze
#

ahhh yeah, today is just full of brain farts lmao

slate swan
#

heya Skev

supple thorn
slate swan
supple thorn
little ivy
#

How do i install discord py 2.0.0 via terminal

slate swan
maiden fable
#

pip install git+https://github.com/Rapptz/discord.py @little ivy

little ivy
#

thx

#

is it a MUST to uninstall discord-components than?

maiden fable
#

Yes

little ivy
#

okay

slate swan
little ivy
maiden fable
maiden fable
slate swan
maiden fable
#

Lmao

supple thorn
#

Back to trying to learn js the way i did with python

little ivy
supple thorn
little ivy
#

I have these :/

maiden fable
supple thorn
little ivy
#

can i do that via terminal?

#

what do i need to type then

maiden fable
#

most of the people are using the outdated version who are waiting for 2.0 lmao

supple thorn
#

Hello yerlikaya how is the disnake community treating you

little ivy
#

Yeah, it cant find GIT

maiden fable
supple thorn
#

Lmao i also left the dpy server

proud rain
supple thorn
#

After seeing your encounter i searched for encounters like yours in the server

maiden fable
#

Lmao nvm

supple thorn
#

I found a ton

#

Also i'm in like 89+ servers

#

I don't even talk there or go there

#

So i might as well leave

wintry bronze
supple thorn
#

Yerlikaya about to go on a fishing spree

little ivy
maiden fable
#

I'll be the first one to DM I would love to see who DMs u the first πŸ‘€

little ivy
#

i do

#

i have git

#

powershell

#

okay

#

a what? Haha

supple thorn
#

A virtual environment

little ivy
#

nope

#

they do

#

but,
a dropdown or buttons wont work without that v2 version or what?

#

yeah i know, but how is it possible i still can sent button and dropdown messages than?

slate swan
#

buttons are components too

little ivy
#

so i can send those, but cant respond to the interactions?

slate swan
little ivy
#

so yeah, the problem isss: when i install the v2, my whole script wont work anymore

slate swan
little ivy
#

Okay...

#

But i still cant install that git thingy link

slate swan
# little ivy

i dont really understand that but....is your git version outdated or smth

#

your favourite server uwu

narrow grail
#

@hushed galleon minigame has not an attribute "bot"

slate swan
little ivy
slate swan
#

git

little ivy
slate swan
#

it means that git is not added to your PATH

little ivy
#

and how do i fix that

slate swan
little ivy
#

how do uninstall git πŸ˜‚

maiden fable
little ivy
#

Like this?

maiden fable
#

Mhm

slate swan
#

lmao

slate swan
#

select "you" ticket..

maiden fable
#

She dk the context

supple thorn
#

That's your context

slate swan
#

...

little ivy
#

Now i dont have anything named git anymore on my pc.

#

What now

#

πŸ‘

slate swan
#

tbh i'd just suggest installing github desktop

#

it installs git along with it easily

little ivy
#

oh really

#

lets do that, does it have to be in a specific folder?

slate swan
#

didnt you already download git though?

little ivy
#

i uninstalled it again

#

i now have github desktop

#

Still the same thing

maiden fable
#

I got a ghost ping

#

Haha

supple thorn
#

Do you want me to find one for you

wintry bronze
#
from cgi import print_form
from dis import disco
from http import client
from pydoc import cli, describe
from turtle import color, title
from unicodedata import name
import discord
import os
from discord.ext import commands

client = commands.Bot(command_prefix="!")

@client.command(aliases=['user','info'])
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member):
    embed = discord.Embed(title = member.display_name , description = member.mention , color = discord.Colour.red())
    embed.add_field(name = "ID" , value = member.id , inline = True)
    embed.set_thumbnail(url = member.avatar_url)
    embed.set_footer(icon_url= ctx.author.avatar_url, text= f"Requested by {ctx.author.name}")
    await ctx.send(embed=embed)

client.run(os.environ['TOKEN'])```
 
I want to add something so only a certain role can use the command, what do i do
supple thorn
unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

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

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")...
supple thorn
#

Use this check decorator

#

You can use the name of the role

#

But using the id is recommended

#

#bot-commands

slate swan
#

sry wrong channel

wintry bronze
granite parcel
#
@client.command()
async def img(ctx):
    imag = imag.new("RGB", (200,200) , (0,255,255))
    imag.save(format="PNG")   
    await ctx.send(file=discord.File("imag.png"))```
#

Command raised an exception: UnboundLocalError: local variable 'imag' referenced before assignment

#

?

#

please see

vale wing
#

You didn't define imag to call imag.new

#

Maybe you meant Image.new?

granite parcel
#

it isnt working still

little ivy
#

i hear v1 still supported for a year

granite parcel
vale wing
#

Did you even import it

flint widget
#

It must have given a different error now if you changed it to Image.new ?

vale wing
#

^

boreal ravine
#

Don't.

quaint epoch
#

if you edited it, you might as well have made it captitalized

granite parcel
granite parcel
#
Command raised an exception: UnboundLocalError: local variable 'image' referenced before assignment```
quaint epoch
#

you called on image before you assigned it

boreal ravine
granite parcel
#
@client.command()
async def img(ctx):
    image = image.new("RGB", (200,200) , (0,255,255))
    image.save(format="PNG")   
    await ctx.send(file=discord.File("image.png"))```
quaint epoch
#

an image object?

#

or a file obj

granite parcel
#

image

quaint epoch
#

because that's what my brain goes to

granite parcel
#

yeah

quaint epoch
#

hmmm

granite parcel
#

from PIL import Image

quaint epoch
#

time to dive in the docs

#

try this -

slate swan
quaint epoch
#

image.save(fp=r'./image.png', format="PNG")

granite parcel
#

i try it wait

boreal ravine
granite parcel
#

ahh f

#

i didnt saw that

boreal ravine
slate swan
quaint epoch
slate swan
slate swan
#

so if the image is a png for example then i'd be image.png.png

slate swan
#

its good for hiding dangerous executables

slate swan
slate swan
#

a normal device user wont

#

who doesnt know much about computers

#

not yet

#

it's useless however, windows will pick it up and also, it'll say on the side for example: windows executable

#

not possible yet

#

workarounds are possible

junior verge
#

Is there a way with heroku connected to a github repository to use database (Not mongodb)

slate swan
sick birch
#

CI/CD pipeline integration?

granite parcel
vale wing
#
image = Image.new(...)```
granite parcel
#

i did that

vale wing
#

And yeah you need to provide the path to save the image to

onyx solar
#

hello, can ask for help here?

placid skiff
#

What do you need?

slate swan
#

How to fetch the time of a message in PY?

Like:
Your message has been sent at (time when the message was sent)

vale wing
#

!d discord.Message.created_at

unkempt canyonBOT
granite parcel
#
@client.command()
async def img(ctx):
    image = Image.new("RGB", (200,200), (0,255,255))
    image.save(fp='./image.png', format="PNG")  
    dfile = discord.File(filename="image.png")
    await ctx.send(dfile)```
#

@vale wingsee

onyx solar
#

cant get member.activity correct

spring flax
onyx solar
#

@tasks.loop(seconds=5)
async def check_streaming():
await bot.wait_until_ready()
guild = await bot.fetch_guild(GUILD)
member = await guild.fetch_member(user_id)
print(member.status)

#

printed value is "offline"

spring flax
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

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

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

granite parcel
#

intent

onyx solar
#

i did

#

bot = commands.Bot(command_prefix='.', intents=discord.Intents().all())

spring flax
#

show code

granite parcel
spring flax
#

did you enable it on developer portal?

onyx solar
#

yea

#

also tried reinviting bot to server

#

the member is myself, and i am online

spring flax
onyx solar
#

yes

#

its running other commands

#

how can i share code?

#

cant link from pastebin

spring flax
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.

left crater
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

onyx solar
#
import os
import asyncio
import discord
from discord.ext import commands, tasks
from discord.utils import get
from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
user_id = os.getenv('discord_user_id')
member_state = ''
urls = ''


bot = commands.Bot(command_prefix='.', intents=discord.Intents().all())

@tasks.loop(seconds=5)
async def check_streaming():
    await bot.wait_until_ready()
    guild = await bot.fetch_guild(GUILD)
    member = await guild.fetch_member(user_id)
    print(member.activity)
    return


check_streaming.start()
bot.run(TOKEN)
left crater
#

bro

#

you cant have discord.Client and commands.Bot

#

choose one

onyx solar
#

client is not used, my bad left that trash

onyx solar
#

y

onyx solar
# onyx solar

i turned on this today. Maybe some time needed for it to be turned on

granite parcel
onyx solar
#

just wanted a feature that would link my yt stream in text channel, well maybe i should try another way. meh

cold sonnet
#

did you say meh

boreal ravine
#

meh

cold sonnet
#

πŸ₯³

cold sonnet
#

you have all intents just use get

onyx solar
#

i am not a big experienced one

cold sonnet
#

!d discord.Guild.get_member

unkempt canyonBOT
#

get_member(user_id, /)```
Returns a member with the given ID.

Changed in version 2.0: `user_id` parameter is now positional-only.
cold sonnet
#

needs member intents but you do have them

#

no?

#

get_guild

#

he has the guild in cache

#

he has every intent

unkempt canyonBOT
#

get_guild(id, /)```
Returns a guild with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
cold sonnet
#

he currently makes 2 api calls every 5 seconds

#

unnecessarily

onyx solar
#
    member = guild.get_member(user_id)```
spring flax
#

for member yes

onyx solar
#

tried like this

cold sonnet
#

yeah, but idrk the point

spring flax
#

!d disnake.Guild.getch_member

unkempt canyonBOT
#

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

Tries to get a member from the cache with the given ID. If fails, it fetches the member from the API and caches it.

If you want to make a bulk get-or-fetch call, use [`get_or_fetch_members()`](https://docs.disnake.dev/en/latest/api.html#disnake.Guild.get_or_fetch_members "disnake.Guild.get_or_fetch_members").
slate swan
#

wasn't it a thing?

cold sonnet
#

maybe, it hasn't for me yet

spring flax
slate swan
#

Oh hm makes sense

onyx solar
#

it returns AttributeError: 'NoneType' object has no attribute 'get_member'

spring flax
#

you can consider guild.getch_member as well

spring flax
#

Is that the right guild ID and is the bot in it?

onyx solar
#

yes

quaint epoch
#

how is this bookmark command?

onyx solar
#

fetch is ok with that

maiden fable
#

@slate swan get back to the anime pfp πŸ‘€

maiden fable
quaint epoch
slate swan
cold sonnet
#

hunter

maiden fable
cold sonnet
#

hunter's name was return Hunter if python === js

paper sluice
#

how do i send a dm through interactions, this doesn't work, it doesn't throw errors or anything

    @discord.ui.button(label='Book Mark Current', style=discord.ButtonStyle.green, emoji='πŸ”–')
    async def bookmark_current(self, interaction: discord.Interaction, button: discord.ui.Button):
        message = await interaction.user.create_dm()
        await message.send(embed=self.pages[self.current_page])

cold sonnet
#

which would throw an undefined and an else missing error

maiden fable
formal basin
#

How

quaint epoch
#

just get a member object and .send like usual

paper sluice
formal basin
#

How?

quaint epoch
paper sluice
#

nope

#

it just doesn't send, my dms are open too

quaint epoch
spring flax
#

i'm pretty sure ```py
guild = bot.get_guild() or bot.fetch_guild()

paper sluice
#

its not, normal dm command works it just the interactions

slate swan
quaint epoch
paper sluice
#

hmm that works

quaint epoch
onyx solar
cold sonnet
#

or await

onyx solar
#

and now if i am want to get member i use member = guild.get_member(user_id) right?

spring flax
#

!d discord.ext.commands.Bot.fetch_guild

unkempt canyonBOT
#

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

Retrieves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") from an ID.

Note

Using this, you will **not** receive [`Guild.channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.channels "discord.Guild.channels"), [`Guild.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.members "discord.Guild.members"), [`Member.activity`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activity "discord.Member.activity") and [`Member.voice`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.voice "discord.Member.voice") per [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member").

Note

This method is an API call. For general usage, consider [`get_guild()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_guild "discord.ext.commands.Bot.get_guild") instead...
nimble plume
#

how do i get a invite
guild = client.get_guild(851841115896152084)

lyric apex
#

How to do this that every time the thumbail image changes as color value change

quaint epoch
#

well, not from a guild directly

#

you need to get it from a channel

nimble plume
#

how?

quaint epoch
#

so (await (client.get_guild(851841115896152084).channels[0].create_invite())).url

#

in condensed form

nimble plume
#

ok let me try

quaint epoch
#

or just so (await (guild.channels[0].create_invite())).url

lyric apex
#

@quaint epoch lemon_zipped see mine

quaint epoch
#

i guess you can use PIL

#

!d PIL.Image

unkempt canyonBOT
quaint epoch
#

it should allow you to change the color of it by rgb values

lyric apex
#

I tried once

quaint epoch
#

πŸ₯„ = ❌

#

you'd do image = PIL.Image.new(color=int)

onyx solar
#

Holy jeez

#

i found it

quaint epoch
#

then just save the image, load it in the embed, then delete it after

nimble plume
#

r: 'coroutine' object has no attribute 'url' @quaint epoch

onyx solar
#
user_id = int(os.getenv('discord_user_id'))```
quaint epoch
onyx solar
#

now i have working bot.get_guild

#

without transforming env values to int get_guild didnt worked

nimble plume
#

how to leave a server from id

quaint epoch
nimble plume
#

ok

onyx solar
#

ty for help guys

#

u are crazy here

#

cya

nimble plume
#

invite = await self.bot.get_guild(g.id).channels[0].create_invite().url

nimble plume
#

?

quaint epoch
#

you can't await .get

#

it isn't a coroutine

nimble plume
#

oh

quaint epoch
#

.fetch is

nimble plume
#

so i remove await

quaint epoch
#
invite = (await (self.bot.get_guild(id_here).channels[0]).create_invite()).url
#

there

nimble plume
#

unknown channel

#

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10003): Unknown Channel

nimble plume
# quaint epoch show the full traceback

Ignoring exception in command sld:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 169, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/nuker-1/utility.py", line 160, in sld
invite = (await (self.bot.get_guild(g.id).channels[0]).create_invite()).url
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/abc.py", line 1160, in create_invite
data = await self._state.http.create_invite(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/http.py", line 416, in request
raise NotFound(response, data)
disnake.errors.NotFound: 404 Not Found (error code: 10003): Unknown Channel

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

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot_base.py", line 570, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 920, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/core.py", line 178, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10003): Unknown Channel

quaint epoch
#
guild = self.bot.get_guild(id=id_here)
channel = guild.channels[1]
invite = await channel.create_invite()
invite_str = invite.url
#

i guess doing it on one line would be unnecessary

nimble plume
#

ok

quaint epoch
#

welp, i gotta go outside now

#

cya

scarlet sorrel
#

how do i use

secud = (". ".join([f"{msg.content}"async for msg in\
message.channel.history(limit=int(1))][::-1])).lower()

but instead of 1 message or 2 messages it just gets the entire channel?

scarlet sorrel
#

ah

#

thanks!

cosmic agate
#

hello

#

i have a problem

#
@bot.event
async def on_member_join(member):
      embed= nextcord.Embed(title= "Welcome!", description=f"**Hello {member.mention}!**\nWelcome to **{member.guild.name}**!", color=nextcord.Colour.random())
      embed.set_image(url="https://c.tenor.com/Ch4VFEjuI7IAAAAC/anime-boy.gif")
      welcome=member.guild.system_channel
      await welcome.send(f"Hey {member.mention}",embed=embed)
#

this is my welcome event

#

this works on 1 bot

#

but doesnt work on the other

little ivy
#

short question, how do i get a message id?

#

not in discord

little ivy
#

but in script

scarlet sorrel
little ivy
#

thx

scarlet sorrel
#

np

slate swan
glacial willow
#

MEMBER OBJECT HAS NO ATTRIBUTE ADD ROLES? WHAT

slate swan
#

How can I use disable_all_buttons() in my command function, instead of waiting for someone to press a button

tawdry perch
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
slate swan
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

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

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

formal basin
#

Anyone know how I can make it so it gets the channel name instead of channel id

E.g channel = client.get_channel(942450268585472051) how can I make that for channel name instead of id

frozen patio
#

Hello, the error is for the boxed-in line **User** object is not iterable

left crater
unkempt canyonBOT
#

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

Retrieves a [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel"), [`abc.PrivateChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.PrivateChannel "discord.abc.PrivateChannel"), or [`Thread`](https://discordpy.readthedocs.io/en/master/api.html#discord.Thread "discord.Thread") with the specified ID.

Note

This method is an API call. For general usage, consider [`get_channel()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_channel "discord.ext.commands.Bot.get_channel") instead.

New in version 1.2.

Changed in version 2.0: `channel_id` parameter is now positional-only.
formal basin
left crater
#
    print(g.name)```
#

thats prob not the best way tho

formal basin
slate swan
formal basin
#

Yes

formal basin
#

Thanks

frozen patio
#

I am making a dashboard for my bot

#

Then how can I make it iterable

#

I am trying to get this to run πŸ˜„

#

But the User object is not iterable

slate swan
# frozen patio

you shouldnt put a slash after the endpoint name in routes

frozen patio
#

I did

slate swan
#

dont mind me but...well

slate swan
frozen patio
#

So if I remove it

#

Would it run?

#

I am trying to get the guilds that a user are in

#

with the manage_guild permission

#

So you can set a prefix inside the dashboard

slate swan
frozen patio
#

OH

#

Ok I changed this

#

This should work I think

cosmic agate
#

oh ok

frozen patio
#

Nextcord

#

Now my permissions parameter is broken

#

Well, 'Permissions' object has no attribute 'manage_server'

#

I did

slate swan
#

πŸ˜”

frozen patio
#

I am using discord-quart, and I installed nextcord-ext-ipc

#

And that worked

#

Cause it's manage_guild OHHH

#

Breh

maiden fable
#

Modules used to make dashboards

frozen patio
#

Yeah

maiden fable
#

ipc -> Inter Process Communication

frozen patio
#

Yes

#

I have a permission error, somehow

cosmic agate
#
Traceback (most recent call last):
  File "main.py", line 238, in <module>
    bot.run(SIKE U THOUGHT TOKEN WAS HERE HEHE)
  File "/home/runner/Romba/venv/lib/python3.8/site-packages/nextcord/client.py", line 730, in run
    return future.result()
  File "/home/runner/Romba/venv/lib/python3.8/site-packages/nextcord/client.py", line 709, in runner
    await self.start(*args, **kwargs)
  File "/home/runner/Romba/venv/lib/python3.8/site-packages/nextcord/client.py", line 673, in start
    await self.connect(reconnect=reconnect)
  File "/home/runner/Romba/venv/lib/python3.8/site-packages/nextcord/client.py", line 614, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
nextcord.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.
ξΊ§ 172.18.0.1 - - [07/Apr/2022 15:38:38] "GET / HTTP/1.1" 200 -
#

can someone help?

frozen patio
#

Enable intents

slate swan
frozen patio
#

Nice

cosmic agate
quaint epoch
#

eh

#

random ping?

maiden fable
slate swan
#

i think

maiden fable
#

Nah

#

He fixed it anyways

frozen patio
#

No Not this one

maiden fable
#

Wym

hollow plover
#

how to disable all buttons in a view when they press one?

slate swan
#

!d discord.Member.guild_permissions

unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
maiden fable
frozen patio
slate swan
maiden fable
#

!d discord.Permissions.manage_guild @frozen patio

unkempt canyonBOT
frozen patio
#

manage_guild doesn't work either

hollow plover
#

ah self.children thats what im looking for thanks

maiden fable
#

!d discord.ui.View.stop

unkempt canyonBOT
#

stop()```
Stops listening to interaction events from this view.

This operation cannot be undone.
hollow plover
slate swan
# frozen patio manage_guild doesn't work either

You're trying to check if they have manage server prms? Right basically you need to check the user (the one who connected to the website) if they have perms in the (user.guilds) and then you'll need to eh put those guilds in a list or whatever you're going to do. So it will shows those guilds (the user that has perms in) in the dashboard

Idk how to explain tho

hollow plover
#

this is prob easier

maiden fable
cosmic agate
#

ik

hollow plover
#

so what about frontend

slate swan
hollow plover
#

like the ui

cosmic agate
#

so how to fix?

maiden fable
cosmic agate
#

oh frix

frozen patio
#

No changing it to user did not work sadly

slate swan
#

You're trying to check if they have manage server prms? Right basically you need to check the user (the one who connected to the website) if they have perms in the (user.guilds) and then you'll need to eh put those guilds in a list or whatever you're going to do. So it will shows those guilds (the user that has perms in) in the dashboard

Idk how to explain tho

hollow plover
#

ty

frozen patio
#

I have the list part made

#

Yes

#

I am 100% sure

maiden fable
#

!d nextcord.Client.fetch_user is what u r looking for

unkempt canyonBOT
#

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

Retrieves a [`User`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.User "nextcord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

This method is an API call. If you have [`nextcord.Intents.members`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Intents.members "nextcord.Intents.members") and member cache enabled, consider [`get_user()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Client.get_user "nextcord.Client.get_user") instead.
frozen patio
#

Yea

#

I didn't see it

#

Sorry

slate swan
#

Yesbb_dshy

#

Wait

maiden fable
#

Why uninstal tho

lament mesa
#

use -U to update

nimble plume
#

what does this mean

#
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 60003): Two factor is required for this operation
frozen patio
#

You might need 2 Factor Authentification enabled on your account

nimble plume
#

its bot

#

oh

slate swan
#

To use some features with a bot it requires the bot owner to have 2FA enabled to their account, just as a side note. So it might be that you do not have 2FA on your account and you try to do something with your bot that requires it.

dull sorrel
#

Is there any way to get what song is someone playing on spotify?

#

Like someone is listening to a song, I want to get the name of that song and send a message based on that.

slate swan
#

You can get the member's activities and see the Spotify activity.

#

A quick search on the documentation will let you know how to get the member's activities.

dull sorrel
#

All right.

maiden fable
#

bro, it will update the 1.7.3 installation

sick birch
#

"missing 1 required keyword-only argument: 'intents'

#

I don't think it can be more clear

maiden fable
#

wait what? that is a required kwarg now?

boreal ravine
#

looks like it yes

sick birch
#

That's what I was thinking

maiden fable
#

Bro show yr commands.Bot

#

@slate swan

#

u need intents=discord.Intents.default() in the commands.Bot

hoary cargo
#

πŸ—Ώ where you put the intents

lyric apex
hoary cargo
#

do you use anything that might require privileged intents? like members intent, presence or message ?

final iron
#

Why is the command prefix a tuple?

cold sonnet
#

why not

hoary cargo
#

why would be a list

#

then go to developer portal and enable them, then enable through code

final iron
slate swan
#

I'm trying to learn cogs and that comes up

maiden fable
#

self, ctx

slate swan
#

thanks

hoary cargo
final iron
hoary cargo
#

i just said that mikedone

boreal osprey
#
@bot.event
async def on_message(message):
    if "didn't ask" in message.content:
        message=message.channel
        await message.send("nobody cares if you didn't ask")
        
        if message.author.id == bot.user.id:
            return;

    await bot.process_commands(message)

it is still spamming the same message even though i added if statement for the message author

hoary cargo
final iron
hoary cargo
final iron
#

.

boreal osprey
hoary cargo
#

here he does πŸ—Ώ

final iron
slate swan
#

can i do something like this?

async def test(ctx, arg):
    if len(arg) >= 5:
        ...
    else:
        ...
#

so if arg is over 5 letters

final iron
#

Sure

slate swan
#

is it the correct code for it?

slate swan
#

Is there a way to get a list of DMS

hoary cargo
#

wdym list of dms? whose dms

slate swan
hoary cargo
#

!d discord.DMChannel.history

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
hoary cargo
#

i guess?

slate swan
#

Tnxdown_syndromesmile

hoary cargo
#

there's also

#

!d discord.DMChannel.fetch_message

unkempt canyonBOT
#

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

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
frozen patio
#

I still cannot understand this error.

slate swan
#

now i want to make a command that says what current language (cog) is loaded, but idk how to do the if statement to that

If the cog german was loaded it should say that its language is german

if the cog wasnt loaded it should say that its language is english

#

this is not in a cog

slate swan
frozen patio
hoary cargo
unkempt canyonBOT
#

exception discord.ext.commands.ExtensionAlreadyLoaded(name)```
An exception raised when an extension has already been loaded.

This inherits from [`ExtensionError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.ExtensionError "discord.ext.commands.ExtensionError")
frozen patio
#

It's getting VERY annoying.

slate swan
frozen patio
slate swan
frozen patio
#

It is guild, I checked the docs

frozen patio
#

It's the dashboard page itself that is not

slate swan
frozen patio
#

I installed nextcord-ext-ipc

#

and it all logged in successfully

#

It's the dashboard page right here that is being a pain

slate swan
frozen patio
#

But it is very broken

slate swan
frozen patio
#
  1. the bot isn't even in these servers
#
  1. I can edit any of them
frozen patio
slate swan
frozen patio
#

😐

#

And all 92 servers I am in pop up

slate swan
frozen patio
#

That permission line is KEY to this bot

#

also I got an error when I clicked on 1 of them :/

slate swan
#

Dashboard is a pain in the ass😭

frozen patio
#

100%

#

But it is possible

sick birch
slate swan
neat field
#

[(None,)] hi how would i conert this to a string?

sick birch
#

It's only a pain when you make it one

slate swan
sick birch
#

It's a pain when you use things like flask or whatever to do it

frozen patio
slate swan
sick birch
#

Nah. Use tailwind πŸ˜‰

frozen patio
#

Who are you saying Nah to?

sick birch
#

Saad

frozen patio
#

Oh

sick birch
#

Dashboard is very easy and enjoyable if you pick the right tools

frozen patio
#

I am using Python an HTML

slate swan
frozen patio
#

It's the Python that's being dumb

sick birch
sick birch
#

Very handy because it's universally agreed on that CSS sucks

slate swan
sick birch
spring flax
#

for **kwargs, it's a dictionary right? So you can do if something not in kwargs or kwargs["something"] = something

sick birch
#

You can do that, yes

#

!e

def test(*args, **kwargs):
  print("hello" in kwargs)

test(hello="world")
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

True
frozen patio
#

@sick birch (sorry for ping)
But like this permission line is having an attribute error, And if I remove it does work but I got all 92 servers I am in

sick birch
#

Which line?

#

if guild.permissoins.manage_guild?

frozen patio
stuck oyster
#

How do I get the date a channel was created at

spring flax
#

!d discord.TextChannel.created_at

unkempt canyonBOT
sick birch
#

What error is it giving you?

spring flax
frozen patio
dull terrace
#

So i have this bot that is this big game but i want an npc you interact with that you can play a mini game with but im not sure what to do

#

texas holdem maybe but all these regular ideas seem so boring to me

stuck oyster
dull terrace
#

i might just copy pasta some code

sick birch
#

I'm not seeing anypermission property on discord.Guild

frozen patio
#

Cause I am using nextcord

spring flax
sick birch
#

That shouldn't change

frozen patio
#

I named the client discord

slate swan
#

nvm ignore

sick birch
#

It doesn't make sense for a guild to have permissions

slate swan
#

my bad

dull terrace
sick birch
#

A user, text channel, or a role may have permissions

dull terrace
#

it's kind of like an extra thing to add some diversity

slate swan
frozen patio
dull terrace
#

a game within the gamee

stuck oyster
slate swan
sick birch
#

You need to check if the current logged in user has certain permissions for a guild

#

I did exactly this for my dashboard now that I remember

dull terrace
frozen patio
#

I want to check for manage_guild

dull terrace
#

and nothing seems to excite me, like adding chess or whatever feels dumb

sick birch
#

Yes. You need to get a user's current guilds and its permissions integer

#

That's what I did

frozen patio
sick birch
#

I used the raw API which returned a list of guild objects along with the permisisons a user had

frozen patio
#

Yeah but I do not want to break the rest of this

sick birch
#

Then checked if that was > 32 since 32 is the manage guild integer

frozen patio
#

What?

#

Ik the number for it

sick birch
#

Also discord doesn't have a fetch_guilds method

spring flax
frozen patio
#

But I am surprised it does not run how it is cause it should πŸ€”

sick birch
#

One is for the get current user guilds endpoint

frozen patio
sick birch
#

One is for getting all your bot's guilds

sick birch
#

nextcord doesn't naturally have that endpoint since it has to do with oauth

#

You're gonna have to interact with the raw API here there's no other way

spring flax
#

given the guild object is guild and the user object is member, you need if member.guild_permissions.manage_guild:

#

!d discord.Member.guild_permissions

unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
spring flax
#

right now you're just doing guild.permissions.manage_guild

sick birch
#
// All guilds where both and bot and user are in, and the user has the manage server permission.
async function getValidGuilds(botToken: string, userToken: string) {

    const userGuilds = await getCurrentGuilds(userToken, 'Bearer');
    const botGuilds = await getCurrentGuilds(botToken, 'Bot');
    
    const botGuildIDs = botGuilds.map(guild => guild.id);
    let guilds: CurrentUserGuilds = []

    for(const userGuild of userGuilds) {
        if(botGuildIDs.includes(userGuild.id))
            if(parseInt(userGuild.permissions) >= 32) // manage server permission
                guilds.push(userGuild);
    }

    return guilds;

}

i hope this points you in the right direction since it's exactly what you're doing

hybrid ravine
#

what’s the method for giving everyone in a guild a certain role?

sick birch
frozen patio
#

I changed I changed guild --> user

spring flax
#

iterating through members

sick birch
#

Watch out for rate limits

tired hinge
#

can anyone tell me how to get the nick of message author rq

#

i forgot-

unkempt canyonBOT
dull terrace
sick birch
tired hinge
dull terrace
#

is name just username without discrim?

hybrid ravine
sick birch
dull terrace
#

πŸ€” you right

hybrid ravine
dull terrace
#

i usually keep everything similar everywhere so never thought about it

sick birch
sick birch
#

Of course it's TS

maiden fable
#

You cannot code a discord bot in assembly that easily

sick birch
#

I wish

#

Guess you can write it in C and compile

maiden fable
#

I don't think so

sick birch
#

Assembly is terribly hard to write anything in

#

It's way too imperative

maiden fable
#

@slate swan u should start, Robin will join u

sick birch
#

You probably need to tell it how to put bits on the network

frozen patio
#

How does User have no attribute to Permissions

sick birch
maiden fable
frozen patio
#

Oh

sick birch
#

Also you're gonna wanna use the raw API for your dashboard

#

Get current guilds has everything you want

frozen patio
#

But I never defined member in my code

sick birch
frozen patio
#

I can define it in an @app.route correct?

sick birch
#

Define what?

frozen patio
#

member

slate swan
#

What

sick birch
#

You need to somehow obtain a member object

frozen patio
#

Doing nextcord.Member in an async def

sick birch
#

Are you using Oauth2 for a user to log in to your dashboard?

frozen patio
#

Yeah using my bot invite link

slate swan
sick birch
#

Then you should have their bearer token, yes?

frozen patio
#

I have the client secret and the bot token yeah

sick birch
#

I'm talking about a user's bearer token

#

You should have their token when they log in

frozen patio
#

I got this error when I did that

#

defined member

sick birch
#

This really isn’t gonna work out that well with nextcord classes

frozen patio
#

Well Somehow I found myself watching a yt tutorial

#

And it all worked for them just like that

sick birch
#

Because YouTube tutorials are pretty bad and somehow work even with bad code

#

Best to follow proper procedure with oauth flow in accordance with discord documentation

frozen patio
#

I will try this in JavaScript ig :/

#

I prefer Python

#

Thank you for trying to help me

quaint epoch
#

average yt python discord bot tutorial:

Hello friends today we will be hosting a bot
To start, click the github repository in the description, and host.
You now have a working mod bot!
(clicks link) 404
(goes to waybackmachine) last wrapper version is alpha 0.1, uses deprecated fork.
bruh

frozen patio
#

Ikr

tired hinge
#

how can i check who is mentioned in a message?

#

mentioned as in pinged

scarlet sorrel
#

How would I do an asynchronous while loop inside a bot command that can be stopped by another command?

tired hinge
#

got it, nevermind.

hybrid ravine
#

im not sure if that would work in python

#

but it does in other langs

scarlet sorrel
#

hmm

sick birch
frozen patio
sick birch
#

Both front and back

frozen patio
#

Yeah

sick birch
#

Making a dashboard in js is a lot more fun and easier

frozen patio
#

Ima watch a 61-part video

sick birch
#

Mmm

frozen patio
#

gonna take me like a few weeks to do this

sick birch
#

Next.js is great for this

#

File based routing for one

frozen patio
#

Yeah

#

Should we talk somewhere else robin

sick birch
#

Sure, where would you like

slate swan
frozen patio
torn sail
sick birch
#

Yeah, send me a req and I’ll accept it

frozen patio
hoary cargo
scarlet sorrel
torn sail
#

!bot-vars

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

torn sail
#

while bot.var:

#

Although it would be messy

#

It best to just use bot.wait_for

sick birch
hybrid ravine
#

how do i check if a role has a certaiun permission?

unkempt canyonBOT
quaint epoch
#

yup

#

but there is also PermissionsOverwrite for channels

slate swan
#

I mean, they asked about a role

quaint epoch
#

no i didn't

#

anyway, Permissions_obj.ban_members = bool

#

you can check it like that

stuck oyster
#
        for i in range(5, -1, -1):
            embed1 = discord.Embed(description=f"Deleting in {i} seconds...", color=0xb92222)
            await ctx.channel.send(embed=embed1)```
How can I make it edit instead of sending new embeds
quaint epoch
stuck oyster
quaint epoch
#

because editing an embed in a message, await message_obj.edit(embed=embed1)

hybrid ravine
dull terrace
#

Do most non-coders call guilds servers instead?

dull terrace
#

i've been calling servers guilds all through my code and someone was confused by it

quaint epoch
dull terrace
#

and now... 2.6k lines of code to squint through

stuck oyster
quaint epoch
dull terrace
#

because searching for "guild" and changing it is not...

quaint epoch
#

where did you send the first message?

dull terrace
stuck oyster
quaint epoch
#

you sent a previous message, and you want to EDIT the embed in that message, right?

hybrid ravine
#

ty πŸ™‚

quaint epoch
#

show me the line where you sent the message

#

like, the message you want to edit later on

stuck oyster
#
        for i in range(5, -1, -1):
            embed1 = discord.Embed(description=f"Deleting in {i} seconds...", color=0xb92222)
            await ctx.channel.send(embed=embed1)```
quaint epoch
#

ie - py message1 = await ctx.send('this is a message') # first message await asynio.sleep(1) # wait one sec message1 = await message1.edit(content='this message has been edited') # the message has now been edited

cold sonnet
stuck oyster
stuck oyster
#

well that is what I want to edit

quaint epoch
#

are you trying to edit the embed?

stuck oyster
#

yes

quaint epoch
#

or the message?

#

you just said the message before

stuck oyster
#

embed there is no message

stuck oyster
quaint epoch
#

okay, just send over the full command

stuck oyster
#
        embed = discord.Embed(description="Deleting ticket in 5 seconds...", color=0xb92222)
            
        for i in range(5, -1, -1):
            embed1 = discord.Embed(description=f"Deleting ticket in {i} seconds...", color=0xb92222)
            await asyncio.sleep(5)
            await embed.edit(embed=embed1)```
cold sonnet
#

you can give the pizza without a box

quaint epoch
stuck oyster
#

I said I was editing the embed at first

quaint epoch
#
        embed = discord.Embed(description="Deleting ticket in 5 seconds...", color=0xb92222)
        message1 = await ctx.send(embed=embed)
            
        for i in range(5, -1, -1):
            embed.description = f'deleting in {i} seconds'
            await asyncio.sleep(1)
            message1 = await message1.edit(embed=embed)```
quaint epoch
cold sonnet
#

don't make a new embed instance every time in the for loop

cold sonnet
#

just edit embed's description

#

and use ctx.send instead of ctx.channel

quaint epoch
#

oh yeah, you can do that

cold sonnet
#
        embed = discord.Embed(description="Deleting ticket in 5 seconds...", color=0xb92222)
        message1 = await ctx.send(embed=embed)
            
        for i in range(5, -1, -1):
            embed.description = f"Deleting ticket in {i} seconds..."
            await asyncio.sleep(1)
            await message1.edit(embed=embed)
quaint epoch
#

alr

cold sonnet
#

everything I do is good

quaint epoch
#

and embed is the nice looking bubble

#

a message, is the thing that holds that bubble

slate swan
quaint epoch
#

when you edit a message, you can change what the bubble looks like

cold sonnet
#

ey wassup with it tho

stuck oyster
#

Alright I understand now

slate swan
cold sonnet
#

start using await, stop using ctx.channel.send

slate swan
#

but seriously? bubble?

cold sonnet
#

please

quaint epoch
#

they both return the same object

cold sonnet
quaint epoch
slate swan
hoary cargo
cold sonnet
#

the ctx.channel one

quaint epoch
#

it's about the drive, it's about the power, we stay hungry we devour

quaint epoch
hoary cargo
cold sonnet
quaint epoch
hoary cargo
#

πŸ—Ώ so this is how the app discovery will look i guess

cold sonnet
#

pretty sure dank memer has more than 200 sends in a minute

quaint epoch
#

and they'll just get a 429

quaint epoch
cold sonnet
quaint epoch
#

yes in that case, you'd want to condense everything into one line

#

:)

cold sonnet
#

no?

quaint epoch
#

yes

cold sonnet
#

one liners save long time memory

#

less variables save ram

#

more variables if used correctly save time

sick birch
#

One of the reason a lot of people say whitespace based language are a bad idea

#

With brace-based languages such as Java or javascript, it can be minified

quaint epoch
#

not a lot im betting

#

especially with the servers dank memer runs on

#

oh fuq

#

i had geo this entire time and i did not pay attention

cold sonnet
#

three vars per function with using 500 async functions running

quaint epoch
#

gtg

quaint epoch
cold sonnet
#

you just told us to be real yert

quaint epoch
#

only read chad programmers use binary

#

oh fuck

#

this is a research assignment

#

i need to go now cya

#

it was fun arguing

cold sonnet
#

yeah, if you gotta write everything many times it can be weird

#

in every single way possible

#
with open("file.txt", "r", encoding="utf-8") as file: print(valami := "A leghosszabb nevek:" if (lista := list(filter(None, [line.split(" : ")[0] if len(line.split(" : ")) != 1 else None for line in file.readlines()]))).sort(key=len) is None else "", "\n", "\n ".join(list(filter(lambda x: (len(x) == len(lista[-1])), lista))))

πŸ˜„

#

don't even need valami var do I

#

ey I just saved a var

#

πŸ˜„

cold sonnet
#
with open("file.txt", "r", encoding="utf-8") as file: print("A leghosszabb nevek:" if (lista := list(filter(None, [line.split(" : ")[0] if len(line.split(" : ")) != 1 else None for line in file.readlines()]))).sort(key=len) is None else "", "\n", "\n ".join(list(filter(lambda x: (len(x) == len(lista[-1])), lista))))
```better now
#

what you can do in one print is fascinating

stiff nexus
#

bots cant get changes in on_user_update if the user is bot.user?

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

cold sonnet
#

bot.user is literally your bot

#

you know when your bot changes in your code

#

you use disnake and discord in one code?

#

choose one and leave the other

#

but updating dpy might save your time

#

oh like in the dev portal?

#

it's mostly just changing discord to disnake or disnake to discord

ashen notch
#

Weird question: I'm wanting to make a server bootstrapping script. One that will let people layout a server layout (categories, channels, roles, etc) as a script to make it easier to develop for the Python bot. I was wondering if anyone knew of a way to test something like that without having to actually make x number of guilds during testing. Anyone know of anything like that?

cold sonnet
#

I don't think discord has a feature like that to test bots

#

maybe somebody else

ashen notch
#

Lame

cold sonnet
#

they both have everything now

#

so it's up to what you prefer

#

but using both doesn't work well

hoary cargo
cold sonnet
#

or faster and more stable

#

don't ask which

#

I have no idea

#

I prefer the original lib

hoary cargo
#

pycord is a banned word here pls

cold sonnet
#

lmao

ashen notch
#

To each their own

hoary cargo
#

admins lurking waiting to punish people be like πŸ—Ώ

ashen notch
#

They aren't actually serious

ashen notch
quaint epoch
ashen notch
#

Lurking to see if anyone has any insight

unkempt canyonBOT