#discord-bots

1 messages · Page 1089 of 1

scarlet aurora
#
if amount == "all":
    amount = bal```
#

?

#

send error

#

amount = 0

#

0

slate swan
#

Dear, Why doesn't it find the file?


    @commands.command( name = '123', aliases = ["321"])
    async def command_123(self, ctx,):
        img = Image.new('RGBA', (8000,4800), '#232934' )

        embed = discord.Embed(
            title="Был забанен МЕМБЕР",
            color= 0xff0000
        )

        embed.set_footer(
            text="| Правительство SK",
            icon_url= ctx.guild.icon_url,
        )

        file1 = discord.File("./ImageO/ban/clear1.png")

        embed.set_image( file = file1)

        embed.add_field(name="Бан выдан:", value="China", inline=True) 
        embed.add_field(name="Срок бана:", value="2 дня", inline=True) # по очереди потомучто в конце True
        embed.add_field(name='\u200b', value='\u200b', inline=False)
        embed.add_field(name="Причина Бана:", value="Причина", inline=True) 
        embed.add_field(name="Дата выдачи:", value="Дата", inline=True)

        await ctx.send(embed=embed)
boreal ravine
#

Did you mean member: discord.Member=None?

scarlet aurora
boreal ravine
boreal ravine
slate swan
# boreal ravine Try ```py embed.set_image(url='clear1.png') await ctx.send(file=file1, embed=em...
    @commands.command( name = '123', aliases = ["321"])
    async def command_123(self, ctx,):
        img = Image.new('RGBA', (8000,4800), '#232934' )

        embed = discord.Embed(
            title="Был забанен МЕМБЕР",
            color= 0xff0000
        )

        embed.set_footer(
            text="| Правительство SK",
            icon_url= ctx.guild.icon_url,
        )

        file1 = discord.File("./ImageO/ban/clear1.png")

        embed.set_image(url='clear1.png')

        embed.add_field(name="Бан выдан:", value="China", inline=True) 
        embed.add_field(name="Срок бана:", value="2 дня", inline=True) # по очереди потомучто в конце True
        embed.add_field(name='\u200b', value='\u200b', inline=False)
        embed.add_field(name="Причина Бана:", value="Причина", inline=True) 
        embed.add_field(name="Дата выдачи:", value="Дата", inline=True)

        await ctx.send(file=file1, embed=embed)

🥺

boreal ravine
#

You don't paste it, you integrate it into your code

boreal ravine
slate swan
stable leaf
#

how can i add / commands into my bot?

#

i forgot the name of lib

boreal ravine
stable leaf
#

idk the name of the lib

#

it was something like discord-slash

boreal ravine
stable leaf
#

how?

boreal ravine
#

What do you mean "how"?

stable leaf
#

how to use forks

boreal ravine
stable leaf
#

which one

lyric apex
#

Adding stickers through bot?

lyric apex
#

Read that once

#

!d discord.ext.commands.CommandOnCooldown

boreal ravine
#

Looks like you have a command called commands

unkempt canyonBOT
#

exception discord.ext.commands.CommandOnCooldown(cooldown, retry_after, type)```
Exception raised when the command being invoked is on cooldown.

This inherits from [`CommandError`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError")
slate swan
#

Dear, why does he give out a picture in the upper left corner, although it looks different?

    @commands.command( name = '123', aliases = ["321"])
    async def command_123(self, ctx, member: discord.Member = None):
        img = Image.open("./ImageO/ban/фон.png")
        img1 = Image.open("./ImageO/ban/Рамка1.png")
        url = str(ctx.author.avatar_url)[:-10] # переменная юрл где юрл нашу аву -10 в конце символов

        response = requests.get(url, stream = True)
        response = Image.open(io.BytesIO(response.content))
        response = response.convert('RGBA')
        response = response.resize((1000, 1000), Image.ANTIALIAS) 
        
        img.paste(response, (0, 0)) #115 = 100 повыше + 15
        img.paste(img1, (0,0))
        img.save('./ImageS/user_card.png')

        embed = discord.Embed(
            title="Был забанен МЕМБЕР",
            color= 0xff0000
        )

        embed.set_footer(
            text="| Правительство SK",
            icon_url= ctx.guild.icon_url,
        )

        file1 = discord.File("./ImageS/user_card.png")

        embed.set_image(url='attachment://user_card.png')

        embed.add_field(name="Бан выдан:", value="China", inline=True) 
        embed.add_field(name="Срок бана:", value="2 дня", inline=True) # по очереди потомучто в конце True
        embed.add_field(name='\u200b', value='\u200b', inline=False)
        embed.add_field(name="Причина Бана:", value="Причина", inline=True) 
        embed.add_field(name="Дата выдачи:", value="Дата", inline=True)

        await ctx.send(file=file1, embed=embed)
        os.remove("./ImageS/user_card.png")
#

‘RuntimeWarning: coroutine ‘Client.run.<locals>.runner’ was never awaited

#

How can I await client.run :-:

modern fiber
#

Any clue why this isn't working?

#

No errors, but it doesn't display it.

#

nvm

boreal ravine
#

you have a command named commands, rename it

placid skiff
#

!d discord.ext.commands.cooldown

unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
placid skiff
#

he doesn't have a command named commands .-.

crisp drift
#

He does

fresh ferry
#

hey, anyone online wanting to help me on an issue ?

untold sigil
#

it’s not creating new channel

vale wing
#

Why use utils.get to get something by id

#

Use guild.get_channel

fresh ferry
#

omg exenifix your online. ong ima dm you

vale wing
#

Ok

boreal ravine
sick birch
slate swan
slate swan
#

.

boreal ravine
# slate swan

Try doing ```py
if name == "main":
client.run(...) # ... being your bot's token

untold sigil
vale wing
#

Instead of that utils.get construction

boreal ravine
vale wing
#

Also open context menu and reformat your code

boreal ravine
#

Get the users data -> get the users balance

vale wing
#

No spaces at all besides between keywords 😔

boreal ravine
#

Maybe

vale wing
#

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

py

#

after 3 backtics

inland beacon
#

you sure?

#

He's not going to help you, I'm gonna though.

#

Which part?

#

Errors?

#

balance isn't defined anywhere?

slate swan
#

yea

inland beacon
#

Do you have an error handler?

slate swan
#
if amount == "all" or amount == "max":
   amount = balance[0]
#

is it working ?

livid hinge
#

why are slash commands so annoying lol

slate swan
#

nope

#

"all"*

#

yea

#

Yea

#

show me your error

#

Have you checked the json file?

#

I think the error is in the update_bank() function

untold sigil
#
async def on_reac_add(react,user):
    if react.emoji=='🎫':
        guild=tic
        category=discord.utils.get(guild.categories,id=983345563590352976)
        await guild.create_text_channel(name=f"user.name",category=category)```
#

so can someone fix it?

slate swan
#

use get_channel instead of utils.get

sick birch
#

Like I mentioned before it needs to be in its full form, on_reaction_add

slate swan
#

^ and the event name

untold sigil
slate swan
#

and it needs @bot.event/@bot.listen() decorator too

untold sigil
#

but

#

it still not working

#
async def on_reac_add(react,user):
    if react.emoji=='🎫':
        guild=tic
        category=discord.get_channel(guild.categories,id=983345563590352976)
        await guild.create_text_channel(name=f"user.name",category=category)```
#

this what I did

slate swan
#
@client.command()
async def send(ctx,member:discord.Member,amount = None):
    await open_account(ctx.author)
    await open_account(member)

    if amount == "all" or amount == "max":
           amount = balance[1]

    if amount == None:
        await ctx.send("Please enter the amount")
        return

    bal = await update_bank(ctx.author)

    amount = int(amount)    
    if amount>bal[1]:
        await ctx.send("You don't have that much money!")
        return    
    if amount<0:
        await ctx.send("Amount must be positive!")
        return

    await update_bank(ctx.author,-1*amount,"bank")
    await update_bank(member,amount,"bank")

    await ctx.send(f"You gave {amount} coins to {member}!") 
untold sigil
#

pic of this

slate swan
#

and then you have tic, is it defined anywhere?

slate swan
#

!d discord.Client.get_channel

unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
slate swan
#

and this is the get_channel method

untold sigil
#

its name of the fuc

slate swan
dapper tendon
#

whats that ?

untold sigil
#
async def on_reaction_add(react,user):
    if react.emoji=='🎫':
        guild=tic
        category=discord.get_channel(guild.categories,id=983345563590352976)
        await guild.create_text_channel(name = user.name, category = category)




@bot.command()
async def ticketm(ctx):
    global tic 
    tic=ctx.guild
    embed=discord.Embed(title="Ticket", description='open ticket', color=0xf00000)
    embed.add_field(name="hi", value="have fun", inline=False)
    
    
    emoji='🎫'
    message=await ctx.send(embed=embed)
    await message.add_reaction(emoji=emoji)
#

its the code

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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.

dapper tendon
#

why this error ?

slate swan
slate swan
untold sigil
unkempt canyonBOT
#

discord/client.py line 1017

setattr(self, coro.__name__, coro)```
`discord/client.py` line 391
```py
coro = getattr(self, method)```
`discord/state.py` line 556
```py
self.dispatch('reaction_add', reaction, user)```
slate swan
#

use discord.Intents, or from discord import Intents

#

you need to deposit first

slate swan
#

nvm im slow

untold sigil
#

How can I open new channel by command

slate swan
unkempt canyonBOT
#

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

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

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

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

Note

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

depends if you want a text channel

#

same goes for other channels, just replace text

#

okay, now try to send money to someone

#

try 1

#

so we have an error in the "all" part.

#
@client.command()
async def send(ctx,member:discord.Member,amount = None):
    await open_account(ctx.author)
    await open_account(member)

    bal = await update_bank(ctx.author)

    if amount == "all" or amount == "max":
           amount = bal[0]

    if amount == None:
        await ctx.send("Please enter the amount")
        return
        
    amount = int(amount)    
    if amount>bal[1]:
        await ctx.send("You don't have that much money!")
        return    
    if amount<0:
        await ctx.send("Amount must be positive!")
        return

    await update_bank(ctx.author,-1*amount,"bank")
    await update_bank(member,amount,"bank")

    await ctx.send(f"You gave {amount} coins to {member}!")  
untold sigil
#
async def on_reaction_add(react,user):
    if react.emoji=='🎫':
        guild=tic
        category=discord.get_channel(guild.categories,id=983345563590352976)
        await guild.create_text_channel(name = user.name, category = category)




@bot.command()
async def ticketm(ctx):
    global tic 
    tic=ctx.guild
    embed=discord.Embed(title="Ticket", description='open ticket', color=0xf00000)
    embed.add_field(name="hi", value="have fun", inline=False)
    
    
    emoji='🎫'
    message=await ctx.send(embed=embed)
    await message.add_reaction(emoji=emoji)```
this is my code and its not creating new channel
can someone help me?
slate swan
#

show your code

stable leaf
#

how to add a role to someone using commands?

unkempt canyonBOT
#

commands [bpnumber]```
Specify a list of commands for breakpoint number *bpnumber*. The commands themselves appear on the following lines. Type a line containing just `end` to terminate the commands. An example:

```py
(Pdb) commands 1
(com) p some_variable
(com) end
(Pdb)
```  To remove all commands from a breakpoint, type `commands` and follow it immediately with `end`; that is, give no commands.

With no *bpnumber* argument, `commands` refers to the last breakpoint set...
untold sigil
#
async def on_reaction_add(react,user):
    if react.emoji=='🎫':
        guild=tic
        category=discord.get_channel(guild.categories,id=983345563590352976)
        await guild.create_text_channel(name = user.name, category = category)




@bot.command()
async def ticketm(ctx):
    global tic 
    tic=ctx.guild
    embed=discord.Embed(title="Ticket", description='open ticket', color=0xf00000)
    embed.add_field(name="hi", value="have fun", inline=False)
    
    
    emoji='🎫'
    message=await ctx.send(embed=embed)
    await message.add_reaction(emoji=emoji)```

this is my code and its not creating new channel
can someone help me?
slate swan
#
@client.command()
@commands.cooldown(1,5,commands.BucketType.user)
async def balance(ctx, member: discord.Member):
    if member == None:
        member = ctx.author
    await open_account(member)
    users = await get_bank_data()

    wallet_amt = users[str(member.id)]["wallet"]
    bank_amt = users[str(member.id)]["bank"]

    em = discord.Embed(title = f"{member.name}'s balance",color = discord.Color.red())
    em.add_field(name = "Wallet balance",value = wallet_amt)
    em.add_field(name = "Bank balance",value = bank_amt)
    await ctx.send(embed = em) 
slate swan
stable leaf
slate swan
#

use the aliases kwarg in the command decorator

@client.command(aliases=["bal", "more aliases if required"])
slate swan
stable leaf
#

thx

lyric apex
#

How to setup jishaku?

slate swan
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/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
slate swan
#
@client.command(aliases = ["bal"])
@commands.cooldown(1,5,commands.BucketType.user)
async def balance(ctx, member: discord.Member):
    if member == None:
        member = ctx.author
    await open_account(member)
    users = await get_bank_data()

    wallet_amt = users[str(member.id)]["wallet"]
    bank_amt = users[str(member.id)]["bank"]

    em = discord.Embed(title = f"{member.name}'s balance",color = discord.Color.red())
    em.add_field(name = "Wallet balance",value = wallet_amt)
    em.add_field(name = "Bank balance",value = bank_amt)
    await ctx.send(embed = em) 
#

show the traceback @untold sigil a single line doesn't even help a bit

#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

lyric apex
#

I am here?Sad_Cat

slate swan
#

no?

lyric apex
slate swan
crisp drift
lyric apex
slate swan
untold sigil
slate swan
unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
lyric apex
slate swan
slate swan
#

why you code discord.get_channel ?

lyric apex
slate swan
#

yea ♥️

slate swan
lyric apex
slate swan
untold sigil
untold sigil
slate swan
odd walrus
#

anyone got a sample on how i could fetch all username/user id that has reacted to a msg

slate swan
#

does it send error about cmd?

crisp drift
#

@untold sigil why dont you just do category = react.message.guild.get_channel(YourCategoryID)

crisp drift
#

At this point, you just don't know python enough and I suggest you to learn abit more and read the doc to know what attributes an object has

slate swan
stable leaf
#

or i don't know how to use it

slate swan
#

is your prefix is breh!

stable leaf
slate swan
slate swan
lyric apex
stable leaf
#
await ctx.author.add_roles("Member")
slate swan
slate swan
#

your token

untold sigil
crisp drift
#

????

slate swan
stable leaf
slate swan
#

trying to trigger the stupid token warning

slate swan
lyric apex
#

It isn't needed?

untold sigil
slate swan
#

Can you take a screenshot while using the command?

#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
crisp drift
stable leaf
untold sigil
slate swan
#

wdmy

stable leaf
slate swan
# stable leaf ok

better do it like this

@client.event
async def on_command(ctx: commands.Context):
  if ctx.guild.id != 1234567890:
    return
  role = ctx.guild.get_role(1234567890)
  if role
    await ctx.author.add_roles(role)
#

just an example

stable leaf
#

thx

slate swan
#

on_command is triggered when a command is invoked

#

the current app's command*

slate swan
#

example:
you in channel 123 and want send message to channel 1234 ?

#

get/fetch your server channel and use the send method on it

slate swan
lyric apex
slate swan
# lyric apex ?

idk, you don't await load_ext in 1.7.3, did you ever install 2.0?

slate swan
#

you need server id and channel id to send message

lyric apex
slate swan
#
<@bot/client/commands>.command()
async def foo(<self>, ctx: commands.Context, *, message: str):

  channel = <bot/client/commands/self.bot/self.client>.get_channel(channel_id) or await <bot/client/commands/self.bot/self.client>.fetch_channel(channel_id)

  await channel.send(message)
slate swan
lyric apex
tough lance
brave flint
#

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.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

do anyone know what is the issue?, pycord

slate swan
lyric apex
brave flint
#

i think i do, rechecking

slate swan
lyric apex
slate swan
#

have fun

#

ok

lyric apex
#

AshleySad_Cat

brave flint
lyric apex
crisp drift
brave flint
lyric apex
#

I think you have enabled all in your code

brave flint
slate swan
#

can you show balance command?

slate swan
crisp drift
#

Golu, you have dpy 1.7.3 installed on the py version your starting your bot with

lyric apex
#

On message intent too

slate swan
#

maybe you write @client.command

slate swan
#

but @client.command() is true

brave flint
brave flint
crisp drift
slate swan
#

these 2 commands work

lyric apex
slate swan
#

This command can only check your money

crisp drift
heady sluice
#

I swear I have seen this piece of code like 6k times already

lyric apex
#

No errors on the panel

brave flint
#

hmm how to not use a embed value?, retried value = " " thrown an error

slate swan
#

can you hide the Token of bot and submit your Python file?

lyric apex
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.

Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
brave flint
#

i forgot how

crisp drift
#

You want dpy2.0 to be installed also your bot setup must be a bit different than you did in 1.7.3

slate swan
#

yea

heady sluice
lyric apex
brave flint
lyric apex
brave flint
#

it is easier wait ill check

keen talon
#

Hey everyone 👋

lyric apex
heady sluice
#

you can use asyncio.run

#

for random awaits like this

slate swan
lyric apex
#

asyncio.run('jishaku')?

slate swan
#

no

lyric apex
#

Then?

heady sluice
#

no asyncio.run(client.load_extension(...))

slate swan
#

ew

lyric apex
#

Ah k

heady sluice
heady sluice
#

or you use an args arg

#

then it's no ew

slate swan
#

but its better to load it somewhere else

heady sluice
#

I use a command for it

slate swan
#

why even use dpy anymore-

crisp drift
#

It is recommended to load cog in setup_hook on startup for dpy2

heady sluice
crisp drift
#

Just subclass commands.Bot and load in that method

brave flint
#

value="** **"

heady sluice
#

imagine outplaying discord

slate swan
slate swan
#

yes it does, _ _ works too

brave flint
#

i think its your answer tho

slate swan
#

if you think that's cringe, wait

heady sluice
#

wait await

lyric apex
heady sluice
#

and where tf do you use await

#

then what's the point

slate swan
#

^

heady sluice
#

I'd like to put this shit piece of code in my about me

#

but it doesn't fit

gray cloak
#

is it worth updating to dpy2? im so used to the old practice i feel pretty lazy to do it

heady sluice
#

you will have to

heady sluice
#

<3

slate swan
brave flint
slate swan
#

I feel dizzy looking at that piece of code now

#

even though I wrote it

heady sluice
#

can't you do

lyric apex
#

Ashley need restQtpie

heady sluice
#

_______________ = await

#

that would be a menace to python

slate swan
#

is that even possible

heady sluice
#

that's the question

slate swan
#

no, it isnt, it has to be inside an async func

heady sluice
#

_____________________ = asyncio.run

#

that's possible

slate swan
#

yeah

#

it is

lyric apex
#

Oh god Sad_Cat

slate swan
#

Can someone help me with slash commands?

#

yes

lyric apex
#

Lol

heady sluice
slate swan
#

I swear I didn't even read it (or read it wrong tbh)

placid skiff
slate swan
#

@slate swan no dms

heady sluice
#

hell na

slate swan
slate swan
crisp drift
# placid skiff Now you can code in brainfuck language

Thats a brainfuck code

bot = left = right = first = last = None

async def paginate(embeds, msg):
    with type('',{'__enter__':lambda _:0,'__exit__':lambda*a:bot.loop.create_task(msg.delete())})():[(embed:=embeds[(index:=locals().get('index',0))+(min(index, len(embeds))-index if r.emoji == right else max(index-1,0) if r.emoji==left else len(embeds)-1-index if r.emoji==last else -index)])and await msg.edit(embed=embed) for r in iter(lambda: await bot.wait_for('reaction_add',check=lambda _r:_r.emoji in(left,right,first,last)and _r.message==msg),...)]```
heady sluice
#

I will write a whole discord bot like this

slate swan
#

bye

heady sluice
slate swan
#

lmao

slate swan
#

Okay, so my problem is I always get an error when using slash commands. Error is AttributeError: aenter I dont even know what that is

#

Can I send pictures in here or do I have no rights?

heady sluice
#

you can

#

but don't leak your token

slate swan
#

My Code

slate swan
#

And my Error

paper sluice
slate swan
heady sluice
#

you shouldn't call it, which ruins the plan

slate swan
lyric apex
#

Then Ashley was rightSad_Cat

heady sluice
#

!d asyncio.run

unkempt canyonBOT
#

asyncio.run(coro, *, debug=False)```
Execute the [coroutine](https://docs.python.org/3/glossary.html#term-coroutine) *coro* and return the result.

This function runs the passed coroutine, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the threadpool.

This function cannot be called when another asyncio event loop is running in the same thread.

If *debug* is `True`, the event loop will be run in debug mode.

This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once.

Example...
heady sluice
#

click on it

slate swan
slate swan
slate swan
paper sluice
#

i got this option for a command

@lightbulb.option(
    'channel',
    '...',
    TextableGuildChannel,
    default=None,
    required=False
)

but when i access it using ctx.options.channel i get 'hikari.interactions.command_interactions.InteractionChannel' whereas i want 'hikari.channels.GuildTextChannel'

i get GuildTextChannel when i invoke the command as a prefix command. i want the same for app commands.

slate swan
heady sluice
paper sluice
heady sluice
#

run_coroutine_threadsafe!!!

heady sluice
lyric apex
slate swan
heady sluice
#

hikari

slate swan
#

yeah...

heady sluice
lyric apex
#

Bruhh am i alive here?

slate swan
# lyric apex Got it

that's what I said 😭 set the owner_id in the bot constructor to your discord id

heady sluice
#

!d asyncio.run_coroutine_threadsafe

unkempt canyonBOT
#

asyncio.run_coroutine_threadsafe(coro, loop)```
Submit a coroutine to the given event loop. Thread-safe.

Return a [`concurrent.futures.Future`](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future "concurrent.futures.Future") to wait for the result from another OS thread.

This function is meant to be called from a different OS thread than the one where the event loop is running. Example...
heady sluice
#

might replace await

slate swan
lyric apex
slate swan
lyric apex
heady sluice
#

you just forgot await

lyric apex
slate swan
heady sluice
#

no you forgot await

slate swan
#

can someone help me with my purge command and editing the embed? I get this error

heady sluice
heady sluice
slate swan
#

ahhh

lyric apex
slate swan
#

so i cant edit my embed message?

heady sluice
#

you can

#

you have to save the message you sent at first

slate swan
#

i did as embed = discord.Embed

heady sluice
#

message = await ctx.send(embed=embed)

neat field
#

hi! i have a discord bot, but i wanna make a dashboard too, any sggestions on where to start?

heady sluice
#

then you can use await message.edit(embed=new) later

#

and don't use time bru

lyric apex
#

@slate swan lol it is working now i think i messed with saving that

heady sluice
#

import asyncio and use await asyncio.sleep() instead of time.sleep()

#

@slate swan

slate swan
#

ok thanks

#

same error

#

ohh wait nvm

heady sluice
slate swan
#

I swear I was on the phone for 2 minutes, and I get 3 pings and you solve the error by yourself 😔

#

cant read

lyric apex
heady sluice
slate swan
slate swan
#

my wifi

heady sluice
#

late b

slate swan
#

it didnt even upload the image for 15 seconds

heady sluice
slate swan
#

it didnt even upload the image for 15 seconds

heady sluice
#

you did await ctx.message.delete()

#

but you already deleted that message

#

so you can't delete it again

slate swan
#

ahh ok thank u

#

meh's smort

heady sluice
#

brain="huge"

slate swan
#

why the heck are my message getting sent twice

heady sluice
slate swan
heady sluice
slate swan
#

!ot

unkempt canyonBOT
heady sluice
#

@slate swan

slate swan
heady sluice
slate swan
#

😠 no

heady sluice
slate swan
#

How can I import discord_slash? I already used: pip install -U discord-py-slash-command

slate swan
heady sluice
#

did you reset vsc

slate swan
#

ye

heady sluice
#

then I don't know

slate swan
#

imagine using v2

#

imagine using v2

slate swan
slate swan
heady sluice
#

what's your python interpreter and pip version

#

pip version as in the pip that's set on path

slate swan
#

pip version 22.0.4

heady sluice
slate swan
#

man Im new and dumb :(

#

where can I find this?

heady sluice
#

like when you click on the play button in vsc

#

there's a long yellow text that has the python version in it

slate swan
heady sluice
#

or on bottom left

slate swan
#

ah I see, I normally press on execute without debugging

heady sluice
#

that's your python interpreter

slate swan
#

C:/Users/FynnLuca/AppData/Local/Programs/Python/Python310/python.exe this?

heady sluice
#

exactly

#

did you try pip3.10 install slash_command_thing

#

?

slate swan
#

no lemme try rq

lyric apex
#

Jishaku is sending the traceback in dm whySad_Cat

slate swan
heady sluice
#

I don't think you need -U

slate swan
#

hm okay

heady sluice
#

-U means update

#

it's when you already have it

slate swan
#

ye I just saw it on the internet to install it like this

heady sluice
#

prolly doesn't matter

slate swan
#

already satisfied btw

heady sluice
#

then it's installed

#

your pip is on 3.10

#

your python interpreter is 3.10

#

weird

slate swan
#

ye thats my problem

#

normally its underlined yellow but when I restart my vsc its gone but now it isnt

heady sluice
#

maybe the namespace is just something else...

slate swan
#
    @commands.command( name = '123', aliases = ["321"])
    async def command_123(self, ctx, member: discord.Member = None):
        img = Image.open("./ImageO/ban/фон.png")
        img1 = Image.open("./ImageO/ban/Рамка1.png")
        url = str(ctx.author.avatar_url)[:-10] # переменная юрл где юрл нашу аву -10 в конце символов

        response = requests.get(url, stream = True)
        response = Image.open(io.BytesIO(response.content))
        response = response.convert('RGBA')
        response = response.resize((1000, 1000), Image.ANTIALIAS)
        
        img.paste(response, (0, 0)) #115 = 100 повыше + 15
        img.paste(img1, (0,0))
        img.save('./ImageS/user_card.png')

        embed = discord.Embed(
            title="Был забанен МЕМБЕР",
            color= 0xff0000
        )

        embed.set_footer(
            text="| Правительство SK",
            icon_url= ctx.guild.icon_url,
        )

        file1 = discord.File("./ImageS/user_card.png")

        embed.set_image(url='attachment://user_card.png')

        embed.add_field(name="Бан выдан:", value="China", inline=True) 
        embed.add_field(name="Срок бана:", value="2 дня", inline=True) # по очереди потомучто в конце True
        embed.add_field(name='\u200b', value='\u200b', inline=False)
        embed.add_field(name="Причина Бана:", value="Причина", inline=True) 
        embed.add_field(name="Дата выдачи:", value="Дата", inline=True)

        await ctx.send(file=file1, embed=embed)
        os.remove("./ImageS/user_card.png")

Please tell me why the picture in the corner is distorted🥺

#

It has a transparent background. I think because of this but how to fix it

stable leaf
slate swan
#

Can someone give me an example of how to use disnake.Option?

atomic path
#

image processing is blocking the event loop while being slow and intensive

#

consider running in an executor

#

same with requests

#

but there is aiohttp as an alternative

#

additionally you should be saving to an in memory buffer bytesio and not saving to disk and then removing for the processed images

#

also can you send the image you are having trouvle with attempting to paste here

#

@slate swan

atomic path
slate swan
#

Bytes? what about bytes?

atomic path
#

wot

slate swan
#

How to store an image in bytes?

atomic path
# slate swan

additionally if you use dpy as your main lib consider updating to 2.0 and using the built in slash stuff

fallow mauve
#
@bot.listen
async def on_message(message):
  if message.author.id != 983391481589031002:
    await message.delete()
```why wont my messages get deleted? i dont understand why it wont work
atomic path
#

bot.listen()

#

also uh

fallow mauve
#

thx

#

ye?

atomic path
#

you are attempting to deleting every message except for whoeevr that is

#

why

placid verge
keen talon
atomic path
fallow mauve
# atomic path why

bcs im bored and trying to make it so that i can only send messages using the bots message command(thats the id)

placid verge
#

whatever, its up to u

atomic path
#

message is already a message what is message.message doing except for raising attributeerror

atomic path
#

just update to 2.0 via git

keen talon
#

What the yert

slate swan
atomic path
#

yepz

slate swan
#

did that but what is the built in slash stuff?

atomic path
#

and the stuff is under app_commands

keen talon
#

Just use disnake lol

slate swan
slate swan
# slate swan did that but what is the built in slash stuff?

With commands extension

from discord import app_commands
from discord.ext import commands

class Bot(commands.Bot):
   def __init__(self):
     super().__init__(command_prefix="uwu", ...)
  
  async def setup_hook(self):
    await self.tree.sync(guild=discord.Object(guild_id)) #passing in the guild is optional and will be globalized instead

bot = Bot()

@bot.tree.command()
async def ping(inter: discord.Interaction):
  await inter.response.send_message("Pong!")
atomic path
#

is that all your code

fallow mauve
#

in embed=discord.Embed(title="", description=content, color=???) how do i get the main color of the users pfp and set that to the embed color

fallow mauve
slate swan
#

!d discord.Member.colour

unkempt canyonBOT
#

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

There is an alias for this named [`color`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.color "discord.Member.color").
atomic path
#

i think its accent_color idk about that

slate swan
#

its the same thing iirc

#

accent colour returns the colour of the banner ig

#

!d discord.User.accent_colour

unkempt canyonBOT
#

property accent_colour```
Returns the user’s accent colour, if applicable.

A user’s accent colour is only shown if they do not have a banner. This will only be available if the user explicitly sets a colour.

There is an alias for this named [`accent_color`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.accent_color "discord.User.accent_color").

New in version 2.0.

Note

This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
atomic path
#

it doesnt say its an alias of the latter so

slate swan
#

yeah, colour for the banner

fallow mauve
#

so what if the user has a custom banner

atomic path
#

.banner ?

slate swan
#

exists, it will return an Asset object

#

else, it'll return None

fallow mauve
#

ok also

#

ctx.author.color always sets it as black

slate swan
#

Hi, anyone have any idea how I can add interactive buttons to a message?

unkempt canyonBOT
#

class discord.Button```
Represents a button from the Discord Bot UI Kit.

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

Note

The user constructible and usable type to create a button is [`discord.ui.Button`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Button "discord.ui.Button") not this one.

New in version 2.0.
maiden fable
shrewd apex
#

habit ig

maiden fable
#

Prolly

maiden fable
slate swan
#
@client.command()    
async  self.recover(ctx):
  if ctx.author.guild_permissions.administrator:
  
    for channel in ctx.guild.channels:
        if channel.name in ('rules', 'moderator-only'):
            try:
                await channel.delete()
            except:
                pass 
``` this is correct?
maiden fable
#

no

slate swan
#

so?

shrewd apex
#

yeah whichever one u need u could either subclass or make a button in ur command

slate swan
#

@maiden fable tell

shrewd apex
#

what's async self.recover

maiden fable
slate swan
#

why guild_channel_update is not working?

maiden fable
#

member.display_avatar.url

slate swan
#

where are the docs for what can go inside this?

maiden fable
#

yup

fallow mauve
#

how to check if a channel is a dm or not

maiden fable
#

avamember.display_avatar.url

maiden fable
unkempt canyonBOT
#

class discord.Permissions(permissions=0, **kwargs)```
Wraps up the Discord permission value.

The properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools. This allows you to edit permissions.

Changed in version 1.3: You can now use keyword arguments to initialize [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") similar to [`update()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.update "discord.Permissions.update").
maiden fable
#

like send_messages=True and so on

#

Yup

maiden fable
#

userAvatarUrl = avamember.display_avatar.url

slate swan
maiden fable
#

U can do moderate_members=True

slate swan
#

how cani see all the permission names

maiden fable
#

!d discord.Permissions.moderate_members

unkempt canyonBOT
maiden fable
unkempt canyonBOT
#

class discord.Permissions(permissions=0, **kwargs)```
Wraps up the Discord permission value.

The properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools. This allows you to edit permissions.

Changed in version 1.3: You can now use keyword arguments to initialize [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") similar to [`update()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.update "discord.Permissions.update").
maiden fable
slate swan
#

thank u how could i make a kick user command?

#

like how can i do something like !kick @echo breach and return the mentioned users id?

maiden fable
#

Nice ping

slate swan
#

ddint mean to do that lol

maiden fable
#
@commands.has_permisisons(kick_members=True)
@bot.command()
async def kick(ctx, member: discord.Member, *, reason):
    await member.kick(reason=reason)
slate swan
#

ok thank you

shrewd apex
#

oh ok

maiden fable
#

remove the =None

alpine cove
#

thats not gonna work just wanna say

slate swan
#

ahem

#

everybody falls for handsome hunter 😔

maiden fable
#

Nice now I don't even remember what I was even working on

slate swan
#

PLS

slate swan
maiden fable
#

All cool

slate swan
#

im gonna play now bai

#

but not working

#

bruh

maiden fable
alpine cove
#

try:
!avatar @user1#7092, @User#50002 (assuming ur prefix is !)

#

its not gonna work...

maiden fable
#

Nice, another two pings

alpine cove
slate swan
# maiden fable show code
@commands.Cog.listener()
    async def on_guild_update(self, after: discord.Guild,
                              before: discord.Guild) -> None:
        await self.client.wait_until_ready()

        guild = after
        if not guild:
            return
        if not guild.me.guild_permissions.view_audit_log:
            return
        async for entry in guild.audit_logs(
                limit=1,
                after=datetime.datetime.now() - datetime.timedelta(minutes=2),
                action=discord.AuditLogAction.guild_update):
            if entry.user.id in IGNORE or entry.user.id == guild.owner.id:
                return
            else:
                await after.edit(name=f"{before.name}",
                                 reason=f"venox | Recovery")
                if guild.me.guild_permissions.manage_webhooks:
                    await guild.ban(entry.user,
                                  reason="venox | Anti Guild Update")
#

@maiden fable

alpine cove
slate swan
alpine cove
#

send a screenshot of you excuting my command

alpine cove
#

it cant

maiden fable
#

@alpine cove @slate swan's code works

alpine cove
#

is the bot public?

slate swan
maiden fable
#

I am confused

slate swan
#

why my bot is not recover all these channels?

maiden fable
#

I don't even understand what u tryna do

slate swan
#

-__-

alpine cove
#

yea

maiden fable
#

@shrewd apex do u mind coming here?

alpine cove
#

no wait

#

yea

shrewd apex
#

mhm

alpine cove
shrewd apex
#

hello

slate swan
alpine cove
#

ok well send me that invite link

maiden fable
shrewd apex
#

ok

tight mica
#

wat happen

shrewd apex
slate swan
shrewd apex
#

so what are u trying to do exactly?

slate swan
#

self recover channels

#

means

tight mica
slate swan
#
@commands.Cog.listener()
    async def on_guild_update(self, after: discord.Guild,
                              before: discord.Guild) -> None:
        await self.client.wait_until_ready()

        guild = after
        if not guild:
            return
        if not guild.me.guild_permissions.view_audit_log:
            return
        async for entry in guild.audit_logs(
                limit=1,
                after=datetime.datetime.now() - datetime.timedelta(minutes=2),
                action=discord.AuditLogAction.guild_update):
            if entry.user.id in IGNORE or entry.user.id == guild.owner.id:
                return
            else:
                await after.edit(name=f"{before.name}",
                                 reason=f"venox | Recovery")
                if guild.me.guild_permissions.manage_webhooks:
                    await guild.ban(entry.user,
                                  reason="venox | Anti Guild Update")
shrewd apex
#

what's ignore here?

slate swan
#

users

tight mica
#

there is many stuff wrong here

fallow mauve
#
@bot.command()
async def test(ctx):
  button = Button(label="Click", style=discord.ButtonStyle.green, emoji="🥞")
  view = View
  view.add_item(button)
  await ctx.send("testing", view=view)
```why am i getting an error saying that in `view.add_item(button)` theres no item given?
shrewd apex
#

so u want to ban people if they change the guilds name?

slate swan
slate swan
#

join my test server check your dm

tight mica
slate swan
#

You know why?

shrewd apex
#

u prolly don't have those intents enabled in ur own dev acc bot section

dull terrace
#

is there a better way to count in an infinite loop that doing

count = 0
while True:
  if count = something:
    do something
    count = 0
  await asyncio.sleep(1)
  count += 1```
tacit token
#

hi guys, how can i add a simple mute informations to database? (To 1 server only)

#

and warn etc..

#

similar to Dyno modlog

dull terrace
#

what do you mean simplify it

tight mica
tacit token
dull terrace
#

are you asking how to do the entire thing or just how to write it to a database

tacit token
#

how to write it to a database

dull terrace
tacit token
#

ty

sick birch
#

Haven’t seen you in a bit

scarlet aurora
#

is there a way to get a bot to move a channel specifically somewhere

#

for example, it moves general right above bot commands

maiden fable
#

Hey @sick birch do u have any idea how to prevent the logging module from writing to sys.stderr and sys.stdout? I have made it so that its writing to a file but now its writing to both stderr/stdout and the log file

blissful sparrow
#
@bot.event
async def on_mentions(bot,ctx,guild):
    if ctx.mentions.bot.user:
        conn = await aiosqlite.connect('./sql/ghostbot.db')
        c = await conn.cursor()
        await c.execute('SELECT prefix FROM server_settings WHERE gid = ?', (guild.id,))        
        result = await c.fetchone()

        if result:
            embed = discord.Embed(titlle='The current prefix for this server is: ', description=f'{result}', color=0x000000)
            await ctx.reply(embed=embed)
        return

    else:
        return

So erm bot doesn't reply with prefix and it doesnt give any errors any ideas?

maiden fable
#

on_mentions

sick birch
maiden fable
#

That's sad

rocky hornet
#

choose folder name

maiden fable
#

Gonna open a help channel

rocky hornet
#

cogs, modules, extensions, plugins

maiden fable
rocky hornet
#

people tend to use "cogs" which isnt suitable at all

#

since the files are just extensions, in context of discord.py

round knoll
#

hey, good afternoon! i just want to start with a huge thanks to everyone who took the time to talk with me yesterday and made my bot happen.. this is huge for me as a 1st project.

i have a slight issue. i tried to set the default icon for my bot.. it ended up being square, which i didnt like. so i figured, id open 3d paint (cause it's easy to setup alpha background) BUT doing so, changed the default software that windows uses for the .ico files... now i cant preview the .ico files .. it just shows an icon of 3d paint.

#

sorry btw, this might be a bit out of context for the channel, i just realised

maiden fable
light violet
#

How make a code to check user status

round knoll
spring flax
#

!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/latest/api.html#discord.Role "discord.Role")s.

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

!d discord.Member.status

unkempt canyonBOT
#

property 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.10)") instead.
slate swan
#

the hell

sick birch
slate swan
#

Please tell me what to write in {} to get the date and time

round knoll
#

thankfully i had the day off today

#

so its a chill day

maiden fable
slate swan
#

today

maiden fable
#

datetime.utcnow()?

sick birch
#

The bot working, that is, not going to bed at 3 in the morning. Lol

round knoll
#

there we go

#

just need to add it to my macro for stream lol

slate swan
#

discord.errors.NotFound: 404 Not Found (error code: 0): Interaction is unknown (you have already responded to the interaction or responding took too long) Are the solutions for this error?

sick birch
#

(you have already responded to the interaction or responding took too long)
From this I can deduce 2 things:

  • You have already responded more than once, so check in your code for any loops or just multiple responses
  • Response took too long. Obviously we know what this is, I believe the timeout is ~15 minutes so I don't think that's the issue
spring flax
#

i'm pretty sure if you defer the interaction it is 15 minutes otherwise it is 3 seconds

sick birch
#

Please use #bot-commands

atomic path
#

you have 3 seconds to respond tp an interaction

#

otherwise it fails (for the user) and you will get NotFound as you try to respond after

#

You have already responded more than once, so check in your code for any loops or just multiple responses
this would result in a different error saying "This interaction has already be responded to before"

#

so its that you took too long

atomic path
#

but yea to solve just defer() first (do stuff that takes a while) and then interactio.followup.send.... and other respective methods @slate swan

slate swan
#

better use Interaction.edit_original_message, follow-ups can be "floody"

scarlet aurora
#

is there a way to get a bot to move a channel specifically somewhere
for example, it moves general right above bot commands

flint isle
#

My bot needs to search a Json array an example has been attached for a specific word and if it contains the word it needs to grab the appropriate grouping

[{'text': "This is just a regular little gummy bear,\xa0\nand I've decided to destroy it. To do this\xa0\xa0", 'start': 0.24, 'duration': 5.68}, {'text': "I just have to get a vial, and I'll add a small\xa0\namount of something called potassium chlorate.\xa0\xa0", 'start': 5.92, 'duration': 5.68}, {'text': 'After that I just have to heat it up,\xa0\nuntil it all melts into a nice goop.', 'start': 12.32, 'duration': 4.24}, {'text': 'At this point it should be pretty good, and I\xa0\ncan carefully drop in the poor little gummy bear.', 'start': 19.52, 'duration': 5.36}, {'text': 'Almost immediately the potassium chlorate started\xa0\nripping it apart, and oxidizing it into water,\xa0\xa0', 'start': 28.64, 'duration': 6.32}, {'text': "and CO2 gas. Within just several seconds\xa0\nthough the reaction's already done,\xa0\xa0", 'start': 34.96, 'duration': 5.12}, {'text': 'and my little gummy bear, no longer exists.', 'start': 40.88, 'duration': 2.96}]```
stone beacon
unkempt canyonBOT
#
Out of the question.

No documentation found for the requested symbol.

stone beacon
#

!d discord.abc.GuildChannel.position

unkempt canyonBOT
stone beacon
#

That applies to the TextChannel and etc

#

Then you can call .edit(position=newposition) on the channel object

scarlet aurora
#

thanks

slate swan
#

Code

    await message.channel.send( 'it worked ' + (message.author.mention))```

**Error**
SyntaxError: 'await' outside function
atomic path
#

you can only await within a coro

stone beacon
#

oO where are you calling that from

atomic path
#

is this in on message

#

did you like not define it as a coro

slate swan
atomic path
#

can you show the code around it

slim crag
#

when you make the function instead of def (ctx): put async def(ctx):

slate swan
#

i found a fix

tacit token
#

whats the basic underage emoji ID / name?

        if payload.emoji.name==("🔞"):
slate swan
#

🔞

#

\🔞

tacit token
#

ok, but how can i use this

slate swan
tacit token
#

ok

scarlet aurora
scarlet aurora
tacit token
#

bot.get_channel(ID)

Examlpe

channel=bot.get_channel(123456789101)
scarlet aurora
#

i'm using bot

#

alr i got it

#

ty

tacit token
#

np

ember gate
#

Noob question: My bot already has the code

bot = discord.Client()```
and I want to add this to the same code:
```py
bot = commands.Bot(command_prefix="$")```

Do I need to (or should I?) join the commands under one `bot` somehow?
#

Or is it OK to just have those two things on two separate lines?

tacit token
#

what

atomic path
#

you only need the latter

#

having both just overwrites anyways so the top like os absolutely useless

ember gate
#

All righty, thanks

scarlet aurora
#
    @commands.command()
    @commands.is_owner()
    async def mediaperm(self, ctx, member: discord.Member = None):

        role = discord.utils.get(commands.server.roles, name="Media Perms")
        await commands.add_roles(member, role)

        await ctx.send(f"Sucsesfully given {member} Media Perms!")``` What should I put in replacement of commands?
#

because commands.add_roles nor commands.server.roles work

#

I tried bot / client

slate swan
#

read the docs

scarlet aurora
#

yeah I just did that

#

lol

#

oof it don't work discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'server'

slate swan
#

!d discord.Member.guild

unkempt canyonBOT
slate swan
#

guild is equal to server

loud junco
#

3am here and i still havent sleep

scarlet aurora
#
    @commands.command()
    @commands.is_owner()
    async def mediaperm(self, ctx, user: discord.Member = None):

        if user is None:
            print("Choose someone to give Media Perms")

        role = discord.utils.get(user.server.roles, name="Media Perms")
        await user.add_roles(role)
        

        await ctx.send(f"Sucsesfully given {user} Media Perms!")``` ```discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'server'```
#

Can someone help?

loud junco
#

Change user.server.roles to user.guild.roles

#

Its called guild not server

#

@scarlet aurora

scarlet aurora
#

thanks

loud junco
#

Thats what ashley told u =.=

scarlet aurora
#

oh

loud junco
#

Sad ashley noises

#

Goodbye

#

Maybe time to sleep it's now 337am and i have tuition at 9am

slate swan
#

Is it possible to Greedy user id's?

tacit token
#

Guys, the commands not work but the log is working, why?

odd mango
#

hey, how do i do pip install -U git+https://github.com/Rapptz/discord.py in pycharm

maiden fable
#

U do that in cmd

odd mango
#

windows cmd prompt?

maiden fable
#

yes

odd mango
#

i have 1.7.3 installed

odd mango
#

@maiden fable^^

maiden fable
#

yes, also remove discord

odd mango
maiden fable
odd mango
maiden fable
#

Huh weird

odd mango
#

how do i install 2.0 now

maiden fable
odd mango
#

its a different application though

#

how do i ren that cmd from within pycharm

keen mural
#

whats that thing that makes it so only the bot owner can use a command

#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
odd mango
#

uhh

wicked atlas
odd mango
#

yeah

#

ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

wicked atlas
#

Have you installed git?

odd mango
#

yeah i did

wicked atlas
#

do git --version

odd mango
#

says no git

#

wtf

wicked atlas
#

then try installing git again

odd mango
#

from where

wicked atlas
odd mango
#

is this not it?

wicked atlas
#

that is git bash

#

Still, just try installing it again

odd mango
#

installing what

wicked atlas
#

git

odd mango
#

from that link i installed git bash

#

where do i get git

wicked atlas
odd mango
#

this is it right

wicked atlas
#

I'm not sure what it is I'm looking at

odd mango
wicked atlas
#

Just try running the installer again. Sometimes things might not get configured properly when installing, so if something dosen't work like it's supposed to after being installed, it's a good idea to try that installation again

digital mason
#

Has anyone worked with slash commands in disnake

#

I want to know if it's possible to have an option that can take an array of a type, for example tagging multiple members and getting all of them in a single array

#

Something like this : users:List[Member]=None

left idol
#

if i have a command that does a bunch of stuff with the inputted arguments, can i use them during button interaction?

#
class View(discord.ui.View):
    @discord.ui.button(label="Approve", style=discord.ButtonStyle.green)
    async def button_callback(self, button, interaction):
        guild = bot.get_guild(ID)
        role = guild.get_member(interaction.user.id).get_role(ROLEID)
        if role is None:
            await interaction.response.send_message("No perms to interact")
        else:
            discordID = player.id
            robloxuser = bloxlink(discordID)
            embed = discord.Embed(title = f'{player.name}', description = f'<@{discordID}> : {robloxuser} added to {team}', color = discord.Color.blue())
            sheets(robloxuser, team, tmz)
            await interaction.response.edit_message(content = None, embed=embed , view=None)
potent spear
smoky cedar
#

I cannot figure out how to get my discord bot to accept commands while a task is looping

wicked atlas
#

Shouldn't have to be something you have to figure out. What code do you have?

smoky cedar
#

The bot is constantly looping to check for new releases

#

But during that loop, it wont accept slash commands

wicked atlas
#

how are you looping?

smoky cedar
#
@tasks.loop(minutes=1)
async def do_something():
    while True:
        continue
#

This is just an example, I'm using tasks.loop

wicked atlas
#

Are you using that while True: loop?

smoky cedar
#

Nah of course not

#

But even still if I was I need the bot to accept commands during it

wicked atlas
#

😮‍💨

smoky cedar
#

But no while true, can send the whole method if you like

wicked atlas
#

tasks shouldn't be blocking the command portion of the bot from running

#

Yeah, can you send the task?

smoky cedar
#
@tasks.loop(minutes=1)
async def send_new_releases():
    artists = db.get_all_artists()
    for artist in artists:
        channel_id = db.get_music_channel_id_for_guild_id(artist.id)
        channel = client.get_guild(int(artist.id)).get_channel(int(channel_id))
        # update channel hasn't been set yet
        if channel is None:
            continue
        artist_role = channel.guild.get_role(int(artist.role_id))
        # server has manually deleted this artist from their roles
        if artist_role is None:
            db.remove_artist(artist)
            continue
        newest_release = get_newest_release_by_artist_id(artist.id)
        if newest_release is None:
            continue
        newest_release_id = newest_release['id']
        # If we haven't already notified the channel of this release
        if artist.latest_release_id != newest_release_id:
            db.set_latest_notified_release_for_artist_in_guild(artist_id=artist.id, new_release_id=newest_release_id)
            release_url = newest_release['external_urls']['spotify']
            message = await channel.send("<@&%s> New Release!\n:white_check_mark:: Assign Role."
                                         ":x:: Remove Role.\n%s" % (artist.role_id, release_url))
            await add_role_reactions_to_message(message)
wicked atlas
#

what are you using for db and get_newest_release_by_artist_id?

smoky cedar
#

db is my utility class db=MusicDatabase()

#

The latter is a method in my spotify api utility file

#

Should the bot still accept commands during the While True version though?

#

Because that's what I'm using for testing

wicked atlas
#

while true loops are blocking, which is why you shouldn't use them in asyncronous programs

smoky cedar
#

Gotcha, so wont work for my testing

#

What's the difference with the bot executing different code though?

#

It's still preoccupied right

digital mason
smoky cedar
#

But I need it to accept the command regardless of being occupied

wicked atlas
#

Just like a while true loop, make sure that your DB methods and API call methods aren't blocking as well. As long as they "finish fast enough" or are asyncronous, you should be good

smoky cedar
#

Hmmph

wicked atlas
#

for API calls, I would suggest using aiohttp, which discord.py uses, and calling api methods using the bot's ClientSession

potent spear
smoky cedar
#

Since the task loops every single minute though, there is no speed that could solve this issue no?

digital mason
#

What I need is to make the slash command have an option that is basically an array or a collection of the same type like discord emoji or anything

smoky cedar
#

There will always be moments in which the bot cannot accept the command

digital mason
potent spear
#

it sure is

digital mason
#

I love slash commands

wicked atlas
digital mason
#

But how can I get the array

#

Oh I see

#

*members

potent spear
#

the difference between
*, members and *members is also explained in that link iirc

wicked atlas
#

wrong ping

potent spear
wicked atlas
odd mango
#

hey i got a red list of errors when i tried to install python levenshtein

#

what do i do

atomic path
digital mason
#

I also have an option wich choices, could it be the one causing the issue

potent spear
wicked atlas
atomic path
digital mason
#

While still using slash commands

potent spear
#

I've never used slash commands or anything v2 related unfortunately

ivory raptor
fallow mauve
#

what would you say is the best API wrapper for discord.py? disnake, pycord, etc.

im thinking of switching from discord.py to smth that wont be discontinued

fading marlin
fallow mauve
#

it isnt?

fading marlin
#

no, it isn't discontinued. It previously was, yes, but now it's being developed again

fallow mauve
#

since when

fading marlin
stone beacon
#

2

fallow mauve
#

ok

#

still, could you answer my question anyway?

#

in case i need it later

stone beacon
#

I use nextcord

fallow mauve
#

ok

stone beacon
#

Disnake is great as well

#

They're really forks tbh they're gonna be extremely similar

fallow mauve
#

ok

#

i googled what the term was and it said api wrapper so

stone beacon
#

Sounds like a #python thing idea
K what yr asking or what that has to do with the library

fallow mauve
#

ok another thing, how would yall suggest making a database for my bot? idk what exactly would be in it but whats simple and not json?

fading marlin
#

you're not even asking any questions? you're just stating something

fallow mauve
fading marlin
fallow mauve
#

ok thx

flint isle
odd mango
stone beacon
#

Make sure it's async sqlite for your bot

fallow mauve
flint isle
fallow mauve
fading marlin
odd mango
#

i use fuzzywuzzy to match my command args

#

fuzzywuzzy requires levenshtein

#

also in pycharm, how do i hide my bots token

fading marlin
#

that's not related to discord bots though. Just because you're trying to use a library with a discord bot doesn't mean it's an issue that belongs in this channel

odd mango
#

okay okay i get it

odd mango
potent spear
odd mango
#

used to replit until 30 mins ago

potent spear
#

there were venvs there, right?

odd mango
#

if you mean this, then yes i see that

potent spear
#

alright, I hope you know what that is

odd mango
#

i wish i did 😭

potent spear
#

check the pycharm docs

#

it's a virtual environment