#discord-bots
1 messages · Page 411 of 1
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"
would you input the r
It's highlighting part of the escape sequence, but the whole thing is a string
before the \
the r for a raw string always goes before the first quote of the string
r"\033[03m"
yes
but you don't want a raw string here I think. Are you sure the error is on this line?
yeah but that's not the same as what you showed here
that was just a example for a string
okay
i gotta leave in like 25 minutes for work anyway you could input it for me
os.system("clear && printf '\e[3J'")
says invalid escape sequence here
so what do you think you have to do here?
i think i have to input a r before the string but i already tryed that and it didn't work
what did you change it to
os.system(r"clear && printf '\e[3J'")
i tryed that and this os.system("clear && printf r'\e[3J'")
and what was the error
same thing
can you send a screenshot
bones in the most respectful way possible can you input it for me ive spent so much time on this already i legit have to get ready right now to leave
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
why not im not trying to pursue somthing in coding
I wonder what Boost Bot v3 does 
alright ill come bck later
So what happens when you encounter this the next time? Will you also have someone to do it for you then?
Yes ill probably pay someone
i just use the bots i don't code them
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
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.
You want people to use skills they spent time acquiring for your benefit for free
yes if someone wants to help they can.
its topicalchat/help bro like i think your smart you should know this
"Help" is a funny way of phrasing "free labor"
can't ride a bike if you're not willing to pedal
Help is free labor essentially
Yeah we get that. It's just the way you're asking is kinda impolite and entitled
Okay i don't have good grammer im not good at asking things i was just asking for help im not trying to be entitled i personally think your just taking it that way.
Anyway as I said, you're welcome to come back here if you still need help later
You've repeatedly asked him to do it for you despite him declining. You continue to insist that he should do it for you. That's not a grammar issue. That's an 'entitledness' issue
the belief that one is inherently deserving of privileges or special treatment. Defintion of entitlement. i think im am deserving of help i don't see the issue, even its to have someone do it for me that would still be help.
Help isn't the same as special treatment.
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?
i don't think im entitled to have special treatment, lol i think someone has the free will to help someone
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.
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
i didn't decline i said i don't understand and i don't have the time i already know i wouldn't understand it at all
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
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
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
Then don't, just don't be surprised when people aren't lining up to do your work for you
Okay lol i don't really care i know there is people who will help.
i get you are mad that you spent years/months learning thats not my problem
I'm not sure what gave you that idea. Still waiting for you to mow my lawn
Not the same consept though asking for help with a couple minutes fix on a code
It's been 25 minutes btw. I thought you had work?
Shame, 25 minutes that could have been spent on the python tutorial
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.
Have a good one!
I wouldn't have been able to help you anyways tbh, I'm a newbie myself. I just wanted to make it a little clearer to you why the other two were answering you the way they were and thats because you came off as being a little pushy and impolite. Thats usually not a good thing to do when asking a favour of someone
well i was trying to tell him i just wanted it to be fixed im not here to learn
and if he does not want to do that then okay not a problem
on too the next
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
idk how i came off i was trying to say it nicely like im pretty sure all i said was " anyway you could just input it for me please"
i don't see how that is rude
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
True i mean i was just being honest but i gotta go now later.
Cya hope it gets fixed soon
Fair point but I don't think it's a nice idea to store them in memory of the code
why?
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%
Needs url=
Hahaha, that worked perfectly!
Thank you!
how long can channel.typing() last for?
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
there is not a single day in this channel without drama
That’s exactly we need to secede it from the rest of the server
Iirc it's 10 secs per request
However you can use async with to make it as long as you are in the context manager
Hello
how do i format a channel as a clickable button like here >>>
https://discord.com/channels/267624335836053506/343944376055103488
is it like uh. Channel id
ah .jump_url
<#{id}> as well
that's differerent, that gives you a link. I believe you're looking for is channel.mention
oh wait that's a link nvm lol
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... 
Nice!
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
Expand on what "isn't working" means. What do you want to happen, and what is happening?
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
You shouldn't be using channels for tickets
@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
use threads
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
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
Are you going to try and help or just start talking about channels and threads
That said, what is leading you to believe that on_channel_create is an event?
i thought that's what i'd be
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
I'd recommend reading the docs for the library you're using, the answer will be there
do you know and your just not telling me?
yes
what library are you using?
well, I don't know what library you're using
like version?
Library + version is helpful
How do i find out what library i'm on c
You installed it
probably like 4 years ago
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
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
yeah i updated it before i started asking for help
https://discordpy.readthedocs.io/en/stable/api.html#event-reference anywho this is the reference for the available events in discord.py
and that would not have taught you any self sufficiency
I have no responsibility to help you on your terms
Says who?
Says the channel rate limits and lack of archival
Funny you say that considering the main Modmail bot actually works the same way. All logs are stored in a database

@nova hawk Use this https://github.com/modmail-dev/Modmail
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
That sounds like a you problem. I'm running the bot on a VPS with 2 cores and 8 GB of RAM (among other bots) without any issues
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
It works perfectly fine
That doesn't mean it's not inferior
Drama 24/7
"No drama thank you"
I want a bot for my server that sends messages every 5 minutes, can anyone help me?
what are these messages containing
!rule 5
[Omitted]
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
this was not the way to do this
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
Oh ok,
I was just attempting to describe it sound like spamming which would violate ToS
Sorry for the text block
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
Ok
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
i made a bot with temp channel and ban kick an timeout. i dont know what i can add
Are you looking for learning exercises or things that are actually useful that would convince someone to add your bot?
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
How is self.message set?
in which part
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
anyone know how to make an auto claim system for ticket bot?
you're going to have to elaborate what "auto claim" means, and what "ticket bot" is
or can anyone help me word out waht i mean
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)
basically, ticket bot is a discord bot where people make tickets whether it be for support, and it gives staff the option to claim it (once claimed, the ticket is locked to the person who claimed it)
i want a bot that can automatically say /claim whenever a ticket is opened
Bots can't perform interactions
they cannot run slash commands, they cannot click ui buttons
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
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
Or special way if you want to call it such way
uhm, i think i meana discord tool
this is an example
Yea that's against the ToS lol
oh it is?
It is call self botting
not exactly what i want
i mean like the panel thing, is an example
Yes, it'd be pretty strange if it wasn't, dont you think?
if self.view._timeout_task:
self.view._timeout_task.cancel()
self.view._stop_autospin = False
for child in self.view.children:
child.disabled = (child.label != "⏹️ Stop Auto")
await self.view.message.edit(view=self.view)
If the owners of this bot wanted you to interact with it in a certain way, they would create an API for doing so
thought itd js be automated actions, im not rlly in the scripting weorld
That doesn't set self.message
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
no not for the ticket bot, i want a system where it automatically makes me press "/claim" in a certain channel (i fill out the channel id to decide which channel)
Bots cannot perform interactions, or "make" your account do something
Anyways this sounds contrary to the spirit of what this other bot is doing
So you don't own the ticket bot
no its nothing to do with ticket bot,
If they wanted you to be able to auto subscribe to things, they would give you a mechanism for doing that. Contact them
The self.message attribute on my SlotView
view.message = await channel.send(embed=embed, view=view)
its like. i want a system where i can automatically send a message in a channel of my choice (in a nutshell)
Your error above is suggesting that self.message is an InteractionMessage though, not a regular ol' Message
for exampple, some scammers or whatevre they do. they sned messages in a discord server, and whoever dms them gets automatically sent a message
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
A bot can send messages to a channel based on conditions, sure
not a bot, idk what its called. a panel maybe
By violating the ToS in many way
what the heck is a panel
so what should i do
3rd party systems?
I assume they're talking about running a script on their terminal that will do stuff from their account lol
Find the part of your code that is setting that .message to be an interactionmessage
yeh
Again, that's against the ToS
i see
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
i got sent something which i cld use on my disord account
well that thing is against tos
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
There's a 99% chance its also malware
i see
so its impossible for me to get wat im requesting?
It is impossible without violating ToS or being allowed to do so by the bot owner
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
i see
If the ticket bot owner allows you to do so, they can provide a API that doesn't go through Discord
thanks for your support guys really appreciate it
No worries, and please don't run random code downloaded from the internet
Also, you shouldn't be trying to call on_timeout yourself, you should be using the built in timeout
how can i check if its malware
virus total?
pro tip don't download anything from randos
why is that happening and bot dies after 20 min?
the bot doesn't die
Its common sense, don't run anything from anyone without knowing EXACTLY what you're doing
if that ever hapens what shld i do
yh i cna get my pc ratted or smt
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?
it is still self botting
but its possible?
You're better off not testing the waters with this one
I don't even know what that is
auto hot key
i think its working fine now thanks for your help dude
^ the main point is not whether it is or isnt possible
And sorry that was for the other poster, glad it's working 
helps to ask for source so you can inspect and build it yourself 
"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
Out of curiosity, what was it? Was it the timeout?
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:
...
You can use GroupCog too
You cannot subclass Group and do it like that
alright
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?
Id recommend still using prefix commands for owner only operations like syncing
fair
But you can set the prefix to [] if you wanted
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
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)
Do you have use app command privileges on that server? Do you have the app command scope on that server?
And the latter?
I asked two questions
I don't understand the second question
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
Do the commands show up if you go to the integration tab in server settings?
no
And this is for your account, not inviting to the server
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
You don't declare this command as user installable
They're not user installable by default, at least in discord.py
thoughts on the owner control panel?
uses select menus for everything related to cogs. Also allows you to select logs.
Personal preference honestly, I don't like having too many buttons on one message. Feels cluttery
Yeah thats fair
is this like an opensource bot you're giving to people?
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)
We have decorator that is is_owner() and if you aren't a valid owner then you can't use the cmd
and you have to be in a certain guild to see owner commands anyways
No, I meant that you might accidentally click the button
That's nice
nah, its just our control panel we put in all bots
logs all actions besides the blue buttons, which are just syncing, and bot logs
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
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
rather have it all in once place lol
no point in me making multiple commands for 1 thing honestly
But you already have separate logic
Wasn't making views more work?
Yes, but I rather be able to just press a button vs run multiple commands
it is, but in the long run its easier to use that than run multiple cmds lol
Valid
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
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
its for a team
That makes more sense now
not just me alone uses it, the whole team uses it
let me rephrase, something for less than 1% of my user base
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
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)
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
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
yeah that is fair
i mean, we all have our own opinions.
But I personally like the owner control-panel lol
How are we supposed to judge something that is not possible in discord?
?
here is a video of it @stark ingot
You don't appear to be using discord
Suggestion: Make all operation require to enter a 2fa code by implementing otp validation on the bot
No need if you need to be an owner of the bot. Sure you can get token logged, but the worst part of the owner control panel is the Restart n Shutdown, you can't do much with those.
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.
until your discord compromised and you add some more dangerous thing in it
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.
There is nothing else to add into the control panel. Also, to NOT get compromised is do not download stuff or compile things without reading the source..
Logs only show debugs and errors.
nothing risky about that..
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
and that would be in a dev instance, not production.
you don't just leave prints in production
Oh yeah? How they run differently
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.
what about this
Then it would be an API key.
and you can still get compromise
apis have a generate cmd for a reason 😭
never been compromised and ive had discord since 2018.
seems to not be that hard..
and our databases are IP locked. So really no one can do muchn lol
or you didn't notice
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.
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
Hold up... why would ANYONE log anything in the env?
no they don't
Why would logging do that? You would have to literally say it to log that
well, people don't always use logging
discord.py does not return the token unless you exactly log it yourself
well thats on them.
in particular the person use loguru
maybe use the correct things instead of random stuff lmao
what define as correct
also its not random, it is pretty popular
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
never heard of it personally
why would you use the variable outside of just starting the bot?
which is why the token got into log
please answer that...
it print variable for the whole stacktrace
which include the frame that called bot.run
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.
it doesn't
it just print all variable in the whole stack trace related
I have never seen it do that in dpy..
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
which is both debugging family, but danger in this case
thank you
I can cause an error right NOW in my discord bot, have the full traceback and see no token in it.

not really because I also done something done something wrong multiple times
we make sure we don't do something stupid in production.
what is the suggestion here? Don't ever emit/store any logs in the off chance that someone puts something dumb in them?
?
that is what they are saying basically
adding more security than just pushing a button by the owner
what r u guys talking about im crazy good with discord bots
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.
whats the whole point of worrying about it when you VIEW/REQUEST the log goes to ONLY your dms only YOU/OWNER
it goes to the persons dms who pressed the button dawg 😭
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
if someone with control over the code is that malicious/grossly incompetent, there's a lot worse they could do at that point
Exactly, and if someone was to do this, it wouldve happened by now for us
and if someone was to "token log" the owner they would have access to dev portal
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.
When tf I say not use log file 🥴
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)
wasnt that your whole point of this?

No, I say prevent it to be easily accessible
............
Not remove log file entirely
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
Well, I come from a stand point that you cannot trust a singular thing
But maybe that's too extreme? Well
Trust a singular thing.. I have no clue what you mean by that.
But you would need to hack our storage server then access minio, so youd have to reset passwords to that, then you could edit the owner staff list. But I have SSH access to block ALL ips besides 4.
I think security is very okay on my end.
but if you do manage it, lmk 😭
Theoretical attack method:
- Somehow compromised the discord account of the owner
- 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
Alright, counter attack
DONT download a token logger.
Boom your entire thing is now invalid.
It doesn't mean I would do it, I don't know cyber security that much
its clear that you don't
keep in mind if they "compromise" the owners account they would have access to dev portal anyway ABSOULUTE no reason to "wait for team to use other log framework" they could just reset token 😭
I am in cyber security, clearly you don't know much about cyber security 😭
That would require 2fa and token stealing don't 🤔
compromised means token logged...
CVE exist 🥴
define CVE?
if you got token logged and didnt have 2fa on
buddy
Like, a vulnerability in some application you used
ah yes
If you don't have 2fa honestly that your fault
discord, the billion dollar company pushing a CVE vuln to production
Which for token, from my memory, only need file read access
seems like that has happened before (pretty sure its happened many times lmao)
Can we just stop fighting because respectfully its not a fight your gonna win 😭
ONG its not
So therefore if an application have a arbitrary file read access, it could leak the token of the user
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.
And would you imagine Microsoft Team have zero click RCE in 2020? It is absolutely possible
Switching topics to another company about NOTHING we are on is crazy
microsoft is a bad company, we have known this right?
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 ...
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.
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
nobody is saying it ISNT gonna happen we are just saying we try our best to PREVENT it
problem solved baby.
Good point it mitigate so much
rage baiting in the big 25, little 26, mini 27 is crazy bro
Tbf I wasn't
I genuinely think it's needed
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.
Well, I said I am done so I am not saying any what if related
i think they would be after a credit card or something useful instead of a DISCORD BOT TOKEN
sooooo hows everyones day
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.
every minute is decent and serves for decent logging. if it was my choice i'd do updates every 1-5 minutes depending on how taxing updating is
Thank you for the response! Yeah my bot is just used by myself so every minute is probably not worth it, but I like pretending it's used by millions.
Do you think this flow is appropriate (monitoring events for registered user ids with my api).
id like to filter out the noise, so I may just update or inspect the new data on every command. Not sure what's best.
but I like pretending that it's used by millions
relatable asf 
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
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
databases are very fast
i think one insert operation on sqlite was like, 1e-5s
(obviously that can vary but not by much)
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
thats true
why would you be using a database that cant handle at least 3 queries a second
*In most case
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
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
you can use vercel or use a hosting free server, bot-hosting.com, silly development,
Do any of those not use shared ips?
Wdym
They give you a free server to run your code on it 24/7
The last two they use petrodycel game server management
Just use Vercel to host it
Replit now needs premium to get a repl.co domain
If you're not paying these services, how do you think they're keeping the lights on? Out of the kindness of their heart?
They have premium service
Does each vps get its own IP or will multiple bots use the same IP?
You can check the official petrodycel docs
I think they give you a container to do anything with it
Ohh
No it's special ips
And ports
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?
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.
Yo wolf I have a question
what did you use to code survey wolf bot?
probably Python // Pycord
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?
I don't know
But they are absolutely free and running your code 24/7
And it's not free fully
It's like you need to gather coins
Bro
Noone is the prodcut
They are getting profit from the ads
How much money do you think you watching an ad as one person generates
And you need afk in the page to gather coins and make your server alive
Idk abt ads
cents
Think critically about this for a few minutes
Idc if they will run my discord bot
Poor human, too young or delusional to understand.
The point is that they don't, they try to make it look like they are
I'm an enjoyer of oracle free tier
They will either frustrate you by giving you nonfunctional service at some point to coerce you into paying, sell your data, or both
You didn't try them
wuh woh
Or use them
admin mod is here
?
godlygeek was typing
I don't need to try them. This is incredibly simple economics
they are always watching 👁🗨
People don't give you a free service at a loss out of the kindness of their hearts
IDC if they will make my code run
Let them do anything, they will not hurt me
And my code is functional,
however this is kinda limiting so im moving to self-hosted in a few months when I move living situations
And it's not free fully
!warn 1311690314632921153 That's not how we talk to people here. Give our #code-of-conduct another read.
:incoming_envelope: :ok_hand: applied warning to @regal venture.
Why
he can see what u edited it from
That is not a bad thing
Soheab where you from
a lack of experience is not an insult
Why does that matter and you're getting off topic
You're name is arab
I'm curious

any idea how to set up openssh lol
Up until they sell/use your token, discord holds you accountable and bans your account. I've literally seen this happen
.
That's right
Probably better to ask that in https://discord.com/channels/267624335836053506/716325106619777044 lol
oke
will vercel keep it on 24/7
Skips over the entire conversation of why free hosts are by definition scams
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.
I thout vercel doesn't support long polling
Cloudflare has a free tier, are they a scam?
Is it
btw it's a tele bot not discord
Cloudflare isn't a host?
Oh
ye
I said I'm new to python so thought bot all are alike
I don't use tele
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.
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
so now what are sites or apps that can run the bot 24/7 (free)
This isn't a telegram bot channel
OK where is the channel
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.
Soheab is correct
Python+Py-cord
Py-cord is it a fork
Yes
Okay
Although sometime in the future it won't be
What does that mean?
Pycord v3 is supposed to be a full rewrite
I just hope they would finally move away from the discord name
@slate swan have a look at https://fallendeity.github.io/discord.py-masterclass/ if you havn't
A hands-on guide to Discord.py
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.
I'm from poland I don't english
Hello
Can you give the code
I don't currently have any code.
Then what dont you understand?
everything
I don't know how to write code.
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
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
This has some good resources for just starting out
I have already created it and I have already put it on Discord, but there are no commands.
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
I know how to create commands but I don't know how to set the bot ticket on the channel and write the code.
thank you bro
And which one should I choose because I'm not really good at English?
@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 learn some English before trying to ask for help
That is just rude. If you have to throw a few words into a translator here and there it is fine.
That is not how we talk to other server members here. Yes, you need to speak English here, but using a translator is absolutely fine.
He's trolling
Look at how he's talking
Look at his username too
I don't care, I don't want other people see such messages either and then be discouraged from posting.
You are not required to help anyone here. To me it looks like you interrupted a respectful conversation between Ice Wolfy and them.
Yeah I agree it comes across rude
:D
Can someone give me any code?
print("Like this?")
And what about the bigger ones?
def bigger_one():
print("Like this?")
I was just kidding.
Have you tried to learn how to make a Discord bot from the resource I shared with you @slate swan ?
https://fallendeity.github.io/discord.py-masterclass/
A hands-on guide to Discord.py
I do not understand what is written there.
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 ...
Your next step is to ask specifically which part you don't understand. We'll try our best to help 🙂
I have yet to see a YouTube "tutorial" that isn't complete ass
Thank you bro
Strongly suggest you don't use that as a reference
What can I do if I have something like this?

what?
That's a tiny image with two yellow lines
Can someone help me with something like this, at least explain what it is that I'm getting an error about?
If you could paste your error here that would be a start
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
What is the error
And that's the problem because it doesn't show me any error in the terminal
If there's no error then what's the problem
I keep writing this and it doesn't want to load (turn on)
Code
...
code bot
why do you call it config.py? Why not mybot.py?
Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.
OK so its not config.py. Its called main.py. Run py main.py in your terminal
I from poland
Have you written anything in python before? Have you run a file on your own?
No
what do you mean no?
Then its fine. Just run py main.py in your terminal and hit enter
Hi
I ran the file myself
It's a yes or no question
Yes
yes
Do you not see the problem with that
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 ...
That is made by a random dude making shit up
py main.py
also pip install that missing module
what where should I paste it
type ls first in your terminal and hit enter. Then share the output.
whats in your requirements.txt file?
nothing
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
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!
Something like pip install the modules are considered very basic. Please. I urge you to please learn the basics properly.
I'm starting to get a headache from the guides that are available in our country XD
Are you looking at basic python resources or trying to skip ahead to making a bot
Here's a tutorial in polish and its from the official Python itself https://docs.python.org/pl/3.13/tutorial/index.html
Python jest łatwym do nauki, wszechstronnym językiem programowania. Ma wydajne wysoko-poziomowe struktury danych i proste ale efektywne podejście do programowania zorientowanego obiektowo. Eleganck...
Thank you
No you don’t
You’re trying to run config.py ffs
what?
bro. config is config
you don't put anything there other than config, the thing that actually runs stuff is always in main
who the hell has a file named
config.py
it's either a save file like json or a env file
i mean you still need to load them either way, config.py would probably be like global variables loaded from the actual config files
you can define global variables in your code, no need a header file like C/C++
well some people make header-like files
well for the sake of naming, don't name it config.py
idk what he was thinking, but i just called mine globals.py
what does it really do anyway
show the code please
nothing, the entire thing is just loading from a .toml config
are you making a package or smth
I just use a .env and a db with sqlite
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
There's like 50 ways/formats of doing static config and it really doesn't matter which one you choose
yeah sounds about right
I’m really bored, anyone want a free discord bot all you need to do is host it
why doesn't the bot start? what is the problem
(token hidden)
pretty sure its an empty token
noo bro I just copied it. the error is not in the token
a very strange mistake. because everything used to run, but now it doesn't
no
in any case, the bot should change its status to online. And I have nothing going on.
what's the full traceback? In text
Are you sure you want OAuth code grant on (unlikely to be related to your issue)
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.
I'll change the token. I came here to find out the reason for my mistake.
Also your full token is in the file you provided
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.
^
they did but delted it because it contained their token
discord py 2.5.2
!pypi discord.py
Looks to be latest stable release, idk then, the error did not have much to go off of
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 (((
what is the error
Copy the full traceback, remove any tokens, paste it here
okey
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)
The fact you have discord, discord.py, and disnake is not good
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
I think it's worth deleting everything and downloading the libraries again.
Install one library this time; the one you want to use
Okay, thanks a lot. I will definitely try it.
guys, how do i fix ModuleNotFoundError: No module named ‘cgi’
install it?
it got removed
!pypi legacy-cgi
u might need to use this
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.)
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
exactly
Back to help post
'kay
Do the bots need to communicate in any way? If not then it is just unnecessary
Why?
So a troll bot interesting 
If you're exceeding 100 commands you've got way bigger issues
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
Not a good idea imo
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
Can you just upload the video to discord?
all its showing is nothing is going to my file
lol
Also sound like ToS violation 
its not at all
so is anyone going to help
Want to explain what the use case is for generating usernames
I mean technically just using proxy to do this would be attempt to circumvent API limit which would violate the Developer Policy
what happens if you refresh your text file? Right click > Refresh
hello
im trying to install discord.py
`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.`
'$' is not recognized as an internal or external command, operable program or batch file.
followed the official doc
you tried 5 times and got the same error. Try it a different way.
^
wait might be dumb
All I know is that the definition of insanity is trying the same thing over and over again ad expecting a different result.
do you need visual code
I use VScode but you can use whatever editor you want.
source isnt even a windows command is it
thought it was a seperate app
nvm
It was your virtual environment folder name
Assuming you are in the project, which you ain't
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
can you recommend anything
just got python
!res have some read
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
And digest it
no option for that sir
Do it in your VSCode
i am
can bot.change_presence ratelimit me if i repeatedly use it?
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
bots wow
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
how can i avoid the bot is thinking ephemeral message ?
yes but if i spam 5 commands for example it will send 5 messages
yes but my chat will be full with 5 different messages
Not if it's ephemeral
it will full my chat
Well, that's to be expected if you're running 5 commands, expect 5 responses
ok got it
If you find yourself spamming commands, that might be a sign you should redesign your flow
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
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
Code?
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
what list and anyways it's kinda offtopic here then
It would probably help to describe the direct problem you're trying to solve
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
Do you have a database? Are these things changing over time?
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
A database is the proper way you'd track data that changes over time
probably, no idea how to do it tho
No time like the present to learn
true
You can store these things in memory if you really want, but any changes you make will be wiped when the bot restarts
database would probably be better
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
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
sqlbolt is a fantastic tool for learning base SQL, which will be useful whichever SQL flavor you end up with
As well
Hello
Without specifics, you could see if that game has an API or some other point you can access to take the data from
Can I make a discord bot with api from chatgpt
as in use the openAI API for a discord bot?
absolutely!
Yah and have it trade info with each other
I think yes because the last time i asked ChatGPT and he coded a bot for me
you should test
Just make sure you select a modal that does not train off of the inputs from discord as that is against discord TOS
Don't use AI to make discord bot code. I have yet to see any AI make a bot on the library I use that works and uses up to date features and practices
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
Cool, you should learn how to use a GPG key and write conventional commit messages
ohh noted ! thank you :)
- 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
Yes since discord api is asnyc the simple request module isnt what makes it blocking
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
You should use async if possible unless it would cause large performance penalties to change
Which is unlikely
im talking about like math operations
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
You should use app commands instead of message content based commands
The higher the demand for responsiveness gets, the more important it is to use non blocking IO frameworks to enable that.
It is especially true in this case, because responding to heartbeats on time is critical for keeping the bot connected and being able to respond to events and commands in the first place.
Presumably that would violate some of their TOS, I can't see why they'd be fine with people violating their own ban
Afaik discord has not banned Russian citizens. But the Russian government has banned discord
Oh yeah, so it seems. Still, helping someone bypass their country's policy probably runs afoul of rule 5
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.
@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?
You could use a database to store the dates
Bind the Roblox User ID with interaction.user.id
Buy a VPS
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.
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)```
Run your code, get an error and traceback
What is leading you to write "AppCmdInter"
I wanted to write a panel like in the photo. But with some more features
1: What's your name
2: how old are you
3: your experience
I'm asking what led you to write that specific word
Is this from a tutorial or did you just make it up
from the textbook. actually, this code is on disnake, but I wanted to rewrite it on a standard discord.
Libraries aren't the same
Resources you get for one library won't work if you use another library
I understand. can't you write the same thing on a regular discord?
What do you mean by "regular discord"
I was referring to the standard discord library. the translator translated it incorrectly
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
I don't feel like writing on disnake.
You're welcome to use another library. You will need that library's documentation
Okay, then I'll use disnake.
If you're referring to discord.py, that is a different library with different docs
The same code will not work
Well, that's the point. I took the disnake code.py and tried to rewrite under discord.py . An error came out and I asked how to fix it.
I can send you the original code.
The documentation has references for interactions, components, and all related things, also packed with examples, you may want to see it
!d discord.Interaction
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.
Is there an open source cluster manager library
By any chance could anyone help with a discord bot?
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?
!paste
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.
Do you know if there is any docs on how to use Components v2?
