#discord-bots

1 messages · Page 631 of 1

spring flax
#

i mean i highly suggest using the commands instead of on_message but you do you lol

#

anyways, let me see one second

visual island
#

👍

normal folio
#

Is there any way to get the command's argument to another command? (i use group command)

spring flax
unkempt canyonBOT
normal folio
slate swan
#
raise CommandOnCooldown(bucket, retry_after)
discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 38.01s
```How do i print out the cooldown?
#

The 38.01s

maiden fable
#

Do u have an error handler?

slate swan
#

error is a parameter?

slate swan
maiden fable
#

O, u need tho

slate swan
#

Oh

maiden fable
#

Breh anyways on_command_error

#

U need to use that

#

It's an event

slate swan
#

What was that u showed me

#

Can u do that again

#

So that I can see

maiden fable
#
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        print(error.retry_after) 
slate swan
#

Ohh

maiden fable
#

Sorry for spoonfeeding ;-;

slate swan
#
@bot.event
async def on_ready():
    guild = await bot.fetch_guild(id)
    print(guild.name)
    members = await guild.members
    for member in members:
        print(member.name)

why doesn't this work?

maiden fable
slate swan
#

Oh ok

slate swan
visual island
maiden fable
#

!d discord.Client.get_guild

unkempt canyonBOT
velvet tinsel
#

Hello

maiden fable
#

Use this

velvet tinsel
#

Hi Hunter

maiden fable
#

Hi

velvet tinsel
#

no more await ctx.send(“!ot”) I see.

maiden fable
slate swan
#
async def on_ready():
    guild = await bot.get_guild(id)
    print(guild.name)
    members = guild.members
    for member in members:
      print(member.name)

this is the updated code and this is the error:

TypeError: object NoneType can't be used in 'await' expression
normal folio
#

how to use signature

glass rock
#

how can i convert a normal file to discord.file object to send it

velvet tinsel
maiden fable
maiden fable
#

!d discord.ext.commands.Command.signature

unkempt canyonBOT
maiden fable
#

This?

velvet tinsel
glass rock
#

discord.errors.InvalidArgument: file parameter must be File

maiden fable
slate swan
maiden fable
#

!d discord.File

unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
velvet tinsel
#

I thought you can just do open() normally

glass rock
maiden fable
#

!local-file

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.

maiden fable
#

See this

velvet tinsel
#

I though open() would do fine

maiden fable
#

No

velvet tinsel
#

🤷‍♂️

velvet tinsel
glass rock
slate swan
maiden fable
#

Ah wait

slate swan
#
@bot.event
async def on_ready():
    guild = bot.get_guild(909170415337869333)
    members = guild.members
    for member in members:
        print(member.name)
maiden fable
#

!intentd

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.

maiden fable
#

U need members intent

slate swan
#
client = discord.Client()
intents = discord.Intents.all()
bot = Bot(command_prefix="", intents=intents)

I did this tho

velvet tinsel
velvet tinsel
slate swan
dapper cobalt
velvet tinsel
dapper cobalt
slate swan
dapper cobalt
#

Here's the difference between Client and Bot.

slate swan
slate swan
velvet tinsel
#

I can’t find the soy sauce

#

I can just get the Lao gan ma

slate swan
#

so.. how do I fix this?

intents = discord.Intents.all()
bot = Bot(command_prefix="", intents=intents)


@bot.event
async def on_ready():
    guild = bot.get_guild(id)
    members = guild.members
    for member in members:
        print(member.name)

it just prints me my bot's name

maiden fable
slate swan
velvet tinsel
#

I think this will help

maiden fable
#

😐

#

Isn't that what he's also doing 🤦

spring flax
#

Bruh

#

But

dapper cobalt
spring flax
#

Why

#

I mean why do it on ready?

maiden fable
#

🤷‍♂️

spring flax
#

A command seems more ideal

velvet tinsel
velvet tinsel
#

Excuse me while I eat breakfast

grizzled sundial
#

is there a good wrapper that works for accessing the http api directly? i remember that you could do it with discord.py but i don't quite know what the current state of that is (for oauth2)

dapper cobalt
#

!pypi disnake

unkempt canyonBOT
grizzled sundial
#

is this just a fork of dpy, but still updated?

velvet tinsel
#

Fork

mental kraken
slate swan
#

says the developer

velvet tinsel
#

I mean most of the people here like it

grizzled sundial
#

sounds decent i guess

velvet tinsel
#

@slate swan hi

slate swan
velvet tinsel
#

How did you get verified bot developer @mental kraken 😭

#

I want that badge

velvet tinsel
grizzled sundial
velvet tinsel
slate swan
#

yert we cannot get the verified bot dev badge anymore

dapper cobalt
grizzled sundial
grizzled sundial
#

can't seem to find the method in HttpClient

slate swan
#

you can literally do whatever you could with discord.py in disnake

grizzled sundial
#

oh wait i can just abuse http.Route and it should work

slate swan
#

soo i have this command which updates the status in how many servers the bot is in, is it possible to make the command update the status automatically when its been added in a new server

@bot.command()
async def status(ctx):
    await bot.change_presence(activity=discord.Game(name=" s!help in " + str(len(bot.guilds)) + " Servers."))```
unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.

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

nvm

peak yoke
#

How can I reply a set of random text when the bot is mentioned? In python?

spring flax
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
spring flax
#

bruh

#

why did you put on_message?

#

!d discord.on_guild_join

unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.

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

Guys I need help

#

When i type in s!help, It shows all of the commands like This

maiden fable
#

Yea

manic wing
maiden fable
#

That is the default behaviour

somber tree
#

Oh

#

but I don't know how to change that

maiden fable
#

!d discord.ext.commands.DefaultHelpCommand

unkempt canyonBOT
#

class discord.ext.commands.DefaultHelpCommand(*args, **kwargs)```
The implementation of the default help command.

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

It extends it with the following attributes.
maiden fable
unkempt canyonBOT
#

Custom help commands in discord.py

To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000

manic wing
#

you can make your own by doing bot.remove_command("help")

maiden fable
#

help_command=None is there for a reason

manic wing
somber tree
#

right now I'm making a bot that shows the stats for my gd private server, and this is what I have made so far ```py
@client.command()
async def leaderboard(ctx):
await ctx.send('What leaderboard do you want to see? Star or CP?')

@client.command()
async def levels(ctx):
await ctx.send('Please say the level ID.')```

spring flax
#

@maiden fable you made an API right?

maiden fable
spring flax
#

what exactly does it do?

spring flax
maiden fable
spring flax
#

how'd you make it?

maiden fable
#

!pypi flask

unkempt canyonBOT
#

A simple framework for building complex web applications.

maiden fable
#

Just a raw API

spring flax
#

Is it difficult?

manic wing
#

is it public?

maiden fable
#

Making the API was damn easy

maiden fable
# manic wing is it public?

Nah, it is private cz anyone can literally DDOS it since it doesn't have any authentication or something haha

somber tree
#

except I don't have the players command yet

maiden fable
manic wing
#

and the github repo is private?

maiden fable
#

Ain't got one

manic wing
maiden fable
#

😄

spring flax
maiden fable
maiden fable
somber tree
spring flax
maiden fable
#

It will remove the help command

somber tree
#

nope

#

doesn't work

velvet tinsel
#

client.remove_command()

#

I think

somber tree
#

ok

velvet tinsel
#

🤷‍♂️ depending if you called it client or bot

somber tree
#

for me it's client

slate swan
#

a one more thing

#

how to make my bot all time online?

velvet tinsel
#

It costs money

slate swan
velvet tinsel
slate swan
#

VPS

#

cost money

velvet tinsel
#

Ok then b it it is remove_command()

grizzled sundial
slate swan
#

fardddddd

velvet tinsel
#

You expect it to be free lmao

slate swan
#

but

#

all days i use my pc

#

and my is only private

velvet tinsel
#

You’d have to have your pc on 24/7

#

Cheaper to buy raspberry pi

#

Or just use linode lmao

#

Like @unkempt canyon here

somber tree
#

Oh it works!

slate swan
#

my bot works only me online, my bot its "me".

hazy agate
#

GUYS

#

I HAVE A DOUBT

#

I MEAN

somber tree
#

Ok now I have to make my own help command and change the style of text

velvet tinsel
#

What

slate swan
#

all times when my pc start

velvet tinsel
slate swan
hazy agate
velvet tinsel
slate swan
#

uhn no

velvet tinsel
slate swan
#

how to create a discord bot

hazy agate
velvet tinsel
slate swan
#

with soundcloud

velvet tinsel
hazy agate
#

wdym

velvet tinsel
#

Find tutorials online lmao

velvet tinsel
#

I forgor the name 💀

unkempt canyonBOT
#

Hey @hazy agate! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

hazy agate
#

bruhh

#

this

velvet tinsel
#

Don’t include the token lmao

slate swan
#

send code again

velvet tinsel
#

😂😂

slate swan
#

on dm

velvet tinsel
slate swan
#

ok

velvet tinsel
#

Don’t reveal your bot token

slate swan
velvet tinsel
#

People can steal it

#

😭

hazy agate
#

rd
import random
import time
import asyncio

TOKEN = "NO!"

client = discord.Client()

@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith("!Ping"):
        await message.channel.send("Pong!")

if message.content.startswith("!Idiot"):
        await message.channel.send("No u idiot!")

if message.content.startswith("!Hi"):
    await message.channel.send("*Hello!*")

if message.content.startswith("!SUS"):
        await message.channel.send("Ayo stop my brain is going dumb!")

if message.content.startswith("!Hri"):
        await message.channel.send("=Dumb!")

if message.content.startswith("!>"):
        await message.channel.send("Wat u mean bro!!")

@client.event
async def on_ready():
print("Bot is Ready :)")

client.run(TOKEN)

somber tree
#

Now I want to make an embed for the text

hazy agate
#

ignore the commands

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.

somber tree
#

kinda like

#

This

#

but with colour

velvet tinsel
twin moon
#
async def check_user(ctx,user):
    with open("logins.json","r") as f:
        logins = json.load(f)
    if not str(user.id) in logins:
        msg = await ctx.send(f"{user.mention}Make an account or log in.")
        return msg
    else:
        User1 = logins[str(user.id)]
        return User1


@client.command()
@commands.cooldown(1,30,commands.BucketType.user)
async def work(ctx):
    await check_user(ctx,ctx.author)
``` It doesent send the message
hazy agate
#

bro

somber tree
maiden fable
#

!d discord.Embed *

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

how can i make a bot join in vc by pycharm

#

aaaaaaaaaaaaaaaaaaaaaa

velvet tinsel
velvet tinsel
hazy agate
#

yea

velvet tinsel
#

Search it up

#

For the third time

#

There are useful resources

#

🤷‍♂️

maiden fable
#

Bruh

#

!d discord.VoiceChannel.connect @hazy agate

velvet tinsel
#

What

unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.

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

!d discord.Guild.get_channel can be used

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.
balmy goblet
#

hi i need help its urgent

velvet tinsel
#

ig that works as well

velvet tinsel
maiden fable
balmy goblet
maiden fable
#

!d discord.TextChannel.delete

unkempt canyonBOT
#

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

Deletes the channel.

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

......?

balmy goblet
balmy goblet
hazy agate
#

ayobro how can

velvet tinsel
hazy agate
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)

#

only this

maiden fable
hazy agate
#

then

hazy agate
velvet tinsel
# hazy agate then

We’re not spoonfeeding you code, you’ll have to find out in the docs or some resource

balmy goblet
somber tree
kind radish
#

Can anyone help?
got a link on database, need to set as bot avatar

Code:

        if (str(ctx.guild.id)) in self.pic:
            pic = self.pic[f"{ctx.guild.id}"]
            with open(pic, 'rb') as file:  
            await self.bot.user.edit(avatar = await file.read())

Error:
FileNotFoundError: [Errno 2] No such file or directory: 'https://cdn.discordapp.com/attachments/865581332737294336/914107357485756446/unknown.png'

hazy agate
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)

velvet tinsel
#

Python or discord py

somber tree
#

I'm really confused

velvet tinsel
#

It’s easy

twin moon
#
async def check_user(ctx,user):
    with open("logins.json","r") as f:
        logins = json.load(f)
    if not str(user.id) in logins:
        msg = await ctx.send(f"{user.mention}Make an account or log in.")
        return msg
    else:
        User1 = logins[str(user.id)]
        return User1


@client.command()
@commands.cooldown(1,30,commands.BucketType.user)
async def work(ctx):
    await check_user(ctx,ctx.author)```It doesent send a message
velvet tinsel
maiden fable
velvet tinsel
#

Unless you used the check_user

twin moon
velvet tinsel
hazy agate
#

@deep sorrel

unkempt canyonBOT
#

Hey @hazy agate!

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

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

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

https://paste.pythondiscord.com

maiden fable
slate swan
#

My account token is ||never gonna give you up, never gonna let down||

velvet tinsel
twin moon
hazy agate
velvet tinsel
#

Remove return

velvet tinsel
maiden fable
unkempt canyonBOT
velvet tinsel
hazy agate
#

''

velvet tinsel
hazy agate
#

wait

#

wat

velvet tinsel
#

😂

hazy agate
#

he is admin

#

bruhh

#

i thought he is member

velvet tinsel
#

He is a member, he just has admin privileges

hazy agate
#

ok

#

but help me

velvet tinsel
#

Don’t ping him for python help

hazy agate
#

i need mny bot to join vc

velvet tinsel
hazy agate
#

vcs

velvet tinsel
hazy agate
#

d! make my bot onlin

#

e

velvet tinsel
#

What

hazy agate
#

xebruh

velvet tinsel
#

😂😂 what are you doing

hazy agate
#

nohing

somber tree
#

I don't know what this coding is supposed to do py client.discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)
Btw I use client for coding

hazy agate
#

just tell me what do i need to do that my bot joins my vc pls tell

balmy goblet
#

@maiden fable

velvet tinsel
velvet tinsel
hazy agate
#

thx

velvet tinsel
#

What

balmy goblet
#
  @commands.command(name="deletem")
  @commands.has_permissions(manage_channels=True)
  async def deletem(self, ctx, cnl = name):
    for cnl in guild.text_channels:
      if cnl.name == name:
        await cnl.delete
``` w
#

wahts wrong?

balmy goblet
#

i want to delete channels with same name

hazy agate
#

bruhh

balmy goblet
velvet tinsel
#

Did you pass all the required arguments?

balmy goblet
#

module discord has no attribute to channel

#

@velvet tinsel

velvet tinsel
balmy goblet
#

i want to delte multiple channels with same name

slate swan
hazy agate
#

bye i am going to sleeeeep

balmy goblet
#

i want to delete 1200 channels with same name

velvet tinsel
#

?

#

Channels or text messages

balmy goblet
velvet tinsel
#

“Fight fire with fire. Use the same bot (or your own bot) to then delete all of the channels.

It's possible, with a bot, to loop through all channels in a server and check the name of the channel. If the name of the channel matches a certain criteria, you can then delete it.

I personally like Discord4J to make bots, but since your friend already has a bot, I believe you should ask him/her to make a command to implement a new command for cleaning up those channels.

Alternatively, you can delete them all manually. That'd be a lot of clicking though, but depending on you and your friend's knowledge of bot development, that may just be simpler and less frustrating.”

#

I found that online

balmy goblet
#

wth

velvet tinsel
#

Just loop through the text channels

balmy goblet
#

send code

velvet tinsel
#

Using the startswith()

velvet tinsel
balmy goblet
#

just a little code

velvet tinsel
#

…ok

balmy goblet
#

then i will get it

supple thorn
#

Isnt there a way to get a users input without wait_for

#

I remember seeing a third party lib for it once here i think

#

I dont know where to find it

dark pawn
#

can someone join my server to test my game? i need to see if i works for other people

velvet tinsel
#
for guild in bot.guilds:
    for channel in guild.text_channels:
        if cnl.name == name:
            await cnl.delete
dark pawn
#

oh true

velvet tinsel
supple thorn
#

Except for i know the person who helped the person who said the message had a cyan username

maiden fable
#

Those names are for those people who boost this server

velvet tinsel
#

It’s wait_for(“message”, check=check, timeout=60) but you have to make your own check function

dapper cobalt
maiden fable
#

Could be the person was @visual island?

supple thorn
velvet tinsel
#

Nope

supple thorn
#

Wait

maiden fable
#

Either it, or Scoopy are the only ones who are most active here

velvet tinsel
#

Not icy definitely, she doesnt have cyan username

supple thorn
#

It could have been icy

velvet tinsel
supple thorn
#

Ah shit

maiden fable
velvet tinsel
#

;_;

maiden fable
#

The role keeps getting added and removed

velvet tinsel
#

I like nesting

spring flax
#

:sadge:

velvet tinsel
#

I changed user

slate swan
#

How can i put 2 views in one message?

velvet tinsel
#

?

slate swan
#

With the view kwarg

balmy goblet
#
  @commands.command(name='delete-channel', help='delete a channel with the specified name')
  async def delete_channel(ctx, channel_name):
    
    if channel_name is not None:
      while True:
        existing_channel = discord.utils.get(ctx.guild.channels, name=channel_name)

        await existing_channel.delete()
    
    else:

      await ctx.send(f'No channel named, "{channel_name}", was found')
#

error: object has no attribute guild

velvet tinsel
#

Ima bit busy, so I am not available

slate swan
#

@balmy goblet wait, are you using cogs?

balmy goblet
spring flax
supple thorn
#

Damn i really cant find it

spring flax
supple thorn
#

I know there was even documentation for it

supple thorn
#

I just cant find it on google nor here

balmy goblet
#

somethingg

#

pls

spring flax
#

you can ask here

spring flax
balmy goblet
#

i need help
i used nuked command
and it created multiple text channels with same name
now i need to delet all those same name text_channels

supple thorn
#

Unless im going crazy made up i saw it

balmy goblet
spring flax
#

what the-

#

why would you even do that

balmy goblet
spring flax
#

first of all, ratelimits.

supple thorn
#

But i even remember seeing someone with a cyan nickname telling someone something when they replied to the person asking for help with the thing with "why would you even use that"

balmy goblet
#

they all have same names

spring flax
#

and uhmm

balmy goblet
#
@commands.command(name='delete-channel', help='delete a channel with the specified name')
  async def delete_channel(ctx, channel_name):
    
    if channel_name is not None:
      while True:
        existing_channel = discord.utils.get(ctx.guild.channels, name=channel_name)

        await existing_channel.delete()
    
    else:

      await ctx.send(f'No channel named, "{channel_name}", was found')
slate swan
#

@balmy goblet man you'll just have to loop through all guild channels and check its name and if its equal to what you want delete it

slate swan
#

Listen to what diabolical said

#

Put self

balmy goblet
#

then waht?

spring flax
#
#command decorator
#parameters
for channel in ctx.guild.channels:
  if channel.name == "a channel name":
    await channel.delete()```
This is what would be suggested if you want to use it on a few channels but for 1200, there's ratelimits
dapper cobalt
#

That seems like some kind of raiding?

balmy goblet
#
  @commands.command(name='delete-channel', help='delete a channel with the specified name')
  async def delete_channel(self, ctx, channel_name):
    
    for channel in ctx.guild.channels:
  if channel.name == "a channel name":
    await channel.delete()
#

@spring flax

spring flax
slate swan
#

Jeez

spring flax
#

@balmy goblet is this your server?

balmy goblet
#

yes

manic wing
spring flax
#

you own it?

unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
dapper cobalt
slate swan
spring flax
#

read what he wants

manic wing
balmy goblet
spring flax
dapper cobalt
#
@commands.command(name='delete-channel', help='delete a channel with the specified name')
async def delchannel(self, ctx, channel:discord.TextChannel):
  await channel.delete()
spring flax
#

that's not what he wants

balmy goblet
manic wing
#

:0

dapper cobalt
slate swan
#

@dapper cobalt 2 channels with the same name doesn't mean its the same channel

#

Oh

#

Well then you missed context lol

dapper cobalt
#

Grammar matters.

supple thorn
slate swan
#

Reading context does too

spring flax
#

@balmy goblet how many people are in the server?

spring flax
#

you dont have to keep pinging me?

dapper cobalt
balmy goblet
spring flax
balmy goblet
balmy goblet
supple thorn
spring flax
#

okay i suggest deleting this server you're talking about

dapper cobalt
velvet tinsel
slate swan
#

?

spring flax
#

without the template*

slate swan
#

So delete the entire server..?

balmy goblet
spring flax
#

yeah well

spring flax
dapper cobalt
balmy goblet
balmy goblet
#
  @commands.command(name='delete-channel', help='delete a channel with the specified name')
  async def delete_channel(self, ctx, channel_name):
    
    for channel in ctx.guild.channels:
  if channel.name == "a channel name":
    await channel.delete()
``` @spring flax
hazy canopy
#

When you do a database of users to save the money and more, what is the best parameter to assign that variables in the database?

dusk pumice
#

How to make eval command?
Ping to awnser

spring flax
dapper cobalt
dusk pumice
#

Uww Tnx!

hazy canopy
#

the id of the user changes?

dapper cobalt
#

Don't check for the author's ID, instead, use the @commands.is_owner() decorator.

#

!d discord.ext.commands.Bot.guilds returns a list of the bot's guilds. Each guild represents a discord.Guild object.

unkempt canyonBOT
dapper cobalt
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

x == y Checks if two guilds are equal.

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

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
dapper cobalt
#

You're the only owner of the bot, right?

#

Then use that decorator.

#

Also, do not generate invites too quickly. It'll ratelimit your bot.

#

Yes.

supple thorn
dusty island
#

PEOPLE WHERE THE PLACE IS FOR BRAZILIANS

hazy canopy
#

@dapper cobalt what goes in @command.is_owner(here)

dusk pumice
#

DAMN IT I GOT RATE LIMITS 😦

hazy canopy
#

is_owner() missing 1 required positional argument: 'use line 255, in <module>r'

dapper cobalt
#

It's @commands. I assume you missed that 's'.

hazy canopy
#

oh ok

dapper cobalt
#

!d discord.ext.commands.is_owner

unkempt canyonBOT
#

@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.

This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").

This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
slate swan
#

@dapper cobalt btw, do you know how i can put 2 views in one message?

#

that is, a button and dropdown

dapper cobalt
#

Which library are you using?

deft lodge
#

Hello this might seem like a dumb question but I am trying to store like number in my database to have it be sorted but I can't make a for loop or a while loop or it'll send a bad request error, is there a function or something I can use to have numbers one by one in-order from like 1-10 stored?

slate swan
deft lodge
#

Alright thanks for the help

dapper cobalt
slate swan
#

Hm, lemme try

#

I tried view=[view1, view2], didn't work though

dapper cobalt
#

!d discord.ext.commands.Bot.guilds @slate swan

unkempt canyonBOT
slate swan
#

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send_message() got an unexpected keyword argument 'components' huh

junior verge
#

How would you make a command like !invite 1 that you would generate a 1 invite link

slate swan
#

!d discord.Guild.create_invite @junior verge

#

bruh

hazy canopy
#

can you change your discord id?

slate swan
#

no

hazy canopy
#

ok

slate swan
#

!d discord.TextChannel.create_invite

unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

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

oh okay here

spring flax
#

what do you want it to do?

#

the number of guilds the bot is in?

#

how many servers is it in?

slate swan
#

how do I make a discord bot which gets trigger when a user says something after using a command such as

!test
bot: make a print command of "hello world"
user:
print("hello world")
bot: you are a coder

dapper cobalt
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

This function returns the **first event that meets the requirements**...
sick talon
spring flax
#

!d discord.abc.GuildChannel.create_invite

unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
maiden fable
visual island
maiden fable
#

@commands.group*

#

@sick talon

supple thorn
sick talon
maiden fable
#

Hahaha

sick talon
# maiden fable Hahaha

i am getting this error now pithink

discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.utils.setup.setup' has no 'setup' function.
maiden fable
#

O

#
def setup(bot):
    bot.add_cog(Setup(bot)) 

@sick talon

sick talon
maiden fable
#

Hahaha it's all cool

sick talon
worthy moat
#

please help someone
code:

@client.command()
async def captcha(ctx):
        user = (ctx.author.id)
        await ctx.send(f'Aby się zweryfikować patrz dm')
        await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
        embed = Embed(title = 'Captcha', color=998514)
        embed.description = f'aby się zweryfikować napisz co tu jest napisane'
        embed.set_image(url="captchafiles/captcha1.png")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")

        await user.send(embed)

Error:

Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 97, in captcha
    await user.send(embed)
AttributeError: 'int' object has no attribute 'send'

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'send'
velvet tinsel
#

message = await client.wait_for("message", check=check2, timeout=30) apparently I have to await the wait_for() but I already did ;_; what do I do

velvet tinsel
#

convert user to str

worthy moat
#

ok

#

like this?

str(user) = (ctx.author.id)
velvet tinsel
#

user = str(ctx.author.id)

worthy moat
#

ok

velvet tinsel
#
RuntimeWarning: coroutine 'wait_for' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
maiden fable
sick talon
velvet tinsel
#

I awaited it

velvet tinsel
#

but it still shows up with an error

maiden fable
worthy moat
#

still doesn't work

Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 97, in captcha
    await user.send(embed)
AttributeError: 'str' object has no attribute 'send'

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'send'
velvet tinsel
maiden fable
unkempt canyonBOT
maiden fable
#

!d discord.User.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**.
sick talon
maiden fable
#

Ah the function name should be setup and nothing else

sick talon
#

pithink i have a command with the same name, wouldnt there be a conflict ?

worthy moat
maiden fable
#

It's inside the class and ain't accessible outside the class scope

sick talon
#

oh ok, i will try again

velvet tinsel
worthy moat
#

wait

#
Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 89, in captcha
    user = get_user(id)
NameError: name 'get_user' is not defined

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'get_user' is not defined
#

changed code:

@client.command()
async def captcha(ctx):
        user = get_user(id)
        await ctx.send(f'Aby się zweryfikować patrz dm')
        await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
        embed = Embed(title = 'Captcha', color=998514)
        embed.description = f'aby się zweryfikować napisz co tu jest napisane'
        embed.set_image(url="captchafiles/captcha1.png")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")

        await user.send(embed)
sick talon
worthy moat
#

@velvet tinsel

sick talon
maiden fable
velvet tinsel
#

what is get_user()

#

client.get_user()?

worthy moat
maiden fable
#

A bad example but u get the idea

velvet tinsel
worthy moat
#

yes

sick talon
#

it working now thanks @maiden fable

maiden fable
#

(:

worthy moat
#

@velvet tinsel

velvet tinsel
#

you didnt

#

you only did get_user()

#

you have to do client.get_user()

worthy moat
#
@client.command()
async def captcha(ctx):
        user = client.get_user(id)
        await ctx.send(f'Aby się zweryfikować patrz dm')
        await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
        embed = Embed(title = 'Captcha', color=998514)
        embed.description = f'aby się zweryfikować napisz co tu jest napisane'
        embed.set_image(url="captchafiles/captcha1.png")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")

        await user.send(embed)
#
Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 97, in captcha
    await user.send(embed)
AttributeError: 'str' object has no attribute 'send'

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'send'
worthy moat
#

oh ok

maiden fable
maiden fable
worthy moat
#
@client.command()
async def captcha(ctx):
        id = (ctx.author.id)
        user = client.get_user(id)
        await ctx.send(f'Aby się zweryfikować patrz dm')
        await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
        embed = Embed(title = 'Captcha', color=998514)
        embed.description = f'aby się zweryfikować napisz co tu jest napisane'
        embed.set_image(url="captchafiles/captcha1.png")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")

        await user.send(embed)
#

pls help someone

manic wing
#

any ... errors?

worthy moat
#

yes

#
Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 98, in captcha
    await user.send(embed)
AttributeError: 'NoneType' object has no attribute 'send'

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'
timber ledge
#

I am not sure if this is supposed to be here.
Anyways. So I wanna run my bot with pm2 and I dont know how I can?
This is the command I wanna use with pm2: pipenv run bot
Any help is appreciated!

sick talon
manic wing
slate swan
#

how do I mention a user id in the output?

manic wing
unkempt canyonBOT
#

property mention: str```
Returns a string that allows you to mention the given user.
slate swan
#

the function is on_message and it seems I cannot use ctx

manic wing
sick talon
manic wing
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.
manic wing
sick talon
sick talon
normal folio
#

Why it resets back to 1?

maiden fable
worthy moat
#

how to send image using embed

#

own image

sick talon
maiden fable
#

!local-file

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.

worthy moat
#

ok but how to select other folder

normal folio
slate swan
#

what to do if on_message ate all the commands?

quick gust
#

process the commands

#

await bot.process_commands(message)

velvet tinsel
#

@manic wing

#

I cant seem to be able to solve it

manic wing
velvet tinsel
#

Damn

valid galleon
#

how do i check if the bot has been reply pinged?

#

i want it to respond to only @ mentions not the replies

worthy moat
#

why this doesn't work?
Code:

@client.command()
async def captcha(ctx):
        await ctx.send(f'Aby się zweryfikować patrz dm')
        await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
        embed = Embed(title = 'Captcha', color=998514)
        file = File("/captchafiles/captcha1.png", filename="captcha1.png")
        embed.description = f'aby się zweryfikować napisz co tu jest napisane'
        embed.set_image(url = "attachment://captcha1.png")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")

        await ctx.author.send(embed=embed, file=file)
valid galleon
#

what is the error?

obsidian ledge
valid galleon
#

im doing that already. the problem is that it responds to reply pings as well

obsidian ledge
#

i dont think theres a way that you can avoid reply pings

worthy moat
#

`

#

Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 92, in captcha
    file = File("/captchafiles/captcha1.png", filename="captcha1.png")
NameError: name 'File' is not defined

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'File' is not defined
valid galleon
#

you arent importing i think

velvet tinsel
#

😂

#

What are you trying to do

lament mesa
manic wing
#

@pliant gulch what was the original lefi readme.md? it used asyncio.create_loop or smthin

#

i need that, cus im tryna host a fastapi alongside the bot

lament mesa
#

asyncio.create_task?

manic wing
#

uh

velvet tinsel
#

uh

manic wing
#

whats the difference because client.start & client.run

summer flume
worthy moat
# lament mesa maybe you meant `discord.File`

when i use it this error prints

Ignoring exception in command captcha:
Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\main.py", line 92, in captcha
    file = discord.File("/captchafiles/captcha1.png", filename="captcha1.png")
NameError: name 'discord' is not defined

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

Traceback (most recent call last):
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'discord' is not defined
summer flume
#

nvm, I dont think there is, there is only for the guild banner

manic wing
#

!d discord.Member.avatar.url

brave flint
#

why it show 'Context' object has no attribute 'user'

manic wing
#

!d discord.Member.banner

unkempt canyonBOT
#

property banner```
Equivalent to [`User.banner`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.banner "discord.User.banner")
manic wing
brave flint
#

wait i tried smtg

manic wing
manic wing
#

its ctx.author

brave flint
#

wait"

#

hmm

#

so i want it work for author and for other

manic wing
#

what “other”?

brave flint
#

like ?whois @brave flint

summer flume
#

then member: discord.Member

worthy moat
obsidian ledge
#

can someone tell me why this didnt work

#

this is the error code

Ignoring exception in view <view timeout=180.0 children=1> for item <Button style=<ButtonStyle.secondary: 2> url=None disabled=False label='🎁 Claim' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ui\view.py", line 359, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\USER\Desktop\coding shit\projecttester.py", line 16, in counter
    label = int(button.label)
ValueError: invalid literal for int() with base 10: '🎁 Claim'
manic wing
#

youve tried to int it

obsidian ledge
#

oh

maiden fable
#

U did int("🎁 Claim")

obsidian ledge
#

and how do i make it work

#

like if someone presses it the bot responses?

maiden fable
#

You can't

maiden fable
obsidian ledge
#

alr ty

magic ore
#

send_message*

obsidian ledge
#

and how do i make the bot mention the person who pressed it?

normal folio
#

Why does count reset to 1?

velvet tinsel
#

Caeden being good

obsidian ledge
sullen shoal
#

what lib are you using

velvet tinsel
#

But I forgor

magic ore
unkempt canyonBOT
magic ore
#

has a .mention attribute

worthy moat
#

!file-images

worthy moat
#

i imported discord but it still doesn't work

blissful aspen
#

and delete the discord. from discord.File

#

also delete the import discord, you bcs you literally imported discord twice

velvet tinsel
blissful aspen
supple thorn
#

2 hours of scrolling through tens of thousands of messages

sullen shoal
manic wing
#

!d discord.Member.banner.url

unkempt canyonBOT
#
Out of the question.

No documentation found for the requested symbol.

manic wing
spring flax
#

@slate swan you use 2.0?

manic wing
#

-_-

sullen shoal
#

when tf that came out

supple thorn
spring flax
#

lol

supple thorn
#

Find it

sullen shoal
#

idk any other way to do it other than waiting for the on_message event

spring flax
#

latest is v2.0 yes.

sullen shoal
spring flax
#

@slate swan have you tried member.banner.url?

sullen shoal
#

banner is a property is wont check for its return value and then its attribute

#

!d discord.Asset.url

unkempt canyonBOT
sullen shoal
#

should work

sullen shoal
unkempt canyonBOT
#
Nuh-uh.

No documentation found for the requested symbol.

spring flax
#

okay i wasn't asking if the docs on it were available, i asked have you tried it in the code

sullen shoal
# unkempt canyon

Member.banner returns discord.Asset which does have an attribute named url. the reason this bot couldn't show it is because, it basically scraps RTD
it will not check for return type of an attribute (banner) and then fetch the details of that object

misty dirge
#

is there a way like making a discord bot run a py file with command
example:

someonetype : /start
discord bot : "start another python file"

sullen shoal
velvet tinsel
#

🤷‍♂️

sullen shoal
#

if you really want to do that, one easy way would be to just import the py file

#

inside the command

velvet tinsel
#

I think he wants a slash command

#

Or maybe is bot prefix is /

#

¯_(ツ)_/¯

sullen shoal
#

is there a way like making a discord bot run a py file with command :

velvet tinsel
#

Ok

slate swan
#
@bot.event
async def on_ready():
    guild = bot.get_guild(id)
    for member in guild.members:
        print(member.name)

can someone help me fix this code? it just prints the bot's name

misty dirge
maiden fable
velvet tinsel
sullen shoal
velvet tinsel
slate swan
sullen shoal
velvet tinsel
#

Just print member ig

sullen shoal
#

either that kid is lying or my entire life

slate swan
#

that's what I do

velvet tinsel
#

!intebts

#

!d intents

unkempt canyonBOT
velvet tinsel
slate swan
#
intents = discord.Intents.all()
bot = Bot(command_prefix="", intents=intents)


@bot.event
async def on_ready():
    guild = bot.get_guild(id)
    for member in guild.members:
        print(member)

I already have...

maiden fable
#

!intent

opal skiff
#

how do i anwser a User message so the user is pinged?

slate swan
sullen shoal
#

!d discord.User.mention

unkempt canyonBOT
#

property mention: str```
Returns a string that allows you to mention the given user.
maiden fable
velvet tinsel
#

intents.members = True

opal skiff
slate swan
sullen shoal
#

it does

velvet tinsel
sullen shoal
#

have you enabled them in the portal?

velvet tinsel
#

I mean this guy set it to default

slate swan
velvet tinsel
opal skiff
velvet tinsel
#

I think

opal skiff
#

ok

slate swan
velvet tinsel
sullen shoal
#

okay selfbotting

final iron
opal skiff
velvet tinsel
safe fulcrum
#

How do import discord_slash

slate swan
final iron
safe fulcrum
#

pip install discord-py-slash-command

velvet tinsel
safe fulcrum
#

yes

opal skiff
velvet tinsel
safe fulcrum
#

but its showing me error

tawdry perch
sullen shoal
slate swan
safe fulcrum
velvet tinsel
#

It obviously is against the rules

slate swan
#

y obviously? it's like a bot, but if it is I'll just stop

queen summit
tawdry perch
velvet tinsel
#

Having a self bot you can spam everyone

queen summit
safe fulcrum
tawdry perch
velvet tinsel
safe fulcrum
velvet tinsel
tawdry perch
#

did you run pip install <package>? if yes, restart vsc

velvet tinsel
#

I didn’t use vsc for about 3 months

velvet tinsel
#

Like for projects

#

My VSC is brokken 😭😭

safe fulcrum
#

fixed

tawdry perch
#

wdym by broken?

safe fulcrum
#

am nob

velvet tinsel
tawdry perch
velvet tinsel
#

And I screwed up my run button

sullen shoal
velvet tinsel
#

I installed and uninstalled run code

velvet tinsel
#

Now my run button broken

#

😂 but I use PyCharm

#

PyCharm hot

tawdry perch
#

so.. I have bunch of regexes to prevent antispam (I took these from @unkempt canyon if anyone wonders) but I need to somehow use them as well. How could I implement invite filter? ```py
import re

INVITE_RE = re.compile(
r"(discord([.,]|dot)gg|" # Could be discord.gg/
r"discord([.,]|dot)com(/|slash)invite|" # or discord.com/invite/
r"discordapp([.,]|dot)com(/|slash)invite|" # or discordapp.com/invite/
r"discord([.,]|dot)me|" # or discord.me
r"discord([.,]|dot)li|" # or discord.li
r"discord([.,]|dot)io|" # or discord.io.
r"((?<!\w)([.,]|dot))gg" # or .gg/
r")([/]|slash)" # / or 'slash'
r"(?P<invite>[a-zA-Z0-9-]+)", # the invite code itself
flags=re.IGNORECASE
)

velvet tinsel
#

…..

tawdry perch
#

what?

#

I alrd tried few solutions but they fked up even more

queen summit
#

what do you mean invite filter

#

you should start with an on message event

velvet tinsel
#

Antispam as in stop people from spamming or spamming invites

tawdry perch
#

ye I know?

queen summit
#

yeah ok so add an on_message event

tawdry perch
#

yep that exists

queen summit
#

ok so what are you asking

#

you seem like you know what to do

#

if your asking about basic help on regexes then this isnt the place i would assume

tawdry perch
#

oh ye, you are right 😅 I probably ask some where else as it is not actually related to dpy. Sorry

sullen shoal
tawdry perch
#

I alrd tried

#

but it leads to some unknow variables

sullen shoal
#

that's the code, this bot is made of, if it works there, it is working

#

maybe you're confused on how it works

#

anyway this is not the right place to ask about using regex or

tawdry perch
slate swan
#

Guys I had a bot like NQN. NQN and my bot both check if a webhook exist when the command is executed, if not exist, then create one for the channel. But the problem is my bot gets rate limited but nqn bot which is in more servers does not get rate limited. Any idea why??

sullen shoal
#

read it

sick birch
maiden fable
normal folio
#

Is there any way to convert list strings to int?
Example:

list = [liststring1, liststring2, liststring3]

and it would print to 1, 2, 3

velvet tinsel
#
await ctx.send("`What do you want to do?`\n`1. Play games`\n`2.google`\n`3.send an enail`\n`4. exit`")

                    def check2(msg):
                        return msg.author == ctx.author and msg.channel == ctx.channel
                    def check(msg):
                        return msg.author == ctx.author and msg.channel == ctx.channel and \
                               msg.content.lower() in ["1", "2", "3", "4"]
                    try:
                        msg = await client.wait_for("message", check=check, timeout=30)
                        if msg.content == "1":
                            from random import randint as r
                            number = r(1, 100)
                            message = await client.wait_for("message", check=check2, timeout=30)

apparently, it responds with nothing.

velvet tinsel
normal folio
velvet tinsel
normal folio
slate swan
velvet tinsel
velvet tinsel
misty dirge
#

how i can run a py file with discord
like
if i type :/start
a python file will run

sullen shoal
#

i already answered your question while ago

misty dirge
#

ye it didnt work

sullen shoal
#

you basically import the py file

#

why wouldn't it work

velvet tinsel
misty dirge
slate nymph
#

how to create a channel at the most bottom of the server

sullen shoal
sullen shoal
#

the file must be in the script directory

misty dirge
#

thx

slate swan
#
async def avatar(ctx , member : discord.Member = None):
    if member == None:
        member = ctx.author

    memberAvatar = member.avatar_url
    avaEmbed = discord.Embed(title = f"{member.name}'s avatar")
    avaEmbed.set_image(url = memberAvatar)


    await ctx.send(membed = avaEmbed) ```
#

why is it not working plz?

bright latch
#

error ?

velvet tinsel
#

you did membed instead of embed

bright latch
#

member.avatar.url

velvet tinsel
bright latch
#

yes

quick gust
#

await ctx.send(membed = avaEmbed)

velvet tinsel
#

they did membed when they should have done embed

quick gust
#

yeah

velvet tinsel
#

the indents look awful I know

#

I did a lot of nesting

slate swan
#
  File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\bluet\Documents\python\ozone_bot.py", line 43, in avatar      
    await ctx.send(membed = avaEmbed)
TypeError: Messageable.send() got an unexpected keyword argument 'membed'      

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

Traceback (most recent call last):
  File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Messageable.send() got an unexpected keyword argument 'membed'  ```
maiden fable
#

embed*

bright latch
#

1.7.3 is broken

hazy agate
#

how can i make my bot join vc LL

velvet tinsel
hazy agate
#

LOL

slate swan
hazy agate
velvet tinsel
#
await ctx.send("`What do you want to do?`\n`1. Play games`\n`2.google`\n`3.send an enail`\n`4. exit`")

def check2(msg):
  return msg.author == ctx.author and msg.channel == ctx.channel
def check(msg):
  return msg.author == ctx.author and msg.channel == ctx.channel and \
  msg.content.lower() in ["1", "2", "3", "4"]
try:
  msg = await client.wait_for("message", check=check, timeout=30)
if msg.content == "1":
  from random import randint as r
  number = r(1, 100)
  message = await client.wait_for("message", check=check2, timeout=30)

Goddamnit Myxi here you go

sullen shoal
#

alright

hazy agate
#

wat

velvet tinsel
hazy agate
#

u didn't answer me

hazy agate
velvet tinsel
velvet tinsel
sullen shoal
velvet tinsel
#

i should stop cursing

hazy agate
velvet tinsel
slate nymph
#

how to create a channel at the most bottom of the server?

velvet tinsel
slate nymph
#

yeah ofc

velvet tinsel
#

uh well creating a channel in the bottommost category would work

slate nymph
#

i dont want it to be in a category

velvet tinsel
slate nymph
#

i mean yes

#

but the channel shouldnt be in a category rather be at the bottom

velvet tinsel
sullen shoal
slate nymph
#

ty

sullen shoal