#discord-bots

1 messages · Page 1012 of 1

slate swan
#

no

#

you need to add that button to your selectiview first

#
view = SelectView()
view.add_item(Button(...))
await ctx.respond(embed=embed, view=view)
crimson nova
#

ah okay, sorry i have just begun last month with python ^^,
but my discord.py version is 1.7.3

stone beacon
#

message.send() has a delete_after Kwarg

#

I don't see why you would use io or time at all

heady sluice
#

channel

heady sluice
#

and time would be really bad for your bot

frozen patio
#

I coded one 🙂

slate swan
#

Its simple doe

frozen patio
#

Yea

slate swan
#

U just need a databaseFortniteDude (json is not a db)

#
link_button = discord.ui.Button(label="link", style = discord.ButtonStyle.URL, url = "https://google.com/")
view.add_item(link_button)``` something like this
slate swan
frozen patio
#

But I did this instead for the url

#

discord.ButtonStyle.URL, url = f"https://google.com/{query}"

#

No

slate swan
#

SelectView.add_item(button)?FortniteDude

frozen patio
#

Do you know Python?

slate swan
#

Call the subclass (SelectView) and add_itemstaringcat

#

Yes and no

#
view = SelectView()
link_button = discord.ui.Button(label="link", style = discord.ButtonStyle.URL, url = "https://google.com/")
view.add_item(link_button)

#ur embed codes

await ctx.send(embed = embed, view =  view``` here is an example
brave forge
#

@slate swan what module is needed for this pycord ?

brave forge
#

what module is needed for this pycord ?

slate swan
slate swan
brave forge
brave forge
slate swan
brave forge
slate swan
#

ohh

slate swan
brave forge
#

@slate swan how do you use this damn pycard which module is responsible for it??
from ... import Button, View

brave forge
#

@slate swanhow to make buttons is clear, but which module needs to be spoiled is not

#

what kind of lib ?

formal basin
#

Yes. In slash commands

formal basin
#

Just that command

brave forge
#

I just need to write from ... import Button, View for the buttons, but I do not know what to enter instead of an ellipsis in the video bullshit is shown. I installed the module and the bot says I didn't install it

slate swan
#

any problem?

brave forge
#

@slate swan yes

slate swan
#

wht is it.. lemme see if i can help

#

ping me btw

brave forge
#

@slate swan from ... import Button, View
what do I need to enter instead of an ellipsis ?

slate swan
#

Idk if pycord do support buttons so

#

it does

#

they changed nothing in terms of buttons, as it was a direct fork from discord.py v2 which ws under development at that moment

slate swan
#

!d discord.Button

unkempt canyonBOT
#

class discord.Button```
Represents a button from the Discord Bot UI Kit.

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

Note

The user constructible and usable type to create a button is [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") not this one.

New in version 2.0.
slate swan
#

@brave forge ^^

slate swan
#

it is sstill same

vale wing
#

ui subpackage is for users, this structure is system

slate swan
#

for View it is discord.ui.View

#

u meant pycord*

#

it is py-cord*

#

😏

#

Oh thats WHYY

#

wot?

#

Wait lmao lemme tey something

#

Wait nvm 😭😭😭😭

#

💀

#

😂

#

bro, calm down 💀 😂

brave forge
#

Extension 'cogs.osnov' raised an error: ModuleNotFoundError: No module named 'discord.ui'

slate swan
#

wrong version

#

install from github branch @brave forge

uncut comet
#

yes

slate swan
#

buttons aren't released on pypi yet

uncut comet
#

i want to be able to see who ran this command

brave forge
slate swan
slate swan
uncut comet
slate swan
#

if you've installed directly from pypi, then it's versoin 1.7.3

slate swan
slate swan
#

otherwise, use a footer where u put author's name

#

or do some shit related to ctx.author on_command event

uncut comet
#

the slash command is to a different bot

#

im using a on_message and picking up the embeded response

#

i then want to see from the reply who sent the command

slate swan
#

waittt

#

command in on_message?

uncut comet
#

i cant pick up the command

#

im picking up the responce from the bot

brave forge
uncut comet
#

the embeded message sent into the chanel by the bot

slate swan
#

i can't help u this way

uncut comet
#

?

slate swan
uncut comet
#

bots cant see each others commands

#

if i run a slash command to another bot

#

any other bots wont see it full stop

brave forge
uncut comet
#

thats why im looking at the embed that gets sent in

slate swan
uncut comet
#

and i have no code for that

#

hence im here

brave forge
#

@slate swanhow to update it ?

slate swan
brave forge
#

@slate swanversoin 1.7.3

slate swan
#

ok

#

uninstall it

nimble minnow
#

how do i make a bot that counts
example:
1+ 1 = 2
but i want always to add +1 once i say !count

brave forge
#

@slate swan deleted

slate swan
#

u want to make that count bot.. which is specific to a channel?

nimble minnow
#

nope, check dms

slate swan
slate swan
#

:")

nimble minnow
slate swan
#

i can't help

brave forge
nimble minnow
#

ah.

frozen patio
#

XD

formal basin
nimble minnow
slate swan
frozen patio
#

I cannot read your screen.

formal basin
frozen patio
#

Code then?

#

Of the command.

slate swan
uncut comet
#

i have a check and i can pick out this message
but how can i see who sent the command

nimble minnow
#

wdym

formal basin
nimble minnow
slate swan
uncut comet
nimble minnow
uncut comet
#

huh

frozen patio
nimble minnow
#

just go in dms

uncut comet
#

wdym??

frozen patio
#

It looks fine

brave forge
uncut comet
slate swan
formal basin
slate swan
#

which one are u planning to use? @brave forge

nimble minnow
formal basin
uncut comet
frozen patio
#

I do mine a bit differently for amount

formal basin
brave forge
formal basin
#

But for a normal command amount would work

slate swan
formal basin
frozen patio
#

Yea

nimble minnow
formal basin
uncut comet
nimble minnow
brave forge
uncut comet
#

how to see who sent in the command from the embeded reply

#

from a different bot

formal basin
uncut comet
slate swan
formal basin
uncut comet
formal basin
#

Oh wait

#

Nvm

formal basin
dire folio
formal basin
uncut comet
#

sorry what?
im sending a command to a completely different bot (my bot cant see the command sent to that bott)
but i can see the reply from the bot (the embeded)
i want to see who sent the original command from the embeded reply

slate swan
dire folio
#

yknow that makes complete sense

slate swan
#

🤔 just asking

#

lmao ikr

brave forge
#

@slate swan and why after installing pycord. have my commands stopped working ?

slate swan
#

i don't think.. there is any way for OTHER bot to know the command user of other bot.. if im wrong, pls correct me

stark fable
#

hi guys

#

who can help me ?

slate swan
slate swan
#

yeah.. i feel the same way

uncut comet
dire folio
uncut comet
#

im trying to make my bot do the same hahaha

stark fable
uncut comet
#

so i have seen it done

#

im just unsure how to reproduce it haha

slate swan
formal basin
slate swan
brave forge
slate swan
stark fable
#

this is not about bots, i would like to reply as a user to a message from another determined user

crimson compass
#

anyone can help me start to make a ticket bot

stark fable
brave forge
dire folio
uncut comet
formal basin
dire folio
#

which is against tos

slate swan
stark fable
stark fable
formal basin
slate swan
# uncut comet

🤔 hmm that's interesting.. probably it is using on_message event or something like that

#

idk exactly

uncut comet
#

yea i got stuck haha

brave forge
#

@slate swan how do I delete everything installed ?

uncut comet
#

hence i am now here

dire folio
slate swan
dire folio
#

which isn't allowed

slate swan
#

yep ^^ +1

stark fable
stark fable
dire folio
#

ig but no one here will help you afaik

slate swan
#

!rule 2 @stark fable

unkempt canyonBOT
slate swan
#

:")

dire folio
#

ngl i kinda want to try make one

slate swan
#

~~ same here ~~

#

but i'm more into doing the discord auth shit

brave forge
#

@slate swan thanks for helping. And yes as I understood to make the buttons in discord.py need to do probably not on disocrd.py

slate swan
#

uhm.. i didn't get it completely.. but okay.. if u feel like it helped u

formal basin
slate swan
#

:>

#

and i'm not familiar with its concept of slash.. let's wait till someone comes & help u out :")

brave forge
slate swan
#

importing discord anyway would cause a conflict

slate swan
#

:")

formal basin
#

I wish slash just have the same code as a normal command

#

Because that code will work for a normal command

slate swan
#

i agree till some point

slate swan
#

but i don't want it to happen anymore after migrating to the changes

ocean steeple
#

Hello guys

#

Can I use Azure to host my discord Bot?

#

and digitil ocean

regal pulsar
dense geyser
#

lmao

regal pulsar
#
@bot.slash_command()
async def test(inter: ApplicationCommandInteraction, amt: int):
    await inter.response.send_message(“Hello”)
#

@formal basin

regal pulsar
#

Its a lot easier than people make it sound tbh

stark fable
regal pulsar
#

I mean you can 🕵️

#

Just saying

sick birch
#

I originally didn't care much for it but I wanted to make a sign in with discord option for my bot's web dashboard so that kind of forced me to learn it

#

found it pretty fun

slate swan
#
@client.event
async def on_message(message):
    if channel.name == 'announcements':

        messageembed = discord.Embed(
            description=message,
            color=0xffffff)
        await channel.send(embed=messageembed)

client.run(token)``` this isn't working for me basically im trying to make it so if any message is sent in a channel, it deletes it and changes it to an embed
#

says it can't recognise channel

slate swan
#

oh ok

#

channel hasn’t been declared yet

#

would that above declare it?

#

no

#

It’s getting the message that has been parsed as an argument

#

message.channel.send

#

Channel still doesn’t exist

#

oh mb

#

uh its sending this now

#

when i send a message

boreal ravine
slate swan
#

yeah

#

uh

slate swan
#

To get the message text

#

message is a message object

#

I just wanted to set this prefix to my bot: $

What can I do, if it's writting an error:

client = commands.Bot(command_prefix="$")
TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'
slate swan
#

I just added intents and it fixed it

#

How to do it ?

slate swan
slate swan
#

Here is an example of how to add intents

#

k

#

thanks

#

Np

#

!e ```py
import getpass

class check():
@staticmethod
def number(number,number2, returnbool: bool):
"""Checks if number is bigger than number 2. If so, it will return a statement or a boolean depending on if returnbool is set to True or False."""
#hello
if number > number2:
if returnbool == False:
return "{} is bigger than {}!".format(number,number2)
elif returnbool == True:
return True
elif number == number2:
return "Same number."
else:
if returnbool == False:
return "{} is not bigger than {}!".format(number,number2)
else:
return False
@staticmethod
def type(obj):
return type(obj)
@staticmethod
def string(obj):
if type(obj) == str:
return True
else:
return False
@staticmethod
def integer(obj):
if type(obj) == int:
return True
else:
return False

if check.number(2,2**2,returnbool=True) == False:
print('bob')

unkempt canyonBOT
#

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

bob
slate swan
#

#bot-commands

#

That has nothing to do with this channel

#

ok

#

couldnt find it throuhg all these channels

slate swan
#

Hard to miss

#

pretty easy to miss but alr

#

I would look harder and not put it in some random ass channel

#

🤣

#

ok then lmao

#
import discord
from discord.ext import commands
import youtube_dl
import os

intents = discord.Intents().all()
client = commands.Bot(command_prefix='!', intents=intents)


@client.command()
async def play(ctx, url: str):
    song_there = os.path.isfile("song.mp3")
    try:
        if song_there:
            os.remove("song.mp3")
    except PermissionError:
        await ctx.send("Wait for the current playing music to end or use the 'stop' command")
        return

    voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='『:notes:』music voice')
    await voiceChannel.connect()
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)

    ydl_opts = {
        'format': 'bestaudio/best',
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        }],
    }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([url])
    for file in os.listdir("./"):
        if file.endswith(".mp3"):
            os.rename(file, "song.mp3")
    voice.play(discord.FFmpegPCMAudio("song.mp3"))


# noinspection PyArgumentList
@client.command()
async def leave(ctx):
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    if voice.is_connected():
        await voice.disconnect()
    else:
        await ctx.send("The bot is not connected to a voice channel.")


@client.command()
async def pause(ctx):
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    if voice.is_playing():
        voice.pause()
    else:
        await ctx.send("Currently no audio is playing.")


@client.command()
async def resume(ctx):
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    if voice.is_paused():
        voice.resume()
    else:
        await ctx.send("The audio is not paused.")


@client.command()
async def stop(ctx):
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    voice.stop()
client.run('')
#

I sent this

#
@client.event
async def on_message(message):
    if message.channel.name == 'announcements':
        author = message.author
        messageembed = discord.Embed(
            description=message.content,
            color=0xffffff,
            set_author=message.author)
        await message.delete()
        time.sleep(1)
        await message.channel.send(embed=messageembed)
        print('changed a message to an embed in announcements')``` this just deletes my message and says `NameError: name 'time' is not defined`
slate swan
#

Ok...

slate swan
# slate swan Ok...

!ytdl # For the reason why we don't help, it's not just because they are 'music bots'

#

im dumb af

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
slate swan
#

Your trippin lmao

#

ok so that was the problem for that but now im getting this

#

You shouldn't use time.sleep, it blocks your bot from working.

#
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.description: This field is required```
#

You should use await asyncio.sleep() instead

#
@client.event
async def on_message(message):
    if message.channel.name == 'announcements':
        author = message.author
        messageembed = discord.Embed(
            description=message.content,
            color=0xffffff,
            set_author=message.author)
        await message.delete()
        time.sleep(1)
        await message.channel.send(embed=messageembed)
        print('changed a message to an embed in announcements')
#

thats the code the embed appears for a sec then disappears

#

Your embed is fucked up

#

author =, not set_author=

#

Make sure what you do ignores messages from bots

#

That's one reason of your issue

#

You try to convert embeds to embeds again

#

Embeds coming from your bot

#

how would i do that, i could ig check if the message is the bots message

#

Add a simple check at the top to ignore messages from bots, something like this

if message.author.bot:
    return
#

ah ok lemme try

slate swan
#

it works thanks so much peeps ❤️

slate swan
#

one last question how could i get the person who sent the msgs pfp

slate swan
#

I believe

#

alr lemme see

#

Returns a pfp url

#

What was that

rain salmon
#
import discord, requests, randfacts
client = discord.Client()


@client.event
async def on_ready():
    print('Running...'.format(client))


@client.event
async def on_message(message):
    request = requests.get(url='https://catfact.ninja/fact?max_length=140')
    if message.author.bot:
        return
    if message.author == client.user:
        return
    if message.content.startswith('.catfact'):
        await message.reply(f"The cat fact is: {request.json()['fact']}")
    elif message.content == '.meh':
        await message.reply(f".meh")
    elif message.content.startswith('.fact'):
        await message.reply(f"The random fact is: {randfacts.get_fact()}")

client.run(discord token)
#

it used to work but for some reason now it does not anymore

slate swan
#

Any errors?

rain salmon
#

non

#

it says runningbut the bot does not answer

slate swan
#

If message.author = user it returns

#

Remove that

#

Then it shall work

slate swan
# slate swan message.author.avatar.url

getting this error File "C:\Users\harle\Downloads\final\purge.py", line 50, in on_message messageembed.set_author(name=message.author, icon_url=message.author.avatar.url) AttributeError: 'NoneType' object has no attribute 'url'

@client.event
async def on_message(message):
    if message.channel.name == 'announcements':
        if message.author.bot:
            return
        author = message.author
        messageembed=discord.Embed(description=message.content, color=0xffffff)
        messageembed.set_author(name=message.author, icon_url=message.author.avatar.url)
        await message.delete()
        await asyncio.sleep(0.1)
        await message.channel.send(embed=messageembed)
        print('changed a message to an embed in announcements')```
rain salmon
#

nope does not work

slate swan
#

python 2.0?

slate swan
fickle hamlet
slate swan
#

Print discord.__version__

#

1.7.3

#

Then it's avatar_url not avatar.url, avatar.url is for 2.0

rain salmon
slate swan
#

i tried to update but it gave me an error so i couldn't

#

And you should check for default avatars as said above

slate swan
rain salmon
#

i removed it

#

but still dont work

slate swan
#

Also try adding print statements in the commands to see if they are actually working

#

Debugging is a big part of fixing errors

#

I mean debugging is fixing errors 💀

slate swan
#

ImportError: cannot import name 'Mapping' from 'collections' (C:\Python310\lib\collections\__init__.py)

#

Change your code from

from collections import Mapping

to

from collections.abc import Mapping
slate swan
slate swan
rain salmon
slate swan
rain salmon
#

i made it print something if it goes to the def but it does not

slate swan
#

Show your code

#

Python 3.10 made changes to collections and if a library you're using uses that, then you get an error as they haven't updated it yet

rain salmon
#
import discord, requests, randfacts
client = discord.Client()


@client.event
async def on_ready():
    print('Running...'.format(client))


@client.event
async def on_message(message):
    print('a')
    request = requests.get(url='https://catfact.ninja/fact?max_length=140')
    if message.author.bot:
        return
    if message.content.startswith('.catfact'):
        await message.reply(f"The cat fact is: {request.json()['fact']}")
    elif message.content == '.meh':
        await message.reply(f".meh")
    elif message.content.startswith('.fact'):
        await message.reply(f"The random fact is: {randfacts.get_fact()}")
slate swan
#

Reinstalling might not do the trick, they might have not even been updated

rain salmon
slate swan
#

You can for sure try to update them

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

slate swan
#

!d discord.Intents.messages

unkempt canyonBOT
slate swan
slate swan
#

Probably following typical tutorials which show exactly what not to do

#

Lmao

#

Discordpy tutorial slander

#

There is no tutorial that actually explains how to make a bot in a decent way, but people are new and they don't know that so they think it's good

rain salmon
#

but it used to work without it

slate swan
#

Everyone I could run this thing, now it can't be (

client = discord.Client()
TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'
slate swan
rain salmon
#

like an hour ago

slate swan
#

As the example shows above

#

Oh, sorry

#

Client is not made for your plans

#

Ehh copy past from site is so bad (I did .Bot last time)

#

Don’t copy and paste

#

You learn nothing

#

I know,

#

I didn't

#

Only one time

#

Now I learned it (few hours ago*)

#

Only copy and paste when you understand the code

#

That’s the only acceptable way to copy and paste

#

Even in that case; read the code, understand it to get some inspiration and then make your own solution

#

Ima watch better call Saul then go to bed, cya guys

#

👋

rain salmon
#

better call saul is cool xd

slate swan
slate swan
#

Breaking bad is better

rain salmon
#

yes xd

#

i still dont understand the intents thing

slate swan
slate swan
#

If you think better call Saul is better than breaking bad your not allowed to watch anything

rain salmon
#

gud series drive to survive

boreal ravine
#

!rule 5

unkempt canyonBOT
#

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

slate swan
#

and not version 2.0

slate swan
#

oh

#

Install it with pip install git+https://github.com/Rapptz/discord.py

slate swan
#

!rule 7

unkempt canyonBOT
#

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

slate swan
rigid trench
slate swan
#

It said client = discord.Bot()
AttributeError: module 'discord' has no attribute 'Bot'

#

Look at the example above again please

slate swan
spice adder
#

Quick question: Is it possible to perform remote actions (I.e. autoban users in one server that are banned in another), and if so, how?

full lily
rain salmon
#

krypto what did u mean add intents to my code?

slate swan
#

These are important lines

boreal ravine
rain salmon
#

it confused me

slate swan
#

Ohhhhh

#

But I don't use it )

spice adder
boreal ravine
full lily
spice adder
#

It does, in fact it was only made for these two servers

slate swan
full lily
#

then sure

slate swan
#

You really don't see a difference between the highlighted blue lines and your code?

spice adder
#

The goal is to have it automatically kick members from one server, using on_member_ban, that are banned in the other/main server

slate swan
#

I don't see any

from discord.ext import commands

import

#

And I don't see that you use commands.Bot

#

Oh...

slate swan
slate swan
spice adder
slate swan
#

I need only automatically deleting bad words

#

I did it last time, now not works

boreal ravine
slate swan
#

nope

spice adder
slate swan
slate swan
#

can someone help me with this error File "C:\Users\harle\Downloads\final\purge.py", line 9, in <module> client = discord.Client() TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

#

The last question: how to add intens, last time it didn't need them, but know ||IDK WHY|| but it need them...

#

if you need the code lmk

boreal ravine
#

kwargs are the basics of python

slate swan
#

Hello, I have created a command, that when you turn it on, it runs other functions for 1 day. And I would like to know how I can make it so that another user can also do the command even if the other one is still running

boreal ravine
#

look at that SS and see what your code is missing

slate swan
#

!intents

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.

slate swan
#

Read the entire message, not just the code

#

Otherwise you will come to another error because you haven't read it entirely

slate swan
slate swan
#

It said

#

For the fourth time, please read
You're missing

from discord import Intents
#

Ohh

#

Now what ?

intents.member = True
AttributeError: 'Intents' object has no attribute 'member'
#

eh..

#

I need to import Mebers

#

It's members

#

WORKED

slate swan
#

Yeah that will make it block

slate swan
slate swan
# slate swan WORKED

Noo, it worked, but my command

@client.event
async def on_message(message):
    if any(word in message.content.lower() for word in["lol", "haha", "mhm"]):
        await message.delete()

not working

#

What intents have you enabled?

#

members

slate swan
#

look..

#

We told you to enable the messages intent

heady sluice
#

he says his command isn't working

#

and it's because he has an on_message

slate swan
#

The members intent is just an example

#

oksec

slate swan
heady sluice
slate swan
#

It's not this

slate swan
#

They only have a word filter, that's it

heady sluice
#

I'm literally done

slate swan
#

now what..

#

not working

#

Is that the entire code?

#

PyCharm (idk what is entire ......)

#

Is that all your code or you have something below

#

Yes I have smthong

#

Something with .run()?

#

Don't send it, just yes or no

#

no

#

I wanna send

#

Here we go....

#

Yeah ok

#

It ran\

slate swan
# slate swan Make it asynchronous

like this ?

@bot.command()
async def test(ctx):
    z = get_string()
    await test2(z)

async def test2(z):
    for i in range(50):
        print(z)
        time.sleep(5)

because no work

#

Now you need another intent

#

but when I type one of that words it don't do anything (which intent)

#

The message_content intent is also needed

#

Ok.

slate swan
#

Where.. ?

#

Ik it is wrong

#

intents.messa....

#

Have you learned Python?

#

Yes

#

Then maybe you want to learn more about OOP in Python before doing a bot. Doesn't seem like you know that pretty well and it's fundamental to know it

slate swan
#

OH MY GODDES worked (I learned only Python IDLE a bit), but it works again and when I said bad word it is automatically deleting, so, I am so happy again (I am Ukranian btw) I wish you a good night (2 am for me ...)

#

how did you get "Advent of Code" role here ?

full lily
#

opt in, meaning you can give it to yourself

fervent shoal
#

how would i use custom emotes with the bot

slate swan
#

however, none of my scripts work, i added the intents thing in the scripts too

#

File "C:\Users\harle\Downloads\final\purge.py", line 14, in <module>
client = discord.Client()
TypeError: Client.init() missing 1 required keyword-only argument: 'intents'

#
client = discord.Client()```
final iron
#

pretty clear my guy

#

!d discord.Client

unkempt canyonBOT
#

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

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

discord pycord

@bot.slash_command()
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.respond(embed = avaEmbed)

"member" object has no attribute "avatar_url"
idk what I forgot

slate swan
hybrid ravine
#

guys how can i get everyone whos banned in a guild?

silver agate
#

pip?

#

why should I reinstall pip?

#

o.o

slate swan
hybrid ravine
sage otter
unkempt canyonBOT
#

async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

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

Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list...
silver agate
#

No error just when I try to use the command

silver agate
sage otter
#

yes

silver agate
#

wait

sage otter
#

Are you on 2.0?

silver agate
#

o.o

silver agate
sage otter
#

Then yes.

hybrid ravine
# unkempt canyon
bannedmems = [] 
async for mem in bans(*):
    bannedmems.append(mem)
``` so this would worj?'
silver agate
#

Oh yeah lol. Saw that I did all my commands with author/member."...."

#

bruh ok my fault, thanks Tylerr

sage otter
#

And what’s the point of that star there

hybrid ravine
silver agate
#

@sage otter Banner is the same with just .banner right?

hybrid ravine
silver agate
#

nope its not working

#

'NoneType' object has no attribute 'url'

sage otter
#

but it’s different. You need the members User object for the banner.

silver agate
#

tf

sage otter
#

Idk

silver agate
#

strong xd whys it so complicated

hybrid ravine
sage otter
#

In the docs. If you read, if you pass in None which is the default value. It returns all the bans.

hybrid ravine
jade tartan
#

If i want to have the embed field value to be empty how do i make it do that? because i want it to store numbers on that field if that make sense

#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
    embed.add_field(name='Name', value=str(ctx.author.name), inline=True)
    embed.add_field(name='Age', value="", inline=True)
    embed.add_field(name='Gender', value="", inline=True)
    embed.add_field(name='Orientation', value="", inline=True)
    embed.add_field(name='Location', value="", inline=True)
    embed.add_field(name='Dating status', value="", inline=True)
    embed.add_field(name='Height', value="", inline=True)
    embed.add_field(name='DMs status', value="", inline=True)
    embed.add_field(name='Verification level', value="", inline=True)
    embed.add_field(name='Looking for', value="", inline=True)
    embed.add_field(name='Hobbies', value="", inline=True)
    embed.add_field(name='About me', value="", inline=True)
    embed.set_author(name=ctx.author.name, icon_url= ctx.message.author.avatar_url)
    await ctx.send(embed=embed)```
fickle hamlet
sage otter
slate swan
#

is it possible to make webhooks with disnake?

boreal ravine
#

yes

slate swan
slate swan
pliant gulch
#

Guy was giving real help too

frozen patio
#

Yep

#

😔

#

Dead chat

green bluff
#

elaborate

#

are you familliar with databasews

#

also id suggest go look up tutorials cause this stuff usually takes itme

#

maybe

#

try making it and share the errors with us

#

well maybe try learning sql or mongo db first

#

maybe start with more simple commands then

#

and try learn the basics of python

#

database but i suggest you learn python before you move onto them

supple thorn
#

!resources

unkempt canyonBOT
#
Resources

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

frozen patio
#

Coke smart

slate swan
#

💀 then find videos in your language

supple thorn
#

What is your language

#

Try searching up python tutorials in french

sick birch
#

Error says it

#

It can't find Player

#

Depends on what Player is

#

Is it a function, a class, where is it from? A pip module or some other file? etc

dusky pine
#

maybe you can try from player import Player

sick birch
slate swan
#
File "d:\CODE\py\discord.py\main.py", line 88, in work
    user[str(user.id)]["wallet"] += earnings
TypeError: 'Member' object is not subscriptable

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

Traceback (most recent call last):
  File "C:\Users\H81\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\H81\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\H81\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: 'Member' object is not subscriptable
#

what is this error guys ?

stray carbon
#
@client.command(hidden=True)
async def prefix(ctx, prefix=None):
    if prefix is None:
        return
    async with aiosqlite.connect('prefixes.db') as db:
        async with db.cursor() as cursor:
            await cursor.execute('SELECT prefix FROM prefixes WHERE guild = ?', (ctx.guild.id,))
            data = await cursor.fetchone()
            if data:
                await cursor.execute('UPDATE prefixes SET prefix = ? WHERE guild = ?', (prefix, ctx.guild.id,))
                await ctx.reply(f'Updated prefix to `{prefix}` successfully.')
            else:
                await cursor.execute('INSERT INTO prefixes (prefix, guild) VALUES (?, ?)', (',', ctx.guild.id,))
                await cursor.execute('SELECT prefix FROM prefixes WHERE guild = ?', (ctx.guild.id,))
                data = await cursor.fetchone()
                if data:
                    await cursor.execute('UPDATE prefixes SET prefix = ? WHERE guild = ?', (prefix, ctx.guild.id,))
                    await ctx.reply(f'Updated prefix to `{prefix}` successfully.')
                else:
                    return
        await db.commit()

I am using this to change prefix and it changes but still doesnt work for new prefix and works for , only
||Sorry if i am asking in wrong channel|| https://media.discordapp.net/attachments/865884512692207636/969810961559080990/unknown.png

#
async def getprefix(client, message):
    async with aiosqlite.connect('prefixes.db') as db:
        async with db.cursor() as cursor:
            await cursor.execute('INSERT INTO prefixes (prefix, guild) VALUES (?, ?)', (',', message.guild.id,))
            data = await cursor.fetchone()
            if data:
                return data
            else:
                try:
                    await cursor.execute('INSERT INTO prefixes (prefix, guild) (?, ?)', (',', message.guild.id,))
                    await cursor.execute('SELECT prefixes SET prefix = ? WHERE guild = ?', (message.guild.id,))
                    data = cursor.fetchone()
                    if data:
                        await cursor.execute('UPDATE prefixes SET prefix = ? WHERE guild = ?', (',', message.guild.id,))
                except Exception:
                    return ','

I believe here is some error

slate swan
abstract kindle
#

``py

#

oops

#
@bot.tree.command(guild=discord.Object(id=guild_id), name="hello",
                      description="Use this and I'll say hi!")
    async def slash(interaction: discord.Interaction):
        await interaction.response.send_message("Hi!")
#

How would I implement a slash command like this in a Cog?

torn sail
#

And the function would be the same

abstract kindle
#

except with self stuff, right?

torn sail
#

Yep

autumn trench
#

how do i get a user object from an ID? i'm having some trouble getting it to work

    messages = await ctx.channel.history(limit=200).flatten()
    for i in messages[::-1]:
        print(bot.get_guild(ctx.message.guild.id).get_member(i.author.id))
abstract kindle
#

how do I learn more about the decorators?

torn sail
abstract kindle
#

I mean the specific app_commands.command decorator

torn sail
#

Docs maybe

#

!d discord.app_commands.command

unkempt canyonBOT
#

@discord.app_commands.command(*, name=..., description=...)```
Creates an application command from a regular function.
abstract kindle
#

bah I keep looking on outdated docs

#

I need to just save the master docs

pliant gulch
autumn trench
#

it doesn't seem to be? when i do ctx.author.color i get the right hex value, but when i do i.author.color it just returns black (#000000)

autumn trench
# pliant gulch `i.author` is already the user/member object which sent the message
def information(message):
    return {'COLOUR': message.author.color, 'NAME': message.author.name, 'ICON' : None, 'CONTENT': message.content, 'BOT': message.author.bot, 'TIME': message.created_at}

@bot.command()
async def archive(ctx):
    messages = await ctx.channel.history(limit=200).flatten()
    for i in messages[::-1]:
        # print(bot.get_guild(ctx.message.guild.id).get_member(i.author.id))
        print(information(i)['COLOUR'])
torn sail
autumn trench
#

i is the message object, since its looping through the messages in messages

#

by author do you mean the person who sent the command?

torn sail
#

Yes

autumn trench
#

no, they arent necessarily the same

#

its grabbing the messages from the channel and im trying to get the name colour of the person who sent each i

torn sail
#

!d discord.User.color

unkempt canyonBOT
#

property color```
A property that returns a color denoting the rendered color
for the user. This always returns [`Colour.default()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour.default "discord.Colour.default").

There is an alias for this named [`colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.colour "discord.User.colour").
autumn trench
#

yeah thats the problem though

torn sail
#

Says something about default color 0 here

split merlin
autumn trench
#

when i just have ```python
@bot.command()
async def archive(ctx):
print(ctx.author.color)

#

they are different actually

autumn trench
#

solved it! nikoThumbsUp

boreal ravine
spring flax
#

okay so for a modmail bot, when someone DM's the bot and confirms, it opens a ticket and for the bot to know which ticket is open, I put it in a db. If a user has an open ticket in the db, it sends the message, if not, it gives the confirmation message (whether they're sure they want to create a ticket). Now, I saw someone has opened two tickets at the same time. does anyone have an idea why?

quaint epoch
#

i would recommend a per member ticket cooldown, or a custom check

spring flax
quaint epoch
unkempt canyonBOT
#

@disnake.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Command "disnake.ext.commands.Command") or its
subclasses. These checks could be accessed via [`Command.checks`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Command.checks "disnake.ext.commands.Command.checks").

These checks should be predicates that take in a single parameter taking
a [`Context`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Context "disnake.ext.commands.Context"). If the check returns a `False`-like value then
during invocation a [`CheckFailure`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.CheckFailure "disnake.ext.commands.CheckFailure") exception is raised and sent to
the [`on_command_error()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.disnake.ext.commands.on_command_error "disnake.disnake.ext.commands.on_command_error") event...
quaint epoch
#

lemme give an example

spring flax
#

it's not a command

quaint epoch
spring flax
supple thorn
spring flax
quaint epoch
slate swan
#

hi

quaint epoch
#

such as py if user.id in db: return await ctx.send('you already have an open ticket')

quaint epoch
supple thorn
sullen pewter
#

It's not listening to command verification

spring flax
#

it should work

sullen pewter
#

no errors

supple thorn
spring flax
#

i did testing before I pushed it out to my bot but yes it did work

slate swan
#

this makes my json empty for some reason

with open("giveawaytime.json","w") as f:
          logs2 = json.load(f)
quaint epoch
# sullen pewter It's not listening to command verification

try creating a view class separately, i usually do it like ```py
class my_view(View):

@button(style=discord.Style.green, name='Verify')
async def callback(self, button: Button, interaction: discord.Interaction):
pass # do something here

await ctx.send(view=my_view())```

slate swan
#

i want to delete a key

supple thorn
#

Are you perhaps using json as database again

slate swan
#

nope

quaint epoch
slate swan
#

i found sql hard and im learning it

supple thorn
#

I'll let double 7 handle this

slate swan
#

hm?

quaint epoch
supple thorn
#

In this case

slate swan
#

im stuck in IMPORT in sql

quaint epoch
quaint epoch
#

forgor this is async

slate swan
#

not writable

slate swan
#

okay

formal basin
quaint epoch
#

either import, or take it from a module

formal basin
#

Like what’s the code

quaint epoch
#

huh

#

import it as from disnake import ApplicationCommandInteraction

formal basin
#

Do I import?

quaint epoch
#

yes

formal basin
#

disnake?

quaint epoch
#

either that or access it by disnake.ApplicationCommandInteraction

formal basin
#

What’s disnake?

#

from disnake import ApplicationCommandInteraction

#

I’m using dpy

#

Not disnake

dull terrace
#

I finally, finally think i'm nearing the end creating my bot. After getting a rough prototype done, i wrote down 60 items to complete and estimated two weeks to finish it. I've now completed 242 items in my dev log, have 9 left to go, and if i get finished in a couple days i'll have spent 6 weeks on it.

slate swan
#

So I'm making my discord bot and I want to set the thumbnail of an embed. As we know, discord.py only accepts links in the url parameter, But I want to use an image which exists in my working directory, not a link. How can I do that? Any help is appreciated (:

dull terrace
#

i think if my brain is working that should do it

slate swan
#

there is no disnake function or something @dull terrace

dull terrace
#

replace disnake with discord if you're using that

dull terrace
#

it's the module you imported

slate swan
#

thanks let me try it

dull terrace
#

you may have to send the file in the message too

slate swan
#

hm

#

let me try first

dull terrace
#

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

#

or however you're sending it

slate swan
#

File "c:\Users\DEBARKA NASKAR\Desktop\The Marauders\main.py", line 1330 file = discord.File(fp='C:\Users\DEBARKA NASKAR\Desktop\The Marauders', filename='flower.png') ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

#

@dull terrace Why is this coming?

paper sluice
#

fp=r'C:\Users\DEBARKA NASKAR\Desktop\The Marauders'

dull terrace
#

oh, you have to put the full path

slate swan
dull terrace
#

'C:/Users/DEBARKA NASKAR/Desktop/The Marauders/flower.png'

slate swan
#

ok

dull terrace
#

wait where is your python file

slate swan
dull terrace
#

if it's in the marauders

#

just 'flower.png' i think

slate swan
#

IT WORKED TYSM

dull terrace
slate swan
#

:pogfish:

#

no nitro ._.

stone beacon
quaint epoch
formal basin
#

I fixed it anyway

slate swan
#

replit

slate swan
quaint epoch
slate swan
quaint epoch
#

.topic

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

Suggest more topics here!

quaint epoch
# lament depot

prolly a server mapping command, shows which users have the most activity, most active channels, most messages sent, who was banned recently, and other things

slate swan
#

Could someone please help me figure out what this means?

Attribute avatar_decoration is missing from the User data model, skipping.

trying to do slash commands with discord interactions

slate swan
#

and the full traceback

quaint epoch
#

i think you tried to instantiate a class directly

#

instead of get/fetch

stone beacon
abstract kindle
#

why is guild.members giving me a list of 1 member

#

and that member is my bot

quaint epoch
abstract kindle
#

:0

quaint epoch
#

go to application page, turn on all intents

#

and in your code do py intents = discord.Intents.all() bot = commands.Bot(command_prefix='!', intents=intents, case_insensitive=True)

slate swan
#

@slate swan @quaint epoch

import discord
import interactions


token = str("my token")
client = discord.Client()
bot = interactions.Client(token=token)

@client.event
async def on_ready():
    print('Bot Started')

@bot.command(
    name="test",
    description="test",
    scope=963627111111856138,
    options = [
        interactions.Option(
            name="test2",
            description="test2",
            type=interactions.OptionType.STRING,
            required=True,
        ),
    ],
)

async def thorne(ctx: interactions.CommandContext, test2: str):

  await ctx.send("Working", ephemeral=True)

  bot.run()
abstract kindle
#

@quaint epoch u the goat, thanks

slate swan
#
PS C:\Users\Micha>  c:; cd 'c:\Users\Micha'; & 'C:\Users\Micha\AppData\Local\Programs\Python\Python39\python.exe' 'c:\Users\Micha\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy\launcher' '57290' '--' 'c:\Users\Micha\discslash.py'
Attribute avatar_decoration is missing from the User data model, skipping.
PS C:\Users\Micha> 
quaint epoch
#

you can't do that

#

the context for regular commands is discord.ext.commands.Context

#

for slash commands, use~

#

welp, back to the docs

#

gimme a bit, kay

paper sluice
#

why not just use the slash commands that come with discord.py?

quaint epoch
quaint epoch
#

here -

#

!d disnake.ext.commands.Bot.slash_command

unkempt canyonBOT
#

@slash_command(*args, **kwargs)```
A shortcut decorator that invokes [`slash_command()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.slash_command "disnake.ext.commands.slash_command") and adds it to
the internal command list.
vale wing
#

Discord making a feature for killing some kind of bots again 💀

quaint epoch
#

use this instead

quaint epoch
vale wing
#

Idk how good it is

#

Gotta test

paper sluice
quaint epoch
#

how do you enable it?

#

is it canary?

vale wing
#

It is beta and available to limited amount of servers

paper sluice
slate swan
#

wow

vale wing
#

Well time to test its bypass resistance

quaint epoch
vale wing
#

Lmao

#

I made almost unbypassible word filter and now there's discord

slate swan
formal basin
#

When in use the command it doesn’t say that I’m on a cool down

quaint epoch
#

!pypi better_profanity --- go brrrr

unkempt canyonBOT
formal basin
quaint epoch
formal basin
formal basin
quaint epoch
unkempt canyonBOT
#

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

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

This is only supported with the following interaction types...
slate swan
#

@quaint epoch i dont see the problem with that I did, could you please expand or talk to me in #help-falafel

vale wing
formal basin
vale wing
#

And I am gonna add character antidoubling later

quaint epoch
#

because if the application does not response in 3 seconds, it say's it did not respond

#

and btw, show your work command

formal basin
#

@slash.slash(name="work", description="work to get money")
@commands.cooldown(1, 300, commands.BucketType.user)
async def work(ctx):
await open_account(ctx.author)

users = await get_bank_data()

user = ctx.author

earnings = random.randrange(20000)

await ctx.send(f"you got {earnings} coins from working")

users[str(user.id)]["wallet"] += earnings

with open("bank.json", "w") as f:
    json.dump(users, f)
vale wing
#

Second didn't get censoured

formal basin
# quaint epoch and btw, show your work command

@slash.slash(name="work", description="work to get money")
@commands.cooldown(1, 300, commands.BucketType.user)
async def work(ctx):
await open_account(ctx.author)

users = await get_bank_data()

user = ctx.author

earnings = random.randrange(20000)

await ctx.send(f"you got {earnings} coins from working")

users[str(user.id)]["wallet"] += earnings

with open("bank.json", "w") as f:
    json.dump(users, f)
slate swan
vale wing
#

And as you can see it sucks

slate swan
vale wing
#

I programmed a better thing

#

But I got no server to host in on because of stupid sanctions

#

Gonna build bare metal

formal basin
formal basin
quaint epoch
#

but it was too aggressive

abstract kindle
#

How do I make this for my guild only so that it syncs instantly?

@app_commands.command(name="hello", description="Use this for me to say hi!")
slate swan
quaint epoch
slate swan
quaint epoch
#

just defer

formal basin
quaint epoch
#

then do stuff after

formal basin
#

Oh ok.

quaint epoch
#

sending messages, calculations, all that

abstract kindle
#

Like

#

How do I make it sync to my guild

formal basin
#

await defer(thinking=False)

formal basin
abstract kindle
#

Is there somewhere I have to make it for my guild only?

formal basin
quaint epoch
quaint epoch
#

in the decorator

abstract kindle
#

that's not an option for that decorator

quaint epoch
#

dpy, disnake?

abstract kindle
#

dpy

slate swan
formal basin
abstract kindle
#

yea it does..

slate swan
#

I don’t believe

quaint epoch
#

!d disnake.ext.commands.Bot.command

unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.command "disnake.ext.commands.command") and adds it to
the internal command list via [`add_command()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.GroupMixin.add_command "disnake.ext.commands.GroupMixin.add_command").
abstract kindle
#

I'm looking at the docs rn

quaint epoch
#

just import commands instead of app_commands

#

that's what most people do

abstract kindle
#

im on dpy 2.0

quaint epoch
#

what's the latest version?

slate swan
abstract kindle
#

2.0

quaint epoch
# abstract kindle

that's an application command, not a regular text/slash_command, i don't think you can do that then

regal cove
#

how could i make a leaderboard command for my discord.py economy bot using aiosqlite?

quaint epoch
#

i haven't used it myself tho

regal cove
quaint epoch
regal cove
quaint epoch
#

you can

slate swan
#

Even though your using it in a discord bot, your handling all your database stuff

regal cove
quaint epoch
regal cove
#

yeah

abstract kindle
#

Slash commands are part of applciation commands tho..

#

NVM

formal basin
quaint epoch
abstract kindle
#

Literally another decorator lol

quaint epoch
regal cove
slate swan
regal cove
#

i know lol

#

thats why i asked here aswell

slate swan
#

I gave up on databases a while ago

#

The hosting service I’m using just allows me to edit json files so I’m using that

regal cove
#

oh

#

thats sad cus json is really bad

slate swan
#

It has a built in database too but I cba to use it

regal cove
#

yeah

#

im mostly working with this bot cus my friends and i have a private server with an economy bot

#

and json lagged so much that we had to switch database

slate swan
#

That’s probs why my commands are so slow 💀

quaint epoch
#

!d discord.ext.commands.CommandOnCooldown

unkempt canyonBOT
#

exception discord.ext.commands.CommandOnCooldown(cooldown, retry_after, type)```
Exception raised when the command being invoked is on cooldown.

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

try printing out the type of the error

formal basin
#

It printed it?

slate swan
#

commands.errors.CommandOnCooldown

formal basin
slate swan
slate swan
#

Instead of commands.CommandOnCooldown

formal basin
#

Ok

formal basin
gaunt ice
#

remove return

slate swan
gaunt ice
#

just try

slate swan
#

K

#

Useless try

gaunt ice
#

@formal basin

#

ok

formal basin
slate swan
#

It's ctx.send() now just as side note

#

I believe send_message is old

gaunt ice
#

hm

slate swan
#

NOT ON_COMMAND ITS ON_ERROR FFS

#

@formal basin

#

No that is correct

#

What

#

Bruh ☠️

gaunt ice
#

on_command_error is ryr

#

ok

slate swan
#

Oh he did put on_command_error

#

Bruh I’m blind Bruh_Penis

formal basin
slate swan
gaunt ice
#

send_message to send

formal basin
gaunt ice
#

did it work

formal basin
gaunt ice
#

hm

#

show whole code

#

!bin

#

!pastebin

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.

slate swan
formal basin
gaunt ice
#

DELETE

#

fasttt