#discord-bots

1 messages · Page 877 of 1

boreal ravine
quaint epoch
#

but they only exist in the cogs? and i removed them by doing bot.remove_command('rules') bot.remove_command('rule') bot.remove_command('rule_add') bot.remove_command('rule_remove') bot.remove_command('rule_replace') the last few restarts

boreal ravine
#

show the exception

#

they are the same thing

quaint epoch
#

this is what happens when i run a command in the cog without removing the commands and adding the cog first - Ignoring exception in command rules: Traceback (most recent call last): File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\bot_base.py", line 570, in invoke await ctx.command.invoke(ctx) File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 912, in invoke await self.prepare(ctx) File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 846, in prepare await self._parse_arguments(ctx) File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 752, in _parse_arguments transformed = await self.transform(ctx, param) File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 578, in transform raise MissingRequiredArgument(param) disnake.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing.

pliant gulch
#

slash commands are apart of application commands

#

specifically the API calls them CHAT_INPUT

quaint epoch
boreal ravine
#

i mean

#

add another parameter to the command

manic wing
shut axle
#
@client.command()
async def casinoh(ctx, reason=None, member: discord.Member=None):
    member = member or ctx.author
    if reason is None:
        await ctx.reply("❌ אתה חייב להכניס סיבה!")
    await ctx.send("<@&948997997860126740>")
    embed = discord.Embed(
        color = discord.Color.green(),
        description = f"המשתמש {member.mention} צריך עזרה בקזינו!\n`סיבה:` {reason}",
    )
    embed.set_author(name="Casino Help", icon_url="https://media.discordapp.net/attachments/889822776024768573/949006996714168340/Comp_1_1.gif")
    await ctx.send(embed=embed)

No error but why I send the message without a reason it not only send the error message which says you have to put a reason it actually sends both of the messages.

boreal ravine
#

greek?

boreal ravine
#
async def uwu():
    if ...:
        return ...
shut axle
#

return await ?

boreal ravine
#

yea

#

dogepopcorn 👍

#

no more questions

slim ibex
#

you only use return await if are calling a coroutine in the return statement, no?

slate swan
boreal ravine
#

they did?

slim ibex
#

its already defauled to None

slate swan
slim ibex
#

that check is not needed, and tbh i would put member arg before reason

slate swan
#

guys read again02shrug

final iron
sick birch
boreal ravine
#

I'm gonna dip

slim ibex
#

y

boreal ravine
#

cya guys

slim ibex
#

k pce

boreal ravine
slate swan
boreal ravine
#

robin needs to stop flexing his reaction permissions, not cool 😢

slate swan
#

fr

boreal ravine
#

checking for it's type is better than checking for it's value

pliant gulch
#

It's actually faster to check for None than to check for a truthy value

#

Because that would mean checking over multiple things

slate swan
#

idk because is compares the id and == compares the value not is better as its short and None returns False

pliant gulch
#

Also it's just good practice to compare the pointers when dealing with None

slate swan
#

to specify the value or idyert

pliant gulch
#

Doesn't mean you are fine writing sloppy code 24/7

#

That's just not a good mindset

manic wing
#

tell em andy

slate swan
boreal ravine
#

also maybe because ```py
x = []

if not x:
print(x) # prints the list

if x is None:
print("it's none") # wont print

manic wing
#

no

#

it wont print the first time because [] is False

pliant gulch
#
print(x or "It's none")
boreal ravine
#

yea

manic wing
#

!e print(bool([]))

unkempt canyonBOT
#

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

False
boreal ravine
#

falsey value

manic wing
unkempt canyonBOT
#

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

[]
manic wing
#

whelp

boreal ravine
slate swan
#

well arent they both true?🗿

unkempt canyonBOT
#

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

001 | its 0
002 | False
boreal ravine
slate swan
#

0 returns? False interestinglemon_glass

boreal ravine
#

if bool(y)

slate swan
#

!e print(bool(0))

pliant gulch
#

Keep in mind okimii False is zero

#

!e ```py
print(False.real)

slate swan
unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

0
boreal ravine
#

0 = false
anything above 1 = true

slate swan
#

i forgot 0 is false and true is 1

pliant gulch
#

Yep, C doesn't have bools, they used ints instead

#

So python also uses integers

slate swan
unkempt canyonBOT
#

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

False False False False False False False True
#

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

hi
slate swan
#

guess its True get it02comfy

pliant gulch
#

Well there is no reason why ... shouldn't be truthy

boreal ravine
#

ellipsis is true?

pliant gulch
#

It's an object, you wouldn't want your classes to randomly become not truthy

slate swan
boreal ravine
#

yes? did you not know that Bruhmoment

slate swan
boreal ravine
#

ok

slate swan
#

i know about ellipsis because of typehints

sick birch
boreal ravine
#

I know about ellipsis because I google shit

pliant gulch
#

You didn't learn about it in like 5th grade?

#

👁️ 👁️

sick birch
#

i probably did but ellipsis sounds stupid

slate swan
slate swan
pliant gulch
slate swan
#

you're old thopithink

boreal ravine
slate swan
#

you guys talked about computers in 5th grade?lemon_glass

boreal ravine
#

asian schools are depressing SadgeCry

pliant gulch
boreal ravine
#

English isn't even my mother tounge lol

slate swan
#

same

pliant gulch
#

Me neither

slate swan
#

we have an excuseyert

boreal ravine
#

we scared the person away

slim ibex
#

🗿

slate swan
livid jacinth
#

Why i get an error but its working if i use py after.activity.type ?

sick birch
#

What error?

livid jacinth
#

activity_type = after.activity.type
AttributeError: 'NoneType' object has no attribute 'type'

sick birch
#

Probably because the user stopped doing something, e.g stopped playing a game or listening to spotify

#

Use a typeguard to make sure that doesn't happen

boreal ravine
#

whats a typeguard?

livid jacinth
#

Yes the error comes when that happen but how can i stop that error

slate swan
sick birch
#
if after.activity is not None:
  print(after.activity.type)
#

i think that's a typescript term but it still applies

boreal ravine
#

smh

sick birch
#

One of the things I like about it, after.activity would be typehint to an activity or none so if you try to access .type it would say "hey this could be none, so you can't do that"

livid jacinth
shut axle
#

How can I make a mute cmd for example and for the reason I can type with spaces....

dry kelp
#

How can i put a custom emoji to the discord bot status? i tryna put the ukraine flag

boreal ravine
#

impossible

#

also why do you wanna put the Ukraine flag

dry kelp
#

multiple status

dry kelp
#

including support for ukraine + none of ur business

dry kelp
#

"ua"

slate swan
boreal ravine
dry kelp
#

multiple status? impossible?

boreal ravine
shut axle
#
@client.command()
async def ch(ctx, reason=None, member: discord.Member=None):
    member = member or ctx.author
    if reason is None:
        return await ctx.reply("❌ אתה חייב להכניס סיבה!")
    await ctx.send("<@&948997997860126740>")
    embed = discord.Embed(
        color = discord.Color.green(),
        description = f"המשתמש {member.mention} צריך עזרה בקזינו!\n`סיבה:` {reason}",
    )
    embed.set_author(name="Casino Help", icon_url="https://media.discordapp.net/attachments/889822776024768573/949006996714168340/Comp_1_1.gif")
    await ctx.send(embed=embed)

I have this working but when I type: .ch dshb dshgds d with spaces it doesn't work

dry kelp
#

i meant activity

boreal ravine
#

oh

slate swan
#

ig you can copy paste the id to the playing status

dry kelp
#

activity == status in normal terms

dry kelp
#

like <emojiid...

slate swan
dry kelp
#

wtf

dry kelp
boreal ravine
slate swan
boreal ravine
slate swan
#

\🇺🇦

dry kelp
#

no like

#

🇺🇦

#

but the real name is ua

slate swan
dry kelp
slate swan
#

mhm

dry kelp
#

🇺🇦

#

oh ye? lemme see

slate swan
#

remember emoji formats are like that 02smile0

#

or if you have an ide you can copy paste it

dry kelp
#

no sadly u can't... the only way to see it is by phone

#

when i use "ua" copy paste emoji

#

ye need it in the status

slate swan
#

copy paste this 🇺🇦

dry kelp
#

i tried

#

says "ua"

slate swan
#

yeah

dry kelp
slate swan
#

sadly

dry kelp
slate swan
#

just google it02think

dry kelp
#

i can see it from phone tho

plucky shoal
#

You can use \ for raw text

dry kelp
#

i tried .. still ua

slate swan
alpine furnace
#

It works on some platforms, at least

dry kelp
#

i think everyone can choose what to do with they own bot 🙂

slate swan
#

guys lets not judge others by their beliefs 02comfy

dry kelp
#

i mean u said it shouldnt be political

#

ye but i can do whatever i want with it

#

ty for ur approval 🙄

slate swan
#

guys thats like saying dont tattoo your body its your choice 02comfy

#

so pls dont fightcatgun

boreal ravine
#

well

#

at least they aren't putting their bots logo above the Ukraine flag

alpine furnace
#

Does it matter?

boreal ravine
#

no clue

slate swan
#

guys

#

!ot sorry MarinLove

unkempt canyonBOT
alpine furnace
#

Bro you have said this 3 times just let the convo finish takes like one minute

slate swan
#

ugh but the rulesrooFight

boreal ravine
#

he's saying facts lol

slate swan
final iron
#

Too bad

cold sonnet
boreal ravine
slate swan
#

Should a .db file be created? (sqlite3)

#

yes

#

And I don't have it

#

(git.hub)

boreal ravine
slate swan
#

Why is the file not being created by git?

boreal ravine
#

maybe

#

you are ignoring the file

#

in a .gitignore

slate swan
#

🤔

#

What?

manic wing
peak loom
#

how do I install this?

manic wing
boreal ravine
#

that looks like a folder

boreal ravine
peak loom
boreal ravine
#

just preference

manic wing
#

.sqlite3 better

#

no reason but its better pithink

peak loom
manic wing
#

ok

slate swan
boreal ravine
#

doesn't really matter

manic wing
slate swan
boreal ravine
#

you can name it anything as long as it isn't valid language bigbrain

slate swan
velvet tinsel
#

People flexing their nitro 😔

slate swan
peak loom
boreal ravine
peak loom
peak loom
boreal ravine
#

by creating a folder named cogs

manic wing
cold sonnet
cold sonnet
#

say you're a girl

peak loom
manic wing
#

you cant give me no info and expect me to resolve it for you

slate swan
#

Can anyone help me with my command error handler? It doesnt send a message

velvet tinsel
boreal ravine
peak loom
velvet tinsel
#

just be nice in a server and someone will eventually gift you nitro 🤷
Contradictory statement innit

slate swan
#
async def on_command_error(ctx,error):
    if isinstance(error,commands.MissingPermissions):
        await ctx.send("You cannot do that!")
        await ctx.message.delete()``` It doesnt send nor delete the message.
velvet tinsel
manic wing
manic wing
velvet tinsel
slate swan
slate swan
velvet tinsel
#

did you use asyncio.sleep?

boreal ravine
velvet tinsel
slate swan
#

Its just weird, Is there a special version of python i need to use?

boreal ravine
#

well

cold sonnet
boreal ravine
#

above python v3.6

slate swan
#

I tried 3.7, does the same thing.

quaint epoch
#

how do i get the total length of message in a channel?

slate swan
#

python 2kek

velvet tinsel
boreal ravine
unkempt canyonBOT
final iron
velvet tinsel
#

Is that even a thing lmao

slate swan
quaint epoch
slate swan
quaint epoch
#

like, all of the messages sent in the channel

final iron
velvet tinsel
boreal ravine
quaint epoch
slate swan
#

he means the len of msg objects02comfy

boreal ravine
unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destination’s message history.

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

Examples

Usage...
velvet tinsel
boreal ravine
slate swan
final iron
#

Idk he worded it terribly

#

Not what you're saying though

quaint epoch
slate swan
#

Still doesn't send on the command, Would someone be able to hop in a call with me and see what the issue is?

#

he means get how many msgs were sent in a channel02smile0

velvet tinsel
quaint epoch
#

so like channel_list = list(ctx.channel.history) len(channel_list)

velvet tinsel
#

Did you wait before deleting the message?

slate swan
#

how do i create a bot instance?

boreal ravine
quaint epoch
velvet tinsel
slate swan
#

oh did it change?

velvet tinsel
unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

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

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

im used to discord.commands()

slate swan
velvet tinsel
velvet tinsel
quaint epoch
slate swan
boreal ravine
#

it's an async for loop

quaint epoch
#

i just want to total number of messages

boreal ravine
slate swan
quaint epoch
boreal ravine
slate swan
velvet tinsel
quaint epoch
#

imma figure it out

slate swan
slate swan
#

what instance are you getting then

velvet tinsel
velvet tinsel
velvet tinsel
#

It’s already made for you pithink

velvet tinsel
slate swan
#

you need a class instance to use its methods many times so you dont have to make a bot instance each time02comfy

#

Its just making me mad cause i cant figure out the issue

#

@velvet tinsel i dont know whats happening

boreal ravine
#

import commands

velvet tinsel
boreal ravine
#

Danny didn't import the folder in the init file

quaint epoch
velvet tinsel
#

from discord.ext import commands

velvet tinsel
slate swan
#

oh

#

now i remember, thanks

slate swan
#

name space?02think

boreal ravine
#

makes sense?

slate swan
#

yes02comfy

quaint epoch
#

what would a purgeban command do?

dry kelp
#

can the bot check if a change is being made to this?

boreal ravine
#

probably yes

velvet tinsel
quaint epoch
boreal ravine
quaint epoch
#

oh no

#

anyway

cold sonnet
#

is this a reference

dry kelp
#

@boreal ravine can u send me the docs or smth?

#

of that cuz ion find it

boreal ravine
#

i don't know

velvet tinsel
velvet tinsel
boreal ravine
#

I think it was something called "guild locale" through

quaint epoch
#

!src purgeban

unkempt canyonBOT
#
Command: cleanban

Same as ban, but also cleans all their messages from the last hour.

Source Code
dry kelp
quaint epoch
dry kelp
#

found it

manic wing
#

typically method/property names are pretty straight forward

boreal ravine
#

yea

#

d.py follows api docs pretty thoroughly

quaint epoch
#

!d disnake.Guild.unban

unkempt canyonBOT
#

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

Unbans a user from the guild.

The user must meet the [`abc.Snowflake`](https://docs.disnake.dev/en/latest/api.html#disnake.abc.Snowflake "disnake.abc.Snowflake") abc.

You must have [`ban_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.ban_members "disnake.Permissions.ban_members") permission to do this.
quaint epoch
manic wing
#

user object always

#

!d disnake.Object or this

unkempt canyonBOT
#

class disnake.Object(id)```
Represents a generic Discord object.

The purpose of this class is to allow you to create ‘miniature’ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.

There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.

x == y Checks if two objects are equal.

x != y Checks if two objects are not equal.

hash(x) Returns the object’s hash.
quaint epoch
#

got it

velvet tinsel
manic wing
#

as it says

The user must meet the abc.Snowflake abc.

cold sonnet
velvet tinsel
manic wing
quaint epoch
manic wing
velvet tinsel
# manic wing

haha, very funny, but actually, what's abc.Snowflake

quaint epoch
unkempt canyonBOT
#

class disnake.abc.Snowflake```
An ABC that details the common operations on a Discord model.

Almost all [Discord models](https://docs.disnake.dev/en/latest/api.html#discord-api-models) meet this abstract base class.

If you want to create a snowflake on your own, consider using [`Object`](https://docs.disnake.dev/en/latest/api.html#disnake.Object "disnake.Object").
velvet tinsel
velvet tinsel
manic wing
#

each snowflake is different, foreshadowing irl snowflakes

#

ez 9 at gsce english

boreal ravine
velvet tinsel
slate swan
#

whats wrong here?

boreal ravine
slate swan
#

i did but i dont get it

boreal ravine
#

you are calling a set object

slate swan
#

where?

boreal ravine
#
_ = set()
_() #error
boreal ravine
velvet tinsel
boreal ravine
#

no

velvet tinsel
#

ok kayle

slate swan
#

im not calling it anywhere, i dont even have sets

boreal ravine
velvet tinsel
#

📸 kayle I screenshotted that

boreal ravine
#

wait don't

slate swan
#
async def trade(ctx, price: float, buy: bool = True):
    calc = Calculator(price=price, buy=buy)
    tps = calc.get_tps()
    sls = calc.get_sls()
    side = 'Long' if buy else 'Short'

    tp_list = list()
    sl_list = list()

    for tp in tps:
        percentage = tp['percentage']
        tp_ = tp['tp']
        difference = tp['difference']

        item = f'+{percentage:.2f}%'.ljust(7) + f' | {tp_:,.2f} | {difference}'
        tp_list.append(item)

    for sl in sls:
        percentage = sl['percentage']
        sl_ = sl['sl']
        difference = sl['difference']

        item = f'-{percentage:.2f}%'.ljust(7) + f' | {sl_:,.2f} | {difference}'
        sl_list.append(item)

    msg = Embed(title='Trade',
                description='---Info---\n\n'
                            f'Price: {price}\n'
                            f'Side: {side}\n'
                            '\n\n'
                            '---TP Table---\n\n'
                            f'{tp_list}\n\n'
                            '---SL Table---\n\n'
                            f'')```
boreal ravine
#

show full error

velvet tinsel
slate swan
#
  File "C:\Users\vilko\OneDrive\Desktop\Bitcoin\main.py", line 55, in <module>
    async def trade(ctx, price: float, buy: bool = True):
TypeError: 'set' object is not callable
velvet tinsel
slate swan
#

oh thanks

boreal ravine
#

.

velvet tinsel
#

...

manic wing
#

bot.commands returns a set not a wrapper

boreal ravine
#

im done

manic wing
velvet tinsel
#

same

boreal ravine
#

good night

velvet tinsel
#

I'm gonna do chemistry homework

velvet tinsel
quaint epoch
#

so i moved a few commands to a cog, when i ran a ban command it banned the user twice?

manic wing
quaint epoch
#

do i have to remove the command and add the cog for it to work?

#

because originally the command wasn't in a cog

manic wing
#

w h a t

quaint epoch
#

I moved the command to a cog?

manic wing
#

and?

quaint epoch
#

changed @bot.command to @commands.command defined self first in the params and such

#

and bot.add_cog(ban_cog(bot))

#

yes i name my cogs generic names

manic wing
#

typically cogs have multiple commands...so it would be like Moderation

#

but anyway, continue

quaint epoch
#

and ```py
def init(self, bot):
self.bot = bot

#

so, why is this happening?

manic wing
quaint epoch
#

i just put it behind bot.run()

manic wing
#

just put it after you define bot

quaint epoch
manic wing
#

thats infront not behind

#

ps its commands.Bot not commands.bot

quaint epoch
#

so any clue as to what might be happening?

manic wing
#

can I see any code?

quaint epoch
#
class ban_cog(commands.Cog):


    def __init__(self, bot):
        self.bot = bot

    @commands.command(aliases=('ban_user', 'ban_member'))
    @commands.has_permissions(ban_members=True)
    async def ban(self, ctx, member: discord.Member, *, reason='None'):
        await member.ban(reason=reason)
        await ctx.send(f'''**{ctx.message.author.mention}** banned **{member.mention}**:
    **{reason}**.''')
        try:
            await member.send(f'''{member.mention} you were banned from **{ctx.guild}** by **{ctx.author}**:
    **{reason}**''')
        except (discord.HTTPException, discord.errors.HTTPException, discord.ext.commands.errors.CommandInvokeError,
                commands.CommandInvokeError, commands.CommandError, AttributeError, discord.Forbidden):
            print(f'Cannot direct message {str(member)}.')```
manic wing
#

full code

quaint epoch
slate swan
#

how do i send multiple embeds in 1 msg

manic wing
quaint epoch
#

2.5k lines

manic wing
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**.
quaint epoch
#

wait a sec

#

lemme check smth

#

nope i don't have two ban commands

slate swan
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send() got an unexpected keyword argument 'embeds'
slate swan
#
info_emb = Embed(title='Info',
                     description=f'Price: {price:,}')

    tp_emb = Embed(title='TP Table',
                   description=f'{tp_list}')

    sl_emb = Embed(title='SL Table',
                   description=f'{sl_list}')

    await ctx.send(embeds=[info_emb, tp_emb, sl_emb])```
quaint epoch
slate swan
#

yes

quaint epoch
slate swan
#
@bot.command()
async def trade(ctx, price, buy: bool = True):
    price = float(price.replace(',', ''))
    calc = Calculator(price=price, buy=buy)
    tps = calc.get_tps()
    sls = calc.get_sls()
    side = 'Long' if buy else 'Short'

    tp_list = list()
    sl_list = list()

    for tp in tps:
        percentage = tp['percentage']
        tp_ = tp['tp']
        difference = tp['difference']

        item = f'+{percentage:.2f}%'.ljust(7) + f' | {tp_:,.2f} | {difference}'
        tp_list.append(item)

    for sl in sls:
        percentage = sl['percentage']
        sl_ = sl['sl']
        difference = sl['difference']

        item = f'-{percentage:.2f}%'.ljust(7) + f' | {sl_:,.2f} | {difference}'
        sl_list.append(item)

    tp_list = '\n'.join(tp_list)
    sl_list = '\n'.join(sl_list)

    info_emb = Embed(title='Info',
                     description=f'Price: {price:,}')

    tp_emb = Embed(title='TP Table',
                   description=f'{tp_list}')

    sl_emb = Embed(title='SL Table',
                   description=f'{sl_list}')

    await ctx.send(embeds=[info_emb, tp_emb, sl_emb])```
manic wing
#

we dont need to see the full command

velvet tinsel
manic wing
quaint epoch
slate swan
quaint epoch
#

i daresay, it's as bad as doing from discord import *

velvet tinsel
manic wing
manic wing
#

you 'daresay' out your ass

velvet tinsel
manic wing
#

theres nothing wrong with doing from discord import Embed

manic wing
quaint epoch
#

hey run this import os os.system('py -m pip install discord --upgrade')

velvet tinsel
quaint epoch
#

can anyone help me?

slate swan
#

ran it and still the same thing

quaint epoch
#

what python version u using

slate swan
#

idk

quaint epoch
#

!d platform.python_build

velvet tinsel
#

oh dear Caedens typing a lot of stuff

slate swan
#

3.9.7

quaint epoch
#

this is cursed

#

switch to disnake.

#

py -m pip install disnake

#

it might fix it

manic wing
# velvet tinsel I know, but if you're using other stuff (like `discord.Color`) it's just better ...

!star-imports || or you just do from discord import Color, Embed ... you guys talk about pep-8 to act fancy but all you're doing is talking out your ass. there is nothing wrong with doing from x import y
a) y may be used many times so would be more code efficient to import it at the start
b) its all about personal preference so there technically is no right or wrong answer except in the terms of efficiency, speed and practice
c) sometimes you might want to import a lot of things from discord which there is no problem with doing so
you guys literally do from discord.ext import commands but then say its 'just as bad as using a wildcard import' - you guys dont even know the problems of a wildcard import so im putting this here so you guys can actually get some knowledge about what exactly is wrong with wildcard imports and how that does not compare in the slightest with from x import y

unkempt canyonBOT
#

Star / Wildcard imports

Wildcard imports are import statements in the form from <module_name> import *. What imports like these do is that they import everything [1] from the module into the current module's namespace [2]. This allows you to use names defined in the imported module without prefixing the module's name.

Example:

>>> from math import *
>>> sin(pi / 2)
1.0

This is discouraged, for various reasons:

Example:

>>> from custom_sin import sin
>>> from math import *
>>> sin(pi / 2)  # uses sin from math rather than your custom sin

• Potential namespace collision. Names defined from a previous import might get shadowed by a wildcard import.
• Causes ambiguity. From the example, it is unclear which sin function is actually being used. From the Zen of Python [3]: Explicit is better than implicit.
• Makes import order significant, which they shouldn't. Certain IDE's sort import functionality may end up breaking code due to namespace collision.

How should you import?

• Import the module under the module's namespace (Only import the name of the module, and names defined in the module can be used by prefixing the module's name)

>>> import math
>>> math.sin(math.pi / 2)

• Explicitly import certain names from the module

>>> from math import sin, pi
>>> sin(pi / 2)

Conclusion: Namespaces are one honking great idea -- let's do more of those! [3]

[1] If the module defines the variable __all__, the names defined in __all__ will get imported by the wildcard import, otherwise all the names in the module get imported (except for names with a leading underscore)
[2] Namespaces and scopes
[3] Zen of Python

slate swan
quaint epoch
manic wing
slate swan
#

i dont want to

quaint epoch
#

but it's practically the same

#

just import disnake as discord

slate swan
#

but even in docs there's no embeds, only embed

manic wing
manic wing
quaint epoch
#

maybe embed is a kwarg?

manic wing
manic wing
quaint epoch
#

huh, why did i suggest that?

manic wing
velvet tinsel
#

@quaint epoch what time is it there?

velvet tinsel
#

oh okay nevermind

boreal ravine
#

don't use disnake

velvet tinsel
#

okay

boreal ravine
#

use dyesnake, 20% better because it uses green dye

slate swan
#

already migratedhmmcat

velvet tinsel
unkempt canyonBOT
#
Huh? No.

Package could not be found.

velvet tinsel
#

humbug

#

@slate swan helppls

#

oh

slate swan
velvet tinsel
#

it's a joke
nevermind

quaint epoch
#

oh fuck

#

all of my commands are running twice

slate swan
#

2 bot instances

manic wing
#

⭕o do you want to know why that is?

manic wing
slate swan
manic wing
#

it is because you have await bot.process_commands(…) in an on_message but cogs already handle that for you because they are listeners not events

#

most likely

slate swan
#

i think he knows the difference between events and commands

manic wing
#

your logic is out the window

slate swan
#

"all of my commands are running twice" he means commands?

#

not listeners?

manic wing
#

💀

#

read what I wrote again xD

slate swan
manic wing
#

gOd aT PrOgRAmInG bTw

boreal ravine
velvet tinsel
#

🗿

slate swan
boreal ravine
#

@slate swan @manic wing you guys should coc tbh

slate swan
#

what

boreal ravine
#

first person to win with the most accurate % wins

velvet tinsel
#

clash of code

final iron
#

!ot

unkempt canyonBOT
velvet tinsel
#

not whatever you're thinking of

final iron
#

🗿

velvet tinsel
#

also I think okimii plays clash of clans

manic wing
#

as if that would be a fair competition

slate swan
#

no

velvet tinsel
#

ok

boreal ravine
velvet tinsel
boreal ravine
velvet tinsel
#

oh yeah lol

slate swan
#

i play clash royaleMarinDed

manic wing
boreal ravine
#

@slate swan answer

velvet tinsel
slate swan
slate swan
manic wing
#

as if

boreal ravine
#

i don't think thats what caeden meant

#

🗿

final iron
#

Can we keep it on topic?

manic wing
#

okimii even kayle is better than you

velvet tinsel
slate swan
velvet tinsel
final iron
#

Moderator ping time 🗿

slate swan
velvet tinsel
#

nooo-- I never did anything wrong

velvet tinsel
cold sonnet
slate swan
full lily
#

Yo quit arguing

slate swan
#

we arentThinkO_O

velvet tinsel
slate swan
#

no more :kek: 😔

boreal ravine
#

I fear one of us will get banned soon

slate swan
#

yesHehe

velvet tinsel
slate swan
#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

boreal ravine
#

i use replit and I copy lucas's code coolMoyai

boreal ravine
slate swan
#

fcc is better

#

guys, i fixed that problem with embeds. i had to download the experimental 2.00 version of d.py

cold sonnet
slate swan
cold sonnet
#

no

slate swan
cold sonnet
#

actually

#

how do you put links to an embed description

#

only for the word here

final iron
cold sonnet
#

"Suggest more topics" + "here"(url) + "!"

#

"Suggest more topics here!"

final iron
#

Ever heard of f-strings?

cold sonnet
#

no

final iron
#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

cold sonnet
#

should I know now

final iron
#

It's pretty simple

cold sonnet
#

everything's simple if you know how to do it

#

!source resources

unkempt canyonBOT
#
Tag: resources
Source Code
livid jacinth
#

hey how can i create an event that can be triggered on only one specific server?

cold sonnet
#

!source source

unkempt canyonBOT
#
Command: source

Display information and a GitHub link to the source code of a command, tag, or cog.

Source Code
final iron
cold sonnet
livid jacinth
final iron
#

!d discord.Member.guild

unkempt canyonBOT
final iron
#

And then get the guild id with:

unkempt canyonBOT
final iron
#

Then compare the id's

cold sonnet
dry kelp
#
    @purge.command()
    @commands.has_permissions(manage_messages = True)
    @commands.bot_has_permissions(manage_messages = True)
    @commands.cooldown(rate=1, per=20, type=commands.BucketType.member)
    async def image(self, ctx):

        def is_attachment(m):
            return m.attachments
            
        await ctx.message.delete()
        em = discord.Embed(title='![Ver](https://cdn.discordapp.com/emojis/858069322512859146.webp?size=128 "Ver") Purge Successful!', description=f'Successfully purged! (Can take a few seconds)', color=discord.Color.from_rgb(black1, black2, black3))
        await ctx.channel.send(embed=em, delete_after=15)
        await ctx.channel.purge(limit=200, check=is_attachment)
``` why is this def not working?
#

won't delete the attachments tbh

slate swan
#

hello

#

i need help

#

a serverinfo cmd

cold sonnet
#

what do you need help within that?

final iron
#

Code/error?

dry kelp
#

what's this checking?

slate swan
#
@client.command(aliases=['si'])
async def serverinfo(ctx):
  name = str(ctx.guild.name)
  description = str(ctx.guild.description)
  guild22_owner = str(ctx.guild.owner)
  own4er = discord.Guild.owner
  id = str(ctx.guild.id)
  region = str(ctx.guild.region)
  mc = str(ctx.guild.member_count)
  text = len(ctx.guild.text_channels)
  voice = len(ctx.guild.voice_channels)
  cat = len(ctx.guild.categories)
  channels = text + voice
  rolet = len(ctx.guild.roles) 
  guild_owner = client.get_user(int(ctx.guild.owner))

  bots = [bot.mention for bot in ctx.guild.members if bot.bot]
   
  embed = discord.Embed(title=f"{name}",description=f'\n**owner**\n{guild_owner}\n\n**created**\n\n\n**members**\n``{mc}``', color=0xFFFFFF)
  embed.add_field(name="server boost", value=f"![boost](https://cdn.discordapp.com/emojis/940308268805402644.webp?size=128 "boost") ``{str(ctx.guild.premium_subscription_count)}``", inline=True)
  embed.add_field(name="id", value=f"``{id}``", inline=True)
  embed.set_footer(text=f"{ctx.author}")
  embed.timestamp = datetime.datetime.utcnow()
  await ctx.message.reply(embed=embed,mention_author=False)
dry kelp
final iron
slate swan
#

lmfao dont worry im gonna delete some im js seeing what i wanna add

dry kelp
#

ctx.message.reply ??

slate swan
#

it works yes

dry kelp
#

can't he just use ctx.reply ?wtf

cold sonnet
#

he can

slate swan
#

bru

dry kelp
#

im pretty sure u don't need message

#

ctx.reply would work too

slate swan
#

ty but any help

cold sonnet
unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

slate swan
#

i have them all?

cold sonnet
#

you have members?

slate swan
#

yes

cold sonnet
#

even in the dev portal

slate swan
#

yes

final iron
final iron
slate swan
#

its my server

dry kelp
#

str???

#

u could use just ctx.guild.owner

final iron
final iron
#

Just spit balling

slate swan
#

ya i do

dry kelp
final iron
cold sonnet
#

are you sure you wanted to name the variable own4er

dry kelp
#

ye but is not needed

slate swan
#

why make them a str

#

do get the name and discrim?

dry kelp
slate swan
#

oh lol

dry kelp
#

like ctx.guild.owner gets name and discrim

slate swan
#

ik

dry kelp
#

im using it and it works perfectly fine

slate swan
#

it returns a member obj

final iron
dry kelp
#

ye but in his code

slate swan
#

im gonna try rn

#

and if you str the obj it returns the name and discrim

dry kelp
#

he doesn't really need str

final iron
#

guild_owner = client.get_user(int(ctx.guild.owner))

dry kelp
dry kelp
#

WHAT THE FUCK

cold sonnet
#

own4er = discord.Guild.owner

dry kelp
cold sonnet
#

I had to join

final iron
#

Why is he getting the owner anyway

dry kelp
#

i just saw that there are like 3 defines for it 😭

slate swan
dry kelp
#

@slate swan

slate swan
final iron
dry kelp
#

no don't do that .. look

unkempt canyonBOT
#

discord/member.py lines 300 to 301

def __str__(self) -> str:
    return str(self._user)```
slate swan
#

i deleted

final iron
#

!d discord.Member

unkempt canyonBOT
#

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

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/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/master/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/master/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.
dry kelp
#

change this line into guild_owner = ctx.guild.owner

#

@slate swan

slate swan
#

tysm.

dry kelp
#

👍

slate swan
final iron
cold sonnet
#

1 tip: don't variable everything

slate swan
#

make everything a one liner

dry kelp
slate swan
dry kelp
#

huh

slate swan
#

it keeps saying none

dry kelp
#

send code

cold sonnet
slate swan
#

oki

dry kelp
#

send it again @slate swan

slate swan
slate swan
dry kelp
#

😂

slate swan
#
@client.command(aliases=['si'])
async def serverinfo(ctx):
  name = str(ctx.guild.name)
  description = str(ctx.guild.description)
  guild_owner = ctx.guild.owner
  id = str(ctx.guild.id)
  region = str(ctx.guild.region)
  mc = str(ctx.guild.member_count)
 

   
  embed = discord.Embed(title=f"{name}",description=f'\n**owner**\n{guild_owner}\n\n**created**\n\n\n**members**\n``{mc}``', color=0xFFFFFF)
  embed.add_field(name="server boost", value=f"![boost](https://cdn.discordapp.com/emojis/940308268805402644.webp?size=128 "boost") ``{str(ctx.guild.premium_subscription_count)}``", inline=True)
  embed.add_field(name="id", value=f"``{id}``", inline=True)
  embed.set_footer(text=f"{ctx.author}")
  embed.timestamp = datetime.datetime.utcnow()
  await ctx.message.reply(embed=embed,mention_author=False)
cold sonnet
dry kelp
#

wtf

slate swan
#

ok

dry kelp
#

it shouldn't get it None

dry kelp
#

pretty sure that shouldn't be None

dry kelp
#

can u invite me to ur server rq? @slate swan

slate swan
#

yes

#

what even for

cold sonnet
#

hehe ignored

slate swan
cold sonnet
#

stop zerotwo

slate swan
final iron
slate swan
#

im not even sure why he makes the guild name a str if it already returns a strcatsip

final iron
#

!d discord.Guild.description

unkempt canyonBOT
slate swan
unkempt canyonBOT
slate swan
final iron
slate swan
#

water_gazes bro

dry kelp
#

pretty sure he doesn't have the intents enabled

cold sonnet
#

Python bot literally makes fun of it

#

by using the normal python urls

final iron
cold sonnet
#

!d discord.Embed.url

unkempt canyonBOT
final iron
#

Oh yeah that

#

Just doing is easier imo

sage otter
#

You can’t do that with titles tho

cold sonnet
#

this is like the same as here with , but the color of the title doesn't change

cold sonnet
slate swan
#

you guys mean hyperlinks

cold sonnet
#

dunno, I just learned it

sage otter
final iron
slate swan
#

no

sage otter
#

You literally can’t but ok

cold sonnet
#

what can't you do with titles

slate swan
#

discord doesnt format hyperlinks on a title

sage otter
#

Hyperlink them without the Embed.url

cold sonnet
sage otter
#

without Embed.url

cold sonnet
#

now we're gonna look at it and me gonna be wrong

#

!source d

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
sage otter
#

Channel.permissions_for(Member | Role)

#

You asking for that?

#

Oh

#

Just look at discord.Permissions

#

!d discord.Permissions

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/master/api.html#discord.Permissions "discord.Permissions") similar to [`update()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.update "discord.Permissions.update").
cold sonnet
#

I'm still looking at it and I can't find the embed

lost lichen
#

can i keep track of how many times a command has been run by the same user?

#

in a file or something?

cold sonnet
#

database

lost lichen
#

with disnake

cold sonnet
#

still database

lost lichen
cold sonnet
#

👍

#

I think the Python bot bamboozled us

#

I think it gave use the wrong command

#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

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

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

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/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.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/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/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
unkempt canyonBOT
#

bot/exts/info/doc/_cog.py lines 307 to 311

embed = discord.Embed(
    title=discord.utils.escape_markdown(symbol_name),
    url=f"{doc_item.url}#{doc_item.symbol_id}",
    description=await self.get_symbol_markdown(doc_item)
)```
cold sonnet
#

!d discord.utils.escape_markdown

unkempt canyonBOT
#

discord.utils.escape_markdown(text, *, as_needed=False, ignore_links=True)```
A helper function that escapes Discord’s markdown.
cold sonnet
#

interesting

#

ey, this is usable shit

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.
left crater
#

how can i make it so that when someone presses a button it creates a dm with them?

cold sonnet
#

send them something

#

!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**.
left crater
#

no because after that i want it to ask a question and they are supposed to respond

cold sonnet
#

what stops you from sending him a message again

#

and using bot.wait_for

#

but if you'd like

#

almost

#

!d discord.Member.create_dm

unkempt canyonBOT
#

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

Creates a [`DMChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.DMChannel "discord.DMChannel") with this user.

This should be rarely called, as this is done transparently for most people.
left crater
#

how do i use bot in buttons

cold sonnet
#

interaction is as ctx

left crater
#

do i need to pass it in the init method

peak loom
#

Code is attached but ow would I fix this json error?

left crater
#

like self.bot = bot?

unkempt canyonBOT
#

When using JSON, you might run into the following error:

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This error could have appeared because you just created the JSON file and there is nothing in it at the moment.

Whilst having empty data is no problem, the file itself may never be completely empty.

You most likely wanted to structure your JSON as a dictionary. To do this, edit your empty JSON file so that it instead contains {}.

Different data types are also supported. If you wish to read more on these, please refer to this article.

pliant gulch
#

Make sure the json is not empty

#

Also when comparing ids you must make sure they are integers, as in JSON you have to store them as strings iirc

peak loom
#

Wait....

#

When I made the Reaction roles I forgot to add the json file. Maybe that has to do something with it.

#

@pliant gulch What would I put in the JSON file when empty?

pliant gulch
#

{}

peak loom
final iron
#

It simply isn't one

peak loom
final iron
peak loom
peak loom
final iron
#

Perhaps

peak loom
final iron
peak loom
tacit storm
#

give us a traceback and full error.

tacit storm
#

alright

tacit storm
#

wait

#

i dont think that permission exists?

#

unless Mute Members is a custom permission you made.

#

Hm

#

well try changing it to "manage_members"

tacit storm
#

hm strange.

#

wait

#

OHH

#

maybe try manage_messages?

since it's for muting, right?

#

ah

#

well im not sure then honestly.

left crater
#
  File "C:\Users\nikit\PycharmProjects\discord.py\discord\ext\commands\bot.py", line 994, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\nikit\PycharmProjects\discord.py\discord\ext\commands\core.py", line 894, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\nikit\PycharmProjects\discord.py\discord\ext\commands\core.py", line 176, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send() got an unexpected keyword argument 'view'``` my button commands were working fine but now it is saying this for some reason
final iron
wispy spade
#

Depends. If the member the command is being run on is the owner or has higher role than the bot, then it will simply error since it can't really do much.

left crater
#

2.0

#

it was working completely fine yesterday

#

idfk what happened

final iron
#

Just use timeout

#

!d disnake.Member.timeout

unkempt canyonBOT
#

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

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
tall venture
slow estuary
#

Can anyone help me out

native wedge
#

how do i get a list of member's name in discord server ?

#

i want to make my bot's status a task loop where every 30 seconds it says
Watching insert name here

slate swan
unkempt canyonBOT
#

property members: List[discord.member.Member]```
A list of members that belong to this guild.
slate swan
#

just get a random member which the Member obj has a name attr

unkempt canyonBOT
#

property name```
Equivalent to [`User.name`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.name "discord.User.name")
maiden fable
maiden fable
#

So uninstall all of them

left crater
#

Oh

#

How do I uninstall a library?

maiden fable
#

pip uninstall <lib>

left crater
#

Ok

#

@maiden fable it works thanks

maiden fable
#

Cool!

maiden fable
boreal ravine
#

it'll rate limit his bot

maiden fable
boreal ravine
#

should change it to a minute instead

slate swan
#

yeah the gateway handles it i was told by andyHehe

#

since its not like a command to the gateway its 2/1 iirc

#

probably wrong lolkek

maiden fable
#

And the ratelimit is like 120/60s for the gateway

pliant gulch
#

1/30s probably won't break the gateway limit

#

Although it isn't recommend by discord staff either way a it uses bandwith still

maiden fable
#

The gateway limit is 120/60s bruv

#

Ah wait nvm, I get what u mean

slate swan
maiden fable
#

Ywa

midnight gorge
#
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_option 
#

Are this imports are right?

final iron
#

Why use that lib

#

Just use a lib with baked in support

#

Like disnake

frozen patio
#

My cog command wont even work, why?

midnight gorge
boreal ravine
#

or use slash_util

final iron
midnight gorge
slate swan
midnight gorge
#

token = 'token_here'
client = discord.Client()
client = commands.Bot(command_prefix=";", intents=discord.Intents.all())
slash = SlashCommand(client, sync_commands=True)

frozen patio
midnight gorge
#

Slash = SlashCommand

Turns red

tacit storm
slate swan
boreal ravine
tacit storm
tacit storm
final iron
frozen patio
slate swan
final iron
frozen patio
midnight gorge
tacit storm
boreal ravine
tacit storm
#

in the init.

client can work but only if you define in the params of init

frozen patio
#

im using client for decorators and stuff, so I thought to use client

torn sail
boreal ravine
tacit storm
frozen patio
#

well its not working

torn sail
#

Oh sorry didn’t see

tacit storm
#

capitalize the first letter of cog when you did you class

frozen patio
#

let me try now

midnight gorge
tacit storm
#

did you

#

did you just expose your token?

midnight gorge
frozen patio
#

didnt work either

midnight gorge
#

well it is

boreal ravine
tacit storm
# frozen patio nope

then i dont know, because thats all the issues with tje cog.

this is a problem with how you’re prob loading the cog

frozen patio
midnight gorge
tacit storm
#

wait nvm

frozen patio
tacit storm
#

idk ngl

frozen patio
#

cause it just

#

wont

#

work

midnight gorge
#

like that?

frozen patio
#

OH WAIT

#

i think i fixed it

#

the file wasnt in a folder

mellow gulch
#

alr how would I go through the most recent msgs of a channel using the channel name im using nextcord

boreal ravine
#

!d discord.TextChannel.history you can then use this method to get the most recent messages in a channel

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destination’s message history.

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

Examples

Usage...
boreal ravine
mellow gulch
#

For more context im trying to make it so that it will take the most recent msg from a channel and then see if it started with the person actually counting cuz it is a counting channel

#

So i want it to go from where the e last person started