#discord-bots

1 messages Β· Page 906 of 1

slate swan
upbeat otter
#

imagine arguing this much and not getting back an answer

#

πŸ˜”

slate swan
#

lol

sick birch
misty ridge
#

can a bot check if a user online/offline? and if they can ,how?

slate swan
misty ridge
slate swan
#

if you havent already

misty ridge
#

oooh okok

#

thxxx

maiden fable
vestal pine
#

hi

#
@client.command()
async def emojify(ctx, url: Union[discord.Member, str], size: int = 14):
    if not isinstance(url, str):
        url = url.display_avatar.url

    def get_emojified_image():
        r = requests.get(url, stream=True)
        image = Image.open(r.raw).convert("RGB")
        res = emojify_image(image, size)

        if size > 14:
            res = f"{res}"
        return res

    result = await client.loop.run_in_executor(None, get_emojified_image)
    await ctx.send(result)``` error ```discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message     ```
maiden fable
#

Hmm, try printing res

vestal pine
formal basin
upbeat otter
#

happens

formal basin
# formal basin

So I’m making a economy bot but the buy command is not working

vestal pine
vestal pine
maiden fable
vestal pine
maiden fable
#

(Happens to me tho)

maiden fable
#

Also

#

Use aiohttp cz why not

vestal pine
#

I use requests

vestal pine
#

it says aiohttp has no attribut called get

#

but I have another question please

worldly bane
vestal pine
#

thanks

vestal pine
#

or downloaded one

stray flicker
vestal pine
stray flicker
#

repo?

vestal pine
#

repo?

stray flicker
#

I mean if you are using git

vestal pine
#

no

stray flicker
stray flicker
worldly bane
stray flicker
vestal pine
stray flicker
#

I was thinking to make it but then I forgot

#

now you reminded again

vestal pine
#

how can I add more than those colors?

worldly bane
vestal pine
#

thats why I am not sure if I can use downloaded emojis

#

like not the normal emojis

worldly bane
vestal pine
#

oh true, thanks

#
COLORS = {
    (0, 0, 0): "⬛",
    (0, 0, 255): "🟦",
    (255, 0, 0): "πŸŸ₯",
    (255, 255, 0): "🟨",
     (190, 100, 80):  "🟫",
    (255, 165, 0): "🟧",
     (160, 140, 210): "πŸŸͺ",
    (255, 255, 255): "⬜",
    (0, 255, 0): "🟩",
    (0,0,0) : "![dice_0](https://cdn.discordapp.com/emojis/759569474696511518.webp?size=128 "dice_0") ",
}``` but can I do something like that?
worldly bane
vestal pine
vestal pine
#

thank you very much

formal basin
#

It won’t send this message

formal basin
brazen raft
vestal pine
#

cuz I didnt have any rpg number in head πŸ˜…

#

why does it send brown and purple emojis

worldly bane
vestal pine
cosmic agate
#

hey guys

vestal pine
#

hey

cosmic agate
#

2022-03-14T15:38:45.788774+00:00 app[worker.1]: Traceback (most recent call last):
2022-03-14T15:38:45.788798+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/client.py", line 415, in _run_event
2022-03-14T15:38:45.788799+00:00 app[worker.1]: await coro(*args, **kwargs)
2022-03-14T15:38:45.788818+00:00 app[worker.1]: TypeError: on_member_join() missing 1 required positional argument: 'guild'

#
@bot.event
async def on_member_join(member, guild):
      embed= nextcord.Embed(Title= "Welcome!", description=f"**Hello {member.mention}!**\nWelcome to **{guild.name}**!")
      embed.set_image(url="https://tenor.com/view/no-way-home-spider-man-no-way-home-tobey-maguire-spider-man-portal-gif-25114767")
      await welcome.send(embed=embed)
tawdry perch
#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

nono

#

ikt

worldly bane
#

yes

cosmic agate
#

no ikt

tawdry perch
#

ye, it takes 1 argument which is member and not guild (I haven't used discord bots for a while so I might be wrong)

cosmic agate
#

ig thats correct

vestal pine
#

I think nextcord is diffrent

cosmic agate
#

nono

tawdry perch
#

well.. it's worth a try

cosmic agate
worldly bane
#

fork*

vestal pine
#

because I started with discord py then I switched to pycord then nextcord and now back to discord py because I found it was the best

tawdry perch
#

async def on_member_join(member, guild): so.. you have this, but it only takes member param

cosmic agate
#

2022-03-15T07:26:06.078121+00:00 app[worker.1]: Traceback (most recent call last):
2022-03-15T07:26:06.078137+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/client.py", line 415, in _run_event
2022-03-15T07:26:06.078138+00:00 app[worker.1]: await coro(*args, **kwargs)
2022-03-15T07:26:06.078157+00:00 app[worker.1]: File "/app/main.py", line 64, in on_member_join
2022-03-15T07:26:06.078158+00:00 app[worker.1]: embed= nextcord.Embed(Title= "Welcome!", description=f"Hello {member.mention}!\nWelcome to {guild.name}!")
2022-03-15T07:26:06.078175+00:00 app[worker.1]: NameError: name 'guild' is not defined

visual island
#

member.guild to get the guild

cosmic agate
worldly bane
cosmic agate
#

oh ok

#

hmm

worldly bane
#

or ```py
guild = member.guild
embed = nextcord.Embed(Title= "Welcome!", description=f"Hello {member.mention}!\nWelcome to {guild.name}**!")

if I'm correct
#

this should work^

cosmic agate
#

oh

#

XD

drowsy thunder
#

Ok thx

cosmic agate
#

this is what i did

#
embed = nextcord.Embed(Title= "Welcome!", description=f"Hello {member.mention}!\nWelcome to {member.guild.name}**!")
#

@worldly bane

cosmic agate
#

no

drowsy thunder
#

How to use footer and color in nextcord embed(slash)

cosmic agate
#

2022-03-15T07:30:20.672660+00:00 app[worker.1]: Ignoring exception in on_member_join
2022-03-15T07:30:20.673597+00:00 app[worker.1]: Traceback (most recent call last):
2022-03-15T07:30:20.673629+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/client.py", line 415, in _run_event
2022-03-15T07:30:20.673630+00:00 app[worker.1]: await coro(*args, **kwargs)
2022-03-15T07:30:20.673652+00:00 app[worker.1]: File "/app/main.py", line 64, in on_member_join
2022-03-15T07:30:20.673654+00:00 app[worker.1]: embed= nextcord.Embed(Title= "Welcome!", description=f"Hello {member.mention}!\nWelcome to {member.guild.name}!")
2022-03-15T07:30:20.673691+00:00 app[worker.1]: TypeError: init() got an unexpected keyword argument 'Title'

drowsy thunder
#

</>

drowsy thunder
worldly bane
#

not Title

cosmic agate
#

oh tile

drowsy thunder
#

Thats why

cosmic agate
#

i got it

drowsy thunder
#

Caps error lol

worldly bane
drowsy thunder
#

Wanna flood your console?
Use

sus = 'amogus is sus '
print(sus*1000)
drowsy thunder
cosmic agate
#

some thing like this ig

drowsy thunder
cosmic agate
cosmic agate
#

not color

slate swan
#

It's Color/Colour.

#

( brb)

cosmic agate
#

py doesnt use american english ig

drowsy thunder
worldly bane
unkempt canyonBOT
#

discord/colour.py line 331

Color = Colour```
slate swan
drowsy thunder
cosmic agate
# worldly bane `title="Welcome!"`

2022-03-15T07:36:12.857156+00:00 app[worker.1]: Ignoring exception in on_member_join
2022-03-15T07:36:12.858099+00:00 app[worker.1]: Traceback (most recent call last):
2022-03-15T07:36:12.858124+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/nextcord/client.py", line 415, in _run_event
2022-03-15T07:36:12.858125+00:00 app[worker.1]: await coro(*args, **kwargs)
2022-03-15T07:36:12.858138+00:00 app[worker.1]: File "/app/main.py", line 66, in on_member_join
2022-03-15T07:36:12.858139+00:00 app[worker.1]: await welcome.send(embed=embed)
2022-03-15T07:36:12.858158+00:00 app[worker.1]: NameError: name 'welcome' is not defined

drowsy thunder
#

Just edit the sus = ''

cosmic agate
cosmic agate
worldly bane
#

send the full code again

#

welcome has to be a discord.Channel object

cosmic agate
#

like i want to take as

#

you know discord has a thing like

slate swan
#

a discord.abc.Messageable to be accurate

cosmic agate
#

welcome

worldly bane
#

welcome = bot.get_channel(channel_id)

cosmic agate
#

something like this

slate swan
#

!d discord.Guild.system_channel

unkempt canyonBOT
#

property system_channel```
Returns the guild’s channel used for system messages.

If no channel is set, then this returns `None`.
slate swan
#

( you can access it with member.guild.system_channel)

cosmic agate
cosmic agate
slate swan
#

Explain, but what?

cosmic agate
#

what the code does?

drowsy thunder
cosmic agate
#

nvm

supple thorn
#

It gives the channel that's used for system messages

slate swan
#

what idea do you get from the property names

drowsy thunder
cosmic agate
#

in the same channel

cosmic agate
#

hmmm

worldly bane
#

never tried doing it so πŸ€·β€β™‚οΈ

cosmic agate
#

ok lemme try

slate swan
supple thorn
#

You want to send a message whenever that messages get sent in that channel?

drowsy thunder
#

!e

sus = 'Sussy amogus'
print(sus*20)
#

@cosmic agate it should be like this

supple thorn
#

Technically what you want is to check if a new user joins the server if that is what you want

drowsy thunder
#

Also,Can I know whzt are intents,idk what it is honestly

supple thorn
cosmic agate
drowsy thunder
#

I know alot about python

#

But anyways

#

Yall know how to ban using slash commands?

cosmic agate
#

!e

sus = 'πŸ‘‹'
print(sus*1000)
#

oh sorry

supple thorn
worldly bane
#

that yellow wave made my flinch for some reason πŸ’€

supple thorn
# drowsy thunder Uhh,what

I remember seeing someone with discord bot coder in their bio and they didn't knew basic python and was struggling in this channel

#

Seeing what everyone says when they mention you in this channel i'm thinking that's you

honest vessel
#

@worldly banecreative bio

worldly bane
supple thorn
honest vessel
#

is it alot of content?

supple thorn
#

Nope

#

Scroll and see what they say

worldly bane
supple thorn
honest vessel
honest vessel
#

how you know alot of python if dosnt even know indentations

supple thorn
vestal pine
#

hi, I got a question please, it is actually a how to question:
I have made yesterday a command for the server I am in, it is to help them to manage the donations in a discord bot called anigame and yes they have a clan and they needs to donate.
I made the bot that if they type .cl donate 10000 the bot takes the 10000 and save them as if they donated it, what I am trying to do if the other bot says donation failed, you don't have enough money to donate my bot should then ignore their donations

placid skiff
#

Custom checks

#

what package are you using?

vestal pine
drowsy thunder
#

Nextcord code

#

Errored out

supple thorn
vestal pine
supple thorn
drowsy thunder
lyric tusk
#

My bot is sending the command 2 times when i type the commands ones
i have restart bot and my pc i dont now what do to xD

novel bolt
#

how set time like that?

supple thorn
drowsy thunder
#

Use this

cosmic agate
#

@worldly bane i got it

drowsy thunder
#

It is how it works

cosmic agate
#

it works

placid skiff
#

ok, you can do something like this:

from typing import TypeVar, Callable
from discord.ext.commands import check, CheckFailure, Context

T = TypeVar("T")

class DonationError(CheckFailure):
  def __init__(self, message):
    self.message = message
    super().__init__(message=self.message)

def has_money()->Callable[[T], T]:
  def predicate(ctx: Context):
    user = ctx.author
    user_money = # Your way to retrieve the user money
    if user_money < ctx.kwargs["money"]: # money is the name of the argument passed in the command
      raise DonationError(message="not enough money")
    return
  return check(predicate)
novel bolt
lyric tusk
# drowsy thunder Show the code

    #commandos
    @commands.command()
    async def ping(self, ctx):
        await ctx.send(f'The speed of the bot is {round(self.bot.latency * 1000)}ms')
    
    
    #info commands
    @commands.command(aliases=['info'])
    async def hello(self,ctx,  member:nextcord.Member=None):

        infoEmbed=nextcord.Embed(color=0xdc0909)
        infoEmbed.add_field(name="Hello guys!", value="I am the new bot for the EPYC|DPYC community\nif u have any suggestions for the bot😎", inline=False)
        await ctx.send(embed=infoEmbed)
drowsy thunder
#

@cosmic agate hey! What about annoying your friends,did it work?

pulsar niche
#

The bot could be running multiple instances

drowsy thunder
supple thorn
#

Man blvck typing out a whole essay

modest plover
lyric tusk
novel bolt
placid skiff
# vestal pine wow thank you very much

then when you declare the command you can just do this:

@bot.command()
@has_money()
async def your_command(ctx: Context, money: int):
  #your stuff here

the check will be called automatically

pulsar niche
#

Nextcord? like branch lib?

drowsy thunder
modest plover
novel bolt
pulsar niche
#

version 2 release by may 1st

modest plover
#

Yeah, to bump it to API 10, because after April, it would have been unusable

drowsy thunder
#

HELP MEE

pulsar niche
#

10 is out?

drowsy thunder
modest plover
#

has_permissions maybe?

slate swan
unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
modest plover
drowsy thunder
#

Oh ok,should the permission name be in strings?

placid skiff
# vestal pine thank you

remember that the class will be a new error, so remember to handle it in your error handler, you can just check if the error is an instance of your DonationError class

slate swan
#

no.

drowsy thunder
pulsar niche
#

Cool. Needs a little read for catching up on the gateway doc

slate swan
drowsy thunder
slate swan
#

!d nextcord.ext.commands.has_permissions

unkempt canyonBOT
#

@nextcord.ext.commands.has_permissions(**perms)```
A [`check()`](https://nextcord.readthedocs.io/en/latest/ext/commands/api.html#nextcord.ext.commands.check "nextcord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`nextcord.Permissions`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Permissions "nextcord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://nextcord.readthedocs.io/en/latest/ext/commands/api.html#nextcord.ext.commands.MissingPermissions "nextcord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://nextcord.readthedocs.io/en/latest/ext/commands/api.html#nextcord.ext.commands.CheckFailure "nextcord.ext.commands.CheckFailure").
drowsy thunder
#

I mean @nextcord

slate swan
#

try , you won't be able to do that :)

#
from nextcord.ext import commands

@commands.has_permissions(...```
vestal pine
placid skiff
vestal pine
#

like you wrote that I should check if they have the money

supple thorn
#

Khaled just wants to read the embed

#

Wether it failed or succeeded

dense swallow
#

anyone here know postgres?

placid skiff
drowsy thunder
#

Help

placid skiff
#

!d discord.TextChannel.delete

unkempt canyonBOT
#

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

Deletes the channel.

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

No,Its in / commands

placid skiff
#

That changes nothing...

drowsy thunder
#

Oh wait

placid skiff
#

you need a channel object

drowsy thunder
#

I dont wanna delete channel!

#

I wanna purge messages

placid skiff
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
drowsy thunder
#

How to code this code

placid skiff
#

you just the need the channel object no matter what package are you using

placid skiff
# drowsy thunder How to code this code

well, for example in disnake:

from disnake import ApplicationCommandInteraction

@bot.command()
async def purge(ctx: ApplicationCommandInteraction, messages: int = None):
  messages = 5 if message is None else messages
  await ctx.channel.purge(limit=messages)
slate swan
#

messages = messages or 5

placid skiff
#

i'm actually sleepin yet so don't complain my code hahaha

slate swan
#

Irish land day in python cord sheesh people know I exist

slate swan
maiden fable
drowsy thunder
#

Help me

hoary cargo
#

await purge

drowsy thunder
#

Hwo to do it properly

#

@hoary cargo

slate swan
hoary cargo
drowsy thunder
regal cove
#

hi i just made this command and can y'all look through it and see if it works or not:

#

cool my command is too long

#

i cant send it

drowsy thunder
drowsy thunder
hoary cargo
slate swan
regal cove
regal cove
#

this is a part of the command tho. i get the error context has no attribute "discord"

#
async def pay(ctx, member: discord.Member, amount):```
hoary cargo
#

^

hoary cargo
drowsy thunder
regal cove
#

did i?

#

i know its a simple mistake i made

hoary cargo
regal cove
#

bruh

slate swan
#

@bot.command(name="claim",description="yb better",pass_context=True)
async def _claim(ctx, *, reason=None):
        username, user = reason.split(':')
        if not get(ctx.guild.roles,id=int(952619437427654696)) in ctx.author.roles:
          return await ctx.send("you dont have role 3l make ticket to apply")
webhook = DiscordWebhook(url= os.environ['alexlol'])
embed = DiscordEmbed(title=f'{user}', description= f'{user} {username}', color= '264dd9' )


webhook.add_embed(embed) ## Adds embed to webhook

response = webhook.execute() ## Executes the webhook```
regal cove
#

yes idk wtf i did

drowsy thunder
regal cove
#

instead of doing ctx.message.author i did ctx.discord.message.author

drowsy thunder
#

I think its a issue with the nextcord package

slate swan
regal cove
#

i was really dumb

hoary cargo
#

ok then send the code after modifications, though it's weird

regal cove
#

whats even worse is i only did that once

regal cove
#

i did it right all the other time

drowsy thunder
#

Idk what just happened

hoary cargo
#

code

drowsy thunder
#

But Im 100 sure i didnt do 1 is none

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: '>' not supported between instances of 'set' and 'int'
slate swan
hoary cargo
drowsy thunder
#

I will trust one of the peps and give them code link for repl

slate swan
#

Bro…

#

Repl really

drowsy thunder
#

Yeah

slate swan
#

You could of used vs code, pycharm but you decided to pick repl…

drowsy thunder
slate swan
drowsy thunder
#

Pydroid 3?

#

Kinda but the big ol screen makes it easy

#

Who thinks I should use Pydroid 3,ping me

hoary cargo
#

MR_uncanny_1 pro tip, you don't do programming on mobile phones/ tablets

hoary cargo
drowsy thunder
#

But what to do aaaaa

slate swan
slate swan
drowsy thunder
slate swan
modest plover
#

Also alternatively, you could say the bot is machine learning and not discord lmao

#

Or, use a phone

final wagon
#

I am a beginner and i am trying to make a public welcome bot
it will first be enabled by the user through command if they wanted then it will run (basically run event on user input whether they want it or not)
and i need this for every diffrent server
Can anyone please give me any hint how to do it because i dont have any clue

modest plover
#

@final wagon so when a member joins, it sends a message sayin "hi @member" to the channel the owner picks?

hoary cargo
#

You will need to work with a database for this

#

Idk if u should do this as a beginner tbh

modest plover
#

Use a database, make a config command probably which lets the user save the channel and it's id the database

#

Then just use

#shit to get channel ID, save it to ID
channel = self.bot.fetch_channel(ID)
await inter.channel_send(embed = welcomeEmbed)
#

Is how I would probably do. All the discord code shit is easy

#

It's only the database shit which is a bit harder

light violet
#

is there really any way to make bot dm me without being in m mutual servers?

#

like with id

modest plover
#

Probably not.

#

Also, why would you need to do that?

light violet
modest plover
#

I'm gonna pretend like I know what semcret is

light violet
#

awww'

modest plover
#

What's semcret?

light violet
#

secret*

light violet
slate swan
#

It’s like trying to dm user without mutual server or being added

light violet
#

ok

#

c

#

is there an wa to get guild with api ?

hoary cargo
#

MR_uncanny_1 listen
It's impossible ok

slate swan
unkempt canyonBOT
final wagon
final wagon
gaunt ice
#

oh hi yerli

#

what's this for

slate swan
#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.

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

gets the user with an api call ^

final wagon
gaunt ice
#

hm then u need to keep a database

#

and store the values according to the server owners wish

final wagon
#

okay i have to create a database but how can i enable or disable welcome message(event) acc to user

slate swan
final wagon
#

thank you i will try it tonight

inner epoch
#

Hey guys am using discord python to develop a bot and its an NSFW bot how to check if the channel it is in is NSFW one?

slate swan
#

!d discord.TextChannel.is_nsfw

unkempt canyonBOT
#

is_nsfw()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.10)"): Checks if the channel is NSFW.
maiden fable
#

Cool

gaunt ice
inner epoch
slate swan
#

?

inner epoch
#

I have commands like this how do I fix all that in it?

#

Like do I need to add client or something

gaunt ice
slate swan
inner epoch
#

Umm yea so like wait

#

How can I share link on here?

slate swan
#

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

inner epoch
#

Aye wait ill do that

#

How do I make it such that when -agif is typed it checks if channel is NSFW and then serves the gif

slate swan
#

just check if the channel is nsfw with the method given since it returns bool check if its true

gaunt ice
#

I get ratelimited whenever I try on message

inner epoch
gaunt ice
#

try if channel.is_nsfw == true:

inner epoch
#

Umm like see let me make a function

def check_channel():
  a = discord.TextChannel.is_nsfw
  return(a)

a = check_channel()

if a == True:
  #do something
#

Is that correct

gaunt ice
#

umm

frozen elk
#

i have been using mongodb and it's slow in responding what do you suggest i use now

slate swan
#

is there a way to get/store the interaction message?

gaunt ice
gaunt ice
#

I'm in a 1gb ram tablet so I cant type muc faster

gaunt ice
#

yea

slate swan
# inner epoch Umm like see let me make a function ``` def check_channel(): a = discord.TextC...

i recommend u to use @is_nsfw() smil for example py @bot.command() @is_nsfw() async def ur_command(ctx): #whatever you want then use on_command_error event or just locate the command error like : ```py
@bot.command()
@is_nsfw()
async def ur_command(ctx):
#whatever you want
@ur_command.error
async def command_error(ctx, error):
if isinstance(error, commands.NSFWChannelRequired)
#message

slate swan
gaunt ice
#

await bot.wait_for('message',check = lambda,m.author = ctx.author, m.channel = ctx.channel)

gaunt ice
#

I've been wasting my time then

slate swan
gaunt ice
#

ahh

#

true forgot abt that

slate swan
#

ye, i just want to get the get_bucket but that needs message + interactions doesnt have messages ig. Well when i tried inter.message it gave me a error

gaunt ice
slate swan
candid pilot
#
async def give(ctx, a: int, member: discord.Member=None):
    users = await chung_data()
    await ctx.send(f"Given {a} coins")
    users[str(member.id)]["Wallet"] += a

    with open("chungbank.json", "w") as f:
            json.dump(users, f)```
#

how do i make it so that itll remove the same amount from the person who gave

slate swan
placid skiff
#

uhm

slate swan
# placid skiff uhm
class is_premium:
  def __init__(self, rate, per, rate1, per1, type, guilds: list):
    self.cooldown = commands.CooldownMapping.from_cooldown(rate, per, type)
    self.premium_cooldown = commands.CooldownMapping.from_cooldown(rate1, per1, type) 
    self.type = type
    self.guilds = guilds
    
  def __call__(self, inter: disnake.Interaction):
    key = inter.guild_id
    if key in self.guilds:
      bucket = self.premium_cooldown.get_bucket(inter.message)
    else:
      bucket = self.cooldown.get_bucket(inter.message)
    retry_after = bucket.update_rate_limit()
    if retry_after:
      raise commands.CommandOnCooldown(bucket, retry_after, self.type)
    return True```
#

it looks like dis

placid skiff
#

first of all, don't use type as name of variable, type is a builtin method

slate swan
placid skiff
#

what package are you using and what do you want to get from the slash command?

cosmic agate
slate swan
tacit stone
placid skiff
maiden fable
slate swan
slate swan
placid skiff
placid skiff
slate swan
inner epoch
slate swan
drowsy thunder
#

Hello,so is this possible that you do a command saying /verify #verify @Verified in which #verify is the channel and @Verified is the role name and you can do this on different servers and with different channels and role names and every user who joins will go to verify channel and click the button called verify and it will say You are verified in ephemeral form and if you clicm that button again it shows You are already verified! in ephemeral form...

candid pilot
# slate swan for example ```py users[str(ctx.author.id)["wallet"] - a ```
async def give(ctx, a: int, member: discord.Member=None):
    users = await chung_data()
    await ctx.send(f"Given {a} leancoins")
    users[str(member.id)]["Wallet"] += a
    users[str(ctx.author.id)["Wallet"] - a

    with open("chungbank.json", "w") as f:
            json.dump(users, f)```am i doing it wrong or something i keep getting invalid syntax on open bank.json line
regal cove
slate swan
#

users[str(ctx.author.id)]["Wallet"] - a

drowsy thunder
#

Help meee

candid pilot
drowsy thunder
#

@regal cove can ya help me

regal cove
#

and the error i get is: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "/opt/virtualenvs/python3/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: OperationalError: no such column: getter_id

slate swan
candid pilot
#

ohh

regal cove
#

can someone pls help me

left crater
#

nvm

regal cove
#

just scroll up and its all there

left crater
#

ye

candid pilot
#

not getting any errors rn but its not working on discord

#

its giving but not removing

#

@slate swan

left crater
#

i personally cant help you with that maybe someone else can

regal cove
#

json isnt a database and ur gonna have huge problems with lag

candid pilot
regal cove
#

thats why im trying to switch over to sqlite

candid pilot
#

i see

regal cove
#

json is much easier to use than sqlite tho

#

easier to code

slate swan
regal cove
#

i havent heard of mongodb

slate swan
regal cove
#

but what i would need

slate swan
regal cove
#

is for someone to help me with my code

regal cove
#

whoever looks through my code and help me with my probably pretty simple mistakes in my code is a goat

candid pilot
#

@slate swan thanks for the help, i fixed it. just had to put an = after the negetive symbol

unkempt canyonBOT
#

Hey @cold oyster!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

cold oyster
#

Oof

cold oyster
slate swan
cold oyster
slate swan
#

I meant, show

#

my bad

cold oyster
cold oyster
slate swan
regal cove
#

i need help

slate swan
regal cove
#

but people ignored me -_-

slate swan
slate swan
slate swan
slate swan
#

like you're making an api call , you may have to use that, since you cant get the response and send that within 3 seconds

slate swan
#

i've never used sql db

inner epoch
#

Thanks @slate swan @gaunt ice @slate swan for the help my bot works fine now may god bless you!!

sage otter
gaunt ice
#

hm

swift monolith
#

im making a calculator in my bot and when i input 0.1+0.2 it gives 0.3000000004
i tried the math round function but it rounded to 0

#

similarly it gives cube root of 1000 as 9.99999998

#

is there a way to fix this

vocal plover
#

How are you doing the calculations?

inner epoch
inner epoch
inner epoch
#

Lol thanks to all.....

swift monolith
# vocal plover How are you doing the calculations?
                ans=float(num1+num2)
                await message.channel.send(f"<@{message.author.id}> Your answer is {ans}")
                return
            if operator=="-":
                ans=num1-num2
                await message.channel.send(f"<@{message.author.id}> Your answer is {ans}")
                return
            if operator=="/":
                ans=num1/num2
                await message.channel.send(f"<@{message.author.id}> Your answer is {ans}")
                return
            if operator=="^":
                ans=num1**num2
                await message.channel.send(f"<@{message.author.id}> Your answer is {ans}")
                return
            if operator=="%":
                ans=(num1/100)*num2
                await   message.channel.send(f"<@{message.author.id}> Your answer is {ans}")
                return
            if operator=="rt":
                ans=round(num1**(1/num2))
                await message.channel.send(f"<@{message.author.id}> Your answer is {ans}")
                return
            else:
                await message.channel.send(f"<@{message.author.id}> Invalid")
                return
maiden fable
#

Alec, u got demoted?

vocal plover
#

okok, so basically the reason it is giving you weird numbers is due to how computers do addition, they work in binary rather than decimal so you get things called rounding errors for things like this

swift monolith
#

i used round for root and it worked because of whole numbers right?

vocal plover
#

one way you could fix it is by using the decimal module which works in decimal rather than binary and will make more familiar looking answers

swift monolith
#

ok i will look it up.
thanks for support

slate swan
gaunt ice
#

is there a way for me to not get ratelimited for using on_message

slate swan
#

sorry for the ping, Hunter πŸ˜”

gaunt ice
#

process commands ok but stil?

slate swan
gaunt ice
#

yes?

vocal plover
#

no?

gaunt ice
#

um

slate swan
gaunt ice
#

um

#

how does bots get ratelimited

maiden fable
#

Uhhh, I got a ghost ping....?

slate swan
gaunt ice
#

hm

slate swan
maiden fable
#

Ah gotcha

gaunt ice
#

like the bot checking every message in a alive general chat for swear words

#

what abt that

slate swan
gaunt ice
#

hm

vocal plover
#

the only thing you can get ratelimited for is making api calls

#

receiving events doesnt affect ratelimits

gaunt ice
#

hm

#

alr then

gaunt ice
#

everytime a message triggers

#

the API has to fetch the channel

vocal plover
#

generally speaking if you're not awaiting a call, it doesnt contact the api

gaunt ice
#

so I have to define the channel outside the event

boreal ravine
#

@gaunt ice Which host are you using?

gaunt ice
#

hmm

gaunt ice
#

ima peasant

boreal ravine
gaunt ice
#

definitely not freecodecamp

#

yes

#

ik ik I'm that average freecodecamp guy

#

but all I could do was that at that time

boreal ravine
#

Don't use replit for hosting bots, they use shared IPs so if one bot on replit gets rate limited, your bot will get rate limited too :)

gaunt ice
#

now I'm learning from docs

gaunt ice
#

FRICK

#

I DIDNT KNOW THAT

#

ig time to buy raspberry pi

boreal ravine
#

Now you know

slate swan
#

which one is better is not None or != None

gaunt ice
gaunt ice
supple thorn
brave flint
#

um can i ask python things here

supple thorn
#

If it's related to discord bots

boreal ravine
#

Consider using is when comparing to types

slate swan
brave flint
#

well it for my discord bot things but...

slate swan
sick birch
vocal plover
#

it's for checking if 2 objects are the exact same object

slate swan
#

how to get the get_bucket for a command a_kimy_smiles

sick birch
vocal plover
#

nope

#

that'd be isisnstance

brave flint
#

holy im dumb

boreal ravine
#

@brave flint use motor instead of pymongo

brave flint
boreal ravine
#

awesome

gaunt ice
#

I used to use pymongo

#

but changed to motor lmfao

brave flint
#

well

gaunt ice
#

no offense

brave flint
#

what motor does lol

gaunt ice
#

it's just like pymongo

brave flint
#

idk i just hating asyncio thing

boreal ravine
brave flint
vocal plover
brave flint
#

im bad on it soo...

slate swan
#

what is this bro

#

i cannot run the code

stone beacon
#

Uh..

#

πŸ’€

gaunt ice
#

wait I got this error too

#

but this was when I got ratelimited

gaunt ice
slate swan
gaunt ice
#

yes

slate swan
#

lol

gaunt ice
#

freecodecamp making a killing

slate swan
#

so it gets limited rn?

gaunt ice
#

yes

#

show the full error

slate swan
#

how long is it?

gaunt ice
#

idk

slate swan
#

3hr?

gaunt ice
#

yes sm what

slate swan
gaunt ice
#

this is all?

slate swan
#

yea

gaunt ice
#

yup

#

u got ratelimited

boreal ravine
#

Don't use replit for hosting bots

gaunt ice
#

prolly

gaunt ice
slate swan
gaunt ice
#

yes

slate swan
#

or which one

gaunt ice
#

or buy raspberry Pi

#

if ur not a peasant that is

slate swan
#

i don't understand haha,hard to use heroku

boreal ravine
gaunt ice
slate swan
#

bruh it ran justnow

boreal ravine
#

awesome!

slate swan
#

than it gets the error after like 10 seconds

slate swan
slate swan
spring flax
#

how do you get the timestamp for a discord embed in relation to the day? i.e today, yesterday, e.g.

boreal ravine
#

why do you guys even like hosting bots on replit Bruhmoment

boreal ravine
slate swan
#

it ran again then stops

boreal ravine
slate swan
# sage otter Gateway?

yeah gateway sorry its just in docs on wait for it says websocket eventd which does get sent through it but it confuses me a bit

sage otter
#

Websocket is just a connection to the gateway it has nothing specifically to do with discord but just being a two way communication between the gateway and your bot

slate swan
#

yeah ik its just docs on wait for confuses me because the wording is a bit off

sage otter
#

Similar to network protocols like tcp/udp in a sense

#

But not really

slate swan
#
const Discord = require("discord.js")
client.on("guildCreate", async (guild) => {
    let channel = new Discord.WebhookClient(
        client.config.webhook.id,
        client.config.webhook.token
    );
    const embed = new Discord.MessageEmbed()
        .setColor(client.config.embed.color)
        .setThumbnail(guild.iconURL({ dynamic: true }))
        .setTitle("New Server!")
        .addField("Server Name", guild.name, true)
        .addField("Server ID", guild.id, true)
        .addField("Owner ID", guild.ownerID, true)
        .addField("Owner Mention", `<@${guild.ownerID}>`, true)
        .addField("Member Count", guild.memberCount, true)
        .setFooter(client.user.username, client.config.embed.thumbnail);

        await guild.channels.cache
        .first()
        .createInvite()
        .then((invite) => embed.addField("Invite link", invite.url, true))
        .catch(() => embed.addField("Invite link", "Missing permissions", true));

    channel.send({ embeds: [embed] });
});
quick gust
#

wrong server lol

boreal ravine
#

Wrong server buddy

slate swan
quick gust
#

that's js

slate swan
#

How to add this script in my bot?

#

asking js code in py server πŸ’€

slate swan
quick gust
#

um, this is a python server, not a js server

boreal ravine
boreal ravine
slate swan
boreal ravine
slate swan
#

I put in last but this error is coming

#

In config

#

@sick birch oohhh robin02comfy

slate swan
#

Anyone?

boreal ravine
# slate swan

I have no idea what that means, and you need to go somewhere else for help (no offence)

slate swan
#

You also can ask the mods

boreal ravine
slate swan
boreal ravine
slate swan
slim ibex
#

me too

slate swan
boreal ravine
slate swan
slim ibex
#

ok bet

slate swan
#

is it just me that knows rb

#

Xd np

boreal ravine
slate swan
#

bro is this new

#

i got it today

boreal ravine
slate swan
#

@boreal ravine dm

slate swan
slim ibex
#

javascript has dunder methods (attribute):

class Bar {}
var bar = new Bar()
console.log(bar.__proto__);
slate swan
boreal ravine
slate swan
#

😳

slim ibex
#

no its the objects prototype. since js does prototypal inheritance

slate swan
#

ew

spring flax
#

link?

#

oh not that

#

with sfrttime

slate swan
#

LMAO

spring flax
#

i can't find it

boreal ravine
sage otter
#

Idk what that was I’m not gonna lie. Shitty mobile

slate swan
boreal ravine
#

Right.

sage otter
spring flax
slate swan
#

Check dm

sage otter
#

Oh

slate swan
spring flax
#

okay actually i don't know which thing it uses but

sage otter
#

I think you can just slide

spring flax
#

also it adjusts automatically so if the embed sent yesterday is looked at today it will say yesterday and if it is two days ago is will show dd/mm/yy or whatever but I think this is a discord thing

sage otter
#

A datetime object into it

spring flax
#

and?

sage otter
#

that’s it

slate swan
#

ah

#

i made new repl

#

then copy paste,disable old one

#

and it worked

spring flax
sage otter
#

To the time stamp

slate swan
#

samething tbh

sage otter
#

!d discord.Embed.timestamp

unkempt canyonBOT
#

The timestamp of the embed content. This is an aware datetime. If a naive datetime is passed, it is converted to an aware datetime with the local timezone.

slate swan
#

the timestamp kwarg still gets set to the footer of the embed

#

anyways , thx for the little help.. have a wonderful night!

#

me? orr

slate swan
spring flax
#

ooh okay

slate swan
spring flax
#

thank you Tylerr

slate swan
spring flax
#

I will, that was just to test it

slate swan
#

ah

spring flax
#

doesn't matter too much though

slate swan
#

nope but its cleaner

boreal ravine
sage otter
#

It’s cleaner and there’s not really a reason to

slate swan
sage otter
#

Unless your dynamically setting it

slate swan
#

^

boreal ravine
#
embed = discord.Embed()
embed.description = ''
embed.timestamp = ...
``` is more readable
slate swan
#

bro what?

terse locust
#

#bot-commands

sage otter
#

Having in the constructor tho makes it more aligned and makes it seem more localized tho

boreal ravine
#

Right

slate swan
#

yeah so its more together with the class construction

junior verge
#

!Paste

slate swan
#

you can set a default value of none and check the value or just add another value of whatever you want

#

tl;dr optional arguments

#

anyone js?

slate swan
quick gust
#

bro this is a python server lmao

slate swan
#

heyyy, I have a problem I put my moderation commands in a cog but when I add it in the hand I get an error

#

show

#

you dont import it

placid skiff
#

lol

slate swan
#

you add the cog in the file with the method and you pass the class

placid skiff
#

that are the problems that we mentioned to you yesterday

slate swan
#

Explain to me how I can correct this problem please

slate swan
#

I don't see how to add the class. Sorry for my ignorance on discord.py

slate swan
#

in the cog file

swift monolith
#

if i have a float assigned to a variable is it possible to find out the decimal places?
its in my calc in a bot

slate swan
#

I always have the same mistake

swift monolith
slate swan
#

if the decimal is long just round it out

#

!e print(round(45.55))

unkempt canyonBOT
#

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

46
swift monolith
#

!e print(round(0.1+0.2))

unkempt canyonBOT
#

@swift monolith :white_check_mark: Your eval job has completed with return code 0.

0
swift monolith
#

thats what happens

#

if i round

maiden fable
#

Yea

slate swan
#

well thats how math works?

#

I always have the same mistake

maiden fable
#

Cz 0.3 rounds off to 0

slate swan
#

^ math

swift monolith
maiden fable
#

Just use math.ceil()

import math
print(math.ceil(0.1+0.2)) 
#

!e
import math
print(math.ceil(0.1+0.2))

unkempt canyonBOT
#

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

1
slate swan
slate swan
swift monolith
#
                ans=float(num1+num2)
                await message.channel.send(f"<@{message.author.id}> Your answer is {ans:,.8f}")
                return```
i want it to give only the required decimal places if there are any
slate swan
#

I did what you told me but it didn't work

#

bro you didnt even tried it

#

if you did and an error is raised show if you have another problem say

regal cove
slate swan
#

!d disnake.ext.commands.Bot.fetch_member

unkempt canyonBOT
#
Huh? No.

No documentation found for the requested symbol.

maiden fable
#

fetch_user*

slate swan
#

lol

maiden fable
#

Or Guild.fetch_member if u want timeout

maiden fable
honest shoal
#

ohh, lol
but one more error now console AttributeError: 'User' object has no attribute 'timeout'

slate swan
visual island
maiden fable
#

Just do:

class MyCog(commands.Cog):
    . . . 
def setup(bot):
    bot.add_cog(MyCog(...)) 
slate swan
#

show

maiden fable
maiden fable
visual island
maiden fable
#

But they wanted to use fetch so I just told them with fetch lemon_pensive

slate swan
# slate swan

its supposed to be outside of the class and in the global setup function

visual island
maiden fable
tough trellis
#

how would i react to the command message ($hi) and add a wave react or something

lament mesa
slate swan
#

I can't do it

lament mesa
unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
slate swan
#

!d discord.Message.add_reaction @tough trellis

unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.

Changed in version 2.0: `emoji` parameter is now positional-only.

Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
slate swan
gaunt ice
#

rection

slate swan
#

I still can't get through, would you like to see my code ?

gaunt ice
#

sure

slate swan
potent spear
gaunt ice
#

adding cog issua

#

issue*

potent spear
#

well, I don't see any setup method in the cog itself first of all

slate swan
gaunt ice
#

why moderation.cogModeration?

potent spear
#

because his file is named like that most likely

gaunt ice
#

oh wait

#

I'm dumb

#

wait a min

#

try add_extension

unkempt canyonBOT
potent spear
# slate swan

try this instead:
bot.load_extension("cogs.moderation") <- in the init
(it's "cogs." because I assume you have a cogs folder where your moderation is in


in the moderation.py file, last line, NOT in the class

# The setup function below is neccesarry. Remember we give bot.add_cog() the name of the class in this case CogModeration.
# When we load the cog, we use the name of the file.
def setup(bot):
    bot.add_cog(CogModeration(bot))```
gaunt ice
#

Yess

#

not add extension

slate swan
#

why does this not work for me to add a role per command?

gaunt ice
#

what error

dense vortex
#

nah. i put them in. they just arent on the ss

slate swan
#

ah

dense vortex
#

i mean i did forget them but i found out fast enough when i typed the command and got the entire list pepeclown

slate swan
#

kek

#

Hi, I am building a discord bot which handles some coin and market system. So I will need to have money data per users. I installed the mongo db but couldnt understand how to make special data per user. can someone teach me how to make it ?

slate swan
quaint epoch
sage otter
#

what’s wrong with local storage :<

slate swan
#

how can i reset cooldowns in slash commands?

slate swan
quaint epoch
#

btw you can't add roles to a user

#

only members

slate swan
quaint epoch
#

btw

slate swan
quaint epoch
#

change name="Staff" to id=id and use await ctx.guild.fetch_roles() instead of ctx.guild.roles

slate swan
quaint epoch
#

ID's are much better than names

slate swan
slate swan
sage otter
quaint epoch
sage otter
#

The only time you should be using utils.get is if you are grabbing by name

quaint epoch
#

i wanna change as little of the code as possible while keeping the functionality the same

sage otter
quaint epoch
#

lol

sage otter
#

And you don’t need fetch_roles() either

#

All of the guild roles will be in cache

quaint epoch
slate swan
slate swan
#

yes

#

better use commands.Bot tho

quaint epoch
# slate swan yes

replace your client = discord.Client() with bot = discord.ext.commands.Bot(commands_prefix='!', intents=discord.Intents.all())

final iron
#

Spoonfeed go brrrr

quaint epoch
final iron
#

At least explain it

unkempt canyonBOT
#

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

This class is a subclass of [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") and as a result anything that you can do with a [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.GroupMixin "disnake.ext.commands.GroupMixin") to provide the functionality to manage commands.
quaint epoch
#

this represents a bot

#

which is what you should use when you're making a bot

final iron
#

Questionable explaination

quaint epoch
slate swan
#

yes

final iron
#

Using commands.Bot instead of discord.Client allows you to do some extra things. Most notably, use the commands extension

quaint epoch
#

send the new command over

slate swan
# quaint epoch send the new command over
@commands.has_permissions(administrator=True)
async def accept(ctx, member: discord.Member = None):
 if member == None:
     embed = discord.Embed(title="", description="Please Mention a applicant!", colour=0x992d22)
     await ctx.send(embed=embed)
 else:
     embed = discord.Embed(title="", description=f":smalltick: Welcome in the team buddy!", colour=0x2ecc71)
     await member.send(embed=embed)
     embed = discord.Embed(title="", description="A Staff Member will message you shortly!", colour=0x2ecc71)
     await member.send(embed=embed)
     id = ("953063650967560222")
     role = discord.utils.get(ctx.guild.roles, id=id)
     await member.add_roles(role)
#

idk if i did something wrong

quaint epoch
#

an id is an integer, not string

slate swan
#

oh

quaint epoch
#

and try async def accept(ctx, *, member: discord.Member = None):

lilac eagle
#

Original

responses={'bren':'@visual basalt'}

@bot.event
async def on_message(message):
      for response in responses:
          if message.author != bot.user and message.content.lower().startswith(response.lower()):
              embed=discord.Embed(description=responses[response],colour=0x960200)
              await message.channel.send(embed=embed)
              break
      else:
          await bot.process_commands(message)

New

responses={'bren':'@visual basalt'}


@bot.event
async def on_message(message):

      for response in responses:
          if message.author != bot.user and message.content.lower().startswith(response.lower()):
              await message.channel.send("")

What am I doing wrong DISCORD.PY BOT

quaint epoch
#

you can't send empty messages

lilac eagle
#

first one works

#

second one doesnt, trying to make it so it sends as a normal messgae and not a embeded

quaint epoch
#

when you loop through a dict, you loop through the keys

#

read a few docs on how to use dicts tho

#

yes

#

w/ what

#

what?

#

what?

#

is this internet slang im too old to understand?

#

what?

#

did you need help with a discord bot?

sick birch
#

Hey hey let’s keep it calm okay?

quaint epoch
#

what is even going on'

#

what?

sick birch
#

Please calm down and explain what the problem is

quaint epoch
#

if you need some help with discord bots, explain please

wheat heart
#

what's happening lol

quaint epoch
sick birch
#

If you explain what the problem is we would be glad to help you

sick birch
#

But without knowing what the problem is we can’t help

wheat heart
#

logic

quaint epoch
#

unless we telepathic

#

well, they're offline

#

this was strange

#

what even does that mean

#

what

wheat heart
#

calm down man