#discord-bots

1 messages · Page 765 of 1

maiden fable
#

Or was he?

sage otter
#

I hope he is.

slate swan
#

for the lucas part , yes
for the hikari part , no

sage otter
#

Understandable

maiden fable
#

I wish it was quite the opposite

slate swan
#

i like lucas' voice

sage otter
#

I don’t. Honestly if the people who are making hikari keep doing what they're doing it will be probably be better than dpy

maiden fable
#

True

#

Well, I'm kinda moving away from the bot making scene, soooo ain't learning hikari

cloud dawn
#

hikari's naming is so uwu

maiden fable
#

I bet the owner's a weeb

sage otter
#

Hikari isn’t as beginner friendly as dpy tho. Like I said it lacks many of the abstractions that dpy has.

cloud dawn
slate swan
#

hikari lover is typing...

#

well its developing fast
dav works on the hikari lib , lightbulb is maintained by thommo , tanjun by snab
and there are like 3 or 4 voice extensions

slate swan
#

like lavasnek-rs , songbird-py

waxen granite
#

@cloud dawnif url1 == self.url: this was needed . ty

slate swan
#

my purge command is not working for some reason it worked before

#
@bot.command()
@commands.has_permissions(manage_messages = True)
async def purge(ctx, ammmmount=int):
  await ctx.channel.purge(limit=ammmmount)
slate swan
# maiden fable Like?

ctx.guild -> ctx.get_guild() ( lightbulb)

Bot.get_user(id) -> GatewayBot.cache.get_user(id)

basically , the implementations are not too easy

sage otter
#

Imagine using lightbulb

#

Tanjun all the way babyyyyyy

slate swan
#

tf is lightbulb

sage otter
#

A commands framework

maiden fable
#

They are easy... We are just adapted to dpy

modern fiber
#

How can I make banned words event? So it deletes the message + returns a message when banned word is detected?

slate swan
maiden fable
sage otter
#

Hikari does stuff in a weird way as well.
In dpy Guild.members returns list[Member] while hikari's Guild.get_members returns a Mapping[Snowflake, hikari.Member]

maiden fable
slate swan
maiden fable
#

Tf

slate swan
sage otter
#

Ye.

spring flax
sage otter
#

Same thing as

slate swan
sage otter
#

Wot

slate swan
#

!d discord.abc.Snowflake

unkempt canyonBOT
#

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

Almost all [Discord models](https://discordpy.readthedocs.io/en/master/api.html#discord-api-models) meet this abstract base class.

If you want to create a snowflake on your own, consider using [`Object`](https://discordpy.readthedocs.io/en/master/api.html#discord.Object "discord.Object").
spring flax
#

What's action row

vale cedar
#

How to get an owner name in each server bot is in in cogs?

sage otter
#

A row of components

slate swan
unkempt canyonBOT
#

property owner: Optional[discord.member.Member]```
The member that owns the guild.
sage otter
#

[g.owner for g in Bot.guilds]

slate swan
#

Returns the owner of the server

sage otter
#

Ez money

slate swan
#

;-;

#

Welp

vale cedar
obsidian ledge
#

how do i make the bot delete the command after it has been sent/received

round widget
#

is it possible to use slash commands in cogs using disnake library?

spring flax
#

Of course

round widget
#

I'm trying real hard to figure out where I'm failing

round widget
#

could you link me to some example or docu?

spring flax
modern fiber
#

How do I get it to delete that message and return another message?

spring flax
#

What do you mean return another message?

modern fiber
#

Like print, "Your message was deleted bla bla bla"

slate swan
vale cedar
spring flax
#

Why purge?

#

!d discord.Message.delete

unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
modern fiber
spring flax
#

Yeah, purge is different, refers to bulk deleting messaging

slate swan
#

Or you can of course fetch it

modern fiber
#

Hold on, so what do I add now?

round widget
#

@slate swan am I doing this right

    async def pug(inter):
        await inter.response.send_message("Response")```
slate swan
slate swan
modern fiber
#

Tried that, says ctx isn't stated.

round widget
#

¸hmm ok

slate swan
spring flax
#

is it client or bot?

modern fiber
#

client

spring flax
#

you sent two screenshots, one with bot and one with client

#

how did you define client?

modern fiber
#

I know I fixed it lol

modern fiber
slate swan
#

client = ?

spring flax
#

did you do client = commands.Bot(...)

keen talon
slate swan
#

Lol

spring flax
slate swan
slate swan
slate swan
#

a client for making events
and a bot for making commands

keen talon
slate swan
#

seems a cool idea

spring flax
#

think about what?

slate swan
#

then i can run both instances together

keen talon
#

!pypi hikari

unkempt canyonBOT
slate swan
slate swan
slate swan
vale cedar
#

How to get all name of all member in each server is bot is in???

slate swan
#

some of them use bot , some of them use client
so i used both to make a best one

slate swan
slate swan
slate swan
unkempt canyonBOT
#

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

Misleading*

vale cedar
slate swan
round widget
#

@slate swan ah ok, the reason why my command didn't show up was because it was global. I've turned on debug mode and noticed "it might take up to 1 hour" message so I've just set it to local

modern fiber
round widget
#

now everything works

vale cedar
slate swan
slate swan
# slate swan Bad desc

the initial owner named it that way ig
`An opinionated, static typed Discord microframework for Python3 and asyncio that supports Discord's V8 REST API and Gateway.

Built on good intentions and the hope that it will be extendable and reusable, rather than an obstacle for future development.

Python 3.8, 3.9 and 3.10 are currently supported.` is the actual desc

slate swan
modern fiber
slate swan
#

I-

slate swan
#

!d discord.ext.commands.CommandOnCooldown

unkempt canyonBOT
#

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

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

yo can someone help me

spring flax
# modern fiber

do await message.delete() and await message.channel.send(...)

slate swan
#

on_message

#

if text in string

#

add reaction

sage otter
maiden fable
#

Damn

slate swan
sage otter
#

dav

slate swan
#

ah

#

well , hes cool 😳

sage otter
#

He knows his way. AMshrug

spring flax
modern fiber
#

sorry for maybe asking stupid shit, lol.

slate swan
spring flax
# modern fiber I am,

!resources Alright so....making a discord bot requires some basic understanding of python.
If you do have a basic understanding it'd be a lot easier for you and you would know somewhat what to do and how
So I suggest going over the resources page here

unkempt canyonBOT
#
Resources

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

modern fiber
#

smh

slate swan
#

hey i have this code but i get this error ```python
role_id = str(config['staffid'])
role = get(guild.roles, id=role_id)

```     role = get(guild.roles, id=role_id)
AttributeError: 'int' object has no attribute 'roles'```
modern fiber
#

event*

sage otter
#

I didn’t really read your code. I’m just addressing your error.

sage otter
spring flax
spring flax
fluid spindle
#

Hi, just wanted to tell you that I tried this again & it worked! Thanks!

slate swan
modern fiber
#

Oky, but how do I make it so it works when in message like "you are idiot" not just when u say "idiot"? @spring flax

slate swan
slate swan
slate swan
#

Sometimes

sage otter
#

Which it usually doesn’t. All of the bots guilds are chunked on startup.

#

Oh wait

#

That’s a role

slate swan
#

Code? And what you're trying to do?

#

you used Avatar/Icon/Banner .size somewhere?

sage otter
#

Same concept tho. Roles are cached as well. Guild.get_role() will always return something unless the role isn’t in that guild or doesn’t exist.

slate swan
#

many people just end up with only member intents lol

sage otter
#

either way, he shouldn’t use utils.get() if he already has an id

sage otter
#

You just grabbed an id from your config and assumed that is your guild object

#

grab the guild with
Bot.get_guild() and consider adding the changes I just mentioned earlier.

slate swan
#

what r u trying to do?

#

ah

#

use pfp.size where u used asset.size

#

same thing there too

#

replace asset with pfp

modern fiber
#

For some reason, my just broke. Doesn't respond on any commands + isn't showing any errors?

#

Huh.

#

Help?

sage otter
#

you overwritten your on_message event

#

So your bots no longer processing commands anymore

modern fiber
sage otter
#

Add await bot.process_commands(message)

modern fiber
#

Where exactly?

sage otter
#

Inside the on_message() event

#

Not inside your if block

modern fiber
#

Like this?

#

Doesn't seem to work.

sage otter
#

I just said not in the if block

modern fiber
#

AH

#

Okay, lol. Also, how can I add more words?

#

Should I use like
if "idiot;lasagna" in message.content:

#

Or?

sage otter
#

Using a list

#

Checking if any of the items in the list are in message.content

modern fiber
sage otter
#

You're telling me you don’t know how to make a list??

modern fiber
#

I don't know how to separate words

#

well I forgot

cold sonnet
shy elm
#

I'm trying to have a db with Mongodb using pymongo. Currently I'm trying to add a new field to a doc that's registered to that server but in my code I get '(' '[' and '{' not closed even tho they are. I'll send the code In a sec

cold sonnet
#

or an unoccupied help channel

slate swan
#

yo

#

guys

#

is there a way to start vc activity with discord.py

sage otter
#

!d discord.VoiceChannel.connect

unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.

This requires [`Intents.voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
modern fiber
#

Also await delete message doesn't work

cold sonnet
#

that's the indents

#

also, please learn using python

#

!resources with this

unkempt canyonBOT
#
Resources

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

modern fiber
modern fiber
#

Please.

cold sonnet
#

gotta learn the priorities

slate swan
unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
slate swan
#

Your first if statement is wrong.

#

When deleting a message you don't need to pass an argument such as 5.

#

If you want to delete the bot message after 5 seconds, use the following

await ctx.send(..., delete_after=5.0)
modern fiber
#

Oh okay

#

thank you @slate swan

slate swan
#

If you want to mention the member, you can simply use message.author.mention.

#

That should be everything you need ^^

modern fiber
#

Thanks bud.

#

I really appreciatte that.

slate swan
#

No problem :)

modern fiber
#

Not sure what's wrong ;-;

cloud dawn
slate swan
#

The last line is not correctly aligned with the if.

cloud dawn
#

I think i got it

slate swan
#
role = '934115503973203978'
@client.command()
@commands.has_permissions(administrator=True)
async def whitelist(ctx, user: discord.Member):
    roles = ctx.guild.get_role(role)
    await user.add_roles(roles)
    roleadd = discord.Embed(color=0x800080,
                            title=":Tick: Role Given!!",
                            description=f'''
**Whitelisted** {user.mention}

**Whitelisted By:** {ctx.author.mention}
    ''')
    roleadd.set_thumbnail(url=user.avatar_url)
    await ctx.send(embed=roleadd)
await user.add_roles(roles)

File "C:\Users\siyya\AppData\Roaming\Python\Python310\site-packages\discord\member.py", line 777, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
AttributeError: 'NoneType' object has no attribute 'id'

maiden fable
#

roles is None

slate swan
#

IDs are integers, not strings.

maiden fable
#

Ah good catch

modern fiber
cloud dawn
slate swan
cloud dawn
#

!indention

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

!indents

cloud dawn
#

ha

slate swan
#

Same as the return in the example above.

modern fiber
slate swan
#

It wasn't

#

There was 1 space too much

modern fiber
#

Nvm it wasn't, thanks man

#

time to test it all together

slate swan
#

Which you still have in that last screenshot by the way.

cloud dawn
# modern fiber

Also in the gamecode func why did you define embed and then again?

modern fiber
#

Ok well I have problem-

#

bot going crazy spamming it and deleting its own messages and mentioning himself

#

loop huh?

slate swan
#

You need to ignore bot users.

modern fiber
#

Ah,

slate swan
#

ctx.author.bot returns a boolean whether or not the author is a bot.

#

Simple if statement and then go for a return if it's true.

modern fiber
#

if ctx.author.bot = True
return

slate swan
#

You can remove the = True

modern fiber
#

or - Im sorry, Im still pretty new,

slate swan
#

Since it already returns a boolean

#
if ctx.author.bot:

would turn into

if True:
#or
if False:
#

So no need of a comparison.

cloud dawn
#

I highly recommend learning the basics of Python first before coding a Discord bot.

modern fiber
#

So how do I add an ignore part

cloud dawn
slate swan
#

Simple if statement as above, then return

cloud dawn
#

So we're asking these questions

Hey bro are you a bot? (yeah i am because ctx.author.bot is true):
Go back

modern fiber
#

Thanks bro lmao, thank you so much

#

Im dumb af

#

lol

slate swan
modern fiber
#

How should I define it

cloud dawn
modern fiber
#

Believe in me

quaint scaffold
slate swan
#

Lmao

modern fiber
#

cries in python

cloud dawn
quaint scaffold
#

Take a look at the documentation for on_message and see what attributes a discord.Message has

modern fiber
#

event?

slate swan
cloud dawn
modern fiber
#

Oh yeah- args

#

so uhh

slate swan
#

can someone help

modern fiber
#

..

cloud dawn
slate swan
#

that does not work

slate swan
modern fiber
quaint scaffold
#

Add py after the three backticks please

#

It's not syntax highlighted angy

cloud dawn
slate swan
#

pls help me with this

cloud dawn
#

Please don't bump messages.

modern fiber
slate swan
#

bump?

modern fiber
#

If Im smart I wouldnt be here

slate swan
#

That code.....is so cursed

quaint scaffold
#

Add py after the three backticks please
It's not syntax highlighted angy

cloud dawn
modern fiber
#

FINALYL

slate swan
#
@bot.event
async def on_member_join(ctx):
    embed=discord.Embed(title="{memmerrb} joined the server Make sure to say welcome in the chat")
  embed.set_image(url = "https://cdn.discordapp.com/attachments/929026308007161876/934116441328848946/ezgif-5-a319dff6e7.gif")

    await buttons.send(
        content = None,
        embed = embed,
        channel = ctx.channel.id,
        components = [
            ActionRow([
                Button(
                    style = ButtonType().Link,
                    label = "Grab Some Roles",
                    url = f"https://discord.com/channels/932909416481689620/933800545230131220"
                )
            ])
        ]
    )
#

there

#

Dan Dan

cloud dawn
slate swan
quaint scaffold
#

r. danny died :(

modern fiber
slate swan
slate swan
cloud dawn
quaint scaffold
#

Ah forgot this wasn't dpy

slate swan
#

Dpy server has it

#

after the backticks

#

!d discord.on_member_join || we dont have rdanny here

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.
slate swan
#

no

#

i addedd a button

quaint scaffold
#

Take a look at the args for on_member_join

slate swan
#

to redirect to take some roles

#

💀

modern fiber
#

well we got a problem

slate swan
#

oh

modern fiber
#

now it doesn't even look at if has shit, it deletes and returns a message to any message you send @cloud dawn

slate swan
#

yh i forgot

modern fiber
#

I literally said hi and it deleted

quaint scaffold
#

The way you declare the button gives me brain aneurysms

slate swan
#
@bot.event
async def on_member_join(member):
    embed=discord.Embed(title="{memmerrb} joined the server Make sure to say welcome in the chat")
  
  embed.set_image(url = "https://cdn.discordapp.com/attachments/929026308007161876/934116441328848946/ezgif-5-a319dff6e7.gif")

    await buttons.send(
        content = None,
        embed = embed,
        channel = ctx.channel.id,
        components = [
            ActionRow([
                Button(
                    style = ButtonType().Link,
                    label = "Grab Some Roles",
                    url = f"https://discord.com/channels/932909416481689620/933800545230131220"
                )
            ])
        ]
    )
quaint scaffold
#

Bro

slate swan
#

Replit-

modern fiber
slate swan
cloud dawn
quaint scaffold
#

Keyword: IndentationError

slate swan
#

i just shwed updated code

#

Dan Dan

quaint scaffold
#

Ashley Ashley

slate swan
#

Take some rest

#

16 hours shh

#

Sheesh

quaint scaffold
#

LOL

#

Sleep is for the weak

modern fiber
slate swan
#

i cant find the problem

cloud dawn
unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
cloud dawn
modern fiber
slate swan
modern fiber
#

Hm-

quaint scaffold
cloud dawn
quaint scaffold
#

I'd recommend opening up a help channel, there are many issues your code has

slate swan
#

and how do i do that

quaint scaffold
modern fiber
#

So like this?

#

@cloud dawn

quaint scaffold
#

No

cloud dawn
quaint scaffold
#

!e py print(bool('idiot'))

unkempt canyonBOT
#

@quaint scaffold :warning: Your eval job has completed with return code 0.

[No output]
quaint scaffold
#

hm

#

That returns True anyways

cloud dawn
#

!e ```py
print(bool('false'))

unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

True
cloud dawn
# modern fiber So like this?

!e ```py
message = "Hello you are looking good :D"

if "idiot" or "mf" in message:
print("The **** you say to me you little *****")

unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

The **** you say to me you little *****
honest vessel
#

has anyone done subclass to bot?

manic wing
#

how did you misspell shit

cloud dawn
manic wing
cloud dawn
manic wing
#

the fuck you say to me you little shit?

honest vessel
quaint scaffold
#

There are many words in the English language comprised of 5 characters

manic wing
modern fiber
quaint scaffold
#

It can be

honest vessel
#

anyway ```py
class anna(commands.Bot):
def init(self, *args, **kwargs):
super().init(command_prefix=commands.when_mentioned_or(command_prefix), *args, **kwargs)
self.uptime = int(round(time.time()))

#

dont mind indentations

manic wing
#

what is subclass to bot

#

what is a clas

modern fiber
#

@cloud dawn

@client.event
async def on_message(message):
    if message.author.bot:
        return

    if "idiot" or "mf" in message.content:
        await message.delete()

        await message.channel.send(f"Hey {message.author.mention}! Please refer using words like this one!", delete_after=5.0)
    await client.process_commands(message)```
#

So what I change?

quaint scaffold
#

Have you read anything we said?

#

Scroll up and read our answers to you

modern fiber
#

I did but I don't understand

#

what I did wrong

#

nvm lol

#

I found out haha

#
@client.event
async def on_message(message):
    if message.author.bot:
        return

    if any([word for word in message.content if word in ("mf", "idiot")]):
        await message.delete()

        await message.channel.send(f"Hey {message.author.mention}! Please refer using words like this one!", delete_after=5.0)
    await client.process_commands(message)```
#

So smart right? 🆒

#

is nobody gonna tell me im smart? smh

potent spear
#

good attempt

modern fiber
#

.

potent spear
#

users will always bypass censoring, but you can censor basic words, yeah...

honest vessel
#

@modern fibermaybe consider check message.content.lower()

quaint scaffold
#

^ and eventually once you get good enough you can use regex

honest vessel
#

cause IDIOT MF will work

#

😛

honest vessel
modern fiber
# honest vessel <@!655735547297529876>maybe consider check message.content.lower()

I know haha, Im smart

@client.event
async def on_message(message):
    if message.author.bot:
        return

    if words := [word for word in message.content.split() if word.lower() in ("mf", "idiot")]:
        await message.delete()

        await message.channel.send(f"Hey {message.author.mention}! Please refer using words like this: {''.join(words)}", delete_after=5.0)
    await client.process_commands(message)```
potent spear
#

not worth it, like bruh
this is an example of the regex of the n word
(?i)\bn[i1][bg]{1,2}[ae3][rs]?s?

quaint scaffold
# potent spear not worth it, like bruh this is an example of the regex of the n word `(?i)\bn[i...

Here's a better one: (?P<main>(?:(?:(?<!s)[n\U0001F1F3]+(?:(?P<_nc>.)(?P=_nc)*)?[i1!|l\U0001f1ee]+(?:(?P<_ic>.)(?P=_ic)*)?[g9\U0001F1EC](?:(?P<_gc>.)(?P=_gc)*)?)|(?:[k\U0001f1f0]+(?:(?P<_knc>.)(?P=_knc)*)?[n\U0001F1F3]+(?:(?P<_nnc>.)(?P=_nnc)*)?[e3€£ÉÈëeÊêËéE\U0001f1ea]+(?:(?P<_enc>.)(?P=_enc)*)?[e3€£ÉÈëeÊêËéE\U0001f1ea]+(?:(?P<_enc_>.)(?P=_enc_)*)?))[g9\U0001F1EC]+(?:(?P<_gc_>.)(?P=_gc_)*)?(?:[e3€£ÉÈëeÊêËéE\U0001f1ea]+(?:(?P<_ec>.)(?P=_ec)*)?[r\U0001F1F7]+|(?P<soft>[a\U0001F1E6])))((?:(?P<_rc>.)(?P=_rc)*)?[s5]+)?(?!rd)

honest vessel
#

gotta love the headache u get from regex 😄

waxen granite
#

i have a question. i am storing IP and port in a json file. i am fetching the names of the server from those ip and on what position/index they are in the json. how can i reverse the thing and get the server ip and port from its index or the name?

quaint scaffold
#

SQLite / Postgres is what most recommend

potent spear
#

you're clearly not using the json as a config (for it's intended purpose)

honest vessel
#

aiosqlite ❤️

#

simple and fast

quaint scaffold
#

It's good for beginners but lacks more advanced features

honest vessel
potent spear
#

for what it's worth, most beginners don't use the "advanced features"

honest vessel
#

INNER JOIN

#

UNION

#

nah they happy with basic Update select delete

potent spear
#

are those features not available in aisqlite?

#

is that advanced? lol

echo wasp
#

ctx.channel.send(embed = random.choice(begEM)) this right?

honest vessel
#

i mean most dosnt know sql at all, and just do simple select can be hard first time

#

"another language to learn FUCk i give up, i stay with json" 😛

potent spear
potent spear
honest vessel
#

@potent speari learned basic sql before json was even a thing 😄

round widget
#

any way to reloads cogs on the fly so I don't have to restart bot every time? Using disnake lib

honest vessel
#

php+mysql

potent spear
#

noice

honest vessel
#

webdevelop

honest vessel
#

unload and load

#

not sure if u can change the code and unload n load tho? (never tested so i dont know)

round widget
#

yeah that's what I'm interested in, update the code on the fly without restarting the bot

honest vessel
#

try it out?

round widget
#

will do for sure

honest vessel
#

let me know 😉

round widget
#

alright :D

honest vessel
#

that would be great when working with 1 cog only

echo wasp
slate swan
#

Code?

round widget
#

but i guess i'll make admin cog for (re/un)loading

echo wasp
potent spear
maiden fable
#

begEM is an embed

slate swan
potent spear
#

I said IF begEM is a list, which it isn't

potent spear
#

that's it

#

also, use a better variable name than list, it's reserved

#

call it embed_list or whatever

echo wasp
echo wasp
echo wasp
#

ok let me try it

vale root
#

Hey how can i make my bot say somthing when a key word is sent?

#

i cant remember for some reason

echo wasp
# potent spear Perfect

that worked now i just have this issue the variables to say an amount doesn't work how do i make it work

icy axle
#

hello guys i need help for discord.py
I did code on_message and now the commands do not work for me because of this, I tried to find a way to fix it but without success can anyone help me?

maiden fable
waxen granite
#

How do i get the list of perms the bot requires to execute a cmd?

frank tartan
#

can someone help me make a members command? like it shows the members of a specified role? also, shows the amount of people who have the role?

icy axle
# maiden fable `await bot.process_commands(message)` at the end of the on_message
@bot.event
async def on_message(message):
    if message.content == "test1":
        await message.channel.send("test1", reference=message)
    if message.content == "test2":
        await message.channel.send("test2", reference=message)
    if message.content == "test3":
        await message.channel.send("test3", reference=message)
    if message.content == "test4":
        await message.channel.send("test4", reference=message)
    if message.content == "test5":
        await message.channel.send("test5", reference=message)
        await bot.process_commands(message)
waxen granite
slate swan
#
    @bot.command(name="timer")
    async def countdown(self, ctx: commands.Context, number: int, reason: str):
        if number < 0:
            await ctx.send("Error: Input should be a number.")
        elif number > 7201:
            await ctx.send("Input must be under 7200 seconds")
        else:
            while number != 0:
                number -= 1
                await asyncio.sleep(1)
            await ctx.send(f"{reason}")

hey how do i make it so my bot actually takes all of the {reason} and not just the first word

icy axle
frank tartan
slate swan
#

so if i do the command
$timer 3 reason 1 2 3
it will only take "reason" as its paramter for the {reason}

waxen granite
waxen granite
#

How do i get the list of perms the bot requires to execute a cmd?

echo wasp
#

how do i random pick a number for the {earning} varible in the embed prob with random choice but better safe than sorry

#

between like 10 and 50

final iron
#

!d random.randint

unkempt canyonBOT
#

random.randint(a, b)```
Return a random integer *N* such that `a <= N <= b`. Alias for `randrange(a, b+1)`.
final iron
#

@echo wasp

final iron
echo wasp
final iron
unkempt canyonBOT
#

@final iron :white_check_mark: Your eval job has completed with return code 0.

6
echo wasp
#

thanks

#

and this will fit the earnings?

final iron
#

What do you mean?

shadow wraith
final iron
#

Randint chooses a number inbetween the 2 numbers you provided

shadow wraith
#

ye

final iron
#

If you need to change the range just change the numbers

shadow wraith
#

random.randint(<somenum>, <somenum>) is how it works i think

final iron
shadow wraith
#

yeah, but idk what he means by "earnings"

#

thought i knew what he means though

final iron
#

¯\_(ツ)_/¯

echo wasp
#

i need to be in the earnings slot

final iron
#

Use an f string

#

!f-strings

unkempt canyonBOT
#

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

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

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

echo wasp
#

oh i get it now

final iron
#

You just need to add an f at the beginning of your quotes

echo wasp
quick gust
#

what's wrong

echo wasp
#

thanks

quick gust
#
async def on_ready():
    print('we have logged in as {0.user}'.format(client))```
use f-strings instead
quick gust
final iron
quick gust
final iron
quick gust
#

"use f-strings instead"

final iron
#

Why not just provide an example of an f string

quick gust
#

I was just highlighting their code which should be changed...

quick gust
icy axle
quick gust
#

it works, but f-strings are better imo

echo wasp
quick gust
#

fair enough

quaint epoch
#

should i use API calls in the on_disconnect() event?

#

or should i avoid them like in the on_ready() event?

slate swan
slate swan
slate swan
modern fiber
#

Why this doesn't work?

slate swan
modern fiber
#

nvm I forgot comma

slate swan
slate swan
cloud dawn
#

main.py ```py
from disnake import Intents
from disnake.ext.commands import Bot

class SubClass(Bot):
def init(self, *args, **kwargs) -> None:
self.var = "Hello! I'm a bot variable!"

    super().__init__(*args, **kwargs)

@classmethod
def create(cls) -> "SubClass":
    """ Create and return an instance of a Bot """

    return cls(
        command_prefix="!",
        help_command=None,
        case_insensitive=True,
        owner_ids=[169790484594556928],
        intents=Intents.all()
    )

@staticmethod
def load_ext() -> None:
    bot.load_extension("cogs.acog")

async def on_ready(self) -> None:
    print(f"I ({self.user.name}) am ready to rumble")

bot = SubClass.create()

if name == "main":
bot.load_ext()
bot.run("input-token-here", reconnect=True)
cogs/acog.pypy
from disnake import Message
from disnake.ext.commands import Cog, Context, command

from main import SubClass

class Acog(Cog, name="Acog"):
def init(self, bot: SubClass) -> None:
self.bot = bot

@command(name="tell")
async def tell(self, ctx: Context) -> Message:
    return await ctx.send(self.bot.var)

def setup(bot: Acog) -> None:
""" Load the Acog cog """
bot.add_cog(Acog(bot))

slate swan
#

ew

#

you run the bot in the same file ew

slate swan
cloud dawn
slate swan
#

ew

#

make a main py and run it there

slate swan
sage otter
cloud dawn
#

This is my __main__.py

from socket import gethostname, gethostbyname
from os import system

from core import Dispy, config, logger

bot = Dispy.create()

if __name__ == '__main__':
    system('cls')
    logger.info(f"Starting bot for {gethostname()} at {gethostbyname(gethostname())}")
    bot.load_extensions()

    logger.info(f"Attempting to connect to Discord..")
    bot.run(config.bot.token, reconnect=True)

slate swan
#

Rip

slate swan
slate swan
#

ew

#

why learn classes and objects when u can just stackoverflow things

#
from NextGenbot import NextGen

if __name__ == "__main__":
    NextGen().run()

my main filespithink

sage otter
slate swan
#

Y'all seemingly use disnake

sage otter
#

I don’t.

#

I still use the main repo

slate swan
#

wuts this

from databases import Database
slate swan
sage otter
#

A library

slate swan
#

mhmm

#

Hikari lightbulb be like

#

ic

#

@unkempt canyon

#

Wait brb

#
import​ ​aiosqlite 
 ​from​ ​lightbulb​.​app​ ​import​ ​BotApp​, ​when_mentioned_or 
 ​from​ ​lightbulb​.​checks​ ​import​ ​bot_has_guild_permissions 
 ​from​ ​hikari​.​intents​ ​import​ ​Intents 
 ​from​ .​exts​ ​import​ ​initialise_databases​, ​PrefixHandler 
 ​from​ ​hikari​.​permissions​ ​import​ ​Permissions 
 ​from​ ​datetime​ ​import​ ​datetime 
  
  
 ​class​ ​Winky​(​BotApp​): 
 ​    ​def​ ​__init__​(​self​, ​token​): 
 ​        ​super​().​__init__​( 
 ​            ​token​=​token​, 
 ​            ​intents​=​Intents​.​ALL​, 
 ​            ​prefix​=​when_mentioned_or​(​PrefixHandler​.​prefix_getter​), 
 ​        ) 
 ​        ​initialise_databases​() 
 ​        ​self​.​boot_datetime​ ​=​ ​datetime​.​now​() 
 ​        ​self​.​load_extensions​(​"lightbulb.ext.filament.exts.superuser"​) 
 ​        ​self​.​load_extensions_from​(​"winky/plugins"​) 
 ​        ​self​.​check​( 
 ​            ​bot_has_guild_permissions​( 
 ​                ​Permissions​.​EMBED_LINKS​, 
 ​                ​Permissions​.​SEND_MESSAGES​, 
 ​                ​Permissions​.​ATTACH_FILES​, 
 ​                ​Permissions​.​READ_MESSAGE_HISTORY​, 
 ​            ) 
 ​        )
sage otter
#

I could make a hikari bot

#

But like meh

quick gust
slate swan
sage otter
# slate swan mhmm

It’s like a combination of sqlalchemy and aiosqlite at the same time

#

But just made easy and wrapped

slate swan
#

nice

sage otter
#

sqlalchemy kinda hot ngl.

slate swan
#

i wanna try hikari i just dont want to learn its syntax

slate swan
#

Imo , it's somehow easier than dpy with lightbulb

sage otter
#

just use lightbulb

slate swan
quick gust
sage otter
#

Or go hard mode and use tanjun. Tanjun is a lot harder compared to lightbulb.

#

It’s constant decorator chaining.

slate swan
#
#cog like stuff 

import lightbulb 

plugin = lightbulb.Plugin(name="okimi" , description = "learn hikari when")

def load(bot: lightbulb.BotApp)
    bot.add_plugin(plugin)
#

Even the slash Commands are too easy

#

!e
print("never")

unkempt canyonBOT
#

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

never
slate swan
#

!e print( 0 or "do it")

#

LMAO

unkempt canyonBOT
#

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

do it
slate swan
#

I'm used to jsk lol

slate swan
#

relatable

#

imagine using dpy and not Jishaku

#

cant be me

sage otter
#

Tanjun doesn’t do function signature parsing. All the arguments need to be made with a decorator

slate swan
#

Same goes for lightbulb

sage otter
#

it’s kinda nasty tbh

slate swan
#

Tanjun is a bit harder than lightbulb imo

sage otter
#

Ofc it is

#

The creator is probably some pyromaniac

slate swan
#

Imagine having your username "Faster Speeding" and not being a pyromaniacwhyyyyy

jaunty bear
#

!resources

unkempt canyonBOT
#
Resources

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

untold canyon
#

Hey, is there a way to delete that embed or just doesn't show it? I can delete it manualy because it's auto showing by discord. But i want bot to do it.

sage otter
#

I mean if your bot doesn’t have embed_links it won’t show up

slate swan
#

!discord webhook

untold canyon
sage otter
#

you're definitely misunderstanding.

untold canyon
sage otter
#

embed_links is the permission that allows for people to have discord automatically embed their link

forest beacon
#

I have two snippets of code. The first one works as expected so i mimicked it to create the second one and the print statiment doesnt work. Any help?

@commands.Cog.listener()
    async def on_ready(self):
        '''Prints ready message in terminal upon bot connection as well as setting rich presence'''
        print('Bot is online')
        await self.bot.change_presence(
            activity=discord.Activity(type=discord.ActivityType.listening,
            name=' to your request | ..help')
        )```
```py
@commands.Cog.listener()
    async def on_member_join(self, member):
        print(f'{member} has joined the server')```
sage otter
#

So for example if your bot didn’t have that. Discord wouldn’t of embedded it for you.

slate swan
untold canyon
slate swan
#
<https://welp.com/>
untold canyon
#

i now how i works but didn't fought of it

#

so thanks

slate swan
sage otter
#

I didn’t know that existed either 🤷‍♂️

untold canyon
slate swan
quaint epoch
forest beacon
#

Trying to make a try except. How do i address discord.ext.commands.MissingRequiredArgument?

quaint epoch
slate swan
#

use

isinstance()
#

oh nvm

forest beacon
#

Yes @quaint epoch

slate swan
#

you want it to handle that exception

#
except discord.ext.commands.MissingRequiredArgument:
#

iirc

quaint epoch
slate swan
#

depends

quaint epoch
#

instead of putting try/except in every command

forest beacon
quaint epoch
#

bc if you have to put it in every command it's just better to use the on_command_error event

slate swan
#

!indents

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

forest beacon
quick gust
#

You can't check a user's connections with dpy can you?

forest beacon
slate swan
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

forest beacon
#

How would that translate to being used in a cog? Do i set up the bot line again?

slate swan
#

no in your bot file

forest beacon
#

well darn. Was trying to have that within a cog for basic things like ping lol

modern fiber
#

Guys how can I make it so it deletes if someone spams

slate swan
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
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.

Examples

Deleting bot’s messages...
hoary cargo
#

eh

flint widget
#

What library are people using now instead of discord.py?

oblique cobalt
flint widget
#

Okay, I'll take a look into those
Was just curious as I've taken a long break from making bots and wondered if there was a fork/alternative that was most commonly used now

manic wing
#

everyone uses disnake

frank tartan
#

how can i get the guild icon/logo url?

oblique cobalt
flint widget
oblique cobalt
frank tartan
oblique cobalt
#

as far as i remember its guild.icon.url, let me check docs

slate swan
#

i use disnake but hikari is better tbh

slate swan
#

Welp

frank tartan
#

it doesnt work

#

i get the error guild isnt defined

slate swan
#

Ikrr

oblique cobalt
slate swan
#

!d discord.Guild.icon

unkempt canyonBOT
#

property icon: Optional[discord.asset.Asset]```
Returns the guild’s icon asset, if available.
oblique cobalt
frank tartan
oblique cobalt
#

the ctx

frank tartan
slate swan
frank tartan
#

yes

oblique cobalt
slate swan
oblique cobalt
#

man just copy pasted directly

slate swan
#

crazy how people dont know that ctx is context

flint widget
frank tartan
oblique cobalt
slate swan
unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

slate swan
#

coughs

oblique cobalt
#

bru

slate swan
#

and you wont make danny mad for using a fork

oblique cobalt
#

why even change ? dpy is usable as long as Gateway version 6 (if that is what dpy uses) and HTTP API version 8 isnt removed lmao

slate swan
#

you really havent seen internals

oblique cobalt
slate swan
#

Mostly because people want to use slash commands and upcoming form/user input methods without needing to install an add-on library for that.

#

hikari is just way cleaner compared to others

slate swan
oblique cobalt
slate swan
#

other wrappers will just takeover thats all

oblique cobalt
slate swan
#

At some point it will; at least not if they find another maintainer.

slate swan
slate swan
#

forks are just ctrl c ctrl v

slate swan
oblique cobalt
#

i dont really care much about it being maintained or anything like that, just as long as it is usable, which dpy will be for while now

slate swan
#

Not really no

#

Even if you edit a fork, it will still stay a fork

#

yes they do have new stuff but most forks connect the same way

oblique cobalt
#

same

slate swan
#

disnake is a fork and will always be, as long as they don't make the library from scratch.

slate swan
slate swan
#

A fork is just to make some changes that you'd like to see in the actual library.

#

some people are tired of trash forks

#

But keeping the base of that library.

#

i.e andy

#

Ouch, panda's lecturess

slate swan
#

And personally I hate using forks.

slate swan
slate swan
#

i want to switch but im to lazy😔

slate swan
slate swan
flint widget
#

Yeah, I guess in this case though if no one is allowed to take over the original repo then a fork is the closest thing to someone maintaining the original 🤔

slate swan
#

danny could revive dpy but he wont

#

i doubt he will comeback

flint widget
#

Yeah I read the whole post and that was deeeep, so it seems pretty unlikely

frail notch
#

hoi... how can i fix this..? when I do !scrape it doesn't get the user ID's...

import discum
bot = discum.Client(token='bot token', log=False)

def close_after_fetching(resp, guild_id):
    if bot.gateway.finishedMemberFetching(guild_id):
        lenmembersfetched = len(bot.gateway.session.guild(guild_id).members) #this line is optional
        print(str(lenmembersfetched)+' members fetched') #this line is optional
        bot.gateway.removeCommand({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
        bot.gateway.close()

def get_members(guild_id, channel_id):
    bot.gateway.fetchMembers(guild_id, channel_id, keep="all", wait=1) #get all user attributes, wait 1 second between requests
    bot.gateway.command({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
    bot.gateway.run()
    bot.gateway.resetSession() #saves 10 seconds when gateway is run again
    return bot.gateway.session.guild(guild_id).members

@bot.gateway.command
def helloworld(resp):
    if resp.event.ready_supplemental: #ready_supplemental is sent after ready
        user = bot.gateway.session.user
        print("Logged in as {}#{}".format(user['username'], user['discriminator']))
    if resp.event.message:
        m = resp.parsed.auto()
        #print(m['content'])


        if m['content'] == "!scrape":
            #print("1")
            guildID = m['guild_id'] if 'guild_id' in m else None #because DMs are technically channels too
            channelID = m['channel_id']
            userids = get_members(guildID, channelID) 
            print(guildID)   
            print(userids)    

            #with open("users.txt", "w") as userfile:
            #    userfile.write(userids)

bot.gateway.run(auto_reconnect=True)
oblique cobalt
#

there is module named discum ? what

slate swan
#

My my, that import name

unkempt canyonBOT
#

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

final iron
#

Please leave.

frail notch
#

whats inapropriate or against the law or anything here

final iron
#

It's selfbotting

slate swan
frail notch
#

what...

slate swan
#

against tos

final iron
frail notch
#

bro every time i ask help I get profiled for self botting

oblique cobalt
slate swan
slate swan
frail notch
#

legit can u not get a bit of help like what the hell

frail notch
slate swan
#

!pypi disnake ❤️

unkempt canyonBOT
final iron
#

You're making a self bot

slate swan
#

use a fork that actually is for bots

final iron
frail notch
#

A bot which registers all user's id's for the members cuz im working on a larger bot which uses oauth2 but needs the user id's in order to know the servers in common

#

like jesus mfing christ

final iron
frail notch
#

wdym

final iron
#

Look, I'm just going to ping mods eventually

slate swan
frail notch
#

bru

#

im out of here man

slate swan
final iron
#

That's your choice

slate swan
#

hi korta

untold token
untold token
#

Although its still in alpha so

slate swan
#

yeah

untold token
#

They are working on it

#

Although I absolutely love you can use plugins system with hikari

#

Very cool

slate swan
#

yes indeed

flint widget
#

I guess I'll use disnake for now since it's so close to what I was using before, and then I'll keep an eye on hikari because it could be interesting

slate swan
#

Pincer actually looks more interesting than Hikari

#

pincer has way better presentation

#

Heard of Hikari some time ago and hasn't really moved away from the alpha stage as far as I know.

#

yeah both pincer and hikari look good

frank tartan
#

i have totally forgoten how to do this, so i feel dumb rn... but how do I send a message in a specified channel?

slate swan
#

channel.send

#

you get the channel lol

#

channel should be a TextChannel object

frank tartan
#

i dont use disnake

manic wing
#

!d disnake.abc.Messageable.send ||

unkempt canyonBOT
#
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://docs.disnake.dev/en/latest/api.html#disnake.File "disnake.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://docs.disnake.dev/en/latest/api.html#disnake.File "disnake.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed "disnake.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed "disnake.Embed") objects. **Specifying both parameters will lead to an exception**.
manic wing
slate swan
#

you can grab a specific channel using utils.get

fresh orchid
#

is there a function like asyncio.sleep that wont stop all the code?

slate swan
#

provided you already have a Guild object

frank tartan
manic wing
fresh orchid
#

but when I use asyncio.sleep it stops all the code after it too

#

or maybe im just lost

manic wing
#

what do you want to stop

slate swan
slate swan
#

¯_(ツ)_/¯

fresh orchid
# manic wing what do you want to stop

I want to give someone a role and send a message

But before this happens the bot should send a embed with the actual embed
I made it with many if statements maybe thats the problem

and I managed to solve the problem but I think it work better with something like asyncio.sleep

#

I can send the code if you want

slate swan
#

yes, send it.

#

use the pydis paste service

#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

slate swan
#

how would i go on to stop a bot on something like a timer, lets say i told the bot to make a timer, but i want it now to stop & clear the timer. (pls ping when replying to me)

fresh orchid
#

It should just send the embed first and then add the role

I need it because when I dont send the embed first it will use the❌ everytime

slate swan
#

wdym sniper bot?

final iron
#

If it can tell a bot token is valid it will delete it

final iron
#

I'm assuming he wants this except for crypto and it saves it instead of just deleting it

slate swan
#

he's talking about crypto

final iron
#

Which is pretty inappropriate

slate swan
#

no water that's really uh.. not how crypto works

final iron
#

I was assuming it was for account passwords and shit

#

I agree, I have no idea how crypto works

slate swan
#

look, regardless

#

this isn't the place to ask about that, I'm unsure myself of how legal that is

#

take your questions somewhere else

astral vector
#

out of context but is it possible to take a command name from a database?

final iron
#

If it's in the database you can fetch it

astral vector
#

yeah that's what i was thinking too i'll make something for user made custom commands

analog barn
#

Hey! I'm trying to make my discord bot send a message in a channel ever n seconds (i chose 15) because it's supposed to be a type racer game.

#

however, I cannot get it to work.

#
@tasks.loop(seconds=15)
@ethan.event
async def type(message):
    channel = ethan.get_channel(934185379790213190)
    
    import random
    from essential_generators import DocumentGenerator
    gen = DocumentGenerator()

    starttime = time.time()
    answer = gen.sentence()
    timer = 10.0
    await channel.send(f"You have {timer} seconds to type: \n\n `{answer}`")

    def is_correct(msg):
        return msg.author==message.author

    try:
        guess = await ethan.wait_for('message', check=is_correct, timeout=timer)
    except asyncio.TimeoutError:
        embed=discord.Embed(title="Ran out of time! >:)", description="Have you ever tried getting good at actually typing? Here is what you can do to win:", color=0x109319)


#
        embed.add_field(name="Tip 1:", value="Type the message exactly as provided. If you've left out punctuation, you will fail.", inline=False) 
        embed.add_field(name="Tip 2:", value="Don't Panic, if you panic, you'll most likely get it wrong", inline=True)
        embed.add_field(name="Tip 3:", value="Be patient, don't rush the sentance or you will most likely fail.", inline=True)

        embed.set_footer(text="Type racer game provided by Ethan Pelletier.")
        return await channel.send(embed=embed)
        # ctx.send("You took too long :(")

    if guess.content == answer:
        embed=discord.Embed(title="You Won! :DDD", description="Everyone who competed against you are complete losers.", color=0x109319)
        fintime = time.time()
        total = fintime - starttime
        embed.add_field(name=f"{message.author.display_name} is the winner!", value="ahahaahahha this guy is a no life", inline=False)
        embed.add_field(name=f"{message.author.display_name} typed out the message in a total of {round(total)} seconds.", value=":]", inline=False)  

        embed.set_footer(text="Type racer game provided by Ethan Pelletier.")
        await channel.send(embed=embed)

    else:
        embed=discord.Embed(title="You lost! >:)", description="Have you ever tried getting good at actually typing? Here is what you can do to win:", color=0x109319)
        embed.add_field(name=f"{message.author.display_name} is the loser!", value="ahahaahahha get good", inline=False) 
        embed.add_field(name="Tip 1:", value="Type the message exactly as provided. If you've left out punctuation, you will fail.", inline=False) 
        embed.add_field(name="Tip 2:", value="Don't Panic, if you panic, you'll most likely get it wrong", inline=True)
        embed.add_field(name="Tip 3:", value="Be patient, don't rush the sentance or you will most likely fail.", inline=True)


#

        embed.set_footer(text="Type racer game provided by Ethan Pelletier.")
        await channel.send(embed=embed)
        
        @type.before_loop
        async def before_type():
          await ethan.wait_until_ready()

        type.start()
        ethan.run(token)
#

I have to run the function outside of the function, but I also need to get the author's message to access the author name and such

#

I cannot define message when I'm calling the function from outside as message is supposed to get the discord user's message and you're not supposed to predefine it.

#

any help? haha

#

(don't worry about the name in the code, that information is very public and I don't mind)

velvet tinsel
#

why are you importing modules inside your task pithink

analog barn
#

i was testing

velvet tinsel
#

ok

analog barn
#

i didnt wana scroll all the way up and down

#

soo

#

its fixed now dw

velvet tinsel
#

ok

analog barn
#

yall able to help-?

velvet tinsel
#

I thought you fixed it

slate swan
velvet tinsel
#

ok

hoary cargo
#

hmmnote Can you make a button to be pressed just by member member being the person you @ for the command on the old commands you could do this stuff with try except and wait_for , though i'm not sure if you can with slash commands and inter check
edit : it's possible

gentle badger
#

How do i do a HELP ME command

#

?

final iron
velvet tinsel
#

!d discord.ext.commands.Bot you can do help_command=None in there

unkempt canyonBOT
#

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

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

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

It's possible to get all users in a particular voice channel and return user objects for each correct?

slate swan
#

Yes, a voice channel has a members attribute that returns a list of Member objects.

gentle badger
final iron
ebon island
#

Terrific, exactly as I expected 🙂

gentle badger
#

@final iron

final iron
gentle badger
#

I write the code, but people will use the command not the code

#

1 server

#

@final iron

final iron
#

If it fits your purposes make the button exclusive to the person who ran the command

gentle badger
#

No, the button is for staff only

#

@final iron

final iron
#

Then make it exclusive to staff members only

gentle badger
#

Well, can you write me the code?

final iron
#

No

#

I'm not going to write you code

gentle badger
#

OK

#

But why?

slow fog
final iron
vale cedar
#
mem = (self.bot.get_guild(guild.id).members)
``` It show full information of members how to set up it for just show the name of the member?
final iron
unkempt canyonBOT
#

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

Loop through the list or getting the name?

vale cedar
final iron
#

Its not a yes or no question

#

Which one of those options are you confused with?

vale cedar
#

get the name

final iron
#

It would be like getting the name normally where i is your member object

vale cedar
#

yes

final iron
velvet tinsel
#

no

final iron
slate swan
unkempt canyonBOT
#

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

001 | 1
002 | 2
003 | 3
004 | 4
005 | 5
006 | 6
007 | 7
008 | 8
009 | 9
010 | 10
slate swan
#

!e

a = ["CAPS","LOCK"]
for b in a:
    print(b.lower())
unkempt canyonBOT
#

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

001 | caps
002 | lock
slate swan
#

see^pithink

vale cedar
#

ok tks

slate swan
slate swan
final iron
#

Whats the rate limit on editing messages?

slate swan
#

i think its 5/5s

#

im not sure

final iron
#

Isn't that kinda low?

slate swan
#

not really

slate swan
outer violet
#

I have a serverinfo command and when I tried it, it gave me this error. If anyone here knows anything about hikari-lightbulb please help me


@plugin.command
@lightbulb.command(name="serverinfo", aliases=['server', 'si'], description="Displays info about the server")
@lightbulb.implements(lightbulb.PrefixCommand, lightbulb.SlashCommand)
async def cmd_guild_info(ctx: lightbulb.Context) -> None:
    guild = await ctx.bot.d.redis_cache.get_guild(ctx.guild_id)
    ms = guild.get_members()
    cs = guild.get_channels()
    guild_id = guild.id

    await ctx.respond(
        f"Created at: <t:{int(guild.created_at.timestamp())}:f>\n"
        f"Owner: `{ctx.bot.cache.get_member(guild_id, guild.owner_id).display_name}`\n"
        f"Verify level: `{str(guild.verification_level).title()}`\n"
        f"ID: `{guild_id}`\nEmojis: `{len(guild.get_emojis())}`\nRoles: `{len(guild.get_roles())}`\n\n"
        f"**Members**\nTotal: `{len(ms)}`\nHumans: `{len([m for m in ms.values() if not m.is_bot])}`\n"
        f"Bots: `{len([m for m in ms.values() if m.is_bot])}`\n\n"
        f"**Channels**\nVoice: `{len([c for c in cs.values() if c.type == hikari.ChannelType.GUILD_VOICE])}`\n"
        f"NSFW: `{len([c for c in cs.values() if c.is_nsfw])}`\n"
        f"Text: `{len([c for c in cs.values() if c.type == hikari.ChannelType.GUILD_TEXT])}`"
    )```
native wedge
#

how do i transfer from replit to vscode i cant leave replit help

final iron
#

Not sure if there is an option to download the files

slate swan
final iron
#

Ayo okimii

slate swan
#

huh

native wedge
#

should i use cogs for each command? or category of commands

final iron
#

When you think of ram what do you think of?

dapper grotto
#

is there a channel to talk about trading bots?

native wedge
final iron
#

Because I got this command

slate swan
slate swan
final iron
#

But most people don't know how to recognize a dimm

slate swan
final iron
slate swan
native wedge
slate swan
#

how many hz

final iron
#

Well it would be mhz

slate swan
#

yes

final iron
#

Because if we're talking in hz it would be a very large number

slate swan
#

how many

final iron
#

3000mhz

#

1500 mt/s

slate swan
#

3200mhz😩

slate swan
final iron
#

I have docp enabled

slate swan
#

good