#discord-bots

1 messages · Page 454 of 1

wispy sequoia
#

god

maiden fable
#

Ghost ping, great

wispy sequoia
#

we all gonna get banned

brave ravine
#

wym

slate swan
#

You already pinged Moderators

maiden fable
#

.....?

brave ravine
#

admins have their do not disturb on

slate swan
#

Still, ghost ping weirdChamp

brave ravine
#

what ping

slate swan
#

Uh use ctx.command to get the command used?

maiden fable
#

Well a moderator has already seen this channel (pgp verified), so I am sure he's taking the required action

slate swan
#

Yeah

brave ravine
#

what are u people trying to make a music bot with? if not youtube

bitter depot
#

!mute 878071532163846184 Investigating

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @steel flower until <t:1631003220:f> (59 minutes and 58 seconds).

bitter depot
#

Let's get back on topic please guys

slate swan
#

👍

brave ravine
#

also, back to the removing the help command thing, do u want to make something like this instead?

slate swan
#

in bot constructor

brave ravine
#

i do this
bot.remove_command("help")

slate swan
#

help_command = None is better to use

brave ravine
#

it does the same thing so theyre equally as good

#

right?

slate swan
#

not really tbh

#

up to you what you want to do tho

#

it's just doing bot.remove_command is dynamically doing it

brave ravine
#

people in this channel told me before to just use bot.remove_command("help") so imma stick with it

slate swan
#

ok

brave ravine
slate swan
#

but like im just gonna say it'll be suggested to do none as help command

slate swan
brave ravine
#

ya i think

slate swan
#

yes, so same thing implies

brave ravine
#

i havent worked on a bot in months so im rusty on a lot of the stuff lol

slate swan
#

Literally right here

#

right there bruh

#

h o w

#

it's member

#

not user

#

discord.Member

#

user and member objects are 2 diff things??

#

yes of course

vagrant brook
#

User is not tied to a guild

#

Member is

slate swan
#

oh-

#

user is a discord user. member is a user in a guild.

#

ohh

#

OHHHHH

brave ravine
#

so far my bots do all that i need them to do and i dont have an idea for another bot

slate swan
#

!d discord.Member

unkempt canyonBOT
#

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

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

Mb 🤣

slate swan
#

so discord.Member object would be like this?

... help(ctx, member = discord.Member):?

#

yep

#

wait no

spring flax
#

nope

slate swan
#

typehint

#

Oh wait

#

member: discord.Member

#

:

#

yes

#

yeah i forgot typehint is a thing

#

alr thx for da help

#

oh so would I have to use member intents if im using a on_message events to get discord.Member object? @slate swan

#

or is there an easier way WITHOUT having the member to give input

lone aurora
#
@client.command()
async def join(self,ctx):
    if ctx.author.voice is None:
        await ctx.send("You're not in a voice channel")

    voice_channel = ctx.author.voice.channel

    if ctx.voice_client is None:
        await voice_channel.connect()
    else:
        await ctx.voice_client.move_to(voice_channel)``` it just doesnt want to work
oak quest
#

does anybody wants to collab with me for making a bot ?

lone aurora
#

nope

vagrant brook
#

Then why

#

Do you have the self param

lone aurora
#

fak

#

listen im dumb

#

still not work when i remove

#

fak me

#

im nub

slate swan
oak quest
slate swan
#

what kind of bot mate

oak quest
#

like i don't get your point mate 🤣

slate swan
#

there are various types of bot mate

#

You can't call a verification bot a moderation bot

boreal ravine
#

music/moderation/leveling/economy/anime/gaming

slate swan
#

yeah

waxen granite
#

How do i get a role hexcode?

hoary gust
#

guys how can i check the author perms inside the cod

#

code

spring flax
sage mural
#

?

#

Whats the issue

reef shell
#

show the snippet where you load the extension

vagrant brook
#

Try rules instead of Rules

reef shell
vagrant brook
#

.

reef shell
#

oh you're right

#

^

#

I thought you were talking about the class name

heavy folio
#

sorry got it already

vagrant brook
#

You didn't have to delete everything lmao

heavy folio
#

it was a long message and took lots of space so

reef shell
#

nothing to worry 'bout that

slate swan
#

how to get channel count

hasty iron
#

call len on Guild.channels

reef shell
#

guild = ctx.guild
clist = await guild.fetch_channels()
count = len(clist)

vagrant brook
#

Wouldn't want to do an API call for no reason when you can just use guild.channels

waxen granite
#

Is role: discord.Guild.role a thing?

vagrant brook
#

discord.Guild.role isn't a thing

vagrant brook
#

You probably mean discord.Role

waxen granite
#

I am trying to get a role information

vagrant brook
#

I think RoleConverter exists

hasty iron
#

it does

vagrant brook
#

So that'd work

reef shell
#

my bad

reef shell
#

of discord.Guild

slate swan
#

it works

slate swan
hasty iron
#

Guild.roles

waxen granite
slate swan
#

ctx.guild.role?

hasty iron
#

not role

waxen granite
#

What should be args

hasty iron
#

roles

slate swan
hasty iron
#

it should work

reef shell
vagrant brook
#

What's the problem anyway

waxen granite
#
    @commands.command()
    async def roleinfo(self, ctx, role : discord.Roles):
        roleembed = discord.Embed(title =f"{role.name} information", color = discord.Color.random(), timestamp = datetime.datetime.utcnow())
        roleembed.add_field(name = "ID", value = role.id)
        roleembed.add_field(name = "Name", value = role.name)```discord has no atrr Roles
vagrant brook
#

discord.Role

#

Not discord.Roles

slate swan
hasty iron
#

Guild.categories

waxen granite
#

alright

#

ty

slate swan
hasty iron
#

use Guild.owner_id and Guild.get_member

slate swan
#

write

slate swan
hasty iron
#

no

slate swan
hasty iron
#

!d discord.Guild.get_member

unkempt canyonBOT
hasty iron
#

!d discord.Guild.owner_id

unkempt canyonBOT
waxen granite
#

role.members gives a list of members , how do i get the names of the members from that list?

hasty iron
#

use a list comp

vagrant brook
#

Probably learn how to use for loop 🙂

slate swan
hasty iron
#

a for loop isn’t needed here

slate swan
#

thnx @hasty iron

vagrant brook
#

list comp is also a for loop

waxen granite
#

for member in role.members

hasty iron
#

it’s different

waxen granite
#

something?

vagrant brook
#

Yes

waxen granite
#

idk what a list comp is

slate swan
hasty iron
#

[member.name for member in Role.members]

slate swan
waxen granite
#

members = role.members for member in members: name = member.name

#

works?

boreal ravine
#

try it and see

waxen granite
#

hm it prints just 1 name

hasty iron
waxen granite
#

works

#

how do i get <@roleid> ?

#

like opposite of mention

spring flax
#

<@&[ROLE ID]>

#

is that what you meant?

slate swan
slate swan
#

code

slate swan
#

how to get bots?

#

ctx.guild.bot_count does not work

waxen granite
#

ye

slate swan
slate swan
spring flax
unkempt canyonBOT
#

bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/stable/api.html#discord.User.bot "discord.User.bot")
waxen granite
#

how can i reverse the postion of roles?

spring flax
#

you can use that to get it

waxen granite
#

its a int obj

#

already tried .reverse()

slate swan
#

<@&751814647346102303>

#

😞

spring flax
waxen granite
#
    async def roleinfo(self, ctx, role : discord.Role):
        members = [member.name for member in role.members]
        perm_string = ', '.join([str(p[0]).replace("_", " ").title() for p in role.permissions if p[1]])
        date_format = "%d %b %Y %I:%M %p"
        roleembed = discord.Embed(title =f"{role.name} information", color = discord.Color.random(), timestamp = datetime.datetime.utcnow())
        roleembed.add_field(name = "ID", value = role.id)
        roleembed.add_field(name = "Name", value = role.name)
        roleembed.add_field(name = "Position", value = role.position)```
#

i want it to count the top most role as pos 1 and so on, insead of counting @lament oar one role as pos 1

harsh ledge
#

Is there any discord.py fork yet, which has support for slash commands in cogs?

reef shell
#

no stable fork yet

harsh ledge
reef shell
harsh ledge
#

xD

slate swan
#

index it to remove the first one that'll always come

waxen granite
#

like by default @ everyone role has postion 0, then the role just above it get s the postion 1

spring flax
#

its ctx.guild.roles[1:] ,

waxen granite
#

i want to the role postion that is 1 by default gets the last postion

slate swan
waxen granite
#

yes

slate swan
#

so can't you just do int(role.position) - 1 or something?

waxen granite
#

i am changing the role hierarchy postion

#

or want to

slate swan
#

oh edit the role?

waxen granite
#

wait

#

take a look at this

#

the role PsyDuck i on the top of the list

#

and the Role Nurse at the bottom

slate swan
#

Go on..

waxen granite
#

normally while getting postion

#

the nurse role get the postion 1

#

and the Psyduck role gets the last postion

slate swan
#

is that what you want? if not what do you want?

waxen granite
#

i want it to be reversed

#

PsyDuck get 1 and Nurse gets last

slate swan
#

okay

#

can you try reversing the list of guild roles then

waxen granite
#

i did

slate swan
#

didn't work?

waxen granite
#

rolesList = ctx.guild.roles rolesList.reverse() for role in rolesList:

#

it give every role postion to 0

#

s

slate swan
#

huh

#

how about reverse indexing

#

[::-1]

waxen granite
#

let me try

slate swan
#

roles = ctx.guild.roles[::-1]

valid patio
#

!ban

waxen granite
#

nope didnt work

slate swan
#

??

valid patio
#

.ban

slate swan
#

what are you doing

valid patio
#

How do i make a bot ban ppl i want to know

#

how do i ask the python bot here

waxen granite
#

[::-1] makes the indexing reverse? @slate swan

slate swan
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/stable/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

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

ok thanku

frigid badge
#

i used implemented mondodb in my bot and it is giving me this error:

pymongo.errors.OperationFailure: bad auth: Authentication failed., full error: {'ok':0, 'errmsg' : bad auth....

can someone fix this

slate swan
#

how do i use cog

waxen granite
#

not ext

slate swan
unkempt canyonBOT
frigid badge
#

can someone help me , please.

slate swan
slate swan
vagrant brook
#

You should remove that picture and regen your token immediately

#

@slate swan

slate swan
#

description

#

not decription

#

sounds like a weird decease

#

and you're addicted to f-strings

lament mesa
#

lol

slate swan
#

f"Member Count"

lament mesa
#

And Member.bot won't work

#

It's the class

slate swan
#

yeah, just some python basics lmao

#

@slate swan
learn how to use the docs

#

when someone tells you
discord.Member.bot,
the discord.Member has to be replaced with a member object

void dew
#

I need a answer. How do we get rate limited and till how much time

slate swan
#

a couple of minutes

#

for doing too many API calls

#

when you get ratelimited, you know you've done something illegal

#

illegal 👀

#

ToS breaking

#

illegal

#

Replit is ready to ruin new developers

#

They also got a video tutorial tab

#

hasn't it already

#

I just saw it

#

freecodecamp's been advertising it for a long time

#

Suggesting one of the best almost outdated tutorials

#

oh, that's the freecodecamp tutorial

#

fuq bru

#

3rd line
c = discord.Client()

reef shell
#

triggered

slate swan
#

Atleast I didn't write it bot = discord.Client blobpain

reef shell
#

discord.Bottum

slate swan
void dew
slate swan
#

did you get ratelimited?

#

Making spamming requests

void dew
slate swan
#

Like crossing it's max rate limit will get you ban for a few minutes or hours

#

And you probably crossed it

#
    await ctx.send("wanna get ratelimited")
    #illegal```
reef shell
#

d.py handles these ratelimits by default

slate swan
#
async def on_ready():
    while True:
        await client.change_presence(...)
        await asyncio.sleep(10)
        await client.change_presence(...)
        await asyncio.sleep(10)

More illegal

#

there's sleep

#

so no

reef shell
#

while True:

slate swan
#

10 secs sleep is nothing for presence changes

#

And most people do it every 10 secs

#

but putting things in on_ready can't be no good anyways

reef shell
#

lmao why would you do it in this way

slate swan
#

i have error handler but it doesnt work:

code:

async def on_command_error(ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            em = discord.Embed(title="Failed to run the command!", description="This command is on cooldown. Please try again after {round(error.retry_after, 1)} seconds.")  
        elif isinstance(error, commands.MissingPermissions):
            em = discord.Embed(title="Failed to run the command!", description="\nYou dont have permission to run this command")
        elif isinstance(error, commands.MissingRequiredArgument):
            em = discord.Embed(title="Failed to run the command!", description=f"{error.param} argument is requierd")
        elif isinstance(error, commands.CommandNotFound):
            em = discord.Embed(title="Failed to run the command!", description=f"nCommand not found!")
            
        else:
            em = discord.Embed(title="Failed to run the command!", description=f"Oh no! Something went wrong while running the command!") 
        
        await ctx.send(embed=em)
reef shell
#

you have task loops for this

slate swan
#

unwrap your error

#

error = getattr(error, 'original', error)

#

Your errors got packed in CommandInvokeError

#

oh

#

ok

#

Also where it is defined?

slate swan
#

The func

#

do you have @bot.event?

#

I don't remember we need any decorator syntax or not for error handlers blobpain

slate swan
reef shell
#

I have a question guys

slate swan
hasty iron
#

try error = getattr(error, 'original', error) on top

slate swan
#

ok

slate swan
hasty iron
#

where did you put it

#

also did you make sure to put @bot.event

slate swan
#

Is there like a way to inplement a status like uptimerobot or npm2 to ur discord bot, it’s hosted on windows vps tag if u have an answer or dm me

slate swan
slate swan
boreal ravine
#

My error handler is very simple.

@client.event
async def on_command_error(ctx, error):
    await ctx.send(error)
boreal ravine
#

That works fine.

slate swan
boreal ravine
#

Imagine using bot to define the commands ducky_blurp

compact field
#

can i use .mp4 in embed.set_image ?

slate swan
#

rooThink No I guess

#

!d discord.Embed.set_image

boreal ravine
#

@compact field u cant

compact field
#

how can i use .mp4 in embed ?

boreal ravine
#

U cant

#

Wait

#

Do embeds support file types?

compact field
boreal ravine
#

Other than png and images ofc

slate swan
boreal ravine
strong kettle
#

My bot not responding to members only for the owners guild

#

Why?

#

@client.command()
@commands.guild_only()
async def avatar(ctx, user: discord.User = None):
    if user == None:
        user = ctx.author
    e = discord.Embed(title=f"{user.display_name} Avatar")
    e.set_image(url=user.avatar_url)
    e.set_footer(text=f"Requested By {ctx.author}",
                 icon_url=ctx.author.avatar_url)
    await ctx.reply(embed=e)
boreal ravine
#

it works for me?

#

@slate swan show ur full error code

boreal ravine
#

the full one

slate swan
#

It is the full onw

boreal ravine
#

Include the decorator

slate swan
#
@bot.event
async def on_command_error(ctx, error):
    error = getattr(error, 'original', error)
    if isinstance(error, commands.CommandOnCooldown):
            em = discord.Embed(title="Failed to run the command!", description="This command is on cooldown. Please try again after {round(error.retry_after, 1)} seconds.")  
        elif isinstance(error, commands.MissingPermissions):
            em = discord.Embed(title="Failed to run the command!", description="\nYou dont have permission to run this command")
        elif isinstance(error, commands.MissingRequiredArgument):
            em = discord.Embed(title="Failed to run the command!", description=f"{error.param} argument is requierd")
        elif isinstance(error, commands.CommandNotFound):
            em = discord.Embed(title="Failed to run the command!", description=f"nCommand not found!")
            
        else:
            em = discord.Embed(title="Failed to run the command!", description=f"Oh no! Something went wrong while running the command!") 
        
        await ctx.send(embed=em)
    
boreal ravine
#

do any errors pop up? like pyflakes

slate swan
boreal ravine
#

@slate swan o

#

u forget to send the embeds..

boreal ravine
slate swan
boreal ravine
#

-.-

slate swan
boreal ravine
#

show the code again

slate swan
# boreal ravine show the code again
@be
async def on_command_error(ctx, error):
    error = getattr(error, 'original', error)
    if isinstance(error, commands.CommandOnCooldown):
        em = discord.Embed(title="Failed to run the command!", description="```py\nThis command is on cooldown. Please try again after {round(error.retry_after, 1)} seconds.```")
        await ctx.send(embed=em) 
    elif isinstance(error, commands.MissingPermissions):
        em = discord.Embed(title="Failed to run the command!", description="```py\nYou dont have permission to run this command```")
        await ctx.send(embed=em)
    elif isinstance(error, commands.MissingRequiredArgument):
        em = discord.Embed(title="Failed to run the command!", description=f"```py\n{error.param} argument is requierd```")
        await ctx.send(embed=em)
    elif isinstance(error, commands.CommandNotFound):
        em = discord.Embed(title="Failed to run the command!", description=f"```py\nCommand not found!```")
        await ctx.send(embed=em)
    else:
        em = discord.Embed(title="Failed to run the command!", description=f"```py\nOh no! Something went wrong while running the command!```") 
        await ctx.send(embed=em)
        
        await ctx.send(embed=em)
boreal ravine
#

@be ?

slate swan
#

i defined it

boreal ravine
#

@slate swan huh

#

u still didnt send the embed

slate swan
#

wait

#

its the wrong code

boreal ravine
#

add await ctx.send(embed=em) to the if/elif statements

slate swan
#

i edited

boreal ravine
#

wtf

#

the codeblock

waxen granite
#

can someone explain how should i use on_member_unban to send a msg in a channel when the user gets unbanned?

boreal ravine
#

WHATVDIDNU DO 😭

slate swan
boreal ravine
#

why the codebloks in the errors smh

#

wait

#

@slate swan can u like remove the ```py so i can edit it?```

boreal ravine
#

send me the code in DMs

lofty mulch
#

for some reason, Vscode couldn't resolve the discord imports

#

What's up with it?

stiff nexus
#

why emoji.user is coming None

slate swan
#

!d discord.Emoji.user

unkempt canyonBOT
slate swan
slate swan
#

it'll be none unless you fetch it

stiff nexus
#

oh

slate swan
#

Restart your ide

compact field
#

guys how can i send gif emoji from guild with bot ?

boreal ravine
compact field
#

i copy the gif emoji but doesnt work

boreal ravine
#

@stiff nexus man asked this somewhere else

boreal ravine
#

U wanna send a emoji from a guild using a bot?

compact field
#

how can i do that ?

boreal ravine
#

An animated emoji?

compact field
#

yes yes

boreal ravine
#

<a:emoji_name:emoji_id>

stiff nexus
compact field
#

thankss

boreal ravine
#

how old ru

stiff nexus
#

u?

#

13???

slate swan
#

calm down lol

wispy sequoia
#

how to make purge command delete bot' messages only?

slate swan
#

Check if message.author == bot.user

stiff nexus
boreal ravine
wispy sequoia
slate swan
slate swan
wispy sequoia
wispy sequoia
boreal ravine
#
if message.author == client.user:
  await ctx.channel.purge(limit=amount)
``` i think?
wispy sequoia
#

let me try

pale turtle
#

I finished my ModMail and i works but it is really bad code

void mortar
#

why this code is not printing anything...

class Help(commands.Cog, name='Help Command'): 
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        help_command = HelpCommand()
        help_command.cog = self
        bot.help_command = help_command

    async def send_bot_help(self, mapping):
        print('help command')
slate swan
#

Is it open source?

stone talon
pale turtle
slate swan
pale turtle
#

I mean it is really bad written

slate swan
#

I'd like to see, since when I tried to make one it really got complicated lol

stiff nexus
#

btw what is this called?

lofty mulch
boreal ravine
lofty mulch
#

Actually, let me just reiinstall it

slate swan
pliant gulch
wispy sequoia
slate swan
stiff nexus
boreal ravine
pale turtle
wispy sequoia
stiff nexus
slate swan
pale turtle
boreal ravine
lofty mulch
#

finally it worked

wispy sequoia
slate swan
#

Just apply a check= in the purge method which returns true for the conditions you need to purge

pliant gulch
pale turtle
slate swan
reef shell
#

My bot reached 48 servers ducky_ghost

lofty mulch
#

so, I should be 1.7.3?

#

Damn i'm almost a whole version down

pliant gulch
slate swan
#

Is there any async spotify api wrapper?

summer oracle
#

hey how do u create bots in discord im new to this server CC_partyCat CC_partyCat

pliant gulch
#

Authentication is a pain

slate swan
#

I started working on one just today fl_panik

hasty iron
#

i made one a while ago

#

it was for my bot

pliant gulch
#

Everybody here already made api wrappers for things I wanna do

hasty iron
#

i basically just copied everything from spotipy but made it async

slate swan
pliant gulch
hasty iron
#

and make the wrapper yourself

pliant gulch
#

I have for my bot before

slate swan
summer oracle
slate swan
#

!d discord

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

slate swan
#

Note the requirements: Python and Oop

reef shell
#

but don't jump right to making bot if you don't know the basic syntax of py

summer oracle
#

hmm thanks

stone talon
summer oracle
#

i am learning py currently

#

im noob

reef shell
#

🤣

stone talon
slate swan
#

And if you get more advanced, subclassing

stone talon
hasty iron
#

subclassing is not advanced

stone talon
#

But if u want a simple bot u can just have sone client commands

pale turtle
#

I have to admit, I know nothing about OOP, at least not good at it

slate swan
pale turtle
#

But cogs are really easy

#

All you do is change decorators names and self.bot instead of bot

slate swan
#

Thanks to dpy who kept it easy blobpain

stone talon
reef shell
wispy sequoia
#
@client.command()
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()```

```Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice```
#

why

boreal ravine
#

How do people make libraries for discord?

hasty iron
#

you read docs

#

and code code

slate swan
#

pip install discord.py[voice]

wispy sequoia
slate swan
wispy sequoia
#

kek

#

then how to import

slate swan
#

no need

wispy sequoia
#

still

#

same error

slate swan
#

Restart your ide

wispy sequoia
#

did

#

WARNING: discord 1.7.3 does not provide the extra 'voice'

#

wutta heck

valid perch
#

Just get pynacl extra id assume

wispy sequoia
#

and it says requirements already satisfied

boreal ravine
strong kettle
boreal ravine
#

join a VC then try the command

wispy sequoia
#

it doesn't work

strong kettle
slate swan
#

Maybe install it manually pip install PyNaCl @wispy sequoia

strong kettle
#

For me?

wispy sequoia
valid perch
valid perch
strong kettle
valid perch
#

Do you have an on_message

strong kettle
#

No

#

Only this command

strong kettle
#

But if member have administrator work

#

If not dont work

reef shell
stark bobcat
#

why doesn't this work

#

it gives interaction failed

reef shell
#

what library are you using

stark bobcat
#

discord_components

reef shell
#

not familiar with that tho , is it a fork of d.py?

slate swan
#

!pypi discord-components

unkempt canyonBOT
stark bobcat
reef shell
#

oh ok thanks

#

`Discord components are cool, but discord.py will support it on version 2.0. It

is hard to wait, so we made a third-party library for using components such as

buttons or selects!`

#

version 2.0 😔

reef shell
stark bobcat
stark bobcat
reef shell
reef trail
#
@commands.command()
@commands.cooldown(rate=1, per=4.5, type=commands.BucketType.user)
@commands.guild_only()
async def hoist(self, ctx):
    #remove hoisted names starting with !
    for member in ctx.guild.members:
        if member.display_name.startswith("!"):
            first = 0
            try:
                await member.edit(nick=f"{member.display_name.replace('!', '')}")
                first += 1
            except:
                pass
        await ctx.send(f"{first} users nicknames have been changed.")
        
        #remove hoisted names starting with a number
        x = member.display_name[0].isdigit()
        second = 0
        if x:
            try:
                await member.edit(nick=re.sub("\d", "", f"{member.display_name}"))
                second += 1
            except:
                pass
        await ctx.send(f"{second} users nicknames have been changed.")
        
        #remove hoisted names starting with a .
        if member.display_name.startswith("."):
            third = 0
            try:
                await member.edit(nick=f"{member.display_name.replace('!', '')}")
                third += 1
            except:
                pass
        await ctx.send(f"{third} users nicknames have been changed.")
        
        #remove hoisted names starting with a [
        if member.display_name.startswith("["):
            last = 0
            try:
                await member.edit(nick=f"{member.display_name.replace('[', '')}")
                last += 1
            except:
                pass
        await ctx.send(f"{last} users nicknames have been changed.")```
 this is super basic but would this work as is? I still need to add some stuff but do i need multiple for loops for each if statement?
slate swan
#

You're taking more than 3 seconds to respond

#

Maybe your internet, or your code is taking time

stark bobcat
slate swan
#

How..? Your code is taking more than 3 secs after receiving interaction, or maybe slow internet

stark bobcat
#
buttons = [
    [
        Button(style=ButtonStyle.grey, label='1'),
        Button(style=ButtonStyle.grey, label='2'),
        Button(style=ButtonStyle.grey, label='3'),
        Button(style=ButtonStyle.blue, label='×'),
        Button(style=ButtonStyle.red, label='Exit')
    ],
    [
        Button(style=ButtonStyle.grey, label='4'),
        Button(style=ButtonStyle.grey, label='5'),
        Button(style=ButtonStyle.grey, label='6'),
        Button(style=ButtonStyle.blue, label='÷'),
        Button(style=ButtonStyle.red, label='←')
    ],
    [
        Button(style=ButtonStyle.grey, label='7'),
        Button(style=ButtonStyle.grey, label='8'),
        Button(style=ButtonStyle.grey, label='9'),
        Button(style=ButtonStyle.blue, label='+'),
        Button(style=ButtonStyle.red, label='Clear')
    ],
    [
        Button(style=ButtonStyle.grey, label='00'),
        Button(style=ButtonStyle.grey, label='0'),
        Button(style=ButtonStyle.grey, label='.'),
        Button(style=ButtonStyle.blue, label='-'),
        Button(style=ButtonStyle.green, label='=')
    ],
]
 
#calculates answer
def calculate(exp):
    o = exp.replace('×', '*')
    o = o.replace('÷', '/')
    result = ''
    try:
        result = str(eval(o))
    except:
        result = 'An error occurred.'
    return result
 
@bot.command()
async def calc(ctx):
    m = await ctx.send(content='Loading Calculators...')
    expression = 'None'
    delta = datetime.datetime.utcnow() + datetime.timedelta(minutes=5)
    e = discord.Embed(title=f'{ctx.author.name}\'s calculator | {ctx.author.id}', description=expression,
                        timestamp=delta)
    await m.edit(components=buttons, embed=e)
    while m.created_at < delta:
        res = await bot.wait_for('button_click')
        if res.author.id == int(res.message.embeds[0].title.split('|')[1]) and res.message.embeds[
            0].timestamp < delta:
            expression = res.message.embeds[0].description
            if expression == 'None' or expression == 'An error occurred.':
                expression = ''
            if res.component.label == 'Exit':
                await res.respond(content='Calculator Closed', type=7)
                break
            elif res.component.label == '←':
                expression = expression[:-1]
            elif res.component.label == 'Clear':
                expression = 'None'
            elif res.component.label == '=':
                expression = calculate(expression)
            else:
                expression += res.component.label
            f = discord.Embed(title=f'{res.author.name}\'s calculator|{res.author.id}', description=expression,
                                timestamp=delta)
            await res.respond(content='', embed=f, components=buttons, type=7)```
slate swan
#

Not you, the bot

reef trail
#

just change the timer

stark bobcat
#

uh

slate swan
#

You can take how much time you want, doesn't matter, but bot needs to respond back in 3 secs

stark bobcat
#

oh

wispy sequoia
#

!charinfo ✅

unkempt canyonBOT
slate swan
#

This sometimes happens due to errors too

#

check if any error?

lament mesa
stark bobcat
reef trail
#

prolly

wispy sequoia
#

!charinfo ⛔

unkempt canyonBOT
slate swan
#

I guess it's some error

reef trail
wispy sequoia
reef trail
#

np

slate swan
unkempt canyonBOT
lament mesa
lament mesa
reef shell
#

disnake what?

#

dpy fork?

lament mesa
lament mesa
maiden fable
#

They have

reef shell
#

I hope danny will continue maintaining d.py again

reef trail
#

he prolly wont

slate swan
#

h- h- hun- blushes

lament mesa
#

lol

stark bobcat
reef shell
reef trail
#

Did you not read his gist?

slate swan
reef trail
#

highly unlikely he'll come back

stark bobcat
#

oof ok

reef trail
#

he might contribute some stuff

#

but he probably wont ever fully maintain anything anymore

drifting arrow
#

Soo

wispy sequoia
#

how to make the bot defeaned

#

when it joins a vc

slate swan
unkempt canyonBOT
#

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

Changes client’s voice state in the guild.

New in version 1.4.
wispy sequoia
slate swan
#

Not to exactly copy paste it

#

It's a method of guild

lament mesa
#

and dont pass in *

wispy sequoia
#
@client.command(aliases=["connect", "come"])
async def join(ctx):
    try:
        channel = ctx.author.voice.channel
        embed = discord.Embed(color=0x000000)
        embed.add_field(
            name="\u2705 Success!", value=f"Succesfully connected to `{channel}`.", inline=False)
        await channel.connect()
        await ctx.send(embed=embed)
    except:
        embed = discord.Embed(color=0x000000)
        embed.add_field(
            name="\u26d4 Error!", value="An error occoured.", inline=False)
        await ctx.send(embed=embed)```

how to fix
wispy sequoia
#

it doesn't error rn

#

I need it to defean itself when it joins a vc

slate swan
#

is voice.channel correct?

#

iirc it's voice_channel

wispy sequoia
#

yes

slate swan
#

hmm

wispy sequoia
#

look

#

@slate swan

slate swan
#

okay

dark wagon
#

.-.

slate swan
#

so your code works

#

you just want to deafen?

wispy sequoia
#

yes

#

how?

slate swan
wispy sequoia
#

ok but

#

how do I set it

slate swan
#

Call this method after joining the channel

wispy sequoia
#

did

slate swan
#

oh bruh

wispy sequoia
#

syntax error

slate swan
#

After .connect()

#

so set self_deaf=True then

wispy sequoia
slate swan
#

yert Because it's a method of guild

slate swan
slate swan
# slate swan ???

They copy pasted exactly await change_voice_state(*, channel, self_mute=False, self_deaf=False) from docs

#

you aren't even doing it right

#

oh come on

#

don't copy paste

#

try to understand

wispy sequoia
#

😔

slate swan
#

change_voice_state is a method. use the kwargs to deafen

#

self_deaf=True

#

And it's a method attached to guild, not defined globally

#

Yeah

#

and (*, ...) is for docs, you don't pass kwargs like this

#

you don't need to even copy all and pass all kwargs it just shows examples of what you can do with it

wispy sequoia
#

so await change_voice_state(channel, self_deaf=True)

hasty iron
#

do you know what a method is

slate swan
#

almost correct, but it's a method of guild

wispy sequoia
#

omg 😔

lament mesa
#

Parameters after * need to be supplied as key word arguments, you cant pass it positionally

wispy sequoia
#

can't u just sent the code? I'm not understanding

#

sorry

slate swan
wispy sequoia
#

sad

slate swan
#

answer blankets question though, what's method?

#

Revise your python concepts and try again

#

do you know?

wispy sequoia
lament mesa
#

There you go you got your answer

slate swan
spring flax
#

is that from the internet weirdChamp

slate swan
#

it seems you know

slate swan
#

so what's the problem

lament mesa
slate swan
#

change_voice_state is a method of Guild, and you just said what a method is

#

so....

#

use it now

#

Now think how you can get the guild

wispy sequoia
#

trying to don't look even more stupid

#

let me try

slate swan
#

bruh

wispy sequoia
#

Ikkkkkk

#

wait

slate swan
wispy sequoia
#

await ctx.guild.change_voice_state(channel=channel, self_mute=False, self_deaf=True)

#

omg I did it

#

why is it looking like it's playing smth

slate swan
#

hellp

#

i cant figure out dis error

hasty iron
#

its pretty clear

#

and pretty obvious

wispy spade
slate swan
#

well i saw a vid

#

every end on stats there should be a colon

reef trail
#

how do i check if a user has a nickname

vagrant brook
#

Check if their nickname is different from name prob

reef trail
#

is there no param for it

#

or whatever its called

vagrant brook
#

hmm

slate swan
vagrant brook
#

!d discord.Member.nick

unkempt canyonBOT
reef trail
#

yeah i could check if the nick is none

#

ty

vagrant brook
#

That's obviously invalid syntax

slate swan
#

ohk

#

thx

wooden garnet
#

Hello

wispy spade
wooden garnet
#

does anyone know a way to show dm recipient, couldn't find anything in documentation ```py

on_message

@bot.event
async def on_message(message):
if message.guild is None:
await bot.get_channel(751758793691365437).send(
f"[{message.guild}]<@{message.author.id}>: {message.content}")
await bot.process_commands(message)

wooden garnet
#

however just using message.channel shows Direct Message with Shiba#7473

#

which is pretty good

#

I think I found something though

#

recipient

#

lemme try

#

thanks for the help though @visual island

slate swan
#

why me is getting error when

slate swan
storm zodiac
#

someone tell me how to come up with a name for a discord bot

slate swan
storm zodiac
frigid badge
#

`@client.command(help = "Check your level using this")
async def stats(ctx, member: discord.Member):

print("Brudda")

if member is None: member = ctx.author

# get user exp

async with client.db.execute("SELECT exp FROM guildData WHERE guild_id = ? AND user_id = ?", (ctx.guild.id, member.id)) as cursor:
data = await cursor.fetchone()
exp = data[0]

    # calculate rank

async with client.db.execute("SELECT exp FROM guildData WHERE guild_id = ?", (ctx.guild.id,)) as cursor:
rank = 1
async for value in cursor:
if exp < value[0]:
rank += 1

lvl = int(math.sqrt(exp)//client.multiplier)

current_lvl_exp = (client.multiplier*(lvl))*2
next_lvl_exp = (client.multiplier
((lvl+1)))**2

lvl_percentage = ((exp-current_lvl_exp) / (next_lvl_exp-current_lvl_exp)) * 100

embed = discord.Embed(title=f"Stats for {member.name}", colour=discord.Colour.gold())
embed.add_field(name="Level", value=str(lvl))
embed.add_field(name="Exp", value=f"{exp}/{next_lvl_exp}")
embed.add_field(name="Rank", value=f"{rank}/{ctx.guild.member_count}")
embed.add_field(name="Level Progress", value=f"{round(lvl_percentage, 2)}%")

await ctx.send(embed=embed)`

I made this command , but it is not running when said to , what am i doing wrong ?

boreal ravine
#

Just made a music bot in like 30 minutes pog

slate swan
#

how do i send a message every 2 hrs by bot lol

#

pls tell

reef shell
frigid badge
#

what ?

wooden garnet
#

does anyone know what I'm doing wrong? ```py
await bot.change_presence(status=discord.Status.online,
activity=discord.CustomActivity(
name="Waiting for .help",
emoji=None))

slate swan
boreal ravine
#

it works 🦆

wooden garnet
#

changed the code a bit ```py

presence

@bot.event
async def on_ready():
await bot.change_presence(status=discord.Status.online,
activity=discord.CustomActivity(
name="Listening to .help (msg me for modmail)",
emoji=None))
print("Bot online!")

spring flax
#

It has those kwargd

wooden garnet
#

?

spring flax
#

Kwargs *

#
bot = commands.Bot(comamnd_prefix ="a prefix", activity=...., status =...)```
wooden garnet
#

oh ok

#

still doesnt work @spring flax

#
    activity=discord.CustomActivity(
        name="Listening to .help (msg me for modmail)",
        emoji=None),
    status=discord.Status.online)
#

in commands.Bot

slate swan
wooden garnet
#
bot = commands.Bot(
    command_prefix=[
        "Shiba ",
        "shiba ",
        "Doggo ",
        "doggo ",
        "."],
    help_command=None,
    activity=discord.CustomActivity(
        name="Listening to .help (msg me for modmail)",
        emoji=None),
    status=discord.Status.online)
slate swan
#

just try activity

wooden garnet
#

just changed it btw ```py
bot = commands.Bot(
command_prefix=[
"Shiba ",
"shiba ",
"Doggo ",
"doggo ",
"."],
help_command=None,
activity=discord.CustomActivity(
name="Listening to .help (msg me for modmail)",
emoji="🐕"),
status=discord.Status.online)

#

ok

#
  File "/Users/shiba/Documents/projects/shiba-bot/bot.py", line 15, in <module>
    activity=discord.Activity(
  File "/opt/homebrew/lib/python3.9/site-packages/discord/activity.py", line 193, in __init__
    self.emoji = PartialEmoji.from_dict(emoji)
  File "/opt/homebrew/lib/python3.9/site-packages/discord/partial_emoji.py", line 83, in from_dict
    animated=data.get('animated', False),
AttributeError: 'str' object has no attribute 'get'
shiba@MacBook-Pro shiba-bot %```
#

@slate swan

vagrant brook
#

I don't think bots have access to custom activity currently

wooden garnet
#

Here it's in the list

slate swan
wooden garnet
#

this is line 15 activity=discord.Activity(

#

I think its the emoji

slate swan
#

oh wait

wooden garnet
#

I changed the emoji to None

#

Now I have no errors but the acitivity doesnt work eitehr

#

i gtg rn tag me if you reply pls

reef trail
#

how could i check if a users name contains a string

#
if member.display_name.contains("!") and member.display_name.contains("."):```
 this doesnt work since strings are a no no apparently
error:
```py
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/container/Cogs/mod.py", line 555, in hoist
    if member.display_name.contains("!") and member.display_name.contains("."):
AttributeError: 'str' object has no attribute 'contains'

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

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.8/site-packages/jishaku/features/invocation.py", line 146, in jsk_debug
    await alt_ctx.command.invoke(alt_ctx)
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'contains'```
slate swan
reef trail
#

ahhh, ty

#

how could i check it with multiple?

slate swan
#

There is no python function named contains believe

reef trail
#

there is

#

theres also a function named startswith surprisingly

slate swan
slate swan
#

startswith and endswith

slate swan
#

Indeed

reef trail
#

thank you for the help

slate swan
# reef trail smart

or just loop through i of the str(member.display_name) and check if i == "what you want" that'll also work

#

may be better

reef trail
#

Im checking through multiple characters

#

im making an anti hoist feature

slate swan
#

yeah, if and elif

#

if i == "something"
elif i == "something else"

reef trail
#

this is what i was doing before

#

its very not optimized

#

I was more or less testing if i could do what i wanted

hasty iron
reef trail
#

?

hasty iron
#

!d object.contains

unkempt canyonBOT
#

object.__contains__(self, item)```
Called to implement membership test operators. Should return true if *item* is in *self*, false otherwise. For mapping objects, this should consider the keys of the mapping rather than the values or the key-item pairs.

For objects that don’t define [`__contains__()`](https://docs.python.org/3.10/reference/datamodel.html#object.__contains__ "object.__contains__"), the membership test first tries iteration via [`__iter__()`](https://docs.python.org/3.10/reference/datamodel.html#object.__iter__ "object.__iter__"), then the old sequence iteration protocol via [`__getitem__()`](https://docs.python.org/3.10/reference/datamodel.html#object.__getitem__ "object.__getitem__"), see [this section in the language reference](https://docs.python.org/3.10/reference/expressions.html#membership-test-details).
slate swan
#

not working

#

firstly, don't do it on on_ready

slate swan
reef trail
#

dnd works

slate swan
slate swan
reef trail
#

how could i check if the users name contains something then?

#

i guess startswith works fine

#

since hoisting

slate swan
unkempt canyonBOT
slate swan
#

oh wait nevermind

slate swan
#

i'm not sure exactly what it is

#

but in your bot constructor use activity and status kwarg

slate swan
slate swan
reef trail
slate swan
waxen granite
#

can someone explain me how should i use on_member_unban to send a msg in a channel when the user gets unbanned?

slate swan
#

loop through i of the chars

slate swan
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/stable/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
reef trail
slate swan
#
for i in (member.display_name):
  if i == "something":
    #do something
  elif i == "something else":
    #do something else
clear comet
#

I need a help of custom embed just I need like this syntax !embed <hex code of the colour> <description> please help me

clear comet
reef trail
#

what is i?

slate swan
#

with the description as description, color=color, based on command arguments

slate swan
#

try and except it, or make error handlers

clear comet
#

Ok

slate swan
slate swan
clear comet
#

Thank you very much my friend

slate swan
#

it can be anything

reef trail
#

ah i see

slate swan
#

your welcome

slate swan
#

no

waxen granite
#

can someone explain me how should i use on_member_unban to send a msg in a channel when the user gets unbanned?

slate swan
#

read what i said

slate swan
unkempt canyonBOT
#

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

001 | t
002 | e
003 | s
004 | t
slate swan
slate swan
#

see that's like basically looping through each character of the string

reef trail
#

Yep

pale turtle
#

!d discord.on_member_unban

unkempt canyonBOT
#

discord.on_member_unban(guild, user)```
Called when a [`User`](https://discordpy.readthedocs.io/en/stable/api.html#discord.User "discord.User") gets unbanned from a [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild "discord.Guild").

This requires [`Intents.bans`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.bans "discord.Intents.bans") to be enabled.
slate swan
waxen granite
pale turtle
#

It should be called on_user_unban

slate swan
#

no, it's user

#

weird

waxen granite
slate swan
#

okay, anyways

#

just get the channel with ID or something and send message there?

waxen granite
#

Ye

slate swan
#

press the hyperlink

waxen granite
#

Ik how to get the id and to send the msg in that chan, but what about the middle part? Getting the user which was unbanned and stuff @slate swan

valid galleon
#

so im finally integrating my bot with a database, and i wanted to store the db password and the bot token in a json file. is it ok if i store these 2 in a json file, and how would i do that? is it better to make a .py file and make a list and put it in there?

honest shoal
#
@bot.group(invoke_without_command=True)
async def help(ctx):
    embed = discord.Embed(title="Welcome!", description="Here's the list of available commands", color=discord.Color.purple())
    embed.add_field(name="Information:", value="`serverinfo`,`check`", inline=False)
    embed.add_field(name='Other Commands', value="`youtube`", inline=False)
    embed.add_field(name="Moderation:", value="`kick`", inline=False)
    embed.add_field(name="Utilities:", value="`about`, `ping`", inline=False)

@help.command
async def kick(ctx):
    embed = discord.Embed(title='Kick', description='Kicks a Member from the guild. This command requires **Kick Members** permission to work.')
    embed.add_field(name='Usage', value="`!kick <user>`")
    embed.add_field(name='Aliases', value='Coming soon....')
    embed.add_field(name='Examples', value='!kick @user')
    await ctx.send(embed=embed)
```While trying `!help kick` I am getting that main help menu, why don't I get the below one?
clear comet
fleet prairie
#

guys! i need help if someone can help me!
i am making a bot that plays music radios in a voice channel
i want it to send an error message if you're not in a voice channel but i can't make my code to work 😢

@ouvir.command()
async def antena1(ctx):
    channel = ctx.message.author.voice.channel

    if channel:
      player = await channel.connect()
      player.play(FFmpegPCMAudio('http://radiocast.rtp.pt/antena180a.mp3'))
      await ctx.send("You are listening to **Antena 1**.")
    else:
      await ctx.send("You need to be in a voice channel!")
honest shoal
clear comet
honest shoal
silver wolf
valid galleon
valid galleon
fleet prairie
#

if i change ctx.message.author.voice.channel to ctx.author.voice

silver wolf
#

ctx.author.voice is only to detect if their in a voice channel. Only the channel object has the connect method

round quarry
#

Can I have the bot active 24/7?

lament mesa
#

Yes

#

Host it on a vps

round quarry
#

How do I do it?

maiden fable
#

Tbh, u just need a device on which u can run the python script 24/7

fleet prairie
#

never shuts down

#

and free

silver wolf
# round quarry How do I do it?

Just google VPS. I’ve seen ppl use

Amazon AWS
Digital Ocean VPS
Google Cloud Platform

Or purchase a Raspberry pi

These are just a few

soft wind
random wagon
#

does anyone know a way to see all the attributes of message

soft wind
#

?

random wagon
#

what's that doo?

maiden fable
#

!e print(dir(print))

unkempt canyonBOT
#

@maiden fable :white_check_mark: Your eval job has completed with return code 0.

['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']
random wagon
#

like directires of message

#

OMFG

maiden fable
#

It returns the list of methods and attributes

random wagon
#

THAT'S SOOOO COOOLL

maiden fable
#

(:

random wagon
#

:)

#

thank you!

soft wind
random wagon
#

i'm not that good

soft wind
#

bruhh

#

its an import error

#

buut

random wagon
#

yh ik that

soft wind
#

why im even getting it

random wagon
#

maybe the file don't exist

#

letme go read it gain

soft wind
#

i do

random wagon
#

it does?

soft wind
random wagon
#

what's that

clear comet
#

@honest shoal

soft wind
keen talon
limber latch
#

can someone teach me python for my school practicals

#

only basic python ,, like list function ,, range function

slate swan
#

discord-bots

atomic charm
#

hey i have a small question, is there any way to get the id of a user

#

if i have the username

slate swan
#

!d discord.Guild.get_member

unkempt canyonBOT
slate swan
#

ah, it doesn't accept a name

atomic charm
#

yea

slate swan
#

lemme check in the docs

atomic charm
#

i need the vice versa

lament mesa
#

!d discord.Guild.get_member_named

unkempt canyonBOT
#

get_member_named(name)```
Returns the first member found that matches the name provided.

The name can have an optional discriminator argument, e.g. “Jake#0001” or “Jake” will both do the lookup. However the former will give a more precise result. Note that the discriminator must have all 4 digits for this to work.

If a nickname is passed, then it is looked up via the nickname. Note however, that a nickname + discriminator combo will not lookup the nickname but rather the username + discriminator combo due to nickname + discriminator not being unique.

If no member is found, `None` is returned.
slate swan
#

lemme not

#

lmao

atomic charm
unkempt canyonBOT
#

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

make sure not to use properties inside your code

atomic charm
slate swan
#

nice

#

anyone uses replit?

reef shell
#

how to do the error handling part for group commands?

maiden fable
#

!d discord.on_command_error @reef shell

unkempt canyonBOT
#

discord.on_command_error(ctx, error)```
An error handler that is called when an error is raised inside a command either through user input error, check failure, or an error in your own code.

A default one is provided ([`Bot.on_command_error()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.on_command_error "discord.ext.commands.Bot.on_command_error")).
reef shell
#

for group commands, not for all commands

slate swan
#

you could make your own exception for that

#

and put it in an elif statement