#discord-bots
1 messages · Page 410 of 1
uh consider .gg/djs
oh okay
javascript?
ye
lol
I need the help for my bot
what problem are you having?
I want to create a Roleplay bot for the community (console) but it's my first time so I'm struggling.
and my English is really down the drain
Where are you stuck?
Uh actually, it's a project that I want to do and I want to know the beginnings, where to start, etc. I don't know if you see what I mean.
I don't, you need to be specific about what you have tried, what you want to do and where the problem is
Then I don't even know which language would be good, I've been told Js is better but I manage a bit with Py.
Well given this is a python community server, you should come here if you decide to use python
What are the basics for starting a bot already?
I must admit I can't listen to tutorials since most are in English and that's not my language, so there you go.
- Have a good solid understanding of the language you want to use. This is beyond just basics and includes things like classes and async
- Pick a library you want to use (discord.py, pycord, disnake, etc)
- Read the getting started guide for that library
I only created a Panel system, then I'm struggling.
Bots layer on multiple advanced language concepts like classes, async, and API's. It is suggested you learn those things before attempting to make a bot
Yeah that's true, can you just tell me if the beginning is good?
I have no idea what you're asking by that
You can send it here if you would like feedback
you should subclass discord.ui.View() so it's much cleaner
How is that, excuse me I don't know how to do it I'm starting development lol
If you don't know what a subclass is, this applies
???
Alright, I'm using discord.py, latest version, trying to make a logging command
in on_ready I'm getting the channel set with
log_channel = client.get_channel(LOG_CHANNEL_ID)
if log_channel == None:
print(f"Could not connect to channel id {LOG_CHANNEL_ID}")
That print does not get called if LOG_CHANNEL_ID is valid, and does get called if LOG_CHANNEL_ID is invalid, I've tested this
The following code is used for the logging itself:
@client.event
async def on_message_delete( message ):
print(f"Message deleted: {message.content}")
DeletedEmbed = discord.Embed(
title=message.author.name,
description=message.content, color=0xFF0000
)
await log_channel.send(embed=DeletedEmbed)
The error I get is as follows:
AttributeError: 'NoneType' object has no attribute 'send'
Any ideas on what causes this?
It's also worth noting that I put log_channel = None is in the global scope, before any functions are called
you need to do global log_channel before using it in the on_message_delete function
and same thing with on_ready
otherwise it might be a local variable
that worked perfectly
always those little nuances that I mess up
Are there any Discord bot developers here with a strong background in creating bots? I'd like to have a word with you
If you're considering hiring devs, try fivver, else you can ask for help here
How do you make a button permanently interactive even after restarting the bot?
Disable it?
"interactive"
OH
I swear it isn't JS this time
bro
Listen for the specific custom_id in the on_interaction event
Surely you can listen for events
But you're using djs
No i'm using disnake
It's similar to d.py
the syntax is the same
js a different library in which you don't need to sync with the commandtree
😭
it still doesnt workr 😢
Did you also send those view with the same custom id
https://discord.gg/gJDbCw8aQy could join their server and ask there
No they have different custom ids
but theres no error
Its js saying failed interaction everytime i restart the bot and try
Then it isn't gonna work lmao
It dispatches based on the custom id
wym same custom_id tho
like the components of the view having the same custom button?
Sure
Like the custom_id= kwarg for all the buttons
You need to send the same view as you add to the bot
no
uh then ask here
no
Huh

Uhhh, which one is better? edit_original_response or edit_message?
going through an interaction has much kinder rate limits where possible than alternatives that don't
One thing noted is edit_original_response would edit the new message sent if the interaction already replyed with a mesage, where edit_message can pre-record the message and specifically edit it
Does it matter if it's ephemeraled or not?
I am not sure, try refer it from the documentation
pretty sure you have to go through the interaction to mess with ephemerals at all
So, original?
!d discord.Interaction.edit_original_response
await edit_original_response(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None, poll=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.InteractionMessage.edit) in case you do not want to fetch the message and save an HTTP request...
it's an API
they're just more human-interpretable methods of interacting with that API
also uh
In any of these
Only .py is a file extension of a programming language
json is another file extension to store static config (not really that good nowadays)
disnake is an api wrapper for discord, wrapping raw request into methods of objects
if you however meant js (javascript), this is a python server, there will not be a an objective answer to X or Y question in X's server
discord.js and discord.py are just libraries that abstract discord's raw API. there isn't much difference besides the language they're implemented in and the coding style that comes from that
Back to python api wrappers, choose whatever you want, most people use discord.py, some uses py-cord, less use disnake, even 1 or 2 people uses hikari, interactions.py etc
@bot.event
async def on_ready():
print("ready!")
client.on('ready', () => {
console.log("ready!");
};
pick your poison 
Real ones use arikawa
Interestingly, on my sample size of 1 hikari had the most active and quickest support.
they're so eager to help because it's the first help post in 3 months
Hikari is great idk why dpy users hate it so much
never seen people hating on it
Have literally never seen anyone say anything negative, unless you read "few people use it" as "hate"
as a discord.py user I have never heard of Hikari
AFAIK it's one of the few (maybe only) 'mainstream' library that is completely from scratch and not a fork of d.py
wildly different design patterns
Neat
Hikari's design is wild yeah
Hikari design is very bright, i mean, it means light
-# Pls laugh, i spent 1 hour on that
No
Why doesn't my Discord bot respond to any commands anymore?
We'll need more details, preferably code
I thougt mayby is it discord?
Beacuse the main bot is working
And how would we know that without seeing your code
probably overrode on_message event without process_commands()
Should i share bot.py with you?
Share it here
I'm not the master dev that can solve everything, more people better help
Pretty sure you are
hi anyone who has web scrapped rocket reach please help me
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
you will not...engage in any systematic, automated, or excessive data collection or extraction activities (including, but not limited to, scraping, data mining, data extraction, and data harvesting) on or related to our Services or Lookup Information without obtaining our explicit written consent;
Yup it's exactly this. Don't use an on_message event, use a listener
is that new, it worked before very well, and i use application commands
That's how it has always worked
Events override the base functionality, listeners layer on top of it
even if they are application commands?
so i have to just add await bot.process_commands(message)
okay and n futher action is needed?
or imorvements?
You should understand what this does and why it fixes it
i will not change very much so i asked if it is that one thing
Do you understand what that does
If you do, then you should be able to figure out if you need to change anything else rather than being told
# do stuff here # do not process commands here
i have only db stuff and message stuff
so i need just to change the header ig
^
yeah it is a listener instead of the a that is bugged
how can i use this in my bot code?
and only the bot an use this?
For bot emoji only bot can use it I think
An application can own up to 2000 emojis that can only be used by that app.
-# Source: https://discord.com/developers/docs/resources/emoji
Not with that attitude
very carefully
hey can someone help me make this
like an automated python script, that can be changed via discord bot. Ping me
A screenshot doesnt really describe the behavior you want
what does that mean
It means you just sending this screenshot isn't much to go on
We can't read your mind of what these buttons do
oh I see, so i made a discord automated script via python. then I want to make the python script changeable via discord bot the (j.son file)
@fast osprey
u get it?
ive written a code via python for the discord automated messages and i want to make a bot like the one ive sent (I want to change the json file via discord bot
What is "discord automated messages"
like auto advertiser, auto message
It is against discord developer policy to target users with advertisements or marketing
oh I see
thank u
so basically the pic that I have sent is a custom made UI? if im not mistaken
No, it's a usage of built in UI components discord offers to bots
sorry, im new to coding. I just coded this for 17 hrs and started to learn python. I'll delete this cuz it violates discord's TOS
Bots layer on lots of advanced topics. I would not recommend making one until you complete some more focused projects and learn the fundamentals
And also familiarize yourself with the TOS and dev policy
but I made it worked so, is that goods for 17 hrs
It depends on what you learned and what practices you used
This message was funnier than the joke bro
too many hearts
simple question. is there a "standard" way to format a discord project? "specific" ways to name folders
Or ext
Cogs are the way
cogs have nothing to do with folders/files
ummm yes it does?
It doesn't
cogs are classes. You can put a million classes in a file.
It's a very common and incorrect misunderstanding that cogs and extensions mean the same thing
im aware of what cogs are, but lets not pretend that cogs aren't almost always used to call classes from other files for better organization of files/folder/commands.
and this "misunderstanding" has no impact on the bot itself when using cogs
People almost always parrot what they see from some random youtuber. That doesn't mean it's right just because a lot of people say it
organizing things into cogs and file structure are two entirely separate exercises
the cogs are using to call the files in that structure
Its like taking caramel and apples for caramel apples and saying that have nothing to do with each other for caramel apples.
im aware
and yet you're saying it
You also don't call classes
mhm
Fml
I'm trying to make my bot's slash commands work in DMs and GCs but it simply doesnt work only in other servers
class CustomBot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
intents.messages = True
intents.guilds = True
intents.dm_messages = True
super().__init__(command_prefix='!', intents=intents)
async def setup_hook(self):
await self.tree.sync()
i tried
Adding dm_permission=True to commands (got TypeError)
Using @app_commands.guild_only(False) (got AttributeError)
Setting self.tree.copy_global_to = None
Added DM intents
any advice on this problem? many thanks 
!d discord.app_commands.allowed_contexts
@discord.app_commands.allowed_contexts(guilds=..., dms=..., private_channels=...)```
A decorator that indicates this command can only be used in certain contexts. Valid contexts are guilds, DMs and private channels.
This is **not** implemented as a [`check()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.app_commands.check), and is instead verified by Discord server side.
Due to a Discord limitation, this decorator does nothing in subcommands and is ignored...
!d discord.app_commands.allowed_installs
@discord.app_commands.allowed_installs(guilds=..., users=...)```
A decorator that indicates this command should be installed in certain contexts. Valid contexts are guilds and users.
This is **not** implemented as a [`check()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.app_commands.check), and is instead verified by Discord server side.
Due to a Discord limitation, this decorator does nothing in subcommands and is ignored...
i have a helper deco that does both of these for me
apperciate it, ima try use those decorators
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
"s3lfb0ts"...honestly? Really? Is this tiktok?
Can someone help me make my “first” discord bot? I say “first” in quotes bc I’ve made part of a bot but not a full one… if anyone has tutorials please feel free to send them my way… the main problems I am having is the best way to start and also how to use custom prefixes… like I don’t want the command to be ‘/command’ but I want it to be ‘%command’
Anyone who responds plz ping me! Thx in advance!
❤️
You would have to show your code
I don’t have any yet…
I guess they are trying to circumvent a non existent filter in the dumbest way possible
Have a read in this https://fallendeity.github.io/discord.py-masterclass/
A hands-on guide to Discord.py
Also don't trust any DM request because no one would be able to cross check if they are doing something malicious
If you are using discord.py
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, ...)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client) you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.GroupMixin) to provide the functionality to manage commands...
You can set the prefix there
W3 4r3 l1v1n9 1n 7h3 493 7h47 y0u n33d t0 wr173 1n number case or else you are not a beta
Bro
ok Terezi
Do you see their server tag bro 😭
snek, in reference to snekbox, which power !e
a) Don't spam this across channels, b) this is a Python server
are you even old enough for discord?
also what made you think that people from a python server would help you with c++?
codebox?
print('oo textt')
this?^
you wanna learn how to do the codebox?
where code gets color?
what's your objective here?
!d discord.Message.system_content
A property that returns the content that is rendered regardless of the Message.type.
In the case of MessageType.default and MessageType.reply, this just returns the regular Message.content. Otherwise this returns an English message denoting the contents of the system message.
if you're using discord.py, it constructs the content for you there
im interested in seeing some of the most "advanced" discord bots does anyone know any
and open source would be cool
There aren't many open sources advanced discord bots, but you can take a look at danny's https://github.com/Rapptz/RoboDanny
Collect and exchange countryballs on Discord. Contribute to Ballsdex-Team/BallsDex-DiscordBot development by creating an account on GitHub.
Thank you all
Let’s go bro I’m rocking the Python discord emblem
Snek
put it in a box
Working on a verification bot that contacts an API, changes the profile picture and then lets them in
They have oauth it seems btw
why would you want it to change the pfp?
well ig for inappropriate profiles
Because only the account owner can do that
Yeah authorization flows like this should absolutely use oauth when it's offered, way more secure and easier for both parties
yeah ik but for what purpose?
To verify that you are not a robot
so if it cant change the pfp then that means its a bot?
It means you won’t be able to access the server and will be removed shortly
wait explain
Well, you need to complete the verification within a specified time
not discord pfp, their pfp in the game
oooh
Wait...this is just to verify someone isn't a bot? Not to link an account?
Just use an interactive captcha service
Can be used for different purposes
If you want to link accounts, use oauth. If you want to verify a human, use an interactive service
^^
why would you only store the message id in the view
I mean i want to change it, example let's say i have class Button1, and i want to change it with class Button2
After they select i want to change embed with another select class
This method is used by multiple well known bots. I see nothing wrong here
Just because people do it doesn't mean it's good. It means it's easy
That method doesnt do either of the things I described well. It just does it easily
You need both message id and channel id to manipulate messages
Does anyone know how to connect my cog commadn to my main .py all help is appercited and I will sendwhatever you need to help me. Thanks 🙂
-# please ping me if you can assist me.
did you load the cog?
Im not a coder, But I have the cogs in a ifle,
this is my main with my cogs.
yeah so you need to tell your bot where the cogs are actually located, and load them. They don't load on their own
Okay, I have no idea how to do that is their any chance you can tell me what to do please?
await load_extension(name, *, package=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Loads an extension.
An extension is a python module that contains commands, cogs, or listeners...
Okay one second can I get back to you?
yeah just ping me later i might be on
They have not stated what library they use so the above docs may be inaccurate.
There is no deadline to delete discord messages. Except for ephemeral messages, which require the use of an interaction token that expires after 15 minutes. This is universal to any language/library
bulk delete is limited to 14 days though
can you only send 1 embed per message now?
no matter what i do, i can only get the 1st embed to show, here is my raw body:
{
"embeds": [
{
"title": "Overall",
"fields": [
{
"name": "**Seasonal Wins**",
"value": "944 wins in 1322 matches (71.4%)",
"inline": false
},
{
"name": "**Seasonal Kills**",
"value": "5,722 Kills, 15.14 KD, 4.33 KPM",
"inline": false
}
]
},
{
"title": "Gamemodes",
"fields": [
{
"name": "**Solo Wins**",
"value": "487 wins in 525 matches (92.8%)\n4,226 Kills, 111.21 KD, 8.05 KPM",
"inline": false
}
]
}
]
}
also tried discord.py and same result
sending both individually works fine
Context in case anyone want to help differently: https://discord.com/channels/267624335836053506/1386132870426394695
What the
Show full code
async with self.session.request(
method="POST",
url=f"https://discord.com/api/v10/channels/{channel_id}/messages",
headers={
"Authorization": f'Bot {token}',
"Content-Type": "application/json"
},
json={
"embeds": [embed1, embed2]
}
) as request:
data = await request.json()
The value of embed1 & embed2 are the exact same as my previous message. My current workaround is just to send them as 2 individual messages like this (which works fine so I don't think theres any issue with the embed structures):
for embed in [embed1, embed2]:
async with self.session.request(
method="POST",
url=f"https://discord.com/api/v10/channels/{channel_id}/messages",
headers={
"Authorization": f'Bot {token}',
"Content-Type": "application/json"
},
json={
"embeds": [embed]
}
) as request:
data = await request.json()
lol
whats up guys
Perfectly fine
I believe so
Not like I can be a super human being, nor being such can be consider good anyway
not possible to put a video inside of an embed still correct?
i dont think i've ever seen it
aight figured lol
L discord fr
I remember not being able to set the video in an embed for awhile, but checking again just incase I missed something
although....
I see some screenshots of what might be just that
oh i wonder if its uh
like youtube, steam, twitter preview
thats a completely different thing
thats website embeds, which discord bots don't use those embeds
websites have special embeds or something where the API does not let you access ig
yeah seeing that now. The screenshot mislead me
its not hard to do logic to avoid conflicts, but all being in embeds looks better than via content
personal opinion ^
They are defined by specific field in the html
Which isn't API oriented
Yes I know that, but discord allows that to be embeded in discord. Which is technically controlled by API
Not in DPY I don't think, so I will have to wait for that release unless i am wrong?
Oh, I mean check whether component v2 is capable of that
oh let me check
yeah I rather wait for official releases though
Fair
from what I am seeing you can't do it in v2 either unless im reading it wrong
I don't think its ever coming to discord for security reasons maybe, but I have no clue why
I believe you can use media gallery component for that
https://docs.discord4j.com/interactions/components/media-galleries
But only found on a weird library docs
Media Galleries
Other only mention as "media", including official, which is quite vague
And example usually only provided as image
i am just very certain it won't be in v2 because they don't show examples of videos either, they only show images / attachments
and if discord makes something new, they USUALLY show the preview
Well, there are library maker who said it work on video
And it would be weird to say image or media if it only support image
Display images and other media
So you could maybe try it in the future, maybe something to look for
Maybe other source: https://x.com/danatationn/status/1914898706479841685
Doesn't mean it can be directly trusted, but ye
not exactly how that works, just because you make a wrapper / lib doesnt mean you can do anything. Discords API is set for all wrappers / libs
I mean they wrote the library with this specified, so they probably test it out
Instead of just speculation
Which is what we doing
I am not saying they make the feature exist, but they probably have verified that the feature exist
Thx
ah alright, thank you
How to gift an SKU to another person..? as developer_gift is a thing?
It's just components v2
waow components
Hey i need some helping with my host. Basicly he is not autoupdsting the files
Wdym by not auto updating the files
Pulling it from github
Yeah what about that that doesnt work
What have you done, what it does, why is it not working
When i start the host, it is not checking dor any updates in files between the local and github
It has the git username a git Access token and the git repo adress
Still not enough of an answer, what have you done, also if you do it on bot start just do a quick git pull before starting the bot
It is
if [[ -d .git ]] && [[ "1" == "1" ]]; then git pull; fi; if [[ ! -z "" ]]; then pip install -U --prefix .local ; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --prefix .local -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/bot.py
thats the startup
what do you need?
i recognise this command 
Has nothing to do with python
As i said it is a python discord bot
That doesn't mean your question is python related. Where's the python there
...bin/python...
"I'm running my discord bot on a Samsung smart fridge, my fridge is broken so help me fix my fridge"
Why do you make life difficult instead of helping?
Because this isn't the place for what you're asking
either help or stay out of it
Or you could ask where you're supposed to
Nah I'm good
From?
this one goofy hosting service
It is just to test
whatever this is
So do you know how to help?
You should try contacting the hosting support
well for a start, did you commit and sync whatever changes you want?
I doo from vs code to github commit and push
what website is this?
XeroHost
does that container have a git repository
Did you put a valid git access token in there
Yeah a Personal Access token
Was trying to debug that bash but seeing that image, the host is auto update as it said, so go to their server for help lol
They wonder themselves
Not a very good hosting service then
Then you shouldn't use that hosting service
Since even them don't know what theyre doing
They now but it is not fixed yet
There have been several attempts to solve the problem
So I thought someone here could help me
It's clearly not a python code issue, and therefore you shouldn't ask here
They should be the best in knowledge to understand this
where else?
Your hosting provider
That question has already been answered. Their support server
Who provide this specific feature and have issue with the specific feature
So no one can help here
They know how their hosting works and if they don't, then you shouldn't be using that hosting service anyways
Fr best analogy
Really it shouldn't be the responsibility of the hosting service to abstract things away from you; they're just giving you a vm and running the infra. Any automation should be fully in your control, ideally through something like a process manager
"AI server builder" come on..
Seem very unnecessary 
If they know how to add your bot, they probably know how to setup a server in such way that AI can
Is a time focused tool. I know plenty of people tired of setting up servers. And templates lack customization . Thanks for your opinions tho.
Read documentation and learn systems: 
Hope a random LLM guesses right what you want: 
Tired of setting up server:
How many time do you have to setup server🥴
Also server template already exist if they are tired of setting up server
Templates can create channels and roles.. basically what you're doing?
Also did you setup role permission for each channel? Just making sure
?? You decided to showcase something in a public channel where anyone can say whatever they want...
Criticism isn't equal to toxicity or lame or "no life".
Yep deleting your messages is totally the right thing to do 473513617950638081 
Which
The video and calling us toxic, lame and low lifers has been deleted https://images.soheab.com/MxiKcvVzF90.jpeg
Oh it just reload
My discord just haven't load the change for whatever reason before I go to a different channel and back
They also left so well
Amazing
me when i cant handle truth 🥀
lol
# -------------------- Imports -------------------- #
import os
import asyncio
import logging
from dotenv import load_dotenv
from pathlib import Path
import nextcord
from nextcord.ext import commands
from bot.config import DEFAULT_SETTINGS
from bot.database.db import init_db
# -------------------- Logging -------------------- #
logging.basicConfig(
level=logging.INFO,
format='[%(asctime)s] %(levelname)s: %(message)s',
handlers=[
logging.FileHandler('bot.log', encoding='utf-8'),
]
)
logger = logging.getLogger('bot')
# -------------------- Load Environment -------------------- #
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
if not TOKEN:
raise RuntimeError("❌ DISCORD_TOKEN not found in .env")
# -------------------- Init Database -------------------- #
init_db()
# -------------------- Intents -------------------- #
intents = nextcord.Intents.default()
intents.message_content = True
# -------------------- Bot Class -------------------- #
class DiscordBot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.cog_dir = Path("cogs")
async def setup_hook(self):
await self.load_cogs()
async def load_cogs(self):
for cog_file in self.cog_dir.glob("*.py"):
if cog_file.stem.startswith('_') or cog_file.stem.startswith('__'):
continue
cog_name = f"cogs.{cog_file.stem}"
await self.load_extension(cog_name)
logger.info(f"✅ Loaded cog: {cog_name}")
# -------------------- Bot Instance -------------------- #
bot = DiscordBot(
command_prefix=DEFAULT_SETTINGS["general"]["default_prefix"],
intents=intents
)
# -------------------- Run Bot -------------------- #
async def main():
await bot.start(TOKEN)
if __name__ == "__main__":
asyncio.run(main())
No terminal print loaded_cog message. I have tried multiple variations of these same actions and im not sure why its not loading the cogs or sending any success message.
Also I am not familiar with nextcord as much but I dont see what would need to change.
you set the logger to log into a file 🤔
indeed
so have you checked the file
Click here to see this code in our pastebin.
[2025-06-24 10:37:34,044] WARNING: Shard ID None heartbeat blocked for more than 530 seconds.
Loop thread traceback (most recent call last):
File "C:\Users\braed\Desktop\Nextcord Bot\main.py", line 65, in <module>
asyncio.run(main())
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 195, in run
return runner.run(main)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 712, in run_until_complete
self.run_forever()
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 683, in run_forever
self._run_once()
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 2004, in _run_once
event_list = self._selector.select(timeout)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\windows_events.py", line 446, in select
self._poll(timeout)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\windows_events.py", line 775, in _poll
status = _overlapped.GetQueuedCompletionStatus(self._iocp, ms)```
cool comment styling
thanks
anyways I tried to just keep the basic stuff until I could identify the problem for now
It seems you have blocking code. The main 3 culprits are
- Image manipulation
- Non-async API requests
- Non-async database calls
Or just a busy sync loop
main most common in discord bots
I think most common issue is beginner not listening to the advice of not picking discord bot as first project
lol
you could do asyncio.run_in_executor()
i think maybe; my memory on that isn't too great atm
It's been a long time since i've had to do that
ive awaited the init_db() in main instead that didnt help
[2025-06-24 12:43:15,100] INFO: logging in using static token
[2025-06-24 12:43:15,101] INFO: Allowed 1 rate limits to be garbage collected.
[2025-06-24 12:43:15,606] INFO: Shard ID None has sent the IDENTIFY payload.
[2025-06-24 12:43:15,754] INFO: Shard ID None has connected to Gateway: ["gateway-prd-us-east1-d-g0k9",{"micros":69868,"calls":["id_created",{"micros":788,"calls":[]},"session_lookup_time",{"micros":1255,"calls":[]},"session_lookup_finished",{"micros":14,"calls":[]},"discord-sessions-prd-2-48",{"micros":67412,"calls":["start_session",{"micros":55146,"calls":["discord-api-rpc-5c89788f78-9xvzh",{"micros":41836,"calls":["get_user",{"micros":5256},"get_guilds",{"micros":3472},"send_scheduled_deletion_message",{"micros":14},"guild_join_requests",{"micros":3},"authorized_ip_coro",{"micros":11},"pending_payments",{"micros":1066},"apex_experiments",{"micros":3},"user_activities",{"micros":2},"played_application_ids",{"micros":1}]}]},"starting_guild_connect",{"micros":44,"calls":[]},"presence_started",{"micros":5784,"calls":[]},"guilds_started",{"micros":62,"calls":[]},"lobbies_started",{"micros":1,"calls":[]},"guilds_connect",{"micros":1,"calls":[]},"presence_connect",{"micros":6351,"calls":[]},"connect_finished",{"micros":6354,"calls":[]},"build_ready",{"micros":19,"calls":[]},"clean_ready",{"micros":0,"calls":[]},"optimize_ready",{"micros":1,"calls":[]},"split_ready",{"micros":0,"calls":[]}]}]}] (Session ID: 6429e57d07e65395fbc463f279cc3658). Resume URL specified as wss://gateway-us-east1-d.discord.gg
[2025-06-24 12:44:05,281] WARNING: Can't keep up, shard ID None websocket is 49.7s behind.
[2025-06-24 12:44:06,879] WARNING: Shard ID None heartbeat blocked for more than 10 seconds.
Loop thread traceback (most recent call last):
File "C:\Users\braed\Desktop\Nextcord Bot\main.py", line 66, in <module>
asyncio.run(main())
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 195, in run
return runner.run(main)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 712, in run_until_complete
self.run_forever()
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 683, in run_forever
self._run_once()
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 2004, in _run_once
event_list = self._selector.select(timeout)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\windows_events.py", line 446, in select
self._poll(timeout)
File "C:\Users\braed\AppData\Local\Programs\Python\Python313\Lib\asyncio\windows_events.py", line 775, in _poll
status = _overlapped.GetQueuedCompletionStatus(self._iocp, ms)
idk
What library are you using to connect to your database?
sql
I switch to aiosql to see if that was an issue as well
is sql a library
!pypi sql
I guess so...
so why when doing SKUs can you only have User Subscriptions or Guild Subscriptions, you aren't allowed to do both on the store?
Not really related to this server, but maybe someone in here might know..
Just use server templates?
Because that seems to be what their code is doing
this is surprisingly really good
cant you also just make and handle a server template yourself in code?
!d discord.Template 
class discord.Template```
Represents a Discord template.
New in version 1.4.
!d discord.Guild.create_template
await create_template(*, name, description=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a template for the guild.
You must have [`manage_guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_guild) to do this...
thank god for dpy having normal names
lol
Hi, looking to sell some Discord bots made with Pycord then compiled using Nuitka for compatibility and privacy of my source code. Now I am into keeping the check logic for the bot to be safe enough against reverse-engineering. I heard that storing the SERVER_ID directly allow some people to access it from the memory. What about this logic:
# A hashed + salted server ID.
SERVER_ID = "825c491944682dae4ee43cf82f7f6da5d187eda3b8a5471cfba3b9a9f3b3f9b7"
# A function to get the salt, which is should never stored;
# the salt is obtained by converting unicode code points to chars.
def salt():
part1 = [codes here]
part2 = [codes here]
part3 = [codes here]
return "".join(chr(n) for n in part1 + part2 + part3)
# A function to convert a text into a hash with the required salt.
def hash(text: str) -> str:
return hashlib.sha256((salt() + text).encode()).hexdigest()
Then compare the bot that the bot in and the and SERVER_ID in the hash function. This way: Never storing the actual ID, instead a hashed+salted server ID string, and the salt itself is also non stored. What do you think? Hope this works and make things at least safer.
what even is the point
there isnt really anything crazy you can do with an id
I know, but it's for them, not the bot. The bot should work with only 1 ID. And being hard to change in the bot logic, if changed means they could use the bot for other servers.
A client comes, give me their server ID, I hash it with salt, include it in the bot source, and then compile. Got it?
When someone is looking at the memory and could find and modify the SERVER_ID variable, the bot will hash it with salt and compare with existing guilds.
Look at this:
for guild in bot.guilds:
if hash(str(guild.id)) == SERVER_ID:
logger.debug(f"Bot is connected to the target guild: {guild.name}")
break
else:
logger.warning("Bot isn't connected to the target guild; logging out.")
await bot.close()
if someone is determined enough to do memory manipulation then there isnt much you can do to stop them from using your bot lol
hashing the id doesnt really do anything
if anything you're just wasting cycles
My question, can they modify the check logic? After that we talk about what hashing can really do.
they can modify anything
if you hand over your code they can change anything and do whatever they want with it, given they're determined enough
How? The if hash(str(guild.id)) == SERVER_ID: is editable?
sure. they have the executable, they can change any instruction they want to
can also modify any piece of memory they want to
What tools/methods?
anything to read and write to binary files
as for viewing and modifying process memory, not sure. i've never done that but im sure there are tools
My goal is; making it safe as possible. Not being totally impossible to reverse engineer, so hashing adds a layer of security?
i guess? hiding the ID does nothing
its their own server, they know the ID. and even if it wasnt an ID isnt good for much without context
you're treating the ID like it's some super secret piece of information when its not
I think you still didn't get the point;
I know they know the ID, what my code is doing is having a hashed+salted string of the ID trying to block them from using the bot on multiple servers. Which makes any average reverse engineer at least a bit more complex.
it barely makes a difference
Ok here we go, they knew it's hashed with SHA256, they tried to hash another ID and replace. Now the check logic hashes both IDs (the one the bot in and the one given) using salt.
dont even have to do all that
):
if you cared enough just find where in the bytecode the comparision happens and remove it
why try to sell packaged code/software? Just sell SaaS
just leave it be and spend this effort on making other features or something
Trying to obscure code you're giving to people is obscenely fruitless when there's a clear other business model
if you turn it into a service theres pretty much nothing they can do
I programmed that layer already, will keep it as is. You don't know when Jesus will make someone stop trying to reverse engineer by that logic.
no point beyond just compiling your code if you're trying to prevent reverse engineering
diminishing returns, waste of time and effort
I am not compiling to prevent reverse engineering. Just for client side compatibility. And the target clients are not into tech a lot, so making things simpler download and run is better.
Wouldn't just using a service already running for them be even easier?
real
wdym? Like a website control panel?
It's a discord bot? So just run it?
maybe if it needs configuration that you can't do through the bot itself
My guy can’t they just remove the lines that prevent the bot from being used
but just have them fill out a google form or something explaining what bot they need, send them the bot's invite link, and that's that
I still think download and run easier, I don't want to host myself, not for saving that 1KB RAM, but I don't have 24/7 electricity.
How is that easier for your users to download, run, and figure out hosting themselves
it's easier for you, not them
My target clients are very familiar with that, you don't know about Arab server owners. Btw everything in the bot is automatic, all they have to do is passing the token in a .json config file.
Bro why would they hire you to make a bot for them if they could write it themselves
So somehow they are magically technically advanced enough to do that, but also somehow not technically advanced enough for this. Convenient
They cannot, they're not programmers. + I am not only selling custom bots, ticket managers, etc..
So they’re very familiar with running Python files but can’t write it somehow?
If they're not programmers, why are you worrying about them decompiling?
are we serious rn
Not the point, I am talking IF someone is buying the bot (or got the files from their friends who bought) to do reverse engineering
It's possible that it end up between an expert's hands.
The files
Get a load of this guy
Guys I am just taking advices, I am not saying I am 100% right.
I got into some points I didn't think about after this
This is what I am looking for
ONLY
Bruh? It's compiled using --onefile. 1 mouse click could run it XD
No Python needed
Once you hand it off to users, it's not yours at that point. If you don't want them to pick it apart, don't give it to them
Or charge them more and act like a programming contractor where they own the product you build
Got it
Right some server owner is definitely gonna run a random executable from a guy with 1 commit in a private repository
I mean I would never pay someone to make something, obscure me from seeing what it does while they refuse to run it as a service for me. Incredibly naive buyer if they'd accept that
They're fine it's not your business, I know a service doing the exact same thing with +1,000 sells. You don't understand anything about the targetted clients. They're all Arab server owners.
Ik sounds weird, but for my target clients it's fine
It's not fine, if they accept that they're fools
and are just begging to get ripped off
idc, I am doing my business. 90% of dildo sellers don't use it
What does them being Arab have to do with your product
My guy if you don’t want your product to be reverse engineered then just write the bot in Go
It's kinda complicated thing, but Arab server owners always prefer that way
Pyinstaller doesn’t actually compile your program
I already know
I use Nuitka, it's designed for hiding the source code.
idk you do you. You can't reasonably have a result where you give them a black box and prevent them from opening it. Your options are SaaS, act on contract and sell the code, or pretend there's a third option
Pyarmor make it even harder, but it's not for commercal use unless paid
From a purely business perspective, you make more money with SaaS
Btw you guys forgot the trust concept. Even popular programs are compiled and at the end they found out that they steal info from you.
Like that anti virus program i forgot it's name
What i am doing is very common, acts like activation.
Popular programs are written by swarms of highly paid, experienced engineers
not a rando asking for help in a discord server
yes, we're aware of the discord bot buying/selling "business" space. the consumers there are not technical, and most of the products are unfortunately sloppy.
for your case in particular, you really only have 2 options
- hand over an executable to end users, but be 100% fine with them doing whatever they want with it
- Run a SaaS and charge a recurring fee to host infrastructure and code
for your case in particular, there is a negligible difference whether you hash your ID or not. your efforts are better spent elsewhere
Nobody mentioned the skills except you who's chatting also on Discord, it's on trust no experienced.
I know how to build trust in my case because the clients are targetted not random
What does trust have to do with this
i also don't see why it's your problem if they decide to run the bot on multiple servers
your entire point here is on not trusting them
give them the source code, collect your money and be on your way
There’s never a dull moment in this channel
I now declare myself the mayor of #discord-bots and am seceding this channel from the rest of the server
To wake up on some people making a tutorial on how to run my bot in general with the source.
Is each bot different?
Then you don't trust them
I know how to build trust in my case
I am worried about them doing something I specifically tell them not to

so it's one bot that you're basically selling access to?
Build trust my ass
Ok guys ur right ,
Maybe just letting them have a control panel in the purchase ticket to control the bot.
Running it SaaS isn't going to be as complicated as you might think
if this is true you're overthinking it and all you need is a whitelist lmao
fairly easy to implement and pretty much unbypassable
Is the code for each bot different?
yes. But what I am working on rn is the template of each bot.
Idk about you, but I wouldn’t buy from someone that’s just giving me a random executable and has one commit in a private repository
That’s just me though
TBH that is not relevant to the question/problem
its not and the consumer base doesnt care either
We've already established that these customers are somehow incompetent enough to accept a product like this while also being smart enough to decompile code
truly an interesting set of people
anyway.. you need to be fine with people doing whatever they want with your code
you dont really have a choice
Okay fine
Another thing to consider is that you can license this product that you give them, and then you can sue the pants off of them if they do try to redistribute it. Rather than trying to lock it down (which won't work)
I am here to take opinions only
its the tradeoff you pay for not having your own infrastructure
Good luck 
looks like an unstable connection
That is normal
It's a little bit too frequent than nornal
Every minute isn't normal lmao
You probably don't want to be using on_ready for anything. It runs repeatedly and randomly
If you know then why are you trying to do it 
Will need to see more of the code
!paste paste it here and send the link
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.
It's not
Any other code in that file (or potentially others) could interfere with what you sent us
That's how python works
We'll need to see the rest of the file at minimum
someone knows maybe how to fix old af bot in discord.py (which was done in times we were all scared it will be deleted tbh…) to work right now? i get such things:
hacknorris@fedora:~/Pobrane/tux-update-cogged$ python3 main.py
/home/hacknorris/Pobrane/tux-update-cogged/main.py:40: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension(command)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2025-06-26 16:13:25 INFO discord.client logging in using static token
2025-06-26 16:13:27 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 0e0f8ffcfb835ded878a5ad615e20845).
2025-06-26 16:16:55 ERROR discord.ext.commands.bot Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "man" is not found
You should follow the 1.0 -> 2.0 migration guide in the docs
how to download 1.0 then?
so bot dead, yep?
You upgrade it to 2.x
if i need to rewrite like 2/3 code i'd rather make it dead…
If you don't migrate it, yes (which should be pretty straightforward)
Nobody said it would be 2/3
v1 to v2 isn't that big of a change
At least give it a read
depending. i have this old gem : https://codeberg.org/hacknorris/tux-update-cogged
(that flask thingy to keep uptime on replit when it was still free)
YES
still not much
Extensions, soheab
only two changes for extensions
You shouldn't
Yeah not recommended
everyone does that
Doesn't mean its the right thing to do
no?
A lot of people do, and a lot of people blindly copy paste from YouTube mouth breathers without reading docs
everyone = you and the other person
how you did await without def?
or just use setup_hook
you did :(
Doesn't excuse bad bot structure. If you're having issues with something, ask for help
why do you need to make it global
i also always make globals tbh…
basic = "python"
print(basic) # python
basic = "learn it"
print(basic) # learn it
def change_basic():
basic = "please!"
change_basic()
print(basic) # please!

all of this fool proof to make it not run a second time can just be bring to setup_hook
that thing actually is a useful thing…
Could even do it with advanced setup by starting the event loop yourself and then loading extensions, setup_hook isn't the only way but repeatedly checking some bool at random intervals for the entire lifecycle of the bot ain't the play
💀
You definitely do not need to be making so many global variables
sometimes it's required to keep actual status
especially when you can assign attrs to the bot instance
It's never required
bot instance can store state too
It's a crutch for not making proper use of objects
No it's not, a global variable is probably the worst thing you could use for that
c programmer
I made shitloads of globals when I was starting in python because it's what you get when you Google stuff like "share value in python" and it's "intuitive"
same
And the subtext there is that you think it works until it doesn't, and you have no idea why
and now at me stopped working due to @#%#^@$^$% discord.py
when the problem is yours but you want to blame others
no because earlier it was working without problems…
oh no! changes!
Discord discontinued the backing api. It's not the library's fault
welcome to being a dev ig
And you can't reasonably expect a service to promise upholding every version of an api they ever published for perpetuity
i like to make things i can write, have it written and it will always work same
yeah and youre making like a literature book or something
Then you'll need to adjust your expectations when the thing you build is on top of a live service you don't control
we can say "fuck" here btw
i built on top of discord.py which is a lib
that's a crazy standard, you shouldn't be expecting that if you're using an external service
Which is just a wrapper over the discord api
whats the "backing api" 
should just tell bro to write his own discord
yeah pull off an andrew tate
once been helping in making alternative but it failed
one of the problems is too much vulnerabilities since you dont want to update it
andrew tate is a cutie patootie
i mostly run it for myself and if there was a token it was resetted n times…
@quick gust the hackers spammed the emoji picker on every guild with emoji messages like that
deserved
solstice pls
dpy hits a version of discord's api, discord discontinued the version of the api that dpy 1.x used
wait soooo
OP's using like a 3yo version
and then complaining that it doesnt work anymore?
4*
i know i was writing this when covid started, yea
It would be nice if apis worked eternally but that's just not practical and would severely limit dev velocity
so next project to trash, okay…
I mean if you throw it away that quickly without even looking at the migration guide, you really didn't care about it
i cared when i was working on it
what do you need that bool for
Not sure why you're wasting time changing everything but what we're telling you matters
You don't want to use on_ready
You might as well make a loop that runs at random intervals
you don't need on_ready, use setup_hook as we have saiid multiple times.. it's not that hard..
# subclass of commands.Bot called MyBot
class MyBot(commands.Bot):
# override setup_hook to do stuff
async def setup_hook(self) -> None:
# load extension(s)
await self.load_extension(...)
# create instance of MyBot called bot
bot = MyBot(
command_prefix=...,
intents=...,
activity=...,
status=...
)
# run bot
bot.run(...)
no attrs or globals bs needed when you know its only called once
Major XY problem
why do you want to use on_ready?
who is forcing you to use an event that can be called multiple times at runtime and is generally not recommended for doing any sort of api calls in
You will accomplish your actual goal if you listen to us telling you the right solution instead of deciding you already know the solution
question ?
I been trying to make my own app but it needs AI and I'm too poor to pay, would it work worth it if I use discords bots that already have to fix this issue ?
wdym by "it needs ai"?
trying to make a app that that uses AI for live reaction on gameplay and also be able to generate models like stuff for blender
cant you also just have setup_hook as an event?
or is that just "it's better to just subclass atp"

pretty sure you can, although it's not the intended use
@bot.event literally calls setattr so yes that would work but no
does it not just bind it to the bot
yeah thats what i thought
still doesn't make it an event
something that happens to work but shouldn't be used because it'll stop working and you'll be clueless
it'll be lovely to see that break in 3.0 maybe
question ?
If i want to add a free AI to a discord bot would it be better to make my own ?
any suggestions would be much appreciated.
You may want to review the discord dev policy and tos before you get too deep into that
would it better to add a bot that already has AI to work with my bot or should I review the discord policy and make my own based around that
You should read the things you have agreed to before you do anything
To save you a little time, it's against policy for any AI model to be trained off of user content, and it's against TOS to send any user content to a third party without that user's explicit instruction to do so
Or just read it yourself
We are not lawyer or at least not your lawyer(at least I assume)
And out interpretation might not be correct
We said it multiple time
It might get executed, it might never get executed and it can execute at multiple time randomly
Because there is a specific place (multiple actually) that definitively run once. You are choosing not to use them, for no reason, and instead choosing a place that runs randomly so you can check a boolean flag thousands of times
Spent time achieving something which is achievable with just moving it to setup_hook
Crazy work
Willingly be stunlocked, while they try to make a better bait i already watched 10 youtube videos
Using on_ready here is like
did_the_thing =False
while True:
if not did_the_thing:
do_the_thing()
did_the_thing = True
We're telling you to
do_the_thing()
Your definition of ready should not be when on_ready executes (read up on when it does here: https://discordpy.readthedocs.io/en/stable/api.html?highlight=setup_hook#discord.on_ready ).
Even if it is, most set-up steps can and are intended to be done in setup_hook.
If setup_hook is defined, the bot will call it after logging in, and crucially, exactly once for the entire duration of the bot uptime thereafter, and before any event or other action that has to do with Discord. Just don't make an API call and don't wait on Discord related events in it so you won't hang forever trying to.
There are counter arguments against using on_ready to set your bot up, but to sum it up if you're lazy to read and comprehend the docs I shared up above, just understand that this event can fire too late, leading to problems such as relying on unset state and thus raise exceptions, and that it gets fired upon every reconnect, leading to problems such as resetting/unsetting existing important state which will lead to similar exceptions or even deadlocks because you'd be relying on an event incorrectly.
With setup_hook you deal with none of this headache for the price of being unable to rely on Discord data and events for setting things up. Loading extensions/cogs in setup_hook is better unless some part of doing so requires Discord data or events, which is quite cursed in itself but whatever.
It'd be better for users to have most if not all of the functionality of the bot and its foundation fully working as soon as it goes responsive rather than deal with a waking bot with some of the functionality half ready (could lead to bad state too in this timeframe) every single time it goes online again after maintenance or arbitrary and unexpected downtimes.
You can use an asyncio task if you need to do blocking calls in setup_hook and optional even wait until ready in one them for cache:
async def on_ready_once(self):
await self.wait_until_ready()
...
async def setup_hook(self):
asyncio.create_task(self.on_ready_once())
if it works don't touch it
the code:
def is_even(x):
if x == 0:
return True
elif x == 1:
return False
elif x == 2:
return True
elif x == 3:
return False
...
💀
let it recursively call itself by minusing two for each call and catching 0 and 1
bonus points for inefficiency by using it with negative numbers
Use enumerate to generate the python code :D
wait will that even work lol
def custom_enum(iterable, start=0):
count = start -1
odd = True
for item in iterable:
count += 1
if not odd:
yield count, item,odd
odd = True
else:
yield count, item, odd
odd = False
for i, item, value in custom_enum(range(5)):
print(f'if x == {i}: return {value}')
It works and I did it on mobile :P so we dont talk about the indent lol
just use % 2 == 0 😭
no bro you don't understand
obviously generating a 16 million line python script just to make a bunch of if statements is best practice
1 million lines of amazing code
How test it.
Set N1 == 578 and N2 = 666
How long it take.
That's my kinda hyperfixation task.
what is going on here
oh brother it will show result maybe after 15 minutes
Anyone know a good place to find python videos specific to discord bots? I drive alot and like to listen to them while on the road to learn but having trouble finding ones specific to discord bot making
No real need for advanced videos as I'm beginner level
Don't watch videos to learn. Read docs and articles
Can't do that while driving. Either podcasts or videos.
Been slowly working my way through docs at home. But I spend most of my time on the road.
Text to speech exists
More importantly, driving safe is what you should focus on
No less safe than listening to the radio....
But coding is the sort of thing that benefits massively from being able to experiment alongside what you're learning. It's not the sort of thing most people can passively consume and just remember
Yes. But this is not intended to be my sole way of learning. Just to fill gaps during down time when I can't sit on my PC and dedicate my full attention to it. Things that will talk about concepts and use cases for things I may already have a grasp of. I feel the question has started being pulled away from the original context.
is it possible to get a guild that the bot isn't in, i'm not looking for much just member counts and simple stuff like that
No, all you get is what's on the guild preview if it has one
You're probably going to struggle a lot finding this content, there's not a lot of great content for discord bot in general. And pretty much everything I have seen pretty much requires a visual element.
You would be better of learning python in general, or maybe long form stuff on async
How can i get random video from tiktok with specific tag than send it to specific channel
check if tiktok has a public API
Are you planning on making a bot from scratch or using a library?
I agree with what midget said above. Discord Bots are not a deep enough topic to have more than a little bit of podcast style content.
The core things they use are APIs, rate limits, web socket connections, event handling, and sometimes databases. None of these things are specific to discord bots but can be explored individually
I would like to be able to make one from scratch if needed but I would use libraries for handling specific things like ui elements . But like I said before I am a beginner . I know the basics of python. But I am using discord bot as a way to learn how to use it. And how to learn working with api's and libraries. Possibly how to handle info that would be saved based on the user ( like coin flip game that saves how much money you have ) these things I can look up individually and learn as people have suggested. And I do intend to as I get the time. But until I get the chance to sit down at my PC I would like something I could listen to.
Should I be using pytz or zoneinfo for timezone objects?
I want to keep track of a specific time zone including DST
I don't see why you wouldn't use the stdlib over a package
Wrong indefinite article
?
I said wrong indefinite article Ibn kalb
my bad
Which one is more recommended discord.js or discord.py, for speed and feature richness ?
djs for speed and dpy for features IMO
But these are two different languages
Also there are more python libraries than just dpy btw
Actually I used to use dpy some 2 3 years ago now I am learning js for work and stuff so I have been pondering over options.
Also djs has some reputation for consistency which discord.py has lost over past years. (thats what google says)
Isn't it the opposite?
I heard that djs often changes things in minor version bumps
Sure dpy has been "slow" lately but that's also because it's maintained one person vs a whole team
I heard that dpy was discontinued and then people started exploring other alternatives and then it was reinstigated.
I wonder why don't they add more members to the core team, I am sure many might be willing to contribute.
This was several years ago, and discord loves parroting old Reddit posts
Yes it was discontinued for ~6 months and continued when there were no good alternatives according to the maintainer
For more information, see:
[2021-8-28] Danny stops dpy development: https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1
[2022-3-06] Danny starts dpy development again, after announcement of v10: https://gist.github.com/Rapptz/c4324f17a80c94776832430007ad40e6
Not sure either
Also "speed" requires a little more nuance here, as in 99.9% of cases this is imperceptible on the order of fractions of seconds. It really doesn't matter
Unless your discord bot is a wrapper over like low level hardware architecture somehow
Old does not really matter. That event will be relevant to people choosing a library for many more years.
O...kay?
People are welcome to use whatever criteria they want, doesnt mean they're good criteria
g
Use a database
Also why?
cuz i want like anti spam system so if mesages same it would delete mesage before and how to use database im new
-# Note 1: It would be better to use any well established product than implement it by just yourself. For example, if my first message and second message have a single (a space character) difference, it won't get deleted. Or if a user send Hi 30 days apart, it's considered spam.
-# Note 2: If you are new, you shouldn't take discord bot as a first project. It is the most often told and most often ignored advice
You would have to learn SQL
no i meant not to python but python bots
?
So what is OOP, async?
Function?
How much do you know about function?
Anyway, you should still:
- learn about OOP
- Read at least 1 or 2 article about async
- Learn SQL
- Learn more about function
- Learn how to use a async library for database with SQL in python
- Read the tutorial on how to create a bot in discord.py documentation
okay thanks
can be prevented by checking send date of both msgs but @hollow yacht dc itself prevents spamming and if someone still manages to spam smh then put the server's mods to work lol
This assume you know the existence of both messages
Which mean you still need a database
And if you're storing message content, you'll want to read the TOS closely on what your obligations are
Regardless, you should still read the ToS closely
Just use a cache, no need for a database if you are detecting spam.
guys
I am trying to make a discord wrapper from scratch. I am having problems with websockets handling
I wanted to make a custom wrapper just for me and learn as well. Anyone here have experience with websockets library?
particularly 1006 error code (Abnormal close)
Have you managed to establish websocket connection that isn't to discord? (Like just any, maybe your code communicating with your code)
how do i fix this python error C:\Users\Administrator\Desktop\Boost Bot V3 SRC\main.py:293: SyntaxWarning: invalid escape sequence '['
os.system("clear && printf '[3J'")
C:\Users\Administrator\Desktop\ Bot V3 SRC\main.py:315: SyntaxWarning: invalid escape sequence '\ '
/\ == \ /\ \ /\ \ /\ \ /_ \ /\ == \ /\ \ /
C:\Users\Administrator\Desktop\ Bot V3 SRC\main.py:564: SyntaxWarning: invalid escape sequence '\ '
/\ == \ /\ \ /\ \ /\ \ /_ \ /\ == \ /\ \ /
there is a invalid excape sequence
how do i fix that? im pretty sure thats easy for a coder. Im not a coder
whats the context of that line
why do you have a bunch of backslashes and slashes and dashes
i didn't code it
you should make it a raw string. The backslash has a special meaning
r"this is a raw string"
where do i input that
but its hard to tell whats going on in that line
could you call for 2 seconds
line 315 and 564
ill share my screen for second
you can send a screenshot
If you're not a coder, are you just hoping we'll fix it for you?
im askinf for help
calm the heck down lol
Nice projection
Can you send a screenshot of what's around those two lines?
which line
before the quotes
on 320?
print("\033[95m")
print("""
LOGIN PAGE
""")
print("\033[0m") # Reset color
on one of these correct?
The reason why you're getting an error is because python is trying to use the bacsklash in your ascii art as an escape character, but it's not valid. To make python ignore backslashes as being special inside of a string, you make it a raw string. So you prefix the string with an r
"i am a string"
r"i am a raw string"
r"""
I am also a raw string
"""
What is the string i don't know anything about python, im just wondering if you could inform me on what line to input that in.
strings are sequences of characters
like words, letters, sentences
it's a fundamental type
You know it's a string if it's surrounded by quotes
would i input it on 294 or 321
Line 321 is fine. The stuff you see inside of that string tells the terminal to display text that comes after it in a certain colour
or to remove the colour in that case
your errors are on line 315 and 564
so go to the two strings that are on those lines and prefix them with an r
the r should go before the first quote
I'm sure you already know this, but it's not a good idea to run code from untrusted sources if you don't know what it does
yea im running it on a vps to be a little extra safe i appreacite that advice though
did i do that right lol
would you be able to input it if i copy and pasted the code please
the code went red when i did that
They want you to paste the correct code so they can copy it, they don't know how to code and they said that
and you have another error on line 293 it seems. Not sure what's supposed to be there though. It's an ansi escape code for colour formatting so you could remove it and it would work fine
!e
r"""
test
"""
:warning: Your 3.13 eval job has completed with return code 0.
[No output]
no im running python 3.11
!e
r """
test
"""
:x: Your 3.13 eval job has completed with return code 1.
001 | File [35m"/home/main.py"[0m, line [35m1[0m
002 | r [1;31m"""[0m
003 | [1;31m^^^[0m
004 | [1;35mSyntaxError[0m: [35minvalid syntax[0m
give it a go
doesn't that mean its a error? when it turns red
don't trust whether it turns red or not. Yes, it's supposed to help you spot syntax errors but if you haven't configured your code editor then I wouldn't trust it
the real test is to just run the code and see if the interpreter spits out an error
print("\033[95m")
print("""
/\ == \ /\ __ \ /\ __ \ /\ \ /_ \ /\ == \ /\ __ \ /_ \
\ \ < \ \ /\ \ \ \ /\ \ \ _ \ //\ / \ \ __< \ \ /\ \ //\ /
\ _\ \ _\ \ _\ /_\ \ _\ \ _\ \ _\ \ _\
// // // // // // // /_/
LOGIN PAGE
""")
print("\033[0m") # Reset color
it says error on 315 and 321
anyway you could just input it bro im like a toddler learning to speak when it comes to coding.
yes but you won't learn if I do it for you
did you save the files? I feel like you modified these lines already? Or was that a different line?
yes i saved it ctrl s
that was a differnt line i didn't touch those yet because i don't know what im doing
i have to leave for work in 30 minutes im just trying to get this running
you do know. I explained to you how to find what line the error is on, and you already fixed a couple of these successfully
If you want someone to fix it without you showing any effort to learn, you should hire someone or go to whoever wrote this code
it's the same thing over :)
bro im trying to learn i just don't understand lol
im trying to understand what he is saying i don't though
you need to make it a raw string again
so how are you gonna tell me im not trying like get a life and quit spectating discord chats buddy
because the backslashes are treated as special characters (which you don't want in this case)
You need to have fundamental python knowledge to make these changes. There isn't a shortcut
I can reiterate if you tell me what you're confused about
Okay im confused about a string like is it the print?
print is a function which takes a string. The string is everything that's wrapped in quotes
i mean there is for sure a shortcut if you can get some help i understand you don't like helping but thats not my problem keep it moving bud.
I'm not going to be silenced by you
💀 anyways....
okay i think i understand that so /033 would be the string since its wrapped it qoutes here?

