#discord-bots

1 messages ยท Page 231 of 1

vocal snow
#

did you read the error?

#

it requires you to pass the intents argument

#

!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. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

slate swan
#

okk tjx

#

thx

stuck crown
#

oh im sorry here is the full code. i have already passed that

import discord
import sqlite3
import time
import django
import twitchAPI
import bs4
import logging
import logging.handlers
import os
import datetime
import keys

# connect to sqlite3 db
sqlite3.connect("pyTourney.sqlite")

# set the bots intents
intents = discord.Intents.default()
intents.messages = True
intents.message_content = True
intents.typing = True

# Login to discord api
client = discord.Client(intents=intents)

# check for existing logfile and rename if true
now = datetime.datetime.now()
logfile = "discord.log"
logfilebak = f"{logfile}.{now.month}-{now.day}-{now.hour}-{now.minute}"
logencoding = 'utf-8'
loghandlermode = 'w'
loglevel = logging.DEBUG

if os.path.exists(logfile):
    print(f"discord.log exists, renaming existing logfile to {logfilebak}")
    os.rename(logfile, logfilebak)

# enable logging
loghandler = logging.FileHandler(filename=logfile, encoding=logencoding, mode=loghandlermode)

discord.utils.setup_logging(handler=loghandler, level=loglevel, root=True)


# tell you when bot is ready to start work
@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')


# listen for keywords and respond
@client.event
async def on_message(message):
    if message.author == client.user:
        print(f'{message.channel.name}{message.author.name}{message.content}')
        return

    if message.content.startswith('$hello'):
        await message.channel.send(f'Hello {message.author.name}!')

    if message.content.startswith('$dead'):
        await message.channel.send(f'you died {message.author.name}!')


# tells the bot to run
client.run(keys.bot_token)

vocal snow
#

is it giving you an error?

stuck crown
# vocal snow is it giving you an error?

no errors just not printing the message content to my console. the goal for now is to be able to type anything into a specific channel and have the bot print it to my console. once i can do that i can move on to my end goal

vocal snow
stuck crown
vocal snow
#

oh yes im blind

#

so it prints the rest

stuck crown
#

its printing the $hello command but not the testing123

slate swan
#

so i enable all the intents on the developper portal qnd i add
from discord import Intents
from discord.ext import commands

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

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

#

but it says the exact same error

vocal snow
#

you dont add that

#

you pass the required intents to your Client/Bot

slate swan
vocal snow
#

intents keyword argument

stuck crown
#

omg im a idiot

vocal snow
#

as demonstrated in the example

stuck crown
#

nested ifs are such a stupid pain sometimes

#
@client.event
async def on_message(message):
    if message.author == client.user:
        print(f'{message.channel.name}{message.author.name}{message.content}')
        return

    if message.content.startswith('$hello'):
        await message.channel.send(f'Hello {message.author.name}!')

    if message.content.startswith('$dead'):
        await message.channel.send(f'you died {message.author.name}!')```
vocal snow
#

these arent nested

slate swan
vocal snow
#

no

stuck crown
#

so its giving me the exact info if its matching the the startswith portion

stuck crown
# vocal snow no

so my issue was i had my print statement returning in the if statement all i had to do was move it outside of the if statement

@client.event
async def on_message(message):
    print(f'{message.channel.name},{message.author.name},{message.content}')

    if message.author == client.user:
        return

    if message.content.startswith('$hello'):
        await message.channel.send(f'Hello {message.author.name}!')

    if message.content.startswith('$dead'):
        await message.channel.send(f'you died {message.author.name}!')```
#

now its working perfectly!!!

#

thanks for the second set of eyes

vocal snow
#

oh yes i see what was wrong

#

i am very blind today

glad cradle
stuck crown
vocal snow
slate swan
#

now it says that an improper token has been passed

vocal snow
#

did you get the token from the dev portal?

#

not the client id/client secret

#

might want to try regenerating it if so

slate swan
#

i put it between ""

#

its probably the problem

vocal snow
#

what

slate swan
#

i put the token between ""

white solstice
#

guys can someone help me make a basic discord bot with a couple feautres

#

all i need is it to have 2-4 commands

stuck crown
# vocal snow what

while i have your brain maybe you can help point me in the direction with this. when i type anything other than the 2 commands it errors out but works fine if i have just a single command

    if not message.content.startswith('$hello', '$dead'):
        await message.channel.send(f'Hello {message.author.name}! Only the following commands can be used in this channel. $hello, $dead')
stuck crown
# white solstice all i need is it to have 2-4 commands

heres a super simple template you can work off of but youll need to setup the bot on the discord developer site and get your bot token

import discord

# set the bots intents
intents = discord.Intents.default()
intents.messages = True
intents.message_content = True
intents.typing = True

# set the bots token
bot_token = 'YOUR TOKEN GOES HERE'

# Login to discord api
client = discord.Client(intents=intents)


# tell you when bot is ready to start work
@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')


# listen for keywords and respond
@client.event
async def on_message(message):
    print(f'{message.channel.name},{message.author.name},{message.content}')

    if message.author == client.user:
        return

    if message.content.startswith('$hello'):
        await message.channel.send(f'Hello {message.author.name}!')

    if message.content.startswith('$dead'):
        await message.channel.send(f'you died {message.author.name}!')


# tells the bot to run
client.run(bot_token)
stuck crown
outer parcel
#

If anyone could give me help on how i can save an intventory system in aiosqlite

#
await cursor.execute("CREATE TABLE IF NOT EXISTS inventory (user INTEGER, items LIST)")
#

I want to make it User ID and then the items which is a dictionary

#

and im confused on how to make the items a dictioanry

vocal snow
#

you dont make a dictionary

#

you make another table

outer parcel
#

?

vocal snow
#

you could have user_id, item_id, quantity in one table

outer parcel
#

OH

vocal snow
#

and item_id, item_name, etc in another

outer parcel
#

ok ty ty

stuck crown
#

so ive got a new issue where im getting confusing info in google... i want to make sure the bot is only responding to commands in a specific channel

#
@client.event
async def on_message(message):
    print(f'{message.channel.name},{message.author.name},{message.content}')

    if message.author == client.user:
        return

    if message.channel.name == 'offlines-bot':
        return

    if message.content.startswith('$hello'):
        await message.channel.send(f'Hello {message.author.name}!')

    if message.content.startswith('$dead'):
        await message.channel.send(f'you died {message.author.name}!')

    if not message.content == '$hello''$dead':
        await message.channel.send(f'Hello {message.author.name}! Only the following commands can be used in this '
                                   f'channel. $hello $dead')```
#

from what ive read comparing message.channel.name to a string should work but all its doing is keeping the bot from responding at all now

vocal snow
#

I would recommend you use the commands extension instead of manually parsing everything

steady flume
#

how to make blue text in Title ? this method doesnt work like bellow

vocal snow
#

no markdown in title

#

you can use url of embed

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, 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.

x == y Checks if two embeds are equal.

New in version 2.0...
vocal snow
#

url kwarg ^

reef fractal
#
import discord 
from discord.ext import commands



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

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

@client.command()
async def ping(ctx):
    await ctx.send('Pong!')
    
@client.event
async def on_ready():
    print('The bot is active now and logged in as {0.user}'.format(client))


client.run('Token Here')```

I am trying to run the prefix with this, but its not running, can anyone tell me whats wrong here?
fading marlin
#

You need message content intent

reef fractal
# fading marlin You need message content intent
@client.event
async def on_message(message):
    if message.author == client.user:
        return 
    
    if message.content.startswith("!hello"):
            await message.channel.send("Hellooooo!")```

Something like this?
fading marlin
#

No

#

!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. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

reef fractal
#

ohhh

wind radish
#

is there a way to disable a button inside a command?

patent wagon
#

so i have a function ``` async def main_function(arg):
....
....
return thing1,thing2

@client.command()
async def function(ctx):
thing1,thing2=await main_funtion(someting)
embed=discord.Embed(title='name',color=color)
embed.add_field(name="someting1",value=thing1)
embed.add_field(name="someting2",value=thing2)
``` when i call !function it says RuntimeError: Event loop is closed , i believe the error is in the way i call async main function, how do i fix it(feel free to ping)

#

this is full error message Traceback (most recent call last):
File "C:...\lib\asyncio\proactor_events.py", line 116, in del
File "C:...\lib\asyncio\proactor_events.py", line 108, in close
File "C:...\lib\asyncio\base_events.py", line 750, in call_soon
File "C:...\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed

fiery salmon
patent wagon
#

i fixed it

fiery salmon
#

ah nice (:

patent wagon
#

chat gpt did to be precise

#

it needed asynco loop

#

like this

#

loop = asyncio.get_event_loop()
thing1, thing2 = await main_function(someting)
embed = discord.Embed(title='name', color=color)
embed.add_field(name='someting1', value=thing1)
embed.add_field(name='someting2', value=thing2)
await ctx.send(embed=embed)
loop.close()

fiery salmon
#

Now for my question:
In on_interaction listener, is there a way to stop command from continuing, or maybe pausing it?

Such as

@commands.Cog.listener()
async def on_interaction(self, interaction):
    if not userRegistered(interaction.user):
        stopCommand()
        registerUser()
hushed galleon
fiery salmon
hushed galleon
unkempt canyonBOT
#

discord/bot.py lines 1166 to 1167

async def on_interaction(self, interaction):
    await self.process_application_commands(interaction)```
fiery salmon
hushed galleon
#

it might not

fiery salmon
hushed galleon
unkempt canyonBOT
#

nextcord/client.py lines 1999 to 2000

async def on_interaction(self, interaction: Interaction) -> None:
    await self.process_application_commands(interaction)```
hushed galleon
#

oh and a caveat is that views and other listeners are still dispatched concurrently

fiery salmon
#

i put print() commands at start/end of both functions

hushed galleon
#

what is balance? a slash command?

fiery salmon
#

correct

#
    @nextcord.slash_command()
    @cooldowns.cooldown(1, 5, bucket=cooldowns.SlashBucket.author)
    async def balance(self, interaction:Interaction, user:nextcord.Member=None):
hushed galleon
#

how did you override the on_interaction handler?

fiery salmon
hushed galleon
#

ya, not a listener

fiery salmon
hushed galleon
#

the handler and listeners do get called at the "same" time, but Client.on_interaction is the one that dispatches your slash command, so thats where you want to put your pre-registration code

#

actually a before_invoke hook of some form might be a more preferable choice if thats available

#

or maybe it wouldnt, before_invoke gets called after checks have been run

fiery salmon
#

wow the description of it just matches my case almost perfectly

fiery hare
#
import discord

TOKEN = os.getenv('Token')

client = discord.Client()

@client.event
async def on_ready():
    print(f'Logged in as {client.user}')

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

    if message.content == 'Hi bot':
        await message.channel.send('Hello human!')

client.run(TOKEN)```
#

is this code right?

#

?code

#

!code

unkempt canyonBOT
#
Formatting code on discord

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.

For long code samples, you can use our pastebin.

vocal snow
#

you need to pass the intents argument

#

!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. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

fiery hare
#

do i need to turn on all intents?

vocal snow
#

only the ones you need

fiery hare
#

ok

slate swan
#

do discord modals have a limit of 5 fields?

fiery hare
#

Yes

thin trout
#

i got this error, can someone help me? (im learning python)

ERROR discord.client Ignoring exception in on_voice_state_update Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 441, in _run_event await coro(*args, **kwargs) File "main.py", line 145, in on_voice_state_update if before.channel.name == channel_name: AttributeError: 'NoneType' object has no attribute 'name'

@bot.event
async def on_voice_state_update(member: discord.Member, before: discord.VoiceState, after: discord.VoiceState):

    channel_name = f":unlock:ใƒป๐–ฒ๐—๐–บ๐—‡๐—“๐–บ ๐–ฝ๐—‚ {member.name}"
    if after.channel != None:
        if after.channel.id == 1094531305632436304:
            temp_channel = await after.channel.clone(name= channel_name)

            await member.move_to(temp_channel)

    if before.channel.name == channel_name:
        if before.channel != None:
            if len(before.channel.members) == 0:
                await before.channel.delete()```
slate swan
#

thats bad

slate swan
thin trout
fiery hare
#

how can i fix this

vocal snow
slate swan
fiery hare
vocal snow
slate swan
#

after is the voice state after the changes, e.g. the user that wasnt in the vc joined

slate swan
vocal snow
fiery hare
slate swan
#

but why do you have 2 clients running

fiery hare
slate swan
#

it should be intents=intents

fiery hare
#

hell forgot paste the token but nvm

#

Thanks guys!

short silo
#

what should a normal command's context be type hinted with

fiery salmon
#

edit = one sec

#

There is interaction.data which returns the raw interaction data as a dict

smoky sinew
fiery salmon
short silo
glad cradle
#

the docs doesn't mention it

fiery salmon
#

unless this is a different use-case ๐Ÿ˜ฎ

fiery hare
#

guys how can I make commands

slate swan
#

if i have a modal with a default_value it doesnt trigger the callback when i press submit, can someone help me?

wind radish
#

how can I fix this? The error message says after "UnboundLocalError: local variable 'aaa' referenced before assignment" ```py
aaa = "None"
bbb = "None"

button1 = Button(label="Streamer", style=discord.ButtonStyle.green)
button2 = Button(label="Referee", style=discord.ButtonStyle.green)
b3 = Button(label="test", style=discord.ButtonStyle.green)

async def streamer_callback(interaction):
    
    aaa = aaa.replace("None", f"{interaction.user}")
    desca = f"The {one.mention}`{one.name}` are going against the {two.mention}`{two.name}`. \n\n" + f"Streamer : {aaa}" + f"\n Referee : {bbb}"  
    a = discord.Embed(title='Test', description=desca)
    print(interaction.user)
    button1.disabled = True
    await interaction.response.edit_message(embed=a, view=view)
short silo
#

How do you detect if a message object is a voice message and how do yo get its content ?

tall temple
#

how can i set on_member_join event only for a specific guild ?

smoky sinew
smoky sinew
tall temple
#

sorry

#

@smoky sinew what's the parameter to get the guild id ?

meager orchid
#

Hey guys, what's the best way to set up permissions for each server to execute commands in a customizable way? I want to make a bot that can be used on multiple servers, but I don't fully understand how to do it yet. I've only tried using a database, but I'm afraid I'll run into limitations...

#

Perhaps the disnake library can help with this, or I'm not sure...

gleaming shore
#

does anyone have a non outdated video for discord bots in python ? how to make one ? just to get started ?

smoky sinew
sick birch
smoky sinew
#

if you want them to be assignable by the server owner then yes i would use a database for that

meager orchid
#

Okay, can you provide an example of a database? Or at least what columns with which parameters should be created?

short silo
rugged shadow
#

(meanwhile, me here using pydub and moviepy synchronously and saving things on disk)

smoky sinew
#

i would just use ffmpeg if i were you

#

you could run it separately from the bot event loop

old ibex
#
import os
import discord
from pystyle import Colors, Colorate
from pystyle import Box
from pystyle import Center
from luxor import luxor
from discord.ext import commands
from discord import app_commands

class Test(commands.Cog):
    def __init__(self, luxor):
        self.luxor = luxor # sets the client variable so we can use it in cogs

#    @commands.Cog.listener()
#    async def on_ready(self):
#        # an example event with cogs
#    
#    @commands.command()
#    async def command(self, ctx):
#        # an example command with cogs

@commands.command()
@luxor.tree.command(name="help")
@app_commands.describe()
async def help(interaction: discord.Interaction):
        hembed = discord.Embed(
        title="Luxor", color=0x313338
                )
        hembed.add_field(name="Bot Help", value="*Please reference to our discord server.*", inline=False)
        hembed.add_field(name="Commands", value=("""blah"""))
        await interaction.response.send_message(embed=hembed)```

Need some assistance using cogs with app commands.
#
import os
import discord
from pystyle import Box
from pystyle import Center
from dotenv import load_dotenv
from discord.ext import commands
from discord import app_commands
from pystyle import Colors, Colorate

# Hardcoded until I figure out WTF is going on with .env


luxor = commands.Bot(command_prefix="-", intents=discord.Intents.all())

async def main():
    for f in os.listdir("./cogs"):
        if f.endswith(".py"):
            luxor.load_extension("cogs." + f[:-3])

        await luxor.run("you thought")

# Color Options
# black_to_white, black_to_red, black_to_green, black_to_blue,
# white_to_black, white_to_red, white_to_green, white_to_blue,
# red_to_black, red_to_white, red_to_yellow, red_to_purple, 
# green_to_black, green_to_white, green_to_yellow, green_to_cyan,
# blue_to_black, blue_to_white, blue_to_cyan, purple_to_blue,
# yellow_to_red, yellow_to_green, purple_to_red, purple_to_blue,
# cyan_to_green, purple_to_blue```
austere prairie
#

Your cog file needs a setup function that will load the cog to the bot when the file is loaded, something like: ```py
async def setup(bot):
await bot.add_cog(Test(bot))

bright lava
# old ibex ```py import os import discord from pystyle import Colors, Colorate from pystyle...

Hi. I'd recommend against using pystyle.
Pystyle authors are known malware developers. In the past, they also infected the pystyle package itself by adding a malicious dependency.
When people started spreading message of it being malicious, they claimed their pypi account got hacked... But you can never be sure whether they won't do anything like that again.
Also, a lot of new malicious packages they try to release (ie: they release them but they get removed fast, hence "try") also use pystyle source as filler code so the package looks real if you don't check the setup.py

old ibex
#

?

austere prairie
#

Yeah that should be fine

old ibex
#

Just dies.

austere prairie
#

Do you have luxor.run(...) somewhere?

old ibex
#

not in a cog.

austere prairie
#

Where is main being called?

old ibex
#

oh wait

#

tracemalloc

#

never awaited

austere prairie
#

Also I think you have to sync app commands after loading the cog for them to show up

old ibex
#

huh?

#

sync it?

#

this is the ready cog

#
import os
import discord
from pystyle import Colors, Colorate
from pystyle import Box
from pystyle import Center
from luxor import luxor
from discord.ext import commands
from discord import app_commands
class ready(commands.Cog):
    def __init__(self, luxor):
        self.luxor = luxor # sets the client variable so we can use it in cogs

def clear():
     os.system('cls')

#    @commands.Cog.listener()
#    async def on_ready(self):
#        # an example event with cogs
#    
#    @commands.command()
#    async def command(self, ctx):
#        # an example command with cogs


status = "In Visual Studio Code..."

@commands.Cog.listener()
async def on_ready(self):
    await luxor.change_presence(status=discord.Status.idle, activity=discord.Game(name=f"{status}"))
    try:
        commands = await luxor.tree.sync()
        clear()
        print(Colorate.Vertical(Colors.purple_to_blue, Center.XCenter('''
โ–ˆโ–ˆโ•—     โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— 
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘
โ•šโ•โ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ•''')))
        print(Colorate.Horizontal(Colors.white_to_green, Center.XCenter("\nStatus - Connected")))
        print(Colorate.Horizontal(Colors.purple_to_blue, Center.XCenter("\nโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€")))
        print(Colorate.Horizontal(Colors.purple_to_blue, Center.XCenter(f"User - {luxor.user}")))
        print(Colorate.Horizontal(Colors.purple_to_blue, Center.XCenter(f"Commands - {len(commands)}")))
        print(Colorate.Horizontal(Colors.purple_to_blue, Center.XCenter(f"Servers - {len(luxor.guilds)}")))
        print('')
        print(Colorate.Horizontal(Colors.purple_to_blue, Center.XCenter("Invite:")))
        print(Colorate.Horizontal(Colors.white_to_black, Center.XCenter(f"https://discordapp.com/oauth2/authorize?&client_id={luxor.user.id}&scope=bot&permissions=8")))
        print(Colorate.Horizontal(Colors.purple_to_blue, Center.XCenter("โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€")))
    except Exception as error:
        print(error)

def setup(luxor):
    luxor.add_cog(ready(luxor))```
short silo
# smoky sinew no clue

Could you maybe enlighten me on how to use the attachment object as a file for pydub.

I have tried reading it, passing it as it is. I have tried a lot of stuff over the hours with no luck.

old ibex
#

lmao

#

bot loads.

#

commands don't work.

#

@austere prairie did you give up on me

valid perch
#

By the looks of it, fix your indentation

old ibex
#

Not very helpful, there's 0 code errors.

#

I moved the run outside of the main function

#

but now it's not registering the main function

valid perch
#

Cogs are classes. Anything you want needs to be in the cog itself not merely the file

old ibex
#

?

valid perch
#

Mobile code formatting is showing all of your code to be outside the class, therefore outside the cog

smoky sinew
#

is it the one on github?

old ibex
#

Could I screenshare to you mudkip

smoky sinew
#

sure

short silo
smoky sinew
old ibex
#

could you provide a small example using a custom name for the client and app commands

#
#    @commands.Cog.listener()
#    async def on_ready(self):
#        # an example event with cogs
#    
#    @commands.command()
#    async def command(self, ctx):
#        # an example command with cogs
#

Like you did here but with app commands.

smoky sinew
#

i don't think i wrote that

old ibex
smoky sinew
#

scroll down

old ibex
#

oh

#

๐Ÿ’€

#

So I thought you were him

smoky sinew
#

mm

#

i wrote that example 3 years ago and it's outdated

short silo
smoky sinew
#

it doesn't even have intents ๐Ÿ’€

old ibex
#

wot

short silo
old ibex
#

I don't use discord stuff AHHHHHH

#

plz ๐Ÿ’€

smoky sinew
old ibex
#

pydub?

smoky sinew
#

i haven't heard of that before also

old ibex
#

could you uhh

short silo
smoky sinew
#

what custom name

old ibex
#

any litterally

smoky sinew
#

did you scroll down

old ibex
#

it can be mudkip

smoky sinew
#

bruhh

old ibex
#

what

smoky sinew
#

don't use that gist

old ibex
#

@Tango0o0o Here is a far better version of the code:

#

oh ๐Ÿ’€

short silo
#

I just wanna know how to treat a discord attachment as a file

smoky sinew
#

you just replace the one in the example with your own name

old ibex
#

Why do you use bot though

smoky sinew
#

because it's a bot

old ibex
#

WHY USE DEFAULTS

#

but bot have name

smoky sinew
#

what ๐Ÿ’€

short silo
old ibex
#

you put

#
@commands.command()
    async def command(self, ctx: commands.Context) -> None:
        pass```
old ibex
#

if it was a app command

smoky sinew
#

the example is not for app commands

old ibex
#

How do I use it with app commands

#

๐Ÿ’€

smoky sinew
#

the example was to demonstrate extensions

#

and cogs

#

if you want i could make another example for app commands though

old ibex
#

Please ๐Ÿ˜ญ I just want a separate folder for commands.

short silo
#

Holy shit, save actually saves it as an object not only as a file

old ibex
#

HUH

#

Wasn't discord supposed to remove normal command support anyway?

smoky sinew
old ibex
#

On July 27, 2021, Discord announced that effective May 2022, bot developers will be forced to migrate their bots to use slash commands

smoky sinew
#

that's why it says file-like object instead of file

smoky sinew
#

they've just locked message content behind an intent

old ibex
#

Oh

#

I prefer slash commands anyway

smoky sinew
#

and you shouldn't use discord.Intents.all() because once your bot reaches 100 servers you're going to have to apply for the privileged intents

short silo
old ibex
#

what should I use then

#

english holy

smoky sinew
#

discord.Intents.default() and message content intent if you're using commands.Bot

#

or even better use discord.Intents.none() and specify only the intents you want to use

#

!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. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

old ibex
#

Couldn't you like

#

intents = Intents.default(message_content = True)

smoky sinew
old ibex
#

or nah

smoky sinew
old ibex
#

Ah

#

Ok

#

so on that example

#

so basically

#

cogs are useless? and use extensions

#

wait no brain

#

extensions is the folder

smoky sinew
#

???

#

extensions and cogs are separate things

#

and they have their own purpose

old ibex
#

in your example

#

there's both

#

my brain hruts

smoky sinew
#

ok

smoky sinew
old ibex
#

Using them in unison

#

ok

#

so app commands with cogs?

#

instead of ```@commands.command()
async def command(self, ctx: commands.Context) -> None:
pass

```
#

also wtf is ctx

#

context for what??

smoky sinew
smoky sinew
old ibex
#

MY BRAIN HURTS SM

smoky sinew
#

i can barely keep up with your questions

old ibex
#

I'm just trying to get one working command with this shit skull

smoky sinew
#

don't bother with context if you're using app commands

#

context is information about where and who ran the prefix command

old ibex
#

wtf is that even for bro galaxy_brain

#

OH

#

Like when you get user

#

inside a normal command

#

ctx.send_message(f"who sent this: {ctx.user.id}")

smoky sinew
#

pretty much

old ibex
#

hot men

#

less GOOOOOOOOO

#

@smoky sinew where's ur kofi

#

lemme donate hehe

smoky sinew
#

don't have one

old ibex
#

this is so weird to me

smoky sinew
#

what is

old ibex
#

cause I was like doing

#
@client.tree.command(name="download")
@app_commands.describe(pack=cmddesc)
@app_commands.checks.has_any_role(762044720762716190, 762044945233739816, 762045678426914906)
async def dl(interaction: discord.Interaction, pack: str):
    pack = pack.lower() # choice``` Your code is so different.
smoky sinew
#

that's pretty much the same

#

just the command itself is different

old ibex
#

what's the

#

also

#

ur code straight copy paste

smoky sinew
#

oh remove the await at the end

old ibex
#

o lol

smoky sinew
#

i didn't test this ยฏ_(ใƒ„)_/ยฏ

#

@old ibex did it work

slate swan
#
        guild = client.get_guild(1074296554149654580)
        role = guild.get_role(1098306389237055579)



        member = guild.get_member(921314333567352862)
        await member.add_roles(role)

AttributeError: 'NoneType' object has no attribute 'add_roles'

smoky sinew
#

get_member can return none if the member isn't in cache

old ibex
#

idk I ate dinner

#

lol

smoky sinew
#
async def try_member(id: int, /, *, guild: discord.Guild) -> discord.Member:
    return guild.get_member(id) or await guild.fetch_member(id)

use something like this @slate swan

keen talon
#

Yeah better

old ibex
#

what is the / * for

smoky sinew
slate swan
smoky sinew
#

fetch_member always makes a request to discord's API

old ibex
smoky sinew
#

get_member gets it from cache

#

avoiding api requests is best if you can

#

if you can get it from cache, you should

old ibex
#

ringadingadinga

slate swan
old ibex
#

@smoky sinew

#

seconds = 86400 if delete_messages else 0

#

what in the python??? explain how this works wtf

#

don't you have to

#

if (condition) wtf

smoky sinew
#

no??

#

what does ( mean

#

(condition) is the same as condition

#

the parenthesis are unnecessary

old ibex
#

ok

#

then u define something first and then

#

if statement in the same line??/

smoky sinew
#

yes?

old ibex
#

wtf

#

so

#

seconds

#

then if condition (basically if true)

#

that hurts me to read omg wtf

#

imma take python course ๐Ÿ’€

#

im used to c++ bro

smoky sinew
slate swan
#

@smoky sinew

    await member.add_roles(role)
          ^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'add_roles'

i did fetch members but didnt work

smoky sinew
#

just do try_member bruh

#

and you have to await it

old ibex
#

did you

#

member = await try_member(blah gay)

smoky sinew
#

await try_member*

old ibex
#

mudkip

#

How old are you?

smoky sinew
#

that's not important

old ibex
#

Just wondering in general.

#

Most for a perspective of age to experience.

#

Are you 20's 30's

smoky sinew
#

if you want to talk about it go to my discord

old ibex
#

oki

old ibex
#

@smoky sinew

#

do I use self?

smoky sinew
# old ibex

if you looked at my example, you would know

old ibex
#

I did

smoky sinew
#

rather than just deleting the comments

#

take a look again, you changed it

#

oh nvm i see

#

i meant to put the command after

old ibex
#

...

#

gaslighting me LOL

smoky sinew
#

classes are capital btw

#

Help or HelpCog

old ibex
#

homo

#

does it really matter

#

or good practice?

old ibex
smoky sinew
#

this is not what i meant...

#

i meant you could use a client OR a bot not both

old ibex
#

whats the diff

smoky sinew
#

also why are they repeated..

old ibex
#

cause I have no idea how this works still.

smoky sinew
#

and it should be intents=intents not intents=discord.Intents.default()

slate swan
#

is it possible to get user's roles in the guild with discord oauth2

smoky sinew
#

no i updated it a while ago

#

i've been updating it

old ibex
#

oh

smoky sinew
#

then you can access this endpoint

old ibex
#

I'm using it in a cog

#

I know how to do app commands

#

I needed to know how to do it in a cog

smoky sinew
#

it's the same thing

old ibex
#

In an extension, this would be @app_commands.command() instead.

smoky sinew
#

just replace bot.tree.command with app_commands.command

#

and import app_commands

old ibex
#

you put it above the description line

#

so I thought u meant description

#

AttributeError: 'Client' object has no attribute 'command'

#

token leaked 4k

#

I feel like your brain hurts speaking to me. Lol

smoky sinew
#

it's ("commands.help",) with the comma

old ibex
#

I removed it

smoky sinew
#

also you shouldn't be separating each command in its own file that's not really what extensions are meant for

old ibex
#

same error

smoky sinew
#

and it's bot = commands.Bot

old ibex
#

o

smoky sinew
#

bots have prefix commands, clients don't

#

and you don't need to import app_commands in the main file, only in the extension file

old ibex
#

o

#
  File "C:\Users\lux\Desktop\luxor\luxor.py", line 29, in <module>
    bot.run("token")
  File "C:\Python\lib\site-packages\discord\client.py", line 860, in run
    asyncio.run(runner())
  File "C:\Python\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Python\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Python\lib\site-packages\discord\client.py", line 849, in runner
    await self.start(token, reconnect=reconnect)
  File "C:\Python\lib\site-packages\discord\client.py", line 777, in start
    await self.login(token)
  File "C:\Python\lib\site-packages\discord\client.py", line 621, in login
    await self.setup_hook()
  File "C:\Users\lux\Desktop\luxor\luxor.py", line 27, in setup_hook
    await bot.load_extension(extension)
  File "C:\Python\lib\site-packages\discord\ext\commands\bot.py", line 1011, in load_extension
    raise errors.ExtensionNotFound(name)
discord.ext.commands.errors.ExtensionNotFound: Extension 'c' could not be loaded.```
smoky sinew
#

what is c

old ibex
#

no idea

smoky sinew
#

what is extensions equal to right now

old ibex
#

commands.help

smoky sinew
#

just show your two files

old ibex
smoky sinew
#

like i said

#

it's with the comma

#

("commands.help",)

#

the comma is necessary

old ibex
#

oh WITH

smoky sinew
smoky sinew
#

and it's @app_commands.describe not description

old ibex
#

I just wanted each command to have afile

smoky sinew
old ibex
#

ah

smoky sinew
#

or well you could probably get more specific than that

#

but it should be a few commands per

old ibex
#
  File "C:\Python\lib\site-packages\discord\client.py", line 860, in run
    asyncio.run(runner())
  File "C:\Python\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Python\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Python\lib\site-packages\discord\client.py", line 849, in runner
    await self.start(token, reconnect=reconnect)
  File "C:\Python\lib\site-packages\discord\client.py", line 777, in start
    await self.login(token)
  File "C:\Python\lib\site-packages\discord\client.py", line 621, in login
    await self.setup_hook()
  File "C:\Users\lux\Desktop\luxor\luxor.py", line 27, in setup_hook
    await bot.load_extension(extension)
  File "C:\Python\lib\site-packages\discord\ext\commands\bot.py", line 1013, in load_extension
    await self._load_from_module_spec(spec, name)
  File "C:\Python\lib\site-packages\discord\ext\commands\bot.py", line 938, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'commands.help' raised an error: AttributeError: module 'discord.app_commands' has no attribute 'description'
#

skull x10

smoky sinew
old ibex
#

oh

#

blind

vocal snow
old ibex
#
Traceback (most recent call last):
  File "C:\Users\lux\Desktop\luxor\luxor.py", line 29, in <module>
    bot.run("token")
  File "C:\Python\lib\site-packages\discord\client.py", line 860, in run
    asyncio.run(runner())
  File "C:\Python\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Python\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Python\lib\site-packages\discord\client.py", line 849, in runner
    await self.start(token, reconnect=reconnect)
  File "C:\Python\lib\site-packages\discord\client.py", line 777, in start
    await self.login(token)
  File "C:\Python\lib\site-packages\discord\client.py", line 621, in login
    await self.setup_hook()
  File "C:\Users\lux\Desktop\luxor\luxor.py", line 27, in setup_hook
    await bot.load_extension(extension)
  File "C:\Python\lib\site-packages\discord\ext\commands\bot.py", line 1013, in load_extension
    await self._load_from_module_spec(spec, name)
  File "C:\Python\lib\site-packages\discord\ext\commands\bot.py", line 938, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'commands.help' raised an error: TypeError: unknown parameter given: member```
#

omfg

smoky sinew
#

you removed the parameter from the describe decorator but it's probably still in your command

old ibex
#

It's in there.

smoky sinew
#

idk what you changed

old ibex
#
from discord.ext import commands
from discord import app_commands
import discord

class Help(commands.Cog):
    def __init__(self, bot) -> None:
        self.bot = bot
    
    @commands.Cog.listener()
    async def on_ready(self) -> None:
        pass
    
    @app_commands.describe(
        member="The member to ban.",
        reason="The reason for banning them.",
        delete_messages="Whether to clear their messages in the past day."
    )
    @app_commands.checks.bot_has_permissions(ban_members=True)
    @app_commands.checks.has_permissions(ban_members=True)
    @app_commands.command() # bot.tree.command # outside of cogs
    async def ban(
        interaction: discord.Interaction,
        member: discord.Member,
        reason: str,
        delete_messages: bool = False
    ) -> None:
        embed=discord.Embed(
            title="Wasif is gay.",
            description="Potatos",
            color=0xFF5733)
        await interaction.response.send_message(embed=embed)

    @commands.command()
    async def command(self, ctx: commands.Context) -> None:
        pass

async def setup(bot) -> None:
    await bot.add_cog(Help(bot))    


# In an extension, this would be @app_commands.command() instead.
# All slash command arguments need to have type hints. (e.g. str, int, discord.Member, etc)
smoky sinew
#

huh

old ibex
#

it's all there bro.

smoky sinew
#

was that after you ran the command

old ibex
#

No

#

on start

#
  File "C:\Users\lux\Desktop\luxor\commands\help.py", line 21, in Help
    async def ban(
  File "C:\Python\lib\site-packages\discord\app_commands\commands.py", line 2121, in decorator
    _populate_descriptions(inner._params, parameters)
  File "C:\Python\lib\site-packages\discord\app_commands\commands.py", line 276, in _populate_descriptions
    raise TypeError(f'unknown parameter given: {first}')
TypeError: unknown parameter given: member
#

top part

#

@smoky sinew u give up??

smoky sinew
#

i think you forgot to save your code

vocal snow
#

u forgot self param in callback too btw

old ibex
#

its saved

vocal snow
#

self

#

the parameter

smoky sinew
#

they didn't forget it they just didn't know they needed it

vocal snow
#

true

ornate crater
#

what the problem???

vocal snow
smoky sinew
smoky sinew
#

No problem

vocal snow
#

no problem

fiery hare
#

guys help me pls

north kiln
#

reset your bot token now

#

!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. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

north kiln
#

@fiery hare

fiery hare
#

it worked

#

thx

slow ether
#

Hello! could i make slient message by discord bot?

#

i can but with normal user like @slient

#

but when i try put it in discord bot it just send it lol

#

like this

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

Sends a message to the destination with the content given.

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

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/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.11)") of [`File`](https://discordpy.readthedocs.io/en/latest/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/latest/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.11)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
vocal snow
#

silent kwarg

slow ether
#

i can't see silent

vocal snow
#

go to the doc

#

it shortens the signature in the embed

slow ether
#

and what is allowed_mentions=None do??

slow ether
#

@vocal snow What?

vocal snow
#

try updating; pip install -U discord.py

slow ether
#

o

#

ok then

#

ok done

#

ah why it now ask me for this?

#

it was working a???

#

does discord change it???

#

or do i need update nextcord or what

smoky sinew
slow ether
#

i use both

slow ether
slow ether
vocal snow
slow ether
#

yes

vocal snow
#

You should never use both

#

Once one of those

#

They aren't cross compatible

slow ether
#

ag

#

but i need them both

naive briar
#

Why

slow ether
#

all my import from ast import Interactive from typing import Literal import discord from discord.ext import commands from time import sleep import random import nextcord from nextcord import File, ButtonStyle from nextcord.ui import Button, View import os import asyncio

slow ether
naive briar
#

What would that explain

slow ether
#

ah

#

So i delete from discord.exe import commands? and it should fix it?

naive briar
#

What would it fix

#

Just choose to use one and delete the other

slow ether
#

o

#

ok i will choose nextcord

#

now how delete the other one?

#

pip3 uninstall discord.py?

smoky sinew
#

which are you more frequently using

slow ether
#

ah

#

when i delete import nextcord

#

i got 200 errors

#

when i delete discord.exe

#

it only get 2 errors lol

vocal snow
#

discord.exe ?!

slow ether
#

but it give me this 3 errors

#

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

#

and here @commands.has_permissions(administrator=True)

slow ether
#

how fix them?

vocal snow
#

Use the nextcord equivalents

#

!d nextcord.ext.commands.Bot

unkempt canyonBOT
#
class nextcord.ext.commands.Bot(command_prefix=(), help_command=..., description=None, *, max_messages=1000, connector=None, proxy=None, proxy_auth=None, shard_id=None, ...)```
Represents a discord bot.

This class is a subclass of [`nextcord.Client`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Client "nextcord.Client") and as a result anything that you can do with a [`nextcord.Client`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Client "nextcord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://nextcord.readthedocs.io/en/latest/ext/commands/api.html#nextcord.ext.commands.GroupMixin "nextcord.ext.commands.GroupMixin") to provide the functionality to manage commands.
slow ether
naive briar
upbeat zinc
#

Hi Guys

#

can you'll please help me with converting .rtf file to csv

vocal snow
upbeat zinc
#

ok thanks

slow ether
vocal snow
#

Same way

slow ether
#

commands.Bot?

#

nextcord.ext.commands?

#

just do from nextcord.ext import commands

outer parcel
#

I saw this cool feature in dank memer

#

And i wondered how they made that graph. I did research and learnt about MatPlotlib which works but does not have a nice design. Due to this i tried to find other ways of doing it

#

Which way is the best, currently im thinking of Pillow and mapping the values to a y coordinate

keen talon
#

!pypi matplotlib perhaps

unkempt canyonBOT
keen talon
#

Use matplotlib lib to generate it and pillow to show it to the end user

vocal snow
#

Maybe try pyqtgraph

outer parcel
#

wait?

#

you can edit the image using PIl how ?

#

since all i want from the graph

#

is just a value on left hand side

#

and the graph line

vocal snow
#

You can do that via matplotlib

#

It's highly configurable

outer parcel
#

using it

#

i created

#

but how do i remove the box outside it and al lthe values

#

i just want the graph

vocal snow
#

Search how to hide the tick labels, you'll find something online

outer parcel
#

ty i think i can now edit this image using

#

PIL

outer parcel
#

i have background

#

and i have

#

graph which is transparent background

#

and when i paste these

#

the logo just disappears

#

im confused as to why logo just disappears

#

and the graph is transparent it is not overlapping it?

smoky sinew
#

what logo

#

oh

outer parcel
#

and im pasting the transparent graph over it

#

and somehow the logo disappears

naive briar
outer parcel
#

it works

#

but the background color is removed now

naive briar
#

What colour

outer parcel
#

how it looks

#

the color is removed (background)

naive briar
#

Show the code

outer parcel
#

nvm

#

im dumb it works

hazy vault
#

Can I add buttons in the bot in this engine

slate swan
#

!paste

unkempt canyonBOT
#
Pasting large amounts of code

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

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

slow ether
quasi thorn
#

click where you see 3.10.6

austere prairie
#

Try py -3.10 -m pip install nextcord

slow ether
#

yes

slow ether
#

wait 1 sec i will photo other one

#

i will ping

hazy vault
#

guys
How can I add buttons in the bot discord
on replit

slate swan
slow ether
#

guys this

#

@austere prairie @quasi thorn

slate swan
hazy vault
#

k thank

slow ether
#

lol

#

you maybe could need update python @mellow socket

slate swan
#

hello guys,
I need a help to access the class variable(self.something) in my cog class.
is that possible in any way?

class MyClient(commands.Bot):
    def __init__(self, intents: discord.Intents,
                 something):
        super().__init__(intents=intents,
                         command_prefix='$',
                           activity=discord.Game(name="api"))
        self.something = something
class UserProfile(commands.Cog):

    def __init__(self, bot: Bot) -> None:
        self.bot = bot

    @discord.app_commands.command(name='profile', description='Fetches the profile')
    @discord.app_commands.describe(member="mention the user")
    async def profile(self, interaction: discord.Interaction, member: Optional[discord.Member]):

      // here I want to use self.something
        member = member if member is not None else interaction.user
        await interaction.response.send_message(f'ok I got {member.display_name}')
slate swan
slate swan
#

error?

slate swan
#

on using self.bot.something

2023-04-23 17:14:58 WARNING  root Failed to load extension: Extension 'bot.cogs.controllers._profile' raised an error: AttributeError: 'MyClient' object has no attribute 'something'

on using interaction.client.something

discord.app_commands.errors.CommandInvokeError: Command 'profile' raised an exception: AttributeError: 'MyClient' object has no attribute 'something'
#

what error?

#

you didn't add the attribute then , where did you add it?

#

make sure the files saved and stuff

slate swan
#

show the part of code where you add it

#

umm means?

#

the line...

#

I got it

#

it's working now

#

thanks a lot bro

winged linden
#

I have an issue where my code does not work when I put it into an async function

#

But I need to use async to await sending a message to a channel

tall temple
#

open your cmd window

scenic pike
#
import discord

class InviteTracker(commands.Cog):
    def __init__(self,client):
        self.client = client

    @commands.Cog.listener()
    async def on_member_join(self, member):
        inviter = await self.get_inviter(member)
        if inviter is not None:
            inviter_name = inviter.name + "#" + inviter.discriminator
            total_invites = await self.get_total_invites(inviter)
            embed = discord.Embed(
                title=f"โœ…ใƒป{member.name} joined.",
                description=f"They were invited by **{inviter_name}** who now has **{total_invites}** Total invites.",
                color=discord.Color.green()
            )
            await self.client.get_channel(1093657090100305940).send(embed=embed)

    async def get_inviter(self, member):
        invites = await member.guild.invites()
        for invite in invites:
            if invite.inviter == member:
                return invite.inviter
        return None

    async def get_total_invites(self, inviter):
        invites = await inviter.guild.invites()
        for invite in invites:
            if invite.inviter == inviter:
                return invite.uses
        return 0

def setup(client):
    client.add_cog(InviteTracker(client))```

Bot dont send message
Without error
vocal snow
#

member intents enabled? And what's your discord.py version?

outer parcel
onyx crag
#

Help!

#

import discord
from discord.ext import commands

Set up your bot client with the command prefix

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

Event listener for when the bot is ready

@client.event
async def on_ready():
print('Bot is ready!')

Command for the /say command

@client.command()
async def say(ctx, *, message):
await ctx.send(message)

Replace 'TOKEN_HERE' with your bot's token

client.run('TOKEN_HERE')

outer parcel
outer parcel
#

tyty

onyx crag
#

.

vocal snow
onyx crag
#

import discord
from discord.ext import commands

Set up your bot client with the command prefix

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

Event listener for when the bot is ready

@client.event
async def on_ready():
print('Bot is ready!')

Command for the /say command

@client.command()
async def say(ctx, *, message):
await ctx.send(message)

Replace 'TOKEN_HERE' with your bot's token

client.run('TOKEN_HERE')

#

.

:

vocal snow
#

what help do you need with it

onyx crag
vocal snow
#

what is the error

onyx crag
vocal snow
#

!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. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, 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

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

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

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

steady flume
#

what the code of common embed color ?

vocal snow
steady flume
#

this line on left side - whats the code of color to make it merges with all embed

scenic pike
tall temple
#

how can i get the guild for on_member_join event ?

steady flume
tall temple
steady flume
#

kinda this

tall temple
#

okay thx

naive briar
slate swan
steady flume
#

it can be name also

naive briar
slate swan
scenic pike
#
import discord

class InviteTracker(commands.Cog):
    def __init__(self,client):
        self.client = client

    @commands.Cog.listener()
    async def on_member_join(self, member):
        inviter = await self.get_inviter(member)
        if inviter is not None:
            inviter_name = inviter.name + "#" + inviter.discriminator
            total_invites = await self.get_total_invites(inviter)
            embed = discord.Embed(
                title=f"โœ…ใƒป{member.name} joined.",
                description=f"They were invited by **{inviter_name}** who now has **{total_invites}** Total invites.",
                color=discord.Color.green()
            )
            await self.client.get_channel(1093657090100305940).send(embed=embed)

    async def get_inviter(self, member):
        invites = await member.guild.invites()
        for invite in invites:
            if invite.inviter == member:
                return invite.inviter
        return None

    async def get_total_invites(self, inviter):
        invites = await inviter.guild.invites()
        for invite in invites:
            if invite.inviter == inviter:
                return invite.uses
        return 0

def setup(client):
    client.add_cog(InviteTracker(client))```

Bot dont send message
Without error
old ibex
#

I'm not sure if python works the same as C++ but I'm pretty sure in general coding languages you have to define before?

scenic pike
#

What

old ibex
#
    async def get_inviter(self, member):
        invites = await member.guild.invites()
        for invite in invites:
            if invite.inviter == member:
                return invite.inviter
        return None

    async def get_total_invites(self, inviter):
        invites = await inviter.guild.invites()
        for invite in invites:
            if invite.inviter == inviter:
                return invite.uses
        return 0```
#

Try moving these before your listener

slate swan
#

@old ibex hey, by any chance do you know aiosqlite

old ibex
#

I've used it with node.js.

slate swan
#

have you gotten this error before?

shrewd apex
#

aiosqlite is a python lib how u used with node?

old ibex
#

sqlite

#

in general not specifically aio

slate swan
#
sqlite3.ProgrammingError: Cannot operate on a closed cursor.```
#

keeps on happening

old ibex
#

where are you closing?

slate swan
#

no where

#

i commit on the last line

old ibex
#

Could you show that I don't see the commit line

#

oh waitI see now

#

That error is basically saying the database your trying to commit to is closed.

slate swan
#

how tho?

old ibex
#

also you're not using a try

#

and finally

#

it's just straight through

#

what is this even for?

slate swan
old ibex
#

hm

#

where's your connect?

shrewd apex
#

u need to open the cursor inside the callback using async with also

old ibex
#

It's so hard for to read

slate swan
old ibex
#

no spacing ๐Ÿ’€

shrewd apex
#

yes

slate swan
old ibex
#

I meant between sections

slate swan
#

i copied and pasted

old ibex
#

That makes more sense.

spice carbon
#

made a function that fetches the most common color on the bot profile picture. i call it right on setup_hook: should i annotate it as Optional? i wrote it on a way that this is not needed, because checking for None is really annoying when i'm pretty sure that this attribute will not be None when it is accessed. i'm looking at you, Client.user

chilly spear
#

how would i make my bot commands show up in the auto complete menu

#

?

hushed galleon
shrewd apex
#

assert seems more appropriate tbh

tall temple
#
@bot.slash_command(name="methodslist",
                   description="CMD used to display methods list")
async def methodslist(ctx):
  for method in os.listdir(f"users_data/{ctx.guild.id}"):
    method = method + "\n"
  await ctx.respond(
    embed=discord.Embed(title='', description=f'{method}', color=0x50468a))
#

i want to make an embed respond with all file names

#

what should i add ?

meager chasm
#

!d str.join

unkempt canyonBOT
#

str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") objects. The separator between elements is the string providing this method.
meager chasm
#

You can use this instead of manually iterating and adding to string

tall temple
meager chasm
#

What syntax

#

!e ```py
print(", ".join(['a', 'b', 'c']))

unkempt canyonBOT
#

@meager chasm :white_check_mark: Your 3.11 eval job has completed with return code 0.

a, b, c
tall temple
#

look

#

there is something like that

#

it can be 0 file like 100 files

#

i don't know how much files there will be

vocal snow
#

So

#

Os.listdir gives you all of them

#

Although it would be preferable to use pathlib (especially if you're looking to get files from sub-directories as well)

scenic pike
#

Any who have discord.py music bot and can send me code?

unkempt canyonBOT
#

@tall temple :x: Your 3.11 eval job has completed with return code 1.

001 |   File "/home/main.py", line 4
002 |     folder = pathlib.Path(f"users_data/{ctx.guild.id")
003 |                                                      ^
004 | SyntaxError: f-string: expecting '}'
spice carbon
#

and how should i handle a command that was not found? using a global eh here

tall temple
#

!e

@bot.slash_command(name="methodslist",
                   description="CMD used to display methods list")
async def methodslist(ctx):
  folder = pathlib.Path(f"users_data/{ctx.guild.id}")
  await ctx.respond(embed=discord.Embed(
    title='', description = f"{'\n'.join(folder.iterdir())}", color = 0x50468a))
unkempt canyonBOT
#

@tall temple :x: Your 3.11 eval job has completed with return code 1.

001 |   File "/home/main.py", line 6
002 |     title='', description = f"{'\n'.join(folder.iterdir())}", color = 0x50468a))
003 |                                                             ^
004 | SyntaxError: f-string expression part cannot include a backslash
tall temple
#

wtf is that

#

@meager chasm hmm_gn

#

viens par lร 

dense jackal
#

Is it possible to add buttons to welcome messages

#

Cause im kinda lost. My welcome message needs async def on_member_join and my buttons need async def button(ctx):

stuck cave
#

yo guys

#

How can you make a bot that plays music infinitely?

sick birch
dense jackal
slate swan
#

hey have you a code for music bot , for play in infinity my code no play in infinity

sick birch
# dense jackal Im literally lost while doing it

@dense jackal

class MyView(discord.ui.View):
  def __init__(self) -> None:
    super().__init__()

  @discord.ui.button(label="Click me!")
  async def callback(self, interaction: discord.Interaction, button: discord.ui.Button) -> None:
    ...

async def on_member_join(member: discord.Member) -> None:
  view = MyView()
  channel = bot.get_channel(123)
  await channel.send("Welcome to the server!", view=view)
#

Hopefully that example clears up a bit

dense jackal
#

Alright thx ill check that

#

Appreciate you

dense jackal
#

Whatโ€™s the interaction where when you click on the button, it redirects you to #rules

#

@sick birch

sick birch
#

I don't remember that being a thing

#

Unless you mean just a link button

dense jackal
#

I saw a server where when you click on the button, it sends you on a page

sick birch
#

Was it gray?

dense jackal
dense jackal
#

Lemme check I dont remember well

sick birch
#

Yes please

#

(sorry, accidental ghost ping shen)

dense jackal
#

Maybe its not something after all

#

Sorry for disturbing

dense jackal
#

You know the default welcome message of discord? We can send stickers via a button. Is it possible to recreate that with an interaction

dense jackal
hushed galleon
dense jackal
#

So it can response with a gif?

#

Which can be similar to discordโ€™s feature itself

hushed galleon
#

by sending a link / uploading an attachment sure

dense jackal
hushed galleon
#

for a view your bot will forget how to respond to it after a restart by itself, but you can trigger that early by using the View.stop() method

#

and you can edit your button with .disabled = True so it cant be clicked again

dense jackal
#

Can we also do so its not clickable after like 2 mins

hushed galleon
#

yeah, using a timeout

#

though if you want to visually disable the button, your view will need the initial message so it can edit it

dense jackal
#

No not visually

#

Just not being able yo interact anymore

hushed galleon
#

then you only need to pass timeout=120 to your view's constructor

#

the default timeout is 180s

dense jackal
#

Oh wait I got a better idea

#

I want the button to be clicked only once

#

And then it goes failed

#

Only one interaction (not per members) one interaction

hushed galleon
hushed galleon
dense jackal
dense jackal
#

ok so I did this

  def __init__(self) -> None:
    super().__init__()

  @discord.ui.button(label="Click to welcome the new user!")
  async def callback(self, interaction: discord.Interaction, button: discord.ui.Button) -> None:
    await interaction.response.send_message("Bond was created just now uwu test")
    button.disabled = True
    button.label = 'Bond was created!'
    await interaction.response.edit_message(view=self)
    ...```
#

and it still doesn't work

hushed galleon
#

e.g. ```py
bot = commands.Bot(...)

@bot.tree.error
async def on_tree_error(interaction, error):
if isinstance(error, app_commands.CommandNotFound):
await interaction.response.send_message(...)
else:
raise error

@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
await ctx.send(...)
else:
raise error```

hushed galleon
fading linden
#

heloo

So i saw this line of code:

@bot.command()
async def myfunc(ctx, *, var)

I'm aware that var is going to be user-defined args(?) but what are ctx and * for?

smoky sinew
#
  • marks the argument var as keyword-only so everything the user puts after the command will go to that argument
hushed galleon
slate swan
#
import discord
import uuid
from discord.ext import commands

# Initialise les intents pour le bot
intents = discord.Intents.default()
intents.members = True

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

# Initialise votre liste de tickets
tickets = {}

# Gรฉnรจre un ticket unique pour chaque demande
def generate_ticket():
    return str(uuid.uuid4())

# Crรฉe un nouveau ticket lorsque l'utilisateur envoie une commande "!newticket"
@bot.command()
async def newticket(ctx):
    # Gรฉnรจre un identifiant unique pour le ticket
    ticket_id = generate_ticket()

    # Crรฉe un salon pour le ticket
    overwrites = {
        ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False),
        ctx.author: discord.PermissionOverwrite(read_messages=True, send_messages=True),
        ctx.guild.me: discord.PermissionOverwrite(read_messages=True, send_messages=True)
    }
    ticket_channel = await ctx.guild.create_text_channel(f'ticket-{ticket_id}', overwrites=overwrites)

    # Ajoute le ticket ร  la liste des tickets
    tickets[ticket_id] = ticket_channel.id

    # Crรฉe un bouton pour fermer le ticket
    close_button = discord.ui.Button(label='Fermer le ticket', style=discord.ButtonStyle.red, custom_id='close')

    # Crรฉe une vue avec le bouton de fermeture
    view = discord.ui.View()
    view.add_item(close_button)

    # Envoie un message avec l'identifiant du ticket et la vue contenant le bouton de fermeture
    await ctx.send(f"Votre ticket a รฉtรฉ crรฉรฉ avec l'identifiant {ticket_id}.", view=view)

# Ferme le ticket lorsque l'utilisateur clique sur le bouton "Fermer le ticket"
@bot.event
async def on_button_click(button: discord.ui.Button, interaction: discord.Interaction):
    if button.custom_id == 'close':
        ticket_id = int(interaction.message.content.split()[-1][1:-1])
        # Code pour fermer le ticket avec l'identifiant ticket_id
        channel_id = tickets.get(ticket_id)
        if channel_id:
            channel = interaction.guild.get_channel(channel_id)
            await channel.delete()
            del tickets[ticket_id]
            await interaction.response.edit_message(content=f"Le ticket {ticket_id} a รฉtรฉ fermรฉ et le salon a รฉtรฉ supprimรฉ.")
        else:
            await interaction.response.edit_message(content=f"Le ticket {ticket_id} n'existe pas.")

# Affiche un message dans la console lorsque le bot est prรชt
@bot.event
async def on_ready():
    print(f'{bot.user.name} est connectรฉ ร  Discord et prรชt ร  รชtre utilisรฉ !')

# Dรฉmarre votre bot
bot.run("")```


My bot does not create ed ticket but has no error and no reaction when I make the order
fading linden
hushed galleon
hushed galleon
onyx crag
#

Ah lord!

dense jackal
#

I use easy_pil and when someone joins with no pfp, my welcome message doesnโ€™t send.

#

Im wondering what I need to change to make it work

brazen raft
#

Probably because you have to use display_avatar instead of avatar

weary root
#

Do you guys know how to draw pixel art using turtle

tall temple
#

what do i have to do to get the same result ?

rugged shadow
#

the code executor is snekbox

#

it's a web service

tall temple
#

hm ?

#

lemme check

#

wtf is that @rugged shadow ๐Ÿ˜น ?

rugged shadow
#

or do you want an admin-only unsafe command that runs in the bot itself

tall temple
#

uh

#

i just want to find a solution to get the same result ๐Ÿ’€

rugged shadow
#

what exactly do you mean

tall temple
#
@bot.slash_command(name="methodslist",
                   description="CMD used to display methods list")
async def methodslist(ctx):
  folder = pathlib.Path(f"users_data/{ctx.guild.id}")
  await ctx.respond(embed = discord.Embed(name = "test" , description = '"\n".join(folder.iterdir())' , color = 0x50468a))

i want to make a list in the embed desc. of all files names in a specific directory @rugged shadow

rugged shadow
#

oh alr

#

maybe you could store iterdir's result in a variable and just join them in the description

tall temple
#

oh, lemme try

#

@rugged shadow like that ?

@bot.slash_command(name="methodslist",
                   description="CMD used to display methods list")
async def methodslist(ctx):
  folder = pathlib.Path(f"users_data/{ctx.guild.id}")
  fl = folder.iterdir()
  await ctx.respond(embed=discord.Embed(
    title="test", description=f'{"\n".join(fl)}', color=0x50468a))
rugged shadow
#

u dont need the fstring

austere prairie
#

@slate swan

#

what do you need help with?

#

in the dev portal?

#

these are all the privileged intents

#

you're welcome

#

can you send them here?

slate swan
#

content ...

austere prairie
#

content, not contant

#

there's a typo

#

if message.contant.startswith("$hello")
contant => content

#

no, just replace contant with content

#

keep going

#

what's the error now?

#

why are you doing {0.client}?

#

you're passing in a Bot object

#

which doesn't have a client attribute

#

get rid of the .client part

#

doesn't it do that by default?

#

just {0}

waxen shore
#

Same problem

shrewd fjord
#

Client takes intents only pretty sure

#

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

async with x Asynchronously initialises the client and automatically cleans up.

New in version 2.0.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").
shrewd fjord
#

oh nvm

#

it has more options

#

theese are all kwargs

sturdy fractal
#

i want to add 4 tab spaces in my embed

shrewd fjord
#

its bot.user

sturdy fractal
#

somone help

shrewd fjord
#

iirc u can have spaces if you use \n instead of triple quote

sturdy fractal
# shrewd fjord whats your code right now? Are you using triple quotes?
@bot.command()
async def quote(ctx):
    """Sends a random quote"""
    url = 'https://api.quotable.io/random'
    response = requests.get(url)
    data = response.json()
    author = data['author']
    content = data['content']
    embed = discord.Embed(title="Quote", description=f"{content}\n        - {author}", color=discord.Colour.random())
    embed.set_footer(text=f"Information requested by: {ctx.author}")
    await ctx.send(embed=embed)
shrewd fjord
sturdy fractal
shrewd fjord
#

just try :)

#

then just give more spaces after \n

sturdy fractal
#

ok

sturdy fractal
shrewd fjord
#

....

#

hm

#

use unicode then

sturdy fractal
shrewd fjord
#

sec

sturdy fractal
proven pendant
#

hi im using tree.py app_commands stuff in my discord bot
and there is this one command i want to remove....so the issue is, i removed the code from a file and used the same code in another file.....however the command got registered from the first file....and now there are two commands with same name

how do i remove command from tree.py

shrewd fjord
#

u cant register two commands

proven pendant
#

idk ๐Ÿ’€

sturdy fractal
#

pithink ok

proven pendant
#

im so confused-

shrewd fjord
#

do \n then copy paste this

proven pendant
#

like

shrewd fjord
#

i forgor its for normal msges only

sturdy fractal
#

ook

proven pendant
#

okay so this is the first command i had made, then i removed its code and made another file in which i coded a new ping command

but that other ping command isnt showing

#

and when i use that ( โ˜๏ธ ) ping command, it shows me this error

shrewd fjord
proven pendant
#

no its not a file name

shrewd fjord
#

ื‚

proven pendant
#

its not a file i made

#

its like in a package

shrewd fjord
proven pendant
#

mm yea i think

shrewd fjord
proven pendant
#

see see

shrewd fjord
#

from code?

sturdy fractal
proven pendant
#

i have an index file
then an env file
then a folder

sturdy fractal
waxen shore
shrewd fjord
proven pendant
shrewd fjord
#

\nื‚
@sturdy fractal

#

\nื‚

glad cradle
#

bros sending new lines

sturdy fractal
shrewd fjord
#

this unicode characters ๐Ÿ’€

shrewd fjord
#

after that dot

sturdy fractal