#discord-bots

1 messages Β· Page 685 of 1

visual island
#

"iirc"

snow flare
#

@visual island

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

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

For some reason I am getting this error because of the intents:

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.
snow flare
tacit horizon
#

help ._.

snow flare
#

nvm, I found it @visual island

visual island
tacit horizon
visual island
#

yea i know that, but what issue

heavy folio
#

oh

tacit horizon
quaint epoch
#

So, when i call on the help command(now, i haven't made one myself but it appeared anyway) a list of all the commands is sent, my code doesn't have this in it? Why did it send it?

heavy folio
#

the help command is default

quaint epoch
#

oh

heavy folio
quaint epoch
#

but then how do i show how to use each command

heavy folio
#

command description?

quaint epoch
quaint epoch
#

how do i show command description, idk how because i didn't make the command

valid barn
#
@client.command()
async def buy(ctx, *itemm):
  actualitem = {}
  for i in range(len(shopp)):
    if itemm in shopp[i]["name"]:
      actualitem = shopp[i]
      break
print('works')
print(actualitem)

how to fix error?

heavy folio
#

@visual island also how do i get the command with its args

visual island
unkempt canyonBOT
heavy folio
#

like it's purge [limit] here in the base help

visual island
heavy folio
#

oh

tacit horizon
visual island
#

learn

valid barn
heavy folio
# tacit horizon i have no idea about OOP

There's a difference between a class and an instance. Think of it like this:

  • A class is like a blueprint, or a concept. It defines what something should have, but it's not the same as actually having it.
  • An instance is the 'realized' version of the class, it contains everything that the class defines should be on it, but you can actually access and interact with these features.

Let's consider the Cat. We know a Cat has a name and an age, but Cat.age won't work, because Cat isn't an actual cat, it just represents the concept of a cat. It's like asking "What is the age of a cat?" - it doesn't make sense, because we need to have an actual cat.

mimi on the other hand is an instance of a Cat - it has everything a Cat should have. Maybe mimi was constructed, like mimi = Cat("Mimi", age=4), or maybe mimi was retrieved from somewhere else, like house.cats[0], but in any case, it has everything we need, and mimi.age will rightfully give us 4.

There are many situations in Object Oriented Programming where you will need an **instance **instead of a **class **to perform an operation properly (in fact, you almost always need an instance instead of a class), and these cases will usually be documented.
You should learn a good amount about Object Oriented Programming before working extensively with discord.py.

https://i.imgur.com/dHYdejb.png

Read more about classes and instances here:

Credit: devon

slate swan
quaint epoch
valid barn
# slate swan item is a tuple
shopp = [
  {"name":"item1","price":3000,"description":"somedescription"},{"name":"iitem2","price":500,"description":"desc"}
]
```i set it to be a dict tho.. ? :(
visual island
#

itemm not shopp

#

*args returns a tuple

#

in your case *itemm will return a tuple also

heavy folio
#

how do i get the bot descriptio

valid barn
visual island
#

!e

def foo(*itemm):
   print(itemm) 
foo(1, 2, "hi") 
unkempt canyonBOT
#

@visual island :white_check_mark: Your eval job has completed with return code 0.

(1, 2, 'hi')
valid barn
#

how do i turn it into a str?

quaint epoch
#

is there a character limit on commands? Because the documentation i wrote myself is around 7000 chars

visual island
#

make it ctx, *, itemm instead of ctx, *itemm

valid barn
#

ohkk ty

visual island
#

ah, number of commands?

#

nah

quaint epoch
heavy folio
#

how do i get the bot description

#

nvm bot.description

slate swan
#

i want to make a nsfw command

visual island
#

I dont get what you mean by "using commands"

slate swan
#

its working perfectly, but the problem is

if ctx.channel.is_nsfw:``` wont work and its still sending the nsfw shit in non-nsfw channels
#

can anybody help?

visual island
#

show full code

heavy folio
#

icy do you have an example of a group command help in your bot

#

need some inspiration disgust

slate swan
# visual island show full code
@client.command()
async def boobs(ctx):
    channel = ctx.channel
    if channel.is_nsfw:
            r = requests.get("https://nekos.life/api/v2/img/boobs")
    res = r.json()
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(res['url']) as resp:
                image = await resp.read()
        with io.BytesIO(image) as file:
            await ctx.send(file=discord.File(file, f"boobs.gif"))
    except:
        em = discord.Embed()
        em = discord.Embed(color=0)
        em = discord.Embed(title="Nsfw")
        em.set_image(url=res['url'])
        await ctx.send(embed=em)
    else:
        await ctx.send("WOAH! SLOWDOWN BUD! THIS CHANNEL AINT NSFW.")
        return```
#

FULL bot code is over 300 lines

slate swan
#

server doesnt support .txt files

slate swan
slate swan
quaint epoch
slate swan
visual island
quaint epoch
#

Well, what errors do you have?

quaint epoch
heavy folio
#

i think that'd work

slate swan
slate swan
#

why self in command tho

heavy folio
#

it's outside of it

heavy folio
slate swan
quaint epoch
#

so, returning would cancel the command

slate swan
#

ok ill try it

visual island
heavy folio
#

anyways else would be redundant since you have a return already

heavy folio
visual island
#

just put everything inside the if statement

heavy folio
visual island
#

or that

heavy folio
visual island
#

!custom-check works also

unkempt canyonBOT
#

Custom Command Checks in discord.py

Often you may find the need to use checks that don't exist by default in discord.py. Fortunately, discord.py provides discord.ext.commands.check which allows you to create you own checks like this:

from discord.ext.commands import check, Context

def in_any_channel(*channels):
  async def predicate(ctx: Context):
    return ctx.channel.id in channels
  return check(predicate)

This check is to check whether the invoked command is in a given set of channels. The inner function, named predicate here, is used to perform the actual check on the command, and check logic should go in this function. It must be an async function, and always provides a single commands.Context argument which you can use to create check logic. This check function should return a boolean value indicating whether the check passed (return True) or failed (return False).

The check can now be used like any other commands check as a decorator of a command, such as this:

@bot.command(name="ping")
@in_any_channel(728343273562701984)
async def ping(ctx: Context):
  ...

This would lock the ping command to only be used in the channel 728343273562701984. If this check function fails it will raise a CheckFailure exception, which can be handled in your error handler.

heavy folio
#

ah yes

heavy folio
#

what doesnt work

slate swan
#

i tried making it

@client.command()
async def boobs(ctx):
    channel = ctx.channel
    if channel.is_nsfw:
            r = requests.get("https://nekos.life/api/v2/img/boobs")
    res = r.json()
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(res['url']) as resp:
                image = await resp.read()
        with io.BytesIO(image) as file:
            await ctx.send(file=discord.File(file, f"boobs.gif"))
    except:
        em = discord.Embed()
        em = discord.Embed(color=0)
        em = discord.Embed(title="Nsfw")
        em.set_image(url=res['url'])
        await ctx.send(embed=em)
    if not channel.is_nsfw:
        await ctx.send("WOAH! SLOWDOWN BUD! THIS CHANNEL AINT NSFW.")
        return```
quaint epoch
slate swan
slate swan
quaint epoch
heavy folio
#

at the top

#

you dont need the if statement in line 4 anymore

#

bring last 3 lines up

slate swan
#

sitll sends

quaint epoch
# slate swan i tried making it ```py @client.command() async def boobs(ctx): channel = ct...
@client.command()
async def boobs(ctx):
    channel = ctx.channel
    if channel.is_nsfw:
      r = requests.get("https://nekos.life/api/v2/img/boobs")
    else:
      await ctx.send("WOAH! SLOWDOWN BUD! THIS CHANNEL AINT NSFW.")
       return 
    res = r.json()
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(res['url']) as resp:
                image = await resp.read()
        with io.BytesIO(image) as file:
            await ctx.send(file=discord.File(file, f"boobs.gif"))
    except:
        em = discord.Embed()
        em = discord.Embed(color=0)
        em = discord.Embed(title="Nsfw")
        em.set_image(url=res['url'])
        await ctx.send(embed=em)
``` try this
slate swan
quaint epoch
slate swan
#

bro

#

u messed the code

#

res and try would be above else

quaint epoch
slate swan
#

No

#

else should be at last

#

this your first time? huh

slate swan
quaint epoch
#

i don't use embeds tho

slate swan
#

@visual island help

slate swan
slate swan
#

ye i did that

heavy folio
#

send code + error

slate swan
# heavy folio send code + error
@client.command()
async def boobs(ctx):
    channel = ctx.channel
    r = requests.get("https://nekos.life/api/v2/img/boobs")
    res = r.json()
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(res['url']) as resp:
                image = await resp.read()
        with io.BytesIO(image) as file:
            await ctx.send(file=discord.File(file, f"boobs.gif"))
    except:
        em = discord.Embed()
        em = discord.Embed(color=0)
        em = discord.Embed(title="Nsfw")
        em.set_image(url=res['url'])
        await ctx.send(embed=em)
    if not channel.is_nsfw:
        await ctx.send("WOAH! SLOWDOWN BUD! THIS CHANNEL AINT NSFW.")
        return```
heavy folio
#

your not kidding right

visual island
#

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

slate swan
#

no

heavy folio
heavy folio
slate swan
slate swan
heavy folio
#

lmao

slate swan
#

What the heck is happening

quaint epoch
#

!ot

unkempt canyonBOT
slate swan
quaint epoch
#

images of the images of messages

slate swan
slate swan
quaint epoch
#

:Asin_pepe: is not on topic

#

darn

slate swan
quaint epoch
#

didn't work

slate swan
#

is this boy serious

quaint epoch
slate swan
quaint epoch
slate swan
slate swan
#
@client.command()
async def boobs(ctx):
    channel = ctx.channel
    r = requests.get("https://nekos.life/api/v2/img/boobs")
    res = r.json()
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(res['url']) as resp:
                image = await resp.read()
        with io.BytesIO(image) as file:
            await ctx.send(file=discord.File(file, f"boobs.gif"))
    except:
        em = discord.Embed()
        em = discord.Embed(color=0)
        em = discord.Embed(title="Nsfw")
        em.set_image(url=res['url'])
        await ctx.send(embed=em)
    if not channel.is_nsfw:
        await ctx.send("WOAH! SLOWDOWN BUD! THIS CHANNEL AINT NSFW.")
        return``` is my code and i want it to only happen if the channel is nsfw but it sends on normal channel too
quaint epoch
slate swan
#

do u want the server invite?

quaint epoch
slate swan
#

ok

#

@slate swan help

#

@rugged steeple can u help me

quaint epoch
#

so, does it send the file then say that the channel isn't nsfw?

rugged steeple
#

On a other note, try to split up your code into separate functions.
A simple example using your code -

def async send_file(ctx, res, filename) -> None:
   async with aiohttp.ClientSession() as session:
            async with session.get(res['url']) as resp:
                image = await resp.read()
        with io.BytesIO(image) as file:
            await ctx.send(file=discord.File(file, filename))

def async Emd(dis):
   embeds = {"color": 0, "title": "NSFW"}
   em = dis.Embed()
   [em := dis.Embed(k, v) for k, v in embeds.items()]
   return em

@client.command()
async def boobs(ctx):
    channel = ctx.channel
    if channel.is_nsfw:
            r = requests.get("https://nekos.life/api/v2/img/boobs")
    res = r.json()
    try:
        send_files(ctx, res, "boobs.gif")
    except:
        em = Emd(discord)

        em.set_image(url=res['url'])
        await ctx.send(embed=em)
    if not channel.is_nsfw:
        await ctx.send("WOAH! SLOWDOWN BUD! THIS CHANNEL AINT NSFW.")
        returnβ€Š

β€’ Obviously this could be simplified further, its just an example.
β€’ Tried to keep true to your original code as much as possible.

boreal ravine
unkempt canyonBOT
#

@discord.ext.commands.is_nsfw()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the channel is a NSFW channel.

This check raises a special exception, [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") that is derived 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 [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure"). DM channels will also now pass this check.
slate swan
#

With is_nsfw()

boreal ravine
#

what i just sent

slate swan
#

Hard on mobile

slate swan
tawdry perch
#

Uh?

slate swan
#

i removed it

quaint epoch
#

so, py @client.command() @commands.check(channel.is_nsfw=True) async def blank(ctx):?

slate swan
quaint epoch
#

then what?

slate swan
#

but we would have to DEF it

slate swan
#

@boreal ravine it worked but i want it to send a message if it aint nsfw pls help

dense walrus
#

What's the discord.ui class for a button to send a message when clicking it?
Talking about discord.py 2.0

boreal ravine
unkempt canyonBOT
#
Naw.

No documentation found for the requested symbol.

boreal ravine
#

!d discord.Interaction

unkempt canyonBOT
#

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

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

New in version 2.0.
slate swan
visual island
#

what

boreal ravine
#

!d discord.Interaction.response

unkempt canyonBOT
#

Returns an object responsible for handling responding to the interaction.

A response can only be done once. If secondary messages need to be sent, consider using followup instead.

slate swan
#

oh OK I GOT IT

boreal ravine
#

gj

dense walrus
boreal ravine
#

or r u using something else

dense walrus
#

oh so I can get an interaction when pressing

#

right

#

for example I found in the github repo:

  @discord.ui.button(label='Confirm', style=discord.ButtonStyle.green)
    async def confirm(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.response.send_message('Confirming', ephemeral=True)
slate swan
#

Are you trying to send a message on interaction?

slate swan
#

Well thats correct

#

thanks ! @boreal ravine

boreal ravine
slate swan
#
@boobs.error
async def boobs_error(ctx, error):
    if isinstance(error, commands.CheckFailure):
        await ctx.send("Yo! Nsfw not allowed in this channel bro!")
        return``` worked for error
dense walrus
# slate swan Well thats correct

Yeah, so imagine I have 5 buttons on one message, how can I check what button has been pressed to send the specific message needed?

slate swan
slate swan
#

If thats what you want to do

dense walrus
slate swan
#

You subclass View and you add each button to the sub class and then you view the class on the Message you want the buttons on

dense walrus
#

okay I think I got it let me try, thank you

slate swan
valid barn
#

not an error/issue but i was wondering, this code right here

try:
    for i in range(len(shopp)):
      if itemm in shopp[i]["name"]:
        actualitem = shopp[i]
        break
  except:
    await ctx.send(embed=discord.Embed(description="that item doesn't exist! Check `m.shop` for more."))
    return
```how do i make it so that, after the `for` loop is done and it still hasn't seen `itemm` in `shopp[i]["name"]` it raises an error?
#

also there a way to get a role object using client.get-?

boreal ravine
#

!d discord.Guild.get_role

unkempt canyonBOT
valid barn
#

ok ty

boreal ravine
#
class pogs(disnake.ui.Select):
  def __init__(self):
    options = []
    
    for cog in bot.cogs:
      options.append(disnake.SelectOption(label=cog.qualified_name, description=cog.description))

  super().__init__(placeholder="pick!",min_values=1,max_values=1,options=options,)
  async def callback(self, interaction: disnake.MessageInteraction):
        await interaction.response.send_message('yes')

class v(disnake.ui.View):
  def __init__(self):
    super().__init__()
    self.add_item(pogs())

await ctx.send('a', view=v())
``` im getting `RuntimeError: super(): no arguments` for some reason
sick birch
#

You need to do super.init on the select as well

boreal ravine
sick birch
#

Oh just saw that

boreal ravine
#

hm

sick birch
#

Can you post the full traceback?

#

I’ve never actually seen that before

boreal ravine
sick birch
#

Oh I see

#

See if it works without jsk, it might be that

#

Because code LGTM

boreal ravine
#

hm

boreal ravine
sick birch
#

looks good to me

boreal ravine
#

o

snow flare
#

I am trying to make a verification system using the on_raw_reaction_add function, and it all works correctly, whenever the user reacts to the "verification" message with the check mark emoji, he gets granted a role, which grants him access to the rest of the server, so it all works. But if the user decides to leave the server, he loses his role, but the reaction is still there on the message. So if he wants to rejoin, he will have to remove the reaction, and then add it again

#

Is there some kind of function which can remove the reaction if the user leaves the server?

snow flare
sick birch
#

Check if the user that left has a reaction, if so, remove it

snow flare
boreal ravine
#

@sick birch my bad the super was outside the __init__ dunder

#

why am I getting this? ```py
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ui/view.py", line 367, in _scheduled_task
await item.callback(interaction)
File "main.py", line 25, in callback
await utils.HelpCommand().send_cog_help(cog)
File "/home/runner/bonbons-1/utils/help_command.py", line 88, in send_cog_help
await self.send_help_embed(
File "/home/runner/bonbons-1/utils/help_command.py", line 70, in send_help_embed
icon_url=self.context.author.display_avatar,
AttributeError: '_MissingSentinel' object has no attribute 'author

tawdry perch
#

display.avatar?

#

wait

boreal ravine
#

?

tawdry perch
#

I had a idea but nvm

boreal ravine
#

ok

tawdry perch
#

what is "_MissingSentinel"?

boreal ravine
#

it isn't even in my code

tawdry perch
#

self.context.author is like ctx.author?

slate swan
#
@bot.command()
async def text(message):
    with open('image_urls.txt', 'r') as f:
        lines = f.readlines()
        g = random.choice(lines)
        e = discord.Embed(title='hello',
                          description='** tyfor Voting Me Here Is The Reward**', color=0xcf24ff)
        e.set_image(url=f'{g}')
        user = await bot.fetch_user(message.content)
        await user.send(embed=e)```
it only sends text but no image
boreal ravine
#

!d discord.ext.commands.HelpCommand.context

unkempt canyonBOT
boreal ravine
#

yes

tawdry perch
#

does the user have default pfp?

tawdry perch
#

icon_url=self.context.author.avatar.url if yes, that should work

slate swan
boreal ravine
tawdry perch
#

try the code and if it does not work and same error is given, then I have no idea

slate swan
boreal ravine
tawdry perch
#

give it a try

boreal ravine
#

but like that isnt the problem

snow flare
#

how can I see all the reactions of a particular message?

boreal ravine
#

works fine

boreal ravine
unkempt canyonBOT
tawdry perch
snow flare
slate swan
boreal ravine
#
msg = ...
print(msg.reactions)
boreal ravine
#

that embed does not look like the code you sent

slate swan
# boreal ravine that embed does not look like the code you sent

i know cuz its long look at dis

@bot.listen()
async def on_message():
if message.channel.id !=898872072762195999:
      return    
    with open('image_urls.txt', 'r') as f:
        lines = f.readlines()
        g = random.choice(lines)
        e = discord.Embed(title='Hello, Goshujin-sama',
                          description='**Arigato Gosaimushta for Voting Me Here Is The Reward**', color=0xcf24ff)
        e.set_image(url=f'{g}')
        e.set_footer(text='Goshujin-sama The Above Image Is Fan-Art By Its Respective Anime Community, I or Creator-Sama Has 0 Contributions In It')
        user = await bot.fetch_user(message.content)
        await user.send(embed=e)```
raven gust
solar ridge
#

Interested in your feedback.

boreal ravine
#

L

slate swan
#

god fucking damn why does await guild.create_text_channel('fuckyou') creates 5 fuckyou channels

raven gust
boreal ravine
#

it's probably in a loop of some

raven gust
#

the class

slate swan
#

nope

#

cant be a loop

boreal ravine
#

it cant create 5 channels for no reason

#

unless its in a loop of some kind

boreal ravine
# raven gust whatever is around line 70
    async def send_help_embed(self, title, description, commands):
        embed = HelpEmbed(title=title, description=description or "...").set_footer(
            text="Use help [command] or help [category] for more information.",
            icon_url=self.context.author.display_avatar,
        )

        if filtered_commands := await self.filter_commands(commands, sort=True):
            for command in filtered_commands:
                embed.add_field(
                    name=self.get_command_signature(command),
                    value=command.help or "...",
                )

        await self.send(embed=embed)
slate swan
raven gust
boreal ravine
boreal ravine
raven gust
#

show me the class too

boreal ravine
#

which part

slate swan
# boreal ravine show your code around the method
            for guild in client.guilds:
                for channel in guild.channels:
                    if "adxbot-dm" in str(channel):
                        embed = discord.Embed(title="DM already open!", description="Wait for closing", color=0xFF0000)
                        await message.channel.send(content=None, embed=embed)
                        cmd = "a!dm open"
                    elif "adxbot-dm" not in str(channel):
                        await guild.create_text_channel('adxbot-dm')
boreal ravine
#

what did I say.

slate swan
#

"elif"

boreal ravine
slate swan
#

it should stop the loop right there

boreal ravine
#

the elif gets called multiple times ig

slate swan
#

if the channel already exists it stops the loop

#

where

boreal ravine
slate swan
#

and you don't need a condition

#

you can just do else

#

ik I added it just to make sure

#

aight well I have added break in the first if

#

and this logic is really bad

#

well no shit its made in message.content not command kek

#

it makes a channel for every channel in the list that comes before adxbot-dm

snow flare
slate swan
#

my code is a mess but it works

#

only if the very first channel is the dm channel, right?

boreal ravine
unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Examples

Usage

```py
# I do not actually recommend doing this.
async for user in reaction.users():
    await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
slate swan
#

could imagine something like

snow flare
boreal ravine
#

discord.Message.reactions returns a discord.Reaction object, just use the users attribute on your reactions attr earlier

boreal ravine
#

like you wanna check?

slate swan
#

if any("string" in channel.name for channel in guild.channels)

snow flare
snow flare
slate swan
#

first line of the tag

#

returns an Asynciterator

boreal ravine
boreal ravine
unkempt canyonBOT
slate swan
#

wait bad tag

snow flare
slate swan
#

reactions returns a list

boreal ravine
#

yes my bad

slate swan
#

you can index that list in order to get a reaction object

#

so:
message.reactions[0].users

#

.flatten()
is used most of the time on users

#

!d discord.Reaction.users

unkempt canyonBOT
#

async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.

The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

Examples

Usage

```py
# I do not actually recommend doing this.
async for user in reaction.users():
    await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
boreal ravine
#

yes

slate swan
#

oh users is a method

boreal ravine
#

kinda weird how it isnt a property

slate swan
#

don't really know

#

I'm thinking about how this could be better

boreal ravine
#

hm

slate swan
#

storing it in the cache isn't gonna be near to practical

sullen shoal
#

might just be the discord api being weird

proven osprey
#

guys how to put custom stickers in a buttons? is it possible?

#

im trying, but..)

valid barn
#

how to create new role?

manic wing
unkempt canyonBOT
#

await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

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

All fields are optional.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to do this.

Changed in version 1.6: Can now pass `int` to `colour` keyword-only parameter.
manic wing
proven osprey
#

i want to make like this

boreal ravine
unkempt canyonBOT
#

property emoji: Optional[discord.partial_emoji.PartialEmoji]```
The emoji of the button, if available.
boreal ravine
#

!d discord.ui.button

unkempt canyonBOT
#

discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.

The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View"), the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") being pressed and the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/api.html#discord.Interaction "discord.Interaction") you receive.

Note

Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
boreal ravine
#

it has an emoji kwarg you can use, just put the emoji + id in there and it'll work

proven osprey
#

thank you very much!

boreal ravine
#

πŸ‘Œ

manic wing
boreal ravine
manic wing
#

mmmm

valid barn
sinful pasture
#

How can I make my bot Dm a user when they send a specific message

#

For example: $help
Dms stuff ye

valid barn
# boreal ravine an int

i did this:

@client.command()
async def add(ctx, hexx, *, name):
  await ctx.author.guild.create_role(name = name, color = int(hexx))
  await ctx.send("added!")

error:

boreal ravine
#

a

sinful pasture
boreal ravine
#

no idea

manic wing
#

so int(num, 16)

manic wing
#

makes it int with base 16 - hex

boreal ravine
manic wing
#

in int, yeah

boreal ravine
#

hm

valid barn
valid barn
verbal cairn
#

Anyone good with dropdown menus?

sinful pasture
#

bruh that's it wat

valid barn
sinful pasture
#

message.author.send
Is that actually it

manic wing
#

!d discord.Member.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

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

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

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

how can you list all members with a specific role given

manic wing
unkempt canyonBOT
shadow wraith
#

i thought it was if role in ... or something

#

is it possible to list all the members with a specific role using in

#

sorry i worded that badly :P

manic wing
#

[k for k in guild.members if role in k.roles]

shadow wraith
#

so for <role_obj> in ctx.guild.members or the whole thing

valid barn
#

how do i turn a tuple into a list

shadow wraith
#

oh wait

manic wing
valid barn
#

ok ty

manic wing
#

!e py my_list = [1, 2, 3] print(tuple(my_list))

unkempt canyonBOT
#

@manic wing :white_check_mark: Your eval job has completed with return code 0.

(1, 2, 3)
lament mesa
valid barn
shadow wraith
#

!e

my_tuple = (1,2,3)
if 1 in my_tuple:
  print("test")
unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

test
manic wing
valid barn
#

okk

raven gust
#

yes

manic wing
#

think of it as a list

#

only different is you cant edit the contents

valid barn
#

ty

cloud dawn
unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

10
boreal ravine
#

i never knew you could do that

tawdry perch
#

hm what is the type of k in that case?

#

tuple?

boreal ravine
cloud dawn
tawdry perch
#

Yep, int

cloud dawn
#

tuple unpacking

tawdry perch
#

I ran in bot commands

#

so you stored values in tuple, but if you want to access that value it's same as you would have done ```py
a, b, c = 1, 2, 3

kindred epoch
#

is there a way i can have an image below a field?

cloud dawn
#

!source

unkempt canyonBOT
boreal ravine
cloud dawn
unkempt canyonBOT
#

property image: _EmbedMediaProxy```
Returns an `EmbedProxy` denoting the image contents.

Possible attributes you can access are...
valid barn
kindred epoch
cloud dawn
#

It's called tuple unpacking

boreal ravine
kindred epoch
kindred epoch
cloud dawn
crimson tendon
#

how can I delete all categories and channels with the same start of name ? for example
all categories and channels that start with ge are removed by the bot

lament mesa
#

you can iterate through guild.channels and check if the name starts with ge

crimson tendon
cloud dawn
lament mesa
cloud dawn
crimson tendon
cloud dawn
unkempt canyonBOT
#

class discord.abc.GuildChannel```
An ABC that details the common operations on a Discord guild channel.

The following implement this ABC...
nimble bobcat
#

hey please help me

#

i creating socket server

#

and listen datas

#

i add thread

#

how to call async function inside a thread

#

i try this but not work

lament mesa
#

why are you using threading and asyncio? pithink

nimble bobcat
#

sorry for my bad english πŸ˜„

#

i create socket server

#

i read my game server chat

velvet tinsel
#

Is this discord bots

nimble bobcat
#

yes

#

but this screenshot has nothing to do with discord

nimble bobcat
manic wing
velvet tinsel
#

alright

velvet tinsel
nimble bobcat
#

ok sir 1 min

manic wing
nimble bobcat
#

why πŸ˜„

manic wing
#

typically threading is used for non-synchronous code

#

!pypi asyncwebsockets

unkempt canyonBOT
nimble bobcat
#

this is not websocket

#

this is normal socket

nimble bobcat
manic wing
#

!pypi pip install sockio

unkempt canyonBOT
#

The PyPA recommended tool for installing Python packages.

manic wing
#

crap

#

!pypi sockio

unkempt canyonBOT
nimble bobcat
#

i reading

#

ceaden

#

socketio or sockio

#

Is there a difference

#

and is there a server example?

velvet tinsel
#

Server example?

nimble bobcat
#

server code

#

socket server example

velvet tinsel
#

!pypi socketio

unkempt canyonBOT
velvet tinsel
#

They seem different

#

I don’t know much about socket though 😳

nimble bobcat
#

me too πŸ˜„

manic wing
#

same

#

wtf is a socket xD

nimble bobcat
#

this is my first discord bot project

hollow lodge
#

Socket is used for the communication of two machines

nimble bobcat
hollow lodge
#

Oh sorry couldn't notice it was sarcasm πŸ˜…

manic wing
nimble bobcat
#

yes

#

i love python

#

i dont love javascript

#

but if it continues like this i will love javascript more πŸ˜„

#

nodejs

lament mesa
#

!pypi python-socketio

unkempt canyonBOT
supple summit
nimble bobcat
#

gta sanandreas online mod

supple summit
#

ik

#

i mean i want to make same thing in bot console

#

but im not going to

supple summit
#

who knows if its legal or not

#

using bot to read all the server chats bot is in

nimble bobcat
#

not legal

supple summit
#

actually i can make it with a setting

#

if admins enable message logging setting the messages will log in console

#

still illegal i guess

#

its probably the same as "we value your privacy" in many apps

#

or something
idk

nimble bobcat
#

πŸ˜„

pulsar moth
#

Hello , how are you !

I'm working on a discord bot using discordpy , I just learn today than it's not up to date any more and It's better to use a fork

#

which one do you advise me ?

sick birch
#

It’s really just personal preference

#

I don’t like any of the forks, so I prefer to use the base discord.py

#

You can implement slash commands yourself quite easily

sick birch
pulsar moth
cloud dawn
unkempt canyonBOT
pulsar moth
dire folio
#

Does anyone know how to make reaction roles that saves the data to a db

supple summit
slate swan
#

!pypi

unkempt canyonBOT
#
Missing required argument

package

#
Command Help

!pypi <package>
Can also use: pack, package, pip

Provide information about a specific package from PyPI.

slate swan
#

!pypi phlib

unkempt canyonBOT
slate swan
#

how

dire folio
#

...

sullen shoal
#

can you stop searching shitty libs here, use #bot-commands

sullen shoal
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.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

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

This function returns the **first event that meets the requirements**...
sullen shoal
#

depends tbh

#

you might want

slate swan
#

how do I use embed.set_image(url=videurl)

#

I mean how do I use it as a video

sullen shoal
#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
dire folio
#

I think ik how to do the reaction role bit but idk how to save stuff to db

sullen shoal
sullen shoal
dire folio
#

I think I'll do smth else instead

#

How would I do an application system

sullen shoal
#

application bot system?

dire folio
#

I was thinking of smth else while typing and accidentally wrote bot lol

sullen shoal
#

whats application system

dire folio
#

You know those bots that send questions in dms and stuff when you do a command

sullen shoal
#

you would still use the Bot.wait_for method for the most part

dire folio
#

K

#

How do I create a dm with a user?

manic wing
#

!d discord.User.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

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

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

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

gonna be straight, what's easier to use between discord.py and discord.js?

quaint epoch
#

hey guys how would i check if a member is online if i have the member object?

tawdry perch
quaint epoch
#

!d discord.Member.status

unkempt canyonBOT
#

property status: discord.enums.Status```
The member’s overall status. If the value is unknown, then it will be a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") instead.
quaint epoch
#

huh?

tawdry perch
#

There ya go

quaint epoch
#

no it shows a status

#

i need to see if they are online

tawdry perch
#

Oh

supple summit
#

try activity

#

or something

#

i dont know

tawdry perch
#

Isn't status either online, offline, idle, dnd?

simple gulch
#

What would be the easiest way to implement a feature into my bot that would give a role after x number of messages in the past 24 hours?

simple gulch
tawdry perch
#

Then that is exactly what you should use @quaint epoch, right?

tawdry perch
#

It's worth to try, shall the docs page might tell me

upbeat otter
#

!d discord.Member.status ?iggl

unkempt canyonBOT
#

property status: discord.enums.Status```
The member’s overall status. If the value is unknown, then it will be a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") instead.
upbeat otter
quaint epoch
cold sonnet
slate swan
#

how do you remove the default help command?

final iron
#

A guide can be found here:

brazen raft
#

help_command=None as an option in discord.ext.commands.Bot()

slate swan
#

Imagine not making your own help commandpy_guido

tawdry perch
#

I borrowed mine

dire folio
#

how would i send a dm to a user with their id?

#

put smth in the on_ready

#

the bot event

#
@bot.event
async def on_ready():
  #whatever u want here
#

bot can be client

#

depending on what u put earlier

brazen raft
#

Bot status can be changed in the constructor

cold sonnet
#

no

cold sonnet
dire folio
#
@bot.event
async def on_ready():
  await bot.change_presence(status=discord.Status.online,activity=discord.Game("with Essence")
  print("Playing with Essence")
slate swan
#

message.clean_content.lower.startswith("TEST") Should this work?

dire folio
#

?

cold sonnet
#
  1. status is online defaultly
#
  1. stop changing status in on_ready
dire folio
#

it was just incase they wanted to change it

#

to idle or dnd

slate swan
#

Dont

cold sonnet
dire folio
#

oh yh u should prob use bot.wait_until_ready

cold sonnet
#

oh god

#

wait_until_ready in on_ready

dire folio
#

i forgot the thingy

cold sonnet
#

I'm dying help me

dire folio
#

fine

#

what should they do then?

cold sonnet
#

okay sorry I'll stop being like that

slate swan
#

Changing a bots presence on ready can make it disconnect as its an atomic action discord doesnt like when you sent a request and the bot isnt even connected fully with the gateway might not disconnect but after i think some tries you will get disconnected

cold sonnet
#

as stated three times above

slate swan
sage otter
#

Where you construct your commands.Bot instance

slate swan
#

can you transfer ownership to a bot?

#

cuz bots can create servers

#

how does that work

modest plover
#

You can't transfer ownership I don't think

#

Plus bots can't make servers

#

They can make channels inside servers and categories n shit but they can't create a new server

final iron
modest plover
#

Since when?

final iron
#

No idea

#

Theres a very small limit though

modest plover
#

I didn't know they could make a new server

manic wing
#

they can

modest plover
#

I thought they could only make channels n shjt

manic wing
#

if the bot is in less than 10 servers it can make a server

modest plover
#

How?

wide shale
#

How do I invite the python bot to my server

modest plover
#

On your application

#

On the discord Dev website

wide shale
#

How will it work

#

What will I have to do?

modest plover
#

On there, pick your application, go to OAuth, URL gen then pick bot

#

There, exactly what I did, you go to the link you copied

dire folio
#

how would i start a new line in an embed

slate swan
modest plover
#

Oh

slate swan
#

Which you cant invite him since its only for this server

modest plover
#

I thought he meant a bot made in python

#

xD

slate swan
dire folio
#

woudl it be inside the ''

modest plover
#

Yes

dire folio
#

ty

slate swan
unkempt canyonBOT
#

Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

manic wing
#

what is your host?

craggy cloak
slate swan
unkempt canyonBOT
#

Hey @harsh abyss! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

slate swan
#

You have to chill out rn

craggy cloak
slate swan
#

Your being ratelimited youll have to wait

slate swan
craggy cloak
#

O ok stupid thx

slate swan
#

Not sure but i think its like 2

slate swan
harsh abyss
#

im tryna run it and that blue text pops up idk how to fix it

slate swan
#

And its not an error its the path of the file

harsh abyss
#

well it dosent let me run it

slate swan
#

Nice

harsh abyss
#

so i cant test out the bot cause it dosent go online

slate swan
#

Add the token

harsh abyss
#

i did

#

u just cant see it]

slate swan
#

Show your run

harsh abyss
#

wym

#

i press run then the blue text pops up

slate swan
#

How are you running your bot

harsh abyss
#

client.run

brazen raft
#

Check line 41

harsh abyss
#

and it was all working before and i used the bot but then ia dded the intents and it stopped working

slate swan
#

Seems like its not right since its giving a syntax error

brazen raft
#

From what I can see in the traceback you have a bit of your bot's token outside of the method .run()

harsh abyss
#

dont have any

slate swan
#

Should be in the run as so:

client.run("oejtntkfjn")
harsh abyss
#

its not the token cause that already worked its when i added the intents part

slate swan
#

Show

dire folio
#

do you have to use intents?

slate swan
harsh abyss
#

im using it for what im doing

dire folio
#

what are u doing?

harsh abyss
#

making a discord bot

slate swan
harsh abyss
#

idk wtf that is

dire folio
#

its towards the top of screenie

slate swan
#

Or your whole code would be great

harsh abyss
#

wym your whole

slate swan
harsh abyss
#

let me cross out my token

slate swan
#

Or copy paste it here without the token

harsh abyss
#

alr

#

ill send it

dire folio
#

they put

intents = discord.Intents.default()
#

thats their var

dire folio
#

i meant their

harsh abyss
slate swan
dire folio
#

lol that's mb

slate swan
#

Its in the on_member_join event

dire folio
#

ye thats why it doesn't come online

harsh abyss
#

still dosent work

slate swan
#

Show

harsh abyss
#

wait let me put the token back in

dire folio
#

lmao

slate swan
dire folio
#

you do kinda need the token

slate swan
harsh abyss
#

Still didnt work

dire folio
#

is there an error?

slate swan
harsh abyss
slate swan
harsh abyss
#

i put the token back in and the same thing popped up

#

i did unident it

slate swan
#

Mb

#

Weird i forgot what that error meant

harsh abyss
#

then if i re indent it the blue text comes back up

dire folio
#

is that the whole error?

harsh abyss
#

nah it scrolls up more

#

and then its the blue text

dire folio
#

send the whole error

sage otter
#

That’s definitely not the full error

harsh abyss
#

then its jsut that error if i indent it

slate swan
#

I forgot what it ment

harsh abyss
#

it happened to me once and i just forgot a semicolon

#

idk its weir

#

d

dire folio
#

i haven't used vs code in a while so don't quote me on it

harsh abyss
#

its not cause when i used to run it like yesterday it didnt work

slate swan
#

Show the full tb

#

Not full

dire folio
#

there is no way that is full

slate swan
#

All the traceback

dire folio
#

it can't be that short

harsh abyss
#

i can send the full thing but its really long

sage otter
#

Did you type it out yourself or something?

slate swan
sage otter
#

The fuck is raceback

dire folio
#

lmao

slate swan
#

Or in_run_e

harsh abyss
#

should i use something else the vs code

dire folio
#

no vs code = good

harsh abyss
#

ok

slate swan
harsh abyss
#

alr

sage otter
#

Not as good as PyCharm tho smilebutcryinside

slate swan
dire folio
#

i've never used PyCharm

slate swan
slate swan
#

Looks dead to me

harsh abyss
#

& 'C:\Users\milky\AppData\Local\Microsoft\WindowsApps\python3.10.exe' 'c:\Users\milky.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\lib\python\debugpy\launcher' '63205' '--' 'c:\Users\milky\code\practice bot\bott.py'
PS C:\Users\milky\code>

#

thats the error

slate swan
#

Oof its 3.10

sage otter
#

Py 3.10 is nice. It gots match case.

harsh abyss
#

is 3.10 bad

final iron
#

Are you seriously using the interpreter from Microsoft store?

slate swan
#

From my experience 3.10 isnt great

slate swan
harsh abyss
#

i had to download it from the microsoft store cause it said i didnt have python

sage otter
harsh abyss
#

even though i litteraly had python open

slate swan
sage otter
#

Yes

slate swan
#

Bruhyert

sage otter
#

PyCharm Community is free but professional you need a jet brains license.

final iron
slate swan
#

Ah i seeyert

final iron
#

JetBrains releasing data spell really killed jupyter notebook

sage otter
#

It’s pythons implementation of switch cases.

#

The better form of logic ofc

slate swan
sage otter
#

It’s the same for me as type hinting. Nothings changed.

slate swan
#

Same

#

Could type hint everything and it would still thing it was a nonetype

#

Or it didnt had a attr

sage otter
#

Is that what the interpreter thinks or vsc's intellisense

slate swan
#

Pylance

#

Wasnt showing me an error but just said it didnt had an attr

sage otter
#

That’s not 3.10s fault then. That’s just your linter being trash.

#

Typing isn’t enforced at all as far as runtime.

slate swan
#

Tried it on idle

#

Still same thing

blazing beacon
#

how do i get a colour of someones name?

sage otter
#

!d discord.Member.color

unkempt canyonBOT
#

property color: discord.colour.Colour```
A property that returns a color denoting the rendered color for the member. If the default color is the one rendered then an instance of [`Colour.default()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour.default "discord.Colour.default") is returned.

There is an alias for this named [`colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.colour "discord.Member.colour").
blazing beacon
#

oh alright

#

thankx

slate swan
#

Im still confused about @property

#

Dont quite get it well

sage otter
slate swan
#

Im just running 3.9.9

proven osprey
#

guys how to place for example 5 buttons in one row?

slate swan
#

if your using discord.ui.View

proven osprey
#

ok ill try thank you

#

i didnt use it before but ok

slate swan
#

lol

slate swan
#

look at the tb

#

traceback

dire folio
#

also i'm not sure if i'm being dumb isn't it name not text?

slate swan
#

SyntaxError: positional argument follows keyword argument

#

positional arg should be first

#

i suggest you learn basic python

#

dpy isnt beginner friendly as you need to know oop basic python and async programming

harsh abyss
#

c:; cd 'c:\Users\milky\code'; & 'C:\Users\milky\AppData\Local\Microsoft\WindowsApps\python3.10.exe' 'c:\Users\milky.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\lib\python\debugpy\launcher' '64619' '--' 'c:\Users\milky\code\practice bot\bott.py'

#

what should i do

final iron
#

Uh

rare saddle
#

Please tell me how to create a chat thread using a bot?

harsh abyss
slate swan
harsh abyss
#

and it works fine so far

final iron
harsh abyss
#

maybe idk

#

is there a diffrence between the two

slate swan
#

no

final iron
#

Did the docs change?

harsh abyss
#

the microsoft and the chrome

slate swan
harsh abyss
#

stop spamming

final iron
harsh abyss
#

alr

#

how do i install it to path

final iron
#

There will be a box when you're installing

#

Click it

slate swan
#

language

final iron
#

Have you read the error?

cedar stream
#

Why did u put arguments after keyword arguments

slate swan
#

no need for help then

final iron
#

You are asking for help

#

If you don't like that, leave

cedar stream
#

U dont put positional arguments after keyword arguments

#

Bro

#

U dont read what I tell u

#

Did u read the error

#

It says everything clearly

#

It’ s literally underlined red

#

Lemme

#

@slate swan do u see what u did here

slate swan
cedar stream
slate swan
#

the words

cedar stream
slate swan
cedar stream
slate swan
#

forget it lol

cedar stream
slate swan
cedar stream
#

U put spamming, being rude etc. as seperate arguments

#

It’ s error w replit

slate swan
#

this is a pain to watch @slate swan here

  embed.add_field(name="What you could have been muted for",value="porn content,spamming,being rude,talking about ip ban,personal questions")
cedar stream
slate swan
#

im leaving

cedar stream
#

Bro…

#

He gave u the code

slate swan
cedar stream
slate swan
#

@slate swan do you want me to go to your home and code the bot for you?

#

how?

#

how

#

i have

slate swan
sick birch
slate swan
proven osprey
#

i selected 5, why does he swear?

slate swan
#

those are many buttons lol

proven osprey
#

and what i should do if i want to have more than 5 buttons?

slate swan
#

idk what lib is that?

proven osprey
slate swan
#

ah well i dont really know how to

#

i use disnake

visual island
#

dpy doesn't have components kwarg

proven osprey
#

so how did it work before i add more than 5 buttons

visual island
#

show your imports

proven osprey
slate swan
#

ah discord components

#

welp i have zero idea

proven osprey
#

can i use other methods?

slate swan
#

ig disnake

#

is a good fork

#

that has buttons and slash commands

proven osprey
#

thanks

slate swan
#

!pypi disnake

unkempt canyonBOT
slate swan
rare saddle
#

How to create it correctly?

visual island
# proven osprey

try doing

components = [ActionRow([Button(...), Button(...), ...]), ActionRow([Button(...), Button(...), ...])] 
proven osprey
harsh abyss
#

can any body help me with my problem

visual island
visual island
proven osprey
#
                    ActionRow([Button(style=ButtonStyle.blue, label="✏️"),
                    Button(style=ButtonStyle.blue, label="🚷"),
                    Button(style=ButtonStyle.blue, label="❌"),
                    Button(style=ButtonStyle.blue, label="βœ…")],
                    Button(style=ButtonStyle.blue, label="πŸ™„"]),
                    ActionRow([Button(style=ButtonStyle.blue, label="⛔️"),
                    Button(style=ButtonStyle.blue, label="πŸ‘β€πŸ—¨"),
                    Button(style=ButtonStyle.blue, label="🀐"),
                    Button(style=ButtonStyle.blue, label="πŸ₯±"),
                    Button(style=ButtonStyle.blue, label="πŸ‘‘"])]
        ]```
visual island
rare saddle
proven osprey
#

I will be very grateful if you place these brackets correctly, because i am really confused 😫

visual island
#
components=[
                    ActionRow([Button(style=ButtonStyle.blue, label="✏️"),
                    Button(style=ButtonStyle.blue, label="🚷"),
                    Button(style=ButtonStyle.blue, label="❌"),
                    Button(style=ButtonStyle.blue, label="βœ…"),
                    Button(style=ButtonStyle.blue, label="πŸ™„")],
                    ActionRow([Button(style=ButtonStyle.blue, label="⛔️"),
                    Button(style=ButtonStyle.blue, label="πŸ‘β€πŸ—¨"),
                    Button(style=ButtonStyle.blue, label="🀐"),
                    Button(style=ButtonStyle.blue, label="πŸ₯±"),
                    Button(style=ButtonStyle.blue, label="πŸ‘‘")]
        ]
#

try that

proven osprey
#

the same

visual island
#

what does it say if you hover it

rare saddle
visual island
#

update it

#

to 2.0

proven osprey
rare saddle
visual island
#
components=[
                    ActionRow([Button(style=ButtonStyle.blue, label="✏️"),
                    Button(style=ButtonStyle.blue, label="🚷"),
                    Button(style=ButtonStyle.blue, label="❌"),
                    Button(style=ButtonStyle.blue, label="βœ…"),
                    Button(style=ButtonStyle.blue, label="πŸ™„")]),
                    ActionRow([Button(style=ButtonStyle.blue, label="⛔️"),
                    Button(style=ButtonStyle.blue, label="πŸ‘β€πŸ—¨"),
                    Button(style=ButtonStyle.blue, label="🀐"),
                    Button(style=ButtonStyle.blue, label="πŸ₯±"),
                    Button(style=ButtonStyle.blue, label="πŸ‘‘")])
        ]
```try that now
proven osprey
#

now its ok

#

but cant define actionrow

visual island
#

in your from discord_components import ... add ActionRow

proven osprey
#

❀️

#

i executed it and this is what it wrote

rare saddle
#

last version

slate swan
#

from the main branch

visual island
visual island
proven osprey
#

win!!!!!!!! thank you very much for help!!

visual island
visual island
#

you don't have git installed..

silent ermine