#discord-bots

1 messages · Page 411 of 1

full lily
#

so it's required here.

#

If you've got backslashes inside of ascii art, then the escape sequence will be invalid and will give an error. So you woul need a raw string to ignore the special meaning of the backslash

#

but yes, what's inside of the quotes is a string. You can use single or double quotes. Both give strings. For longer strings you can do a multiline string by putting three quotes in a row

"i am a string"

'i am a string'

"""
i am a string
"""

'''
i am a string
'''

i_am_probably_a_function()
print() # print is a function
#

so /033 would be the string
the whole string is "\033[03m"

unkempt galleon
#

would you input the r

full lily
#

It's highlighting part of the escape sequence, but the whole thing is a string

unkempt galleon
#

before the \

full lily
#

the r for a raw string always goes before the first quote of the string

unkempt galleon
#

r"\033[03m"

full lily
#

yes

#

but you don't want a raw string here I think. Are you sure the error is on this line?

unkempt galleon
#

2 errors

full lily
unkempt galleon
full lily
#

okay

unkempt galleon
#

i gotta leave in like 25 minutes for work anyway you could input it for me

#

os.system("clear && printf '\e[3J'")

unkempt galleon
full lily
#

so what do you think you have to do here?

unkempt galleon
#

i think i have to input a r before the string but i already tryed that and it didn't work

full lily
#

what did you change it to

unkempt galleon
#

i tryed that and this os.system("clear && printf r'\e[3J'")

full lily
#

and what was the error

unkempt galleon
#

same thing

full lily
#

can you send a screenshot

unkempt galleon
full lily
#

well

#

you have more than one error. The one we are talking about is fixed

unkempt galleon
full lily
#

no, i'm sorry I won't do it for you. Come back when you're back from work and surely someone will help you out. You can ping me and i'll come over if i'm online

unkempt galleon
fast osprey
#

I wonder what Boost Bot v3 does thonk

unkempt galleon
#

alright ill come bck later

full lily
#

So what happens when you encounter this the next time? Will you also have someone to do it for you then?

unkempt galleon
#

i just use the bots i don't code them

uncut pebble
#

still, bones isn't your personal debugger. He doesn't owe you anything and you're coming off kinda entitled to expect him to do it for you

unkempt galleon
#

it would be cool to understand it yes, but i have alot of other things going on in my life i don't have time to learn i have a kid and a family and job and a couple side hustles, i don't want to learn this respectfully i just need help fixing it for anybody who does want to help.

fast osprey
#

You want people to use skills they spent time acquiring for your benefit for free

unkempt galleon
#

its topicalchat/help bro like i think your smart you should know this

fast osprey
#

"Help" is a funny way of phrasing "free labor"

full lily
unkempt galleon
uncut pebble
#

Yeah we get that. It's just the way you're asking is kinda impolite and entitled

unkempt galleon
full lily
#

Anyway as I said, you're welcome to come back here if you still need help later

uncut pebble
unkempt galleon
uncut pebble
#

Help isn't the same as special treatment.

fast osprey
#

Do you wanna mow my lawn? For free? Even though I don't know you, I'm benefiting from it, and not doing the bare minimum to contribute?

unkempt galleon
#

i don't think they have to do it for me im asking only if they want too.

#

so i don't really get what your trying to say with this entitlement arguement.

uncut pebble
# unkempt galleon i don't think im entitled to have special treatment, lol i think someone has t...

He was helping you. You declined and asked straight up for the answer. He said he'd rather **help **you understand the issue and help you fix it. You declined and insisted multiple times for him to just fix it for you despite saying no. There's a line here that you're not understanding. Not to mention you said you had work soon and you're still sat here arguing over what help is vs entitlement when in reality you could've used this time to listen to bones and potentially have resolved the issue by now

#

with his help may I add

#

not just him fixing it for you

unkempt galleon
#

no matter how he explains it i probably would not understand

#

it would take hours and hours

#

it would save us both time if he just sent it himself that was my logic behind it

fast osprey
#

Then pay someone. That's how skilled labor works. If you can't put in the time to get the skill, even with people assisting that learning for free, pay up

unkempt galleon
#

No im not going to pay someone when i know there is people out there like myself, who wouldn't mind helping someone with a fix that i know you guys could fix it like 5 minutes or less

fast osprey
#

Then don't, just don't be surprised when people aren't lining up to do your work for you

unkempt galleon
#

i get you are mad that you spent years/months learning thats not my problem

fast osprey
#

I'm not sure what gave you that idea. Still waiting for you to mow my lawn

unkempt galleon
uncut pebble
unkempt galleon
#

vs mowing a lawn

#

yes i have to leave at 3:30

fast osprey
#

Shame, 25 minutes that could have been spent on the python tutorial

unkempt galleon
#

yea i really don't want to learn that i just wanted a simple fix and to be out of here but you guys are not kind souls unfortunately.

#

anyways have a good day too all of you.

fast osprey
#

Have a good one!

uncut pebble
unkempt galleon
#

and if he does not want to do that then okay not a problem

#

on too the next

uncut pebble
#

again, maybe one of them would've been willing if you didn't come off the way you did

#

either way have a good day at work

unkempt galleon
#

i don't see how that is rude

uncut pebble
#

Your actual comment was "i gotta leave in like 25 minutes for work anyway you could input it for me". Despite that, saying "please" on the end of things doesn't automatically make things super polite

unkempt galleon
uncut pebble
#

Cya hope it gets fixed soon

tender bobcat
#

Fair point but I don't think it's a nice idea to store them in memory of the code

fast osprey
#

why?

compact ivy
#

Hopefully easy problem with set_thumbnail on an embed with discord.py

Getting the following error:

DeletedEmbed.set_thumbnail(author_pfp)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
TypeError: Embed.set_thumbnail() takes 1 positional argument but 2 were given

author_url is a string with the url to the pfp of the message author.

Any idea what’s causing this? I have a feeling it’s because the function is getting passed with self as a parameter, but I’m not 100%

timber dragon
#

Needs url=

compact ivy
mint pecan
#

how long can channel.typing() last for?

woeful hill
#

Red color doesnt mean error, underline red is

#

That turn red just to indicate a raw string, making sure you know escape character will print as it is

#

And not escape the next one

rugged shadow
#

there is not a single day in this channel without drama

jaunty cape
timber dragon
tender bobcat
#

However you can use async with to make it as long as you are in the context manager

civic rivet
#

Hello

full lily
#

is it like uh. Channel id

#

ah .jump_url

tender bobcat
#

<#{id}> as well

burnt quiver
burnt quiver
simple vapor
#

gonna be dropping my first project soon, on github.. - fastapi backend with redis/postgres and discord bot (client/server)... so far its a lot of fun! gonna include some basic cogs and stuff 😄

#

gotta do some testing and shit though, not sure if i wanna add prometheus/opentel... Claude_Think

stark ingot
#

Nice!

nova hawk
#
import discord
from discord.ext import commands


intents = discord.Intents.default()
intents.guilds = True            
intents.message_content = True   
intents.messages = True


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

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name} - {bot.user.id}')
    print('------')

@bot.event
async def on_channel_create(channel):
    print(f'Channel created: {channel.name} (ID: {channel.id})')

    if isinstance(channel, discord.TextChannel):
        try:
            await channel.send(':white_check_mark: Hello! This is a new text channel.')
        except discord.Forbidden:
            print(f':warning: Missing permissions to send messages in {channel.name}')
        except Exception as e:
            print(f':x: Error sending message in {channel.name}: {e}')```

Does anyone know why this isn't working?
#

im not even getting an error

fast osprey
#

Expand on what "isn't working" means. What do you want to happen, and what is happening?

nova hawk
#

This is just a demo but i want to add an embed for tickets

Someone opens a ticket
the bot looks for the channel name starting with tickets
(I've already got that done in my other bot but this code snippet is just for testing)
the discord bot sends a message into the channel

fast osprey
#

You shouldn't be using channels for tickets

nova hawk
#
@bot.event
async def on_channel_create(channel):
    print(f"Channel created: {channel.name} (Type: {type(channel)})")
    if isinstance(channel, discord.TextChannel) and channel.name.startswith("ticket-"):
        embed = discord.Embed(
            title="🎫 Ticket Created",
            description="Thank you for reaching out! Our support team will assist you shortly.",
            color=discord.Color.green()
        )
        embed.set_footer(text="Please keep this channel open until your issue is resolved.")
        
        try:
            await channel.send(embed=embed)
            print(f"Embed sent to {channel.name}")
        except discord.Forbidden:
            print(f"Missing permissions to send in {channel.name}")
        except Exception as e:
            print(f"Error sending embed: {e}")

This is the actual code, but i just used that since it was shorter and just for testing

fast osprey
#

use threads

nova hawk
#

i don't like threads, anyways it's besides the point, i'm not even getting any errors

#

the bot doesn't say anything

#

No errors

fast osprey
#

it's not really besides the point when this isn't what channels are made for

#

channels are for persistent conversations, not to be spun up and down constantly

nova hawk
#

Are you going to try and help or just start talking about channels and threads

fast osprey
#

That said, what is leading you to believe that on_channel_create is an event?

nova hawk
#

i thought that's what i'd be

fast osprey
#

and pointing you towards the correct answer is helping, even if that's not what you want

#

well the library doesn't read your mind and name events how you think they should be named

nova hawk
#

🤦‍♂️, could you help me please?

#

what would it be then

fast osprey
#

I'd recommend reading the docs for the library you're using, the answer will be there

nova hawk
#

do you know and your just not telling me?

fast osprey
#

yes

stark ingot
#

what library are you using?

fast osprey
#

well, I don't know what library you're using

nova hawk
#

like version?

fast osprey
#

no, the library

#

there are several discord libraries written in python

stark ingot
#

Library + version is helpful

nova hawk
#

How do i find out what library i'm on c

fast osprey
#

You installed it

nova hawk
#

probably like 4 years ago

stark ingot
#

That is something you should probably know if you are trying to develop with it...
But you can run pip list to see all libraries installed

nova hawk
#

Name: discord.py
Version: 2.5.2
Summary: A Python wrapper for the Discord API
Home-page:
Author: Rapptz
Author-email:
License: The MIT License (MIT)

discord 1.7.3
discord.py 2.5.2

fast osprey
#

d.py 2.5.2 was released in march

nova hawk
#

yeah i updated it before i started asking for help

fast osprey
nova hawk
#

guild was all you had to say @fast osprey

#

thanks anyways

fast osprey
#

and that would not have taught you any self sufficiency

#

I have no responsibility to help you on your terms

fast osprey
#

Says the channel rate limits and lack of archival

young dagger
fast osprey
young dagger
fast osprey
#

Okay I mean I can point to a bot that fries it's own cpu that doesn't mean it's a good thing to do just because you can find people doing it

young dagger
fast osprey
#

I never said it had anything to do with system resources

#

I said using channels for temporary conversations is not only contrary to discord design it's functionally inferior

#

And you pointing at a bot that makes an inferior design decision doesnt change that

fast osprey
#

That doesn't mean it's not inferior

tender bobcat
#

Drama 24/7

timber dragon
#

"No drama thank you"

viscid hornet
#

come again soon

unkempt verge
#

I want a bot for my server that sends messages every 5 minutes, can anyone help me?

viscid hornet
tender bobcat
#

!rule 5
[Omitted]

unkempt canyonBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

azure tendon
#

if you feel there's a rule 5 problem, DM modmail please

#

don't paste blocks of text in

#

and also, a bot sending a message every 5 minutes is not inherently malicious, you have really jumped the gun on this one

tender bobcat
#

Oh ok,
I was just attempting to describe it sound like spamming which would violate ToS
Sorry for the text block

azure tendon
#

hell, we have bots in this community that send messages at an interval, and I can attest to them not being spam bots

#

in general, be cautious when trying to correct people for rule 5, it's easier to DM modmail and get a mod opinion

tender bobcat
#

Ok

fast osprey
#

As far as I can tell, there's nothing in the dev policy regarding this beyond respecting the published rate limits (which all modern libraries do for you under the hood). Whether or not users find it annoying is another story, but that's up to them

heavy tusk
#

i made a bot with temp channel and ban kick an timeout. i dont know what i can add

fast osprey
#

Are you looking for learning exercises or things that are actually useful that would convince someone to add your bot?

radiant shuttle
#

bot is working fine but it have one problem. after a time of running its like getting timed out
and sending this error
why is that happening


[2025-07-01 15:29:00] [ERROR   ] discord.ui.modal: Ignoring exception in modal <AutospinModal timeout=None children=1>:
Traceback (most recent call last):
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\ui\modal.py", line 189, in _scheduled_task
    await self.on_submit(interaction)
  File "C:\Users\pirat\Desktop\Roulette 1\python\cogs\slots.py", line 126, in on_submit
    await self.view._run_spin_step()
  File "C:\Users\pirat\Desktop\Roulette 1\python\cogs\slots.py", line 190, in _run_spin_step
    await self.message.edit(embed=embed)
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\interactions.py", line 1401, in edit
    res = await self._state._interaction.edit_original_response(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\interactions.py", line 557, in edit_original_response
    data = await adapter.edit_original_interaction_response(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\webhook\async_.py", line 226, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token
[2025-07-01 15:29:37] [ERROR   ] discord.ui.modal: Ignoring exception in modal <AutospinModal timeout=None children=1>:
Traceback (most recent call last):
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\ui\modal.py", line 189, in _scheduled_task
    await self.on_submit(interaction)


#
  File "C:\Users\pirat\Desktop\Roulette 1\python\cogs\slots.py", line 126, in on_submit
    await self.view._run_spin_step()
  File "C:\Users\pirat\Desktop\Roulette 1\python\cogs\slots.py", line 190, in _run_spin_step
    await self.message.edit(embed=embed)
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\interactions.py", line 1401, in edit
    res = await self._state._interaction.edit_original_response(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\interactions.py", line 557, in edit_original_response
    data = await adapter.edit_original_interaction_response(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pirat\Desktop\Roulette 1\python\.venv\Lib\site-packages\discord\webhook\async_.py", line 226, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token
[2025-07-01 16:28:38] [INFO    ] discord.gateway: Shard ID N
fast osprey
#

How is self.message set?

radiant shuttle
fast osprey
#

It's your code man

#

line 190 of slots.py is referencing something called self.message, you're setting that somewhere

#

My guess is that you're storing a single interactionmessage, which expires over time, when really if you want to edit a message off of an interaction you should be using that interaction rather than storing something

lone ice
#

anyone know how to make an auto claim system for ticket bot?

fast osprey
#

you're going to have to elaborate what "auto claim" means, and what "ticket bot" is

lone ice
#

or can anyone help me word out waht i mean

radiant shuttle
# fast osprey My guess is that you're storing a single interactionmessage, which expires over ...
    class SlotView(discord.ui.View):
        def __init__(self, cog: commands.Cog, author: discord.User):
            super().__init__(timeout=None)
            self.cog = cog
            self.author = author
            self.bet = 0
            self.message: discord.Message | None = None
            self._timeout_task: asyncio.Task | None = None
            self._stop_autospin = False

        async def _start_timer(self):
            if self._timeout_task:
                self._timeout_task.cancel()
            self._timeout_task = asyncio.create_task(self._timer())

        async def _timer(self):
            try:
                await asyncio.sleep(60)
                await self.on_timeout()
            except asyncio.CancelledError:
                return

        async def on_timeout(self):
            for c in self.children:
                c.disabled = True
            embed = self.message.embeds[0]
            embed.add_field(name="", value="`☑️This session is completed`", inline=False)
            await self.message.edit(embed=embed, view=self)
            await self.message.channel.send(
                f"`⏹️` {self.author.mention}, `your slot session ended due to inactivity.`"
            )
            self.cog.active_games.pop(self.author.id, None)
fast osprey
#

What sets it?

#

You're initializing it to none but nothing is actually setting it

lone ice
#

i want a bot that can automatically say /claim whenever a ticket is opened

fast osprey
#

Bots can't perform interactions

lone ice
#

they cant perfom actions for me?

#

i got it wrong idk wat its called

fast osprey
#

they cannot run slash commands, they cannot click ui buttons

tender bobcat
#

No, a bot cannot run a slash command and cannot act on behalf of you

#

They operate in a special bot account in a limited way

fast osprey
#

If you want to interact with another bot using your bot, you should contact the owners of this other bot and establish an API you can use

tender bobcat
#

Or special way if you want to call it such way

lone ice
#

this is an example

quick gust
#

Yea that's against the ToS lol

lone ice
#

oh it is?

tender bobcat
#

It is call self botting

lone ice
#

i mean like the panel thing, is an example

quick gust
#

Yes, it'd be pretty strange if it wasn't, dont you think?

radiant shuttle
fast osprey
#

If the owners of this bot wanted you to interact with it in a certain way, they would create an API for doing so

lone ice
fast osprey
tender bobcat
#

Basically
Do you own the ticket bot?
If yes => Ok it's possible to implement it
No => Contact the bot owner for a specific special way to access it

lone ice
fast osprey
#

Bots cannot perform interactions, or "make" your account do something

#

Anyways this sounds contrary to the spirit of what this other bot is doing

tender bobcat
lone ice
fast osprey
#

If they wanted you to be able to auto subscribe to things, they would give you a mechanism for doing that. Contact them

radiant shuttle
lone ice
#

its like. i want a system where i can automatically send a message in a channel of my choice (in a nutshell)

fast osprey
lone ice
#

for exampple, some scammers or whatevre they do. they sned messages in a discord server, and whoever dms them gets automatically sent a message

tender bobcat
#

Again, bot cannot run slash command, bot mostly ignore command like messages from other bot, bot cannot click on UI components and bot cannot act on behalf of you

fast osprey
lone ice
tender bobcat
fast osprey
#

what the heck is a panel

lone ice
quick gust
#

I assume they're talking about running a script on their terminal that will do stuff from their account lol

fast osprey
quick gust
#

Again, that's against the ToS

lone ice
#

i see

fast osprey
#

Whether it's a panel or a script or whatever, automation has to act through a bot account

#

you cannot have any programmatic process running through a user account

lone ice
fast osprey
#

well that thing is against tos

tender bobcat
# lone ice 3rd party systems?

Discord doesn't allow 3rd party system unless the server specifically invited the bot that send the message to the user

And again, bot would ignore message command from other bot in most case, and bot cannot run slash command or click UI component, and cannot act on your behalf

quick gust
#

There's a 99% chance its also malware

lone ice
#

so its impossible for me to get wat im requesting?

tender bobcat
#

It is impossible without violating ToS or being allowed to do so by the bot owner

quick gust
#

Its not possible to do it without breaking the ToS.
Breaking the ToS can get your account banned and you'll also get no help with it in most of the places

tender bobcat
#

If the ticket bot owner allows you to do so, they can provide a API that doesn't go through Discord

lone ice
#

thanks for your support guys really appreciate it

quick gust
#

No worries, and please don't run random code downloaded from the internet

fast osprey
lone ice
#

virus total?

fast osprey
#

pro tip don't download anything from randos

radiant shuttle
fast osprey
#

the bot doesn't die

quick gust
#

Its common sense, don't run anything from anyone without knowing EXACTLY what you're doing

lone ice
lone ice
#

or skidded

#

wait

#

@quick gust what if i use ahk and get someone to script me a macro, and with that macro, it goes into the channel and claims the ticket for me

#

that possible?

woeful hill
#

it is still self botting

lone ice
#

but its possible?

quick gust
#

You're better off not testing the waters with this one

lone ice
#

i see

#

wat are the risks of using ahk

quick gust
#

I don't even know what that is

lone ice
#

auto hot key

radiant shuttle
fast osprey
#

bro. This isn't complicated

#

don't do shit they don't want you to do

woeful hill
#

^ the main point is not whether it is or isnt possible

fast osprey
viscid hornet
quick gust
#

"without knowing exactly what you're doing"

#

There's a lot of precautions you have to take before trying to pry into possible malware, things which a script kiddie won't be aware of

fast osprey
dapper ocean
#
class Extension(commands.Cog):
    group = app_commands.Group(name="extension")

    @group.command()
    async def run(self, itx) -> None:
        ...

Is there any other way in which I can achieve the same thing?

I thought of making a subclass of an app_commands.Group, putting command definitions in it and somehow registering it, is that possible in d.py?

Example:

class Extension(app_commands.Group):
    def __init__(self, ...) -> None:
        ...
 
    @app_commands.command()
    async def run(self, itx) -> None:
        ...
fast osprey
#

You can use GroupCog too

dapper ocean
#

hm looks good

#

I'll use that

#

ty

timber dragon
#

You cannot subclass Group and do it like that

dapper ocean
#

I have another question tho

#

I have a subclass of commands.Bot and my bot only supports application commands, can I somehow "disable" the prefix?

fast osprey
#

Id recommend still using prefix commands for owner only operations like syncing

dapper ocean
#

fair

fast osprey
#

But you can set the prefix to [] if you wanted

brittle marsh
#

Hello, today I created a bot on discord and I have a small problem. The slash commands are only shown to me when the bot is user install and is on the server. I can't use the bot when it's on the server without userinstall and I can't use it in dms

fast osprey
#

Code?

brittle marsh
# fast osprey Code?
@discord.app_commands.describe(user="The user whose avatar you want to see (optional).")
async def avatar(interaction: discord.Interaction, user: discord.User = None):
    if not await is_authorized(interaction):
        await interaction.response.send_message(embed=create_error_embed("You are not authorized to use this bot."), ephemeral=True)
        return
    target_user = user or interaction.user
    
    if not target_user.avatar:
        await interaction.response.send_message(embed=create_error_embed("This user does not have a custom avatar."), ephemeral=True)
        return

    embed = discord.Embed(title=f"{target_user.display_name}'s Avatar", color=COLORS['success'])
    embed.set_image(url=target_user.avatar.url)
    embed.set_footer(text=f"Requested by {interaction.user.display_name} • {BOT_NAME}", icon_url=BOT_ICON_URL)

    view = DownloadView(str(target_user.avatar.url))
    await interaction.response.send_message(embed=embed, view=view)
fast osprey
#

Do you have use app command privileges on that server? Do you have the app command scope on that server?

brittle marsh
#

yes I do

fast osprey
#

And the latter?

brittle marsh
#

?

#

what do you mean

fast osprey
#

I asked two questions

brittle marsh
#

I don't understand the second question

fast osprey
#

When you invite the bot, you select a set of scopes you request

#

If you invited it a while ago, you may not have asked for the app command scope

brittle marsh
#

It looks like this

#

I created the bot today

fast osprey
#

Do the commands show up if you go to the integration tab in server settings?

brittle marsh
#

no

fast osprey
brittle marsh
#

yeah I just fixed the problem on the server but it doesn't work on user install

#

the commands doens't show up

#

so what should I do

fast osprey
#

They're not user installable by default, at least in discord.py

vapid parcel
#

thoughts on the owner control panel?

#

uses select menus for everything related to cogs. Also allows you to select logs.

quick gust
#

Personal preference honestly, I don't like having too many buttons on one message. Feels cluttery

vapid parcel
#

Yeah thats fair

fast osprey
#

is this like an opensource bot you're giving to people?

quick gust
#

Its also not fantastic to have such vulnerable actions linked to a single button click, like the Shutdown button (unless you have a confirmation step)

vapid parcel
vapid parcel
#

and you have to be in a certain guild to see owner commands anyways

quick gust
#

No, I meant that you might accidentally click the button

vapid parcel
#

it has a confirm setp

#

step*

#

in the video it shows everything

quick gust
#

That's nice

vapid parcel
vapid parcel
#

Sends a notification for each thing done besides stuff that is non critical ofc

#

so it tells you when a person reloads a cog and who and you get the point lol

fast osprey
#

I mean if you are making a bot that you are operating, making a graphical control panel is complete overkill imo

#

you can just run commands

vapid parcel
#

rather have it all in once place lol

#

no point in me making multiple commands for 1 thing honestly

fast osprey
#

But you already have separate logic

quick gust
#

Wasn't making views more work?

vapid parcel
#

Yes, but I rather be able to just press a button vs run multiple commands

vapid parcel
quick gust
#

Valid

vapid parcel
#

and, we use it for other bots we make, so for any commision they are given this control panel to understand how to use things vs us giving them a tutorial on each cmd ig

fast osprey
#

yeah don't have strong opinions either way. Personally making stuff only one person would ever use (me) is on the absolute bottom of the list of the other things I could be doing

vapid parcel
#

not just me alone uses it, the whole team uses it

fast osprey
#

let me rephrase, something for less than 1% of my user base

vapid parcel
#

thats fair ofc

#

Idk, i just rather have it be easier to use a whole control panel vs understanding which cmd to run ig

#

as its all in one place ya know

fast osprey
#

looks fine though and I'd see the benefit if you were ever running multiple operations quickly (though by definition you're not chaining anything after a shutdown)

vapid parcel
#

shutdown is for if there is a major bug and its causing major issues, then we shutdown just incase

#

but that button has never been used

#

but it would only be used if someone pushed something bad to production on accident ofc

quick gust
#

Personally what I'd do for my bot is just make like 5 different commands, and mention them - along with a small description of what their logic entails (incase I forget) in another message.
It makes it easier for me to just click the mentioned command and run it, it's also pretty straightforward

vapid parcel
#

yeah that is fair

#

i mean, we all have our own opinions.

#

But I personally like the owner control-panel lol

stark ingot
# vapid parcel

How are we supposed to judge something that is not possible in discord?

vapid parcel
stark ingot
#

You don't appear to be using discord

vapid parcel
#

...

#

its just a theme.. but alright 😭

tender bobcat
# vapid parcel

Suggestion: Make all operation require to enter a 2fa code by implementing otp validation on the bot

vapid parcel
#
def is_owner() -> Callable[..., Any]:
    """A decorator for owner-only slash commands"""

    def decorator(
        func: Callable[P, Awaitable[Optional[T]]],
    ) -> Callable[P, Awaitable[Optional[T]]]:
        """A decorator for owner-only slash commands"""

        @functools.wraps(func)
        async def wrapper(*args: P.args, **kwargs: P.kwargs) -> Optional[T]:
            interaction: None | Interaction[Bot] = None

            for arg in args + tuple(kwargs.values()):
                if isinstance(arg, discord.Interaction):
                    interaction = arg
                    break

            if interaction and interaction.client.owner_ids:
                if interaction.user.id in interaction.client.owner_ids:
                    await func(*args, **kwargs)

                else:
                    embed = ErrorEmbed("This command is owner only!")
                    try:
                        await interaction.response.send_message(
                            embed=embed, ephemeral=True
                        )
                    except discord.InteractionResponded:
                        await interaction.followup.send(
                            embed=embed, ephemeral=True
                        )
            else:
                await func(*args, **kwargs)

        return wrapper

    return decorator```
#

You need to be in the owner_ids + be in the staff server to use any type of owner cmd.

tender bobcat
#

until your discord compromised and you add some more dangerous thing in it

vapid parcel
#

I see really no security risks in this way of doing things. Ofc I could remove the shutdown n restart buttons leaving no security risk but those are there for a reason.

tender bobcat
#

also log itself can be a security risk

#

current or future

vapid parcel
vapid parcel
#

nothing risky about that..

tender bobcat
#

And at some point you need to fix something and print some value that contain sensitive data

#

Or another logging framework that print out variable on error

vapid parcel
#

you don't just leave prints in production

tender bobcat
#

Oh yeah? How they run differently

vapid parcel
#

One is ran on a server, while dev is ran on your pc..?

#

meaning only you are testing it and the logs are via YOUR PC, not the server.

#

logs are ignored by .gitignore.

tender bobcat
vapid parcel
#

Then it would be an API key.

tender bobcat
vapid parcel
#

apis have a generate cmd for a reason 😭

vapid parcel
#

seems to not be that hard..

tender bobcat
#

it doesn't mean you cannot

#

it just mean you not encounter one

vapid parcel
#

and our databases are IP locked. So really no one can do muchn lol

tender bobcat
#

or you didn't notice

vapid parcel
#

I get notified when someone logs in

#

and yes thats via token and creds

#

I think ill be fine bro 😭

#

And it was to rate the feature, not to say what ifs.

tender bobcat
#

basically, logging is the main thing I concern about

#

since I literally saw discord bot token in log

#

and they doesn't even know

#

until I tell them

vapid parcel
#

Hold up... why would ANYONE log anything in the env?

tender bobcat
#

no they don't

vapid parcel
#

Why would logging do that? You would have to literally say it to log that

tender bobcat
#

well, people don't always use logging

vapid parcel
#

discord.py does not return the token unless you exactly log it yourself

#

well thats on them.

tender bobcat
#

in particular the person use loguru

vapid parcel
#

maybe use the correct things instead of random stuff lmao

tender bobcat
#

also its not random, it is pretty popular

vapid parcel
#

and on error we have something like this to show what error just happened in a bot, and it also gets logged in the log files so we can have it for later just incase we forget

vapid parcel
tender bobcat
#

it just provide the variable on error

#

to provide extra contexts for debug

vapid parcel
#

why would you use the variable outside of just starting the bot?

tender bobcat
#

which is why the token got into log

vapid parcel
#

please answer that...

tender bobcat
#

it print variable for the whole stacktrace

#

which include the frame that called bot.run

vapid parcel
#

why are you USING the BOT token in other files..? should only be ran in main.py or your startup file that starts the bot.

tender bobcat
#

it doesn't
it just print all variable in the whole stack trace related

vapid parcel
fast osprey
#

idk it sounds like you're overindexing on an example of someone doing something really dumb once. It's unclear what you're even suggesting at this point

tender bobcat
#

which is both debugging family, but danger in this case

vapid parcel
tender bobcat
#

not really because I also done something done something wrong multiple times

vapid parcel
#

we make sure we don't do something stupid in production.

fast osprey
#

what is the suggestion here? Don't ever emit/store any logs in the off chance that someone puts something dumb in them?

full lintel
#

?

vapid parcel
tender bobcat
#

adding more security than just pushing a button by the owner

full lintel
#

what r u guys talking about im crazy good with discord bots

vapid parcel
#
future: <Task finished name='discord-ui-view-timeout-9bfb7d429b5fee4f4556af328f436d7a' coro=<BaseView.on_timeout() done, defined at /home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py:67> exception=Warning('BaseView.message was not defined to disable the items.')>
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py", line 88, in on_timeout
    raise Warning(
Warning: BaseView.message was not defined to disable the items.
[2025-07-01 15:10:37] [ERROR] [asyncio:1833] Task exception was never retrieved
future: <Task finished name='discord-ui-view-timeout-db6959b9a61d11a81bebd823dceba484' coro=<BaseView.on_timeout() done, defined at /home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py:67> exception=Warning('BaseView.message was not defined to disable the items.')>
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py", line 88, in on_timeout
    raise Warning(
Warning: BaseView.message was not defined to disable the items.
[2025-07-01 15:10:42] [ERROR] [asyncio:1833] Task exception was never retrieved
future: <Task finished name='discord-ui-view-timeout-2af974b3d5cb1673703e3d645d30cf0e' coro=<BaseView.on_timeout() done, defined at /home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py:67> exception=Warning('BaseView.message was not defined to disable the items.')>
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py", line 88, in on_timeout
    raise Warning(
Warning: BaseView.message was not defined to disable the items.
[2025-07-01 15:10:55] [ERROR] [asyncio:1833] Task exception was never retrieved
future: <Task finished name='discord-ui-view-timeout-2c483808b57edb6dea7f4c8d05d92874' coro=<BaseView.on_timeout() done, defined at /home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py:67> exception=Warning('BaseView.message was not defined to disable the items.')>
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.12/site-packages/disckit/utils/ui.py", line 88, in on_timeout
    raise Warning(
Warning: BaseView.message was not defined to disable the items.```
#

personally, this is why we have bot logs

#

to view errors just incase, for example just like the one I sent.

red palm
#

whats the whole point of worrying about it when you VIEW/REQUEST the log goes to ONLY your dms only YOU/OWNER

vapid parcel
#

the point you are making is not very valid

#

just dont log env keys n stuff..

#

The only thing I can POSSIBLY see happening is if you log an error that uses an API and it returns the authorization header

#

I see no possible way of getting a discords bot token via logs if it isn't logging that

fast osprey
#

if someone with control over the code is that malicious/grossly incompetent, there's a lot worse they could do at that point

vapid parcel
red palm
#

and if someone was to "token log" the owner they would have access to dev portal

vapid parcel
#

And the production token is only visible to me or people access to the panel, which is 2 people. So figuring out who did it would be easy because pelican logs who does it.

#

if you know how to manage a group and understand production vs dev, you would know what you are saying is very invalid.

#

You think big companies like Microsoft and Call Of Duty doesn't use log files..? You would be wrong in that.

tender bobcat
#

When tf I say not use log file 🥴

fast osprey
#

Very large companies also constantly run static analysis on code commits and have pretty strong compartmentalization of code (and prevent people from committing to locked files without hefty reviews)

vapid parcel
tender bobcat
#

No, I say prevent it to be easily accessible

vapid parcel
#

............

tender bobcat
#

Not remove log file entirely

vapid parcel
#

easy..? Okay so being on the owner list and then being in the guild where owner cmds are is easy...?

#

if thats easy, go ahead do it dawg 😭

#

ion see how thats easy to access, you have to be allowed to use those cmds and stuff. I REALLY dont see how EASY that is

tender bobcat
#

Well, I come from a stand point that you cannot trust a singular thing
But maybe that's too extreme? Well

vapid parcel
#

I think security is very okay on my end.

#

but if you do manage it, lmk 😭

tender bobcat
#

Theoretical attack method:

  1. Somehow compromised the discord account of the owner
  2. Wait for the team to use other logging framework because insufficient debug information
    After that: Sneak in and get some sensitivity information

Step 2 would usually be tended towards as time progresses and the team try some new things
Which therefore you trust only 1 thing, the discord account not get compromised

Which that's my whole idea

#

It may not be token but could be other things that you didn't know it got printed

vapid parcel
tender bobcat
#

It doesn't mean I would do it, I don't know cyber security that much

vapid parcel
#

its clear that you don't

red palm
vapid parcel
#

I am in cyber security, clearly you don't know much about cyber security 😭

tender bobcat
vapid parcel
vapid parcel
#

define CVE?

red palm
#

buddy

tender bobcat
#

Like, a vulnerability in some application you used

vapid parcel
#

ah yes

tender bobcat
vapid parcel
#

discord, the billion dollar company pushing a CVE vuln to production

tender bobcat
vapid parcel
#

seems like that has happened before (pretty sure its happened many times lmao)

red palm
vapid parcel
#

ONG its not

tender bobcat
#

So therefore if an application have a arbitrary file read access, it could leak the token of the user

vapid parcel
#

yeah

#

thats a WHAT IF btw.

#

not a RATE MY FEATURE in discord.

#

you are playing what if cards like crazy. What if the world blew up tmr? No one would remember the damn token.

#

Anyone can play WHAT IFs all day.

tender bobcat
#

And would you imagine Microsoft Team have zero click RCE in 2020? It is absolutely possible

vapid parcel
#

Switching topics to another company about NOTHING we are on is crazy

#

microsoft is a bad company, we have known this right?

tender bobcat
#

I was just trying to demonstrate an example that other applications we are using now could just have vulnerability to read file?

#

But just discord ...

vapid parcel
#

What if someone leaked your Spotify account creds right?? Omg, thats a issue on YOU. Cuz spotify has many issues like no 2fa n stuff

#

they have 2fa, but email wise

#

email 2fa is the worst lmao

#

But we all understand your what ifs. But no disrespect to you, none of that would happen to me personally.

tender bobcat
#

And yep I am done now
It's fine if you think it doesn't get attack this way but hope you acknowledge this very well exist:
Trusting your computer doesn't have program that arbitrary read file due to vulnerability or other reason

vapid parcel
#

and thats why you u use linux.

red palm
#

nobody is saying it ISNT gonna happen we are just saying we try our best to PREVENT it

vapid parcel
#

problem solved baby.

tender bobcat
vapid parcel
#

rage baiting in the big 25, little 26, mini 27 is crazy bro

tender bobcat
vapid parcel
#

Well, if I have never been hacked for 7+ years

#

I think ive been doing it right for so long.. now ofc someone could figure OUT how to but thats a lot of work to just steal a DISCORD BOT TOKEN.

tender bobcat
#

Well, I said I am done so I am not saying any what if related

vapid parcel
#

i think they would be after a credit card or something useful instead of a DISCORD BOT TOKEN

red palm
#

sooooo hows everyones day

simple vapor
#

Yo, I'm making a bot + api. I'm working with redis and Postgres... how often do you guys think I should update non critical data? I am doing batch updates every 60 seconds, if any are in the queue. I collect the data via discord events. I'm not sure if this is the best way to do it.

viscid hornet
simple vapor
viscid hornet
#

i think it should be fine

#

you could do once every 10 minutes

#

or once an hour

#

depending on how often you look at this

simple vapor
#

Yeah I don't want data that's too old though. I may update every 10-15 commands that person uses, a db connection every command is fucked too

#

Or maybe I'll write to redis and then backup to the db

#

I'm not sure I haven't decided yet. It's hard

#

I'm building a dashboard with fastapi, basically a web client for the bot so I can chat and shit too

#

Gonna do levels and stuff too, so if they GET /user/{discord_id} ideally its not an hour old, but I guess write through cache would work with that

#

You know what I'll do? I'm not sure why I didn't think of that first.

I'll just do write through cache for on demand stuff and auto update every hour or whatever

#

Talking to you helped me so thank you

viscid hornet
#

i think one insert operation on sqlite was like, 1e-5s

#

(obviously that can vary but not by much)

fast osprey
#

One thing I'll say is that you shouldn't base design decisions on vibes like "oh that many writes feels bad". If you're not running into material problems doing something, that's often a sign you're doing preemptive optimization. Databases are designed specifically to support extremely concurrent reads/writes

viscid hornet
tender bobcat
#

*In most case

rapid pawn
#

hey I'm new to python and I made a bot and running it on replit but it always goes off after some time so is there a way to keep it running and don't go down
I tried "uptime robot monitors* but these "incidents* always occur so I'm looking for a way to keep it running and also if there are any other sites that can run the bot for long time tell me plz

stark ingot
#

Replit is not a hosting site, you used to be able to get around this but it does not work anymore. If you want your bot to always be online you will have to find a proper hosting solution or selfhost

regal venture
stark ingot
#

Do any of those not use shared ips?

regal venture
#

They give you a free server to run your code on it 24/7

#

The last two they use petrodycel game server management

regal venture
fast osprey
#

If you're not paying these services, how do you think they're keeping the lights on? Out of the kindness of their heart?

stark ingot
regal venture
regal venture
#

No it's special ips

#

And ports

vale pendant
#

last time i created a bot i was using python 3.8, should i switch to 3.10 or is there not much of a difference?

stark ingot
#

3.8 is eol. You should use at least 3.12. no point in upgrading only part way. Depending on what library you use it might not support 3.8 in the next update.

regal venture
timber dragon
#

probably Python // Pycord

fast osprey
# regal venture They have premium service

And you think the people paying for premium are enough to subsidize people eternally staying on a functional free tier? What does the business have to gain by letting people stay free forever?

regal venture
#

And it's not free fully

fast osprey
#

If you don't know that means there's something else going on

#

you are the product

regal venture
#

It's like you need to gather coins

#

Bro

#

Noone is the prodcut

#

They are getting profit from the ads

fast osprey
#

How much money do you think you watching an ad as one person generates

regal venture
#

And you need afk in the page to gather coins and make your server alive

merry cliff
#

cents

fast osprey
#

Think critically about this for a few minutes

regal venture
timber dragon
#

Poor human, too young or delusional to understand.

fast osprey
#

The point is that they don't, they try to make it look like they are

merry cliff
#

I'm an enjoyer of oracle free tier

fast osprey
#

They will either frustrate you by giving you nonfunctional service at some point to coerce you into paying, sell your data, or both

merry cliff
#

wuh woh

regal venture
#

Or use them

merry cliff
#

admin mod is here

regal venture
merry cliff
#

godlygeek was typing

fast osprey
#

I don't need to try them. This is incredibly simple economics

merry cliff
#

they are always watching 👁‍🗨

fast osprey
#

People don't give you a free service at a loss out of the kindness of their hearts

regal venture
merry cliff
regal venture
#

And it's not free fully

glacial sail
#

!warn 1311690314632921153 That's not how we talk to people here. Give our #code-of-conduct another read.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @regal venture.

regal venture
#

Why

merry cliff
#

he can see what u edited it from

regal venture
#

He said I'm young

#

To understand

timber dragon
#

That is not a bad thing

regal venture
#

Soheab where you from

merry cliff
#

a lack of experience is not an insult

timber dragon
#

Why does that matter and you're getting off topic

regal venture
#

I'm curious

timber dragon
merry cliff
fast osprey
regal venture
merry cliff
#

oke

rapid pawn
fast osprey
#

Skips over the entire conversation of why free hosts are by definition scams

grave sandal
#

It looks like vercel offers serverless stuff that will spin up your application whenever a request comes in something. Not container hosting and not running the bot all of the time and probably not dealing with websockets.

rapid pawn
grave sandal
regal venture
grave sandal
rapid pawn
fast osprey
#

Cloudflare isn't a host?

regal venture
rapid pawn
regal venture
grave sandal
# fast osprey Cloudflare isn't a host?

And vercel isn't a host in the same sense as a VPS one. If I am not mistaken these types of containers are very fast to spin up and only execute some of the time.

fast osprey
#

Lambda style services are an entirely different ballgame yeah

#

But given they're not even trying to do anything with discord kind of a moot conversation in this channel anyways

rapid pawn
#

so now what are sites or apps that can run the bot 24/7 (free)

fast osprey
#

This isn't a telegram bot channel

rapid pawn
#

OK where is the channel

fast osprey
#

For general hosting advice which may or may not be applicable for you:

#

!hosting

unkempt canyonBOT
#
Discord Bot Hosting

Using free hosting options like repl.it for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.

See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.

You may also use #965291480992321536 to discuss different discord bot hosting options.

stark ingot
regal venture
stark ingot
#

Yes

regal venture
#

Okay

stark ingot
#

Although sometime in the future it won't be

quick gust
#

What does that mean?

timber dragon
#

Pycord v3 is supposed to be a full rewrite

tender bobcat
#

I just hope they would finally move away from the discord name

gleaming inlet
slate swan
#

Hi, I need help with this one CODE, I'm trying to write code for a ticket bot on my Discord server and I don't quite understand what's going on.

slate swan
#

I don't currently have any code.

stark ingot
#

Then what dont you understand?

slate swan
#

everything

slate swan
stark ingot
#

Then that is where you should start before trying to make a discord bot. You need at least a good understanding of the basics before you can be successful making a bot.

#

!res
-# No slash command moment

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.

stark ingot
#

This has some good resources for just starting out

slate swan
stark ingot
#

Well, you need code to make commands. And if you dont know how to code that may be difficult

#

Making the bot account and adding it to the server is a tiny step in the development process

slate swan
slate swan
# unkempt canyon

And which one should I choose because I'm not really good at English?

#

@stark ingot

stark ingot
#

I started with "automate the boring stuff" but I dont know what the best one for people who do not know english well is.

slate swan
#

yhm

#

It means I know English, but some words I don't know I put into a translator.

simple vapor
#

@slate swan learn some English before trying to ask for help

stark ingot
#

That is just rude. If you have to throw a few words into a translator here and there it is fine.

celest pelican
simple vapor
#

Look at how he's talking

#

Look at his username too

celest pelican
simple vapor
#

Help him set up how to make the bot then

#

Entertain his troll

celest pelican
simple vapor
drifting arrow
#

:D

slate swan
#

Can someone give me any code?

gleaming inlet
slate swan
#

And what about the bigger ones?

gleaming inlet
slate swan
#

I do not understand what is written there.

gleaming inlet
#

There's also Youtube videos available (with caption translated) https://youtu.be/YD_N6Ffoojw?si=v9ugbi6AlX3fuTwo

👉 Try Junie, smart coding agent: https://jb.gg/try-junie
👉 Check out PyCharm, the only Python IDE you need: https://jb.gg/check-pycharm-ide
👉 Free 3-Month Personal Subscription for PyCharm Pro with “PyCharmByTim“: https://jb.gg/redeem-code-pc

In this video, I'll be showing you
how to build a custom discord bot using Python. This ...

▶ Play video
gleaming inlet
fast osprey
#

I have yet to see a YouTube "tutorial" that isn't complete ass

fast osprey
#

Strongly suggest you don't use that as a reference

slate swan
#

What can I do if I have something like this?

fast osprey
slate swan
#

what?

fast osprey
#

That's a tiny image with two yellow lines

slate swan
#

Can someone help me with something like this, at least explain what it is that I'm getting an error about?

fast osprey
#

If you could paste your error here that would be a start

slate swan
#

import** discord**
from **discord.ext **import commands
import logging
from dotenv import load_dotenv
import os
This is highlighted in yellow for me...
Those three words underlined in bold are giving me an error

fast osprey
#

What is the error

slate swan
#

And that's the problem because it doesn't show me any error in the terminal

fast osprey
#

If there's no error then what's the problem

slate swan
#

I don't want to turn on the bot on discord

fast osprey
#

Squiggles don't mean anything

#

Run your code and get an actual error

slate swan
#

I keep writing this and it doesn't want to load (turn on)

fast osprey
slate swan
#

Code

fast osprey
#

...

slate swan
#

code bot

fast osprey
#

Send the contents of that file

#

If there are any tokens in it, remove them

gleaming inlet
unkempt canyonBOT
#

Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.

gleaming inlet
#

OK so its not config.py. Its called main.py. Run py main.py in your terminal

slate swan
fast osprey
#

Have you written anything in python before? Have you run a file on your own?

gleaming inlet
gleaming inlet
slate swan
#

Hi

fast osprey
#

It's a yes or no question

slate swan
fast osprey
#

Okay, but you're trying to run a file called config.py but you're sending us a different file called main.py

slate swan
#

yes

fast osprey
#

Do you not see the problem with that

slate swan
# slate swan yes

Because it's from the movie https://www.youtube.com/watch?v=YD_N6Ffoojw

👉 Try Junie, smart coding agent: https://jb.gg/try-junie
👉 Check out PyCharm, the only Python IDE you need: https://jb.gg/check-pycharm-ide
👉 Free 3-Month Personal Subscription for PyCharm Pro with “PyCharmByTim“: https://jb.gg/redeem-code-pc

In this video, I'll be showing you
how to build a custom discord bot using Python. This ...

▶ Play video
fast osprey
slate swan
#

I can't send my file

#

@fast osprey

#

help me

gleaming inlet
gleaming inlet
slate swan
gleaming inlet
gleaming inlet
slate swan
#

nothing

fast osprey
#

If you don't have experience writing and running python via smaller projects, trying to make a discord bot will be a massive drain of your time and the people trying to help you. They are complex things that draw upon several core concepts. It's recommended you follow day 1 python exercises first

slate swan
#

I've already done the tests and they came out positive 🙂 so I don't know, I just understand everything but I don't know why the bot doesn't want to turn on!

gleaming inlet
# slate swan nothing

Something like pip install the modules are considered very basic. Please. I urge you to please learn the basics properly.

slate swan
#

I'm starting to get a headache from the guides that are available in our country XD

fast osprey
#

Are you looking at basic python resources or trying to skip ahead to making a bot

gleaming inlet
slate swan
#

Thank you

jaunty cape
main idol
jaunty cape
#

you don't put anything there other than config, the thing that actually runs stuff is always in main

main idol
jaunty cape
#

idk, either way you don't run something you call config.py

main idol
jaunty cape
main idol
jaunty cape
main idol
jaunty cape
#

idk what he was thinking, but i just called mine globals.py

main idol
#

show the code please

jaunty cape
main idol
#

I just use a .env and a db with sqlite

jaunty cape
#
from typing import Dict, Final, Any

import toml
from ..roblox import Client

config: Dict[str, Any] = toml.load("conf.toml")

DATABASE: Final[str] = config["database"]["file"]

BOT_TOKEN: Final[str] = config["bot"]["token"]
PREFIX: Final[str] = config["bot"]["prefix"]

TRACKER_CHANNEL_ID: Final[int] = config["discord"]["tracker_channel"]
AUTHENTICATION: Final[int] = config["discord"]["authentication_role"]
EXALTED: Final[int] = config["discord"]["exalted"]  
CHAT: Final[int] = config["discord"]["chat"]

PASSWORD: Final[str] = config["computer"]["password"]
NAME: Final[str] = config["computer"]["name"]
SUBSTITUTION: Final[str] = config["computer"]["sub"]

AUTOSTART_PATH: Final[str] = config["autostart"]["path"]
AUTOSTART_TEXT: Final[str] = config["autostart"]["text"]  

PREFERRED_FONT_PATH: Final[str] = config["fonts"]["preferred"]


class CurrentGroupID:
    current_group_id = -1  # Default to -1 (Stray Users)

    @classmethod
    def set_group_id(cls, group_id: int):
        cls.current_group_id = group_id


roblox_client = Client()

so it ended up being too long so i removed every docstring and comment lmao

fast osprey
#

There's like 50 ways/formats of doing static config and it really doesn't matter which one you choose

jaunty cape
#

yeah sounds about right

quick mica
#

I’m really bored, anyone want a free discord bot all you need to do is host it

sacred wind
#

why doesn't the bot start? what is the problem

(token hidden)

hybrid marten
sacred wind
#

a very strange mistake. because everything used to run, but now it doesn't

hybrid marten
#

maybe the bot permissions?

#

in case you havent done it

sacred wind
#

in any case, the bot should change its status to online. And I have nothing going on.

fast osprey
#

what's the full traceback? In text

stark ingot
#

Are you sure you want OAuth code grant on (unlikely to be related to your issue)

sacred wind
stark ingot
#

You should stop showing your token, even if it is only part of it. A token is not completely random so a skilled attacker might be able to piece together public information and the snippets you send to get a full token.

sacred wind
#

I'll change the token. I came here to find out the reason for my mistake.

stark ingot
#

Also your full token is in the file you provided

sacred wind
#

I changed my token a long time ago.

#

I would like to sort out my problem.

stark ingot
#

I have not seen that error before, I would make sure that you have the latest version of the library you use and ask in that libraries support server for futher guidence.

fast osprey
stark ingot
#

they did but delted it because it contained their token

stark ingot
unkempt canyonBOT
stark ingot
#

Looks to be latest stable release, idk then, the error did not have much to go off of

sacred wind
#

I must have made some kind of mistake. Because after downloading the old version of discord python, the error is the same.

#

2.5.0 (((

fast osprey
#

what is the error

sacred wind
#

the bot does not start

fast osprey
#

Copy the full traceback, remove any tokens, paste it here

sacred wind
#

okey

brazen raft
# sacred wind

You should really use a virtual environment. Helps decluttering the global installs and isolate specific projects from global installs (maybe there's an import conflict causing incorrect modules to be used)

fast osprey
#

The fact you have discord, discord.py, and disnake is not good

brazen raft
#

Yeah discord should never be installed and often gets conflicted with discord.py

#

Not sure about disnake but at this point it's time for virtual environments

#

To each project their own dependencies

sacred wind
#

I think it's worth deleting everything and downloading the libraries again.

sacred wind
#

Okay, thanks a lot. I will definitely try it.

rocky plume
#

guys, how do i fix ModuleNotFoundError: No module named ‘cgi’

burnt quiver
#

install it?

merry cliff
#

it got removed

#

!pypi legacy-cgi

unkempt canyonBOT
#

Fork of the standard library cgi and cgitb modules removed in Python 3.13

Released on <t:1743036536:D>.

merry cliff
vale scarab
#

Hi, everytime I try to download the discord.py library this is what it says, anyone know how to fix that ? (I tried to repair and downloading the most recent version of python but the same thing is happening.)

tender bobcat
#

Go to your environment variable

#

You might have ran some tutorial that do TLS Decryption for e.g. Wireshark

#

And didn't do it properly

#

Which have dangling record that causing conflict

tender bobcat
#

Back to help post

vale scarab
#

'kay

stark ingot
#

Do the bots need to communicate in any way? If not then it is just unnecessary

fast osprey
#

Why?

young dagger
#

So a troll bot interesting rooThink

fast osprey
#

If you're exceeding 100 commands you've got way bigger issues

stark ingot
#

Sure, but if they are 3 separate bots why do you need to run them as one

#

Any good VPS should allow you to run multiple separate bots

young dagger
#

What are the stats based on? @slate swan

#

74% do you get a specific role for that?

tender bobcat
#

Not a good idea imo

slate swift
#

does anyone know why my stuff isnt getting sent to validusers.txt it makes no sense

#
    global valid, invalid, checked
    valid = invalid = checked = 0

    clear()
    log("=== Username Checker ===", "cyan")
    
    proxies = load_proxies()
    
    if not proxies:
        log("❌ No proxies found in proxies.txt", "red")
        return

    print("Select a pattern to generate usernames:")
    for key, (desc, gen_fn) in patterns.items():
        example1 = gen_fn()
        example2 = gen_fn()
        print(f"{key}. {desc}  (e.g. {example1}, {example2})")
    
    choice = input("\nEnter your choice: ").strip()
    
    if choice in patterns:
        _, gen_fn = patterns[choice]
        num = int(input("How many usernames to check? "))
        usernames = [gen_fn() for _ in range(num)]
    else:
        log("❌ Invalid option.", "red")
        return
    
    thread_count = input("> Threads to use (e.g. 50): ").strip()
    if not thread_count.isdigit():
        log("❌ Invalid thread number.", "red")
        return
    max_threads = int(thread_count)
    

    open("validusers.txt", "a").close()

    log(f"🔍 Checking {len(usernames)} usernames with {max_threads} threads...", "cyan")

    results = {"valid": [], "invalid": []}
    
    with ThreadPoolExecutor(max_workers=max_threads) as executor:
        futures = [executor.submit(check_username, username, proxies, results) for username in usernames]
        for future in as_completed(futures):
            pass

    valid = len(results["valid"])
    invalid = len(results["invalid"])

    log(f"[DEBUG] Valid usernames collected: {results['valid']}", "cyan")
    
    
    if results["valid"]:
        with lock:
            with open("validusers.txt", "a") as f:
                f.write("\n".join(results["valid"]) + "\n")  # Add newline after each batch

    log(f"\n✔ Done! Valid: {valid} | Invalid: {invalid}", "green")
    input("Press Enter to continue...")```
#

@slate swan

tender bobcat
slate swift
#

lol

tender bobcat
#

Also sound like ToS violation pithink

slate swift
#

so is anyone going to help

fast osprey
#

Want to explain what the use case is for generating usernames

tender bobcat
#

I mean technically just using proxy to do this would be attempt to circumvent API limit which would violate the Developer Policypithink

gleaming inlet
errant thunder
#

hello

#

`C:Users\Vxnge>$ source bot-env/bin/activate
'$' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Vxnge>$ pip install -U discord.py
'$' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Vxnge>$ cd your-bot-source
'$' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Vxnge>$ python3 -m venv bot-env
'$' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Vxnge>$ bot-env\Scripts\activate.bat
'$' is not recognized as an internal or external command,
operable program or batch file.`

drifting arrow
drifting arrow
#

you tried 5 times and got the same error. Try it a different way.

tender bobcat
#

It just telling you it is a shell command

#

You don't put the $ when you type it

errant thunder
#

let me try it

#

idk where my python path is

errant thunder
#

wait might be dumb

drifting arrow
#

All I know is that the definition of insanity is trying the same thing over and over again ad expecting a different result.

drifting arrow
#

I use VScode but you can use whatever editor you want.

merry cliff
errant thunder
#

nvm

tender bobcat
#

Also I don't see you digest any information on it but just copy and pasting

#

There are a lot of think there that is placeholder that you should change to the name you picked

#

Also, you shouldn't do a discord bot as your first project if you don't have the understanding on how basic things work

errant thunder
#

just got python

tender bobcat
#

!res have some read

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.

tender bobcat
#

And digest it

slate swift
gleaming inlet
slate swift
slate swift
gleaming inlet
#

Do it after you run your script

mint pecan
#

can bot.change_presence ratelimit me if i repeatedly use it?

woeful hill
#

Any of the api call can ratelimit you

#

If you abuse it

fast osprey
#

statuses are meant to report the status of your bot, which is not something that changes frequently

#

not to humblebrag about your user base like a lot of people do

coral plover
#

bots wow

uneven echo
#

can i ask, im trying to learn how to make discord bot and im wondering how do you make it so that the text is on top of itself, rather than a one long line
(like
this)

#

i want to make it look like a list

#

also, was checking code of some bots, what does "\n" mean

#

nwn i found out

radiant shuttle
#

how can i avoid the bot is thinking ephemeral message ?

fast osprey
#

By responding with a message

#

rather than deferring

radiant shuttle
#

yes but if i spam 5 commands for example it will send 5 messages

fast osprey
#

Yes, which is the point

#

you are expected to respond per command invocation

radiant shuttle
#

yes but my chat will be full with 5 different messages

quick gust
#

Not if it's ephemeral

radiant shuttle
quick gust
#

Well, that's to be expected if you're running 5 commands, expect 5 responses

radiant shuttle
#

ok got it

fast osprey
#

If you find yourself spamming commands, that might be a sign you should redesign your flow

uneven echo
#

is there any way of making a list that i can freely add stuff to, that isnt hardcoding, for example, i want to add more items to a list, but i dont want to hardcode every single one of them

woeful hill
#

depends on what kind of data in the list

slate swan
#

hey

#

i run code but on_ready message is never printed and bot is not responding to commands

#

2025-07-07 19:20:01 INFO discord.client logging in using static token
[2025-07-07 19:20:01] INFO: logging in using static token
2025-07-07 19:20:02 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 4de92d7fce0702d4fcc408742f3b4a5f).
[2025-07-07 19:20:02] INFO: Shard ID None has connected to Gateway (Session ID: 4de92d7fce0702d4fcc408742f3b4a5f).

#

thats all that pops up

fast osprey
#

Code?

slate swan
uneven echo
#

is there any way i can add something to a list without having to go into code and program it in?

#

or what should i add to make it possible

burnt quiver
fast osprey
#

It would probably help to describe the direct problem you're trying to solve

uneven echo
#

its for a bot, mostly trying to add all items from a game, and you can press a number and it will show you that item and some stuff about it, its mostly that i dont want to add every single item manually

fast osprey
#

Do you have a database? Are these things changing over time?

uneven echo
#

yeah, i think so atleast

#

it was mostly a test for me to try to make a bot

#

i just dont want to make my code extremely long

#

so if there is a way for me to be able to reuse a part of the code instead of copying and adding it to already a long part

fast osprey
#

A database is the proper way you'd track data that changes over time

uneven echo
#

probably, no idea how to do it tho

fast osprey
#

No time like the present to learn

uneven echo
#

true

fast osprey
#

You can store these things in memory if you really want, but any changes you make will be wiped when the bot restarts

uneven echo
#

database would probably be better

fast osprey
#

In terms of investment, I'd recommend sqlite as that has the simplest infrastructure while still being a relational database. If you haven't learned any sql, that would be a first step

uneven echo
#

ok

#

ill try

tender bobcat
#

sqlite db can go really far and is usually sufficient for discord bot (in terms of the performance and resource usage), unless you need other features that not provided in sqlite

#

Just make sure to do some backup regularly

fast osprey
#

sqlbolt is a fantastic tool for learning base SQL, which will be useful whichever SQL flavor you end up with

tender bobcat
#

As well

broken tulip
#

Hello

wise mica
vapid wharf
#

Can I make a discord bot with api from chatgpt

merry cliff
#

absolutely!

vapid wharf
#

Yah and have it trade info with each other

ivory plaza
#

you should test

stark ingot
stark ingot
zinc badge
#

I m currently working on making a beginner-friendly discord bot. Its name is Senpai 🙂
What I learned till now while making this project
--> about APIs and how to use them
--> tackle many new terms - json, .env
--> how to use GitHub and git bash ( I literally didn't have any idea abt git or github before this project)
--> came across many libraries like asyncio, requests etc
(Everything is a new experience for me as it's my first project and I really appreciate it all)
GitHub repo link : https://github.com/astha-innov/Discord_bot
any feedback is much appreciated

GitHub

Contribute to astha-innov/Discord_bot development by creating an account on GitHub.

jaunty cape
fast osprey
#
  • using both asyncio.run and bot.run sequentially boots up the event loop twice. You really need only one asyncio entry point. You could either put bot.start in your main(), or implement a setup_hook in your bot and put your extension loading in there (I recommend the latter)
  • having an entire file and cog per command is pretty overkill. Longer files aren't bad.
  • you shouldn't be using the requests module in asyncio based applications. Use aiohttp instead
dusk pelican
#

Yes since discord api is asnyc the simple request module isnt what makes it blocking

burnt quiver
#

huh

#

It's normal to have non-async code when they the execution time is very short. But requests can take a longer time hence solstice suggested to use aiohttp

#

Idk what i'm saying lmao

tender bobcat
#

Which is unlikely

burnt quiver
#

im talking about like math operations

fast osprey
#

Every single function blocks. It's just a matter of whether that's on the order of ms to schedule a task vs several seconds waiting for a network request

stark ingot
brazen raft
fast osprey
#

Presumably that would violate some of their TOS, I can't see why they'd be fine with people violating their own ban

stark ingot
#

Afaik discord has not banned Russian citizens. But the Russian government has banned discord

fast osprey
#

Oh yeah, so it seems. Still, helping someone bypass their country's policy probably runs afoul of rule 5

celest pelican
#

Nah, it's fine. Rule 5 doesn't mean we'll enforce the laws of every country on Earth.

#

But I'm guessing the solution isn't Discord-specific: using some kind of VPN that terminates elsewhere.

somber sky
#
@client.tree.command(name="verify_roblox", description="Start Roblox verification")
@app_commands.describe(roblox_username="Your Roblox username")
async def verify_roblox(interaction: discord.Interaction, roblox_username: str):
    if interaction.guild is None or interaction.guild.id != 1141445886002593925:
        await interaction.response.send_message(
            "This command can only be used in the designated server.", ephemeral=True)
        return

    code = generate_code()
    pending_codes[roblox_username.lower()] = code

    await interaction.response.send_message(
        f"To verify, please join our Roblox game and enter this code:\n**{code}**",
        ephemeral=True
    )```

im making a roblox verification to discord, I have it working to where it gives me a code, i type it in the roblox chat and it says successfully verified, but how would i make a command where i can get a discord users info and see what account they verified under?
young dagger
#

Buy a VPS

slate swift
unkempt canyonBOT
#
Discord Bot Hosting

Using free hosting options like repl.it for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.

See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.

You may also use #965291480992321536 to discuss different discord bot hosting options.

sacred wind
#

how to fix it?

@bot.command()
async def sob(inter: discord.AppCmdInter):
    await inter.response.send_modal(
        title="Create Tag",
        custom_id="create_tag_low",
        components=[
            discord.ui.TextInput(
                label="Ваше имя и возраст",
                placeholder="Пример: Олег, 24 года.",
                custom_id="Имя пользователя",
                style=TextInputStyle.short,
                max_length=50,
            ),
            discord.ui.TextInput(
                label="Был ли у вас опыт в данной сфере?",
                placeholder="Расскажите об этом здесь.",
                custom_id="Описание",
                style=TextInputStyle.paragraph,
            ),
        ],
    )
    try:
        modal_inter: discord.ModalInteraction = await bot.wait_for(
            "modal_submit",
            check=lambda i: i.custom_id == "create_tag_low" and i.author.id == inter.author.id,
            timeout=400,
        )
    except asyncio.TimeoutError:
        # user didn't submit the modal, so a timeout error is raised
        # we don't have any action to take, so just return early
        return

    embed = discord.Embed(title="Форма создана. Ожидайте подтверждения руководства.")
    for key, value in modal_inter.text_values.items():
        embed.add_field(name=key.capitalize(), value=value[:1024], inline=False)
    await modal_inter.response.send_message(embed=embed)```
fast osprey
#

Run your code, get an error and traceback

sacred wind
fast osprey
#

What is leading you to write "AppCmdInter"

sacred wind
fast osprey
#

I'm asking what led you to write that specific word

#

Is this from a tutorial or did you just make it up

sacred wind
fast osprey
#

Libraries aren't the same

#

Resources you get for one library won't work if you use another library

sacred wind
#

I understand. can't you write the same thing on a regular discord?

fast osprey
#

What do you mean by "regular discord"

sacred wind
fast osprey
#

There isn't an official library. Each library has their own classes and options

#

No such thing as a standard discord library because discord itself doesn't endorse individual libraries

sacred wind
#

I don't feel like writing on disnake.

fast osprey
#

You're welcome to use another library. You will need that library's documentation

sacred wind
#

Okay, then I'll use disnake.

fast osprey
#

If you're referring to discord.py, that is a different library with different docs

#

The same code will not work

sacred wind
#

I can send you the original code.

patent hull
#

The documentation has references for interactions, components, and all related things, also packed with examples, you may want to see it

#

!d discord.Interaction

unkempt canyonBOT
#

class discord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
whole shoal
#

Is there an open source cluster manager library

glad salmon
#

By any chance could anyone help with a discord bot?

fast osprey
#

Feel free to ask your question

glad salmon
# fast osprey Feel free to ask your question

Me and a mate are working on a bot for a server we are on... he's doing most of the coding and it's his first bot, though he does do a lot of coding

Where can I paste the code to get some help with it?

fast osprey
#

!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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

sly lotus
#

Do you know if there is any docs on how to use Components v2?