#development
1 messages · Page 1973 of 1
idk, but im just annoyed rn since my bot is full, ppl can't use it
and most likely after waiting for a few weeks ill be told no since it grew to fast
shows up when you add them
on the invite page correct?
it is a recent changes
ah okay
i think
people will go far to get a badge
good change
in some ways it's actually smart
then they deserve it
good and bad
my friend was offered $1.4k for their account just for the badge
too complicated for devs who do this just as a hobby
this though, im already annoyed since I know its going to happen
verification is just so discord can say "yeah you can have x, y, and z"
no its not
not so you can feel special because you have a blue badge and torture yourself writing html
make your bot sucks so that it will grow "organically"
most servers do not trust unverified bots
Yeah, its like the most scuffed thing ever
"show growth, but not fast growth"
since fast growth is bad how?
it used to be for the badge abuse
thats why the badge is limited
no, its not to limit submitting since they tell you weeks after you apply
ppl abusing the system as always
there is no badge to be earned
like, do I really have to slow down growing my bot to be verified
some ppl say they can change the ppl who review the bot by emailing them again, but some dont
yeah, and wait another few weeks whilst no one can use your bot
it can effectively kill all growth
thats why you should make your bot sucks, so it will grow to the point that dsc approves it, then you make the changes
if it sucks, you can not get in 100 servers
👀 can you still request a 250 guild cap?
you serious or joking
half
sounds like your issue with the system is discords reply time more than anything else
Yeah
I'd have no issue if it took them 2 days to say something about the bot
but no, they stop you from growing
and you may end up waiting 3 months
it basically kills your bot's best window of becoming popular
^^
you work hard to grow it to the number needed to apply
and your shut down.
I disagree with that tbh
because after those 2-3+ weeks your bot's initial popularity will fade away
I hit the 100 today, ive had 8 server owners join my discord and leave since they can not add it
and after that good luck promoting it
when is your bot submitted?
I would agree with that, if you are talking about something like a video game.
I dont think that applies for bots
when you enter a new server, ppl see it and add it to their servers
if you have a time where no one can add it, there is no one seeing it after that
today.
it really does though
lmao dsc be like
otherwise, get verified kick all the servers your bot is in and restart lol
I got a lot of steam going for my bot
and now its artificially stopped
no
I applied today
how many server that you got this week
you cannot reapply just to get more servers.
which I think is stupid, as all the servers it is in are real
then how does getting verified, kicking all servers, and restarting work
unless you mean something else
thats a silly idea
the argument you all seem to suggest is that starting from zero is easier than starting with 100
yes, wipe away all progress since thatll stop you loosing your progress for them taking super long to accept/deny
(after verification)
I dont think bots, on a small scale have any steam
probably best not to leak private information
yeah, forgot user IDs are in that
yeah and the photo is stuck in my browser
client mods banned
/j
well, you get the point

rn I keep having ppl join my discord, try to invite, and then leave
you could try promoting it later
I think I'm on a different page than you. The process right now goes:
Develop bot > publish on top.gg > get popular > hit 100 server limit > wait 3+ weeks for discord to verify > initial popularity has died, now you're stuck
compare this with the traditional path:
Develop bot > publish on top.gg > get popular > after some time, popularity wears down and you have the boost top.gg gave you
As such, Discord is practically kneecapping bots at 100 servers, killing their chance of becoming popular. Steam's process would be more like the second one. I don't understand why you two are fine with such an abysmal system.
cant you just use auctions and promote it as usual?
That requires money, and this is just initial popularity after being added.
vote credits
I got into a server, and he got all his owner friends to add it
I only got verified on top.gg yesterday, after my bot was already in like 70 servers
Vote credits are hard to earn, they won't help you much
Vote credits as in regular votes?
100 votes = $15 credit
Vote credits are auctions credits gained from monthly votes
the point still stands
Discord ruins the growth bots have by making them wait a few weeks to keep growing
First 100 monthly votes gives you $15 worth of auction credits, after that, every 1000 votes is $1
Because you could've gotten many more vote credits if your bot hadn't been kneecapped at 100
So yea, it doesn't help much
true but thats an alternative to promote your bot due to discord verification system
just gotta deal with it ig
My bot is a moderation bot that is not seen often, and requires basically no action from admins to work, how would I get votes from that?
The issue still stands of growing a bot, and getting popular only for it to be toppled by a 100 server limit.
My bot's confirmation form didn't go
Like, imagine if GitHub published recently created repositories for exposure but after 50 stars required a 3+ week long verification process. By the end of it, your repo's out of trending and you're stuck at 50 when you could've had 500. It's like a dunning kruger graph except instead of a gradual decline you straight up stop for 3 weeks.
trust me you dont need vote only commands to get votes, if you bot is that useful ppl will vote it anyway if there is an option to
The problem here is attention, people seeing the bot and adding it, and interacting with and supporting it in various ways, people won't be able to vote your bot if it doesn't even get attention to be seen and acknowledged
like
today I had 3 servers announce my bot since they like it a lot
but it cant do anything as it is full
EXACTLY
my bot rarely does anything that someone other then a staff member would notice
even then, its rare when a staff member is using it
After the bot is out of the trending cycle, it's basically soft-locked in most cases, as the Discord server limit for the verification clause would block more and more growth of the bot, which will lead to unpopularity and demise of the bot
so your bot is a moderation bot? @elder jewel
basically this
kind of, it only handles moderation of links
yep
I feel bad for the devs who go through this every day
and then you add on top
"your bot has grown too quickly, try to apply in 3 weeks"
after waiting however long
no wonder ppl make multipurpose bot since they knew this was going to happen
then you face another issue
if your bot does too much, people will not trust it if it needs certain permissions
since its not verified
what error?
Like, Discord could at least revoke intents but still allow bots to grow until it's verified.
bot not having perms
wdym??
It doesn't completely stop malicious bots, but is an improvement.
Im saying, if the bot needs certain perms to work, people will not trust it
or just limit it
Nah, straight up revoke it until verified.
they could just disable the perms if they dont trust it
that's what they want
lmapo
a bot without the perms its need is useless
daff the issue is users won't trust unverified bots compared to verified bots
this
but people could disable specific perms upon adding the bot
A user would rather not invite it.
^
thats not the bot's problem then
Yes
Yes it is
it literally is
That's one less server.
No servers add it since it is not verified
but you cant get verified unless servers add it
The trust in bots have significantly diverged since the verification process was introduced, which adds even more problems to the table of problems, piling up the cesspool of problems which can lead to the demise of the bot
My bot literally needs
• manage messages
• send messages
• embed messages
and people still have lots of trouble trusting it
Most Discord users aren't understanding of these problems and the ways they handle things, which is the cause of it
^
then the problem is in the users
then it is your problem not discord?
there is probably hundreds of people with good intentions, and a great bot who will never make it since they cant grow
well this issue was known long ago and there havent been any improvements, so you just gotta suck it up and deal with it ig
That's such a terrible response
literally nothing can be done
"Oh, this platform is still screwing you and hundreds of other small bots over? Just suck it up"
This is what's wrong with the process
sounds like something a politician would say on any complicated issue
pull yourself up by those bootstraps
ppl complaint for a long time and discord doesnt improve it, do you think they will improve it now?
thats what im saying
thats true
The problems now differ, in the old times where these problems (or at least most of it) didn't exist, these bots were easily able to obtain the popularity they were seeking for, after the verification process was introduced, Discord users are less likely to use unverified bots, and trust them in any way, which just kills the goal of the bot, and it's ways to overcome these problems and adapt to the current "meta" of how these things work, Discord server limit, intents, permission issues, concerned users, and much much more
yes
And the queue times being in the way, and all of that, and the ways to promote the bot just significantly reduces by a shit ton
its not only the queue time, its them saying after youve waited "No, youve grown to quickly, try again later"
like, with this logic you can stop a bot from getting verified by announcing it in a large server
how is the developer supposed to regulate how fast it grows
The way they handle "suspicious growth" is outright incorrect, they've even automated it, to check how fast it is being added to servers, which the suspicious growth is just the killing hammer for the bot and it's popularity
THIS ^
today I gained like 20 servers in a hour or two, nothing I did caused it
now im probably going to get screwed
:/
The current verification system is the main reason I have gone away from maintaining public bots in the first place
same
ive been waiting a day, and Im already highly annoyed at it
How can someone be sooo true
how do i make a vote reminder like this?
i use djs fyi btw
you can use redis (easy approach)
you can use any db you like and keep checking every few minutes if the time ran out
Start by making a vote api (see docs https://docs.top.gg/libraries/javascript/#webhooks)
Save the time along with user id
Check every few minutes if the time for vote ran out
If time ran out then dm the user and delete the entry from db
vote api docs?
also thanks
This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.
If you need help with development about your bot or development in general, feel free to use #development.
I've put the link now
sorry
How can I edit an existing Field?
embed.setFields()
how does the setFields property work?
I wanted to change an existing field:
embed = embed.setFields([`Size`, 'value'])
but it gives me an MessageEmbed-fields-must-be-non-empty-strings error
I don't think setFields() is valid?
ey can u help?
this
It is but I’m basically doing the things myself, it always has been like this, so it’s just another kind of experience to gather
I’m actually really optimistic how it already looks and feels
It’s the first time ever I’m working with a css framework and I pretty much like it
At least now I got some predefined structures and don’t need to design anything myself, except the fact I’m still typing each line code myself
How can I create a channel in a category?
This doesnt work for me - setParent() is not a function
let channel = inter.guild.channels.create('new-general', { type: 'text' })
channel.setParent(category.id)
"nuke the entire earth so we won't have any more bad guys"
- basically discord
let channel = inter.guild.channels.create('new-general', { type: 'text' , parent: 'ID'})
await inter.guild...
I have this code, so if the array already includes a value, it will remove that from the array and update a mongoDB schema Code: ```js
if(response.disabledCmds.includes(value)) {
console.log('includes')
await guildSchema.findOneAndUpdate(
{
guildId: guild.id
},
{
blacklistRole: response.disabledCmds.remove(value)
}
);
console.log(response.disabledCmds.remove(value));
return true;
}``` on the console, it shows ```
includes
[]``` but after it updated the schema, the exact same array is still there. Any solutions?
Tim, I have a question on await continuing to last time.
const user = message.mentions.members.first() || await bot.users.fetch(args[0]).catch(() => {});
console.log(user.user.username);
````TypeError: Cannot read properties of undefined (reading 'username')`
This is returning an error when I input an ID like `!bugreview 342963104306429954`.
message.mentions.members.first is a Member
members have member.user
bot.users.fetch is a User
there is no user.user
Oh, damn.
what is response.disabledCmds? what type of object is it?
array
arrays dont have .remove()
Array.prototype.remove = function() {
var what, a = arguments, L = a.length, ax;
while (L && this.length) {
what = a[--L];
while ((ax = this.indexOf(what)) !== -1) {
this.splice(ax, 1);
}
}
return this;
}```
it would give me an error if remove was undefined right?
- when i console.log the array with removing the value it gives an empty array, so without the removed value cause i removed that element
That's inorganic not suspicious.
Inorganic imo is handled the right way
anyone?
If I have 1 route f.e. /api/items and I want to be able to create, get, update etc. on it and everything just depends on the request method. But let's say if I want to only get them. I heard that you shouldn't put important body (which changes the output) into the request when making a get request. How do I do it then? Make an extra param?
I could also make:
api/get/items
api/post/items
and so on
@rustic nova
russian this time lmao
wdym important body?
like if you want to put the item you want to request in the body?
theres nothing preventing you from doing that
its just not semantically correct
but you're free to do it
oh okay
if you want to be semantically correct, a GET request should have all its data in the url, either in the path or in query params
because then my thing would be much simpler xD just change request method and the params etc.
to send a body, a POST request should be used, even if its only used to retrieve data
but theres nothing stopping you from sending GET requests with a body
okay alright thank you Tim^^
the only possible issue you might run into is that if someone uses a very strict http library that does not allow sending body with GET requests, they will have issues using your api unless they change their library or do the request manually
well it's not a public api but yes that's true I already had such a problem once and that's why I even asked
for my discord bot i was given these intructions to set up the api could you explain it a bit more fr me
"{}To find your API key:\n"
"**1.** Login on Top.gg <https://top.gg/login>\n"
"**2.** Go on your profile <https://top.gg/me>\n"
"**3.** Click on `Edit` on one of your bot.\n"
"**4.** Scroll to the bottom of the edit page, in `API Options` section, "
"then click on `Show token` and copy the token.\n"
"**5.** Use in DM `[p]set api dbl api_key your_api_key_here`\n"
"**6.** There you go! You can now use DblTools cog."
)```
it is a bit outdated
edit page > webhooks > token for this bot
how to remove the webhook url box and authy box
i have contents in box when i try to remove it dosent let me
0|attitude | Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
0|attitude | at Timeout.onTimeout (/root/bot/node_modules/discord.js/src/sharding/Shard.js:166:16)
0|attitude | at listOnTimeout (node:internal/timers:559:17)
0|attitude | at processTimers (node:internal/timers:502:7) {
0|attitude | [Symbol(code)]: 'SHARDING_READY_TIMEOUT'
0|attitude | }
This error keeps coming up, along with this one. https://srcb.in/LvMS3vbeW5
Am I doing something wrong, it keeps crashing my public bot.
personally I would increase the timeout
How, so?
I read an online github issue, didn't understand what they meant by timeout?
require('dotenv').config();
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./src/index.js', { token: process.env.TOKEN, totalShards: 'auto' });
manager.on('shardCreate', shard => {
console.log(`[SHARDS]: Launched shard ${shard.id}`)
});
manager.spawn();
the timeout means if it takes too long to be ready it will fail.
increasing the timeout increases the time before it fails
What's the default timeout?
15 seconds iirc
How can I know how long it will take mine?
My bot is in 1,000 servers, supposedly.
What should I be putting each parameter?
https://discord.js.org/#/docs/discord.js/stable/typedef/MultipleShardSpawnOptions
I would increase delay to 10000 and timeout to 60000
seems the default is 30 seconds, which is strange to have it take so long for a bot with 1000 servers.
Like this, correct?
manager.spawn({ delay: 10000, timeout: 30000 });
yep!
I don't understand, yet, the difference between them. I have read the documentation but what, does it take time to spawn each shard?
pushing this to the top as it is slowly getting left behind
like for the topgg webhook?
on the webhook section
there are 3 boxes one is a url box the other an authy and the other a token
how do i remove the contents in the authy and url box
Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
I dont think they can be empty once you place something there.
I would set the url to something useless.
such as http://0.0.0.0/ and test
Good morning
When trying to delete a channel via another method, I get this error:
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown Channel
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
at async TextChannel.delete (/home/container/node_modules/discord.js/src/structures/GuildChannel.js:547:5) {
method: 'delete',
path: '/channels/939911034708299936',
code: 10003,
httpStatus: 404,
requestData: { json: undefined, files: [] }
}
To prevent this I have this statement:
if (interaction.channel != undefined) {
interaction.channel.delete();
}
However the error still persists. Would I have to add a .catch statement to prevent this or is the code I have sufficient?
might want to just catch because the channel could be deleted before your cache gets updated or something on Discord's end happen because lol Discord isn't so stable
also, what you want to check for is Channel.deleted
also don't need to specify != undefined. undefined, null, "" all lead to falsy values
Earlier versions of node do not support optional chaining
Try doing that in the middle of production without a fallback server
delete is undefined
ah nvm.
missed the object brackets
I just woke up
Other people probably find that haha funny and don't care, but I care
Would appreciate not insulting my skills
Some one quite familiar with the npm package nanoid? Whenever I'm using it I'm feeling quite scary because it says the strings are unique but my question is how they did it? You can do something with timestamp + crypto and then it's unique for sure but still... Is it better to check for uniqueness?
The ID is just randomly generated.
but also unique
It is using crypto internally to generate "pseudorandom data"
You can increment specific portions of the string to make sure everything is unique always
with my custom Alphabet this got calculated xD This really let's me feel better everytime but I'm curious lol
I'd argue the point of nanoid is not to make collisions next to impossible, but to make generating IDs more convenient than the alternative (i.e. uuid). The collision rate is negligible, and even if there was one, there's a good chance the format you're storing it in will block collisions (e.g. database).
That range is huge though. I'd suggest something smaller, like 4-8 characters.
Guids can't even collide if you use the default time based guid.
Is it smart to write a file, upload it and delete it then?
let data = ''
messageCollection.forEach(msg => {
data += msg.author.tag + ': ' + msg.content + '\n'
})
await fs.writeFile("transcript.txt", data, (err) => {
if (err) { console.log(err) } else {
console.log('file written successfully')
let file = new Discord.MessageAttachment('./transcript.txt')
if (file) inter.channel.send({
files: [file]
}).then(() => {
fs.unlink('./transcript.txt', (err) => {
if (err) { console.log(err) } else {
console.log('file unlinked successfully')
}
})
})
}
})
Or is there a better solution?
Nah
I'm pretty sure you can store it in memory as a buffer.
Like Buffer.from(data, "utf8") and add it as a value in files: [...]
when you have to watch a 1 and a half minute ad to vote
They're still doing that? I thought they canceled that.
I guess not
anyone know ab express?
i’m trying to redirect /e:id to /cdn/embed:id
how can i achieve this? i tried res.redirect(“/cdn/embed/${req.params.id}”) but it didn’t work
wdym didnt work
nvm i got it to work i didnt do /:id instead of :id which was a dumb mistake
I wanna upload a txt file but this here uploads a png file. How can I change the file type?
data = 'just a string'
let file = new Discord.MessageAttachment(Buffer.from(data))
if (file) inter.channel.send({
files: [file]
})
you can give it a file name
how?
by following this structure https://discord.js.org/#/docs/discord.js/stable/typedef/FileOptions
so instead of files: [...] you go files: [{...}]
it's just metadata an app provides for itself
has no effect on the page. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
not really
okay good
if a scraper can figure out what it means they can find it useful
Has anyone an Solution? No error comes in the Console.
The Bot only want to edit the Message.
I cannot send an Embed without the "MANAGE_MESSAGES" Permission. Idk why
Without "MANAGE_MESSAGES" Permission
https://uploadi.ng/52csd5Wq
With "MANAGE_MESSAGES" Permission
https://cdn.upload.systems/uploads/owr2L5b4.png
(JDA)
You should only need Send Embeds to send an embed.
embed links are the embeds when you post a link
also applies for embeds sent by bots
jep. This Permission has my Bot.
i love when my permission has my bot
?
probably still named that
meant to say that
My Bot has the Perm
but when i removing him the MANAGE_MESSAGES its not working.
Other Embed working. But in this one Command not.
whenever i send a command fthrough my bot it sends the response twice
sounds like you may be running the bot twice
this is the code (its python)
`` import discord
import os
from keep_alive import keep_alive
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('.hello'):
await message.channel.send('Hello!')
if message.content.startswith('man i really want to listen to roblox horror music'):
await message.channel.send('https://www.youtube.com/watch?v=kpeMpyG-ryE'')
keep_alive()
client.run(os.getenv('token'))
my_secret = os.environ['token']``
will startswith even work for that second one
yeah its worked for the past few days
mmm
epic is probably right. there is probably a ghost process running
You might have a double instance of the bot running other then that I see no reason why it'd respond twice
typically thats what happens
Doesn't matter if you restart it, there will still be that ghost process
check the process manager. are you using windows or linux?
is retaining Prometheus data for a year actually viable? 👀
idk seems legit to me
looks like a breaking change to me
why is go syntax so quirky
cause ur quirky
syntax looks fine imo
apl looks cool though
The square brackets before the type... return type right after arguments (no delimiter like most languages with return type after args), tuple not wrapped in parentheses. Not saying it's bad but
it makes you wonder
please tell me that's not valid apl
very valid
wtf is that
apl
it looks bad
I wouldn't
for people who want to roleplay being a scribe in 2000 BC in ancient egypt
Looks like i'd go through a mental meltdown trying to make sense of it
Do you want to roleplay being a scribe in 2000 BC ancient egypt?
this is another insane one https://en.wikipedia.org/wiki/K_(programming_language)
K is a proprietary array processing programming language developed by Arthur Whitney and commercialized by Kx Systems. The language serves as the foundation for kdb+, an in-memory, column-based database, and other related financial products. The language, originally developed in 1993, is a variant of APL and contains elements of Scheme. Advocate...
The function below can be used to list all of the prime numbers between 1 and R with:
2_&{&/x!/:2_!x}'!R
I know someone who uses both of these languages to solve coding challenges, actually cracked
ah yes very concise
they're not even joke/esoteric languages like brainfuck
just a very different paradigm
that you'll actually find in production systems
array-oriented
is that the same as stack oriented
forth is like the most sane of these languages
every other one I've seen is some alien hieroglyph
like J lmfao
2!!7!4
Why did these people thought that this would be a good idea? I'm curious what the thought process was? Functional languages are nice, but should be readable. I don't get it. Unless there are some major space restrictions where the source code must be as small as possible
But that lang was made in '93
this isn't functional
https://learnxinyminutes.com/docs/forth/ this kind of explains the concept
in the most readable way
all the other languages are some kind of extreme end of this idea
Might as well just write python bytecode by hand
well yeah forth is meant to be an assembly
low level but more readable imo
tho I've never written assembly so I don't know
Hey uh im new to sequelize and im struggling a lot
i dont know what im doing wrong but nothing is working anymore
Im using discord.js, sequelize and mariadb
If anyone knows how to help, please lmk
We cannot help you if you don't tell us what is wrong and show the error & code
ive only been working with discord.js and javascript in general for about a week
functions is in the main folder and warn is in the command folder
hence the ../ on the import
im having trouble with my "guildTableCreate" function
it doesnt seem to be creating anything. When i create and then try to fetch it, it just outputs "null"
my userTableCreate function works fine so this is giving me a headache
Here's my entire bot
console output when doing warn command
if (guildtable.get('maxinfractions') <= 1) {
the null in bold here is where i try to print guildtable
think i may know the problem
any operations performed on the database such as guildtable.get take time to complete
so you have to add await before them
otherwise the value will not be ready yet and your program continues to execute
console.log(guildtable = await guildTables.findOne({ where: { name: guildTableName } })); what about this outputting null?
sequelize returns null if it cant find what you requested
so the query returns nothing
meaning the entry does not exist
that line is after the create function
so it attempts to get the entry before it has even been created
referring to this by the way guildTableCreate({ name: guildTableName });
you might want to also practise using promises and when to use await or not as it is a big part of javascript
still same error on the if statement
did you add await to this?
no.. ill try that too
Still getting null in the if statement
added await to guildtable.get() and createGuildTable()
show the updated code just so i can keep up to date
highlighted
also if you have a better way of doing any of this, i would appreciate some input haha
i was wondering how to do that
i know how to check tables and describe them
but checking contents, idk
The database and the tables are there
i know that much
my bot not starts if checked this is the error
execute SELECT * FROM guildTables LIMIT 10;
yeah im not having this issue with my other table
which is what's so frustrating
it works fine here
can you log guildTableName just to make sure
console.log it?
hm?
are you talking about the name?
i do const guildTableName = String(interaction.guild.id);
so instead of guildTableCreate({ name: guildTableName }) you need to do something like guildTableCreate(guildTableName, 10, role, role) filling out the other fields with what they're supposed to be
and also some of your columns are labelled as required so you have to provide them too (not just name) otherwise make them nullable
i did that
and it didnt work
i just set them to a string that contained the word null
to test and it didnt change anything
you're still doing it wrong
it should be guildTabelCreate(guildTableName, 2, 'null', 'null')
because thats what the function expects
if you want to use objects you need to query the model directly
like guildTables.create({ ... })
i didnt know there was a difference between those two, thats interesting
i thought when using {} you could define what you're actually assigning a value to
you can do that but youd need to make the function like function guildTableCreate({ name, max, manrole, modrole }) { ... }
ahh
that way you can directly query the data
okay
Yeah this will probably work then
i didnt know that it had to be like that
OH MY GOD
THANK YOU DUDE
IVE BEEN TRYING TO FIGURE THIS OUT ALL DAY
It's been driving me nuts
glad to see that! i'd recommend you take some javascript courses to learn some of the syntax
otherwise you're kind of just guessing
I have tried taking courses before and i can tell you that i cant get the motivation
i learn from doing and looking up issues
and continue trial and error because i think thats the best way to learn
asking friends for help along the way
yeah you should also try to apply the things you've learnt because you'll forget them quickly
haha i think im doing pretty well for only having used javascript for a week
I used to code my bot in python and then switched to javascript for more control over what im doing
my first week of javascript i was begging some guy in dms to give me code for stuff
mm i usually find out myself, im a linux guy so im used to no one knowing what the issue actually is
@surreal needle which one do you think is easier for beginner py or js?
definitely python imo
also if you're gonna go javascript then eslint is great for not making subtle mistakes that dont actually show up as mistakes
ruby though
if you're used to that try developing an operating system 💀
shit just crashes and glitches with no clues or leads
my friend tried coding an os in C
code an os in B when
i think he's gone insane
me using java
i watched a video on B once
it looked pretty cool
i've gone insane so can confirm
kotlin gamers
ew
the floor is java!
anyone using java is a masochist
naah
if you need to run a js bot you need like a vps and node and blah blah
when log4j allows you to do remote code execution
that issue has been fixedd.
hacking from minecraft moment
or just have your own server and dont cry about node (this is a joke dont be mad pls)
i know smt about that
but god knows if the billion devices already updated
not mad, i have my own vps and it's fine
hopefully
You know many pcs often get hacked because they don't frequently update them
i know but that's not java's fault
Ye
my bot got rejected because my idiot ass was debugging this while someone was reviewing it, i didnt know when it was gonna happen so i was just changing the code and then i broke everything
java s fault for being bad
Many people seem to switch to functional programming anyways
Time to add modrole checks and make my commands even more bloated
Writing a bot to test ur bot is the real shit
i update manjaro once a year because their frequency of updates is fucking abysmal
quick tip for applying in queue: dont change anything abt the bot and just make sure the uptime is good
and they're multiple gbs in size
I cant help myself, I've been so motivated recently
this aswell
but its better to submit now ig
wait time now is so much shorter
im running out of stuff to add
You probably don't wanna ship an unfinished product
true
i need ideas, which is why i wanna get it up on sites like top.gg
copy other bot
make a discord bot so that it can cook rice at 5 am and fry chicken nuggets at the same time, ill invite that bot
on it
kuuhaku: sinks into the floor
Should the warn command have a permission check or should it just check for the mod role?
You should use permission checks where possible lol
honestly dont trust discords command permission system
they've fucked it up a few times already
use it mostly for shows but keep an internal permission check
wdym
i meant if you're gonna be using discords permission system
oh the permission in general? like using bits?
I've just been using sets of enums in my app
if (interaction.member.roles.resolveId(guildtable.get('modrole')) == member.roles.resolveId(guildtable.get('modrole')))
does this work?
I'm honestly just guessing how i could check something like this
I want to check if both users have the modrole and if they do then return;
interaction.member.roles -> member.roles I fail to see what ur doing there
im getting a role id from a database table
i want to check if they both have that role
not if one has more roles than the other
True I had to redo permissions and reinvite my bot many times caused by permissions issues
ok, what does member stands for?
interaction.member I imagine is the user that pressed the button
its the person that sent the command
and member is the mentioned user in the command
im using discord.js
first of all, save guildtable.get('modrole') to a variable
no need to call it twice
second, you could just check if both users have the role
instead of getting it from each one and comparing both
idk what resolveId does tho
the role is stored as an id in the database
OH wait
i know how to turn it back
its been right in front of me
i can do RoleManager.fetch(id)
and then check that
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '../../functions'
Require stack:
- /home/node/commands/uptime.js
- /home/node/index.js
- /etc/917358002070224936m938887546786676836.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at Module.newFunc (/etc/node_modules/appmetrics/lib/aspect.js:101:26)
at Module.newFunc [as require] (/etc/node_modules/ibmapm-embed/appmetrics-zipkin/lib/aspect.js:101:26)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.\u003canonymous\u003e (/home/node/commands/uptime.js:4:22)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/node/commands/uptime.js',
'/home/node/index.js',
'/etc/917358002070224936m938887546786676836.js'
]
}```
Voici le code
const Discord = require("discord.js");
const config = require('../config.json');
const { MessageEmbed } = require('discord.js');
const { parseDur } = require('../../functions');
exports.run = async(bot,message,args) => {
const duration = parseDur(client.uptime);
message.channel.send('⌛ Loading...').then((msg) => {
const embed = new MessageEmbed()
.setTitle('📥 Online for')
.setColor('BLUE')
.setDescription(
`**${duration}**`,
);
msg.edit(embed);
});
}```
Bonjour j'ai une problème
@rose warren
No need to ping random guys
It obviously says it can’t find your module functions
What type of module is it?
Do you maybe miss the file type?
Is the path valid?
you dont need to fetch roles
Im storing the role in a database using the id
so im fetching the role object using interaction.guild.roles.fetch()
unnecessary
eh?
I mean it doesn’t matter if it’s cached, it will first check the cache before fetching anyways if you don’t enforce it
Why is that unnecessary?
if you have a member object, you have its roles
all member objects have a roles array
array of role ids
in discord.js its stored under member._roles
wait so member._roles returns id's?
array of role ids
yeah
that array will always exist since it comes directly from the api
so it doesnt matter if you cache roles or not
you can have all roles disabled and uncached, and members will still have that array
so i could do something like this
oh nice thanks
Hey @quartz kindle ! I'd like to ask a question about interactions. You see, I know for a fact that when you .reply(), you will have to do it via 3 seconds or else it would error and exit out the process. Although, sometimes. I .deferReply() and .followUp() but an error always comes about Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred..
Always, when the error comes, it restarts/exits the process making my public bot restart, I mean, this used to never happen before and keeps continuing, even when the error occures, but when I started working on sharding, that type of habit started appearing. To prevent it from erroring and restarting.. do you think I should do something like. .reply().catch(() => console.log("Failed to Reply")); and .deferReply() .followUp().catch(() => console.log("Failed to Reply"));?
It's getting annoying seeing the bot restart because of an error.
When you defer you have to edit the reply.
IIRC?
Because you didn't really "reply" to it yet.
I don't think that's how it works.
Thankfully it works for me then (:
You can't send a follow up when you never sent an initial response
You .followUp() although sometimes it errors crashing the bot because of the Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred.. error restarting the bot from PM2.
Works for me?
Clearly not lmao
Always been?
You're literally encountering an error about it
How is it supposed to work, then?
When you defer the reply to an interaction, you must send a reply before sending a follow up, as Dylan said
I'm sorry? I've never seen .deferReply() and then .reply()?
Where do you see any deferReply examples?

deferReply is LITERALLY to ensure the interaction doesn't expire in 3 seconds and gives you a 15minute window to reply.
There's a reason it's called "deferReply"
When do people use .followUp then?
When you defer you have to edit the reply.
That’s exactly how it works.
Think of the deferring like an actual message you send.
It’s in fact not a message but the UI will show "Bot is thinking…"
See this as your “loading message” you sent until you edit the reply (which is you thinking-message)
Right.
You can't send multiple replies to an interaction, after the initial response is sent, you must send a follow up
Basically, following up the chain of replies to the initial response
await interaction.deferReply();
interaction.reply({ content: "Hello" });
After then, what? Where do I put .followUp()?
😔
That’s wrong in the first place
After those calls, you can call <CommandInteraction>.followUp() to send a follow up
You can’t reply as you already replied with the deferring
You need to use editReply()
That's not how it works FakE
For his case it is
You must send a reply, not edit it, you can't edit something that does not exist
I’m not speaking about the followUp
I know what you're exactly talking about, after you defer the reply to an interaction, you must send a reply, not edit the reply, because there's no reply in the first place
Anyways, at all cases, I'm .deferReply()ing all my interactions.
if (interaction.isCommand()) await interaction.deferReply({ ephemeral: false }).catch(() => {});
// Invalid.
await interaction.deferReply();
await interaction.editReply(...);
// Invalid.
await interaction.deferReply();
await interaction.followUp(...);
// Valid.
await inteeraction.deferReply();
await interaction.reply(...);
await interaction.editReply(...);
// Valid.
await interaction.deferReply();
await interaction.reply(...);
await interaction.followUp(...);
First isn’t invalid
Dude, I've just did the second Valid one, that's not how it works, and the first Invalid is valid?
Test it yourself, first case is valid
Fourth case? The fourth one doesn't work for me?
Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
Auto correct 
I usually use the second case.
.. and it works pretty pretty fine for me?
Although, sometimes the interaction fails causing an error 10% of the times.
Yeah Voltrex is wrong here
// Valid
await interaction.deferReply();
await interaction.editReply(...);
// Valid
await interaction.deferReply();
await interaction.followUp(...);
// Invalid
await inteeraction.deferReply();
await interaction.reply(...);
await interaction.editReply(...);
// Invalid
await interaction.deferReply();
await interaction.reply(...);
await interaction.followUp(...);
I believe this is how it should be?
There is absolutely no way you can use .reply() after a .deferReply()?
It errors for me. ^ Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
As I said deferReply() then reply() doesn’t work as deferring is already the reply, you need to edit your reply (deferred message)
That’s how it works
Not sure about that one tbh
Works according to tutorials.
Okay, back to my point whether I use your way or my way.
But you should be able to as in no case a folloeUp message would make sense
I mean second case works pretty fine for me.
I've been using it since September.
I’m using the first case
Anyways, your case or my case. Do you sometimes get errors when the interaction fails?
The opposite between a followUp message and the bot responding to your interaction should be understandable
(Using editReply())
When it fails?
Yes, most of the times, when you use the commands of the second case, it sometimes fails but the action has been done.
await interaction.deferReply();
killBob()
await interaction.followUp(...);
It doesn't follow up but killBob() has been executed.
I mean there’s actually no response to followUp for the bot
It has been working pretty fine for me since 5 months?
The only message is the “Bot is thinking…”
So? That's considered a message?
This is only visible in the UI and will be gone once you send the followUp
That's what I wanted?
That means without sending an actual reply or editReply this will always error
.. because of the .followUp()?
Yes
Okay, makes sense. How about if I added .catch(() => {})?
You should always use the first case when deferring
If it fails, it just silently fails.
The interaction will still fail
Not in your code but in the UI of the client
But it doesn't error and crash the bot, correct? Although, yet fails?
I wouldn’t do it
I wouldn't as well.. but is this true?
It’s not meant to be used like that and might be fixed in the future
If it fails, it silently fails and not error and crash the bot but it would say This interaction failed? (if I use .catch(() => {});?)
Don’t know for sure without testing
Once you’re suppressing errors in your code you know something is wrong
The error discord shows in his client has nothing to do with you suppressing API errors
Ah, no worries. 👍
Think of it as if Discord does not get the right response to the interaction it will say Interaction failed in the client or as API error
Suppressing is a bad idea here
After doing some tests, the first 2 ways seem to be working now, they didn't use to work before
This is how things are handled now:
// Invalid.
await interaction.deferReply();
await interaction.reply(...);
// Valid.
await interaction.deferReply();
await interaction.editReply(...);
// Valid.
await interaction.deferReply();
await interaction.followUp(...);
I suppose what you're encountering here is something that is silently unhandled, I've encountered this issue before but the cause was of some interaction not being unhandled correctly
It if fails randomly, I can't think of anything else causing it other than Discord API issues
Yup, exactly. This is the issue.
I’m using that way since I can think of tbh, not sure where’s your issue here.
We might have used different djs versions
Probably
But as I said replying after replying with a defer causes an API error
Anyways, what's the final difference between .editReply() and .followUp()?
I mentioned above
Kind-of lost it.
See this:
That’s a reply to your message
A followUp is a reply to the bots first reply (response )
He actually replies to itself not to you
No, not really?
Yes
Nope.
This is via the third case.
The editReply() method edits the initial response, when deferred, the initial response is considered as the "thinking" state, the followUp() method however, replies to the bot's initial response (if deferred, it edits the "thinking" state)
Ah
Well.. what is better preventing future errors?
I feel like that has changed
It wasn't, maybe you didn't realize the outputs as that, we confuse things with each other as how interactions work can be confusing
It doesn't matter if the reply to the interaction was deferred, both edit the "thinking" state
Sometimes. Both methods can error due to you mentioning about this, is .catch(() => {}); a fix for this?
Sweet, last question is above.
It can definitely be a fix, random errors like that are mostly caused by the Discord API rather than your code
Yeah that’s probably the case
Send an eval real quick with a followUp which edited the deferReply thinking message before deferred the eval output was send
So yeah that’s how it is
Not sure what you meant by here.
Thanks a lot everyone.
Sure np that actually helped Voltrex and me, too as we’re back up to date as well
Cumulative update to ourselves when trying to help 
Since I had 5 minutes, a quick explanation in pictures (what Voltrex already explained)
Is the same as:
(only when deferred)
does anyone know how to recieve vote data when the bot is hosted on heroku?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
i can use that on repl.it
but whats the webhook url for heroku?
When not deferring, followUp actually is a follow up message of the first reponse
As you can see the bot is responding to itself
it would be your public url
And the last use case...
This case also shows that followUp() is a reply the first webhook the bot has send (editReply() in this case)
It does not mention the interaction user
@feral aspen
By default, a Heroku app is available at its Heroku domain, which has the form
[name of app].herokuapp.com. For example, an app named serene-example-4269 is hosted atserene-example-4269.herokuapp.com.
huh
oh yes
then the path added at the end
yep
reply target failed
stinky woo

the url is for a post request, so getting it in your browser wont work
thank you
def __init__(self, bot):
self.bot = bot
self.token = os.environ.get("TOPGG_KEY")
self.auth = os.environ.get("TOPGG_AUTH")
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
self.update_stats_channel = self.bot.get_channel(938674473094246433)
self.update_stats.start()
def __init__(self, bot):
self.bot = bot
self.token = os.environ.get("TOPGG_KEY")
self.auth = os.environ.get("TOPGG_AUTH")
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
self.update_stats_channel = self.bot.get_channel(938674473094246433)
self.update_stats.start()
does not work
is the link i set the webhook url too
do you have a web dyno enabled?
nope, unless you need the scaling already(which would be unusual)
what am i supposed to do
I'm not a heroku user, so I can only really link to the docs.
alright
so basically i need two Procfiles?
I dont think so, I think multiple dynos can be enabled within one
yep
Running two dynos is risky if ur bot is hosted there
It effectively halves your free time quota
Well, that's one of the drawbacks of running free
You could technically use something else for the api alone
Like glitch or replit
Then process votes there or somehow send data to ur bot
i use mongodb
Regardless of what u use, you'd need to notify ur bot that someone voted
so i can use replit to process votes?
Unless u don't do vote messages
oh true
how am i suppoesd to do that
Get creative
you can realistically forward it to a discord webhook using replit
and get the message with your bot
Can also use the database as a message queue and have the bot periodically check if there are new entries there
thats probably more reliable
Many ways to solve that
il go with a vote helper webhook for now
i want to make a thing like when i type a command in the terminal it will make a new project for me like i open a new folder for making a bot and i want it to automatically add the pre made handler and events..
Like git clone <insert template url here>?
You could also make a script to pregenerate such files, but at that point git will be easier and more reliable
If u use an ide, some allow you to create project templates too, at least I know that in intellij it's possible
OHHHHHHHH
YES
YES
THANKS
@lyric mountain UR GREAT
You...please tell me you already used git in ur projects
Like, it's way too dangerous not to use it, and u can use it as a template repository
Just remember to switch detach the origin once u finish cloning the template
errmm why if(!user === undefiend) is not working?
const user = message.mentions.users.first();
if(!user === undefined) {
message.channel.send("Tag someone")
} else {
const messages = await Messages.findOne({
guildID: message.guild.id,
userID: message.mentions.users.first()?.id
})
const member = message.mentions.users.first()
message.channel.send(`${member} has ${messages.messageCount} in total.`)
}```
Keep sending error in console log `messageCount` is undefined
Remove the ! from the conditional in the if statement's expression, as it converts the user variable into a boolean value
ohhh right i forgot
Yup, indeed. Anyways, many thanks on the answer to the question.
It has confused us all but was able to achieve the answers and understand it.
erm when i pinged someone with the command their username shows up, but if use their id it shows undefined
try {
const Messages = require('../../messagesSchema');
const users = message.mentions.users.first() || message.member.id;
const member = users.username || message.member.id
if(!users) return message.reply("Tag someone.")
const messages = await Messages.findOne({
guildID: message.guild.id,
userID: message.mentions.users.first()?.id || message.member.id
})
message.channel.send(`${member} has ${messages.messageCount} in total.`)
} catch {
message.channel.send("This member doens't have any records yet.")
}```
Am i missing something?
string.username is not a valid accessor
just pass message.member instead of message.member.id
Your code is also rather illogical and doesn't make sense from a strictly type perspective
if (!users) will never run because it will fall back to the guild member issuing the command unless this command is being run in DMs which you should be checking anyways.
In your database findOne, you use a logical OR expression to retrieve a value you already have access to users.id assuming users is a GuildMember.
Assignment of variable member is unnecessary since you can just access users.user.username
how to solve

whisper to your device slowly and gently hey, i love you please work uwu 4 times
🤔 i don't understand your message but
I have resolved it
your welcome
I haven't told you thanks 😂
Tried that so many times… but this sucker, my PC, doesn’t care.
…oh smashing your head on the keyboard doesn’t work as well.
just to say
gotta be more gentle fake
If I have a mysql table with mutliple columns f.e. x, y, z.
And I make an API route where you can send patch requests to. How should I do the params to patch multiple values? Should I make like columns + values and both are arrays so I can map in the backend over'em. Or like for every change a request in the backend?
I would use the same structure for all request methods
Instead of an array a JSON stringified object as body to provide the data makes more sense
Where the key is the column and the the value, guess the value
Concert the body back to an object in your backend to check if it’s a valid object
Then escape both the key and the value and build your database query
how can i set permissions on a slashcommand using SlashCommandBuilder with discord.js
I want it to appear disabled for everyone but me
Should this be an issue forwarded to the Discord Developers server or something?
Never try escape data in order to build a query
Probably
What should be the main issue I should talk about?
Since this has been getting annoying, errors just crashing the application when it's a Discord API issue.
I mean I mentioned the issue, they want proper evidences, do I just show them the code example?
The subject should be of what you're encountering, as you've said before, you seem to be encountering random Discord API errors, you can ask what the cause of this can be while showing the error you get on those random errors
Yea
Sweet.. I'll do so.
Well he can also use prepared statements
I just wanted to mention it in the case he doesn’t know
member.guild.channels.find(channel => channel.name.includes === "welcome")
how can i check if the channel name includes welcome
ik this isn't correct
how so?
.includes(“search string”)
some databases dont support prepared statements for column names
i know sqlite doesnt
What a random statement
what i do is manually filter the keys by colum names

That’s what I said god damn
Stop being so old, Tim
Most
I dont actually know of a single db that does tbh
None of you mainstream dbs do
I mean the object key can’t actually be any SQL injection as it wouldn’t be a valid object key anymore after parsing the stringified data
errr no don't rely on that idea

Alright I said escaping them - was wrong, now not escaping them - is wrong to, fuck you all

im talking about filtering, not escaping, ie have an array of actual clumn names that actually exist in the db, then remove all keys from the json that dont exist in that array, before building the query
Looks like you didn’t press reply
Yeah don’t worry, I got it
You just shouldn't try to escape anything like that
If you don’t use prepared statements of course you escape the value
No
well, only if somehow your db/lib doesnt support prepared statements
Yeah, if
You should never try to be smart and escape the data
Also prepared statements does not equal parameterized statements
No? You just send unescaped values along with your query to risk an injection?
I’m not

I know
Hence why i said dont try to be smart and escape it
Because thats playing with fire
However what you are doing is lumping prepared statements with parameterized statements
How is escaping the value in your query string dangerous?
Not doing it, is dangerous
Of course I do
the danger is not using the better solution
You can’t bypass the escape function
🤨 what escape function
Depends on the language you’re using
One is part of PHPs mysqli extension
Oh I see
🤨 i have never heard of anything having a direct escape function that makes your data a okay to just send as if its harcoded in the query
php actually does have native escaping functions
parameterized queries were introduced quite late
Php also has two of the same functions because the first didnt work
One is part of PHPs mysqli extension
I know what he's talking about now
Although php is a good example of why it's a bad idea
Provide an example, please
PHP indeed has lots of functions doing close to the same but they have significant use case differences and speed differences

