#discord-bots

1 messages Β· Page 502 of 1

boreal ravine
#

you know when replies came out I didn't know what this did lmfao

boreal ravine
#

maybe they'll add a new thing called self bots again πŸ€”

slate swan
#

nop its againts their tos

#

imagine discord breaking their own tos

boreal ravine
#

I don't even know what self bots are even though I've used discord since 2018

slate swan
#

nop idc im bkocking you

boreal ravine
slate swan
#

the god damn pings BYE

boreal ravine
meager whale
#

Guys I want help in making a random command

#

For example my command is +joke

#

My bot shall tell a random joke I entered in him

#

Like that system which is in Java

#

Pls guys

outer violet
#

How do you make a ascii command in python?

manic wing
#

!e print(ord('A'))

unkempt canyonBOT
#

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

65
manic wing
#

!e print(chr(65))

unkempt canyonBOT
#

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

A
slate swan
hardy yoke
rigid island
#

heyyyyy anyone know js
as idk but ihave to convert js code to py

stark bobcat
slate swan
#

lmao

rigid island
#

there are translator for that

#

idk about that lol

slate swan
#

anyone know how i can filter my commands by cogs when calling /applications/{application_id}/commands via discord api?

#

note that this is a sepertated flask app, nothing i can take from my discord bot application

slate nymph
#

how do i make a tag script engine in my bot?

#

like they have in carl bot and dyno?

meager whale
#

What shall I do

#

Tell me

stark bobcat
slate swan
rigid island
stark bobcat
#

So 7 lines of code?

stark bobcat
rigid island
#

for(let i = 0; i < lyrics.length; i += 2000) {
    const toSend = lyrics.substring(i, Math.min(lyrics.length, i + 2000));
          const message_embed1 = new Embed.MessageEmbed()
            .setColor("RANDOM")
            .setTitle(`Lyrics`)
            .setDescription(toSend)
          message.channel.send(messaje_embed1)
}```
stark bobcat
#

What is this supposed to do

meager whale
#

I got it

#

It is a

#

Music bot lyrics command

rigid island
slate swan
#

Oh are you want rewrite it in python

rigid island
#

i'm facing problem of 2000line

rigid island
#

but i dont understand js 😦

meager whale
#

It is against the TOS

stark bobcat
#

!ytd

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)
rigid island
meager whale
rigid island
#

this is just to get lyrics

#

nothing wrong with it

slate nymph
#

you dont need youtube anymore for music

#

you can use spotify's music

#

api

rigid island
#

srry if it wrong or something i just wanna flex in front of my friends πŸ˜“

rigid island
slate nymph
#

πŸ‘

rigid island
#

bcos its just for lyrics but here the problrm is 2000 limit

#

on discord

#

that y i asked for help

slate swan
#
async def nation(self,ctx,nation):
   with open("generalaccess.json", "r") as f:
    data = json.load(f)

    if ctx.guild.id  in data:```
#

I have file with ctx.guild included but not working

slate swan
weak cobalt
#

What is scoping and type hinting

distant wagon
#

hi, does anyone know how i can make my bot download messages like images and pdf files? from the link provided as an argument (the link from the discord message)

tropic briar
#
@client.event
async def on_ready():
    while True:
        print("cleared")
        await asyncio.sleep(10)
        with open('spam.txt', 'r+') as file:
            file.truncate(0)

@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'r++') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1

        file.writelines(f"{str(message.author.id)}")
        if counter > 5:
            await message.guild.ban(message.author, reason='spam')
            await asyncio.sleep(1)
            await message.guild.unban(message.author)
            print("uh oh")

I am not able to ban someone when the same message is repeated more than 5 times

crimson sparrow
#

how do I nickname someone with custom emojis?

serene lynx
#

how to check author in buttons?

unkempt canyonBOT
#

Hey @serene lynx!

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

valid perch
valid perch
#

Define 'isnt working'.
Check how many times counter is incremented in the if, can we see the text file, print the author id

#

Isnt working isn't the most helpful statement

tropic briar
#

huh?

valid perch
#

"Check how many times counter is incremented in the if, can we see the text file, print the author id"

tropic briar
#

and if the message is different then counter = 0

valid perch
#

It should, and have you checked what it actually does?

tropic briar
#

and then if the counter == 5 ban

tropic briar
#

let's try that again

valid perch
#

Which part isnt working. Theres multiple things that could go wrong

tropic briar
#

When my friend types a message everytime I think it's not adding something to counter

valid perch
#

Does it write to the file?

tropic briar
#

Somone told me that the counter becomes 0 everytime I send message

tropic briar
#

I should even try doing that again

valid perch
#

Can you change r++ to r+ and try again?

tropic briar
#
@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'r++') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1
``` See counter = 0 on_message
tropic briar
valid perch
#

Do you have any plans to make this more complex?

tropic briar
#

No not for now

valid perch
#

Sweet as, just because if you did I'd say use a third party library or something that does most of the work for you.
But safe as, did the r+ thingy work. Does it write to the file now? Cos thats the first thing to fix

knotty badger
#

How would I get a channel ID where a user is connected using their user ID

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.
valid perch
#

Take a look through the docs for a connect channel on member's iirc

slate swan
left dove
knotty badger
#

I see the Member object but it doesn't seem like that has the channel ID included

crimson sparrow
slate swan
#

yes probably

slate swan
#

cuz i dont see them in partnered servers

crimson sparrow
crimson sparrow
#

yeah first time seeing it too for me

slate swan
#

not my first time

#

seen in couple times before

dim cedar
#

anyone for help?

crimson sparrow
left dove
#

its valorant?

crimson sparrow
#

ye

knotty badger
valid perch
dim cedar
#

what module should i import to make redditeasy defined?

crimson sparrow
#

it dosent seem like its part of any nicknames either

slate swan
#

a very gud

left dove
#

mate discord ded lol see

valid perch
valid perch
tropic briar
#

@valid perch It gives me error

#

When somone sends a message

#

FileNotFoundError: [Errno 2] No such file or directory: 'spam.txt'

#

This file is there

#

In the same folder

valid perch
#

Is it in the same directory as your bot?

#

Can we see

tropic briar
slate swan
dim cedar
#
@bot.command(aliases = ['m'])
async def meme(ctx):
  post = redditeasy.AsyncSubreddit(subreddit = 'memes',                              client_id='id here',
                                client_secret = 'secret',
                                user_agent = 'memes')

  postoutput = await post.get_post()

  em2 = discord.Embed(title = f'{postoutput.title}')
  url = postoutput.content
  
  em2.set_image(url = url)
  await ctx.send(embed = em2)```
#

redditeasy

slate swan
tropic briar
#

they are same?

slate swan
valid perch
slate swan
dim cedar
valid perch
valid perch
slate swan
#

^^^

dim cedar
tropic briar
valid perch
#

Welp i'm out. Repl

If python is saying moduleNotFound, then it's not installed in the enviroment

valid perch
tropic briar
#

ok

dim cedar
tropic briar
#

@valid perch It's still not working

#

but this time it write my ID in the file

valid perch
#

Thats progress

tropic briar
#

but no ban

valid perch
#

Progress is good

#

Now, lets see your updated code?

tropic briar
#

πŸ˜„

tropic briar
#
@client.event
async def on_ready():
    while True:
        print("cleared")
        await asyncio.sleep(10)
        with open('spam.txt', 'r+') as file:
            file.truncate(0)


@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'r+') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1

        file.writelines(f"{str(message.author.id)}")
        if counter > 5:
            await message.guild.ban(message.author, reason='spam')
            await asyncio.sleep(1)
            await message.guild.unban(message.author)
            print("uh oh")
    while True:
         print('counter')
valid perch
#

Why ddidd you add a while true?

tropic briar
#

To see How many time the counter updates

valid perch
#

That doesnt tho?

tropic briar
#

it's just not necessary

valid perch
#

It just prints counter forevery haha

tropic briar
valid perch
#

The print should be here
counter += 1

valid perch
tropic briar
tropic briar
#

lol

#

now ?

valid perch
#
counter += 1
print("Woah! I just incremented the counter")
#

...

tropic briar
#

uh huh ok let's try

#

It's working

valid perch
#

The whole thing?

tropic briar
#

I mean it prints "Woah! I just incremented the counter"

tropic briar
valid perch
#

However many times it prints is how many times that user is in the file

#

file.writelines(f"{str(message.author.id)}") Add a print statement after this line printing counter?

tropic briar
#

ok

#

So it print hmm after I send a message

valid perch
#

Code?

tropic briar
#
@client.event
async def on_ready():
    while True:
        print("cleared")
        await asyncio.sleep(10)
        with open('spam.txt', 'r+') as file:
            file.truncate(0)


@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'r+') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1
                print("Woah! I just incremented the counter")

        file.writelines(f"{str(message.author.id)}")
        print('hmm')
        if counter > 5:
            await message.guild.ban(message.author, reason='spam')
            await asyncio.sleep(1)
            await message.guild.unban(message.author)
            print("uh oh")
valid perch
#

"printing counter?"

#

It will always print hmm, we want to know what counter is

tropic briar
#

it prints hmm when I type a mesage

valid perch
#

"It will always print hmm"

tropic briar
#

really I don't think so

valid perch
#

Not sure if my messages arent sending or what, but please print counter

tropic briar
#

The value of counter right?

valid perch
#

Yep.

tropic briar
#
@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'r+') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1
                print("Woah! I just incremented the counter")
                print(counter)

        file.writelines(f"{str(message.author.id)}")
        print('hmm')
        if counter > 5:
            await message.guild.ban(message.author, reason='spam')
            await asyncio.sleep(1)
            await message.guild.unban(message.author)
            print("uh oh")
#

So it print's 1

#

but after it resets

valid perch
#

So that means your only in the file once

#

Wait

#

ugh, cmon dude. I asked you to print it after file.writelines(f"{str(message.author.id)}")

tropic briar
#

lol ok

#
0
hmm
cleared
0
hmm
Woah! I just incremented the counter
1
hmm
0
hmm
0
hmm
0
hmm
0
hmm
0
hmm
#

output

valid perch
#

Code?

tropic briar
#
@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'r+') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1
                print("Woah! I just incremented the counter")

        file.writelines(f"{str(message.author.id)}")
        print(counter)
        print('hmm')
        if counter > 5:
            await message.guild.ban(message.author, reason='spam')
            await asyncio.sleep(1)
            await message.guild.unban(message.author)
            print("uh oh")
valid perch
#

Whats the contents of your file look like?

tropic briar
#

txt file?

#

i can't see the ID now

#

it's empty

valid perch
#

What keeps clearing it

tropic briar
#

idk but I think it's not even adding the ID

valid perch
#

Lol I figured it out I think. Change r+ to w+

tropic briar
#

r+ oh yeh lol

#
0
hmm
0
hmm
0
hmm
0
hmm
0
hmm
#

Not writing

valid perch
#

Using w+?

tropic briar
#

The value should also increse

#
@client.event
async def on_message(message):
    counter = 0
    with open('spam.txt', 'w+') as file:
        for lines in file:
            if lines.strip("\n") == str(message.author.id):
                counter += 1
                print("Woah! I just incremented the counter")

        file.writelines(f"{str(message.author.id)}")
        print(counter)
        print('hmm')
        if counter > 5:
            await message.guild.ban(message.author, reason='spam')
            await asyncio.sleep(1)
            await message.guild.unban(message.author)
            print("uh oh")
valid perch
#

Maybe a+?

tropic briar
#

anwyays I maybe go ofline

valid perch
#

You can check out this if you want something that ddoes the work for you in the future

#

!pypi discord-anti-spam

unkempt canyonBOT
valid perch
#

Anyway adios and gl

tropic briar
#

alright I will use this

#

Thanks πŸ˜„

valid perch
#

Look at the custom punishments section for your usecase and @me if you want help with it

junior verge
#

Hey, I am looking for someone to make a youtube channel with about discord.py tutorials and on how to make bots. If you are interested dm me

valid perch
#

Why make one with someone, just make it yourself

#

*What benefits would someone get joining rather then doing it themselves

quasi pawn
#

does a music bot use a lot of memory?

proven elm
#

Why am I getting missing permissions error when trying to addrole

#

I am the owner of the discord and have all permissions

#

so idk why it says that

orchid talon
#

hi can anyon help me i am making a dc bot and ading a feature of giving role when member join my bot is online but it dont give role when member joins

heavy folio
proven elm
#

Bot has all permissions

#

hmm maybe thats it

heavy folio
#

well maybe not hierarchy

orchid talon
#

what

#

like mee 6 give auto role when member join if we setup

heavy folio
#

is the bot even online when ur doing it

orchid talon
#

yea

#

yea

heavy folio
# orchid talon

can u try putting something in on_ready like print("online")

proven elm
slate swan
#

God

heavy folio
#

oh nvm

orchid talon
#

???

#

i am confusing

heavy folio
#

i said do print("online")

orchid talon
#

means i put online insted of hey there i am online

#

btw i am new in python

proven elm
#

What do I use to force people to have specific permissions to use commands?

heavy folio
#

no bro i said do print

orchid talon
#

can give example of command

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
heavy folio
orchid talon
#

i k print

heavy folio
#

do print("online") in on_ready

orchid talon
#

which line i should

#

ok

heavy folio
#

delete this image

#

ur token bro

orchid talon
#

oh

#

btw i can regn

#

take thisi have hide it

#

@heavy folio

heavy folio
#

sec

orchid talon
#

k

heavy folio
#

gimme sec #bot-commands

orchid talon
#

k

heavy folio
#

dont use discord.utils

orchid talon
#

k

proven elm
#

Why am I getting this error?

orchid talon
#

is it ok

#

code

cloud dawn
proven elm
cloud dawn
primal mist
#

Hello! Im trying to make a bot which reacts to any messages send in a channel for a star board. However, im dead confused on how to do it, could anyone help? I know how to do the star board but not sure how to make it react to every message.

cloud dawn
# orchid talon

on_member_join you have ctx but it needs to be member since you are working with that object.

cloud dawn
unkempt canyonBOT
#

discord.on_raw_message_edit(payload)```
Called when a message is edited. Unlike [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), this is called regardless of the state of the internal message cache.

If the message is found in the message cache, it can be accessed via [`RawMessageUpdateEvent.cached_message`](https://discordpy.readthedocs.io/en/master/api.html#discord.RawMessageUpdateEvent.cached_message "discord.RawMessageUpdateEvent.cached_message"). The cached message represents the message before it has been edited. For example, if the content of a message is modified and triggers the [`on_raw_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_edit "discord.on_raw_message_edit") coroutine, the [`RawMessageUpdateEvent.cached_message`](https://discordpy.readthedocs.io/en/master/api.html#discord.RawMessageUpdateEvent.cached_message "discord.RawMessageUpdateEvent.cached_message") will return a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") object that represents the message before the content was modified.

Due to the inherently raw nature of this event, the data parameter coincides with the raw data given by the [gateway](https://discord.com/developers/docs/topics/gateway#message-update).
orchid talon
#

oh

supple thorn
proven elm
#

cause it only takes 1 argument currently

#

aka 1 role but I wanna add like 5 roles

orchid talon
cloud dawn
cloud dawn
orchid talon
cloud dawn
#

on role =... replace ctx with member thats it

heavy folio
orchid talon
#

hmm

#

i will try both ways

orchid talon
cloud dawn
#

member.guild.get_role()

#

You are using the member object so you will need to use the member variable

hasty iron
orchid talon
#

yea

hasty iron
#

then you should learn more python

boreal ravine
#

!resources

unkempt canyonBOT
#
Resources

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

hasty iron
boreal ravine
hasty iron
#

its from the same manga so i guess?

valid niche
# orchid talon

you know that when on_disconnect triggers the bot is already disconnected and isn't able to send stuff to discord anymore?

valid niche
#

you are getting a channel and trying to send to it

#

but you will never be able to send the message

#

because the bot disconnected

orchid talon
orchid talon
heavy folio
#

await ctx.guild.get_role(id)

hasty iron
boreal ravine
orchid talon
#

yea

valid niche
heavy folio
#

wait

valid niche
#

fetch_x is an API call and async

orchid talon
#

dident work

heavy folio
#

huh

boreal ravine
orchid talon
#

with id also

boreal ravine
#

And your code

#

that too

orchid talon
#

what

boreal ravine
orchid talon
#

no error but it is not giving role

quasi pawn
#

I have a temp vc code, how do I add the user who made the VC to the perms?

boreal ravine
valid niche
#

or you can edit the channel after the fact

#

but i recommend just passing them when creating the channel to avoid clutter

ornate basin
#

TypeError: Protocols with non-method members don't support issubclass() i got this error after trying to make a cog with slash commands

orchid talon
#

see

boreal ravine
#

not the name?

orchid talon
#

where name

valid niche
boreal ravine
#

why do u have 2 parentheses

valid niche
#

how long have you been doing python for?

valid niche
#

2 sets

#

also context.message.channel.send

orchid talon
proven elm
#

How can I check if the ctx.message.author has the correct role to do a command and if they dont then ctx.send

valid niche
#

instead of just doing ctx for the variable name and doing ctx.send

valid niche
#

and trust me when i say that discord bots isn't just some random learning project

#

discord bots require a good basic knowledge, and have a VERY specific way of writing

#

it's not something you'll often see

boreal ravine
orchid talon
#

no one on yt can teach python is good

boreal ravine
valid niche
orchid talon
#

hmm

valid niche
#

but they don't do dpy tutorials and i think that's for the best

#

also that random indian guy

boreal ravine
orchid talon
proven elm
hasty iron
orchid talon
primal mist
valid niche
boreal ravine
valid niche
#

anyways back on topic

proven elm
#

How can I check if the ctx.message.author has the correct role to do a command and if they dont then ctx.send

boreal ravine
proven elm
#

I already made it so ONLY users with correct roles and permissions can use a command but I wanna send a message to those who dont have correct roles saying "Sorry you cant use that"

proven elm
slate swan
#

!d discord.ext.commands.has_any_role

unkempt canyonBOT
#

@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.

Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.

This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
boreal ravine
boreal ravine
slate swan
#

Oh

proven elm
#

I just wanna ctx.send just like mee6 does if I try !ban someone

slate swan
#

!d discord.ext.commands.MissingRole Use an on_command_error event and compare the errror with this instance

unkempt canyonBOT
#

exception discord.ext.commands.MissingRole(missing_role)```
Exception raised when the command invoker lacks a role to run a command.

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

New in version 1.1.
hasty iron
#

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

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

how do i find the attributes for discord on raw payload thing

#

oh ty

boreal ravine
#

Can someone tell me how to leave a team on discord?

slate swan
#

@hasty iron any way i can find the attributes for payload?

hasty iron
#

have you even clicked the doc link

slate swan
hasty iron
slate swan
#

obviously lol

cloud dawn
#

Debug it

slate swan
#

paramters is different from payload

hasty iron
#

oh wow its not like there is hyperlink on payload's type

cloud dawn
#

πŸ˜‚

slate swan
#

wait payload has a hyperlink?

#

that bolded wdym

hasty iron
#

what is this??

boreal ravine
#

Can someone tell me how to leave a team on discord?

slate swan
#

mb'

boreal ravine
#

some idiot added me and i want out

cloud dawn
#

Unless you have gotten to the website and also accidentally done the survey and clicked okay that is a pretty impressive mistake.

boreal ravine
#

yes from my EMAIL and i want OUT

#

can soeone give me the invite to discord api server

cloud dawn
#

Just click on your badge and the "leave house"

boreal ravine
#

i cant do that

cloud dawn
#

Settings>Hypesquad

boreal ravine
#

im talking about teams

cloud dawn
boreal ravine
#

those are houses

cloud dawn
#

ahh

#

no idea

valid niche
boreal ravine
#

aight

valid niche
boreal ravine
#

i need 2auth

#

bruH ill brb

valid niche
#

then enter your 2FA code

proven elm
#

How do I make a hyperlink on clickable text

valid niche
#

hyperlinks outside of embeds are not possible

proven elm
#

no but look at the picture I sent

valid niche
#

[name](link)

proven elm
#

I want the "CMG LOCKED VEHICLES" thing

valid niche
#

the embed title has a URL kwarg, which makes it a hyperlink

reef shell
proven elm
#

thank you

cloud dawn
boreal ravine
valid niche
slate swan
unkempt canyonBOT
boreal ravine
cloud dawn
cloud dawn
reef shell
valid niche
boreal ravine
#

wasnt that always there?

valid niche
#

this is hover text @boreal ravine

reef shell
slate swan
#
@client.event
async def on_raw_reaction_add(payload):
    print("working")```

idk what im wrong
#

im not getting any errors either'

#

on_raw is supossed to be able to react to messages older then the internal cache right? so why it is not working :C

proven elm
#

Getting an error

slate swan
#

Thats the whole reason im using raw

#

@proven elm

valid niche
slate swan
#

It literally tells ya the problem

proven elm
#

ahhh

slate swan
slate swan
proven elm
#

fixed it thanks

valid niche
# slate swan

well a webhook is a whole different story, no authorization, no account, it just sends raw data and your client displays it as a message

slate swan
#

Yep

boreal ravine
proven elm
#

How can I run my python discord bot script on a VPS?

#

wont the VPS need the libraries etc

slate swan
hoary gust
#

guys is there any way to get all the channels of a list

hasty iron
#

all channels of a guild?

hoary gust
hasty iron
#

!d discord.Guild.channels

unkempt canyonBOT
slate swan
#

tag prefix ?

proven elm
jade jolt
#

pip install it?

boreal ravine
broken dirge
#

Is there an easy way to go to a website and copy specific href?

hoary gust
slate swan
hasty iron
#

[(channel.id, channel.name) for channel in Guild.channels] or something

slate swan
hoary gust
#

@hasty iron py [(channel.id, channel.name) for channel in guild.TextChannels]
it will return the data of text channels right?

hasty iron
#

no

hoary gust
#

so

hasty iron
#

Guild.TextChannels is not a thing

#

!d discord.Guild.text_channels

unkempt canyonBOT
#

property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
hoary gust
hasty iron
#

ok so what

hoary gust
#
guild = my_bot.get_guild(data.guild_id)
    text = [(channel.id, channel.name) for channel in guild.TextChannels]
hasty iron
#

im telling you it would raise an AttributeError

proven elm
#

alright thank you

slate swan
#

read what blanket said

hoary gust
#

ok so how can i get the text channels

hasty iron
slate swan
hoary gust
#

thanks

boreal ravine
#

How do I delete a webhook automatically? I found nothing on channel.delete_webhook.

hasty iron
#

!d discord.Webhook.delete

unkempt canyonBOT
#

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

Deletes this Webhook.
boreal ravine
#

thanks

#

i didnt know that was a thing

slate swan
#

you can fetch the webhook by discord.Client.fetch_webhook :p

boreal ravine
#

wait im stuck on how i delete it? I mean define it

boreal ravine
#

wait

#

So I want my bot to create a webhook > delete if after a command was invoked

slate swan
slate swan
# slate swan

Like in this image if would have added

await c.delete()``` the webhook would have got delete
boreal ravine
#

wait

#

brb

slate swan
#

!d discord.Client.fetch_webhook it takes webhook id as argument

unkempt canyonBOT
#

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

Retrieves a [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") with the specified ID.
boreal ravine
#

hmm thanks it worked

visual island
#

!d discord.AllowedMentions

unkempt canyonBOT
#

class discord.AllowedMentions(*, everyone=True, users=True, roles=True, replied_user=True)```
A class that represents what mentions are allowed in a message.

This class can be set during [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") initialisation to apply to every message sent. It can also be applied on a per message basis via [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for more fine-grained control.
boreal ravine
#

thanks-

#

Is this correct? ```py
bot = commands.Bot(command_prefix=commands.when_mentioned_or('.'), case_insensitive=True, intents = discord.Intents.all(), allowed_mentions=everyone=False)

slate swan
#

nope it's raises a 'everyone' not defined and syntax error

boreal ravine
#

then how does one do it

slate swan
#

allowed_mentions = discord.AllowedMentions(everyone= False)

boreal ravine
#

thanks it worked

frigid dune
#

How can I delete a message?

cloud dawn
frigid dune
#

Ok

reef shell
#

!d discord.Message.delete

unkempt canyonBOT
#

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

Deletes the message.

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

Changed in version 1.1: Added the new `delay` keyword-only parameter.
cloud dawn
#

We won't help code relating to youtube_dl

slate swan
#

how to add a react yo an embed guys

waxen granite
#

Add.reaction

slate swan
#

thx

cloud dawn
#

Still breaks ToS

visual island
unkempt canyonBOT
#

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

Add a reaction to the message.

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

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

Has anyone done a Auction system ? I would like to know how it works, please

slate swan
#

can you run 2 bots under one script??

bitter perch
#

Yes. Should you? No

fallow mauve
#

how do i change the color of my text in the middle of a message? i only know how to do this:

example
maiden fable
fallow mauve
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.

visual island
#

You can change the py to any language you want

fallow mauve
#

ok

boreal ravine
fallow mauve
#

ok

boreal ravine
#

invite doesn't even work 😐

boreal osprey
#

i think i did it wrong

steep estuary
#

where i will get the bot id?

boreal ravine
little ether
slate swan
boreal ravine
visual island
slate swan
visual island
#

[guild.name for guild in bot.guilds]

boreal osprey
#

so what do i add

#

oh

#

ok

steep estuary
#

a client id and bot id is same?

boreal ravine
#

wait

visual island
steep estuary
#

discord website is asking client id and bot id bot

visual island
#

in where exactly?

#

show a screenshot of it, would be really helpful

boreal osprey
#

i'm just trying to fetch the guild names that the bot is in

visual island
steep estuary
#

??

boreal ravine
waxen granite
#

Has anyone done a Auction system ? I would like to know how it works, please

boreal ravine
#

doesnt mention anything about a user tho

steep estuary
#

than why they asked same thing?

boreal ravine
#

ask the developers

boreal osprey
#

@visual island it still does the same thing

visual island
#

New one

boreal osprey
# visual island show code?
@bot.command()
async def guildlist(ctx):
    for guilds in bot.guilds:
     emb=discord.Embed(title = "List of guilds i am in", description = f'{bot.guilds}', color = discord.Colour.random())
    await ctx.send(embed=emb)
visual island
#

you're still putting bot.guilds there

boreal osprey
visual island
hasty iron
visual island
boreal osprey
visual island
#

yes

boreal osprey
#

include the brackets?

#

yay

#

it works

visual island
slate swan
#
from discord import Embed, File
from discord.ext import commands

client = commands.Bot(command_prefix='>')

token =β€œmy token here"

@client.event
async def on_ready():
    print('Connected to bot: {}'.format(client.user.name))
    print('Bot ID: {}'.format(client.user.id))
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name=f">help"))

@client.command
async def help(ctx):
embed = Embed(title="Azure", description="Created by Zolee")
embed.add_field(name=">help", value="Displays all available commands", inline=False)
embed.set_footer(text="Bot Coded by DarthOCE#8832")
await ctx.send(embed=embed)

    

client.run(token)``` i have no idea why this is not working
#

You can't have {} without anything in there

hasty iron
unkempt canyonBOT
#

disnake/client.py line 1126

def get_user(self, id: Optional[int], /) -> Optional[User]:```
lament mesa
lyric moat
#

i got this code and it does not work at all πŸ€·πŸΎβ€β™‚οΈ

embed=discord.Embed(title=title.content, description=description.content, color=0x2f3136).set_image(url=image.content)```
lyric moat
# left dove can u show full code
@client.command()
async def make_embed(ctx):
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel

    await ctx.send('Waiting for a title')
    title = await client.wait_for('message', check=check)
  
    await ctx.send('Waiting for a description')
    desc = await client.wait_for('message', check=check)
    
    await ctx.send('Waiting for an Image')
    image = await client.wait_for('link', check=check)

    embed = discord.Embed(title = title.content, description = desc.content, color = 0x2f3136)
    embed.set_image(url = image.content)```
lament mesa
#

link isnt a valid event

left dove
#

yea

bitter perch
#

It's a hell of a drug

#

There's a lotta disastrous code in that library

lyric moat
slate swan
#

instead of using fstrings

solemn grove
#

How to make the bot trigger on every message?

paper vector
#

hey

slate swan
paper vector
#

can anyone tell how to make a discord bot not look like a bot

slate swan
#

wdym?

paper vector
#

what is wdym

slate swan
#

what do you mean πŸ€¦β€β™‚οΈ

paper vector
#

oh

#

i am saying that i have a bot but it should not look like a bot or get a bot icon

solemn grove
slate swan
slate swan
#

is there anything that would sound or look like "if ctx.author.role.position < ctx.member.role.position:"?

#
if ctx.author.top_role.position < member.top_role.position:
``` i think im not sure
paper vector
#

i want to read my DMs using discord

#

mine not my bot's

hasty iron
#

click here

dusk pumice
#

Hi

paper vector
#

i am trying to read it using my code

hasty iron
#

so its a selfbot

paper vector
#

yes

cloud dawn
#

lol

#

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

paper vector
#

WAIT WHAT IS A SELFBOT

cloud dawn
slate swan
#

Hey guys by any chance can we do a command like +listserver that lists all the servers that the bot is in.

river kindle
#

I want that when a user calls a command a private channel is created visible to him and the admin, what can I do?

unkempt canyonBOT
#

property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
paper vector
#

so that is illegal

hasty iron
#

yes

cloud dawn
#

illegal ish it's the ToS of Discord

river kindle
#

I want that when a user calls a command a private channel is created visible to him and the admin, what can I do?

cloud dawn
#

We are not going to help with music bots.

slate swan
cloud dawn
unkempt canyonBOT
#

The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.

#

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

cloud dawn
#

npducky_dave

river kindle
#

hi guys, i needed help

I created two commands one to delete channels, and the other to create them, everything works only that they are created and the channels are public, but I want that when the channel is created it is visible only to the person who created it and to the staff, how can I do?

here the code:

@ client.command ()
async def delete (ctx, channel: discord.TextChannel):
  mbed = discord.Embed (
    title = 'Correct',
    description = f'Channel: {channel} has been deleted. '
  )
  if ctx.author.guild_permissions.manage_channels:
    await ctx.send (embed = mbed)
    await channel.delete ()

@ client.command ()
async def crearf (ctx, channelName):
  guild = ctx.guild

  mbed = discord.Embed (
    title = 'Correct',
    description = "{} has been created.". format (channelName),
  )
  if ctx.author.guild_permissions.manage_channels:
    await guild.create_text_channel (name = '{}'. format (channelName))
    await ctx.send (embed = mbed)```
slate swan
#

lmao imagine

slate swan
#

!d discord.TextChannel.set_permissions

unkempt canyonBOT
#

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

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
slate swan
#

the target's gonna be the yourGuildInstance.default_role

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.

slate swan
#

hm so i am trying to make an anti-nuke can anyone help me with the audit log part

#

anti-nuke?

half briar
#

How to play audio in voice channel

slate swan
slate swan
slate swan
#

there's no event named help

cloud dawn
#

as color put in 0x003df2 no string

slate swan
#

I'm quite sure

#

@commands.Cog

slate swan
cloud dawn
#

@commands.Cog.listener()

cloud dawn
#

I help a lot of people so i usually don't rember names that fast py_guido

slate swan
#

hmm

cloud dawn
#

!d discord.ext.commands.Bot.help_command

unkempt canyonBOT
cloud dawn
#

this lol

slate swan
#

does it work as listener?

cloud dawn
slate swan
#
@bot.event
async def help(ctx):```
cloud dawn
slate swan
#

NotLikeThis

#

the Dutch

cloud dawn
#

dw i fear them too

slate swan
#

why is the language just English, German and French mixed

cloud dawn
#

Anyways you need @bot.command() not @command.Cog.listener()

slate swan
#

literally tho

cloud dawn
#

more English though and they usually don't like to be compared to german ppl

half briar
#
source = await discord.FFmpegOpusAudio.from_probe("audio.mp3")
    vc.play(source)

Bot not play audio why

slate swan
#

OpusAudio?

#

what that do?

half briar
#

@slate swan no

slate swan
#

he's using a local file as u see

half briar
#

tts bot @slate swan

slate swan
#

that's pog lol

#

wait lemme check mine and help

cloud dawn
#

I recommend ffmpeg.

half briar
#

?

slate swan
#

oh ye

#

well he's using ffmpeg

#

just a different one, innit

cloud dawn
#

Then it's client instead of bot although that is bad naming.

half briar
#

Any one can help

slate swan
#
myString = 123
myInt = "Hello World!"
cloud dawn
#

Could i see the client variable and the error?

slate swan
#

ctx.voice_client.play(discord.FFmpegPCMAudio(source=f"temp.mp3"), after=leave)

half briar
slate swan
#

that's mine

#

you don't need the after

half briar
#

@slate swan i try this

slate swan
#

you probably don't have a leave function

#

so just remove that kwarg

cloud dawn
#

Do @client.command()

slate swan
#

How to make an exception in @has_permissions

For example, I have made a bot which only listens to those who have admin perms....I want the bot to make a special exception for the owner(me) even though I dont have admin role

cloud dawn
#

Name the function something other than help

slate swan
#

in your client constructor, put help_command=None

#

and your help command should work

cloud dawn
#

Yeah if you are making a help command i suggest subclassing it.

slate swan
#

even tho that's not how you make a help command

#

Put in py client=commands.Bot(help_command=None)

#

put
bot = commands.Bot(help_command=None)

slate swan
#

oh shoot

#

Lel

half briar
#

How to slove

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.

half briar
#

@slate swan what

slate swan
#

and then make your 3 hours journey on how to make it work

lyric moat
#

i got this code and it does not work at all πŸ€·πŸΎβ€β™‚οΈ

@client.command()
async def make_embed(ctx):
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel

    await ctx.send('Waiting for a title')
    title = await client.wait_for('message', check=check)
  
    await ctx.send('Waiting for a description')
    desc = await client.wait_for('message', check=check)
    
    await ctx.send('Waiting for an Image')
    image = await client.wait_for('link', check=check)

    embed = discord.Embed(title = title.content, description = desc.content, color = 0x2f3136)
    embed.set_image(url = image.content)```
slate swan
half briar
#

I think this is a discord function @slate swan

#

?

slate swan
#

ffmpeg?

half briar
#

Yes

slate swan
#

that's a sound playing lib....

#

or what it is

#

not a lib

half briar
#

Oo but how to install

#

This

hollow mortar
#
@bot.command()
async def kick(ctx ,member : discord.Member ,*, reason= None):
    await member.kick(reason=reason)
#

i have problem in this code

#

this error

slate swan
half briar
#

pip install ffmpeg @slate swan

slate swan
#

or that

half briar
#

?

slate swan
#

but ffmpeg is gonna have problems indeed

hollow mortar
#
Ignoring exception in command kick:
Traceback (most recent call last):
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 467, in _actual_conversion
    return converter(argument)
TypeError: 'module' object is not callable

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

Traceback (most recent call last):
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 855, in invoke
    await self.prepare(ctx)
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 789, in prepare
    await self._parse_arguments(ctx)

  File 
  File "C:\Users\Mohamed_Zeton\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 476, in _actual_conversion
    raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "discord.member" failed for parameter "member".```
slate swan
#

put it on path, install simpleaudio if not for discord, etc....

half briar
hollow mortar
slate swan
#

what did you type

hollow mortar
#

i did !kick @ the person i want to kick

slate swan
#

hmm

half briar
#

@slate swan any other mudule in play discord voice

slate swan
#

hmmm

#

no

half briar
#

😫

slate swan
slate swan
cloud dawn
# slate swan How to make an exception in @has_permissions For example, I have made a bot whi...

You could make a custom check ```py
def cust_has_permissions(**perms: bool) -> Callable[[T], T]:
invalid = set(perms) - set(discord.Permissions.VALID_FLAGS)
if invalid:
raise TypeError(f"Invalid permission(s): {', '.join(invalid)}")

def predicate(ctx: Context) -> bool:
    ch = ctx.channel
    permissions = ch.permissions_for(ctx.author)  # type: ignore

    missing = [perm for perm, value in perms.items() if getattr(permissions, perm) != value]

    if not missing or ctx.author.id in ([ctx.bot.owner_id] or ctx.bot.owner_ids):
        return True

    raise MissingPermissions(missing)

return check(predicate)
slate swan
hollow mortar
#

no idea how it wont work weird

slate swan
cloud dawn
slate swan
waxen granite
#

Auction Ends: 2021-09-29 15:35:21.472236 how do i avoid microseconds?
futuredate = datetime.datetime.utcnow() + datetime.timedelta(seconds=timewait)

slate swan
#

How can i fetch a message within a task?

cloud dawn
#

!d datetime.date.strftime

unkempt canyonBOT
#

date.strftime(format)```
Return a string representing the date, controlled by an explicit format string. Format codes referring to hours, minutes or seconds will see 0 values. For a complete list of formatting directives, see [strftime() and strptime() Behavior](https://docs.python.org/3.10/library/datetime.html#strftime-strptime-behavior).
slate swan
#

Or how can i pass ctx as an agruement in a task

cloud dawn
unkempt canyonBOT
slate swan
#

for example

cloud dawn
#

What do you need to pass?

slate swan
#

ctx

cloud dawn
#

ctx is like all the info

slate swan
#

to do ctx.fetch_message

cloud dawn
#

!d discord.TextChannel.fetch_message

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.
cloud dawn
#

or user

#

!d discord.User.fetch_message

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
#

ok thank you :)

twilit adder
#

….

boreal ravine
#

wait a couple minutes ig

twilit adder
#

hours prob 😭

slate swan
#

.reverse sud

lyric moat
#

why it does like this and does not send the embed?

slate swan
cloud dawn
slate swan
#

the error is wired

cloud dawn
#

it is not

slate swan
#

so what i did worng?

slate swan
cloud dawn
slate swan
#

you can't tell me?

twilit adder
boreal ravine
#

lmfao ^

cloud dawn
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

twilit adder
#

πŸ‘

#

i guess i gotta wait a day until i can start coding lemon_pensive

twilit adder
#

ok πŸ‘

lyric moat
# slate swan Send the code
@client.command()
async def make_embed(ctx):
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel

    await ctx.send('Waiting for a title')
    title = await client.wait_for('message', check=check)
  
    await ctx.send('Waiting for a description')
    desc = await client.wait_for('message', check=check)
    
    await ctx.send('Waiting for an Image')
    image = await client.wait_for('link', check=check)

    embed = discord.Embed(title = title.content, description = desc.content, color = 0x2f3136)
    embed.set_image(url = image.content)```
spring flax
twilit adder
lyric moat
boreal ravine
#

maybe wait for a link

slate swan
#

@cloud dawn all i have to do is just 2 spaces

boreal ravine
slate swan
#

because i didn't know it\

slate swan
dim wing
#

can adding an eval command to our bot be dangerous?

#

because i saw many people doing weird things with that command

spring flax
#

if you have it like @unkempt canyon's eval, it's fine

dim wing
#

Yeah because we can access to my bot computer?

sage otter
#

I mean if you only let select people have it. AMshrug

spring flax
#

either make it owner only, or make it like @unkempt canyon

slate swan
slate swan
#

Yeah it can get that bad, so be careful

dim wing
#

oh for instance someone download something illegal in your computer using this command?

spring flax
#

it can get your bot token leaked

#

and with that, a lot of bad stuff can happen.

slate swan
#

Main point is it is just dangerous and should not be done.

dim wing
#

oh yeah i see...

slate swan
#

By that I mean not done openly

#

Make it @commands.is_owner() a check for the bot owner

dim wing
#

yeah

bold fog
#

can anyone tell me how to set up a cog

#

please i am stuck

slate swan
slate swan
minor kestrel
#

One question, how have they done this in the last announcement message about python's v3.10 ?

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

waxen granite
#

Has anyone done a Auction system ? I would like to know how it works, please

jade jolt
minor kestrel
# slate swan !rule 7

yeah, the thing is I wanted to add a command for my bot to make events in the server

jade jolt
#

im pretty sure its a partnered server thing

minor kestrel
jade jolt
#

yep

slate swan
#

For*

boreal osprey
#

ban command won't work, and i'm the owner of the server

slate swan
#

it compares the roles ig , and the user may have role hierarchy above than yours

#

Send the code

boreal osprey
#

and the bot has perms

slate swan
#

could you show the code?

boreal osprey
# slate swan could you show the code?
@bot.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member, *, reason=None):
    emb=discord.Embed(title = "member kicked!", description = f'I have banned {member.name} from the server! Reason: {reason}, color 0xff0303')
    emb.add_field(name="responsible moderator", value=f'{ctx.author.mention}', inline = False)
    emb.set_thumbnail(url=f'{ctx.member.avatar_url}')
    emb2=discord.Embed(title=f"You have been banned from {ctx.guild.name}", color=0xff0303)
    emb2.add_field(name="Responsible Moderator:", value=f'{ctx.author.name}', inline=False)
    emb2.add_field(name="Reason:", value=f'{reason}', inline=False)
    await member.send(embed=emb2)
    await member.ban(reason=reason)
    await ctx.send(embed=emb)

@ban.error
async def ban_error(ctx: commands.Context,error: commands.CommandError):
 if isinstance(error, commands.MissingPermissions):
    message = "you are missing the `ban members` permission to run this command"
    await ctx.send(message)

 elif isinstance(error, commands.MissingRequiredArgument):
     message = "ping someone to ban them!"
     await ctx.send(message)

 elif(error, ArgumentParsingError):
     message = "You can't ban your self or anyone that is the same role as you or higher!"
     await ctx.send(message)
heavy gull
#

how do i make the bot edit a message?

boreal osprey
upbeat otter
#

Guys, why am i getting an indentation error in this?

@client.command()
async def lyrics(ctx, name):
  url = requests.get("https://some-random-api.ml/lyrics?title=" + name)
  if 300 > url.status_code >= 200:
      content = url.json()
      lyrics = content["lyrics"]
      link = (content["links"]["genius"])
      embed = discord.Embed(title=name.title(), description=lyrics, color=ctx.message.author.color)
      embed.set_footer(text=link)
      await ctx.send(content=None, embed=embed)
  else:
    await ctx.send("Lyrics Not Found")
heavy gull
boreal osprey
# heavy gull ok
@bot.command()
async def edittest(ctx):
    message = await ctx.send(f'{ctx.author.name} is cool')
    await asyncio.sleep(1)
    await message.edit(content=f'nah just kidding, {ctx.author.name} is an dumbass XD')
upbeat otter
#

in the embed= line

tough wagon
unkempt canyonBOT
#

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

Edits the message.

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

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

need some help with my bot as it isn't recognising any .json files :/

tough wagon
# upbeat otter Guys, why am i getting an indentation error in this? ```py @client.command() asy...

Your indentation is weird, this is the normal indentation:

@client.command()
async def lyrics(ctx, name):
    url = requests.get("https://some-random-api.ml/lyrics?title=" + name)
    if 300 > url.status_code >= 200:
        content = url.json()
        lyrics = content["lyrics"]
        link = (content["links"]["genius"])
        embed = discord.Embed(title=name.title(), description=lyrics, color=ctx.message.author.color)
        embed.set_footer(text=link)
        await ctx.send(content=None, embed=embed)
    else:
        await ctx.send("Lyrics Not Found")```
steep estuary
#

how to see if message.content have @ everyone or @ here

lyric moat
boreal osprey
#

bruhh can someone helpppp

tough wagon
steep estuary
#

wht is smth?

tough wagon
#

@ everyone or @ here

#

string

slate swan
# boreal osprey

The guy u tried to ban was having same role like u that's what I ig

slate swan
boreal osprey
tough wagon
upbeat otter
boreal osprey
steep estuary
boreal osprey
#

what is parsing error supposed to do

slate swan
slate swan
boreal osprey
#

@slate swan what do i do then ??

upbeat otter
#

giphy works fine

slate swan
unkempt canyonBOT
#

exception discord.ext.commands.ArgumentParsingError(message=None, *args)```
An exception raised when the parser fails to parse a user’s input.

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

There are child classes that implement more granular parsing errors for i18n purposes.
tough wagon
#

it can be everyone, here or bad words, anything

steep estuary
tough wagon
steep estuary
#

oo i can use if @ everyone in msg.content?

tough wagon
#

already said...

tough wagon
steep estuary
#

ooo

#

oops

#

lol

boreal osprey
tough wagon
#

@boreal osprey Check if your bot's top role is above user's and does bot have admin / ban users perms

steep estuary
#

how to check if message.author is an admin?

tough wagon
unkempt canyonBOT
#

property guild_permissions: discord.permissions.Permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership and the administrator implication.
tough wagon
#

please read the documentation and learn python first

steep estuary
#

i learnt python

tough wagon
steep estuary
#

ok

heavy gull
#

!d discord.Embed

tough wagon
heavy gull
#

srry

dapper cobalt
junior verge
#

Hey, I am looking for someone to make a youtube channel with about discord.py tutorials and on how to make bots. If you are interested dm me, (I know how to edit and design and how discord.py works πŸ™‚ )

tough wagon
#

or i am noob, if yes sorry

reef shell
dapper cobalt
reef shell
#

Yeah It's fine

brazen seal
#

someone can help me ?

steep estuary
#

what is the code to check if the message.author have perms to mention @ everyone @ here in if condition

tough wagon
tough wagon
unkempt canyonBOT
tough wagon
#

xd

reef shell
steep estuary
#

ohk

#
if message.author.guild_permissions.mention_everyone:
```??
hasty iron
#

yes

steep estuary
#

@ here is also same in that ?

reef shell
#

Same

tough wagon
#

yes

hasty iron
steep estuary
#

ok ty πŸ™‚

#

oh can bot use nitro emojis ?

tough wagon
steep estuary
#

also those emojis which are not in that server ?

hasty iron
#

the bot can use any emojis from any server its in

tough wagon
#

yeah

steep estuary
#

but how i tried it send None :/

tough wagon
hasty iron
#

you're using get_emoji?

steep estuary
#

i tried bot.get_emoji()

hasty iron
#

make sure you're passing in the correct id

tough wagon
#

it's not cached ig