#discord-bots

1 messages · Page 643 of 1

prisma spoke
#

@maiden fable

maiden fable
#

And me getting young ngl

prisma spoke
#

proof m sending it before

upbeat otter
#

send code

#

again

maiden fable
#

Yea

#

I don't wanna scroll up since I am.... lazy

upbeat otter
prisma spoke
#
async def register(ctx):


    def check(msg):
        return msg.channel == ctx.channel and msg.author == ctx.author

    view1 = Confirm()


    embed=nextcord.Embed(description="Do you wish to continue?", color=nextcord.Color.blurple())
    await ctx.send(embed=embed,view=view1)
    await view1.wait()

    if view1.value is None:
        embed=nextcord.Embed(description=f"❎ Timed Out!")
        await ctx.send(embed=embed)
    elif view1.value:
        
        try:
            with open("usersforteams.json", "r") as f:
                users = json.load(f)

            channel = await ctx.author.create_dm()

            
            await channel.send("Please enter your in-game name!")
            msg = await bot.wait_for('message', check=check,  timeout=60)
            ign = msg.content
            await channel.send("Please enter your in-game user ID!")
            msg = await bot.wait_for('message', check=check, timeout=60)
            uid = msg.content




            if str(ctx.author.id) in users:
                return await channel.send("❎ You have already registered!")
            elif str(ign) in users:
                return await channel.send("❎ This in-game name already exists!")
            elif str(uid) in users:
                return await channel.send("❎ This in-game user-id already exists!")
            else:
                users[str(ctx.author.id)] = {}
                users[str(ctx.author.id)]["IGN"] = ign
                users[str(ctx.author.id)]["UID"] = uid
                embed=nextcord.Embed(description=f"✅ You have been registered!")
                await ctx.send(embed=embed)

                
            with open("usersforteams.json", "w") as f:
                json.dump(users,f)
            return True


        except asyncio.TimeoutError:
            embed=nextcord.Embed(title="❎ Timeout to respond!",description=f"{ctx.author.mention} this process has timed out! Please re-do the process again if you wish to register!")
            await channel.send(embed=embed)
            return
    else:
        embed=nextcord.Embed(description=f"✅ Process Cancelled! ")
        await ctx.send(embed=embed)
        return
maiden fable
#

!code dude

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.

maiden fable
#

My eyes 😬

upbeat otter
prisma spoke
#
@bot.command(aliases=["reg"])
async def register(ctx):


    def check(msg):
        return msg.channel == ctx.channel and msg.author == ctx.author

    view1 = Confirm()


    embed=nextcord.Embed(description="Do you wish to continue?", color=nextcord.Color.blurple())
    await ctx.send(embed=embed,view=view1)
    await view1.wait()

    if view1.value is None:
        embed=nextcord.Embed(description=f"❎ Timed Out!")
        await ctx.send(embed=embed)
    elif view1.value:
        
        try:
            with open("usersforteams.json", "r") as f:
                users = json.load(f)

            channel = await ctx.author.create_dm()

            
            await channel.send("Please enter your in-game name!")
            msg = await bot.wait_for('message', check=check,  timeout=60)
            ign = msg.content
            await channel.send("Please enter your in-game user ID!")
            msg = await bot.wait_for('message', check=check, timeout=60)
            uid = msg.content




            if str(ctx.author.id) in users:
                return await channel.send("❎ You have already registered!")
            elif str(ign) in users:
                return await channel.send("❎ This in-game name already exists!")
            elif str(uid) in users:
                return await channel.send("❎ This in-game user-id already exists!")
            else:
                users[str(ctx.author.id)] = {}
                users[str(ctx.author.id)]["IGN"] = ign
                users[str(ctx.author.id)]["UID"] = uid
                embed=nextcord.Embed(description=f"✅ You have been registered!")
                await ctx.send(embed=embed)

                
            with open("usersforteams.json", "w") as f:
                json.dump(users,f)
            return True


        except asyncio.TimeoutError:
            embed=nextcord.Embed(title="❎ Timeout to respond!",description=f"{ctx.author.mention} this process has timed out! Please re-do the process again if you wish to register!")
            await channel.send(embed=embed)
            return
    else:
        embed=nextcord.Embed(description=f"✅ Process Cancelled! ")
        await ctx.send(embed=embed)
        return
maiden fable
tawdry perch
#

how do I pass perms integer to this? ```py
perms = ctx.channel.overwrites_for(role)
perms.send_messages = False

upbeat otter
maiden fable
maiden fable
tawdry perch
#

I need to pass a overwrites..?

maiden fable
#

It's an old problem for which he's asking for help when u were asleep/gone Eevee

tawdry perch
#

Hmm

upbeat otter
tawdry perch
#

I can try

#

So I will not pass overwrites?

maiden fable
maiden fable
#

amount is a string

#

Lol

maiden fable
#

😐

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @prisma spoke until <t:1638361789:f> (9 minutes and 59 seconds) (reason: newlines rule: sent 115 newlines in 10s).

maiden fable
#

Thanks for deleting

#

Bruh

boreal ravine
#

Whats the event for when a command gets invoked

maiden fable
#

<@&831776746206265384> any help?

maiden fable
unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

vocal magnet
#

!unmute 885006461002977280

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @prisma spoke.

maiden fable
#

Bruv

vocal magnet
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

prisma spoke
#

thanks

upbeat otter
#

oof

maiden fable
#

Anyways it's on_command

vocal magnet
#

Use this for large text @prisma spoke

maiden fable
#

Thanks Chris!

prisma spoke
boreal ravine
maiden fable
#

Yea

#

And the param is ctx

boreal ravine
#

Doesn't exist?

maiden fable
#

The bot is having a stroke

prisma spoke
#
Traceback (most recent call last):
  File "C:\Python310\lib\asyncio\tasks.py", line 458, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 173, in register
    msg = await bot.wait_for('message', check=check,  timeout=60)
  File "C:\Python310\lib\asyncio\tasks.py", line 460, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 67, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TimeoutError:```
maiden fable
#

And now tell me which wait_for is there in Line 173

prisma spoke
vocal magnet
#

you have msg = await bot.wait_for('message', check=check, timeout=60) on line 173

prisma spoke
maiden fable
#

Game?

prisma spoke
#

write ur ingame name one..

vocal magnet
#

you have told it to timeout after 60s

#

when it times out, it raises that error

vocal magnet
#

so just try/except that error

prisma spoke
maiden fable
#

But it's triggering before 1 min, as he is saying

prisma spoke
prisma spoke
maiden fable
#

Yes same thing

#

Wait

vocal magnet
#

Have you saved the file, and restarted your bot?

maiden fable
#

Nvm

prisma spoke
#

lemme do it once again

brave flint
boreal ravine
vocal magnet
upbeat otter
vocal magnet
#

what are you looking for?

boreal ravine
#

hm

maiden fable
unkempt canyonBOT
#
NEGATORY.

No documentation found for the requested symbol.

upbeat otter
boreal ravine
#

!d discord.Client

#

it isn't having a stroke

maiden fable
#

Most of the other classes work

boreal ravine
#

it doesn't exist?

maiden fable
#

Only with some of them

boreal ravine
#

!d discord.ext.commands.Command

boreal ravine
#

thanks

maiden fable
#

O it's in the commands namespace

vocal magnet
#

on_command doesn't exist.

maiden fable
#

Still the bot doesn't recognize it

prisma spoke
#

alr i did it

prisma spoke
#

@vocal magnet but same issue

vocal magnet
#

Ahhh

jaunty sparrow
#

@prisma spoke I'm looking at the code you tried to send but I see no try-except

prisma spoke
#

@maiden fable told to..

vocal magnet
#

I'm guessing the symbols aren't setup correctly for it in the docs

boreal ravine
#

two admins nice

prisma spoke
#

so we were finding the error

jaunty sparrow
#

!paste Try sending your code here vvv

unkempt canyonBOT
#

Pasting large amounts of code

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

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

upbeat otter
#

there isnt any event for checking commands invoked

maiden fable
maiden fable
prisma spoke
maiden fable
vocal magnet
#

Yea, we can only use what the auto-docs provide

#

we don't scrape the docs

maiden fable
#

Ah

#

My bad

upbeat otter
#

lol

maiden fable
#

Ok ok, lemme edit it

boreal ravine
#

does it exist in 2.0?

upbeat otter
boreal ravine
#

oh wait

#

probably got removed

#

since doc command is master

prisma spoke
maiden fable
maiden fable
maiden fable
#

🤣

prisma spoke
#

is it cuz m using bot and not client?

boreal ravine
maiden fable
vocal magnet
#

Try changing one of the strings

#

and see if it appears on your bot when you run the command

prisma spoke
tawdry perch
#

@maiden fable when will the timeout button come?

prisma spoke
#

no errors..

maiden fable
pale turtle
#

I didn't keep up with any new libs. Any suggestions for a lib?

prisma spoke
#

error handler i have

vocal magnet
#

embed=nextcord.Embed(description="Do you wish to continue?", color=nextcord.Color.blurple())

#

change the description slightly

#

and see if the change appears when you run the command

#

I don't think your changes are actually being deployed to your bot

boreal ravine
#

hm

tawdry perch
#

will @unkempt canyon consider using time out buttonif discord adds it?

tawdry perch
#

it's not a same thing as mute?

maiden fable
boreal ravine
#

mute exists, why would they add the same thing as mute

boreal ravine
vocal magnet
tawdry perch
vocal magnet
#

Also we can get rid of the muted role too

tawdry perch
#

cool

#

so it will be better than using muted role in some ways

pale turtle
tawdry perch
#

long time no see NIR

maiden fable
#

There's also gonna be an audit logs entry for the same

maiden fable
unkempt canyonBOT
#
I'm sorry Dave, I'm afraid I can't do that.

Package could not be found.

maiden fable
#

!pypi disnake

unkempt canyonBOT
vocal magnet
upbeat otter
vocal magnet
#

and we don't need to remove to add channel overrides for the muted role on every new channel we make

maiden fable
prisma spoke
#

@vocal magnet it changed yes

pale turtle
maiden fable
pale turtle
tawdry perch
maiden fable
tawdry perch
upbeat otter
slate swan
#

dudes i need your help in the new bot dev portal i cant find the url needed to be put in the oauth2 section to save permissions were can i find it ? im a newbie pls help

pale turtle
tawdry perch
#

yes disnake is based of dpy

maiden fable
pale turtle
pale turtle
slate swan
#

in the generated ui it just says please enter a redirect ui

#

it doesnt generate anything

tawdry perch
maiden fable
slate swan
#

@maiden fable

maiden fable
#

Ah

#

Which tab u went to?

slate swan
#

so what do i do ?

slate swan
maiden fable
#

And which scopes u selected?

slate swan
maiden fable
#

Okay

#

And which scopes?

slate swan
#

im following a tutorial from free coding camp

maiden fable
#

O

#

Wait do one thing

#

Do u know how to get the Bot's ID?

slate swan
#

no idea

prisma spoke
slate swan
#

like i said im a newbie

prisma spoke
#

and i am doing the msg in guild and process in dm

maiden fable
slate swan
maiden fable
#

In this url, replace <YOUR CLIENT ID> with the Client ID from the General Page

prisma spoke
#

u will regret it

slate swan
#

why

#

its the only one on replit

maiden fable
#

Your bot gonna get ratelimitef

prisma spoke
#

@vocal magnet @maiden fable i solved the issue...

slate swan
#

my pc is potato pc it cant handle a normal ide

#

so i need a cloud based one

slate swan
sullen shoal
slate swan
#

okay

maiden fable
slate swan
#

If replit is working for him chill ik its not great but people dont have god like pcs

#

but i need a solution right now about tht

sullen shoal
#

also replit + browser will use more ram than vscode

prisma spoke
#

no one saw it

sullen shoal
maiden fable
#

It was correct tho

prisma spoke
#

it was msg.channel == ctx.channel

slate swan
prisma spoke
#

and the process was in dms

slate swan
#

@sullen shoal is your pfp a pig or a demon i cant tell😭

maiden fable
slate swan
slate swan
maiden fable
tawdry perch
#

how can I delete role perms from channel, the whole role out

slate swan
#

this was easy before why the hell did they make it so complex

prisma spoke
slate swan
#

were can i find a good uri

maiden fable
sullen shoal
maiden fable
#

!d discord.TextChannel.edit

unkempt canyonBOT
#

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

Edits the channel.

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

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 1.4: The `type` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
tawdry perch
#

hm

maiden fable
#

Change the permissions

sullen shoal
prisma spoke
#

i even did channel = await ctx.author.create_dm() @maiden fable

tawdry perch
slate swan
prisma spoke
#

in the code

slate swan
#

can anyone help me pls

tawdry perch
#

so there is no direct way to this

#

Verified == Role

sullen shoal
prisma spoke
#

how to mke a command that will fetch a categ by its id then check how many channels are there in that nd delete all those channels?

slender pollen
#

Hello, I'm trying to make a discord bot for welcome card. For now I have this, but the circle is cut on the top

from PIL import Image, ImageDraw, ImageFilter

im1 = Image.open('card4.png')
im2 = Image.open('prof.png')


mask_im = Image.new("L", im2.size, 0)
draw = ImageDraw.Draw(mask_im)
draw.ellipse((343.19, -34.12, 549.19, 171.88), fill=255)
mask_im.save('mask_circle.jpg', quality=95)

back_im = im1.copy()
back_im.paste(im2, (100, 50), mask_im)
back_im.save('test.png')
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.

slender pollen
tropic palm
#

this proves am a noob. someone please help me find the error

slate swan
#

really stupid question but

how do I create variables in the function parameters of a command?

prisma spoke
#

not Member

prisma spoke
slate swan
#

so to read in args with a command

#

async def test(ctx, var, var2):

#

like that but I know I am doing something wrong

prisma spoke
slate swan
brave moth
prisma spoke
brave moth
#

ik

prisma spoke
#

he wrote Member.avatar_url

brave moth
#

ik

slate swan
tropic palm
# brave moth can i see the code?
@client.command(aliases=['av'])        
async def avatar(ctx, member : nextcord.member = None):
    if member == None:
        member = ctx.author

    memberAvatar = member.avatar_url

    avatarEmbed = nextcord.Embed(title= f"{member.name}'s Avatar")
    avatarEmbed.set_image(url = memberAvatar)

    await ctx.send(embed = avatarEmbed)
slate swan
tropic palm
#

simple avatar command

prisma spoke
prisma spoke
brave moth
#

@client.command(aliases=['av'])        
async def avatar(ctx, member : nextcord.Member = None):
    if member == None:
        member = ctx.author

    memberAvatar = member.avatar_url

    avatarEmbed = nextcord.Embed(title= f"{member.name}'s Avatar")
    avatarEmbed.set_image(url = memberAvatar)

    await ctx.send(embed = avatarEmbed)```
prisma spoke
slate swan
slate swan
prisma spoke
slate swan
brave moth
slate swan
prisma spoke
brave moth
slate swan
#

async def test(ctx, the vars to be here):

slate swan
#

thats it

maiden fable
prisma spoke
slate swan
#

sorry for the shit explaining

prisma spoke
slate swan
#

Theres no such thing as a var in parameters

tropic palm
#

got it. Thanks!

brave moth
#

i dont usually do discord.Embed or discord.User or all that stuff

slate swan
brave moth
#

nextcord is different that discordpy. it could be different, idk

prisma spoke
prisma spoke
slate swan
prisma spoke
#

in nc

brave moth
slate swan
brave moth
#

i cant remember much of nextcord since discord-py-interactions doesnt work with it

slate swan
tropic palm
slate swan
slate swan
#

You dont know what num1 means

prisma spoke
slate swan
prisma spoke
slate swan
#

Really cant assume but suggest

prisma spoke
brave moth
prisma spoke
slate swan
prisma spoke
#

why wud u import Embed

#

its already there when u do import discord

#

and commands

velvet bear
#

Guys, please help. I seem to have connected MySQL correctly, but it gives an error. I am creating a discord bot of the economy #help-cheese

prisma spoke
slate swan
brave moth
prisma spoke
brave moth
#

but everyone has a different way of coding

prisma spoke
prisma spoke
#

i gave u my question.. do uk the answer to that?

slate swan
#

@brave moth btw dont do this

import disnake,asyncio
slate swan
maiden fable
slate swan
prisma spoke
prisma spoke
prisma spoke
slate swan
#

if I write a command, then the bot thinks that such a command does not exist

slate swan
prisma spoke
slate swan
#

why are you nesting classes

prisma spoke
slate swan
prisma spoke
slate swan
#

I don't wanna say anything dumb
I don't use nextcord

slate swan
#

but unless it's not in a cog, I don't think @commands.command() will do much

slate swan
prisma spoke
prisma spoke
slate swan
slate swan
prisma spoke
#

learn nextcord's dropdowns

slate swan
prisma spoke
slate swan
#

so where's the commands.Cog

prisma spoke
slate swan
#

just because you name your folder cog

#

it's not gonna be one

dusk dust
#

how can i get the bot to create a file and attach it to a message?

prisma spoke
slate swan
#

you got problems with creating the file or sending it?

prisma spoke
slate swan
#

put it in just the cog

slate swan
unkempt canyonBOT
#

Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:

# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")

# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
    file = discord.File(f)

When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.

discord.Embed instances have a set_image method which can be used to set an attachment as an image:

embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png")  # Filename here must be exactly same as attachment filename.

After this, you can send an embed with an attachment to Discord:

await channel.send(file=file, embed=embed)

This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.

valid galleon
#

is it possible to get the amount of messages a user has sent in that guild by getting attributes from the search feature in discord, or will i have to use a database for that? im referring to this:

slate swan
#

to learn creating a file, you'll have to use like pillow or something

dusk dust
slate swan
#

I guess you meant a picture

prisma spoke
prisma spoke
# slate swan I guess you meant a picture

he is saying that he wants to create a cmd like !create then the bot wiwll make a file wit some contents in it as per the details of the user then attack that file and send it

slate swan
#

so not an image

#

mmhm

prisma spoke
#

u do !create the bot asks u for the contents then u write it then the bot converts it into a file format u wnant then sends it

slate swan
#

well send has a file kwarg

slate swan
#

!d discord.abc.Messageable.send

unkempt canyonBOT
#

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

Sends a message to the destination with the content given.

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

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

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

i never worked with it

slate swan
#

here's written how the file kwarg is used

prisma spoke
slate swan
#

to a discord.File object

prisma spoke
#

u do !create hello the bot will create a txt file withcontent as hello

slate swan
#

yes

prisma spoke
#

how to convert that msg to a file format?

slate swan
#

use the os module

#

as stated before

#

!d os

unkempt canyonBOT
#
os

Source code: Lib/os.py

This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see open(), if you want to manipulate paths, see the os.path module, and if you want to read all the lines in all the files on the command line see the fileinput module. For creating temporary files and directories see the tempfile module, and for high-level file and directory handling see the shutil module.

Notes on the availability of these functions:

slate swan
#

actually, use the tempfile module instead

#

since this tag above says it

#

well I dunno, I didn't know this module existed

#

once he has the file tho, he's just gonna get a File object out of it and send it

#

if you're asking yourself how you're gonna get the File object,
file = discord.File(fp, filename=None, *, spoiler=False)

dusk dust
#

what if i want the bot to create a folder? Can you do this?

slate swan
#

"For creating temporary files and directories see the tempfile module"

prisma spoke
#

how to do somethin lke the user will do !choose 2 then the bot will randomly pick out 2 random things from the json file and then send em for example :- the output:- 2 vs 2
2 vs 2
as the user wanted 2 outputs it chose 2 and 2 vs if u r getting me

thick sigil
slate swan
#

how come

thick sigil
# slate swan how come
from io import BytesIO

string = BytesIO(bytes("This is a test", "utf-8"))
await ctx.send(file=discord.File(string, filename="test.txt"))
slate swan
#

doesn't look bad

#

i want to ask that how to create a command if someone delete the channel/role how bot recover it?

thick sigil
#

I mean why would you create a temp file

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
slate swan
#

**that's no command that's an event @slate swan **

#

probably like

slate swan
#

sike I thought

maiden fable
#

!d discord.on_guild_channel_update

unkempt canyonBOT
#

discord.on_guild_channel_update(before, after)```
Called whenever a guild channel is updated. e.g. changed name, topic, permissions.

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

That should work

slate swan
#

bot recover ?

maiden fable
#

!d discord.on_guild_update or this, ig

unkempt canyonBOT
#

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

• Changed name

• Changed AFK channel

• Changed AFK timeout

• etc...
slate swan
#

hm

#

glad you here hunter

maiden fable
#

???

slate swan
#

can't find the right emoji for this

#

just take this 😃

maiden fable
#

Haha

#

😄

slate swan
#

I wanted something that's not so boomer

maiden fable
#

Wait

#

!d discord.on_guild_channel_delete

unkempt canyonBOT
#

discord.on_guild_channel_delete(channel)``````py

discord.on_guild_channel_create(channel)```
Called whenever a guild channel is deleted or created.

Note that you can get the guild from [`guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.guild "discord.abc.GuildChannel.guild").

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

There (:

slate swan
#

god

#

why the guild

slate swan
maiden fable
slate swan
#

!d discord.on_guild_role_delete

unkempt canyonBOT
#

discord.on_guild_role_create(role)``````py

discord.on_guild_role_delete(role)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") creates or deletes a new [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role").

To get the guild it belongs to, use [`Role.guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role.guild "discord.Role.guild").

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

what if they really wanna delete it

slate swan
#

lesgo

maiden fable
slate swan
prisma spoke
slate swan
#

but it's not gonna completely recover it

prisma spoke
upbeat otter
slate swan
#

messages gone, id changed

prisma spoke
tough lance
#

Blush

prisma spoke
prisma spoke
slate swan
#

again, the id of the role will change

maiden fable
slate swan
unkempt canyonBOT
upbeat otter
maiden fable
#

🤣

upbeat otter
#

oof

prisma spoke
slate swan
prisma spoke
slate swan
#

wait

maiden fable
slate swan
#

who tf's gonna nuke a server
if he doesn't have permissions

prisma spoke
# slate swan i cant understand

with the discord.on_guild_role_create(role) discord.on_guild_role_delete(role) function u can detect the role change and do the needful actions

maiden fable
upbeat otter
slate swan
#

hecker

tough lance
prisma spoke
maiden fable
prisma spoke
prisma spoke
maiden fable
upbeat otter
maiden fable
prisma spoke
maiden fable
prisma spoke
#

@maiden fable @slate swan

slate swan
upbeat otter
slate swan
#

but like

#

like this?

#

whitelisting on something like this

slate swan
#

is the same as not giving him permissions

tough lance
maiden fable
slate swan
#

please tell me your database is not a json file

slate swan
cinder horizon
maiden fable
slate swan
#

it's discord bro @prisma spoke

maiden fable
#

!ot Anyways

unkempt canyonBOT
tough lance
#

Bruh not the JSON controversory

upbeat otter
#

@slate swan use a counter instead of recreating, if the counter value exceeds, kick that person

prisma spoke
maiden fable
cinder horizon
slate swan
maiden fable
slate swan
slate swan
#

get the attributes of the parameters

upbeat otter
slate swan
#

and recreate it using them

prisma spoke
# slate swan so the indentation is right
@commands.Cog.listener()
async def on_guild_role_create(self, role):
      with open('whitelisted.json') as f:
        whitelisted = json.load(f)
      async for i in role.guild.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.role_create):
        if i.user.bot:
            return```
#

async defs indentation

slate swan
#

no

#

that was one above

maiden fable
#

Welp I am out, my IQ too low for all this

prisma spoke
#

or channel

#

and create it

slate swan
slate swan
tough lance
maiden fable
upbeat otter
prisma spoke
slate swan
#

I'm also gonna go because I sense too many shitposters

slate swan
prisma spoke
#

search google

upbeat otter
#

@slate swan Why don't you see every bot account added and ask a staff member to authorize it but the person who added it

prisma spoke
#

idk much bout audit logs

tough lance
maiden fable
#

Eevee gonna help them all since she got more IQ than us all combined

slate swan
upbeat otter
maiden fable
upbeat otter
prisma spoke
#

eevee a girl ic

#

but me no simp

maiden fable
upbeat otter
maiden fable
upbeat otter
#

smh bye

maiden fable
#

😐

prisma spoke
slate swan
#
@bot.command()
async def start(ctx):
    player = ctx.author
    conn = sqlite3.connect('test.sql')
    c = conn.cursor()
    c.execute(f"UPDATE data  VALUES('{player.id}', 100)")
    conn.commit()
    conn.close()
    await ctx.send('you have started your journey with **100:nexus:** in your balance')```
"VALUES" syntax error
maiden fable
prisma spoke
#

and c execute also wrong

slate swan
slate swan
prisma spoke
slate swan
slate swan
maiden fable
slate swan
prisma spoke
#

not f strings

slate swan
#

why are there two spaces between data and VALUES

#

is that causing a problem or just triggering me

slate swan
prisma spoke
slate swan
#

wtf

prisma spoke
maiden fable
slate swan
#

if that's not his point, he's not gonna change that

prisma spoke
prisma spoke
slate swan
#

the heck is going on

upbeat otter
slate swan
prisma spoke
slate swan
#

guess ima dip

#

on_member_update

#

what the command

prisma spoke
#

imagine if the owner comes and sees some questions..

prisma spoke
unkempt canyonBOT
#
I'm sorry Dave, I'm afraid I can't do that.

No documentation found for the requested symbol.

prisma spoke
#

bre

slate swan
#

auditlog action

#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
prisma spoke
#

its used to check if a member has updates somethn

#

updated*

slate swan
#

action=discord.AuditLogAction.member_update):

#

@prisma spoke

#

like this?

prisma spoke
slate swan
slate swan
slate swan
#

who know

#

audit logs aciton?

prisma spoke
slate swan
#

first ever answer when you don't know if it's good

prisma spoke
#

xD

slate swan
#
async for i in member.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.member_update):
NameError: name 'member' is not defined
#

how do I put cooldowns in commands for each user?

slate swan
#

nvm

prisma spoke
#

@client.event ?

slate swan
#

@ client.command

slate swan
#

member is not defined

slate swan
#

I'm gonna have to search on google

unique robin
slate swan
#

its tag someone

#

so i space

slate swan
#

@commands.cooldown(1, 30, commands.BucketType.user)

#

decorator of a command @slate swan

slate swan
#

yes

#

Of the command not for a exact user

#

it's for users

slate swan
slate swan
slate swan
#

Never seen it been done before

slate swan
prisma spoke
slate swan
#

well I searched this on StackOverFlow

#

it's completely copied

#

I'm asking myself why other people can't do the same thing

#
  1. docs
  2. stackoverflow
  3. here
prisma spoke
slate swan
#

these are the options in order

slate swan
#

quite sure

thick sigil
#

if you want it to be within the server use member

slate swan
#

Yeah i saw that

#

Just checked api reference

#

!d discord.ext.commands.cooldown

unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
thick sigil
#

you dont need to

slate swan
thick sigil
#

you already know that User is not member

slate swan
#

Yeah but docs is just cool to check out jam_cavedude

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.

slate swan
#

definitely

brave flint
#

uh ok

unique robin
#

why i cant talk at voice chat ?

slate swan
kindred drum
#

TypeError: on_member_update() missing 1 required positional argument: 'after'
I get this error when trying to activate this event

async def on_member_update(member, before, after):
    temp = discord.Object(910800167664488508)
    if len(before.roles) < len(after.roles):
        newRole = next(role for role in after.roles if role not in before.roles)
        if newRole.name == "Banned":
            await member.send(f"{member.mention} work?.")```
slate swan
#

remove the member parameter

slate swan
#

definitely not

#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
slate swan
#

before, after

#

where is member defined then/

#

before and after are both member objects

#

so you think removing member will fix the code?

#

yes

#

alr lets see @kindred drum

#

and he can use after.send()

slate swan
#

Thats kinda cool ngl

slate swan
#

after is a member object

slate swan
maiden fable
slate swan
#

hunter

#

you're a simp

maiden fable
slate swan
#

fawk

maiden fable
tawdry perch
#

Sad, still broken

maiden fable
#

What

slate swan
#

what's broken

maiden fable
#

Tbh the reason I ain't able to help u with this properly is cz I don't use webhooks that much

tawdry perch
#

everything just 1 function for removing role perms from channel + removing the role wrong channel

maiden fable
#

O

shadow wraith
#

how do i make bot dm user msg

upbeat otter
upbeat otter
shadow wraith
#

user who used the command

maiden fable
maiden fable
unkempt canyonBOT
shadow wraith
#

💀

upbeat otter
shadow wraith
#

no i mean how do i make the bot dm user msg

maiden fable
maiden fable
final iron
shadow wraith
#

so lets say i have this minimalhelpcommand class which gets the destination of channel then sends help

maiden fable
shadow wraith
#

so idk if destination.author.send would work 🤔

maiden fable
shadow wraith
#

here's ma help command

#
class MyNewHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            emby = discord.Embed(description=page)
            await destination.send(embed=emby)

bot.help_command = MyNewHelp()
#

💀

maiden fable
#

!d discord.ext.commands.MinimalHelpCommand.dm_help

unkempt canyonBOT
#

A tribool that indicates if the help command should DM the user instead of sending it to the channel it received it from. If the boolean is set to True, then all help output is DM’d. If False, none of the help output is DM’d. If None, then the bot will only DM when the help message becomes too long (dictated by more than dm_help_threshold characters). Defaults to False.

maiden fable
#

There (:

shadow wraith
#

my guy 💀 i really have to use a commands.MinimalHelpCommand.dm_help

maiden fable
#

No

#

U set that in the init

#

self.dm_help = True

shadow wraith
#

oh

#

im not sure if its in the for statement

#

but for sure it's in there

slate swan
#

so I have

async def test(ctx, var, var2, var3):
 if var is None:
    await ctx.send("Var is empty")

and so on

but it's not executing the ctx.send to say its None

shadow wraith
#

its ==

#

try ==

slate swan
#

I have tried that too

#

set the default value of all your your parameters to
None

#

oh yeah

#

I was doing var : int

#

async def test(ctx, var=None, var2=None, var3=None):

placid skiff
#

They are automatically set to var

#

None*

slate swan
#

no

#

ain't it

num1 : None

?

#

not giving them will result in an error

#

instead of setting it to none

maiden fable
placid skiff
slate swan
placid skiff
slate swan
#

what

maiden fable
#

Yea

slate swan
#

but all I get is this discord.ext.commands.errors.MissingRequiredArgument: num1 is a required argument that is missing.

#

but its not doing ctx.send

#

its so weird and bizarre

placid skiff
#

Because it is a traceback callback, your function stop working cuz a required argument is missing

placid skiff
slate swan
#

this is why I love this channel haha

#

thank you @maiden fable it worked

maiden fable
#

(:

vocal zephyr
#

!d join

prisma spoke
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

vocal zephyr
#

sorry, why my new members system is not working?

maiden fable
unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

vocal zephyr
#

ohh thanks I'll try it

manic wing
#

what is intenrs and where can i get them

prisma spoke
vocal zephyr
#

it is intents i guess

#

await client.process_commands(msg)

#

u need to put this at end of event

#

or wdym?

prisma spoke
vocal zephyr
#

um

maiden fable
shadow wraith
#

me when the self.dm_help doesnt work 💀

shadow wraith
#
class MyNewHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        destination = self.get_destination()
        for page in self.paginator.pages:
            self.dm_help = True
            emby = discord.Embed(description=page)
            await destination.send(embed=emby)
        async def on_help_command_error(error):
            await destination.send("We had an error. Try running the command again.")``` how make bot dm help
tawdry perch
#

so how did I remove role from channel, I alrd forgot

maiden fable
#

I told u before bruv

cobalt coyote
#

Has anyone done so far Mee6 welcome cards on custom discord bot?

tawdry perch
#

somehow, yes

unkempt canyonBOT
#
PIL
tawdry perch
#

!d discord.TextChannel.edit

unkempt canyonBOT
#

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

Edits the channel.

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

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 1.4: The `type` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
tawdry perch
#

hmm

#

;-; docs sucks I can't find it anywhere

manic wing
tawdry perch
#

way to delete a role from a channel

sage otter
#

Like remove the role overwrites?

manic wing
shadow wraith
manic wing
#

read overwrites kwarg

tawdry perch
#

when you go to edit channel -> select role -> scroll down click this

#

but with bot

#

!d discord.TextChannel.overwrites

unkempt canyonBOT
#

property overwrites: Dict[Union[Role, Member], PermissionOverwrite]```
Returns all of the channel’s overwrites.

This is returned as a dictionary where the key contains the target which can be either a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") or a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") and the value is the overwrite as a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite").
shadow wraith
#

def __init__(self): momen

tawdry perch
manic wing
#

!d discord.TextChannel.set_permissions || you can just do this

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

;-; fkk

#

I could have save so many painful tries

tawdry perch
maiden fable
#

U do it in the init self.dm_help = True

shadow wraith
maiden fable
shadow wraith
#

that's why i said init was a function

#

because to get init you need def

maiden fable
#

What did you mean by function inside a function?

maiden fable
shadow wraith
#

cap bro

maiden fable
#

I thought u meant self.dm is function

#

Nvm leave it

#

I am probably drunk

shadow wraith
#

💀

tawdry perch
maiden fable
#

Hmm

peak loom
#

Help?

prisma spoke
#
@bot.command(aliases=["reg"])
async def register(ctx):

    with open("usersforteams.json", "r") as f:
        users = json.load(f)

    
    if str(ctx.author.id) in users:
        return await ctx.send("❎ You have already registered!")
    

    def check(msg):
        return msg.author == ctx.author

    view1 = Confirm()


    embed=nextcord.Embed(description="Do you wish to continue?")
    await ctx.send(embed=embed,view=view1)
    await view1.wait()

    if view1.value is None:
        embed=nextcord.Embed(description=f"❎ Timed Out!")
        await ctx.send(embed=embed)
    elif view1.value:
        
        try:


            channel = await ctx.author.create_dm()

            
            await channel.send("Please enter your in-game name!")
            msg = await bot.wait_for('message', check=check,  timeout=60)
            ign = msg.content
            if str(ign) in users:
                return await ctx.send("❎ This in-game name already exists!")
            else:
                await channel.send("Please enter your in-game user ID!")
                msg = await bot.wait_for('message', check=check, timeout=60)
                uid = msg.content


            if str(uid) in users:
                return await ctx.send("❎ This in-game user-id already exists!")



            users[str(ctx.author.id)] = {}
            users[str(ctx.author.id)]["IGN"] = ign
            users[str(ctx.author.id)]["UID"] = uid
            embed=nextcord.Embed(description=f"✅ You have been registered!")
            await channel.send(embed=embed)

                
            with open("usersforteams.json", "w") as f:
                json.dump(users,f)
            return True


        except asyncio.TimeoutError:
            embed=nextcord.Embed(title="❎ Timeout to respond!",description=f"{ctx.author.mention} this process has timed out! Please re-do the process again if you wish to register!")
            await channel.send(embed=embed)
            return
    else:
        embed=nextcord.Embed(description=f"✅ Process Cancelled! ")
        await ctx.send(embed=embed)
        return``` this doesnt send the msg that "this uid exits" this msg it doesnt send nd ussers can register with saame ign and uid ho to solve?
maiden fable
#

Drunk... Not on alcohol tho, since I am underage

prisma spoke
shadow wraith
upbeat otter
maiden fable
upbeat otter
maiden fable
prisma spoke
upbeat otter
maiden fable
prisma spoke
maiden fable
prisma spoke
maiden fable
maiden fable
#

Hehehe I am the laziest person

upbeat otter
#

light mode

maiden fable
#

Welp light mode in all dark background. Best eye killer for people like me tbh

pearl birch
#

Does anyone know/have experience on how Discord decides on how to display URLs
I'm trying to write a regex to match URLs in a message as close to how they are displayed as possible, Discord has some really weird rules on whether to exclude the final character

peak loom
peak loom
#

There dark theme.

maiden fable
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

maiden fable
#

Long tags go brrr

upbeat otter
pearl birch
# maiden fable Can I get some more context?

you know how if you put a link in a message Discord helpfully highlights the link, and the highlighted part would be what you can click on? I'm trying to match the way it highlights with a regex

upbeat otter
pearl birch
maiden fable
peak loom
maiden fable
#

Ah

upbeat otter
maiden fable
#

The blue color?

pearl birch
peak loom
prisma spoke
#

i never used for loop i the reg cmd

upbeat otter
#

@pearl birch

description= [text goes here](url goes here)

this cant be used in the title attribute

maiden fable
# pearl birch yes

!d str.split it returns a list of words in a string and see if any word starts with https://

unkempt canyonBOT
#

str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).

If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.

For example:
prisma spoke
peak loom
prisma spoke
pearl birch
prisma spoke
#

!d indentation

unkempt canyonBOT
#

Leading whitespace (spaces and tabs) at the beginning of a logical line is used to compute the indentation level of the line, which in turn is used to determine the grouping of statements.

Tabs are replaced (from left to right) by one to eight spaces such that the total number of characters up to and including the replacement is a multiple of eight (this is intended to be the same rule as used by Unix). The total number of spaces preceding the first non-blank character then determines the line’s indentation. Indentation cannot be split over multiple physical lines using backslashes; the whitespace up to the first backslash determines the indentation.

peak loom
upbeat otter
maiden fable
#

ignored again

prisma spoke
maiden fable
prisma spoke
peak loom
maiden fable
upbeat otter
prisma spoke
prisma spoke
#

its basic problem

peak loom
maiden fable
prisma spoke
maiden fable
prisma spoke
sullen shoal
# prisma spoke u dont

its the official discord server of python, you will meet beginners here, you cant stop it

upbeat otter
#

@peak loom You know what indents are? what do you mean by "removing" indents?

maiden fable
#

So I need some help with a bot

upbeat otter
#

No offense

peak loom
prisma spoke
upbeat otter
prisma spoke
peak loom
prisma spoke
#

thats an emoji link

maiden fable
#
from discord import Client
from discord.ext import tasks

bot = Client() 

@tasks.loop(minutes=1) 
async def loop():
    cnl = await bot.get_channel(493451846543998977) 
    await cnl.send(1) 

bot.run(token) 

This doesn't work ;-;

maiden fable
maiden fable
upbeat otter
#

stop making fun of beginners

peak loom
pearl birch
# upbeat otter ohhh, Messages dont contain hyperlinks

Yes. This is what I'm trying to do:

Suppose someone sent a message that says:

This is Wikipedia: https://en.wikipedia.org
Now if you view the message as a person using Discord, you will see that the https://en.wikipedia.org part is blue, and you can click on it
— I want my bot to be able to find this blue part

I do have a regex to do it, and it's working for the most part, but there are some weird kinks that I'm trying to fix:
If someone sends https://en.wikipedia.org) mta_arrowW Notice how Discord decides to not show the right parenthesis as blue
My code can't tell that, so it will still extract https://en.wikipedia.org)
What I want is to see exactly how Discord decides which part to highlight so I can improve my regex

maiden fable
maiden fable
peak loom
maiden fable
maiden fable
sullen shoal
pearl birch
maiden fable
upbeat otter
prisma spoke
#
@bot.command()
async def brackets(ctx, n:int):
    with open("usersforteams.json", "r") as f:
        users = json.load(f)
    
    a = (random.choices(users, k = n))
    await ctx.send(a)```
doesnt work...
upbeat otter
maiden fable
peak loom
slate swan
maiden fable
slate swan
#

then you didn't start the loop

sullen shoal
maiden fable
#

I'mma just stop this, feels like I am trolling everyone ;-;

slate swan
#

also, wait until the bot's ready before getting the channel, and the .get_xxx methods aren't awaitables

pearl birch
maiden fable
upbeat otter
maiden fable
slate swan
sullen shoal
slate swan
#

they can also be ints

upbeat otter
slate swan
#

they're only type-hinted as floats but it doesn't make a difference

maiden fable
slate swan