#discord-bots

1 messages · Page 743 of 1

vast gale
#

@green bluff ^

green bluff
#
async def stat(ctx, reason):
    r = requests.get(f"https://api.hypixel.net/player?uuid={reason}&key=0f4686d5-5696-4b6e-843e-79932a76fbdc", headers={'content-type': 'application/json'})
    await ctx.send(r.json()["record"]["owner"])
slate swan
#

really bye guys pithink

vast gale
#

@slate swan go sleep smh we'll see you tomorrow probably idk I don't frequent this channel much

tender estuary
green bluff
#

doesnt return anything

slate swan
vast gale
#

yes

tender estuary
vast gale
#

yes they are

shadow wraith
#

this channel is active

unique tendon
#

@tender estuary

slate swan
#

aint nobody gonna let u go

vast gale
slate swan
tender estuary
#

Try yourselves first brother

vast gale
slate swan
green bluff
#
async def stat(ctx, reason):
    r = requests.get(f"https://api.hypixel.net/player?uuid={reason}&key=api", headers={'content-type': 'application/json'})
    await ctx.send(r.json()["record"]["owner"])```
#

i dont think this is general guys

#

this is call bot help for a reason

slate swan
#

mini not funny

vast gale
slate swan
green bluff
#

called*

green bluff
#

PLEASE HELPPPP

shadow wraith
green bluff
#

omg

vast gale
slate swan
shadow wraith
#

how do i eat a hamburger

green bluff
#

omg

#

i swear

shadow wraith
#

!ot before we get captured

unkempt canyonBOT
vast gale
slate swan
shadow wraith
#

gogogogo ot2

slate swan
#

.topic

lament depotBOT
#
**What feature would you be the most interested in making?**

Suggest more topics here!

slate swan
tender estuary
green bluff
shadow wraith
slate swan
shadow wraith
#

but i forgot how to use the programming lang

tender estuary
slate swan
tender estuary
slate swan
#

linux improved

slate swan
shadow wraith
vast gale
#

@slate swan I will pong you in disnake on help questions /srs

tender estuary
vast gale
#

if you don't go sleep

slate swan
#

linux terminal improved

shadow wraith
#

i dont use linux

slate swan
shadow wraith
#

no need to be insulting people for an operating system they don't have.

slate swan
#

anyone know any module I could use to make actual bootable iso with python

vast gale
#

:)

shadow wraith
#

bro i use mac 💀

slate swan
shadow wraith
#

today is a funny day

slate swan
#

no

shadow wraith
#

bro, your a savage for insulting yourself

vast gale
slate swan
#

windows is great screams in windows 11

shadow wraith
slate swan
shadow wraith
#

there's something called opinions btw

tender estuary
#

my toaster OS is great.

shadow wraith
#

#code-of-conduct
im pretty sure it says that they respect different view of stuff

slate swan
#

my toilet has a os

shadow wraith
#

• Being respectful of differing viewpoints and experiences

#

this

#

two can play that game, linux very g-

#

linux not very good? thanks for telling me

#

you said nope to what i said so that means linux is not great or good

#

wrong channel btw

tender estuary
#

I totally forgot this was discord bots

tender estuary
#

you can hek in it

slate swan
#

i thought this was the dpy server

tender estuary
slate swan
#

people in the dpy server are scary

shadow wraith
slate swan
tender estuary
lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

quick gust
vast gale
slate swan
past ember
slate swan
#

im leaving in ||never gonna|| sike ||never gonna give you up||

#

bye(really this time)

tender estuary
#

ayo-

slate swan
#

what are these shit posts

#

bye now 🚶

#

nope

tender estuary
#

Delete that before an admin slaps you-

slate swan
#

@ Moderators

tender estuary
tall dust
#

!ban 535319856913055744 troll

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @silk nest permanently.

tender estuary
#

yea fuc-

vast gale
tall dust
#

lol

unique tendon
#
@client.event
async def on_message(message):
    if message.content.startswith('test'):
        channel = message.channel
        await channel.send('Say hello!')

        def check(m):
            return m.content == 'hello' and m.channel == channel

        msg = await client.wait_for('message', check=check)
        await channel.send('Hello {.author}!'.format(msg))
vast gale
unique tendon
#

How to make it so it pings the author, instead of only saying their tag

vast gale
#

author.mention

shadow wraith
unique tendon
#

Kk

quick gust
#

also don't use .format

tender estuary
#

Oh wait

vale wing
#

I already told him to, seems like he ignored

unique tendon
#

Idk how to

#

Im just using docs

vale wing
#

Check the tutorial

#

Docs quickstart is outdated

#

There's command decorator

tender estuary
#

That's all you need tbh

quick gust
#

misleading command name bigthonk

tender estuary
#

I could have used test, dog, cat, neptune or really anything

#

just wanted to show command decorators are a thing

quick gust
#

yes, I wasn't being serious

unique tendon
#

Im tryna make a drop command

#

So thats what i was doing

quick gust
#

what do you mean "drop"? that word has varying definitions

unique tendon
#

just nvm

keen talon
tender estuary
heavy folio
#

yes that

#

either that/requires owner/some built in checks

slate swan
#

!d discord.ext.commands.Command.checks

unkempt canyonBOT
heavy folio
#

what will the display be

small igloo
#

how to make my bot mark an image from link "spoiler"

slate swan
#

how to fix this

small igloo
slate swan
small igloo
slate swan
small igloo
slate swan
#

@small igloo

small igloo
small igloo
# slate swan

🤷‍♂️ see full tutorial, don't skip anything

small igloo
dreamy sluice
#

Is there a way I can add a time limit to the wait_for() function?

#

For example, if the user fails to give a value within a particular amount of time, it'll execute another set of statements.

honest shoal
unkempt canyonBOT
spring flax
#

The error that is raised if timeout is passed is asyncio.Timeout error

green bluff
dreamy sluice
#

in the check

green bluff
#

help?

spring flax
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**...
dreamy sluice
#

Thanks

honest shoal
green bluff
#

@honest shoal help?

honest shoal
#

player uid in int

#

as the error says

green bluff
#

so

#

what do i doreason : int

honest shoal
#

yes

green bluff
#

okay

slate swan
#

No.

#

The command decorator

#

Also no.

green bluff
slate swan
#

The JSON output

#

Contains an arraylist

green bluff
#

mhm

slate swan
#

And since we don't know how the JSON looks like, nobody can help unless you send it.

#

But when using .json()

#

You will somewhere need [0]

green bluff
#

where do i put

slate swan
#

Before, between or after ["record"]["owner"]

green bluff
#

[0]

#

sure

slate swan
#

Because as I said, we don't know how the JSON looks like.

green bluff
#

let me try all 3

slate swan
#

So we can't really help correctly.

green bluff
#

how do i tell

#

u what the json looks like

honest shoal
#

send it here

green bluff
#

print(r.json(["record"]["owner"]))

#

is this the json

honest shoal
#

no

slate swan
#

No

green bluff
#

then what is the json

slate swan
#

Print r.json()

green bluff
slate swan
#

Well, UUID is wrong

green bluff
#

?

#

do i input uuid aswell

slate swan
#

Error says all

green bluff
#

what do i do then

slate swan
#

Which means, the UUID you give when making the request is malformed. Fix that.

#

Give valid UUIDs and format them correctly.

maiden fable
#

!d uuid.uuid4 use this if not using it before to create UIDs

novel bolt
#

hey , in my music bot , when i add songs to q, if a song is being played currently, its voice starts to break. after some time voice become ok.
anyone know why does this happen?

unkempt canyonBOT
slate swan
#

No.

green bluff
slate swan
#

This won't help at all.

green bluff
#

still get the rror

maiden fable
#

Wait, UUID means game ID?

slate swan
#

Minecraft UUID

green bluff
#

yes

maiden fable
#

Ahh sorry about that then. I don't play MC so didn't have any clue

dreamy sluice
maiden fable
slate swan
#

dc8e9a5f-12e2-4928-bd92-c4131b291f26 this is a UUID example

maiden fable
#

Gotcha

green bluff
#

but

#

they said get the uuid from there

slate swan
#

5687da32-6999-429c-bb7d-2006907ec995

#

Not 5687da326999429cbb7d2006907ec995

#

how to delete channels by specifying names?

green bluff
#

oh how do i know when to split

#

with a dash

#

@slate swan

slate swan
#

Mojang's API should still perfectly understand a trimmed UUID

green bluff
#

?

#

what should i do now

#

@slate swan

slate swan
#

There is no need for "formatting it properly"

green bluff
#

then whats the probleme

#

problem

dreamy sluice
slate swan
dreamy sluice
# dreamy sluice It's not working for me oof
await ctx.send("reply with e or commit die")

def check(m):
  return m.content() and m.channel == ctx.channel

with await bot.wait_for('message', check=check, timeout=10) as msg:
  try:
    print(msg.content)
  except Exception:
    print(msg.content)
    traceback.print_exc()
#

My code

green bluff
#

how

slate swan
#

The key is a hypixel API key you need to register for, not the players UUID

#

Nothing's wrong.

#

{reason} is the UUID, they just copied it

slate swan
#

Yes but they're giving the API an invalid key.. how is that not wrong?

placid skiff
slate swan
#

The key is valid, see by yourself.....

dreamy sluice
dreamy sluice
spring flax
#

does anyone know if on_guild_update is triggered when a user stops boosting a guild

slate swan
#

!d discord.on_guild_update

unkempt canyonBOT
#

discord.on_guild_update(before, after)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") updates, for example:

• Changed name

• Changed AFK channel

• Changed AFK timeout

• etc...
slate swan
#

and don't use the with statement,

green bluff
#

so whats my problem please tell me

slate swan
#

A new boost is not a change to the guild.

placid skiff
slate swan
#

instead put wait_for inside of the try block, just before the print

spring flax
slate swan
#

Uhh, i should probably hop on to my computer

green bluff
#

@slate swan

#

i gave u the json list

#

thing

slate swan
#

You need to learn to stop mass pinging. People won't help you.

green bluff
#

sorry

#

ok

slate swan
#

Remove :str, it's not needed.

green bluff
#

still nothing

#

have u figuired out the [owners][record]

#

thing i gave u the documentation

#

player?uuid= is the ? needed

slate swan
#

The URL you're trying to parse doesn't give any owners nor record fields.

#

So even when you get the parameter to work, it won't do what you want to do.

#

he's talking about 'records'

slate swan
#

And that's why I'm saying.
The JSON doesn't give such information back.

green bluff
#

does using disnake change anything

slate swan
#

At least nothing in owners

#

Which doesn't even exist

#

this is a very confusing endeavor, he should tell us which data exactly he aims to extract from the json response

#

It would be ["player"]["stats"]["Bedwars"]["practice"]["records"]

green bluff
#

ii want to start simple and just extract lets say the play bedwars stats

#

one thing

#

i just want to extract one

slate swan
#

Well, which one.

green bluff
#

stats

slate swan
#

Stats is vague....

green bluff
#

ok then player

slate swan
#

The API gives lots of information


         "Bedwars":{
            "packages":[
               "leaderboards_resync_mar_2021"
            ],
            "bedwars_boxes":17,
            "first_join_7":true,
            "Experience":81745,
            "games_played_bedwars_1":595,
            "eight_two_winstreak":0,
            "_items_purchased_bedwars":12634,
            "beds_lost_bedwars":422,
            "coins":30686,
            "deaths_bedwars":1970,
            "eight_two__items_purchased_bedwars":6673,
            "eight_two_beds_lost_bedwars":262,
            "eight_two_deaths_bedwars":1066,
            "eight_two_entity_attack_deaths_bedwars":424,
            "eight_two_entity_attack_final_deaths_bedwars":155,
            "eight_two_final_deaths_bedwars":269,
            "eight_two_games_played_bedwars":298,
            "eight_two_gold_resources_collected_bedwars":5429,
            "eight_two_iron_resources_collected_bedwars":43326,
            "eight_two_items_purchased_bedwars":6969,
            "eight_two_losses_bedwars":277,
            "eight_two_resources_collected_bedwars":49563,
            "eight_two_void_deaths_bedwars":614,
            "entity_attack_deaths_bedwars":759,
            "entity_attack_final_deaths_bedwars":254,
#

So just saying "stats" or "player" doesn't give us what you want to know.

green bluff
#

lets say when the player last logged in

slate swan
#

["player"]["lastLogin"] returns a timestamp, 1641889126926 -> <t:1641889126>

green bluff
#

good but mymalformed uuid still doesnt work

slate swan
#

are you sure you're passing the uuid correctly

green bluff
#

does it look correct

slate swan
#

you really shouldn't do everything on the URL of the requests, it complicates things

green bluff
#

what do i change then

slate swan
#

hey can anyone help me i m making a dc server spammer

#

Well, like that it doesn't since it's an f-string.

#

!rule 5 @slate swan

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
#

oops

#

Please to not discuss about nukers/spammers.

green bluff
#

damn u really memorised the rules

slate swan
green bluff
#

howd u know it was rule 5

#

lol anyways

#

does my url look correct

slate swan
#

i wanna import tkns from a txt file

#

Yes it does.

#

how can i

#

?

green bluff
#

then what can i do to make it work

#

is there something i can do

slate swan
#

<@&831776746206265384> can you explain to @slate swan that asking for help about spammers/nukers using user tokens is not allowed and should not be discussed here, thanks :)

#

oops

#

I don't think you needed to ping the mods for this..

#

Yes I did.

green bluff
#

u coulda just told the man no

#

welp pls help

slate swan
#

Again? After they said "oops" and I linked to the rules.

#

Repeating myself won't help.

green bluff
#

ok yea i understand

spring flax
green bluff
#

anything i can do to fix my program

slate swan
#

Maybe, try it ¯_(ツ)_/¯

#

Quite possible

spring flax
#

well, I'd need a user to boost

green bluff
slate swan
#

It's r.json()[...]

tight obsidian
#

@slate swan

  1. We're not going to help you with a selfbot
  2. Please change your banner and profile picture to something safe-for-work
spring flax
#

But I guess it should, because Called when a Guild updates and premium_subscription_count is an attr of guild

green bluff
#

nothuing

slate swan
#

How about just r.json()

#

Seems like nothing is found, so the JSON is different.

#

how can i fetch a message by it's id

vale wing
unkempt canyonBOT
#

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

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
slate swan
#

i got it

vale wing
#

@green bluff what status code does it return

#

If it is not 2xx (should be 200 if everything is totally ok) then there's an error and you most likely need to get text of the return

#

Also you really should use aiohttp in async functions

magic ore
honest vessel
#

why variable called reason, wen its an user id

#

and yea no ctx at all

#

oh well reason is his ctx lol

vale wing
spring verge
#

I was wondering something

#

if I give this information with password

#

then can anyone access this database?

polar ice
#

Hello, in some serious need. Hoping i can pick someones brains about a issue im having

how could i retreive the guild ID from a custom function in discord.py

I have no way of passing the guild ID through the function either as the function gets called straight away soon as the script starts and then continuously loops

placid skiff
#

You need a variable that refers to the guild. If you have the name of the guild or a channel, even a member, you can get the guild object from that

vale wing
#

Does discord bot on dpy or its fork require any ports opened for work

vale wing
shut leaf
#

hello

#

whats the problem

slim ibex
#

that isnt how you set up cogs

shut leaf
#

how then

slim ibex
#

its commands.Cog

#

bot.load_extensions() for loading cogs

shut leaf
#

should i replace cog in the fifth line with commands.Cog

slim ibex
#

Commands.cog to commands.Cog

shut leaf
#

its not working bro

final iron
#

You leaked your token

final iron
shut leaf
final iron
#

You're missing a :

shut leaf
#

i tried

#

the error went to line 6

final iron
#

You're missing another : on line 6

shut leaf
#

the error goes to line 7

final iron
#

Its indented wrong

#

!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

final iron
#

Line 7 needs to be indented 2 levels

shut leaf
#

line 16

quick gust
#

bruh, else needs to be unindented

shut leaf
final iron
shut leaf
#

kos omak

quick gust
#

please dont spoonfeed

dense coral
final iron
vale wing
#

Web app require ports opened for connection

spring flax
#

any idea why this says extension example could not be loaded?
Main file -

import disnake
from disnake.ext import commands
import os

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


for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        bot.load_extension(f'{filename[:-3]}')
#

and the cog is

import disnake
from disnake.ext import commands

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

    @commands.command()
    async def ping(self, ctx):
        await ctx.send("Pong!")

def setup(bot):
    bot.add_cog(Example(bot))
spring flax
slate swan
#

Silly mistakes

hoary cargo
spring flax
slate swan
#

It's cogs.{filename[:-3]}

hoary cargo
#

^

slate swan
#

You need to load from the cogs folder, therefore the prefix.

vale wing
#

@slate swan hey do you know do I need to open any ports on the firewall (it blocks all connections from unlisted sources and to unlisted ports) for the bot script to work or it just needs internet access?

crisp bloom
#

How di I make my discord bot show that box?

#

I heard I have to use embed but I have no knowledge on how to do it

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.
final iron
crisp bloom
#

this should work then right?

#

but it doesnt

shadow wraith
# crisp bloom but it doesnt

probably because you passed in a name parameter in the decorator although your function name is enough for it to be recognized as the command name.

i've attempted making a decorator and using a function's name is pretty cool

crisp bloom
#

and I have another problem, I cant use (name = "help"), it says the function help already exists. but I have not used it anywhere else

crisp bloom
#

oh

#

but then how will the bot know

#

/help

shadow wraith
#

function name

crisp bloom
#

ohhh

shadow wraith
#

the function name is what's required for the command name

final iron
shadow wraith
#

read pins for further information on subclassing help commands

crisp bloom
#

You see... I started programming bots not long ago and I learnt from like 4 yt videos so subclass, cogs these are big words for me

final iron
#

If you do wish to waste your time, you would have to remove the help command in the bot constructer

shadow wraith
#

well, do you know the basics or indermediate levels of python?

crisp bloom
#

I know all the basics

#

and stuff of indermediate

slate swan
#

!d

unkempt canyonBOT
final iron
slate swan
#

ok

unkempt canyonBOT
#

Hey @crisp bloom!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

crisp bloom
#

oof

shadow wraith
#

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

shadow wraith
#

use this website

unkempt canyonBOT
#

Hey @crisp bloom!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

crisp bloom
#

wait

daring thicket
#

i have code, how can i cog?

shadow wraith
final iron
#

Check this out

shadow wraith
#

i guess so

crisp bloom
#

dude it still gives me the same error

daring thicket
crisp bloom
#

nvm

#

I fixed it

shadow wraith
crisp bloom
#

an example of something I made

#

probably one of my hardest

shadow wraith
#

i dont play c4 (connect4)

crisp bloom
#

never?

shadow wraith
#

never played it

crisp bloom
#

ok another thing I made was a program that solved right angled triangles for you using trignometry

honest shoal
#

nice

vale wing
#

I literally encrypted my token CURSEDHAHA

crisp bloom
#

alrighty... I seem to have gotten this

#

not exactly ogranized 😂

#

how do I like space them out?

honest shoal
#

what

crisp bloom
#

it didnt show the title?

honest shoal
#
(embed=embed_name)```
crisp bloom
#

huh?

honest shoal
#

last line of your code

crisp bloom
#

the await message.channel.send?

honest shoal
#

yes

crisp bloom
#

but I have already defined embed_name as discord.embed

#

so I need to do it again?

quick gust
honest shoal
#

!d discord.Embed

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.
quick gust
#

because your help command is still dpy's help command

#

and don't use on_message

#

I guess u are following old tutorials

crisp bloom
#

so I need async def on_message?

quick gust
#

No

tight girder
#

how to make the bot send a message when a specific word is said in a embed??

quick gust
#

Use the commands framework

quick gust
honest shoal
tight girder
quick gust
#

are u trying to look for a word in an embed? or send an embed after looking for a word

honest shoal
honest shoal
tight girder
# honest shoal of whom?

Like when you give money in dank memer there is a embed sent i want my bot to reply money sent

tight girder
#

Ohk

honest shoal
#

are you making a command with embed as response?

tight girder
#

Noo

honest shoal
#

then?

tight girder
#

Wait

crisp bloom
#

my bot is broken I think

tight girder
#

i want it to reply to this embed

honest shoal
# tight girder

with such way you can't make your bot get triggered by other bots, it needs quite hacks

crisp bloom
#

I was looking at this article on help with embed

#

so I copy pasted that code

crisp bloom
#

but my bot still replies with this crap

quick gust
#

u didn't read what I said

crisp bloom
quick gust
#

ure gonna have to change the help command in the bot constructor

honest shoal
#

you can disable it too

hoary cargo
# crisp bloom

You need to remove the default help command before making a custom one

honest shoal
crisp bloom
#

how do I do that

#

how do I delete the help command

honest shoal
crisp bloom
#

the default one

#

this removes the default command?

crisp bloom
honest shoal
crisp bloom
honest shoal
crisp bloom
#

this gives an error then

honest shoal
#

bruh

#

put it above of @bot.command()

crisp bloom
#

ohhhhh

#

OMG THANKS SO MUCH

#

IT WORKS

#

yall the best fr

left crater
quaint epoch
#

anyone want a script that converts a list of swears to enhanced swears for better detection?

#

i just finished it and thought it would be cool

slate swan
quaint epoch
slate swan
#

re

final iron
#

Google

quaint epoch
#

ah

#

alr

#

but im sticking to my form of swear detection because it is definitely better

final iron
#

I doubt it

quaint epoch
final iron
#

Regex will always be superior to manual searching

pliant gulch
#

Regex is slow

#

You can just tokenize the sentence then use fuzzy searching

#

Better imo than regex here

#

There is just to many swear patterns for regex

maiden fable
#

@quaint epoch mind showing what u doing?

quaint epoch
hoary cargo
quaint epoch
#

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

hoary cargo
#

Then stop forcing other people using itFiaWTF

final iron
#

Its better doe

maiden fable
quaint epoch
#

the list of swears is soooo big, pydis paste tool doesn't support it

pliant gulch
#

Man's really bout a spend 2 days alone writing all the regex swear patterns

#

😔

maiden fable
#

Hahaha just skip the list of swears then @quaint epoch

hoary cargo
#

Damn

final iron
#

I am very persistent py_guido

maiden fable
#

Wait, BTW what kinda patterns u talking about?

pliant gulch
#

What I suggested is pretty effective and fast

maiden fable
#

Sure it is

pliant gulch
maiden fable
#

O

hoary cargo
#

Cringe servers be like you say fuck you get muted

maiden fable
#

Facts

hoary cargo
maiden fable
#

And u say duck or frick just to express yourself and not get muted in a normal convo only to see people reporting u to mods cz u r tryna evade the system 😐

#

What's your Python version?

pliant gulch
final iron
#

Windows 7 hyperlemon

maiden fable
#

And what's your dpy version?

maiden fable
final iron
wide rivet
#

It's not that bad to react like that

maiden fable
#

!d discord.version

unkempt canyonBOT
#

discord.__version__```
A string representation of the version. e.g. `'1.0.0rc1'`. This is based off of [**PEP 440**](https://www.python.org/dev/peps/pep-0440).
final iron
#

...

maiden fable
#

Wait, anyways, just reinstall dpy @slate swan

unkempt canyonBOT
#

discord.__version__```
A string representation of the version. e.g. `'1.0.0rc1'`. This is based off of [**PEP 440**](https://www.python.org/dev/peps/pep-0440).
wide rivet
#

What if he can't run code

hoary cargo
pliant gulch
maiden fable
#

Me who only searches for discord.gg/ in the message content instead of using regex for discord invites sadcat

pliant gulch
#

Instead just tokenize the sentence, then use fuzzy searching

#

!d difflib.get_close_matches

unkempt canyonBOT
#

difflib.get_close_matches(word, possibilities, n=3, cutoff=0.6)```
Return a list of the best “good enough” matches. *word* is a sequence for which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings).

Optional argument *n* (default `3`) is the maximum number of close matches to return; *n* must be greater than `0`.

Optional argument *cutoff* (default `0.6`) is a float in the range [0, 1]. Possibilities that don’t score at least that similar to *word* are ignored.

The best (no more than *n*) matches among the possibilities are returned in a list, sorted by similarity score, most similar first.
hoary cargo
maiden fable
#

!d dis

#

Yea thought so

pliant gulch
#

It is blocking though, so in an asynchronous enviourment your gonna want to run in executor

hoary cargo
quaint epoch
#

low just blocks very basic swears

maiden fable
quaint epoch
#

medium is a good amount detection, the kind that comes with profanity filter modules

unkempt canyonBOT
#

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

True
maiden fable
#

Okay I'm used to my bot's eval, sorry

quaint epoch
maiden fable
#

I have my own eval

quaint epoch
maiden fable
#

No

#

It's an owner only command

quaint epoch
pliant gulch
#

Would this also print True if the string was scrambled

maiden fable
pliant gulch
#

I might just be looking at this from a C language perspective though

hoary cargo
pliant gulch
#

Since strings are char arrays

honest vessel
#

await ctx.guild.edit_role_positions() docs want me to pass a list n positions, but how i just put 1 role at top?

quaint epoch
maiden fable
quaint epoch
#

mine works like:

#

e py print("hello world!")

maiden fable
#

(Ignore the message at the top)

quaint epoch
#

alr

hoary cargo
pliant gulch
unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

False
pliant gulch
#

ok nevermind kek

maiden fable
#

Ah that way

pliant gulch
#

Was looking at it differently

maiden fable
#

I guess then u gotta use split() and then check if each alphabet is there in a single word (totally not a good idea)

stable berry
#

hello i need some help

maiden fable
#

Sure

stable berry
#

@client.command(aliases=['user','info'])
@commands.has_permissions(kick_members = True)
async def whois(ctx, member : discord.Member):
embed = discord.Embed(title = "User info of"+ member.name , description = member.mention , color = discord.color.cyan())
embed.add_field(name = " Member's ID", value = member.id, inline = True )
await ctx.send(embed=embed)

maiden fable
#

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

wary zenith
#
@client.command()
async def email(ctx, sender, recipient, subject, *, body):
  global address, password
  if "`" in body:
    body = body.strip("`")
  message = MIMEMultipart()
  message["From"] = sender
  message["To"] = recipient
  message["Subject"] = subject
  message.attach(MIMEText(body, 'plain'))
  address = sender
  dm = await ctx.author.create_dm()
  await dm.send("Send me the password for your email.")
  msg = await dm.wait_for("message", check=ctx.author)
  password = str(msg.content)

  embed = discord.Embed(title=f"From: {sender}", discription=f"""To: {recipient}
  Subject: {subject}
  Body: 
  {body}""", color = discord.Color.blue())
  await ctx.send(embed=embed)``` What am i doing wrong
maiden fable
#

globals 😐😬

maiden fable
#

!botvars

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

maiden fable
maiden fable
#

Also your indents

slate swan
#

It doesnt

maiden fable
#

O good catch

#

Also color != Color

#

color is a file, Color is a class

slate swan
#

So basically @stable berry, you can't use Color.cyan

slate swan
#

If you want to use cyan color , just use 0x<hex for cyan color>

maiden fable
#

What's the issue bruv

hoary cargo
#

why people expect reading all their code without even telling what is not working

wary zenith
#

im trying to get the thing to ask for the password in dms, and wait for the response

#

then ill add code for deleting both messages

#

well i cant do that in dms oops

wary zenith
vale wing
#

Maybe you want this

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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**...
severe edge
#

can anyone explain this error?

wary zenith
vale wing
#

Check func

#
lambda m: m.channel.type == discord.ChannelType.private```
wary zenith
#

so that should be my check param right?

vale wing
#

And other things you need to check

#

Maybe author

vale wing
cinder horizon
#
    @commands.command(name="queue", aliases=['q'])
    async def queue(self,ctx):
        vc: wavelink.Player = ctx.guild.voice_client
        queue = [track for track in vc.queue]
        qstr=str()
        for idx, i in enumerate(vc.queue, start=1):
          to_add = f"{idx}.{i.query if isinstance(i, wavelink.PartialTrack) else i.title}\n"
          if len(qstr)+len(to_add) > 2000:
            #await ctx.reply(qstr)
            qstr= ""
            continue
          else:
              qstr += to_add
        length = len(qstr)
        embeds = []
        for i in range(length):
            embeds.append(discord.Embed(title=f"{len(queue)} Songs Playing", description=qstr))
        paginator = DiscordUtils.Pagination.CustomEmbedPaginator(ctx, remove_reactions=True)
        paginator.add_reaction('⏮️', "first")
        paginator.add_reaction('⏪', "back")
        paginator.add_reaction('🔐', "lock")
        paginator.add_reaction('⏩', "next") 
        paginator.add_reaction('⏭️', "last")
        await paginator.run(embeds)

i got this code fo now but wt happens is tht it jus sends the last embed....and wen i react it does not change the embed to the prev or next one or wtsoevr...help plish

vale wing
#

Only for private channel message waiting

maiden fable
#

!d discord.DMChannel is a class

unkempt canyonBOT
#

class discord.DMChannel```
Represents a Discord direct message channel.

x == y Checks if two channels are equal.

x != y Checks if two channels are not equal.

hash(x) Returns the channel’s hash.

str(x) Returns a string representation of the channel
stable berry
#

is there any problem in this

#
 embed.add_fields(name = "ID", value = member.id, inline = True )
#

bcs its showing syntax error in this line

maiden fable
#

field*

stable berry
vale wing
#

Your method is different but I don't really see what is better in it

vale wing
#

Probably

#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining.
stable berry
crisp bloom
#

I swear this was working before

#

It deletes the users message if its all caps

#

but it randomly stopped working

#

there is no error message so there isnt a mistake

vale wing
#

@crisp bloom wdym it stopped working

#

Stopped responding to literally everything?

#

Or stopped deleting caps messages

crisp bloom
slate swan
#

was the message all capped

vale wing
#

Could you give an example of cap message that was supposed to be deleted but wasn't

crisp bloom
vale wing
#

!e

print('SUP'.isupper())```
unkempt canyonBOT
#

@vale wing :white_check_mark: Your eval job has completed with return code 0.

True
vale wing
#

Could you copy that message content

slate swan
#

anyone here good at implementing email api into a script? i need help replacing one in something i have

crisp bloom
vale wing
honest vessel
#

wtf is this... <disnake.ext.commands.context.Context object at 0x7f95024f9a90> Command raised an exception: AttributeError: 'str' object has no attribute 'id'

await ctx.guild.create_role(name=role, color=self.colors[role], hoist=False, reason="Cause bad-ass bot")
                positions = {role: 3}
                print("Trying ordering")
                await ctx.guild.edit_role_positions(positions, reason="Ordering...")
vale wing
honest vessel
#

it complaing about ```py
positions = {role: 3}
await ctx.guild.edit_role_positions(positions, reason="Ordering...")

#

role is a string

onyx coral
#

can anyone help me with my discord bot?

#

when i put my filter word script my other commands wont work anymore

vale wing
#

Maybe you want to get a role object from ctx.guild.create_role that you called above

vale wing
#

!d
discord.ext.commands.Bot.process_commands

unkempt canyonBOT
#

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

This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.

By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.

This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").

This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
vale wing
#

!d discord.ext.commands.Bot.listen

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").

Example...
vale wing
#

These two ^

#

One of them

stable berry
#

Still not getting this 🥲

vale wing
stable berry
#

embed.add_field(*,name = "ID", value = str()member.id, inline=True )

vale wing
#

Not like this lmao

vale wing
#

str(obj)

stable berry
stable berry
vale wing
stable berry
#

Sorry if i am irritating anyone

vale wing
#

You are not dw

onyx coral
vale wing
#

Yeah

#

Replace @bot.event with this

@bot.listen('on_message')```
vale wing
#

It's better practice to use listeners rather than to overwrite events

stable berry
# vale wing You are not dw
embed.add_field(*,name = "ID", value = str(member.id), inline=True )
 await ctx.send(embed=embed)

Is this ok ?

vale wing
#

Yes

#

Hold up no

#

You don't need that asterisk

slate swan
#

* ?

stable berry
#

That's why i added

crisp bloom
#

This is what I did for a profinaty filter, I made a separate file with a million swear words, then just checked if the users message contains any word that matches with the one in the file

vale wing
vale wing
#

It means all arguments after * must be kwargs

onyx coral
vale wing
#

@onyx coral show new code

onyx coral
vale wing
#

You didn't replace it to what I said

#

Look more attentively

crisp bloom
#

shouldnt you use bot.event

#

@onyx coral

stable berry
#

Thanks @vale wing it worked

onyx coral
vale wing
crisp bloom
#

Cause bot.event gets triggered whenever someone sends a message

vale wing
#

@bot.event overwrites the internal event function of the bot, @bot.listen() does the same purpose but doesn't overwrite it and there can be several of them as well

crisp bloom
vale wing
#

Just add it as in the example @onyx coral

crisp bloom
#

this is how I do it

onyx coral
vale wing
crisp bloom
#

you need to process the command

vale wing
crisp bloom
#

await bot.process_commands(message)

slate swan
#

using process_commands inside a listener will make all the commands run twice

vale wing
#

@crisp bloom don't confuse people please

vale wing
crisp bloom
#

ok

onyx coral
vale wing
#

Yeah

#

Instead of @bot.event

onyx coral
#

thanks

#
  • sorry i didnt mean to ping you bot
#

but will i remove the "async def"

vale wing
#

@crisp bloom do you want me to explain why is @bot.listen() better and how to use it? It could improve your code btw

vale wing
onyx coral
vale wing
#

It should be

@bot.listen('on_message')
async def message_controller(msg):
   ... #your content?```
crisp bloom
#

this still doesnt work bruh

onyx coral
#

thx

vale wing
# crisp bloom sure

The main advantage of listen is you can create multiple of them and they all will be called once the event occurs. Also you don't need to, for example, do process_commands in on_message. You use it like

@bot.listen('event_name')
async def func(...):```
crisp bloom
#

I see...

honest vessel
vale wing
#

Like

@bot.listen('on_message')
async def automod(msg): ...

@bot.listen('on_message')
async def xp_controller(msg): ...```
slate swan
#

I am trying to make a button attach to an embed. I've seemed to be able to make buttons attach to a normal message with this:

###############################
#--- testbutton command ---#
@bot.command()
async def hello(ctx):
    await ctx.send("hello", components = [
        [Button(label="Hi", style="3", emoji = "🥴", custom_id="button1"), Button(label="Bye", style="4", emoji = "😔", custom_id="button2")]
        ])
    # button1 reaction
    interaction = await bot.wait_for("button_click", check = lambda i: i.custom_id == "button1")
    await interaction.send(content = "Button clicked!", ephemeral=True)
    # button2 reaction
    interaction = await bot.wait_for("button_click", check = lambda i: i.custom_id == "button2")
    await interaction.send(content = "penis", ephemeral=True)

but I can't seem to figure out how to make it go into an embed. anyone know how to help?

honest vessel
#

yeah was just a str needed object

slate swan
#

help please((

tidal hawk
#

prefix is not defined

slate swan
#

How to fix this?

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

I am on Vscode

oblique adder
slate swan
#

ok letme try

stable berry
#

@vale wing can u check once again

embed.add_field(name = "ID", value = str(member.id), inline=True )
slate swan
oblique adder
#

user.avatar.with_size(128) @slate swan

stable berry
slate swan
vale wing
slate swan
vale wing
#

You are using discord_components aren't you

stable berry
slate swan
#

3rd party library

slate swan
slate swan
vale wing
slate swan
slate swan
stable berry
vale wing
slate swan
oblique adder
spiral stratus
#

i need to get the user by userid which is in embed footer. how do i do that?

slate swan
blissful bone
#

Hey has anyone used the nextcord .py scheduled guild events stuff yet

vale wing
#

A while ago alpha version was released and now support of it is ended

#

Check pins to know how to install it

slate swan
quaint epoch
#

!d discord.Client

slate swan
#

so is dpy 2.0 better than normal?

unkempt canyonBOT
#

class discord.Client(*, loop=None, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
stable berry
#

@vale wing

@commands.has_permissions(kick_members = True)
async def whois(ctx, member : discord.Member):
 embed = discord.Embed(title = member.name , description = member.mention , colour = discord.colour.hex#00FFFF())
  embed.add_field(name = "ID", value = str(member.id), inline=True )
 await ctx.send(embed=embed)
vale wing
oblique adder
blissful bone
#

I'm attempting to make a discord events bot using nextcord.py/dpy and the discord official events but I'm having trouble with entity_type as its giving me an error type error str doesn't have attribute value and im confused about this

here is my command

@client.command(name='rp' ,help= 'creates an event')
async def rp(ctx, name=None, time =None, reason = None):
  #external = 
  channel = nextcord.utils.get(ctx.guild.channels, name = 'roleplay-sessions')
  await ctx.guild.create_scheduled_event(name=name, channel = channel, start_time = time, description = reason, entity_type = 'external')

Sorry for the large message

tidal hawk
onyx coral
#

@vale wing thanks for the help i appreciate it. my other cmds now work

slate swan
tidal hawk
#

i guess

slate swan
vale wing
slate swan
slate swan
slate swan
vale wing
stable berry
oblique adder
slate swan
slate swan
oblique adder
slate swan
blissful bone
slate swan
#

same goes for disnake too

#

both of them are decent libraries , id choose disnake tho

blissful bone
#

Have u used the function for scheduled guild events yet

#

I’ve been bashing my head over it

slate swan
#

ive moved to hikari , so i didnt tried anything new in discord.py forks

tidal hawk
# slate swan

You haven't defined prefix, so it doesn't know what to put between {}

slate swan
blissful bone
slate swan
#

is it added on the pypi version? ill test it

shadow wraith
#

hello what funny dpy/disnake discussion is going on

slate swan
#

why should one use a fork instead of 1.7.3 + 3rd party lib for components

blissful bone
#

I can’t figure out entity_type argument

blissful bone
slate swan
#

u need to use the class

#

!d nextcord.ScheduledEventEntityType.external

unkempt canyonBOT
maiden fable
#

Thought so

blissful bone
#

I’m such a idiot

slate swan
blissful bone
#

Thank u thank u my friend

maiden fable
#

There's a class

slate swan
#

yw

#

i mean , reading parameters docs is sometimes helpful

tidal hawk
#

ja nje panjmaju ruski

slate swan
coarse dawn
#

What discord python library should I use?

slate swan
grand shell
#

hey, im trying to install and use ffmpeg to play sounds in a discord bot, but no matter what I do, i keep getting error messages saying it isnt installed. does anyone know what to do?

coarse dawn
slate swan
#

does anybody know how to give someone a specific role when they press a button?

limpid thicket
#

How can I make it so you can parse a discord.Member object or just anything else as a Union if I'm correct, I've got here but unsure how to do what I mentioned.

(ctx, option = None, member: Union[discord.Member = None, ]):
slate swan
limpid thicket
#

Have you first defined your embed before adding footers?

slate swan
#

Function


@client.command()
async def reg(ctx, id:int = None):
    if id is None or id < 1000000000 or id > 999999999:
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
    elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() is None and c.execute(f"SELECT idd FROM faceit WHERE idd = {id}").fetchone() is None:
        c.execute(f"INSERT INTO faceit VALUES ({ctx.author.id}, {id}, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)")
        conn.commit()
        guild = client.get_guild(930223951190298685)
        calibr = guild.get_role(930354136824807434)
        try:
            await ctx.author.add_roles(calibr)
        except:
            pass
        embed = discord.Embed(title='Вы успешно зарегистрировались!', color = 0xfffafa, description=f'Ваш ID в игре Standoff 2 - {id}.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed = embed)
    elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() != None:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: Вы уже зарегистрированы под ID - {c.execute(f"SELECT idd FROM faceit WHERE id = {ctx.author.id}").fetchone()[0]}.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
    elif c.execute(f"SELECT idd FROM faceit WHERE idd = {id}").fetchone() != None:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: На данный ID уже зарегистрирован пользователь {client.get_user(c.execute(f"SELECT id FROM faceit WHERE idd = {id}").fetchone()[0])}.\nЕсли этот ID принадлежит вам, то сообщите в администрацию.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass   
limpid thicket
#

You need to define your embed. Do this by doing embed = discord.Embed(title=None, description=None)

#

The None can be changed as it' a placeholder for example.

#

Put that above before referencing.

limpid thicket
#

You can't add a footer to an embed which doesn't exist.

slate swan
#

i'm paste a code

#

After your line if id is None or id <... you need to define embed as you got told.

surreal sierra
#

hi, does anyone know why this doesnt work? the problem is that the bot is supposed to send the first embed that says you havent picked a number, the bot is supposed to send that embed when nr is None but it doesnt do anything at all.

So if I do my command ?dice but will send the first embed called error


# Gamble
@commands.command()
@commands.cooldown(rate=1, per=4)
async def dice(ctx, nr: int = None, bet: int = None):
    user = ctx.author
    users = await get_bank_data()
    n = random.randrange(1, 6)  # Where does it start and end
    # Errors
    error = discord.Embed(title=f"Dice_Error {frameinfo.lineno}",
                          description="You must pick a number between 1 and 6", color=discord.Color.orange())
    high_error = discord.Embed(title=f"Dice_Error {frameinfo.lineno}",
                               description="The number is too high, it must be between 1 and 6",
                               color=discord.Color.orange())
    low_error = discord.Embed(title=f" Dice_Error {frameinfo.lineno}",
                              description="You must pick a number between 1 and 6", color=discord.Color.orange())
    # Bet Errors
    bet_none_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
                                   description="You must place a bet, ur poor fuck", color=discord.Color.orange())
    low_bet_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
                                  description="The lowest amount you can bet is 10$, bet 10$ or more. Fucking stop being poor idiot",
                                  color=discord.Color.orange())
    high_bet_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
                                   description="You cant bet more than 10000$., u wish u had that luck huh?",
                                   color=discord.Color.orange())
    poor_bet_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
                                   description="You don't have that much money in your wallet. Fun fact, u are poor",
                                   color=discord.Color.orange())

    # Win or lost
    lost = discord.Embed(title=f"Sorry man, the dice landed on {n} and u lost {bet} coins", color=discord.Color.red())
    win = discord.Embed(title=f"CONGRATS MF, the dice landed on {n} and u won {bet * 3} coins",
                        color=discord.Color.green())
    print("Dice")
    if nr is None:  # You didn't pick a number
        return await ctx.send(embed=error)
slate swan
#

Well, you need to check first they didn't picked a number, not at the bottom.

#

Oh wait, it's just embed definitions, my bad.

surreal sierra
#

yea....

slate swan
#

Other commands work?

surreal sierra
#

yea other commands works just fine

surreal sierra
#

and the weird thing is that this command have worked perfect before, but it was a while ago and now it just doesnt work

limpid thicket
#

And you have made changes since yes?

surreal sierra
#

The only thing I can think about rn that I have changed is that I have now cleaned up the code in different files, instead of having it all in same python file

limpid thicket
#

What's frameinfo.lineno may I ask?

slate swan
#

Probably some emoji.

#

Oh wait, you've put that command in a cog?

surreal sierra
limpid thicket
#

Ok.

vale wing
#

@surreal sierra is it added to bot's commands or is it inside of a cog

surreal sierra
vale wing
#

K

slate swan
#

But in a cog?

limpid thicket
#

Wait a second.

surreal sierra
slate swan
#

It's in another file.

limpid thicket
#

If you're not using a cog I mean wait..

#

Should it not be @client.command() or whatever your client is defined as?

slate swan
#

Yep

#

Or @bot.command

#

Try to add self before ctx in the parameter list of the function.

limpid thicket
#

They are not using cogs tho.

quaint epoch
#

hello

vale wing
#

@surreal sierra do you have global error handler set up

slate swan
#

Then you can't move your command to a different file.

#

why not

#

!d discord.ext.commands.Bot.add_command

unkempt canyonBOT
#

add_command(command)```
Adds a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") into the internal list of commands.

This is usually not called, instead the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.command "discord.ext.commands.GroupMixin.command") or [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.group "discord.ext.commands.GroupMixin.group") shortcut decorators are used instead.

Changed in version 1.4: Raise [`CommandRegistrationError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandRegistrationError "discord.ext.commands.CommandRegistrationError") instead of generic [`ClientException`](https://discordpy.readthedocs.io/en/master/api.html#discord.ClientException "discord.ClientException")
vale wing
#

It might be eating your error

#

If you have

surreal sierra
# slate swan Or `@bot.command`

I had that first, but it just gave me errors, I have it in different files like u see here. The command is in casino.py and I have added all commands to the bot

grand shell
#

im trying to download a video using youtube_dl but i cant install ffmpeg. does anyone know what to do? thanks :))

slate swan
#

F

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
#

!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
humble granite
#

I'm confused. My Bot has a "kick" command in a cog and a error handler for permissions, .. I just started it and why does it send the error message TWICE. I even made a print in the error handler and it did only trigger 1 time

slate swan
#

you have the bot running twice maybe

humble granite
#

I've reset the token too

vale wing
humble granite
#

The on_message event is not even in my code :/, couldnt find a duplicated handler

placid skiff
#

can you show the error handler code?

humble granite
#
@commands.Cog.listener()
  async def on_command_error(self,ctx, error):
    if isinstance(error, commands.CommandNotFound):
        return await self.create_embed(ctx,f"Couldn't fint the chosen Command","Missing Permissions")
    if isinstance(error, commands.MissingPermissions):
      return await self.create_embed(ctx,f"You don't have enough permissions","Missing Permissions")
    if isinstance(error,commands.BotMissingPermissions):
      return await self.create_embed(ctx,f"The Bot needs the **{', '.join(error.missing_perms)}** Permissions","Missing Permissions")
    print(error)