#discord-bots

1 messages ยท Page 754 of 1

severe rampart
#

both of us said yes, so i'm sure one of us is correct

pliant gulch
#

E.g multi-choices Ranges, etc

#

Options

cloud dawn
#

!d disnake.ext.commands.Param

unkempt canyonBOT
#
disnake.ext.commands.Param(default=Ellipsis, *, name='', description=None, choices=None, converter=None, convert_defaults=False, autocomplete=None, channel_types=None, lt=None, ...)```
A special function that creates an instance of [`ParamInfo`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.ParamInfo "disnake.ext.commands.ParamInfo") that contains some information about a slash command option. This instance should be assigned to a parameter of a function representing your slash command.

See [Parameters](https://docs.disnake.dev/en/latest/ext/commands/slash_commands.html#param-syntax) for more info.
pliant gulch
#

Oh I found it

pliant gulch
#
@bot.slash_command()
async def multiply(
    interaction: disnake.ApplicationCommandInteraction,
    clean: str = commands.Param(converter=lambda inter, arg: arg.replace("@", "\\@")
):
    ...
``` imagine how this would look with many many many arguments!
cloud dawn
severe rampart
#

what command needs so many args?

pliant gulch
cloud dawn
pliant gulch
#

Either way you go about this

#

It just takes more space

cloud dawn
#

eh i don't agree

#

More based towards JS definitely. No argument there, but how it is handled rn is pretty good.

pliant gulch
#

commands.Param I would say isn't the best though

#

You can make custom typehints E.g Options[...]

cloud dawn
pliant gulch
#

But it still takes to much space!

#

This overall is just more towards discordjs side

#

๐Ÿ˜”

cloud dawn
#

I know it's not ideal but it doesn't suck that much.

#

Not fair i know :(

cloud dawn
severe rampart
#

that would be annoying to do if it was a slash command or not

pliant gulch
severe rampart
#

x3

cloud dawn
severe rampart
#

you ever typed pls profile?

pliant gulch
severe rampart
pliant gulch
#

Imagine making subcommands

#

๐Ÿ’€

cloud dawn
#

Andy has a point here i'd rather have it in the commands aswell rather than a menu every time.

#

Nvm wrong syntax in my head

#

don't do that

#

๐Ÿ˜‚

pliant gulch
#

I'm just trying to say that this takes up to much space

#

which is also one of my reasons why slash commands suck

cloud dawn
#

This is the amount of space it takes

#
    @slash_command(name="pypi")
    async def get_package_info(
        self, inter: ApplicationCommandInteraction,
        package: str = Param(autocomplete=autocomplete_pypi),
        hidden: bool = True
        ) -> Message:
        """ Provide information about a specific package from PyPI """
#

To maintain readability aswell.

#

You could smash it together but it will be annoying to read.

slate swan
#

how do i make an arg in a slash command required?

cloud dawn
#

Just like in Python

pliant gulch
cloud dawn
#

If you only typehint as string you would need to pass a string as arg.

pliant gulch
#

There is just no way this is scalable

slate swan
#

makes sense, thanks

cloud dawn
pliant gulch
#

Avoiding cause of the space it takes right?

cloud dawn
#

Well yeah but you don't need subcommands.

severe rampart
#

@cloud dawn hey again, [WARNING] Failed to overwrite commands in <Guild id=923632089834864690> due to 400 Bad Request (error code: 50035): Invalid Form Body In 1.description: Must be between 1 and 100 in length.

#

what's up with this error? ^^

cloud dawn
pliant gulch
cloud dawn
#

This is my old slash command back when it launched

#
    @cog_ext.cog_slash(
        name="together",
        description="Play games together or watch youtube!",
        guild_ids=[832595290174914571],
        options=[
            create_option(
                name="activity",
                description="Choose your activity",
                option_type=3,
                required=True,
                choices=[
                    create_choice(
                        name="Youtube",
                        value="youtube"
                    ),
                    create_choice(
                        name="Poker",
                        value="poker"
                    ),
                    create_choice(
                        name="Chess",
                        value="chess"
                    ),
                    create_choice(
                        name="Betrayal",
                        value="betrayal"
                    ),
                    create_choice(
                        name="Fishing",
                        value="fishing"
                    )
                ]
            ),
            create_option(
                name="private",
                description="Set visability to others",
                option_type=5,
                required=False
            )
        ]
    )
    async def _together(self, ctx: SlashContext, activity: str, private: bool = True) -> discord.Message:
pliant gulch
#

THAT'S WHAT I'M SAYINGG

#

๐Ÿ˜” there is no real good way about implementing a LITE version of this

cloud dawn
#

But it's not like this anymore Andy ๐Ÿ˜‚

pliant gulch
#

Discord API requires message command descriptions to be between 1-100 chars

severe rampart
#

._.

#

sad

cloud dawn
pliant gulch
#

If you want it empty use a zero width character

#

\u200b

severe rampart
pliant gulch
severe rampart
#

much wow

pliant gulch
cloud dawn
#

Andy i hated the previous slash commands libs aswell but Disnake is pretty decent.

pliant gulch
#

naw look at the function signature

#

Maybe my standards are to high but I like to keep code lite and simple

#

sadly not possible with slash commands

severe rampart
#

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ClientUser' object has no attribute 'avatar_url' how else should i be accessing this? this is how i've accessed it in the past

#

self.client.avatar_url

pliant gulch
#

avatar.url

severe rampart
#

that's new

pliant gulch
unkempt canyonBOT
#
Naw.

No documentation found for the requested symbol.

severe rampart
#

new as in new to me

cloud dawn
#

it's self.client.avatar.url

#

Since it's Disnake

severe rampart
#

welp

#

self.client.avatar.url works now ig x3

#

thankies

cloud dawn
#

!d disnake.Client.user

unkempt canyonBOT
#

property user: disnake.user.ClientUser```
Represents the connected client. `None` if not logged in.
cloud dawn
#

Return an asset object

unkempt canyonBOT
#

class disnake.Asset```
Represents a CDN asset on Discord.

str(x) Returns the URL of the CDN asset.

len(x) Returns the length of the CDN assetโ€™s URL.

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

x != y Checks if the asset is not equal to another asset.

hash(x) Returns the hash of the asset.
cloud dawn
#

If you were interested :3

final iron
#

Is there a way I can make certain slash commands global?

severe rampart
severe rampart
#

then it should be global, but it will take a bit to register is what i was told

cloud dawn
final iron
#

Also if I restart my bot, would I have to wait for my slash commands to register again or is it only a 1 time thing

cloud dawn
final iron
#

I know

cloud dawn
#

test_guilds are instant

#

As for global idk haven't done that yet since i don't need to.

final iron
#

Why don't you need to?

cloud dawn
severe rampart
#

but it would take a while

final iron
#

You didn't really answer my question

severe rampart
#

i do not :3

#

but i can find the vid

cloud dawn
severe rampart
#

that one :3

cloud dawn
final iron
#

If I restart my bot would I have to wait for the slash commands to be registered again (for global) or will it do it instantly since they had been registered in the past

severe rampart
#

@cloud dawn he says it around 3:53

final iron
cloud dawn
final iron
#

So what if I reload the cog?

severe rampart
#

any thoughts on that vid?

final iron
#

Would I have to wait for the command to register again?

cloud dawn
severe rampart
cloud dawn
severe rampart
#

like if i take away guild_ids =

#

does it stay registered?

cloud dawn
severe rampart
#

interesting

severe rampart
#

does the bot need to stay online whilst it registers?

final iron
#

I was just worried that even if I was messing with my prefix commands and restart the cog I would have to wait for my slash commands to register again

cloud dawn
severe rampart
#

ye

cloud dawn
final iron
cloud dawn
#

Grabbing the slash docs now.

final iron
#

But some people learn better through a video

#

So its understandable

cloud dawn
# severe rampart ye

If you are up for it could also show some cogs to get started. They are very nice :3

severe rampart
severe rampart
cloud dawn
#

Ah you coded bots before?

severe rampart
#

ye

#

the one i'm doing rn is on my github

#

i wonder if this button works for you lol

#

@cloud dawn

cloud dawn
#
An app can have the following number of commands:

100 global CHAT_INPUT commands
5 global USER commands
5 global MESSAGE commands
cloud dawn
#

Nice

severe rampart
#

nice, doesn't work for me lol

severe rampart
cloud dawn
severe rampart
#

what do those count as?

#

they just send a single message

final iron
cloud dawn
severe rampart
#

interesting

cloud dawn
#

Return a chat output and accessible for everyone.

final iron
#

What are user specific commands?

severe rampart
#

whats global message commands and global user commands

#

sounds weird

cloud dawn
final iron
#

I have the brain power to read

cloud dawn
#

Those are user commands

#

Message commands

#

Might add those :3

severe rampart
#

uh

final iron
#

I don't really understand a use case for those

severe rampart
#

oh interesting

#

stuff that i don't need to use :3

#

cool, ty

cloud dawn
#

Well you can have 5 of those xD

severe rampart
#

that's fine

final iron
#

I don't really like how they have the cap

cloud dawn
#
Global commands are available on all your app's guilds. Global commands are cached for 1 hour. That means that new global commands will fan out slowly across all guilds, and will be guaranteed to be updated in an hour.
#

Looks like your bot doesn't need to stay on @severe rampart

severe rampart
cloud dawn
#

Sorry ;-;

severe rampart
#

it's ok

#

besides that tho

#

what if it's invited to a new guild?

cloud dawn
severe rampart
#

does it take an hour to load the commands then?

cloud dawn
severe rampart
#

oh nice

#

:3

final iron
#

I'm still only going to make specific commands with them

#

I was going to change my reload command to a slash command so it can auto complete my cogs but with the cap idk if I want to do that

#

Auto complete is still very nice

cloud dawn
#

Later if my bot ever gets verified i will move my reload to my dashboard.

pliant gulch
#

Perhaps the 50/1s global ratelimit

cloud dawn
pliant gulch
#

Feel like it would only be the 50/1s ratelimit here

cloud dawn
#

There must be a valid reason why they are doing it like this.

pliant gulch
#

Well

cloud dawn
#

50 commands per 1/s?

pliant gulch
#

It's because guild specific slash commands are registered to the guild which has a unique int 64 id

#

registering global commands don't require a specific guild ID thus have a different endpoint

#

Meaning 1 request but 1 hour to register for global

#

While registering to all guilds manually you can just do 50 in a second

cloud dawn
#

Using choices instead of autocomplete so they can't input an invalid input :3

flat solstice
#

So I have this command (going to be a task event which runs every 6 - 24 hours, eventually) which searches through a channels history to find msgs that have embeds which match a list of keywords. I

  1. want my bot to look through the fetched msgs chronologically (oldest to newest)
  2. then for every message in that list I want to check if the message ID is not in my list of checked messages
  3. then I want it to check if the author of the msg is the same as the provided ID
  4. then I want it to check if the message contains a embed (It should do every time but doing this to be on the safe side)
  5. then I want it to check if any of the words in my key_words list appear in the embeds title
  6. if the key_words do appear then I want it to construct a new embed from the field values of the original embed
  7. then I want it to add the ID of the message it just checked to my list of checked msgs so that it won't check it again in future
    I think I have all of that logic correct but does someone mind checking over my code to double check this for me?
    I also have some additional stages that I'm not too sure how to implement so some idea's on how I could do them would be appreciated.
  8. I would like to be able to know which of my key_words it triggers on so that I can add that to my new embed inside of the {action} variable
  9. I would like to write the datetime timestamp of the last checked message to my last_chacked variable so that it won't check msgs before that again (jut saving on having duplicate new embeds)
    Below is my code, thank for you reading```py
    @commands.command()
    @commands.has_permissions(administrator = True)
    async def moderation_logs(self, ctx):
    key_words = ["WARN", "MUTE", "UNMUTE", "KICK", "BAN", "UNBAN"] # Add in Captilised versions of each word to account for the Dyno logs
    checked_logs = []
    case_count = 0
    last_checked = 0
    #dict = {}
    moderation = self.bot.get_channel(id = 885569667861717042)
    clifford_log = self.bot.get_channel(id = 500768218257031168)
with moderation.channel.typing():
    messages = await clifford_log.channel.history(oldest_first = True, limit = None, after = last_checked).flatten() # 10000
    for message in messages[0:]: # Making bot search history chronologically
        if message.id not in checked_logs:
            if message.author.id == 776782769312628746:
                if len(message.embeds) > 0:
                    if key_words in message.embeds[0].title:
                        embed = discord.Embed(title = f"Case {case_count} | {action}", colour = self.bot.config.error_colour, timestamp = message.timestamp)
                        embed.set_author(name = f"{message.embeds[0].fields[0].value} | {message.embeds[0].fields[0].value.id}", icon_url = message.embeds[0].fields[0].value.avatar_url)
                        embed.set_footer(text = f"{message.embeds[0].fields[1].value} | {message.embeds[0].fields[1].value.id}", icon_url = {message.embeds[0].fields[1].value.avatar_url})
                        embed.add_field(name = "Offender", value = message.embeds[0].fields[0].value, inline = True)
                        embed.add_field(name = "Moderator", value = message.embeds[0].fields[1].value, inline = True)
                        if message.embeds[0].fields[3]:
                            embed.add_field(name = "Duration", value = message.embeds[0].fields[3].value)
                        if message.embeds[0].fields[2]:
                            embed.add_field(name = "Reason", value = message.embeds[0].fields[2].value)
                        checked_logs.append(message.id)
                        await moderation.send(embed = embed)```
pliant gulch
final iron
pliant gulch
#

No clue lol

#

You'd be adding more stress onto discord by doing that, so wondering if discord has a safe guard or something

#

but so far I don't think so other than the ratelimit

cloud dawn
#

I would make the nesting a bit less since it is a bit much.

cloud dawn
hard trail
#

How do I make a bot ignore a channel?

flat solstice
hard trail
#
async def on_message(ctx):
  if ctx.channel.id == 899133612656558080:
    ... 
  if 'https' in ctx.content.lower():
    await ctx.delete()
    await ctx.channel.send(f"{ctx.author.mention}, you aren't allowed to send Links/Invite Links")
  await bot.process_commands(ctx)
#

I said if the channel that the message is being sent to should be ignored

#

but it isn't

#

what's the problem?

pliant gulch
flat solstice
#

also how could I go about finding out which of my key words it triggered on?

cloud dawn
#

But i keep <120 since otherwise it's way too long.

pliant gulch
#

Using 88 now because black says it's good

#

I was using 120 before

cloud dawn
#

Most of the times i don't reach 120 but i have set my IDE to give warnings if it is longer.

flat solstice
# cloud dawn https://paste.pythondiscord.com/hifiwodocu.py

Thanks, I can't implement those suggested changes bc my laptop just died and since it's 12.30 in the morning I'm going to take that as a suggestion I should go to bed ๐Ÿ˜… I'll probs keep the key words checker separate since I want to know which word it triggered on, which I'm still stuck on how to check but heyo that's something for another day

cloud dawn
#

Makes it a lot cleaner.

flat solstice
cloud dawn
#

You could then already do some checks to throw away unnecessary messages. And it would be much faster.

flat solstice
cloud dawn
#

Then i would've just made a database for it and put it there.

#

Using a Discord channel as database isn't really efficient.

slim ibex
soft trout
#

you know how some bots have slash command messages only available to the user?

#

how do i recreate that

soft trout
#

okay

#

do you have a document for that?

slate swan
#

Guys how can i modify this code

if any(word in message.content for word in ["Ghoul", "Town"]):
        await message.delete()
        sent_message = await message.channel.send('Ghoultest')
        hist[message.author.id] = sent_message

    if "MASSIVE" in message.content:
      await message.delete()
      if message.author.id in hist:
            await hist[message.author.id].edit(content = "Massive Ghoultest")

so it can detect words instead of

["Ghoul", "Town"]):

and execute this

if "MASSIVE" in message.content:

with a different

await hist[message.author.id].edit(content = "Massive Ghoultest")

Thanks

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

Sends a message to the destination with the content given.

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

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

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

THX

#

sry caps

cloud dawn
#

NP

left crater
#

can i make my bot react to old messages

quaint epoch
#

hola

quaint epoch
left crater
#

for example someone said !hello a long time ago can i make it respond

quaint epoch
#

!d discord.Message.add_reaction

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.
quaint epoch
left crater
#

i have a server with a memes section i want the bot to append all the images into a list

#

thats why i want it to work with older messages

quaint epoch
left crater
#

like whenever someone says !meme it will post a random meme from there

#
async def on_message(message, ctx : commands.Context):
    if message.channel.id == 699577970117050399:
        meme_list = []
        if message.attachments.url.endswith('png') or message.attachments.url.endswith('jpg') or  message.attachments.url.endswith('jpeg') or message.attachments.url.endswith('mp4') or message.attachments[0].url.endwith('gif'):
            url = message.attachments.url
            meme_list.append(url)
            list_len = len(meme_list)
            rand = random.randrange(list_len)
            await ctx.send(meme_list[rand])```
#

this is my code but not working

quaint epoch
left crater
#

yup

quaint epoch
#

!d disnake.Message.embeds

unkempt canyonBOT
quaint epoch
#

yup

#

im pretty sure that images are in embeds

#

so just get the embed, get images from them

left crater
quaint epoch
unkempt canyonBOT
quaint epoch
#

same thing

slate swan
#

Guys how can i combine this two

if any(word in message.content for word in ["Ghoul", "Town"]):
        await message.delete()
        sent_message = await message.channel.send('Ghoultest')
        hist[message.author.id] = sent_message
        return 
--------------------
    if "MASSIVE" in message.content:
        if message.author.id in hist:
            await message.delete()
            return await hist[message.author.id].edit(content ="Massive Ghoultest")

so if the first if-statement executes, it also executes the second if-statement
since i'm going to copy+paste this and change some things.

quaint epoch
slate swan
#

Guys how to make it so that a if-statement will only be executed if there's a specific value stored in a hist?

daring olive
#

!ban 932451931492843590 self-botting is against discord's terms of service and our rules

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @silver panther permanently.

rocky mist
#

SELF BOT

#

is it possible???

obsidian ledge
slate swan
#

Guys how to make my discord bot automatically stores the id of the recent message ? since the recent message will not always be the same.

final iron
slate swan
final iron
#

Use an on_message event

#

!d discord.on_message

unkempt canyonBOT
#

discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.

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

Warning

Your botโ€™s own messages and private messages are sent through this event. This can lead cases of โ€˜recursionโ€™ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
final iron
#

And you can get the id from that

unkempt canyonBOT
fading dirge
#

I was trying to create a self bot just for fun, but the user was only answering himself, not others users. Does anyone know how to fix it?

#

i am using cogs

green bluff
#

why do only 1 of these commands work

reef trail
green bluff
#

what are self bots

reef trail
#

basically code that would run a bot running a normal user account.

green bluff
#

oh damn

arctic vapor
#

yo quick question, which wrapper should i be using?

reef trail
#

whichever you find the easiest

#

for me, im using dpy2.0, i made my own slash handler

slate swan
reef trail
#

^

slate swan
#

of dpy

arctic vapor
#

I mean, i used to use d.py long time ago, but just came back and saw its been stopped, so i have no clue what to use

slate swan
#

like disnake

arctic vapor
#

ouu disnake, okay

reef trail
slate swan
reef trail
#

you can totally maintain it yourself

slate swan
#

many forks that are good but i like disnake more imo

slate swan
green bluff
#

any help with this

#

why does only 1 work

reef trail
reef trail
green bluff
#

listener?

reef trail
#

@bot.listen() i think

#

one sec

slate swan
#

not quite

#

now

reef trail
#

forgot the ()

slate swan
#

yep

reef trail
#

cant you name events in @bot.listen()

slate swan
#

yes you can

#

doesnt matter really

reef trail
#
@bot.listen(name="on_message")```
slate swan
#

correct

reef trail
#

oh? for me in cogs, you need to name it if you wanna use multiple on_message events

slate swan
#

!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...
green bluff
#

okay so

#

if i add that would it work

slate swan
#

yes

#

and no need to process commands

green bluff
#

got it thanks

reef trail
#

I would know how to do all of this if i started the way everyone else is starting, but i started with cogs and forced myself to learn how they worked by trial and error sunglasses_fiilis

green bluff
slate swan
last brook
#

HI

reef trail
#

in a way they arent and really are

green bluff
reef trail
#

gotta add code to that listen so it doesnt error things below

slate swan
#

well you have a random decorator there

green bluff
#

okay so no decorator

slate swan
#

no

#

you just cant have a random decorator without a function

green bluff
#

its on on_ready right

slate swan
#

yes

green bluff
#

ur talking about the decorator on on_ready

slate swan
#

no

#

the listener

reef trail
#

okay @client.listen needs to be removed

#

if you need to have an on_message event or any event for that, use @client.listen

green bluff
#

oh

#

so do i put the client.listen into the on mesage command

reef trail
#

yes

green bluff
reef trail
#

remove @client.event

#

you cant have both decorators

green bluff
#

surwe

quaint epoch
#

should i keep my library of swears in a .json file, since they are very large, and they're sets

green bluff
#

client.event doesnt have a decorator but sure

quaint epoch
#

i could use tuples instead tho

slate swan
reef trail
# green bluff

in this screenshot, you have @client.event above your @client.listen()

slate swan
green bluff
#

so it cant overwrite itself am i right

quaint epoch
slate swan
heavy radish
#

Undefined name 'message'. Do I need to import anything?

heavy radish
#

ahh

slate swan
#

you have context

green bluff
#

so the bot.listen thing worked so i tried in a chatlogs channel

#

i literally just said a

#

and it spammed it like 10 times

#

oh yea i figuired out the problem

#

maybe if the user is administrator dont send message in chatlogs

#

yea i can just do that

#

still does the spamming

slate swan
#

it will keep sending the messages since its waiting messages from all users including itself

heavy radish
#

I just forgot, ๐Ÿ˜ข. It's in COGS

slate swan
maiden fable
#

Wait what's commands.listen?

slate swan
maiden fable
#

๐Ÿคทโ€โ™‚๏ธ

heavy radish
#

I was goings to do event but people said listen is better

slate swan
#

is the cog instance

heavy radish
#

Cog being the name of the folder right?

slate swan
#

no

#

thats the Cog class

heavy radish
#

ok

slate swan
#

which you subclass

#

class cog_name(commands.Cog):

heavy radish
#

Okay. Mine is class Miniboss(commands.Cog):

slate swan
#

nice

green bluff
#

and my bot has admin

#

so it wont check my bot right?

slate swan
#

dont think so

#

use an if statement and compare the author id with the bot id

#

you don't use that decorator on on_message events

#

It's meant for commands

#

!d discord.Member.guild_permissions . administrator will be true if the member is an admin

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

doesnt it still work

#

oh wait you ment the has perms

slate swan
#

oh so thats the reason lol

green bluff
#

@commands.has_permission(admin=fakse)

slate swan
#

no

#

admin is not a perm

green bluff
#

ik

slate swan
#

fakse isnt a bool

green bluff
#

administrator

#

@commands.has_permissions(administrator=False)

slate swan
#

Still no

green bluff
#

how do i use that

slate swan
green bluff
#

yes

slate swan
#

@green bluff you are doing something like if member sends a message , and they are not an admin
The message gets logged , right?

slate swan
slate swan
#

Ah , use use if message.author == bot.user : return

green bluff
#

if member.author is 'botid':

#

someithing like that?

#

oh okay

slate swan
#

same thing

green bluff
#

what do i put in the function tho

slate swan
#

you put it in the function?

green bluff
#

no like the : function of the if

#

message.author ==

#

bot.user

#

what would i put

slate swan
#

there's a return already

green bluff
#

in that

slate swan
#

wut

green bluff
#

oh

full valley
#

dmcap2 = await cap2.send(embed=dm2)
await dmcap2.add_reaction('1๏ธโƒฃ')
await dmcap2.add_reaction('2๏ธโƒฃ')
await dmcap2.add_reaction('3๏ธโƒฃ')


def check(reaction, user):
    return str(reaction.emoji) in ['1๏ธโƒฃ', '2๏ธโƒฃ', '3๏ธโƒฃ', '4๏ธโƒฃ'] and user != bot.user and \
           user == cap2 and reaction.message == dmcap2 and isinstance(reaction.channel,
                                                                      discord.DMChannel)


try:
    reaction, user = await bot.wait_for('reaction_add', timeout=45, check=check)
except asyncio.TimeoutError:
    await ctx.channel.send('timeout')
    return
else:
    if str(reaction.emoji) == '1๏ธโƒฃ':
        team2_ids[game_id - 1].append(b[0])
        await cap2.send(f"You have chosen <@!{b[0]}> as your first pick")
        b.remove(b[0])
    if str(reaction.emoji) == '2๏ธโƒฃ':
        team2_ids[game_id - 1].append(b[1])
        await cap2.send(f"You have chosen <@!{b[1]}> as your first pick")
        b.remove(b[1])
    if str(reaction.emoji) == '3๏ธโƒฃ':
        team2_ids[game_id - 1].append(b[2])
        await cap2.send(f"You have chosen <@!{b[2]}> as your first pick")
        b.remove(b[2])

My bot doesnt seem to be picking up reactions from users in dm's, any ideas?
could be my check but idk shrug

green bluff
#

so return

slate swan
#

!e if 1==1 : return #ez

#

bruh

#

nvm , there was not function

#

what was that sarthak

#

I'm used to my bot's eval

#

LMAO

slate swan
slate swan
green bluff
slate swan
green bluff
#

this?

slate swan
#

you don't compare channel type with the instance

green bluff
#

was that for me orrr

full valley
#

oh what is it? just reaction.channel?

slate swan
slate swan
soft lynx
#

is there an attribute for message to check if it starts with something, on a message event

green bluff
#

sure but someone told me to use is over == before

unkempt canyonBOT
#

str.startswith(prefix[, start[, end]])```
Return `True` if string starts with the *prefix*, otherwise return `False`. *prefix* can also be a tuple of prefixes to look for. With optional *start*, test string beginning at that position. With optional *end*, stop comparing string at that position.
soft lynx
#

thanks!

green bluff
#

whats the difference just saying

slate swan
#

Basically , message.content.startswith

soft lynx
#

alrighty

slate swan
slate swan
#

but functions are called methods lol

#

Same for every language

#

yeah

soft lynx
#
@client.event
async def on_message(message):
    await client.process_commands(message)
    if not message.content.startswith("["):
      await message.channel.send("x")

this just spams "x" over and over

slate swan
slate swan
#

check author

slate swan
soft lynx
#

this isnt supposed to be a user-specific event

slate swan
soft lynx
#

oh

soft lynx
#

ohh, because the message "x' is from the bot,,,, right

slate swan
#

yessir

slate swan
green bluff
#

it doesnt send the embed

#

oh disnake oops

slate swan
#

but methods are like functions in python but less complicated

#
def double number = 0
    puts number * 2
end
#

this doubles the arg given

#

not sure why define isnt highlighted

#

when im using the ruby code block but i like

end

in ruby it just shows where the actions ends

full valley
#

just goes to timeout

sage otter
slate swan
sage otter
#

Shit like thag doesnโ€™t exist in python because everything is dependent on indentation.

full valley
#

dmcap2 = await cap2.send(embed=dm2)
await dmcap2.add_reaction('1๏ธโƒฃ')
await dmcap2.add_reaction('2๏ธโƒฃ')
await dmcap2.add_reaction('3๏ธโƒฃ')


def check(reaction, user):
    return str(reaction.emoji) in ['1๏ธโƒฃ', '2๏ธโƒฃ', '3๏ธโƒฃ', '4๏ธโƒฃ'] and user != bot.user and \
           user == cap2 and reaction.message == dmcap2 and isinstance(reaction.channel,
                                                                      discord.DMChannel)


try:
    reaction, user = await bot.wait_for('reaction_add', timeout=45, check=check)
except asyncio.TimeoutError:
    await ctx.channel.send('timeout')
    return
else:
    if str(reaction.emoji) == '1๏ธโƒฃ':
        team2_ids[game_id - 1].append(b[0])
        await cap2.send(f"You have chosen <@!{b[0]}> as your first pick")
        b.remove(b[0])
    if str(reaction.emoji) == '2๏ธโƒฃ':
        team2_ids[game_id - 1].append(b[1])
        await cap2.send(f"You have chosen <@!{b[1]}> as your first pick")
        b.remove(b[1])
    if str(reaction.emoji) == '3๏ธโƒฃ':
        team2_ids[game_id - 1].append(b[2])
        await cap2.send(f"You have chosen <@!{b[2]}> as your first pick")
        b.remove(b[2])

Any other ideas why it just goes to timeout even after the user interacting?

#

am I doing something blatantly wrong

heavy radish
#
@bot.listen()
async def on_message(message):
  mbcommand = bot.get_channel('932479943441543238')
  if message.author == bot.user:
    return
    
  if message.channel.id == 932479913565511710 and message.content.startswith('Congratulations to'):
    await mbcommand.send(f'`RPG miniboss {message.content.split("Congratulations to ")[1]}`')
    await message.channel.send(f'The miniboss command to copy and paste was sent in `[#932479943441543238](/guild/267624335836053506/channel/932479943441543238/)`')

I'm trying to send the (f'`RPG miniboss {message.content.split("Congratulations to ")[1]}`') to another channel and i get error

soft lynx
#
@client.event
async def on_message(message):
    await client.process_commands(message)
    if message.author != client.user:
        if message.channel.id == 930302167825403944 or 930301694389129276 or 930302000791437402 or 930302065715064853 or 931374309962838076 or 931374741560918036 or 931376262142914611:
          if not message.content.startswith("["):
            ....
#

the if loop to check message channel id is passing even if the message was not sent in one of those channels

slate swan
brittle jay
#

How can I wait for both buttons and SelectMenus at the same time?

#

Or I can't?

maiden fable
slate swan
#

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

it does ic

slate swan
#

Sure

spring flax
#

Do dropdown menus have a time in which after that time they don't respond to the interactions?

#

the last interaction was like 8 hours ago or more and I didn't put a timeout on the dropdown menu but it's saying the interaction failed

slate swan
#

and you use View for the view of the dropdown why not use the timeout kwarg?

spring flax
#

Because I want users to be able to press it anytime

slate swan
#

ah

#

replace the view

spring flax
#

Won't restarting the bot do the same though?

slate swan
#

no

#

your bot doesnt replace a view

spring flax
#

Why replace it though?

slate swan
#

so its a new one which can be interacted with

spring flax
#

but i want the users to be able to use the dropdown anytime

#

without me having to replace the view

#

it can't be permanent?

slate swan
#

well yes when a bot restarts it will stop listening from interactions so just replace the view with a new one of the same thing tldr edit the message with a new view

spring flax
#

but the bot didn't restart, other commands still work

slate swan
#

ah ic idk then why it stopped

spring flax
#

apparently when i replaced the views they still don't work not sure why it is working yesterday and I didn't change anything

slate swan
#

weird

pliant gulch
spring flax
#

Oh i see thanks

hard trail
#
async def on_message(ctx):
  for word in naughty_words:
    if word in ctx.content:
      if ctx.author.guild_permissions.manage_messages:
        
        ...
    else:
        await asyncio.sleep(3)
        await ctx.delete()
        await ctx.channel.send(f"{ctx.author.mention}, you aren't allowed to say that!")
  await bot.process_commands(ctx)```
#

The bot keeps malfuctioning every time a swear word is said

#

how do i fix that

#

Ping me if you know how to solve

hard trail
slate swan
#

no need to iterate through it

#

!e

a = ["something","somethingelse","badstuff"]

if "badstuff" in a:
    print("dont say that")
unkempt canyonBOT
#

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

dont say that
quick gust
#

it should be message

slate swan
#

argument naming

quick gust
#

?

maiden fable
slate swan
maiden fable
#

Yea ik

quick gust
#

still looks weird ngl

edgy finch
#

how to make bots

#

!resources

#

please

slate swan
edgy finch
#

tysm

slate swan
#

yw

hard trail
slate swan
sinful fern
#

Does on_message take ctx

#

I thought it just took messsge

torn sail
#

Just message

slate swan
#

its argument naming doesnt matter

sinful fern
#

Hmm

#

Really

#

Never knew

green bluff
#

no error

#

no response

#

nvm it works

#

sorry it was the wrong role

sour inlet
#

does anyone know why ctx.author.avatar_url doesn't work when I use it in an extension?

#

it was fine when I had it in my main file

vale glen
#

Any tips on growing a discord bot?

sour inlet
# spring flax what's the error?

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'

#

no idea why it's hapenning

sour inlet
spring flax
#

which version of discord-py are you on

#

you can run pip show discord.py in your terminal

sour inlet
#

2.0.0a3575+g45d498c1

spring flax
#

you're on v2

sour inlet
#

oh no there's a v3 right

spring flax
#

nope

#

Then to get the avatar url it is member.avatar.url, not member.avatar_url

sour inlet
#

ohh

#

thanks

slate swan
vale glen
potent spear
#

just implement external API's... so it's actually useful

vale wing
#

Make a 300$ bid on top.gg auction and there you go

#

sillySmile ๐Ÿ‘

devout iris
#

Should i do;

if message.author_id == {id} and message == ....  :
    ....

For check message from an user.

#

????

vale wing
#

Also what are you going to compare message with?

boreal ravine
#

that will return false

devout iris
vale wing
#

I guess he just put it for example, there's no brackets in code

devout iris
#

How can i check content from a specific user

vale wing
#

Compare message author's id and user's id

devout iris
#
if message.author.id == 580332673289945099 and message.content == "hello":
    ....
vale wing
#

id is an int

devout iris
#

Like that?

vale wing
#

Not a string

devout iris
#

Ah

vale wing
#

So compare it with int

devout iris
#

K

vale wing
#

Yeah

devout iris
#

Ah tysm ๐Ÿ‘

#

Also can u send a link for tasks.loop?

vale wing
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
devout iris
#

Thx

vale wing
#

Show code

#

Remove token from there bro

#

You don't need to process commands in on_command_error iirc

devout iris
#

to send a message continuously at certain intervals, should I do this?

@tasks.loop(seconds = 10 )
async def message(ctx):
    if message.author.id == 580332673289945099 and message.content == "hello":
    await ctx.send("hello")

For Check message content and user

vale wing
#

Just remove it from there

edgy finch
#

talk in yr own dms

edgy finch
#

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

devout iris
vale wing
#

It should only be in on_message but there's no that event

edgy finch
#

i get a lot of notification

vale wing
#

Disable all messages notifications?

edgy finch
#

tysm

vale wing
#

Lmao do you really have them on

edgy finch
#

for telling,

#

btw how to make bots?

#

?\

#

k

#

did it

#

how to make discord bots

#

hello?

#

bc?

#

wats bc?

valid perch
#

Why does it look like your trying to handle errors and new messages in the same event?

edgy finch
#

okay

honest vessel
#

can anyone explain why 4 are locked? all i did was move each role to position 99 or 1

boreal ravine
#

how do I invoke a command using a command but the author is someone else? kinda like jsk's jsk exec @user command command

boreal ravine
edgy finch
#

idk

honest vessel
#

@boreal ravine but why arnt orange locked etc they all are roles created with no perms

boreal ravine
#

orange is below the purple role

honest vessel
#

oh

slate swan
#

You cannot edit your role and the roles above yours.

honest vessel
#

that kinda messed up

#

i mean its just for colors

#

cant timeout one if they have pink etc

#

even tho i have admin they not

orchid bay
#

Hi

honest vessel
#

hi

edgy finch
#

hi

slate swan
#

bye

heavy radish
#

The embed part (Last 3 lines) looks off

dire folio
#

It looks alright

#

What is ur problem

#

Wdym

quick gust
# honest vessel that kinda messed up

Usually servers with colour roles, have rest of the roles (staff roles and others) with no colour so the colour roles can be at the bottom of the hierarchy

slate swan
#

code and traceback if any

quick gust
#

the code, and the full traceback (error)

#

what does it say? that is what a traceback is

#

full traceback means, complete error

slate swan
#

show the event

quick gust
slate swan
#

on msg doesnt take all of that

quick gust
#

why do you have a error handler in a on_message event...

slate swan
#

and error handlers are for commands

maiden fable
#

U r looking for on_command_error

quick gust
#

nvm u don't

maiden fable
#

Also it takes ctx and error as args only

quick gust
#

but remove ctx and error

#

from on_message

slate swan
#

who

quick gust
#

Okay so all your error handlers go in on_command_error

slate swan
#

who was that monster

maiden fable
quick gust
#

Not in on_message

slate swan
#

as on the name on_command_error

loud junco
loud junco
quick gust
#

infact you don't even need an on_message event if all you had inside it is what u showed

loud junco
#

btw
help ;-;

quick gust
#

with?

loud junco
quick gust
#

more than one if statement, change it to elifs

vale wing
# loud junco

Replit db? Whatever it is you are accessing it in a weird way dunno certainly tho

vale wing
#

Also why do you want to call attribute of function

#

You probably need to declare an object of custom class

loud junco
#

i dun wanna repeat the same var everytime i use them

vale wing
#

That's common python OOP

loud junco
#

oo

#

u mean class?

vale wing
#
class MyData():
    def __init__(self):
        ...```
Yes
loud junco
#

okok

vale wing
#

There must be a better way anyway

loud junco
#

like this?

#

i havent touch class for ages

#

but it looks weird

#

im sure its wrong

boreal ravine
loud junco
#

=.=

boreal ravine
#

it's sync, wont work well with discord bots

loud junco
#

ok

prime inlet
#

im tryna do pip install praw, but it says I have invalid syntax, bcos I need to get a meme api

prime inlet
loud junco
#

and install it manually

#

...

boreal ravine
prime inlet
#

how, im pretty new to python so im not sure how to do that

boreal ravine
#

not the IDE part

loud junco
boreal ravine
#

that is basic python lol

loud junco
#

right here

prime inlet
#

oh ok

#

then

loud junco
#

and type in pip install blahblah

prime inlet
#

oh ok

#

thx

loud junco
#

np

#

!d class

unkempt canyonBOT
#

A template for creating user-defined objects. Class definitions normally contain method definitions which operate on instances of the class.

loud junco
#

help ;-;

boreal ravine
# loud junco

__init__ can only be a normal method/function, not an async one

#

what are you even trying to do?

loud junco
#

without scoping error

#

cuz i dun wanna call them everytime i use it

boreal ravine
#

but why not use a real database?

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!

loud junco
#

i cant use bot.var cuz

#

all the var needs a var that is call userid

#

and userid = ctx.author.id

devout iris
#

Can i add a few libs to my code?

loud junco
devout iris
#

i.e. i imported cv2 but not working....

loud junco
#

as long as u need them just add them

loud junco
#

and type
pip install [packages]

devout iris
#

i'm using vsc

loud junco
#

oo

devout iris
#

Also i have opencv-python

#

in my pc

loud junco
#

go packages

#

search for it

devout iris
#

i just need import it to my code but there is error

devout iris
loud junco
#

:/

#

go to packages and search for the packages u want

devout iris
#

smh

loud junco
#

?

edgy finch
#

hi guys

devout iris
#

i just am saying"i have cv2 lib" but when i import this lib, an error occuring....

loud junco
#

hi

edgy finch
#

wat are going?

loud junco
#

i saw it somewhere in stackoverflow

loud junco
#

to hell

edgy finch
#

ok๐Ÿคฃ

loud junco
#

@devout iris this one?

heavy radish
#

Anyone

boreal ravine
#

just use a proper db

prime inlet
#

with pyton app.py, where do I put it?

loud junco
#

i dun get it

prime inlet
#

no idea either

loud junco
#

what is that

#

why do u put it there

prime inlet
loud junco
#

are u trying to run the code?

prime inlet
#

heres the tutorial im following

loud junco
#

put the python app.py in a terminal

prime inlet
prime inlet
loud junco
#

idk no idea

boreal ravine
# prime inlet

don't blatantly copy code if you don't know what it does

slate swan
#

Sometimes it happens to me

heavy radish
#

Ahhh, I did ] instead of } ๐Ÿคฆโ€โ™‚๏ธ

slate swan
heavy radish
#

Well, I could'nt start a new command

boreal ravine
heavy radish
#

Ahh, That wasn't the prob

slate swan
#

U forgot } in **__Message__**{arg}

heavy radish
#

Yes

loud junco
#

whats this

heavy radish
#

A mistake

loud junco
#

LOL ok

heavy radish
#

I fixed it, Thank You

loud junco
#

:D

slate swan
#

please help im new

#

hm

brittle axle
slate swan
#

yepp

brittle axle
#

which library?

slate swan
#

uh

#

im new

brittle axle
#

-_-

slate swan
#

so yeah idk

brittle axle
#

what did you import

slate swan
#

lol

brittle axle
#

to make music bot

slate swan
#

how do I start a coroutine thread while bot is running?

#

i changed pc in my past pc it worked perfectly @brittle axle

#

same code just other pc

brittle axle
#

bro

#

im asking which stuff did you import

#

at the start of the code

slate swan
#

yeah wait

#

theres a lot

brittle axle
#

copy paste it here

slate swan
#

from discord import activity, channel
from discord import embeds
from discord.embeds import Embed
from discord.ext import commands 
from discord.ext.commands import Bot 
import asyncio 
import math
import itertools
import random
import functools
import platform
from discord.ext.commands import has_permissions 
import discord 
from discord.ext import commands 
import platform
import datetime 
import json 
from datetime import datetime
from asyncio import TimeoutError
from discord.ext.commands import BadArgument
from discord.ext.commands import Context
from discord import Member
from discord.ext.commands import EmojiConverter
from discord.ext.commands.cooldowns import BucketType
from discord.flags import Intents 
import praw
from discord_components import * 
import DiscordUtils
from discord_interactions import verify_key_decorator, InteractionType, InteractionResponseType
import datetime
import aiohttp
import requests
from discord.utils import get```
#

lmao

brittle axle
#

what the hell

#

but anyways

slate swan
#

told ya

brittle axle
slate swan
#

oh

brittle axle
#

use another library like youtube dl or switch programming languages from python or js

slate swan
#

so what can i do

brittle axle
#

pretty much any library other than youtube dl dosent work for music bots with python

slate swan
#

without changing the whole code

#

oh

brittle axle
#

you can switch to js though im making a music bot with that

slate swan
#

so i must code again ?

brittle axle
#

yes

slate swan
#

im done

#

thanks though

brittle axle
#

welcome

heavy radish
#
@bot.listen()
async def on_message(message):
  Unlock = discord.PermissionsOverwrite(send_messages=True)
  Lock = discord.PermissionsOverwrite(send_messages=False)
  Role = ctx.guild.default_role
  if message.channel.id == 814207750342705164 and message.content.startwith('RPG miniboss', 'rpg miniboss'):
    await ctx.channel.set_permissions(Role, overwrite=Unlock)

What i'm trying to do is, get the BOT to open the channel when someone says rpg miniboss then lock the channel after 5min. How do I do so?

heavy radish
brittle axle
#

?

heavy radish
#

I feel like I've done half of it. (Correctly I believe) and i'm stuck now

brittle axle
#

lemme try it later

#

im in class rn

heavy radish
#

Ok. If anyone is online, you can also try help me

brittle axle
#

which role's id is it?

heavy radish
brittle axle
#

oh channel

#

sorry

heavy radish
#

Just default @ everyone

#

Oh okay. NP

brittle axle
#

reading it from first glance i think the code is correct

#

output it and see if there are bugs

heavy radish
#

Ok

brittle axle
heavy radish
brittle axle
#

lemme think

brittle axle
heavy radish
#

No. It has to be an on_message

brittle axle
#

can you show any errors youve got?

heavy radish
#

Woah, No errors. But I have the green line

brittle axle
#

green line?

heavy radish
#

The Lock var is understandable since I didn't use it

brittle axle
#

that means python updated its defenition of what on_message is from the previous line

heavy radish
#

Ok

brittle axle
#

thats why a green line is there

heavy radish
#

So what do I do? Is that a prob?

brittle axle
#

is the older command working or is this the only command that is not working?

#

just a sec

#

lemme take the api docs for a second

heavy radish
#

My WiFi is lagging

brittle axle
#

do you have intents.messages enabled?

brittle axle
heavy radish
#

I'm so sorry. Send it and i'll see it once its stable

#

I'm so sorry. All I see is a rush of messages

brittle axle
#

oh ok

brittle axle
tacit token
#

Hello! How can I add more embeds to a button?

fossil vessel
#

ๆœ‰่ฎฒไธญๆ–‡็š„ๅ—

tacit token
#

ๅชๆ˜ฏไธ€้ปž้ปž

vale wing
#

Add embeds to a button?

#

Wth

tawdry perch
unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

tacit token
#

I want the buttons to have more embeds

heavy radish
final iron
brittle axle
heavy radish
#

Nope

brittle axle
#

enable it

#

thats why it didnt work

heavy radish
#

so intents.messages=True ??

heavy radish
tacit token
#

guys, why not work the 5. embed?

brittle axle
#

go to bot section

#

intents

#

and enable all

brittle axle
heavy radish
#

Done

tacit token
tacit token
heavy radish
brittle axle
heavy radish
#

Ok. So what do I do for that?

brittle axle
#

hmm

#

lemme think

heavy radish
brittle axle
heavy radish
#

Ok, Give me a moment. Let me write the code.

#

Can you think of a way to lock the channel after 5min?

cedar stream
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

heavy radish
cedar stream
unkempt canyonBOT
#
I don't think so.

No documentation found for the requested symbol.

final iron
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
cedar stream
#

That

heavy radish
tacit token
#

bro wtf

#

nothing space

final iron
#

Whats the error

tacit token
#

embed.add_field(name="Moderation",value = "Moderation Commands")
^
IndentationError: unindent does not match any outer indentation level

cedar stream
#

Stops

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

tacit token
#

nothing space

cedar stream
#

Read this pls

#

Wdym

#

You have indentation error

tacit token