#discord-bots

1 messages · Page 232 of 1

proven pendant
#

so the whole story is lmao

i coded the ping command in index file itself

however later decided to make a new folder called "slash_cmds" in the same directory as index.py and then add my commands in that folder (after i made ping cmd in index file, i used it once and it was succesfull so i later decide to make it in separate folder so i remove that code from index file)

so i make a new file and the make ping cmd in that folder

and I use discord.ext, i made a class called SlashClient and then synced in tree.sync

bot.add_cog(Ping(bot))```

i made cogs right, so i used add_cog method to add all my commands thas how i synced
shrewd fjord
#

add on_ready event or setup_ hook event on the cog

#

and sync there

sturdy fractal
#

not working grumpchib

shrewd fjord
proven pendant
#

I import my ping cmd from slash_cmds folder

shrewd fjord
#

ׂ f ׂ

shrewd fjord
shrewd fjord
proven pendant
sturdy fractal
proven pendant
#

okay, i gtg rn
ill get back to this in a bit

shrewd fjord
#

this unicode used to work

#

discord patched or something lol

sturdy fractal
shrewd fjord
#

ׂ\sed

#

!charinfo

unkempt canyonBOT
#
Missing required argument

characters

#
Command Help

!charinfo <characters>
Shows you information on up to 50 unicode characters.

shrewd fjord
#

!charinfo " "

unkempt canyonBOT
sturdy fractal
#

bro i have a simple problem but we are unable to find the solution

shrewd fjord
#

it isnt simple

#

discord dont allow giving space from start of a line

sturdy fractal
sturdy fractal
#

@shrewd fjord ye i remember

#

char + up \ down arrow key to get unicodes

sturdy fractal
#

@copper quartz

copper quartz
sturdy fractal
#

here before the author name

copper quartz
#

?

sturdy fractal
copper quartz
#

here?

sturdy fractal
copper quartz
#

discord embeds probably strip whitespace

sturdy fractal
#

@copper quartz what is that cmd

copper quartz
#

have you checked the discord docs for the embed?

sturdy fractal
sturdy fractal
#

i m pretty confused

copper quartz
sturdy fractal
#

there is nothing like tab space

copper quartz
#

I have never written a discord bot so no idea how the emeds work

#

can you link me the docs?

sturdy fractal
#

k

copper quartz
sturdy fractal
sturdy fractal
sturdy fractal
copper quartz
#

maybe you have to add a field to have it inlined, descriptions field is probably made to adjust for multiple screen sizes

sturdy fractal
#

and i m now unable to save my changes

#

on discord portal

copper quartz
#

try to add a field with the text you want, see if that works

tall temple
#

what's the problem here pls ?

#

it works in my other script

#

@copper quartz

copper quartz
#

you have an indent error, either on the line in question or the previous line

#

if you share the lines above and under line 46 i can tell you in detail what the error is

sturdy fractal
copper quartz
#

data, AI, ML and backend web are huge parts

sturdy fractal
copper quartz
#

almost everything in the AI space is written in python

#

maybe, what doyou need help with?

sturdy fractal
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}")
    fl = folder.iterdir()
    if len(os.listdir(f"users_data/{ctx.guild.id}")) > 0:
        await ctx.respond(embed=discord.Embed(
         title="**➜ Server actual methods :**",
         description='> `' +
         '`\n> `'.join([item.stem
                        for item in folder.iterdir() if item.is_file()]) + '`',
         color=0x50468a))

        guild = bot.get_guild(ctx.guild.id)
    invite = await guild.channels[1].create_invite()
    logsua = bot.get_channel(config['logs_users_actions'])
    await logsua.send(embed = discord.Embed(title = f"",
                                              description = f"![correct](https://cdn.discordapp.com/emojis/1099299593558163518.webp?size=128 "correct")  ・  Bot successfully displayed methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                              color = 0xff5757))
        
    if len(os.listdir(f"users_data/{ctx.guild.id}")) == 0:
         embed=discord.Embed(
         title="",
         description=
         '![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  *There is an error right here, you did not create any Method yet :*\n\n > ・ **You can create a new Payment Method with** `/setmethod`',
         color=0xff5757)
         embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
     await ctx.respond(embed = embed)

        guild = bot.get_guild(ctx.guild.id)
    invite = await guild.channels[1].create_invite()
    logsua = bot.get_channel(config['logs_users_actions'])
    await logsua.send(embed = discord.Embed(title = f"",
                                              description = f"![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  Bot couldn't display methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                              color = 0xff5757))
copper quartz
#

do you have two on_message functions?

tall temple
copper quartz
#

well, then one of them will not work

sturdy fractal
#

ig u can just add bot prefix than if message starts with $hello

copper quartz
vale wing
#

Use @client.listen("on_message") and name one function differently

copper quartz
#

if your overwriting on_message, you need to make sure you only do it once and that you follow the rules of the library

vale wing
#
@client.listen()
async def on_message(msg):
    ...

@client.listen("on_message")
async def on_another_message(msg):
    ...```
sturdy fractal
#

looks like u r making a minecraft related bot

vale wing
#

!d discord.ext.commands.Bot.listen

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.11)").

Example...
tall temple
#

huh

sturdy fractal
#

oo u dont have a lappy ?

tall temple
#

could you help me ? hm_medra

sturdy fractal
#

laptop

tall temple
#

eivl :D 😹

sturdy fractal
vale wing
#

Regarding dpy I am here

sturdy fractal
#

lol okk u r 14 right

#

14 years old

tall temple
sturdy fractal
#

@tall temple exenifix can help u

sturdy fractal
vale wing
tall temple
vale wing
#

Not a good one imho

sturdy fractal
#

just u look 14

sturdy fractal
vale wing
#

Honest reaction to pycord

sturdy fractal
#

sry but the support kinda su*k

#

idk what kind of attitude thy got

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}")
    fl = folder.iterdir()
    if len(os.listdir(f"users_data/{ctx.guild.id}")) > 0:
        await ctx.respond(embed=discord.Embed(
         title="**➜ Server actual methods :**",
         description='> `' +
         '`\n> `'.join([item.stem
                        for item in folder.iterdir() if item.is_file()]) + '`',
         color=0x50468a))

        guild = bot.get_guild(ctx.guild.id)
    invite = await guild.channels[1].create_invite()
    logsua = bot.get_channel(config['logs_users_actions'])
    await logsua.send(embed = discord.Embed(title = f"",
                                              description = f"![correct](https://cdn.discordapp.com/emojis/1099299593558163518.webp?size=128 "correct")  ・  Bot successfully displayed methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                              color = 0xff5757))
        
    if len(os.listdir(f"users_data/{ctx.guild.id}")) == 0:
         embed=discord.Embed(
         title="",
         description=
         '![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  *There is an error right here, you did not create any Method yet :*\n\n > ・ **You can create a new Payment Method with** `/setmethod`',
         color=0xff5757)
         embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
     await ctx.respond(embed = embed)

        guild = bot.get_guild(ctx.guild.id)
    invite = await guild.channels[1].create_invite()
    logsua = bot.get_channel(config['logs_users_actions'])
    await logsua.send(embed = discord.Embed(title = f"",
                                              description = f"![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  Bot couldn't display methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                              color = 0xff5757))
sturdy fractal
#

but its ez to understand and yes u r indian

#

ik from your name

#

and English

#

trader boy

#

and that fancy font

#

chill i m not even goood in english

#

your reaction

#

btw i what bot kind of bot r u making

#

and update that bio server link add permanent link

#

hmmm harry ?

#

old user

#

so u r using discord before 13 😂

#

which is kinda not allowed

maiden fable
#

As if anyone cares 🤷

sturdy fractal
#

harry teach adva py

sturdy fractal
#

idk about others

#

some american do 🥷

sturdy fractal
#

chill

#

lol

#

vese kaha se seekh rahe ho py

#

oo harry bhai ke dekho pyaar na ho jaye to bolna

#

aacha

copper quartz
#

it worked?

#

good job! 😄

sturdy fractal
#

need to think outside of box lol

sturdy fractal
#

ez

fading linden
#

just exceeded rate limit of discord bot
how long does the ban last?

rugged shadow
#

oops you leaked your token

#

also u forgot to add an ending parenthesis at the end of your change_presence call

slate swan
vocal snow
#

We don't help with boost bots here

slate swan
merry spruce
#

hi everyone, if message.channel.send is not working, how should i fix it

vocal snow
slate swan
#

the error is that await something must be on the same line and you split it into two lines (9, 10)

merry spruce
vocal snow
#

Can you show your code?

#

What do you mean, the bot doesn't run?

slate swan
merry spruce
# vocal snow What do you mean, the bot doesn't run?
client = discord.Client(intents=intents)


@client.event
async def on_ready():
    print("We have logged as {0.user}".format(client))



@client.event
async def on_message(message):
    username = str(message.author).split('#')[0]
    user_message = str(message.content)
    channel = str(message.channel.name)

    print(username + "said" + user_message.lower() + "in" + channel)


    if message.channel.name == client.user:
        return
    
    if message.channel.name == 'bot-commands':
        response = openai.Completion.create(
            model = "text-davinci-003",
            prompt =user_message,
            max_tokens = 3000,
            temperature=0.7
        )


        output = response["choices"][0]["text"]


        print(output)
        await message.channel.send(output)

        client.run(token)
#

just a chat gpt bot

vocal snow
#

Does it print the output?

slate swan
slate swan
#

explain more

slate swan
merry spruce
merry spruce
slate swan
merry spruce
#

thank you

merry spruce
slate swan
#

show full error

merry spruce
#
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "d:\2- Nhatminh\Học\Code\Chat gpt\gpt.py", line 32, in on_message
    response = openai.Completion.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_resources\completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_requestor.py", line 620, in _interpret_response
    self._interpret_response_line(
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\api_requestor.py", line 683, in _interpret_response_line
    raise self.handle_error_response(
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.```
#

this happened when i send the message in "bot-commands" channel

slate swan
#

it literally tells you 😭 openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.

merry spruce
#

oh so i should pay for chat gpt right?

slate swan
#

iirc the free requests to gpt api were due to april 1st

#

now you have to pay for the request or something

#

not sure i didnt use this api

merry spruce
#

okay...

slate swan
#

Move it to the same line

vocal snow
#

Put line 10 on line 9

#

Possibly because you're using a mobile device

#

iirc you have to sacrifice the person you love...

velvet compass
slate swan
#
import requests
import discord
from discord import app_commands
from discord.ext import commands

import aiohttp


API_URL = "https://api-inference.huggingface.co/models/microsoft/DialoGPT-large"
headers = {"Authorization": "Bearer x"}

async def query(payload):
    async with aiohttp.ClientSession(headers=headers) as session:
        async with session.post(API_URL, json=payload) as response:
            return await response.json()


def ask(question):
    output = query({
        "inputs": {
            "past_user_inputs": [""],
            "generated_responses": [""],
            "text": question
        },
    })
    return output['generated_text']

class MyClient(discord.Client):
    def __init__(self) -> None:

        intents = discord.Intents.all()
        super().__init__(intents=intents)

        self.tree = app_commands.CommandTree(self)

    async def on_ready(self):
        print(f'Logged in as {self.user} (ID: {self.user.id})')
        print('------')

    async def setup_hook(self) -> None:
        # Sync the application command with Discord.
        await self.tree.sync(guild=client.get_guild(1024504185082875976))

client = MyClient()

@client.tree.command(guild=client.get_guild(952619213313441872), description="ask a question to ai")
async def ask(interaction: discord.Interaction,message: str):
    print('gi')
    await interaction.response.send_message('Thinking', ephemeral=True)
    out = ask(message)
    await interaction.channel.send_message(out)

client.run('x')
#

/command dosent work

hushed galleon
#

use discord.Object(...) instead, its an offline way to create snowflake-compatible objects

slate swan
#

How can I make this,

!changeloader <new link>

!loader replaces the old link and replace it with my new link we did above

#

Is that possible?

meager orchid
#

Please help, I don't know what to do. I did something without realizing it, and now my file is giving an error. How can I fix it?

vocal snow
#

error suggests that you have a list called commands

#

which is overriding what commands is actually supposed to be; presumably discord.ext.commands

meager orchid
#

Oh, thank you. I found that variable, thank you!

tall temple
#

how can i know if a string contains a link ?

slate swan
tall temple
slate swan
tall temple
slate swan
#

what?

tall temple
#

oh i found nvm

#

thanks a lot 🫂

slate swan
#

np

tall temple
#

@slate swan huh no i didn't found

#

just thoughts 😹

#

could you help me ?

slate swan
#

yeah sure

#

ill recommend u the lib "re" for regex etc.

pine cradle
#

How do I make a discord bot in python

tall temple
pine cradle
#

(:

tall temple
#
bot.slash_command(name = "latency", description = "CMD used to display the bot's latency")
async def latency(ctx) :
    embed = discord.Embed(title = "![ping](https://cdn.discordapp.com/emojis/1100135107232280748.webp?size=128 "ping") ➜ Bot actual latency :", description = f"> **Ping :** `{bot.latency * 1000} ms`", color = 0x50468a)
    embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'])
    return await ctx.respond(embed = embed)
#

i can't use /latency command

slate swan
slate swan
slate swan
tall temple
#

oh i forgot it

#

my bad, i wanted to code faster bcz i have to log out

slate swan
#

lol, happens

tall temple
#

yeah 😹

#
@bot.slash_command(name = "methodinfos", description = "CMD used to display method informations")
async def methodinfos(ctx, method : discord.Option(str, "Write here the method of which you want to display the info", required = True)) :

    if not os.path.exists(f'users_data/{ctx.guild.id}/{method}.json'):
            embed = discord.Embed(title = f"", 
                                  description = f'![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  *There is an error right here, there is no method called `{method}` :\n\n > ・ **You can create a new Payment Method with** `/setmethod`',
                                  color = 0xff5757)
            embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
            await ctx.respond(embed = embed)

            guild = bot.get_guild(ctx.guild.id)
            invite = await guild.channels[1].create_invite()
            logsua = bot.get_channel(config['logs_users_actions'])
            return await logsua.send(embed = discord.Embed(title = f"",
                                            description = f"![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  Bot couldn't get method informations for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                            color = 0xff5757))
    
    else :
        OpenFile = open(f'users_data/{ctx.guild.id}/{method}.json', "r")
        FileContent = OpenFile.read()
        Filee = json.loads(FileContent)
        fee = (Filee['fee']  - 1) * 100
        currency = Filee['currency']
        info = Filee['info']

        if "http://" in info == True or "https://" in info == True :
            embed = discord.Embed(title = f"➜ `{method}` method informations :", description = f"> **Address / link :** [`{info}`]({info})\n> **(Extra) fee :** `{fee:,.2f}`\n> **Currency :** `{currency}`", color = 0x50468a)
            embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
            await ctx.respond(embed = embed)

        else :
            embed = discord.Embed(title = f"➜ `{method}` method informations :", description = f"> **Address / link :** `{info}`\n> **(Extra) fee :** `{fee:,.2f}`\n> **Currency :** `{currency}`", color = 0x50468a)
            embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
            await ctx.respond(embed = embed)
        

        guild = bot.get_guild(ctx.guild.id)
        invite = await guild.channels[1].create_invite()
        logsua = bot.get_channel(config['logs_users_actions'])
        return await logsua.send(embed = discord.Embed(title = f"",
                                                        description = f"![correct](https://cdn.discordapp.com/emojis/1099299593558163518.webp?size=128 "correct")  ・  Bot successfully displayed method informations for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                                        color = 0x96ffa2))
#

it's not showing hypertext link :

smoky sinew
#

what link

pine cradle
#

How do I build a python bot

smoky sinew
pine cradle
tall temple
tall temple
slate swan
#

How can I make this,

!changeloader <new link>

!loader replaces the old link and replace it with my new link we did above

#

If i want to make my own discord bot, what are the best things to start of?

smoky sinew
#

also object-oriented programming and async/await

tired pine
#

dpy is very easy

#

I got used to it in about a few months

slate swan
tired pine
#

now I can make whatever

tired pine
#

I mean u can make unimaginable things like chess games

dense jackal
#

How can I delete a slash command? I already deleted the script but my bot still has the slash command and when I do it, it says interaction failed

scenic pike
#

Any who can help me and teach how can i make giveaway ?

drifting arrow
#

How do I get the category of a channel?

#

I'm using the on message and want to find what category it's in

hushed galleon
#

!d discord.TextChannel.category

unkempt canyonBOT
#

property category```
The category this channel belongs to.

If there is no category then this is `None`.
drifting arrow
# scenic pike Any who can help me and teach how can i make giveaway ?

The best way to create a giveaway is first to have some way to store the entries, say a database of some sort. lets go with AIOSQLITE or Mongo. doesnt matter as long as it meets your requirements.

Create a command, such as /giveawaystart and optional params that let you say what you're giving away. or whatever. idk, you do you at this point.

Have a single button that says "JOIN GIVEAWAY!!" and when pressed it adds people to the database for said giveaway.

Lets say you want it to expire after a day, well you're going to need some way to either automagically end it or a command, lets make a command backup just in case.

/endgiveaway <- give command will end the giveaway and run the winner functions.
but you might wanna use a loop, run it every 30 minutes or 60 minutes. everytime it runs it checks the timestamp of when the giveaway ends, and if it has reached it or surpassed it, it runs the end giveaway function.

The end giveaway function pulls all users from the database who entered, picks a random number between 1 and X where X is number of entries. \o/ congrats they won. Cake for that person.
Clears the database.

I have not done a giveaway bot so dont ask me if this is accurate, it's where I'd start tho. Good luck.

drifting arrow
#

Well. I fucked up somewhere [2023-04-25 09:11:32] [WARNING ] discord.http: We are being rate limited. POST https://discord.com/api/v10/channels/1100197334572351568/messages responded with 429. Retrying in 0.30 seconds. xD

placid skiff
#

Someone has a good vps hosting that will not cost me too much? I need at least 8 GB of RAM, i don't need huge memory, even 50GB are enough, but i'll like if it is an SSD storage, for database and other "optionals" i don't need them so i'd like to not have them if it is possible, and i'd like a Linux Ubuntu system. Someone has something?

drifting arrow
#

@placid skiff what do you consider "too much"?

#

Also, how do I make this less shit looking? xD ignore my test images. i just want it to be.. wider D:

drifting arrow
dense jackal
#

Is there a way to mention the user when they interacted with a button? Mention them in the interaction’s response

naive briar
#

Not any different than with normal message

#

!d discord.User.mention

unkempt canyonBOT
#

property mention```
Returns a string that allows you to mention the given user.
old ibex
#

!is_banned

#

!search

smoky sinew
#

you're not going to find 50 gb of ram anywhere

#

use digitalocean perhaps

dense jackal
#

So im kinda lost

#

And I tried interaction.mention and that’s not it

drifting arrow
#

@dense jackal if it's an interaction, I believe it's interaction.user and from there you can do things like interaction.user.mention etc.

dense jackal
#

Nvm I got it thx

drifting arrow
#

🙂

dim sand
#

How can i make my discord bot have a "gui" similar to the one in this photo?

sick birch
dim sand
#

Actually, more the embed

#

I wont be needing the buttons

dim sand
#

Thank you, I will look over those

sick birch
#

(had the wrong link in my clipboard, sorry 😅 )

dim sand
#

Its good 😆

dense jackal
pliant dust
#

why did this happen?

#

i did not respond to ur qn

smoky sinew
#

and don't use the -3 flag

pliant dust
#

fair

smoky sinew
#

if that doesn't work you might have to add python to path

dense jackal
drifting arrow
#

Why is my bot not mentioning the roles?

manager_roles = self.config['additional']['manager_roles']
        manager_roles_string = None
        for mr in manager_roles:
            if manager_roles_string:
                manager_roles_string += f" <@&{mr}>"
            else:
                manager_roles_string = f"<@&{mr}>"

it creates the tag thingy, but nobody gets mentioned.

smoky sinew
drifting arrow
#

on the role?

smoky sinew
#

no

#

in the bot

drifting arrow
#

lemme check

#

I mean, it is an admin

dense jackal
drifting arrow
#

it's okay @dense jackal we forgive you

dense jackal
#

Im desperate fr

#

I need to finish this thing today or else ill die trust

drifting arrow
dense jackal
#

There’s one thing I dont get tho. My button isnt displayed in the bot.event on join so member isnt defined

drifting arrow
#

¯_(ツ)_/¯

smoky sinew
#

also name your view something more descriptive than MyView

drifting arrow
dense jackal
drifting arrow
#
class MyView(discord.ui.View):
  def __init__(self) -> None:
    super().__init__()
  member_object = None

  async def some_function():
      print(self.member_object)

then

view = MyView()
view.member_object = member
smoky sinew
smoky sinew
#

also some_function needs to have self because it's not defined

drifting arrow
smoky sinew
#

that code would not work for those 3 reasons

#

oh wait

drifting arrow
smoky sinew
drifting arrow
#

I wrote the code on discord itself. indentation sucks

smoky sinew
#

yeah you could do that but also that's probably not what you wanted

#

because button_user is a class variable in CreateButtons

#

not a variable of the object

#

and you need to pass it as a required argument to CreateButtons because if you forget to set the variables it would break

drifting arrow
#

good.

#

if it's not set it should break

smoky sinew
#

that's...

#

if you didn't pass it to __init__ it would break too

drifting arrow
#

idk man. it works for me

smoky sinew
#
class WelcomeView(discord.ui.View):
    def __init__(self, member: discord.Member) -> None:
        self.member = member
        # if member is not passed, it will raise an error
drifting arrow
#

oh

#

i can see how that's significantly better

#

your way leads to an error right away. mine just leads to the bot malfunctioning 🤔

smoky sinew
#

yeah lol

drifting arrow
#

btw, feature or bug?
i replied to my bots message and the link was expanded into the display and actual url. Personally I think it's good coz i can see the full link beforehand. but I wanna know if it's intended or not?

smoky sinew
#

eh probably just discord rendering

#

it renders markdown a bit differently when the message is inline

#

like ```
this

gets turned into `this`
drifting arrow
#

😦

#

i had hoped it was a full feature.

dense jackal
#

Where do I put my view? In my bot.event on join?

#

Or outside

smoky sinew
#

outside

dense jackal
#

And that’s all?

dense jackal
#

And I did like

view2 =buttonMyView()
self.member_object =

And im lost there

smoky sinew
#
from typing import Type

class ClanButton(discord.ui.Button):
    def __init__(self, *, modal: Type[discord.ui.Modal], owner: discord.User, **kwargs) -> None:
        super().__init__(**kwargs)
        self.view = view
        self.modal = modal

    async def callback(self, interaction: discord.Interaction) -> None:
        if interaction.user != self.owner:
            await interaction.user.send_message("You don't have permission to use this menu.", ephemeral=True)
            return

        await interaction.response.send_modal(self.modal())
        
class ClanView(discord.ui.View):
    def __init__(self, owner: discord.User, /) -> None:
        self.owner = owner
        self.add_item(ClanButton(
            label="Button",
            style=discord.ButtonStyle.red,
            modal=ClanModal,
            owner=owner
        ))

...
clan_view = ClanView(ctx.author)
await ctx.send(view=clan_view)

@drifting arrow here is what i came up with

#

haven't tested it

dense jackal
#

On my position

smoky sinew
# dense jackal And I did like view2 =buttonMyView() self.member_object = And im lost there

just do something like this ```py
class WelcomeView(discord.ui.View):
def init(self, member: discord.Member, /) -> None:
self.member = member

@discord.ui.button(custom_id="bond", label="Bond")
async def bond(self, interaction: discord.Interaction, button: discord.ui.Button) -> None:
    await interaction.response.send_message(f"{interaction.user} bonded with {self.member}")

...
await ctx.send(
f"{member} joined the server",
view=WelcomeView(member) # member is the member that joined
)

dense jackal
smoky sinew
#

like i said please name your view something more descriptive than MyView and buttonMyView

#

and the issue is that you are doing view = MyView()

dense jackal
#

So I could do maybe WelcomeView and ButtonView?

smoky sinew
#

what is ButtonView

#

ButtonView still does not mean anything

dense jackal
#

Its for my bond

#

So BondButtonMyView?

#

Buttonmyview is for my member view

#

To be able to use self.member.avatar.url

smoky sinew
#

why would it be MyView and it's not necessarily a button

#

since views can have other things

dense jackal
smoky sinew
#

that's why it's not showing anything

#

it's because you're using two views, when you need one

dense jackal
#

No

#

Now it shows everything

#

Without having to delete

smoky sinew
#

delete MyView it's useless

dense jackal
#

Alright

#

Yea and now my welcome message wont even send anymore @smoky sinew

smoky sinew
#

why not

#

show your code

dense jackal
#

Sure

#

Ill send the updated

smoky sinew
#

no

#

you don't need view2 and you don't need member_object

#

but it should still be sending

dense jackal
#

Lemme send you my error maybe?

smoky sinew
#

yeah you need to pass the member

dense jackal
#

How am I supposed to do ctx.send when ctx is not defined

#

We aren’t even in a bot event of command

smoky sinew
#

just pass member to view

#

it's an example for a reason

#

you shouldn't copy and paste it

dense jackal
#

No no I get it

#

I just don’t understand how am I supposed to do it on my situation

#

Because now my whole welcome message is not sending

smoky sinew
#

you're already sending the message so just use the arguments inside ctx.send

dense jackal
#

Ok so

#

await channel.send(f"<@&1068944811782066307> Hello {member.mention}! Welcome To {member.guild.name}!", file=file, view=WelcomeMyView(member))

#

like this?

dense jackal
#

Nvm its a different error code literally

smoky sinew
#

yeah that's it

dense jackal
#

So this?
super().init()

#

Oh yeah kk

#

Nvm wait

smoky sinew
#

actually yeah

dense jackal
#

Everything works now! Thank you so much

slate swan
#

this is the error i am getting

naive briar
#

What error

slate swan
naive briar
#

How obvious can errors get

#

It's already telling you that a eco.json doesn't exist

slate swan
naive briar
#

From what

slate swan
slate swan
naive briar
#

How do I suppose to know

shrewd apex
#

also a discord bot isnt for beginners

slate swan
daring prism
#

can anyone tell me about a discord bot that edits code and works like a python editor pls

shrewd apex
#

u can take a look at jishaku library as a cog extension

shrewd apex
#

!pypi jishaku

unkempt canyonBOT
daring prism
#

how should one progress in his/her coding journey

#

🤔

shrewd apex
# daring prism 🤔

u forgot they/them but i totally forgive u loooli i would say making projects and learning new stuff from docs yt videos books any sources u get and implementing them altho i suggest to go in recommended order from simple to complex

daring prism
#

i am currently making a python + mysql project

#

class 12 th project topic - - Medical shop management

shrewd apex
#

ok just fyi if it's a discord bot don't use mysql

tawdry marsh
#

Hello, does anyone know what can I use to send these kinds of datetime representations in a message / embed?

slate swan
#

Its timestamp

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.11)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
tawdry marsh
#

Thank you very much

near umbra
#

.

slate swan
#

yo

#

show me what your trying to do @slate swan

sick birch
#

Ask away

slate swan
#

u want to edit that file right?

#

what error?

#

dude

#

await has to go in line 10 🤦‍♂️

#

bro

#

go to the front of line 10

#

and backspace once

#

is this on Notepad++?

#

oh ok

#

okok

#

its missing a ) at the end

#

syntax error,

#

and chill bro, i was finding the problem

#

every bracket needs a closing bracket

sick birch
#

!resources I'd recommend learning Python first as discord bots are not beginner friendly

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.

sick birch
#

!d discord.Game

unkempt canyonBOT
#

class discord.Game(name, **extra)```
A slimmed down version of [`Activity`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Activity "discord.Activity") that represents a Discord game.

This is typically displayed via **Playing** on the official Discord client.

x == y Checks if two games are equal.

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

hash(x) Returns the game’s hash.

str(x) Returns the game’s name.
sick birch
#

Documentation

#

I've linked you to the appropriate documentation that explains in detail how you can use discord.Game

timber wren
#

hey, this is a very simple and dumb question...

but I have been seeing places where the bot mentions the number of lines of code it has been written in.... any idea how can I do that too?

#

I can make the embed and stuff... I just wanna know how can i count the number if lines of code in a repo

#

oh i would really appreciate your guidance

#

like what?

#

i guess you pinged the wrong message 😄

timber wren
#

bro I asked a diff question man

#

😭

timber wren
#

i wasnt trynna answer you

#

Ffs

#

nvm

slate swan
timber wren
#

like cog files, json files and others?

timber wren
slate swan
tall temple
#

how can i check if a string is a link ?

slate swan
#

use regex or just check if it has http:// or https:// in it

tall temple
#

check that

#
        if "http://" in info == True or "https://" in info == True :
            embed = discord.Embed(title = f"➜ `{method}` method informations :", description = f"> **Address / link :** [`{info}`]({info})\n> **(Extra) fee :** `{fee:,.2f}`\n> **Currency :** `{currency}`", color = 0x50468a)
            embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
            await ctx.respond(embed = embed)

        else :
            embed = discord.Embed(title = f"➜ `{method}` method informations :", description = f"> **Address / link :** `{info}`\n> **(Extra) fee :** `{fee:,.2f}`\n> **Currency :** `{currency}`", color = 0x50468a)
            embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
            await ctx.respond(embed = embed)
#

@slate swan

slate swan
#

what is the info variable

tall temple
#

it's the address / link

slate swan
#

!e ```py
info = "https://google.com"
if "http://" in info == True or "https://" in info == True :
print("test")

unkempt canyonBOT
#

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

[No output]
slate swan
#

yeaah there's issue with the logic

tall temple
#

yeah, as i see :/

#

is there any other method ?

slate swan
#

replace thsi py if "http://" in info == True or "https://" in info == True : with ```py
if ("http://" in info) or ( "https://" in info ):

#

!e ```py
info = "https://hey.com"
if ("http://" in info) or ( "https://" in info ):
print("yes")

unkempt canyonBOT
#

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

yes
slate swan
#

^

tall temple
#

lemme test :D

lean willow
#

I'm new to python & wondering if someone can provide me with a tutorial, series, or just some documents to help me with a particular thing I am trying to do. (currently at work. Please ping-reply for me to find later)

I am making a gaming/currency bot. Most of the commands come with a cooldown (currently using the @commands.cooldown() to accomplish)
What I am wanting to do is create a command that shows them every command they currently have on cooldown & how long it still is on cooldown.
I do have an error handler set up where if they use the command that is on cooldown, it tells them how long is left until off, but there is a lot of commands & i dont want users just spamming commands seeing what is off cooldown for them. @.@

thin trout
naive briar
#

Just read it, just even a little

tall temple
#

@slate swan working thanks to you my g !

naive briar
#

How any more obvious can it be

slate swan
thin trout
naive briar
unkempt canyonBOT
#

get_cooldown_retry_after(ctx, /)```
Retrieves the amount of seconds before this command can be tried again.

New in version 1.4.

Changed in version 2.0: `ctx` parameter is now positional-only.
naive briar
#

It'll return 0.0 if a command isn't on cooldown

tall temple
#
Ignoring exception in command methodslist:
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 982, in _invoke
    await self.callback(ctx, **kwargs)
  File "C:\Users\user\Documents\calculator\main.py", line 351, in methodslist
    if len(os.listdir(f"users_data/{ctx.guild.id}")) > 0 :
FileNotFoundError: [WinError 3] Le chemin d’accès spécifié est introuvable: 'users_data/1096182696000098385'

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

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: FileNotFoundError```
#

huh ?

slate swan
#

idk why I'm getting this 🙄
things are working properly no error nothing
but why is this appearing

#

can someone help me with this?

tall temple
#

related with the selector

slate swan
#

I think it's bc of callback

tall temple
#

related with the selector

slate swan
slate swan
slate swan
#

okk

#

class _ProfileDropdown(discord.ui.Select):
    def __init__(self, messageInteraction: discord.Interaction, user_data):
        self.userData = user_data
        self.messageInteraction = messageInteraction
        options = [discord.SelectOption(
            label="General Profile",
            description="Shows Profile of the user"
        ),
            discord.SelectOption(
            label="Profile Picture",
            description="Shows Profile Picture of the user"
        ),
            discord.SelectOption(
            label="Profile Bio",
            description="Shows Bio of the user"
        ),
            discord.SelectOption(
            label="Latest Answers",
            description="Shows the latest Answers by users"
        ),
            discord.SelectOption(
            label="Knows about",
            description="Shows about user"
        )]
        super().__init__(placeholder='More',
                         min_values=1,
                         max_values=1,
                         options=options)

    async def callback(self, interaction: discord.Interaction):
        if self.messageInteraction.user.id == interaction.user.id:
            match(self.values[0]):
                case "General Profile":
                    await interaction.message.edit(embed=profile_view(self.messageInteraction.user, self.userData))
                case "Profile Picture":
                    await interaction.message.edit(embed=profile_pic_view(self.messageInteraction.user, self.userData))
        else:
            await interaction.response.send_message("You can't interact with this message", ephemeral=True)


class ProfileDropdownView(discord.ui.View):
    def __init__(self, messageInteraction: discord.Interaction, user_data: quora.Profile):
        super().__init__()

        # Adds the dropdown to our view object.
        self.add_item(_ProfileDropdown(messageInteraction, user_data))
slate swan
tall temple
slate swan
#

I'm a newbie

#

;-;

tall temple
#

sorry i'm not enough competent for that

tall temple
slate swan
slate swan
tall temple
tall temple
slate swan
#

it could not find the folder

tall temple
#

yeah ik

#

but i used an if statement for that

slate swan
#

I'm getting desire output

slate swan
# tall temple

and where is the part checking length of the folder? above or below this

slate swan
#

but that red message still popping up

tall temple
#

i already made the part checking the folder lenght and it's working

slate swan
# slate swan what did you get?

on selecting values from dropdown and printing self.values[0]
i got

2023-04-25 23:04:07 INFO     root Bot is ready...
['General Profile']
['Profile Picture']
['Profile Picture']
['General Profile']
slate swan
unkempt canyonBOT
#

await edit_original_response(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the original interaction response message.

This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.

This method is also the only way to edit the original message if the message sent was ephemeral.
slate swan
#

it makes difference

slate swan
slate swan
#

then self.values[0] returns a list not a string for which you are looking for

tall temple
# slate swan show full code
@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}")

    if len(os.listdir(f"users_data/{ctx.guild.id}")) > 0 :
            embed = discord.Embed(title="**➜ Server actual methods :**",
                                description='> `' + '`\n> `'.join([item.stem for item in folder.iterdir() if item.is_file()]) + '`\n\n**Use `/methodinfo` to display method informations**',
                                color=0x50468a)
            
            embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
            await ctx.respond(embed = embed)

            guild = bot.get_guild(ctx.guild.id)
            invite = await guild.channels[1].create_invite()
            logsua = bot.get_channel(config['logs_users_actions'])
            await logsua.send(embed = discord.Embed(title = f"",
                                                    description = f"![correct](https://cdn.discordapp.com/emojis/1099299593558163518.webp?size=128 "correct")  ・  Bot successfully displayed methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                                    color = 0x96ffa2))
        
    if len(os.listdir(f"users_data/{ctx.guild.id}")) == 0 :
        embed=discord.Embed(
        title="",
        description=
        '![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  *There is an error right here, you did not create any Method yet :*\n\n > ・ **You can create a new Payment Method with** `/setmethod`',
        color=0xff5757)
        embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
        await ctx.respond(embed = embed)
    
        guild = bot.get_guild(ctx.guild.id)
        invite = await guild.channels[1].create_invite()
        logsua = bot.get_channel(config['logs_users_actions'])
        await logsua.send(embed = discord.Embed(title = f"",
                                                  description = f"![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  Bot couldn't display methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                                  color = 0xff5757))

    if not os.path.isdir(f"user_data/{ctx.guild.id}") :
        embed = discord.Embed(title="",
                            description = '![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  *There is an error right here, you did not create any Method yet :*\n\n > ・ **You can create a new Payment Method with** `/setmethod`',
                            color=0xff5757)
        embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
        await ctx.respond(embed = embed)
    
        guild = bot.get_guild(ctx.guild.id)
        invite = await guild.channels[1].create_invite()
        logsua = bot.get_channel(config['logs_users_actions'])
        await logsua.send(embed = discord.Embed(title = f"",
                                                  description = f"![wrong](https://cdn.discordapp.com/emojis/1099355463327428768.webp?size=128 "wrong")  ・  Bot couldn't display methods list for `{ctx.author}` in [` {ctx.guild.name} `]({invite}) !",
                                                  color = 0xff5757))
slate swan
tall temple
#

because with another cmd, i can delete the folder

#

that's why

slate swan
#

bro what

#

i just said

#

this makes no sense

#

thats like you would send message to channel and after trying to send it check if the channel exists

#

like that makes no sense

tall temple
#

wait

#

i'll test something

bleak brook
#

Hello, the slash commands of my Discord bots suddenly stop working. Does anyone have the same problem?

fast anvil
#

Hello. I have a very simple button for a discord bot. Using Replit & discord.py. Below is my code:

class Menu(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @discord.ui.button(label="Send Message", style=discord.ButtonStyle.grey)
    async def menu1(self, interaction: discord.Interaction, button: discord.ui.Button):
        print("Hit")
        await interaction.response.send_message("You Clicked Me!")


@bot.command()
async def menu(ctx):
    view = Menu()
    await ctx.reply(view=view)```

I am able to get the bot to display the button on the -menu command. However, when I click the button. I always get a "! This Interaction Failed" message. No matter what I do, I cannot seem to fix this. Any help?
slate swan
fast anvil
#

a button displays but on click I get no response

slate swan
#

remove the self.value none its unnecessary

sick birch
slate swan
#

also i assume you use discordpy, have you imported it correctly?

sick birch
#

So the callback itself is not getting called. Strange

slate swan
#

try this example and see if it works

fast anvil
#

I have lots of other commands that work fine. just not a button

fast anvil
fast anvil
slate swan
#

you need v2 in order to use buttons

fast anvil
#

so i'm going to try to temporarily host it from my pc using vscode and install the correct packages and see if that works

#

didn't work with v2

#

i'm going to try with my pc at home. i've been trying from my work machine.

#

I'll send update

drifting arrow
#

hey guys. how do I change a server image? the little image on the left? but not this discord obviously, my discord

unkempt canyonBOT
#
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., afk_channel=..., owner=..., afk_timeout=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the guild.

You must have [`manage_guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") to edit the guild.

Changed in version 2.0: The newly updated guild is returned.

Changed in version 2.0: The `region` keyword parameter has been removed.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.11)") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.11)") instead of `InvalidArgument`.
drifting arrow
#

Neat!

#

Ty @sudden radish

#

ty @smoky sinew

#

How often can I change the icon? 🤔

smoky sinew
#

unsure

#

@drifting arrow did you see the code i sent you yesterday

drifting arrow
jolly prism
#

hi i want to learn the discord.py api... any advice on how to learn it?

merry cliff
#

just try making a bot

#

and if you choose to follow a tutorial, make sure its 1 year old max

jolly prism
#

ik coding though

merry cliff
#

well is there a specific type of bot you want to make?

jolly prism
#

but not the api

merry cliff
jolly prism
#

yep

merry cliff
#

ok so what do u wanna make

jolly prism
#

i just want to try it out for fun as a way to practice coding...

#

but like how should i start learning an api

merry cliff
#

well each API is different

#

but for discord, you could start with a simple bot

#

let's move this into a thread to save space.

#

ok nvm no perms

#

first is to have all the correct imports

#

for a discord bot, you will want ```py
import discord
from discord.ext import commands

#

ok to start, create an instance of a bot

#

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

jolly prism
#

ok

merry cliff
#

edited bc i forgot

#

ok now the first function to create is something to let us know when the bot is online and ready.

#
@bot.event
async def on_ready():
    print("bot is online")```
jolly prism
#

@bot.event()

merry cliff
#

correct!

jolly prism
#

something like that

#

on i know the basics of the api

merry cliff
#

ok tell me what you do know

#

for example do u know how to make a text command?

#

thats a command you call using a prefix

smoky sinew
jolly prism
#

@bot.command()
async def name(ctx):

merry cliff
#

ok

smoky sinew
#

you can't include the parenthesis there

jolly prism
#

eoh

merry cliff
#

do u know how to get a bot token?

jolly prism
#

ya

merry cliff
#

ok

jolly prism
#

developers portal

#

etc

merry cliff
#

so what would you like to learn?

#

cogs?

jolly prism
#

like any good resources to learn the discord api

#

from the beginning

merry cliff
#

the best way is to just make your own bot

#

and add random features

#

then you can teach yourself things (AKA google)

#

gtg toh

jolly prism
#

hmm ok practice makes perfect

merry cliff
#

Ye

#

I gtg but u can pm me if u run into anything

thin trout
#

hi, i created a ticket function in my bot but i want it to always be synced with the bot when he reboot so i don't have to do the ticket launch command again, is there a way?

austere prairie
thin trout
#

because its really annoying do the command every time i reboot the bot

austere prairie
#

It's not that bad

#

And you can use cogs instead, which you can reload without having to restart the bot every time you make a change

thin trout
#

with cogs i have to make an error handler cuz i can't see any errors in console while working

jolly prism
old ibex
thin trout
old ibex
#
Traceback (most recent call last):
  File "C:\Python\lib\site-packages\discord\ext\commands\bot.py", line 935, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1017, in get_code
  File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\lux\Desktop\luxor\luxor\commands\misc.py", line 10
    os.system("cls"
             ^
SyntaxError: '(' was never closed

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

Traceback (most recent call last):
  File "C:\Users\lux\Desktop\luxor\luxor\luxor.py", line 52, in <module>
    bot.run(tk)
  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\luxor.py", line 50, 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.misc' raised an error: SyntaxError: '(' was never closed (misc.py, line 10)```
thin trout
#

with cogs i didn't get any errors

old ibex
#

This is in a cog. It shows fine.

#

Then ur cog isn't setup right

thin trout
#

i know

#

but i don't have the required skills to setup up a cog correctly

old ibex
#
# Top of file.
class Whatevername(commands.Cog):
    def __init__(self, bot) -> None:
        self.bot = bot
old ibex
#
# bottom of cog file
async def setup(bot) -> None:
    await bot.add_cog(TheNameYouPut(bot))```
thin trout
#

but in console i didn't get any errors

#

i followed a lot of guides and tutorial but in none of them i get a fix for the errors in console

old ibex
#
# main file
extensions = ("commands.misc", "commands.ready", "commands.filename",)
bot = commands.Bot(
    intents=intents,
    command_prefix='-'
)```
#
#end of main file

@bot.event
async def setup_hook() -> None:
    for extension in extensions:
        await bot.load_extension(extension)
thin trout
#

ill try

#

thanks 😄

old ibex
#

hot

fervent shoal
#

yoooo so for some reason when i try to make a simple bot, the discord in import discord shows missing imports, but i literaly just reinstalled discord.py

brazen raft
vocal snow
#

The error has a paragraph right there that explains it

vale wing
#

What's your code

#

Ah yes naming Bot instance client

#

!d discord.ext.tasks.loop use this for background loops @slate swan

unkempt canyonBOT
#

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

Examples upper on that page

#

Good practice is to name instance of commands.Bot bot and Client client

#

Those examples are pretty easy to understand aren't they

#

I mean it's like 3 lines of actual code

#
@tasks.loop(minutes=5)
async def your_task():
    ...

your_task.start()```
#

Whatever you need to be executed in your loop

#

Soon I'm taking off the bus so can't guarantee to be available

#

You messed up the structure

#

Looks like a python beginner to me rockWhat

#

!indents

unkempt canyonBOT
#
Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

hexed pilot
#

guys how can i use cogs

naive briar
#

Learning offline?

lyric halo
#

this is the embed, there are 4 fields here General PvP rates and more info i want to make it so Genral and pvp are in one line and the other two are in the other line.
the code:

  embed = discord.Embed(title='Player Stats',description=f'**{player.name}**\n{player.bio}')
  embed.set_thumbnail(url=player.avatar)
  embed.set_footer(text=f'Requested by {interaction.user}')
  embed.add_field(name="General:", value=f'**Levels: **{player.level}\n**XP: **{player.xp}\n**Tier: **{player.tier}\n**Guild: **{player.guild}\n**Credits: **{player.credits}', inline = True)
  embed.add_field(name="PvP:", value=f'**Kills: **{player.kills}\n**Deaths: **{player.deaths}\n**All Kills:**{player.allKills}\n**All Deaths: **{player.allDeaths}\n**Wins: **{player.wins}\n**Losses: **{player.losses}', inline = True)

  embed.add_field(name="Rates:", value=f'\n**K/DR: **{player.kdr}\n**AK/ADR: **{player.kdrTotal}\n**W/LR: **{player.wlr}\n**W/DR: **{player.wdr}', inline = False)
  embed.add_field(name="More Info:", value=f'**Voted: **{player.voteStatus}\n**First Joined: **{player.firstJoinedDate}\n**Last Acitve: **{player.sen} ago, On {player.server}')

  await interaction.response.send_message(embed = embed)
vale wing
#

Such common "doubts" can be prevented if you know and understand basics which you can learn anywhere

#

Function indents are pretty basic

slate swan
#

For anyone who owns/is a developer for a Discord bot:

How were you able to grow it? Did you use server listing sites and got people to vote for your bot, Im in need for some help haha

tawny tapir
#

That's it

slate swan
#

Just lucky in general

tawny tapir
# slate swan Lucky as in what?

Luck in general, there's thousands of bots out there. Ofc you can promote it, that's always a good thing to do, but your bot also has to be intuitive to use

#

Most popular bots have been out there for years, It's hard to grow your bot because there's probably another bot that does the same thing as yours and it's way more known than yours

lean willow
hazy vault
#

Guys I need help with this problem

#

What does this problem mean

austere prairie
grizzled wraith
#

`import discord
from discord.ext import commands

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

@bot.event
async def on_member_join(member):
channel = discord.utils.get(member.guild.text_channels, name="welcome") # Change "welcome" to the name of the channel you want to send the welcome message to
embed = discord.Embed(title=f"Welcome to {member.guild.name}!", description=f"{member.mention} has joined the server.", color=discord.Color.green())
embed.set_thumbnail(url=member.avatar_url)
await channel.send(embed=embed)
`

#

chatgpt generated it but I'm getting an error

#

Member' object has no attribute 'avatar_url'

lyric halo
#

lol dont use gpt then

#

it is outdated by over 2 years

grizzled wraith
#

ok but what's the correct attribute?

fast anvil
# grizzled wraith `import discord from discord.ext import commands bot = commands.Bot(command_pre...
@bot.command(name="profile")
async def profile(ctx, user: Member = None):

    if user == None:
        user = ctx.message.author

    inline = True
    embed = discord.Embed(title=user.name + "#" + user.discriminator,
                          color=discord.Color.green())
    userData = {
        "Mention": user.mention,
        "Nick": user.nick,
        "Created at": user.created_at.strftime("%b %d, %Y, %T"),
        "Joined at": user.joined_at.strftime("%b %d, %Y, %T"),
        "Server": user.guild,
        "Top role": user.top_role,
    }
    for [fieldName, fieldVal] in userData.items():
        embed.add_field(name=fieldName + ":", value=fieldVal, inline=inline)
    embed.set_footer(text=f'id: {user.id}')
    userAvatar = user.display_avatar
    embed.set_thumbnail(url=userAvatar.url)
    await ctx.send(embed=embed)```
#

hope this can help you. this is a working -profile command

#

for this to work for me I had to import

from discord import Member```
grizzled wraith
#

so its user.display_avatar

#

.url

fast anvil
#

userAvatar = user.display_avatar
embed.set_thumbnail(url=userAvatar.url)

slate swan
grizzled wraith
#

right?

radiant bough
#

What do I use so that user can send both int and str at same time in the message, like user input is “I am 123”

grizzled wraith
#

i guess you could use split() on message.content and use a for loop to try type cast every word into an integer

#

code?

#

line 28 is causing issue

#

try using await with that line

#

😂

austere prairie
#

What is this for?

grizzled wraith
#

await client.loop.ch_pr()

austere prairie
#

Changing presence every 10 seconds?

#
  1. You should avoid changing the bot presence very often, I think you can get ratelimited for that
  2. Use discord.ext.tasks instead
#

The bot 'status' is called presence

grizzled wraith
#

@client.event async def on_member_join(member: Member):
is this legel? I imported Member from discord

austere prairie
#

You can change it, but it requires an API call each time you change it

grizzled wraith
#

how to use syntax higlighting here?

austere prairie
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.

grizzled wraith
#

thanks

austere prairie
grizzled wraith
#

he just answered you

austere prairie
#

And don't try to make your own loop, use discord.py's own looping mechanism

austere prairie
grizzled wraith
austere prairie
#

It should run fine

#
from discord.ext import tasks

...

@tasks.loop(seconds=10)
async def change_presence():
    ...
```thats how it works iirc
#

You should probably look up the proper documentation for it though

#

You just need to keep the ch_pr function

tall temple
#

how can i make message edit interaction for a message button ? :

class pm(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.add_item(discord.ui.Button(label="Litecoin", emoji = "![litecoin](https://cdn.discordapp.com/emojis/1100484173719945286.webp?size=128 "litecoin")", style = discord.ButtonStyle.blurple))
        self.add_item(discord.ui.Button(label="Bitcoin", emoji = "![bitcoin](https://cdn.discordapp.com/emojis/1100484215780425789.webp?size=128 "bitcoin")", style = discord.ButtonStyle.red))

@bot.slash_command(name = "testtt", description = "")
async def donatetomedra(ctx) :
    embed = discord.Embed(title = "test", description = "retest", color = 0x50468a)
    embed.set_footer(text = config["footer_txt"], icon_url = config['footer_img'] )
    await ctx.respond(embed = embed, view = pm())
#

about what

#

i'm playing 💀

#

playing

#

something 😹

austere prairie
tall temple
austere prairie
#

I've only used d.py before, but I think it should be similar

tall temple
#

stop spamming dude

austere prairie
#

Basically, store ctx as an attribute in the View subclass and use that to edit it when the buttons get pressed

You can add callbacks for buttons like this: ```py
class pm(discord.ui.View):
...
@discord.ui.button( ... )
async def foo(self):
...

tall temple
grizzled wraith
#
@client.event
async def on_member_join(member: Member):
    channel = discord.utils.get(member.guild.text_channels, name="welcome")
    backgroud = Editor("pic1.jpg").resize((800,450)) 
    profile_image = await load_image_async(str(member.display_avatar))
    profile = Editor(profile_image).resize((150,150)).circle_image()
    poppins= Font.poppins(size=50,variant="bold")
    poppins_small = Font.poppins(size=25, variant="light")
    backgroud.paste(profile,(325,90))
    backgroud.ellipse((325,90), 150, 150, outline="white",stroke_width=5)
    backgroud.text((400,260), f"WELCOME TO {member.guild.name}", color="white",font=poppins, align="center")
    backgroud.text((400,325), f"{member.name}#{member.discriminator}", color="white", font=poppins_small, align="center")
    file = File(fp=backgroud.image_bytes, filename="pic1.jpg")
    await channel.send(f"HELLO {member.mention}! WELCOME TO {member.guild.name}")
    await channel.send(file=file)
@client.event
async def on_member_remove(member: Member):
    channel = discord.utils.get(member.guild.text_channels, name="goodbye")
    backgroud = Editor("pic1.jpg").resize((800,450)) 
    profile_image = await load_image_async(str(member.display_avatar))
    profile = Editor(profile_image).resize((150,150)).circle_image()
    poppins= Font.poppins(size=50,variant="bold")
    poppins_small = Font.poppins(size=25, variant="light")
    backgroud.paste(profile,(325,90))
    backgroud.ellipse((325,90), 150, 150, outline="white",stroke_width=5)
    backgroud.text((400,260), f"{member.guild.name} HAS LEFT THE SERVER", color="white",font=poppins, align="center")
    file2 = File(fp=backgroud.image_bytes, filename="pic1.jpg")
    await channel.send(file=file2)
#

if a user leaves and then immediately re-enters, it throws and error saying you can't await profile_image again

#
#imports
import json

import discord

import token1

from discord.ext import commands

from discord import File

from easy_pil import Editor, load_image_async, Font

from discord.ext.commands import has_any_role, CheckFailure

from discord import Member
#

here are my imports

#

should py if profile_image == None: profile_image = await load_image_async(str(member.display_avatar))
work

#

I'm being rate limited by discord on my test account

#

if a variable isn't assigned, can you use something like ```py
if not variable

#

just checked, that does not work

austere prairie
tall temple
#

and if i want to disable it when someone will click on it ?

austere prairie
#

Oh wait, you receive the button and interaction in the callback

#

You can use it to modify the button in the callback: ```py
@discord.ui.button
async def foo(self, interaction, button):
...
button.disabled = True

gleaming shore
#

Im trying to split up my functions and bot.command() in diffferent files, but when I place my function definitions in a different file and import all the files in each other so they are connected it still doesnt seem to work for me, only when I put everything in one file. Does anyone have like a video to help me out or knows how it works ?

austere prairie
gleaming shore
#

you see in the def

#

I called the functions file

#

it tells me that it should work but doesnt

#

I tried with the bot and it also gave me the same options

austere prairie
gleaming shore
#

I was taking a look at this

fierce valve
gleaming shore
#

Is that not the same concept?

fierce valve
#

I am facing this error pls someone help me

#

I am a beginner or this is a code of my friend

austere prairie
gleaming shore
#

unless you dont mind explaining it

austere prairie
#

I'll try to find one

gleaming shore
austere prairie
gleaming shore
#

wait I think I just found a fix

#

these are in a separete file

#

I called this in the main file

from functions import add_vectors, subtract_vectors
#

but im guessing this is gonna be unefficient in the long-run ?

austere prairie
#

No, that's how you're supposed to use imports

gleaming shore
#

before I only imported 'functions' perhaps thats why it didnt work

#

but then why would I want to use "cogs" rather than just do it that way ?

austere prairie
#

discord.py uses decorators (i.e. @something before the function) which doesn't work with imoorts

gleaming shore
#

I have @eternal girder

#

or is that not what you mean ?

austere prairie
tall temple
austere prairie
#

And you can click on it multiple times?

tall temple
#

but it's not working for me

austere prairie
gleaming shore
#

oh

#

so what so you mean cogs is a replacement for the @ part ? which is more efficient ?

austere prairie
#

Cogs let you group a collection of bot commands / event handlers / etc. and load/unload them at once

tall temple
austere prairie
#

If you have a cog in a separate file, you can import that cog and load the cog to load the commands inside of iy

austere prairie
tall temple
austere prairie
gleaming shore
#

and now VectorCog contains all of that ?

tall temple
austere prairie
#

Yes, now VectorCog contains those commands

austere prairie
gleaming shore
#

do you think I should have the functions definitions and command "mains" in the same file or is it better to separete them into differnet cogs aswell? what is most optimal for bigger projects?

#

Im planning to make a math bot that calculates linear algebra calculations with vectors,matrices,gaussiuan eleminations etc

austere prairie
#

Cool

austere prairie
gleaming shore
austere prairie
#

I haven't worked on it in a while, it was mostly a bunch of small, silly things combined together

gleaming shore
#

I just wanted to make something that there isnt much of and something having to do with my classes haha

#

it's actually a fun thing to try out just gotta learn more about the discord library

vernal folio
#

My discord. Py bot not reading dm reaction, I tried several things but it still not reading, he reading his own reaction but not mine

#

Plz help

gleaming shore
#

@austere prairie

#
import discord
from discord.ext import commands
from bot import TOKEN
from VectorCog import VectorCog

intents = discord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix='?', intents=intents)

@bot.event 
async def on_ready():
    print("I'm online!")

bot.add_cog(VectorCog(bot))

bot.run(TOKEN)

#

what am I missing? once I did this now I cant call the commands ?add 1,2,3 1,2,3

gleaming shore
#

why?

glad cradle
#

if you're using the latest version of discord.py Bot.add_cog is a coroutine, this means that it needs to be awaited, you should be getting a warning

#

yeah

gleaming shore
#

is that why its not working ?

glad cradle
#

yes

gleaming shore
#

does this fix it ? ```py
import tracemalloc
tracemalloc.start()

glad cradle
#

no

gleaming shore
#

then how do I fix it

glad cradle
#

something like this should work

import asyncio

...

asyncio.run(bot.add_cog(VectorCog(bot)))
bot.run(...)

though it's preferable to do things using a main function

gleaming shore
#

cant I do that in the main function ?

glad cradle
#

yes you can

#

no

gleaming shore
#

but it just worked

#

damn it actually worked

glad cradle
#

ah didn't see the main function

#

you can put the add_cog inside main too

glad cradle
gleaming shore
#

what main function are you referring to

glad cradle
#

start_bot

gleaming shore
#

ohh, why would I want to add_cog in there?

#

like what does it change

glad cradle
#

should be faster than running it with asyncio.run

gleaming shore
#
import asyncio
import discord
from discord.ext import commands
from bot import TOKEN
from VectorCog import VectorCog

intents = discord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix='?', intents=intents)

async def start_bot():
    await bot.start(TOKEN)
    bot.add_cog(VectorCog(bot))

@bot.event 
async def on_ready():
    print("I'm online!")

asyncio.run(bot.add_cog(VectorCog(bot)))
asyncio.run(start_bot())

Like so ?

glad cradle
#
import asyncio
import discord
from discord.ext import commands
from bot import TOKEN
from VectorCog import VectorCog

intents = discord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix='?', intents=intents)

async def start_bot():
    await bot.add_cog(VectorCog(bot)) 
    await bot.start(TOKEN)

@bot.event 
async def on_ready():
    print("I'm online!")

asyncio.run(start_bot())
gleaming shore
#

yeah thank you, I was gonna say I cannt add it inside startbot because its asynchronus function that will start the bot and should only handle the startup process

#

thank you alot for the help!

glad cradle
#

you're welcome

steady flume
#

how to get bot command ? for example i wanna make help command where member can write command name and bot will show info (aliases, name, brief) about this command

fierce valve
#

Can someone help me ??

idle palm
#

Hi

#

I set up my raspberry pi and im not too sure how to set it up to host my py file 24/7

slate swan
#

in discord.ui dropdown select
I just want this placeholder to change it's value to the selected value

super().__init__(
            placeholder="More", min_values=1, max_values=1, options=options
        )
#

how to do that?

eager bronze
#

this is what I did "sudo apt install screen"

idle palm
eager bronze
#

no problem

smoky sinew
smoky sinew
hushed galleon
thin raft
#

Any ideas on how to give a role for a month?

smoky sinew
#

store the duration in the database and use asyncio sleep

thin raft
#

why asyncio .sleep?

#

if the bot restarts i will loose it right

smoky sinew
#

i never figured out how this worked

weary isle
#

hey can someone help

smoky sinew
#

i do not have access to that

#

but do you have message content intent and process_commands in your message event listener?

torn sail
# slate swan how to do that?

in the callback function, you can set self.placeholder = self.values[0] and then edit the message with the updated view

#

!d discord.ui.Select.callback

unkempt canyonBOT
#

await callback(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The callback associated with this UI item.

This can be overridden by subclasses.
vocal snow
#

Sync them globally

#

No need for the copy_global_to

#

And you use commands.Bot when you want to use the commands extension for command parsing / cogs / extensions etc

jolly prism
#

hi im new to discord.py how do i start learning the module from the beginning like any resources etc

swift trench
#

Docs

plucky sun
#

please sand a ticket system. I'm very stuck

vocal snow
plucky sun
#

I get error after error

vocal snow
#

Ok, send the error here so we can help solve it

#

Also, it would be a good idea to make sure you are comfortable with basic python if you arent

#

We can give resources for that if you need

plucky sun
vocal snow
#

Are you trying to send the view to the ticket channel?

plucky sun
#

Yes

vocal snow
#

Just pass it to channel.send

#

To the view kwarg

jolly prism
#

Or something which explains it

slate swan
jolly prism
slate swan
slate swan
#

will sqlite3 be enough for 40-50 servers ?

#

how time consuming will it be to scale it to something like mysql or postgresql

vocal snow
vocal snow
#

If you write proper abstractions, you should be able to plug-in/plug-out the database connector of choice with minimal effort

#

You could also consider using an ORM to do that for you

vocal snow
#

What are you trying to make?

jolly prism
vocal snow
#

Awesome, and do you want it to have slash commands?

#

Or normal commands?

#

Perhaps no commands and you only want some events?

vocal snow
#

And the Interactions reference in the docs if you need to lookup a specific class/function

jolly prism
#

Ya but I’m learning the module itself

vocal snow
jolly prism
#

So like from where should I start out of these

vocal snow
#

You could start from anywhere. It isn't in a particular order

jolly prism
#

I don’t know the module yet to code slash commands I would say

#

Ok

vocal snow
#

Specifically discord.app_commands

jolly prism
#

Any order you would recommend

vocal snow
#

If you're trying to learn the workings in detail, first stop would be the discord dev portal

jolly prism
#

I’m going to sleep is it ok if I ask for help in the morning ?

vocal snow
#

Yes, there's always someone in this channel usually

thin raft
#

Can you create commands without decorators?

vocal snow
#

Yes

#

Decorators are just functions

#

And you can always instantiate a Command and add it with bot.add_command

slate swan
#

how can I remove a slash command.

white citrus
#
    @nc.slash_command(name="avatar", description=f"Shows you an avatar of a member!")
    async def avatar(self, inter: Interaction,
                     member: Member = SlashOption(name="member", description=f"Please select a member"),
                     show_message: bool = SlashOption(name="hidden", description="Would you like to make the message only visible to you?", required=False, autocomplete=bool)):
        
        
             
        f_member = member or inter.user

        message_delete_time = 25
           
        #Embeds
        noavatar = Embed(description=f"{config.DiscordError} This member has no avatar!", colour=config.dark_red)
        
        try:
            m_av = f_member.avatar
            re = Embed(title=f"Avatar from {f_member}", description=f"Here is the avatar of {config.DiscordMembersEmoji} {f_member.display_name}")
            re.set_image(url=m_av)
            await inter.response.send_message(view=MAV(inter, f_member), embed=re, delete_after=message_delete_time)
        except:
            await inter.response.send_message(embed=noavatar, ephemeral=show_message)```
Why isn't the message ephemeral
vocal snow
#

!dashmpip

unkempt canyonBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

vocal snow
#

Also it looks like urlscanio is supposed to be a command line tool, are you sure you can embed it in your code?

fading linden
#

hwo do you avoid geting rate limited? i have a private bot that i use, i dont even use it that much but i kept getting rate limited for some reason

fading linden
vocal snow
#

Which?

fading linden
#

sparkedhost

vocal snow
#

No clue about that unfortunately

fading linden
#

the error that comes up is discord.errors.HTTPException: 429 Too Many Requests

#

i mean i am using the requests librarty

vocal snow
#

It's possible they're using shared systems for multiple users

#

You should not be using requests along with discord.py

#

Use aiohttp instead

#

But the error is not related to that

fading linden
vocal snow
#

Because it's not async

fading linden
#

parts of my command uses GET for retrieving info
maybe its time to have a copy of all of those locally

fading linden