#discord-bots

1 messages Β· Page 1009 of 1

pseudo portal
#

πŸ˜… im sorry, i prolly sound dead stupid but am rlly new with python πŸ˜„

supple thorn
#

Oh slash commands

#

I don't use slash commands

frozen patio
lone aurora
#

how can i make it so that the bot spams a message to someone

slate swan
#

dont

lone aurora
#

ok but what if i was trying to test smth

velvet compass
#

Doesn't seem like something we would help with

vocal snow
#

Why would you need to test message spam

velvet compass
#

Due to rule 5 and all

slate swan
#

!rule 5

unkempt canyonBOT
#

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

lone aurora
#

F

slate swan
#

:>

slate swan
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

pseudo portal
# slate swan you should learn python before starting discord bots

ik, i did a basic basic 1 hour thing, ik its barely anything, its just i thought of a discord bot that wld be rlly helpful, and i just wanna get it made without havin to pay πŸ˜… i got pretty far, but was using if message.content.lower() instead of doin things properly πŸ˜„ now i wanna move it all to slash commands, started doin that but cant thigure out hybrid and slash πŸ˜„

slate swan
#

uh

#

big msg

pseudo portal
#

srry xD

pseudo portal
slate swan
#

i have to write like 20+ pages ;-; (homework)

pseudo portal
#

as a last resort i cld just do two of each comand and set one set to slash and one to prefix πŸ˜… but i dont think thats the way

pseudo portal
slate swan
#

dont ot πŸ˜‘

slate swan
slate swan
paper sluice
#

psst

slate swan
#

oh humanities

slate swan
#

we call sst here

#

oh

#

geo hist civic

#

economics

stiff gorge
#

it is

slate swan
slate swan
#

CIVICS

slate swan
slate swan
paper sluice
#

the study of the rights and duties of citizenship.

slate swan
slate swan
slate swan
#

guess how many maths book i have

paper sluice
#

2

slate swan
#

3

slate swan
paper sluice
#

he left

slate swan
#

guess how many pages on main book

paper sluice
#

3 textbooks? or supplementary incl?

slate swan
slate swan
#

close

#

dont ot skev

supple thorn
#

Guess how many science books i have

slate swan
supple thorn
#

No

slate swan
#

4

supple thorn
#

No

slate swan
slate swan
slate swan
#

both 1200 pages long uwu

supple thorn
#

A work book and a textbook

slate swan
#

bio chemistry phy

supple thorn
#

So it just multiples

slate swan
supple thorn
#

no

slate swan
paper sluice
slate swan
#

mina or brad90 will come and ot us

supple thorn
#

I need to learn about ctypes

supple thorn
paper sluice
#

no i just know lil bit of cpp

pseudo portal
stiff gorge
slate swan
slate swan
pseudo portal
stiff gorge
#

in vs im not able to use sm commands

pseudo portal
#

whys the think emoji frowning lol xD

slate swan
pseudo portal
#

aight

modern flare
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

modern flare
#

pog

slate swan
#

hi

pseudo portal
pseudo portal
slate swan
pseudo portal
slate swan
#

its test_guilds fyi

#

or idk about hybrids nvm

#

why not make your own?

#

how do i get the bots in a guild

supple thorn
unkempt canyonBOT
supple thorn
#

!d discord.Member.bot

unkempt canyonBOT
#

property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
slate swan
#

aight thanks

slate swan
#

thanks

pseudo portal
slate swan
#

does this ever proceed any further 😭

#

its been an hour and a half

pseudo portal
# slate swan πŸ«‚

thats weird.. i updated code with guild, the prefix command has updated, but slash commands all stuck with old ones still.. i needa wait a bit even with guild specified?

slate swan
#

!d discord.ext.commands.Bot.hybrid_command

unkempt canyonBOT
#

hybrid_command(name=..., *args, **kwargs)```
A shortcut decorator that invokes [`hybrid_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.hybrid_command "discord.ext.commands.hybrid_command") and adds it to
the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.add_command "discord.ext.commands.Bot.add_command").
torn sail
#

!d discord.app_commands.guilds

unkempt canyonBOT
#

@discord.app_commands.guilds(*guild_ids)```
Associates the given guilds with the command.

When the command instance is added to a [`CommandTree`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree"), the guilds that are specified by this decorator become the default guilds that it’s added to rather than being a global command.

Note

Due to an implementation quirk and Python limitation, if this is used in conjunction with the [`CommandTree.command()`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.CommandTree.command "discord.app_commands.CommandTree.command") or [`CommandTree.context_menu()`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.CommandTree.context_menu "discord.app_commands.CommandTree.context_menu") decorator then this must go below that decorator.

Example...
slate swan
#

dpy is getting weirder every update

torn sail
#

Yes

maiden fable
slate swan
#

stop, Hunter

maiden fable
#

Ain't hybrid those commands which are text as well as app commands?

pseudo portal
# torn sail Yes

wdym, im confused πŸ˜… so wadda i put? and i dont put in hybrid_command()?

maiden fable
#

So how are they same as app_commands deco?

slate swan
#

I really wanted to ask, what is the first argument in hybrid commands an instance of?

torn sail
#

guilds will only apply to the all commands

maiden fable
#

!d discord.ext.commands.hybrid_command

unkempt canyonBOT
#

@discord.ext.commands.hybrid_command(name=..., **attrs)```
A decorator that transforms a function into a [`HybridCommand`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.HybridCommand "discord.ext.commands.HybridCommand").

A hybrid command is one that functions both as a regular [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
and one that is also a [`app_commands.Command`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.Command "discord.app_commands.Command")...
slate swan
maiden fable
#

lemme see

slate swan
#

time to use hikari

maiden fable
#

Yea context is the first arg

slate swan
maiden fable
pseudo portal
#

im so confused πŸ˜‚

slate swan
#

How can I disable my cogs from accessing internal variables/functions

#

For example I don't want my cogs to be able to access the bot instance, etc

#

embed=embed needs to be embed=emb

slate swan
#

that's all i noticed, otherwise idk because i havent worked with slash commands yet

paper sluice
#

well, 'TextChannel' object has no attribute 'respond'

slate swan
#

ctx.reply?

#

wouldn't that just work?

paper sluice
#

yea?

slate swan
#

How can I disable my cogs from accessing internal variables/functions. For example I don't want my cogs to be able to access the bot instance, etc

pseudo portal
#

@slate swan was able to do prefix+slash with bridge xD

slate swan
#

from what I just realized.....dpy's hybrid commands are weird, hikari would be better

pseudo portal
#

πŸ˜… ye its confusin lol

paper sluice
#

huh, there is a thing to combine slash and normal commands?

slate swan
paper sluice
#

sadge

slate swan
#

its glitch

paper sluice
#
E:\Computer Science ➜  py -m Python.Code
relative import successful

E:\Computer Science ➜  cd .\Python\

E:\Computer Science\Python ➜  py -m .\Code\
C:\Program Files\Python310\python.exe: Relative module names not supported

@slate swan

paper sluice
slate swan
#

apparently 1k+ is more than 9

#

uh

slate swan
#

so that makes sense, thats just how the notifications have been designed its not a glitch

#

it is

#

glitch

slate swan
#

find me someone who ever got 10 notifs

slate swan
#

in google it show 1k+ pings

slate swan
slate swan
paper sluice
slate swan
slate swan
slate swan
pseudo portal
slate swan
#

i can explain reasons if you want me to

slate swan
slate swan
paper sluice
#

i made 2 commands that do the same thing one was slash and one was normal

#

πŸ’€ πŸ—Ώ

slate swan
# slate swan a couple if you can πŸ˜”
  1. as you already know easy hybrid commands

  2. inbuilt paginators and utils support ( for someone popping in with "pycord has that too", check the docs and source before saying that)

  3. Minimal OOP knowledge, plugins ( cog like stuff) can be used without explicitly Making a class

  4. optional components, you can use native hikari components and discord.py views ( with miru) too

#

that suffice pretty much ig

slate swan
#

and disnake doesnt even have hybrid cmds yet πŸ˜”

#

its worth it :p
and just let me know if you face any issues with it!

spring flax
slate swan
slate swan
#

yeah seems so

#

maybe

maiden fable
slate swan
#

πŸ˜”

#

its fixed now thanks you so much hunter

slate swan
paper sluice
#

if light was travelling through an opaque object

slate swan
compact ivy
#

alright, I have a question
Is it at all possible to set a status per-server for a bot?
I'm not seeing anything about it in the discord.py docs, but I might be missing something

compact ivy
#

ah, okay
Worth a shot!

May I ask why? Is it just an API limit, or is there another reason for it?

#

if you know of course

paper sluice
#

status is global

slate swan
#

ok

compact ivy
slate swan
#

yeah, sharding is a thing

#

!d discord.ext.commands.AutoShardedBot

unkempt canyonBOT
#

class discord.ext.commands.AutoShardedBot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
This is similar to [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") except that it is inherited from
[`discord.AutoShardedClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.AutoShardedClient "discord.AutoShardedClient") instead.
compact ivy
#

and now I'm going to dig into this rabbit hole heh

slate swan
#

Is there a way to check a text in a embed?

#

sure, depends on what part of the embed

boreal ravine
#

It's quite simple

slate swan
boreal ravine
#

You have one?

vale wing
#

By quite simple he means it's truly quite simple

cold sonnet
vale wing
#

Creates shards

#

Recommended to use for bots with > 1k guilds

cold sonnet
#

which are

#

that's a lot

#

but what are shards, elaborate

#

what does this change in code perspective

vale wing
#

I think it's about gateway

cold sonnet
#

I see something

#

you have to give a shard id in order to change your presence in one server

#

!d discord.AutoShardedClient.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example...
cold sonnet
#

!d discord.Client.change_presence prolly doesn't have this?

unkempt canyonBOT
#

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

Changes the client’s presence.

Example...
cold sonnet
#

gotcha

#

but idk how to create shards πŸ˜”

slate swan
#

I am here

#

AutoShardedBot

cloud dawn
#

Shard are like running multiple instances of the bot.

maiden fable
paper sluice
#

botomatically πŸ’€

slate swan
amber lynx
cloud dawn
amber lynx
#

oh okay

slate swan
#

message.content is not callable

dull terrace
slate swan
#

!pip validators

unkempt canyonBOT
dull terrace
slate swan
#

So I wanna make a thing like if the user uses a?item medal and the command written in code is d?item(ctx) . . .
Is it possible to do like if users says a?item medal bot sends price=1m
And if the user uses a?item ribbon bot sends price=500m

slate swan
slate swan
dull terrace
#

Have you considered using a drop down?

slate swan
slate swan
#

Depending on the items in the bot

slate swan
#

or yeah thats the first thing which came to my mind πŸ˜” groups would better

#
@bot.group()
async def item(ctx):
   ...

@item.command()
async def gold(ctx):
    ...
#

correct me if im wrong, Haven't used dpy for months.

#

!d discord.ext.commands.Group.command

unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to
the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
amber lynx
slate swan
#

Right?

unkempt canyonBOT
slate swan
#

Oooh nice

#

I’ll try it

slate swan
# slate swan yes!

Wouldn’t it be better to have all the item data in a dictionary and use arguments to get the items info?

slate swan
#

Instead of having to create a new block of code every item

#

It would be shorter and easier

slate swan
dull terrace
slate swan
dull terrace
#

Or you can check if it's in the message content, no great solutions for that

slate swan
dull terrace
#

I use about 4 drop downs for all the ones you can buy

#

4 different market types split across 2 NPCs

slate swan
#

Oh and how can I get a user’s avatar in Footer?

#

Avatar of the user who used the command

slate swan
dull terrace
#

I think the tidiest would be using a slash command with a value that's only for a URL, depending what they're doing. Makes life so much simpler.

cloud dawn
slate swan
slate swan
dull terrace
#

For the entire value

wide burrow
#

how to make the bot reply to the msg

cloud dawn
wide burrow
#

how to make the bot reply to the message that user replied

#

like followup

cloud dawn
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

Anyone any experience with making a paginated help command with or without buttons (The help command is classed and it's mapping)
I've tried reading the example walkthrough but I have no idea to get started with it.

slate swan
heady sluice
#

!d discord.Embed.set_footer

unkempt canyonBOT
#

set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style
chaining.
slate swan
#

hi im learning C

slate swan
heady sluice
#

icon_url kwarg

slate swan
slate swan
heady sluice
slate swan
heady sluice
slate swan
#

Only set_author?

slate swan
# slate swan Author icon in footer icon_url

no wait, sorry.
this is an example from my code:

            e.set_author(name=editsnipe_message_author[channel.id], icon_url=(editsnipe_message_author[channel.id]).avatar_url)
            e.set_footer(text=member)
slate swan
#

so embed.set_author, and in that the icon_url

heady sluice
#

you can easily remember it by the word "foot" cuz it's at the bottom, set_author gets it to the upper part

paper sluice
heady sluice
slate swan
paper sluice
heady sluice
#

you said footer

slate swan
#

Yea

heady sluice
#

Samandra

slate swan
#

In the footer icon_url=β€œβ€

heady sluice
#

yes

slate swan
heady sluice
#

oh

#

well icon_url = member.avatar.url

#

unless you're not on 2.0

#

then it's member.avatar_url

slate swan
#

if ur not on 2.0 ofc

slate swan
heady sluice
#

yes that

slate swan
#

k

slate swan
#

*many

quaint epoch
# slate swan This

try to do py icon = member.avatar if icon is None: icon = member.default_avatar.url else: icon = icon.url embed = discord.Embed() embed.set_footer(icon_url=icon, text=member.name)

heady sluice
#

await ctx.send(items.get(item))
await ctx.send(items[item])?

slate swan
heady sluice
#

why

slate swan
#

it saves you from having to handle an exception

heady sluice
#

what exception

quaint epoch
#

[] returns exceptions

slate swan
quaint epoch
#

.get returns None if the item doesn't exist

slate swan
#

thats what im saying πŸ’€

#

it saves you from having to handle an exception

quaint epoch
heady sluice
#

what exception and why would it raise one?

heady sluice
quaint epoch
heady sluice
#

"safer way to use .get()"

quaint epoch
#

!e dict = dict()
print(dict.get(''))
print(dict[''])

unkempt canyonBOT
#

@quaint epoch :x: Your eval job has completed with return code 1.

001 | None
002 | Traceback (most recent call last):
003 |   File "<string>", line 3, in <module>
004 | KeyError: ''
uncut comet
#

i have a check and i can pick out this message
but how can i see who sent the command

quaint epoch
#

[] is not safer

heady sluice
#

it's not what he said

slate swan
quaint epoch
#

kek

slate swan
#

Fuckin hell 😭

heady sluice
#

but I'm asking what error it would raise

quaint epoch
heady sluice
#

it cannot be a keyerror because he checks if item is in the keys

heady sluice
#

if item in items.keys():

slate swan
quaint epoch
unkempt canyonBOT
#

@quaint epoch :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: ''
heady sluice
quaint epoch
#

cya

heady sluice
paper sluice
#

what is going on they already said that .get was better pithink

slate swan
#

What are we arguing about here

quaint epoch
#

wait what are we talking about

heady sluice
#

better but unnecessary in the case he already checked if that key is already in the dict

quaint epoch
#

i came a bit late

#

.topic

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

slate swan
quaint epoch
heady sluice
#

no you just didn't read a message properly

heady sluice
slate swan
#

what you on about

#

rephrase

heady sluice
#

bro I'm gonna write a code

quaint epoch
#

no hooman engrish, code

slate swan
heady sluice
#

!e

my_dict = {"sure" : "first", "ok" : "second", "again": "working"}

if "hello" in my_dict.keys():
    print(my_dict["hello"])
else:
    print("There isn't a key called hello.")

if "sure" in my_dict.keys():
    print(my_dict["sure"])
else:
    print("There isn't a key called sure.")

unkempt canyonBOT
#

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

001 | There isn't a key called hello.
002 | first
slate swan
#

what are you showing us

heady sluice
#

that you don't need .get()

slate swan
#

ive gone over this

heady sluice
#

it's literally the only thing I wanted to show and this situation came

slate swan
#

.get() is safer and better to use

uncut comet
slate swan
#

thats why i used it

heady sluice
#

then you can remove the if statement

paper sluice
slate swan
quaint epoch
heady sluice
#

nah you can I'm ending this

#

it was really unnecessary

slate swan
quaint epoch
slate swan
#

I got muted last time

quaint epoch
#

if it raises an error, catch it and assert again

#

until dominance is asserted

heady sluice
#

yes, this is really the right place to assert your dominance against me

quaint epoch
#

lol

slate swan
#

and sarth agrees

quaint epoch
#

.topic

lament depotBOT
#
**What feature would you like to see added to the library? What feature in the library do you think is redundant?**

Suggest more topics here!

slate swan
unkempt canyonBOT
quaint epoch
#

roles, members, users, guilds

flint isle
#

how can i get a cog to print when it is done being loaded?

heady sluice
#

roles and guilds intents: 😒

#

are there roles intents

quaint epoch
paper sluice
pliant gulch
flint isle
paper sluice
#

chuck a print below that then

flint isle
#

ok

slate swan
#

@clever field spit it out tbh

unkempt canyonBOT
clever field
#

akh

slate swan
#

Lmao

clever field
#

ok

#

https://paste.pythondiscord.com/eqayimaluq
https://paste.pythondiscord.com/asuseviwom

Traceback (most recent call last):
  File "E:\LeynBot discord.py\venv\lib\site-packages\nextcord\player.py", line 685, in run
    self._do_run()
  File "E:\LeynBot discord.py\venv\lib\site-packages\nextcord\player.py", line 672, in _do_run
    data = self.source.read()
  File "E:\LeynBot discord.py\venv\lib\site-packages\nextcord\player.py", line 625, in read
    ret = self.original.read()
  File "E:\LeynBot discord.py\venv\lib\site-packages\nextcord\player.py", line 289, in read
    ret = self._stdout.read(OpusEncoder.FRAME_SIZE)
AttributeError: '_MissingSentinel' object has no attribute 'read'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\LeynBot discord.py\venv\lib\site-packages\nextcord\player.py", line 699, in _call_after
    after_return = self.after(error)
  File "E:\LeynBot discord.py\utils\func_music.py", line 237, in play_next_song
    raise VoiceError(str(error))
utils.func_music.VoiceError: '_MissingSentinel' object has no attribute 'read'

I use loop, if music is over bot gave me this error
how fix that ?

cloud dawn
slate swan
#

Yeah fuck those music bots ✊

slate swan
#

even mee6

slate swan
cloud dawn
slate swan
cloud dawn
#

No they all break ToS.

slate swan
#

K

heady sluice
#

grrr

slate swan
#
    @slash_command(name="avatar", description="changes your bot avatar", guild_ids=guild)
    async def avatar(self, ctx, link):
        if ctx.author.guild_permissions.administrator== False:
            return await ctx.respond("No permes")
        async with aiohttp.ClientSession() as session:
            async with session.get(str(link)) as resp:
                if resp.status != 200:
                    return await ctx.send('Could not download file...')
            pfp = await resp.read()
            
        await self.bot.user.edit(avatar=pfp)
        await ctx.respond("Done")
        ``` the connection keeps closing
heady sluice
#

name 'bot' is not defined

slate swan
#

did u define it

heady sluice
#

idk you prolly didn't define it

#

or you did just somewhere else

quaint epoch
heady sluice
quaint epoch
#

using aiohttp for a single request is unnecessary

heady sluice
#

aiohttp is requests in async

slate swan
#

but did u define it?

quaint epoch
cloud dawn
heady sluice
#

are they in other files

quaint epoch
slate swan
#

then you more than defined it else where

quaint epoch
slate swan
#

trying to change the bot avatar within a command

cloud dawn
slate swan
#

one sec let me run it again

quaint epoch
heady sluice
#

practically aiohttp

#

practisely aswell

slate swan
#

thats really it

cloud dawn
slate swan
#

aiohttp.client_exceptions.ClientConnectionError: Connection closed

#

alr one second

#
gnoring exception in command avatar:
Traceback (most recent call last):
  File "/home/runner/v-2/venv/lib/python3.8/site-packages/discord/commands/core.py", line 113, in wrapped
    ret = await coro(arg)
  File "/home/runner/v-2/venv/lib/python3.8/site-packages/discord/commands/core.py", line 762, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "/home/runner/v-2/cogs/misc.py", line 48, in avatar
    pfp = await resp.read()
  File "/home/runner/v-2/venv/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1036, in read
    self._body = await self.content.read()
  File "/home/runner/tester-2/venv/lib/python3.8/site-packages/aiohttp/streams.py", line 349, in read
    raise self._exception
aiohttp.client_exceptions.ClientConnectionError: Connection closed

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

Traceback (most recent call last):
  File "/home/runner/v-2/venv/lib/python3.8/site-packages/discord/bot.py", line 755, in process_application_commands
    await ctx.command.invoke(ctx)
  File "/home/runner/v-2/venv/lib/python3.8/site-packages/discord/commands/core.py", line 312, in invoke
    await injected(ctx)
  File "/home/runner/v-2/venv/lib/python3.8/site-packages/discord/commands/core.py", line 119, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: ClientConnectionError: Connection closed
cloud dawn
#

Ah you are reading the object outside of the context.

slate swan
#

alr one second

quaint epoch
#

bot.get_emoji

slate swan
quaint epoch
#

!d discord.ext.commands.Bot.get_emoji

unkempt canyonBOT
quaint epoch
#

you enter the id of the emoji, returns the emoji

slate swan
#

emoji = bot.get_emoji and then you need to call it

cloud dawn
slate swan
#

!d discord.ui.Button

unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
slate swan
#

!d discord.ButtonStyle.url

unkempt canyonBOT
slate swan
#

use this for the style kwarg

#
AttributeError: 'Object' object has no attribute '_get_channel'```
#

anyone know what this error is?

#

can u show the code pls?

#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

its a bit long

#

...

hard trail
#

No Errors. I don't understand why this is not working. I've been trying to fix this for the past hour now

@bot.command()
async def ban(ctx, user: nextcord.User, *, reason=None):
  guild = ctx.guild
  if reason == None:
    reason == "Not Specified"
  embed1 = nextcord.Embed(title="User Successfully Banned!", description = f"**{user}** has been banned!")
  embed2 = nextcord.Embed(title=f"Ban Information on {user}!", color = nextcord.Color.red())
  embed2.add_field(name="User", value = f"{user.mention}")
  embed2.add_field(name="Admin/Moderator", value = f"{ctx.author.mention}")
  embed2.add_field(name="Reason", value = f"**{reason}**")
  embed2.set_footer(text=f"User ID: {user.id}")
  embed3 = nextcord.Embed(title=f"Your Ban from {guild}", description = f"You were banned from {guild} because **{reason}**", color = nextcord.Color.red())
  if user.guild_permissions.manage_messages:
    error1 = nextcord.Embed(title='User is an Admin/Moderator!', color=nextcord.Color.red())
    await ctx.send(embed=error1)
    return
  else:
    if ctx.author.guild_permissions.ban_members:
      await ctx.send(embed=embed1)
      await guild.ban(user=user)
      log_channel = bot.get_channel(879095317771997246)
      await log_channel.send(embed=embed2)
      await user.send(embed=embed3)
    
slate swan
#

lgit no errors there

slate swan
slate swan
#

and unnecessary if/elses

slate swan
heady sluice
#

nope

#

you can ban a member

#

not a user

slate swan
#

!d discord.Guild.ban

unkempt canyonBOT
#

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

Bans a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

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

"user"

heady sluice
#

god I thought he did user.ban()

#

anyways

slate swan
heady sluice
#

switch user.send() and guild.ban(user=user)

slate swan
#

you can simply shorted it to ```py
if :
return await ctx.send(embed=error1)

if :
...``` since you're already returning

heady sluice
#

AND user's not a kwarg

slate swan
#

^

#

but it wont cause an issue if you use it as one

heady sluice
#

not sure, lemme just check

#

yeah it doesn't

paper sluice
slate swan
#

πŸ‘

paper sluice
#

are u on dpy 2.0?

#

if yes now its avatar.url

#

i was gonna type yes ? avatar.url : idk

hard trail
#

Should I try member: nextcord.Member?

paper sluice
#

:)

#

add a kwarg in ur add_field called inline=False

#

embed.add_field(..., inline=False)

#

ya if u want all of them be like that

#

?

#

ya thats fine

#

yea?

#

which lib?

#

library

glad cradle
#

Are you synchronizing your commands for all servers or have you set up a test server?

glad cradle
#

synchronization of slash commands for all servers takes about 1 hour

fleet kayak
#

how to run a bot with python?

astral bison
#

i want to make a looking for group kinda function in a discord bot for a game. It store the ppl waiting in queue in a json file inside a list. i want to basically create a discord text/voice channel and overwrite the perms to only allow ppl who are in that list to view and access those channels if that makes any sense

#

i have most of the code done im just trying to figure out how to go about the perms for the users in the list

astral bison
heady sluice
slate swan
#

why does reloading my cogs not stop this from running?


    @commands.command(name="count")
    @commands.has_any_role("Owners ✨")
    async def count(self,ctx, choice=None, confirmation=None, amount=None):
            while True:
                print("Attempting to update counter")
                with open("totalcount.stonks","r") as f:
                    totalcount = int(f.read())
                    f.close()
                with open("dailycount.stonks","r") as f:
                    dailycount = int(f.read())
                    f.close()
                staffchannel = self.bot.get_channel(962825990030102568)
                await staffchannel.send(f"TotalCount: {totalcount} DailyCount: {dailycount}")
                totalchannel = self.bot.get_channel(968972997031506002)
                dailychannel = self.bot.get_channel(969008266921259088)
                await totalchannel.edit(name=f"Total Requests: {totalcount}")
                await dailychannel.edit(name=f"Requests Today: {dailycount}")
                print("Success")
                with open("logs.stonks","r") as f:
                    logschannel = int(f.read())
                    f.close()
                logschannel2 = self.bot.get_channel(logschannel)
                embed=discord.Embed(color=0xFFC0CB)
                embed.set_author(name=f"Member count has been updated! Total: {totalcount} Daily: {dailycount}")
                embed.timestamp = datetime.datetime.utcnow()
                await logschannel2.send(embed=embed)
                await asyncio.sleep(660)
loaded cogs.Commands
Attempting to update counter
Success```
astral bison
#

i want to make a looking for group kinda function in a discord bot for a game. It store the ppl waiting in queue in a json file inside a list. i want to basically create a discord text/voice channel and overwrite the perms to only allow ppl who are in that list to view and access those channels if that makes any sense

i have most of the code done im just trying to figure out how to go about the perms for the users in the list

glad cradle
slate swan
#

how would i go about that

cloud dawn
#

!d discord.Member.guild_permissions

unkempt canyonBOT
#

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

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

He's also closing a file inside a context manager.

astral bison
#

i just started typing and it came to me i was just having a mind blank

#

glooks tho

slate swan
#

and tasks didn't work when i tried using them

cloud dawn
#
from discord.ext import tasks

@tasks.loop(minutes=11.0)
async def ...():
    ...
slate swan
#

doesn't work with how i have cogs set up

#

it won't let me change channel name, i tried this all last night

glad cradle
#

or asyncio.sleep

slate swan
#

what?

cloud dawn
glad cradle
#

it's better asyncio.sleep

glad cradle
slate swan
#

i know...

#

i've already done all that lol, that's not what i'm asking

cloud dawn
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with
optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
slate swan
#

i already tried this last night

#

    @tasks.loop(seconds = 5) # repeat after every 10 seconds
    async def myLoop():
        with open("count.stonks","r") as f:
            count = int(f.read())
            f.close()
        channel = bot.get_channel(903918973408665620)
        channel.send("{count}")
    myLoop.start()
Unhandled exception in internal background task 'myLoop'.
Traceback (most recent call last):
  File "C:\Users\allan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\tasks\__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "C:\Users\allan\OneDrive\Documents\mootbot\cogs\Commands.py", line 752, in myLoop
    channel = bot.get_channel(903918973408665620)
NameError: name 'bot' is not defined
``` it doesn't work for some reason
glad cradle
slate swan
# glad cradle are you using cogs.commands?

from discord.ext import commands
import asyncio
import logging
import datetime
import os
import re
import random
import json
import requests
from random import choice
import time
from discord.ext import tasks

client = discord.Client()

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

    @commands.command(name="partner")
    @commands.cooldown(1, 21600, commands.BucketType.user)
    async def partner(self,ctx,member: discord.Member=None):
    -----

def setup(bot):
    bot.add_cog(Commands(bot))

#

this is the setup i've been using so far inside a cog

vale wing
#

Ew client

#

What do you even need it for

#

You parse bot object to cog init

cloud dawn
#

I use Client pithink

slate swan
#
from discord import Client


class OkimiiClient(Client):
    ...

😳

cloud dawn
#

Same

dull terrace
#

They added the bot slash command management to Discord pepe_cheer

slate swan
#

hi, i want to create a dashboard for my bot with python with mongodb what is the best way to do that?

cloud dawn
#

with mongodb?

#

Database just contains data.

slate swan
cloud dawn
#

You can access it from a website or a bot it doesn't matter.

#

If you want to create your own dashboard you will need to look into making your own API or IPC.

#

I recommend an API since it's better if you want to host your site somewhere else.

slate swan
#

i heard that there are libs for making dashboards such as flask or quart

slate swan
cloud dawn
#

But that's more if you want a private dashboard.

dull terrace
#

are the new bot integrations working or do they just take a long time to update?

#

7739monkathink still hasn't restricted them

junior verge
#
@client.command(name="setup")
async def setup(ctx):
    await ctx.send("Starting setup! What does the name of invite channel needs to be?")
    member = ctx.author

    def check(m):
        return m.content != "" and m.channel == ctx.channel
        msg.author == member

    msg = await client.wait_for("message", m.author == member)
    await ctx.send(f"Channel named {msg.content} made")
``` How do I define `m` here?
slate swan
#

Is it passed automatically

#

You just need to set the check kwarg

junior verge
#

is it the check=check?

slate swan
#

m will then automatically be the parameter of the event gathered, in your case a discord.Message object

slate swan
junior verge
#

But where?

slate swan
#

Look at the documentation

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

Yeah I tried before but didn't understand it

slate swan
#

You have an example

junior verge
#
msg = await client.wait_for("message", check=check)
slate swan
#

There you go

#

Now you know where to place it

junior verge
junior verge
slate swan
#

Why m.author

#

The kwarg is check

junior verge
#

should that be msg?

slate swan
#

And that will never change

twin flower
#

slash command is saying "missing 1 required positional argument" but i marked it as unrequired

slate swan
#

check=your_function

slate swan
#

Considering your function's name is check then it's simply check=check

#

Just like in the documentation

junior verge
#

Yeah but still

#

So m should be msg? in msg.author

slate swan
#

No.

#

m is automatically defined when you pass your function in the check kwarg as I've already said above.

#

Forget about m

junior verge
#

I mean my error is the m.author

slate swan
#

Just know it will represent the parameter of the event fired, in your case a message

slate swan
junior verge
#

Maybe because I don't get your explanation?

#
msg = await client.wait_for("message", m.author == member, check=check)
``` got this atm.
slate swan
#

its kinda basic python no?

#

The kwarg is check and that will never change as I've said above

slate swan
#

So remove m.author==member

slate swan
#

As m.author is not a kwarg for this method

junior verge
#

Yeah okay now I finally get it

slate swan
#

Just look at the documentation again - the example is self explaining

dull terrace
#

am i missing something with the integrations page

#

slash commands still accessible from every channel

sick birch
dull terrace
#

just notified of it today

#

think it's only just rolled out to everyone

#
  • although so far it doesn't seem to be working, at least for me
gritty scaffold
#

intents = discord.Intents.default()
client = commands.Bot(command_prefix = '$' , case_insensitive = True , intents = intents)

@client.event
async def on_member_join(member):
  wlc_channel = client.get_channel(968900428702031885)
  await wlc_channel.send(f"{member} has joined the server!")```
#

someone tell me why it doesnt work

#

(welcome message)

boreal ravine
#

Does your bot have member intents?

gritty scaffold
sick birch
#

Any error handlers?

gritty scaffold
#

it just doesn't send welcome message when someone joins

sick birch
#

on_error or on_command_error anywhere at all in your code?

boreal ravine
sick birch
#

And yes, check your member intents

slate swan
#

need some helps here, when someone does a command example !daykey, it sends a message to a certain webhook

#

!pip requests

unkempt canyonBOT
boreal ravine
#

How do i create a forum channel?

slate swan
boreal ravine
#

no

#

a forum channel

slate swan
#

What’s that supposed to mean

boreal ravine
#

Thread only channel

slate swan
slate swan
#

the wrapper already has its own http client

#

Ok

boreal ravine
slate swan
boreal ravine
slate swan
#

what else do you think im talking aboutπŸ—Ώ

#

need some helps here, when someone does a command example !daykey, it sends a message to a certain webhook

slate swan
boreal ravine
boreal ravine
slate swan
#

why

magic ore
#

The internal client session sends your token to sites it makes requests to

slate swan
#

!webhook

magic ore
#

So you don't want to use that; it's private for a reason

slate swan
#

@slate swan can you help me?

#

!d discord.Webhook.send

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

Sends a message using the webhook.

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

not exactly sure how the headers are set but you should handle your own session regardless

slate swan
#

ill check src later

boreal ravine
slate swan
#

lol

boreal ravine
sick birch
#

they're kind of rolling it out slowly

#

this server actually has one, it's just internal and we're testing it

boreal ravine
#

my server has access to them

sick birch
#

ah, maybe they fully rolled it out?

#

i got a little message thing today telling me my server has them

#

i went to make a new channel, not there

sick birch
#

was I pinged here?

slate swan
gritty scaffold
#

anyone?

magic ore
#

I already said why, it isn't hard to handle your own as well

#

It's private (and mangled) so you don't use it

slate swan
#

why would you start your own tho?

nova hare
#

im watching a tutorial on how to make a discord bot

#

and im trying to navigate to the file

boreal ravine
nova hare
#

wym

boreal ravine
nova hare
#

8 minutes is where im at

boreal ravine
#

click that

#

show me the path you get

nova hare
boreal ravine
#

hm

flat solstice
#

what could be causing this error?py Traceback (most recent call last): File "C:\Users\Teagan\Documents\Coding\Zupie\bot\main.py", line 23, in <module> bot = Zupie( File "C:\Users\Teagan\Documents\Coding\Zupie\bot\classes\zupie.py", line 29, in __init__ self.config = Config() AttributeError: can't set attribute 'config' ```py
from .configenv import Config # I think that import statement is right, the configenv is in the same dir as the file with the Zupie class

class Zupie(commands.AutoShardedBot):
def init(self, **kwargs):
super().init(**kwargs)
self.config = Config()
self.redis```

nova hare
boreal ravine
#

yes

boreal ravine
# nova hare

right click desktop in the path and get the full dir

nova hare
#

this ?

#

C:\Users\ollie\OneDrive\Desktop$ad bot

#

or that

boreal ravine
nova hare
#

alr that worked one sec lemme try to load it

#

i did that but it didnt send "bot loaded"

#

@cleint.event
async def on_ready():
print("Bot is ready")

rare saddle
#

How to make a condition that if a user is not a server admin then ...

boreal ravine
nova hare
#

im watching an updated tutorial

#

apparently its built into vsc

boreal ravine
#

what is?

untold oriole
#

whts the default delete_message_days value for member.ban ?

boreal ravine
#

1 day

untold oriole
tacit storm
#

tutorials are not an reliable way to learn discord.py

nova hare
#

im starting to realise

#
from http import client
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='.')

@bot.event()
async def hello(ctx):
    await ctx.send("Hello")
``` thats all i got rn
tacit storm
#

you're not running the actual bot.

nova hare
#

im not sending my key thing

tacit storm
#
bot.run(token)
or
bot.start(token)```
nova hare
#

ik i just wasnt going to send it

slate swan
tacit storm
#

tutorials can be good but most for third party libraries get old fast

slate swan
#

Your point is quite general in a sense of saying all tutorials are bad, i feel like its a very strong statement that isnt correct.

stray carbon
#

Any gist or example on how to get a part of string
e.g
Amazing job, we racked up a sum total of {amount} from {user}
Where amount and user keeps changing and the other part remains same(Which will be used to trigger)

final iron
#

Try recommending more than 2 good tutorials

slate swan
#

You are quite missing my point, i will not answer such a question that will not prove anything.

final iron
#

Exactly.

slate swan
#

Exactly, you have no point to prove.

final iron
#

Yet you can't share the tutorials

jade jolt
#

I agree with @final iron.

slate swan
final iron
slate swan
#

I would disagree.

jade jolt
#

Yeah.

#

Why disagree? It's the truth.

final iron
slate swan
#

Whats your point?

final iron
slate swan
#
  1. documentation has examples.
  2. github repo has a whole example folder
  3. many good developers have made tutorials that are still being maintained
    Your point is quite wrong.
dusk pumice
#

Hello

slate swan
#

hi

final iron
slate swan
final iron
#

Documentation doesn't really count as a tutorial on this context

#

And neither does the repo

slate swan
#

See, you have no point, you barely can prove your own statements.

final iron
#

Wut

jade jolt
#

He did just prove them.

final iron
#

Documentation is definitely not a tutorial

#

It's a reference, not a tutorial

#

And the repo is exactly what you said it was for. Examples. Not a step by step guide

jade jolt
#

Which increases copy/pasting, Therefore the person doesn't actually learn anything

final iron
#

Out of the thousands of tutorials that exist I'm only aware of 1 that is good

slate swan
final iron
#

This counts as a good tutorial?

#

on_message for commands?

#

Also it's very brief

slate swan
#

Its being changed in main already, so my point still stands.

final iron
#

But it's not currently changed isn't it?

#

So that source doesn't matter for someone starting now

slate swan
#

Whats your point?

final iron
#

And we've already gone through why the repo doesn't count as a tutorial

slate swan
#

You want a good beginner tutorial when discord.py is an advance lib you do know theres not much tutorials as the documentation is quite straight forward to the targeted crowd.

final iron
slate swan
#

Its quite the same purpose. It guides you to success.

final iron
#

So were left with vcokltfre

final iron
#

And that's what most people are looking for when they start

slate swan
#

Its quite funny as your missing all my statements and saying nonsense.

final iron
final iron
slate swan
#

Theres quite allot of flags in the documentation so its quite not the developers fault but theres.

final iron
#

Never said it's the developers fault but it's what happens in the real world

#

So were still looking at 1 tutorial

slate swan
#

Nonsense.

final iron
#

We've already gone over why the documentation and repo are not tutorials

slate swan
#

You have been given many tutorials, but deny all of them, what do you expect of them to give a step by step of everything, every single endpoint?

#

Yeah, no.

final iron
#

A step by step explanation is what most people look for

#

That's why they look for tutorials

slate swan
#

In an advance library?

final iron
#

That's the whole point of tutorials. Everything should be explained

jade jolt
#

Correct.

final iron
slate swan
#

Its quite easy to read documentation dont you think?

final iron
#

Which is not a tutorial

slate swan
final iron
#

You keep ignoring that most people who use discord.py are beginners

slate swan
#

if you don't wanna help them then just don't answer

#

Your point is quite not strong, Its like saying theres a tutorial for everything advance, i.e a whole tutorial on how to be a doctor when its such a huge topic and such an advanced one, so your point is quite not right.

final iron
#

discord.py isn't even close to being as hard as a doctor

slate swan
final iron
#

A tutorial can explain how to create commands and such

#

As it's just writing code

slate swan
#

ok on a real question note, error handler for MissingRequiredArgument?

final iron
#

Each patient is different when you're a doctor

#

Like majorly different

slate swan
final iron
#

Well yeah

slate swan
final iron
#

No

#

That's my whole point

slate swan
#

You have proven my point.

final iron
#

You can't compare a tutorial for a doctor to a tutorial for discord.py

final iron
slate swan
#

can you guys argue somewhere else 🀣

jade jolt
#

It fits the topic here.

slate swan
#

I will not continue this conversation as you just proved my own point.

final iron
#

Sounds like somebody ran out of points 🀣

boreal ravine
jade jolt
#

Well, it was before they went to doctors for some reason

slate swan
#

is anyone gonna actually help with discord.py 🀣

final iron
slate swan
jade jolt
#

I can try.

slate swan
slate swan
final iron
slate swan
boreal ravine
slate swan
slate swan
final iron
#

We've gone over this

slate swan
#
@play.error
async def on_command_error(error, ctx):
    if isinstance(error, MissingRequiredArgument):
        await ctx.send("You did not give me anything to repeat!") 

like this?

slate swan
slate swan
final iron
slate swan
final iron
#

When you know nothing about something you need it explained step by step

boreal ravine
final iron
final iron
#

No

final iron
#

You're just ignoring that one

boreal ravine
slate swan
#

Because going back to your own points that have been proven is quite a waste of my time.

final iron
#

You've said it's an advanced library for the 3rd time now I think

#

And that's your whole reasoning why beginners don't use discord.py

slate swan
#

You already have proved my point and i have proved my own, i will not continue as your "standards" are so high for such an advance library as discord.py.

slate swan
dull terrace
#

what would be a good one liner for this so it excludes j[1] and j[3] when i append a tuple

final iron
slate swan
#

Bro

final iron
#

You think that matters to beginners?

slate swan
#

No point.

final iron
#

Finally

#

You have no points

slate swan
#

i ment you have no point.

#

@boreal ravine what if the command is in a cog? how would I do it

#

You have no point to prove, because you already have proved my own.

boreal ravine
final iron
slate swan
slate swan
final iron
#

Answer the questions directly

#

Yes or no?

slate swan
#

You have no point to prove bro.

final iron
#

They're going to try to use it either way

hollow quarry
#

@final iron @slate swan why don't we stop right here, this conversation isn't going anywhere and is rather heated

final iron
#

I'm perfectly fine

#

Him on the other hand...

slate swan
#

Thats not his point again.

slate swan
#

For some reason i'm getting
Command raised an exception: NameError: name 'MissingRequiredArgument' is not defined

final iron
#

Bye!

dull terrace
slate swan
# slate swan Code?
@play.error
  async def on_command_error(self, error, ctx):
      if isinstance(error, MissingRequiredArgument):
          await ctx.send("You did not give me anything to repeat!")

#

Well did you imported the class?

#

well it's in my cog.

#

Still you would need to import the class from the discord module

dull terrace
slate swan
#

using?

slate swan
#

is it just the

#

from discord.ext.commands import MissingRequiredArgument
?

#
from discord import MissingRequiredArgument

not sure if thats the right namespace tho im not sure if it was imported in the init file of the module

slate swan
supple thorn
slate swan
#

nope

unkempt canyonBOT
#

exception discord.ext.commands.MissingRequiredArgument(param)```
Exception raised when parsing a command and a parameter
that is required is not encountered.

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

yep

#

im wrong lmfao

supple thorn
slate swan
#

weird i thought it was in the errors file

#

guess notπŸƒβ€β™‚οΈ

supple thorn
#

Nah it's somehow in commands

slate swan
#

lol

sage otter
slate swan
#

for some reason it's not sending the message.

sage otter
#

Why would it not be? It’s an error that only applies to the commands framework.

sage otter
slate swan
#

and hey tylerπŸ’œ

sage otter
slate swan
#

hm I don't know why it's not sending the message

#

can you show code?

#
@play.error
  async def on_command_error(self, ctx, error):
      if isinstance(error, commands.MissingRequiredArgument):
          await ctx.send("You did not give me anything to repeat!")
#

why is it named on_command_error?

#

oh it works now

#

lol

#

before I had error, ctx

#

and change the functions name

slate swan
#

anything lol

#

just not that

sick birch
#

If you don't have an else: to catch all other errors it's going to eat them up

sacred gull
#

Anyone here that can help me with my file to make it into 2.0? I've been at this for like an 1h+ and I've asked other people for tips and I can't seem to figure it out. All I need is someone to help me or to setup my file correctly, I can do the rest from there

slate swan
sick birch
slate swan
sick birch
#

re-raising would be easiest

slate swan
#

probably just send the error or raise it

sick birch
#
if isinstance(...):
  ...
else:
  raise error
slate swan
#

oh I see. thanks for the information

slate swan
sick birch
#

hm?

slate swan
#

in the isinstance ik its just pseudo code but its triggering meπŸ˜”

sick birch
#

Β―_(ツ)_/Β―

slate swan
#

πŸ˜”

sick birch
supple thorn
slate swan
#

how do i make the bot print the name of the person who join the server?

#

you can use the on_member_join event, it takes a single argument "member" which would be a discord.Member, you can simply print(member) to get member#1234 or simply print(member.name) for just the name

slate swan