#discord-bots

1 messages ยท Page 539 of 1

slate swan
#

That's advertising

lethal heart
#

Hi

naive parcel
#

nope

#

i didnt say to add the bot

slate swan
#

Motor

naive parcel
#

i could have easily sent the code here but its big

tawdry perch
#

which method would you recommend?

slate swan
#

Minecraft

naive parcel
#

you can do some pull requests too to do some additions and u will be creddited

#

๐Ÿ™‚

slate swan
#

pymongo is sync

#

that's why i said to use motor, motor is an asynchronous wrapper for pymongo

naive parcel
#

this place is shit tbh

tawdry perch
#

and, which method would you recommend for accessing collections?

slate swan
#

eh, up2u, there's no difference in speed between those methods

tawdry perch
#

oh, good to know. My bot never went online for some reason..

boreal ravine
#

hm

tawdry perch
#
worker: python __main__.py
``` so if this runs that file, to run my bot. Then I can't make it work
slate swan
#

as well as toggled the dynos

tawdry perch
#
if __name__ == '__main__':
    setup()
    extensions = []
    for extension in extensions:
        bot.load_extension(extension)
    bot.run(TOKEN)
``` the problem is, my bot is a whole module. Only way to run it is `python -m MyBot` and `python __main__.py` will never work.
slate swan
#

why not keep it as a module, make a main.py or bot.py or run.py or smth like that in outside it, and then do python main.py or python bot.py or whatever

tawdry perch
#

hmm so I create a new file to run a module?

slate swan
#

yes

tawdry perch
#

and sorry for all these pings and wasting your time, Pretty sure I won't do it for now on.

slate swan
#

it's alr

hollow crown
#
@client.check
def blacklist_check(ctx):
  blacklisted = {'778662114663071765', '795030779264237599'}
  if [int(ctx.author.id)] in blacklisted:
    return

can I get help with my blacklist command

tawdry perch
hollow crown
slate swan
#

And just do if ctx.author.id...

#

And save the IDs as integers in your list

hollow crown
slate swan
#

Save as integer 3HC_waitwhat

#

Instead of string

hollow crown
#

ok ok

#

int to str right?

slate swan
#

Just remove the '

hollow crown
slate swan
#
"12"/'12' -> that's a string
12 -> that's an integer
tough mesa
#

is it possible to have a command that takes in a sentence as an argument???
e.g. $warn @Joshalot#1023 "for being cringe"

slate swan
#

Yes

tough mesa
#

how would one do that? haha

tough mesa
#

Thank you!

hollow crown
#
@client.check
def blacklist_check(ctx):
  blacklisted = [778662114663071765, 795030779264237599]
  if ctx.author.id in blacklisted:
    return
#

but still I am getting The global check functions for command help failed. <class 'discord.ext.commands.errors.CheckFailure'> error

visual yarrow
#

@naive parcel Are you looking for feedback on your project? ๐Ÿ™‚

naive parcel
#

yes

#

please

hollow crown
slate swan
#

So return false if it's in the list

slate swan
hollow crown
#

yes

slate swan
#

Then you should consider learning it more

hollow crown
#

I am knowing but I couldnt remember the name of it

slate swan
#

Not knowing what a boolean, string, etc. is, means you didn't really learned the basics

hollow crown
#

I thought boolean as boole

#

I figured it out

#

let me fix it

visual yarrow
# naive parcel yes

Alright. If you're just looking for feedback or ideas or whatever, I think it's fine to ask for that here ๐Ÿ‘

#

Although this probably isn't a good place to look for longer-term contributors to a project.

tawdry perch
#

There seems to be some kind of problem where run.py can't run the MyBot. https://github.com/Nipa-Code/testbot
If someone would like to take a look at it. When I run the run.py nothing happens, not even printing anything from __main__.py file, nor any logs from logging.

near oyster
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

vocal plover
tawdry perch
#

so it won't run __main__.py?

#

how can I make it to run?

vocal plover
#

no because as mentioned it calls __init__.py

#

you can run python3 -m MyBot instead of python3 run.py

tawdry perch
#

but, I need another file to run the MyBot

vocal plover
#

or in your case with heroku, worker: python -m MyBot

tawdry perch
#

._. I was told that won't work

vocal plover
#

did you try it?

zenith zinc
#

hii

tawdry perch
#

yes, once

#

I could re try it.

tawdry perch
slate swan
#

How do I make this

boreal ravine
slate swan
#

But idk what that is called

muted zodiac
#

how do i send a msg to a specific channel ?

tawdry perch
#

get channel and then channel.send("anything")

boreal ravine
#

wtf

boreal ravine
#

hmm

slate swan
visual island
#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
visual island
#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
boreal ravine
#

ty

visual island
boreal ravine
#

the class for it

slate swan
#

Thanks

tawdry perch
near oyster
#

!d discord

unkempt canyonBOT
#

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

Creating a Bot account is a pretty straightforward process.

tawdry perch
#

!d discord.Member @near oyster if you were looking for this

unkempt canyonBOT
#

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

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the memberโ€™s hash.

str(x) Returns the memberโ€™s name with the discriminator.
near oyster
#

!d discord.Member.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

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

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

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
slate swan
#
import time

seconds = 300
while True:
  seconds -= 1
  m, s = divmod(seconds, 60)
  if m == 5:
    print('5 minutes')
    break
  elif m == 0:
    print(f'{s} seconds')
  else:
    print(f'{m} minutes {s} seconds')
  time.sleep(1)

At the end of 5 minutes, it moves to a negative number.
Is it possible to automatically start counting again after 5 minutes?

velvet tinsel
#

Guys

#

Help me pls

boreal ravine
slate swan
slate swan
#

To answer your question, yes, it's possible, very easy, by using your python knowledge lemon_starstruck

velvet tinsel
slate swan
#

Simply give it administrator and put it above the bot's role

velvet tinsel
#

Hmm

velvet tinsel
#

But people without mods can be able to access it

boreal ravine
velvet tinsel
#

And the mods

slate swan
#

Then put the bot role above the mod role

boreal ravine
#

add a check I guess

boreal ravine
slate swan
#

Ahh

#

i forgot to tell yall thx for yall help

velvet tinsel
#

Iโ€™ve read through the code on @unkempt canyon , thereโ€™s something that looks similar

slate swan
#

Then use @commands.has_role(role_id)

velvet tinsel
#

To perms

velvet tinsel
gentle tulip
#

How to make the bot online

boreal ravine
#

!d discord.ext.commands.has_role

#

if you want multiple roles

gentle tulip
#

!d help

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
slate swan
velvet tinsel
boreal ravine
#

use discord.ext.commands.has_any_roles()

velvet tinsel
boreal ravine
slate swan
boreal ravine
slate swan
gentle tulip
#

Then how to make a music bot

slate swan
#

Besides self-hosting

gentle tulip
#

Is there a code?

slate swan
#

You use your knowledge

#

someone does !ytdl

gentle tulip
slate swan
#

You have an example in dpy's repo

slate swan
#

^^^^

#

^

gentle tulip
#

.........

#

Wow

slate swan
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
slate swan
#

lmao knew it

#

It was coming

gentle tulip
#

!join.channel

slate swan
slate swan
#

also 15 sec just to write "!ytdl"?

#

nah, I started to write something else

#

Ikr kinda disappointing

#

then deleted it

velvet tinsel
slate swan
#

#bot-commands

boreal ravine
velvet tinsel
#

Wait how to do what python just did with the cool colour symbol

slate swan
boreal ravine
slate swan
#

And we won't help for that

boreal ravine
velvet tinsel
#

Online I took that as forever

boreal ravine
#

what

velvet tinsel
#

Let me do that again

boreal ravine
#

ok

velvet tinsel
#

There

boreal ravine
#

what symbol

velvet tinsel
#

Text

boreal ravine
#

the reaction?

slate swan
#

its a embed

velvet tinsel
#

No

boreal ravine
unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if itโ€™s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
velvet tinsel
#

The text

boreal ravine
#

an embed isnt a symbol

slate swan
#

i got my code to ping roles thx to yall thx

#

it's just a bold text

velvet tinsel
#

Ok

slate swan
#

The text being random?

velvet tinsel
#

Thx

slate swan
#

**hello**

boreal ravine
slate swan
#

Oh

#

Alr

velvet tinsel
velvet tinsel
#

Ok

slate swan
#

Well in that case, yes you can.

#

As we are not allowed to help for ytdl stuff.

boreal ravine
#

hm

slate swan
#

So it's RTFM and nothing more

#

or google

#

The example is more than enough

#

Not for newbies

#

ยฏ\_(ใƒ„)_/ยฏ

boreal ravine
#

ยฏ_(ใƒ„)_/ยฏ

boreal ravine
slate swan
#

I'm on mobile

gentle tulip
#

How to add those code to the bot

slate swan
#

I'm not typing fast

gentle tulip
#

I forgot

boreal ravine
gentle tulip
boreal ravine
slate swan
gentle tulip
boreal ravine
gentle tulip
#

I said how to add code to the application

#

Whatโ€™s the matter @slate swan

slate swan
#

Yeah, all you have to do is copy paste it

boreal ravine
slate swan
#

KEK

velvet tinsel
#

Wow

gentle tulip
slate swan
#

Oh-

#

My apologies

gentle tulip
#

......

#

Fine

boreal ravine
slate swan
#

learn how to make a file โŒ
start dpy bot โœ…

velvet tinsel
slate swan
#

sorry, but wtf?

velvet tinsel
#

Youโ€™d wanna use pip install

vocal plover
gentle tulip
slate swan
vocal plover
#

i mean

gentle tulip
vocal plover
#

evidently not

#

the discord api doesnt just lie for fun

slate swan
boreal ravine
slate swan
#

You added all the text_channels

gentle tulip
slate swan
#

Which returns an entire list of channels

gentle tulip
#

Apps

boreal ravine
slate swan
#

And that is??

gentle tulip
#

Bot then

slate swan
#

a folder containing code files

vocal plover
#

@slate swan i assume you wanted the count of channels, which would be len(guild.text_channels)

slate swan
#

I take my apologies back ๐Ÿ˜‚

#

Having a few channels is already enough to get over 1024 characters as you give all the channels

gentle tulip
boreal ravine
gentle tulip
boreal ravine
slate swan
#

^

gentle tulip
slate swan
#

No not you...

harsh cradle
#

i have leveling system and my problem is it should level me up and send me congrats message but it keeps gain xp as you can see in photo and keeps gain and the goal is 1.97k exp but he keeps gain to 2.01k why?

boreal ravine
gentle tulip
slate swan
#
@client.command()
async def invites(ctx):
    totalInvites = 0
    for i in await ctx.guild.invites():
        if i.inviter == ctx.author:
            totalInvites += i.uses
    embed = discord.Embed(title="MCity Bot - Invites",
                          description=f"Invitao si {totalInvites} membera",
                          color = 0x3498db)
    await ctx.send(embed=embed)

how can i track fake invites for this code?

boreal ravine
slate swan
velvet tinsel
#

Is there any way for a discord bot to DM other people?

gentle tulip
#

Nice

#

He is

slate swan
#

๐Ÿ˜‚

slate swan
boreal ravine
#

!d discord.Member.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

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

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

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
gentle tulip
harsh cradle
# slate swan Without code we can't help, giving a picture doesn't help us at all
@commands.Cog.listener()
    async def on_message(self, message: discord.Message):
        if message.channel.id != 898662705228029972:
            return

        if message.author.bot is True or message.guild is None:
            return
        
        result = await self.find_or_insert_user(message.author)

        user_id, guild_id, xp, level = result
        print(xp, level)

        xp += random.randint(0, 25)
        
        if self.calculate_level(xp) > level:
            level += 1
            # 1,000
            await message.channel.send(f"Congratulations, {message.author.mention} You are levelled up to {level:,}.")

        cursor = await self.db.cursor()
        await cursor.execute('Update users set xp=?, level=? where user_id=? and guild_id=?', (xp, level, user_id, guild_id))
        await self.db.commit()
velvet tinsel
#

Tysm

slate swan
# gentle tulip Bot then

Anyways to answer your question, you'll need to install ffmpeg and youtube_dl from pip, some additional files but can't tell u which because !ytdl, and to add it to your code copy paste the code in your file

harsh cradle
slate swan
#

Omg

#
import time

seconds = 300
while True:
  seconds -= 1
  m, s = divmod(seconds, 60)
  if s == 0 and m == 0:
    print('5 minutes passed, restarting the loop')
    seconds = 300
  elif m == 0:
    print(f'{s} seconds')
  else:
    print(f'{m} minutes {s} seconds')
  time.sleep(1)
#

it was really that hard

near oyster
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

near oyster
#

!codefill

near oyster
#

my code is not coming in one msg

#

wat shud i do?

boreal ravine
boreal ravine
near oyster
#

yes

#

my code block
isnt coming in 1 msg
its more than 2000 chars

harsh cradle
#

i have leveling system and my problem is it should level me up and send me congrats message but it keeps gain xp as you can see in photo and keeps gain and the goal is 1.97k exp but he keeps gain to 2.01k why?

covert igloo
#

Show ur code?

harsh cradle
# covert igloo Show ur code?
    @commands.Cog.listener()
    async def on_message(self, message: discord.Message):
        if message.channel.id != 898662705228029972:
            return

        if message.author.bot is True or message.guild is None:
            return
        
        result = await self.find_or_insert_user(message.author)

        user_id, guild_id, xp, level = result
        print(xp, level)

        xp += random.randint(0, 25)
        
        if self.calculate_level(xp) > level:
            level += 1
            # 1,000
            await message.channel.send(f"Congratulations, {message.author.mention} You are levelled up to {level:,}.")

        cursor = await self.db.cursor()
        await cursor.execute('Update users set xp=?, level=? where user_id=? and guild_id=?', (xp, level, user_id, guild_id))
        await self.db.commit()
near oyster
harsh cradle
near oyster
kind radish
#

~~discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji

when bot tries to react:
await msg.add_reaction(":flag_tr:โ€Žโ€‹")

all other flags i need work fine
is there any other way to do flags reactions?
EDIT: it shows :flag_tr: here coz code view but my reaction is unicode
ps i am new T-T~~
as suggested by @slate swan emoji from emojipedia worked fine. Thank You

harsh cradle
slate swan
#

because

zenith zinc
#

hii

#

Ok

#

p!level

gentle tulip
#

Any code to make the bot online?

slate swan
#

bot.run("token")

boreal ravine
spring flax
#
    @commands.command(aliases=['exec', 'evaluate'])
    @commands.is_owner()
    async def eval(self, ctx, *, code: str):

I have this in a cog, why am i getting command eval is not found

slate swan
#

loaded the cog?

zenith zinc
#

Plsss give any bot name

slate swan
#

how do i fix this

zenith zinc
#

give

#

your code

#

in this command

#

hm

brave flint
zenith zinc
#

yes

high flame
#

use commands.Bot instead to use commands

boreal ravine
high flame
#

discord.Client doesn't have commands functionality

zenith zinc
#

dont @client.command() use @bot.command()

zenith zinc
high flame
zenith zinc
high flame
slate swan
zenith zinc
brave flint
high flame
slate swan
#

commands.Bot

slate swan
high flame
#

it's commands.Bot

brave flint
#

oof

slate swan
#

ok

zenith zinc
#

i`m stuped

brave flint
#

i writed that tho sorry

zenith zinc
#

yes

cloud dawn
#

i mean you could pull it off

slate swan
#

ok thx its works now

brave flint
#

btw did anyone make ship cmds?

zenith zinc
#

guys

autumn bone
#

Hello, it's possible to add date in embed ?

maiden fable
#

Those cmds that ship 2 ppl?

cloud dawn
#

from discord.ext import commands as client py_guido

zenith zinc
autumn bone
#

Did you have a documentation for ?

zenith zinc
brave flint
cloud dawn
#

!d discord.Message.created_at

unkempt canyonBOT
slate swan
#

how would i type hint commands.Context and discord.Message on something like this?

#

you dont need to typehint it

slate swan
#

you can if you want tho

brazen raft
slate swan
#

just use ctx.message if you need it

slate swan
slate swan
slate swan
zenith zinc
slate swan
#

not discord.Message

cloud dawn
#

If ctx is custom.. ```py
from typing import Optional, Union
(ctx: Union[Context, discord.Message])

zenith zinc
#

wrong

#

@autumn bone worked

#

?

cloud dawn
placid skiff
#

How i get the user that send the command with the CommandError object?

cloud dawn
placid skiff
#

Oh

#

Lol i totally forgot

zenith zinc
#

@autumn bone worked or not

placid skiff
#

Hahahaha

zenith zinc
#

!message_eror

cloud dawn
#

!d discord.ext.commands.Bot.on_command_error

unkempt canyonBOT
#

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

The default command error handler provided by the bot.

By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.9)") however it could be overridden to have a different implementation.

This only fires if you do not specify any listeners for command error.
cloud dawn
#

!d discord.ext.commands.Bot.cogs

unkempt canyonBOT
brave flint
#

thc

zenith zinc
#

Guys plss give me any bot name

slate swan
#

like this?

zenith zinc
#

yes

brave flint
cloud dawn
zenith zinc
slate swan
#

ITS BURNING

zenith zinc
zenith zinc
brave flint
#

sorry bad speech

zenith zinc
#

sorry

#

give some

brave flint
#

i didnt get it sry

zenith zinc
#

ouuuuu

#

my gramatick

slate swan
#

ok

zenith zinc
#

CordBot

#

?

brave flint
#

thats good name, but someone maybe used the name tho

zenith zinc
#

yes

boreal ravine
#

its cringe

brave flint
zenith zinc
brave flint
boreal ravine
boreal ravine
brave flint
zenith zinc
#

ok guys

zenith zinc
boreal ravine
#

ok

zenith zinc
#

"cringe" word is so cringe

brave flint
#

XD

zenith zinc
#

sorry sky

brave flint
zenith zinc
#

ok

zenith zinc
boreal ravine
#

its just flexing its a bot

#

automatically cring

reef shell
#

probot, carl-bot cringe ? oooof

brave flint
#

did anyone want to share ping cmds?

cloud dawn
#

Guys it's fine if it is quite to get a bit off topic but don't argue.

boreal ravine
boreal ravine
cloud dawn
brave flint
#

uh

#

i want to ask tho

boreal ravine
#

?

brave flint
#

nvm then

boreal ravine
#

okay

cloud dawn
vapid ingot
#

What should I look into for an image sharing bot?

I want users to upload images via command and view via commands in discord.

reef shell
#

pillow

vapid ingot
reef shell
#

for image manipulation

zenith zinc
vapid ingot
#

Iโ€™m new to coding and itโ€™s my first bot

zenith zinc
vapid ingot
#

Are you trolling?

zenith zinc
#

no

reef shell
zenith zinc
#

set this image

reef shell
#

wdym set the image?

zenith zinc
#

STOP

vapid ingot
#

First time Iโ€™ve seen such behavior in this sever.

zenith zinc
#

Shhhhss

brave flint
#

i had a question

vapid ingot
boreal ravine
reef shell
#

@vapid ingot I assume you are looking for some library that does image manipulation, if so , you can try pillow

#

!pypi pillow

unkempt canyonBOT
brave flint
#

@bot.command(name="Ping", when i try use ping it doesnt respond. any suggestion?

vapid ingot
boreal ravine
brave flint
boreal ravine
brave flint
#

wait google translating

boreal ravine
#

nice

cloud dawn
boreal ravine
brave flint
boreal ravine
harsh cradle
#

i have level system and im wanna know how do i when someone level up reset his exp so im not getting errors ```py
class Levelling(commands.Cog):
def init(self, bot):
self.bot = bot
self.db = self.bot.db

async def find_or_insert_user(self, member: discord.Member):
    # user_id, guild_id, xp, level
    cursor = await self.db.cursor()
    await cursor.execute('Select * from users where user_id = ?', (member.id,))
    result = await cursor.fetchone()
    if result is None:
        result = (member.id, member.guild.id, 0, 0)
        await cursor.execute('Insert into users values(?, ?, ?, ?)', result)
        await self.db.commit()

    return result

def calculate_xp(self, level):
    return 100 * (level ** 1.2)

def calculate_level(self, xp):
    # Sqrt => value ** 0.5
    return round(0.1 * math.sqrt(xp))


@commands.Cog.listener()
async def on_message(self, message: discord.Message):
    if message.channel.id != 869579846450302978:
        return

    if message.author.bot is True or message.guild is None:
        return
    
    result = await self.find_or_insert_user(message.author)

    user_id, guild_id, xp, level = result
    print(xp, level)

    xp += random.randint(0, 25)
    
    if self.calculate_level(xp) > level:
        level += 1
        # 1,000
        await message.channel.send(f"Congratulations, {message.author.mention} You are levelled up to {level:,}.")

    cursor = await self.db.cursor()
    await cursor.execute('Update users set xp=?, level=? where user_id=? and guild_id=?', (xp, level, user_id, guild_id))
    await self.db.commit()
cloud dawn
boreal ravine
#
@bot.command(name='Ping')
brave flint
brave flint
boreal ravine
brave flint
#

i tested it when i type "Ping" it answer but when i typed"ping" it doesnt

brave flint
boreal ravine
boreal ravine
zenith zinc
#
async def ping(ctx):
 await ctx.reply('Pong')
cloud dawn
unkempt canyonBOT
#

Whether the commands should be case insensitive. Defaults to False. This attribute does not carry over to groups. You must set it to every group if you require group commands to be case insensitive as well.

boreal ravine
zenith zinc
cloud dawn
brave flint
zenith zinc
brave flint
#

his feed i mean*

boreal ravine
brave flint
reef shell
#

@zenith zinc please don't waste your energy if you don't know how to help someone

cloud dawn
# zenith zinc why

No type hint, bare function e.g not using the decorator like they are designed.

zenith zinc
cloud dawn
brave flint
boreal ravine
cloud dawn
harsh cradle
brave flint
#

yeah i think

cloud dawn
boreal ravine
slate swan
cloud dawn
# brave flint yes

well command_prefix="!" is what we call a kwarg we can seperate muliple kwargs with , in thace we want to set case_insensitive to true

brave flint
boreal ravine
#

oh ๐Ÿ—ฟ

slate swan
#

is this a stackoverflow code or something

#

or everyone copying each other's bad code

brave flint
boreal ravine
slate swan
#

KiMo?

slate swan
harsh cradle
slate swan
#

mhm

errant shuttle
#

Hey I wanna send a button through my message using nextcord.
Here is my code that does not work

from nextcord import *
from nextcord.ext import commands
@client.command()
async def button(ctx):
    button = Button(
        label = 'me',
        style = ButtonStyle.primary,
        url = "https://www.astranova.com/xyz"
    )
    await ctx.send(button)

What will I do?

boreal ravine
brave flint
slate swan
boreal ravine
slate swan
#

docs don't apply.

cloud dawn
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.
cloud dawn
errant shuttle
boreal ravine
errant shuttle
# boreal ravine no problem

now i am getting this error

  await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/nextcord/ext/commands/core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: __init__() got an unexpected keyword argument 'label'

And here is the code

@client.command()
async def button(ctx):
    button = Button(
        label = 'me',
        style = ButtonStyle.primary,
        url = "https://www.astranova.com/xyz"
    )
    await ctx.send(view = button)
slate swan
#

just use disnake, easier ๐Ÿ˜” โœŠ

boreal ravine
slate swan
#

although i'm fairly sure that your problem doesn't have anything to do with the lib itself

#

ok i think i messed my code up

#

you need to pass a View not a Button

#

but you might wanna check the docs just in case

errant shuttle
slate swan
#

bc a Button is an item

#

you need to send a View that has your Button

nimble kayak
errant shuttle
slate swan
reef shell
nimble kayak
reef shell
#

dpy v2.0 is stable except it doesnโ€™t support slash commands

slate swan
errant shuttle
errant shuttle
slate swan
cloud dawn
#

disnake is def the way to go right now.

slate swan
#

^^

errant shuttle
reef shell
slate swan
#

says it big here see?

brave flint
#

uhhh im still struggle with capital cmds

slate swan
#

capital cmds?

boreal ravine
brave flint
#

like that?

brave flint
#

bot = commands.Bot(command_prefix="?") case_insensitive=True

#

idk why im so dumb

boreal ravine
brave flint
#

bot = commands.Bot(case_insensitive=True, command_prefix="?")

boreal ravine
brave flint
#

OK ill try

#

with , right?

boreal ravine
#

yes

#

separate kwargs with comma's (,)

brave flint
#

ahhh finally

#

tq so much

boreal ravine
#

sure

maiden fable
waxen granite
#

channels += f"{} - {}\n".format(key , channel.mention) whats wrong?

slate swan
#

why don't you use f-strings

#

they are much more readable

maiden fable
#

With use f strings or format

#

And yes, what meh dpy coder said

slate swan
#

channels += f"{key} - {channel.mention}\n"

boreal ravine
slate swan
#

done

slate swan
maiden fable
boreal ravine
#

hm

maiden fable
#

BTW Dia

slate swan
#

yes?

waxen granite
slate swan
#

what

maiden fable
slate swan
#

no

maiden fable
#

:c

slate swan
#

I once wanted to read Unity's source code

#

believe me or not, I didn't

maiden fable
#

๐Ÿ˜‚

#

I meant, any discord API wrapper library code

slate swan
#

not that either

lament mesa
maiden fable
#

Breh, I ain't able to understand HOW events are dispatched

slate swan
#

โ”

maiden fable
#

Lmao

slate swan
#

in Unity, it's just calling functions whenever something sends you a trigger

#

so that's prolly the case

#

ask blanket

lament mesa
placid skiff
#

If i have this query:
"SELECT X, A FROM table"
In python what it returns to me if i use fetchall using sqlite3?

slate swan
slate swan
#

people will use the same logic to do stuff in languages

placid skiff
slate swan
#

just written elseway

placid skiff
maiden fable
#

Breh, as Rush said yesterday in my DM, what I think, is dpy's source code is like black magic. No one knows how it works lmao

#

Except Danny and other contribs ofc ^^^

slate swan
#

danny should just continue his masterpiece

maiden fable
#

Indeed

slate swan
#

All I wish to know is why dpy thinks asdjdjj is a Context object

#

every first param is a context object

#

in a command

#

put ctx as the first param

#

๐Ÿ˜ž

#

and you can remove
await bot.wait_until_ready()

#

God damnit

#

I spent an hour trying to fix that

#

and please change that command name

#

peepoCry

slate swan
#

my bad

slate swan
maiden fable
#

me who always did the second one: pithink

slate swan
#

or self, ctx

slate swan
maiden fable
#

It is, now

slate swan
#

no more pass_context

#

since a long time

placid skiff
#

has_any_role throws an error if it checks roles from different servers?

slate swan
#

hmm

#

it should check the role of the member in the context's guild

placid skiff
#

That's bad

dawn lion
#

!cat

#

?cat

placid skiff
#

I'm creating a command and i have to check a role which is set by a command

#

So i don t know that role during the coding but the bot has to know it when the command is casted

dawn lion
#

#bot-commands

placid skiff
#

I m really stuck at this

slate swan
#

did you just tell yourself to go away

#

lmao

slate swan
placid skiff
#

Oke thanks

slate swan
#

yes, it checks for member

placid skiff
#

Ok so I Guess i should check without using discord checks xD

slate swan
#

probably

#

so you want to check if he has a role in another guild?

placid skiff
#

No no, i have that role saved in a database in the guild table

#

So I have just to check if the author has that role

#

I hoped that i could do that with checks so it will pass through on_error method but it seems that i have to code it xD

slate swan
#

@commands.has_any_role(role_name or role_id)

#

it's actually written pretty simply

placid skiff
#

I know i know, just lazy to do it xD

slate swan
#
    def predicate(ctx):
        if ctx.guild is None:
            raise NoPrivateMessage()

        # ctx.guild is None doesn't narrow ctx.author to Member
        getter = functools.partial(discord.utils.get, ctx.author.roles)  # type: ignore
        if any(getter(id=item) is not None if isinstance(item, int) else getter(name=item) is not None for item in items):
            return True
        raise MissingAnyRole(list(items))

    return check(predicate)
#

kms

placid skiff
#

Maybe I can raise the MissingPermission error so it will pass through the on_error event lol

slate swan
#

so what exactly stops you from using @commands.has_role()

#

I don't- get it

placid skiff
#

The thing is that i don t know the role during the coding

#

The role depends on the guild where the command is sent

slate swan
#

mmhmm

placid skiff
#

And that role is set by using a command

boreal ravine
boreal ravine
slate swan
#

who uses dpy <1.0

maiden fable
pliant gulch
#

I can read it alright, but some stuff they do makes no sense to me what so ever

#

Seems like most of it stayed the same since 2015

maiden fable
#

pithink So I should not waste my time smashing my head around tryna figure out how it dispatches an event, right?

stark garnet
#

Is it possible to use Member objects as dictionary values?

boreal ravine
#

i read dpy's files earlier and most of the files had lots of functions

pliant gulch
maiden fable
#

which file?

waxen granite
#

how can i get the cog name for a certain command?

maiden fable
pliant gulch
#

But again, get gateway url endpoint -> connect to ws via the url -> read the messages received from the gateway -> determine what to do

maiden fable
#

Well, I understand how to receive from the ws, but how to dispatch them

maiden fable
#

Cool thanks

pliant gulch
#

Said parsers process the data

#

Then dispatches it again to event callbacks

lament mesa
pliant gulch
#

Why would it be any different

stark garnet
# maiden fable wym

I have a dictionary like this:


player1 = {'User': ctx.author, 'Piece': 'x'}```
Whenever I call `player1["User"]` I get the following error: `discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Member' object is not subscriptable`
pliant gulch
#

its still being dispatched over the gateway

#

You don't need to hardcode for it, just make a parser for components event

#

i.e interaction_create etc

waxen granite
stark garnet
maiden fable
distant salmon
#

Hello, guys!

I am using discord and discord_components for my imports and I'm trying to make the bot that will respond with client-side messages, like Clyde bot. It works perfectly when I'm trying to respond to button click event, but I was wondering if it's possible to send this kind of client-side message when on_message event is triggered.

Here's what i mean by client-side messages if anyone's wondering. I will appreciate any help, thanks in advance!

slate swan
#

is this good or commands???

maiden fable
waxen granite
#
    async def limitedcommands(self, ctx, guildid:str = None):
        if guildid is None:
            guildid = str(ctx.guild.id)
        try:
            guildLimit = self.channelLimitations[guildid]
        except:
            return await ctx.send("Looks like no commands are limited here.")
        limitmsg = ""
        for command in guildLimit.keys():
            cogname = command.cog
            channelList = guildLimit[command]```
@maiden fable
maiden fable
lament mesa
distant salmon
stark garnet
waxen granite
maiden fable
maiden fable
unkempt canyonBOT
#

discord/state.py lines 701 to 708

def parse_interaction_create(self, data) -> None:
    interaction = Interaction(data=data, state=self)
    if data['type'] == 3:  # interaction component
        custom_id = interaction.data['custom_id']  # type: ignore
        component_type = interaction.data['component_type']  # type: ignore
        self._view_store.dispatch(component_type, custom_id, interaction)

    self.dispatch('interaction', interaction)```
stark garnet
# maiden fable weird then

I have assigned it to another variable though. Could that possibly be the issue? I did active_player = player1

stark garnet
#

Thanks for trying though.

waxen granite
#

@maiden fablepy for command in guildLimit.keys(): cmd = self.bot.get_command(command) cogname = cmd.cog channelList = guildLimit[command]
like this?

maiden fable
#

Yea ig

sonic lark
#

how would i go about running multiple discord clients?

#
def one():
    client.run(tokens[0], bot = False)
def two():
    client.run(tokens[1], bot = False)

#

i tried threading i get some positional argument error

boreal ravine
#

Is there a discord.Sticker class or something?

slate swan
slate swan
unkempt canyonBOT
#

class discord.Sticker```
Represents a sticker.

New in version 1.6.

str(x) Returns the name of the sticker.

x == y Checks if the sticker is equal to another sticker.

x != y Checks if the sticker is not equal to another sticker.
boreal ravine
boreal ravine
slate swan
#

but he's not trying to run a bot from what i see

boreal ravine
#

hm

slate swan
#

to run multiple bots from the same file you can do something like this ```py
import asyncio
from discord.ext import commands

loop = asyncio.get_event_loop()

bot_1 = commands.Bot(loop=loop, ...)
bot_2 = commands.Bot(loop=loop, ...)

loop.create_task(bot_1.start(token_1))
bot_2.run(token_2)

sonic lark
#

what does bot_1 refer to?

slate swan
#

it's a var

pliant gulch
#

I doubt this will work

#

start is still blocking

tough lance
#

Neither is it recommended

slate swan
#

^

slate swan
pliant gulch
#

And something being a coro doesn't mean it isn't blocking

slate swan
pliant gulch
#

It would still block

slate swan
#

it wouldn't

fallow mauve
#

why isnt this working?

@bot.event
async def on_reaction_add(ctx, reaction, user):
  channel = reaction.message.channel
  await ctx.send(channel, '{} has added {} to the message: {}'.format(user.name, reaction.emoji, reaction.message.content))
tough lance
#

!d discord.ext.commands.Bot.start

unkempt canyonBOT
#

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

A shorthand coroutine for [`login()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.login "discord.ext.commands.Bot.login") + [`connect()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.connect "discord.ext.commands.Bot.connect").
fallow mauve
#

its supposed to send a message whenever a reaction is added to a message

tough lance
#

Only args are reaction and user

#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesnโ€™t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโ€™s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
slate swan
tough lance
#

By blocking means become synchronous not asynchronous

slate swan
#

ยฏ_(ใƒ„)_/ยฏ

pliant gulch
# slate swan

bot.start by itself is blocking, and create_task runs it the running loop

#

should this not block the running loop???

#

I'm confused now

slate swan
#

so you want me to show you that i can run 2 bots on the same event loop?

boreal ravine
#

isnt running a bot already an asyncio event loop

slate swan
#

.start is as it says, a coro, a coro is an asynchronous function

pliant gulch
slate swan
#

you'd use asyncio.sleep

pliant gulch
#

That's not the point

#

I'm trying to tell you that just being a coro doesn't mean it doesnt block

#

Making it not asynchronous

slate swan
#

that's because you're running it using asyncio.run

#

try making a loop and running it on that loop

pliant gulch
#

asyncio.run is not relevant I'm just showing you again, that just because its a coro

#

does not make it not blocking

slate swan
#

ยฏ_(ใƒ„)_/ยฏ

pliant gulch
#

and do you even know what asyncio.run does?

#

it creates a new event loop and runs it on there

slate swan
#

yeah saw that now that i read its docs

pliant gulch
#

So even if you did make a loop and tried running it would still block

#

my point

slate swan
#

then explain this ๐Ÿค”

pliant gulch
#

Which goes back to my original question as to why it didn't block the loop

#

create_task if I'm not wrong runs the coro in the running loop so shouldn't it be blocking it

slate swan
#

async do be confusing pithink

waxen granite
crimson tendon
#

how can I prevent an event if an action is done ?

for example, if my bot leave the server himself, is it possible to don't call the on_guild_remove event ?

maiden fable
#

idk dude. seems like a DB problem tbh

waxen granite
#
        for command in guildLimit.keys():
            cmd = self.bot.get_command(command)
            cogname = cmd.cog```
the command here is the command name
#

is it the corrct wat to get the command?

#

correct*

slate swan
#

If you don't need it, don't add the code...

crimson tendon
slate swan
#

then when the bot leaves himself unload the cog where you have the event and after it's done load it back

crimson tendon
#

okay thanks, I'll do that

slate swan
#

yw

waxen granite
#

hw cn i get the roles from the channel overwrites

karmic totem
#

!on_message.delete

slate swan
unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

slate swan
#

๐Ÿค”

#

!d discord.on_message_delete

unkempt canyonBOT
#

discord.on_message_delete(message)```
Called when a message is deleted. If the message is not found in the internal message cache, then this event will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.

If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_message_delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_delete "discord.on_raw_message_delete") event instead.

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

aur @wise hinge ki haal?

long fog
#

hi

#

how do you make your bot send a post request to a webhook when the bot goes online?

final iron
#

Are there any good commands I could work on to help deepen my knowledge of discord components? I have an end goal of what I want to do but I would first need learn how to use them. Im just drawing blanks right now

eternal trench
#

Hi im trying to make a music bot leave after every person leaves. Here's the code:

@commands.Cog.listener()
    async def on_voice_state_update(self, member, before, after):

        if not member.id == self.bot.user.id:
            pass

        if before.channel is not None:
            voice = before.channel.guild.voice_client
            if len(after.channel.members) == 1 and voice.is_connected() is True:
                await voice.disconnect()```
#
AttributeError: 'NoneType' object has no attribute 'members'
``` and im getting this error
cloud dawn
#

!d discord.on_voice_state_update

unkempt canyonBOT
#

discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").

The following, but not limited to, examples illustrate when this event is called...
slate swan
#

can't help

eternal trench
cloud dawn
eternal trench
#

kk

inland venture
#

if user_message.startswith(f'*quote'):
response = f'{user_message}, {username} 2021'
await message.channel.send(response)
return

#

.

#

I want to quote the word that the user said

distant salmon
#

Hello, guys!

Does anybody know how to delete a ping notification message?

inland venture
#

if user_message.lower() == '*specs':
await message.channel.send("SSD: M.2 1000GB Hard Drive")
await message.channel.send("MOBO: B460M Pro Vdh Wifi")
await message.channel.send("GPU: Intel UHD 630")
await message.channel.send("Case: H510 Elite")
await message.channel.send("RAM: 16GB")
await message.channel.send("CPU: Intel core i5 10400")
return
how do i make this into embed text?

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if itโ€™s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
errant shuttle
slate swan
#

then what's the error

#
    if member.activities[0].name != "blahblah":
IndexError: tuple index out of range
final iron
#

There are hard drives

#

And NVME m.2 ssds

slate swan
#

so you get the index error

outer violet
#

So I made a timer command and when the bot says โ€œyour timer has endedโ€ is there any way to show the result of the time like โ€œyour timer has ended (60s)โ€?

@commands.command()
    async def timer(self, ctx, seconds):
        try:
            secondint = int(seconds)
            if secondint > 300:
                await ctx.send("i dont think i can go over 5 minutes")
                raise BaseException
            if secondint <= 0:
                await ctx.send("i dont think i can do negatives")
                raise BaseException

            message = await ctx.send(f"โฑ๏ธ Timer: {seconds}")
            
            while True:
                secondint -= 1
                if secondint == 0:
                    await message.edit(content="โฑ๏ธ Timer ended")
                    break

                await message.edit(content=f"โฑ๏ธ Timer: {secondint}")
                await asyncio.sleep(1)
            await ctx.reply("your countdown has ended")
        except ValueError:
            await ctx.send("you must enter a number")
slate swan
#

while True is blocking

unkempt canyonBOT
#
Nah.

No documentation found for the requested symbol.

slate swan
#

don't do that

distant salmon
reef shell
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
pseudo grail
#

Quite simple, it should print the amount of members in role however it prints 0.

Does anyone know why? It has caught the correct role as it prints Role.id correctly but always returns Role.members with 0

brazen raft
#

Your members intent is disabled

slate swan
#

how can i only delete messages sent by bots with my purge command?

#

ping?

#

Check if the message author is a bot or not

#

!d discord.abc.User.bot

unkempt canyonBOT
slate swan
#

it's the default theme

pseudo grail
slate swan
#

how would i check a if a user was online in a command not event

final iron
pseudo grail
#

good one

final iron
#

Not mine bro

#

Dpy server

slate swan
#

No wonder it comes from there... Pure toxicity

reef shell
#

Dpy server has some good tags
For example:
slash cmdoooof

slate swan
#

indeed

reef shell
#

shhh

slate swan
#

you're a bad person, I said

slate swan
#

but I don't remember what it was so I'll tag it again

reef shell
#

oooof.

slate swan
#

oh rush just did it

#

poor one

lament mesa
#

That's a good song

reef shell
#

indeed

solemn holly
#

Sorry if this isn't the right place to ask, but how do I make sure my application is public?

slate swan
#

it is the right place, dw

solemn holly
#

Alright cool

slate swan
#

but I dunno

solemn holly
#

Anyways it looks like It's public to me

slate swan
#

so I pass

void wyvern
#

why doesn`t it work?

            await wl.connect()
            discord.voice_client.play(discord.FFmpegPCMAudio("C:/Users/VIP/Documents/Audiotonic/Starcity.mp3"))
            while not voice_client.is_done():
                await asyncio.sleep(1)
            await wl.disconnect()
            print(len(channel1.members))```
Error:
```py
    discord.voice_client.play(discord.FFmpegPCMAudio("C:/Users/VIP/Documents/Audiotonic/Starcity.mp3"))
AttributeError: module 'discord.voice_client' has no attribute 'play'```
slate swan
#

!rule 5

unkempt canyonBOT
#

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

slate swan
#

wait I'm dumb

#

is this a bot that downloads music from yt?

void wyvern
slate swan
#

well I guess then

#

use ctx.voice_client

#

discord.voice_client is not a thing

#

!d discord.ext.commands.Context.voice_client

unkempt canyonBOT
#

property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
void wyvern
slate swan
#

mmhmm

void wyvern
#

so ctx will not work

slate swan
#

wl.play?

#

what kind of object is wl?

void wyvern
#

wait a second

#

wl = client.get_channel(888715816252616714)

slate swan
#

so it's a voice channel

void wyvern
#

yes

slate swan
#

voice channel doesn't have a play method

#

I'm searching

void wyvern
#

so how can i play music in a specefic vc?

slate swan
#

eh

#

oh I got it

void wyvern
#

yes?

slate swan
#

save connect() into a variable

#

like

#

voiceClient = await wl.connect()

void wyvern
#

oh i have it alreasdy

slate swan
#

then you can use voiceClient.play()

void wyvern
#

yes i do it like these

#

thx for your help

slate swan
#

yw

strong kettle
#

why??

devout hatch
#

does anyone know what this error is AttributeError: 'FFmpegOpusAudio' object has no attribute '_process'

shrewd birch
#

hey i need help

#

i keep etting the error, user.txt isnt there

#

but it is

devout hatch
#

is it in the same directory as ur py file

shrewd birch
#

yeah basically lookk

devout hatch
#

idk

shrewd birch
#

me either

#

hence me asking for help yk

slate swan
#

Well, we shouldn't really help for mass dm bots

unkempt canyonBOT
slate swan
#

!rule 5

unkempt canyonBOT
#

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

slate swan
#

didn't notice it's a mass dm bot

shrewd birch
slate swan
#

It's against Discord's Developer Guidelines

#

And therefore against the rule number 5

shrewd birch
#

i sincerely apologize sir, i did not realize.

void wyvern
#

why won't this work?

    if len(channel1.members) == 0:
        for members in channel2:
            await members.move_to(channel1)
    if len(channel2.members) == 0:
        for members in channel3:
            await members.move_to(channel2)
    if len(channel3.members) == 0:
        for members in channel4:
            await members.move_to(channel3)```
error:
```    for members in channel2:
TypeError: 'VoiceChannel' object is not iterable

Channels are VC's

pliant gulch
#

Channels aren't iterable as error says

#

You want to be iterating over members

#

The property of the channel

void wyvern
#

couse there are now members in the channel?

pliant gulch
#

?

#

You just need to iterate over the channels member property

#

I.e the list of members in the channel

void wyvern
#

okay

slate swan
#

Loop through the channel .members, and not the channel object itself

#

Does anyone know why it doesn't wanna print the channel name where the message was sent?

#
import random

TOKEN = ''

client = discord.Client()

@client.event
async def on_ready():
    print('Bot Is Running as {0.user}'.format(client))

@client.event
async def on_message(message):
    print(message.channel.name)

client.run(TOKEN)
#

add await client.process_commands(message) in your on_message event

reef shell
#

That's for processing commands