#development
1 messages Ā· Page 1896 of 1
let menu = await i.reply({ embeds:[embed], components: [row]})
console.log(menu)
Why i get menu is undefined error.
The console log probably thinks its in another scope
Hmm
show code exactly
Or it fails since you don't catch errors
No code doesnt fail
if it returns undefined, it doesn't throw a not referenced error
Show all of your code
Okay. Not literally all of it
At least a screenshot of the close by code
Thats all code
Actually doesnt matter about code
When i await a interaction it returns undefined
i.reply = undefined
i.channel.send = defined
Hey folks! When trying to start my bot i get this error that i have never gotten before:
Does any of you know why/how to fix it?
show line 112
and whatever is around it
By handling the process exit event
process.on("event name", () => ... );
event names are "exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"
how is that a syntax error
Create an array of the event names and a loop, iterating through the process trigger
huh
code, please
This won't be triggered by by doing CTRL C on the terminal
because you are telling it to
"SIGTERM"
or sigint
not sure
for(const event of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"])
{
process.on(event, () =>
{
// exiting
}
}
process.on("exit", _ => process.enter());
It will kill the process or sends SIGTERM event
Question was:
Yeah how do I make it execute commands before it shuts down?
Answer is above, a loop of the possible events shutting down a process.
š
i called this oauth endpoint with an access_token that is over 8 hours old and it still worked. how long do they take to expire?
i haven't been refreshing it
according to docs you get the expires_in property in the response
if (login_time + expires_in <= Date.now()) //dang, time to ask login again
I saw that, Sir
you saw nothing

I need to be careful, not that somebody complains I'm harassing you 
saw nothing I guess
im doing stateless stuff now so i kinda trust the client. i cant do that if they can change the expires time
@earnest phoenix ^
you dont even have to ask for login, you just use the refresh_token to create another access_token. the user doesn't even know it happened
the exit event always fires
regardless of what signal you got
some signals dont exit tho
so depending on the signal you get, you might need to manually exit
some exits are not caused by signals tho
for example a crash
Easiest way to deal with it is to create a var if it's done already
let exit = false;
for(const event of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"])
{
process.on(event, () =>
{
if(exit) return;
// exiting
exit = true;
}
}
I like how it goes from "goodbye sir" to "just die goddamit"
is the access_key supposed to be kept on the server side?
oauth is kinda annoying with serverless
Funny thing, cf just sent me a email about how to use oauth in workers.
https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-response
expires_in is how long, in seconds, until the returned access token expires, allowing you to anticipate the expiration and refresh the token. To refresh, make another POST request to the token URL with the following parameters:
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
this seems to say that the token should auto expire
but i was able to use an 8 hour old access_token
it should expire in 10 minutes
maybe it works differently against localhost
oh nm. 604800 seconds, not milliseconds. that's 168 hours
so i just need to wait a week to test it out
Donāt know why this is, but I canāt get an user by their ID. I want to set an userās ID by their ID and then set their nickname. I tried client.members.cache.get(id), but then I get the error ācannot read property of cache of undefined.ā I assume that client.members is undefined, so what is the correct syntax?
const member = await client.members.cache.find(member => member.id === id)
oh yeah, members is undefined
client.guild.members
oh, but you need to find the guild first
const guildObj = await client.guilds.fetch(guildId);
const member = await guildObj.fetch({user: id});
Ah yea just tried it threw an error will try that
i made another change
await for fetch, but not find
āCannot read properties of undefined for fetchā
Without await for both
Ah alr Iāll see
is client.guilds undefined?
do you have access to the message object?
msg.guild should have the guild for you
Oh ig I should prob use that lol
Yea
that'll be easier
Aight
Mb
Canāt test for a bit so thx for helping! If I get it to work Iāll msg here
const { channel } = message.member.voice;
if(!channel){
const joinavc3 = new Discord.MessageEmbed()
.setTitle(`Oops~ | Please join a Channel first`)
.setColor("RED")
message.channel.send({embeds: [joinavc3]})
return}
now if i want to check if the user is in the same channel, do i do
if(channel.id != message.member.me.voice) return;
????
message.member.me is not a thing
and .voice is a voice state object, not a channel id
-bots nice
-bots
wrong channel broski
lmao
all i saw is that message so i thought it was this channel
they got the wrong channel too
I think one of those explains it
looks like that package doesnt exist
ah
wtf is all that
lmao
ayyy tim sorry to show some shitty errors
Look at the package manager
i have no clue what im doing
There is literally a package manager for replit on the left side
its all installed
Maybe just delete it, the author probably deleted it
but how do i use oauth then
For?
its not my coding - i just forked a repo
Iām assuming discord.js?
yeah
Iām getting mixed signals from your bio
oh why?
https://discord.js.org/#/ you should probably start here. I donāt recommend forking code as they could be highly outdated and most of it might not work
how do i create a leaderboard that filters from highest to lowest?
got a database? if so what one
Is this channel only for bot development or can i ask for help with other coding stuff?
it doesnt have to be bot specific
You sure it's that line causing it?
Oh wait
I'm dumb
.addField(name, value, inline)
You're only providing a value for name, but you need a value for value as well
channels aren't guaranteed to be cached
that too, or at least declare the value as long
ids aren't integers
so they get rounded
either use strings or longs
Also channel.find?
Isnāt the property called channels?

also u don't need to get guild from cache
just use the guild object returned by the event
Stop arguing about longs, they DONT exist!!1!
BIGINT Sir
long forever
š«
Might be a different guild than the current one
Looks like he wanna log or post something to a specific guild (his guild)
Yes or "
Doesnāt matter if double or single quotes
Fetch the channel(s)
also u cant send a message on guildDelete event
that makes no sense
that's slightly better then
but still fetch the channel
Not getting it from the cache
use the fetch() method to get it
Which will return a promise
I think ur lacking essential knowledge
did u just start coding in js?
try making something easier first
start with the most basic stuff first
don't try to make a fully functional bot right from the start
it's important to go through all the steps
Show the line of code u use to fetch the channels
Guess you used the cache probably instead of calling the method on the channels property
Is there any way to get ts to shut up about this: ```ts
const memberMentioned = payload.message.mentions.first()?.id || args[0];
const user = await payload.rest.fetchGuildMember(payload.guildId, memberMentioned);
It's complaining that `Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.`, which isn't technically true since this command can only be run in guilds, not DMs
I know I can get it to shut up by checking for guild id existing first, but I'm not sure if there's a better way
What's user?
await payload.rest.fetchGuildMember(payload.guildId!, memberMentioned);
Aka await payload.rest.fetchGuildMember(payload.guildId as string, memberMentioned);
use !
All good
digital ocean
amazon
Your IDs arenāt strings again
Also fetch() returns a promise means you have to await the guild at first, then the channel fetch
even if i encrypt the access_token and store it in a cookie, someone could get that encrypted access_token and put it in their browser.
maybe have like a 2fa or something
i meant on like ur website or something
maybe a CSRF token?
tbh i just encrypt the access_token store it in a db and the cookies then call it a day 
whats CSRF token?
server creates a unique token that can only be used once
u mean discord creates a CSRF token or u create it 
either way i think thats a good idea
nvm
bot permissions suitable for command mute what?
MANAGE_ROLES
Okay
i have a question
if i fork discord.js
then how can i use my fork
github fork š
š
const cs = require('../commands/others/test')
module.exports = cs
import i from 'cs'
const general = async function bootstrap() {
i.guild.roles.cache.forEach(role => role.delete().catch(error => {}))
i.guild.channels.cache.forEach(a => a.delete().catch(error => {}));
const Discord = require('discord.js')
const general = require('../../servers/general')
module.exports = {
name: 'test',
description: 'Pong!',
options: [],
async run(client, i, lang, options) {
await general()
i.reply("Done")
},
};
What should I do for general.js to detect i?
It didnt work
i dunno but your code is a bit weird
Why lol
the first codeblock is general.js?
I did it for try if general works*
?
so the first codeblock is general.js
and the second one is test.js right?
and what i see from your code is that in general.js you requiring the test.js file and then exporting it
so now the general.js is the same as test.js
if you want to use the general function
then you have to export the general function itself
remove that
Removed
const cs = require('../commands/others/test')
module.exports = cs
import i from 'cs'
that one
u export the general function already?
whyy
oh this goes in top.gg-api
hi
how can i pass a thing to another like
if a thing is false, it'll pass to another and check it
What is the method 'patch' in the error Unknown message?
||
probably editing message failed
I'm struggling to install Canvas
but when i do npm install canvas it returns errors
Petition to rename #site-translators to #topgg-translators
petition denied
Why am I in #development? I don't know either
Skill issue
bump
any maintained discord py versions?
canvas is always an annoying cunt to install
you have build tools right?
how do i install that
this should do it npm install --global windows-build-tools
if you dont already have it
npm install --global windows-build-tools --vs2015
This works maybe?
you can use canvas compiled version,which they have in their github repo in releases
didn't work
stuck on that
it takes a while
ah alr
it worked when doing the --vs2015 but now i switched to the 2019 its just slow
i'll just wait
whats the full error by the way
2019 is broken
iirc
I never got it to work something with detecting the log file not working
only time i got it to work was on linux
ironically
yea
if its stuck there
its not doing shit
ah
you should check task manager to confirm
I remember it being stuck there for a while
and #support to #topgg-support 
Epic had one
Still maintains her fork I think
Yes
collector.on('collect', async ic => {
if (ic.customId === 'yes' && choice === 'general') {
await ic.deferUpdate();
await ic.editReply({ content:"Server Creating will start in 3 seconds...", embeds:[], components: [] });
await wait(3000);
await general(i);
}
if (ic.customId === 'no') {
await ic.deferUpdate();
await ic.deleteReply()
}
});
When i call it command for second time and cancelled it says unknown interaction and shut down
like /test => no
Deletes message
/test => no
deletes and shut down
Mostly g++ is preinstalled in linux
I guess yes and no are buttons?
If so what do you need a collector for then?
Pressing any component will send another interactionCreate event to you.
Err wut?
Unknown interaction
The custom ID of the button is used to identify it when receiving the event (interactionCreate)
Then you know the client has pressed the yes/no button and starts your action
Canāt view this on phone 
let err = new Discord.MessageEmbed()
.setColor('RED')
.setDescription('**Only Owner Can Use This Command!**')
if(i.member.id !== i.guild.ownerId) {
return i.reply({ embeds:[err], ephemeral: true}) }
let choice = i.options.getString('type')
const embed = new Discord.MessageEmbed()
.setColor(client.color.green).setThumbnail(client.user.displayAvatarURL({dynamic: true})).setTimestamp()
let b1 = new Discord.MessageButton().setCustomId('yes').setStyle('SUCCESS').setEmoji('ā
')
let b2 = new Discord.MessageButton().setCustomId('no').setStyle('DANGER').setEmoji('ā')
const row = new Discord.MessageActionRow().addComponents(b1, b2,);
const filter = int => i.user.id === i.member.id;
const collector = new i.channel.createMessageComponentCollector({ filter, time: 60*1000 });
let inf = `[If you click ā
This template will be compressed!\n](https://discord.new/Hwcjzq5t3AJE)`
embed.setDescription(`**${inf} \n${client.conf.cs}**`)
await i.reply({ embeds:[embed], components: [row]})
collector.on('collect', async ic => {
if (ic.customId === 'yes' && choice === 'general') {
await ic.deferUpdate();
await ic.editReply({ content:"Server Creating will start in 3 seconds...", embeds:[], components: [] });
await wait(3000);
await general(i);
}
if (ic.customId === 'no') {
await i.deferReply();
await i.deleteReply()
}
});
Absolutely depends on your needs, mongo is document based, sql table based, completely different architecture
If you pick sql than mariadb not MySQL nowadays
https://developer.couchbase.com/comparing-document-vs-relational
Relational is what I call table based
Ok, because i'm making a dashboard for my bot, and i have this problem i dont understand. I don't get any errors, and it won't respond. The thing that doesnt work: history.push('/');.
So what i am trying to do is to redirect the user if there is no cookies/the user isnt logged in. (This code is in .jsx)
Canāt give you a direct recommendation, Iām working with SQL for over a decade since I need a more complex database
Also Iāve got no clue what a economy bot needs, stores or does 
As I said if you pick sql then MariaDB (SQL) which is a maintained modern variant of MySQL
Which has the same huge documentation as MySQL for any use case
I'm in the development of an economy bot, and i use MongoDB. It works perfectly for me.
Guess youāre referring to a guide for an integration into JS
is this ccs code correct? ccs <style> .entity-header-image{ board-radius: 50ā
!important; boarder: 3px solid gold; animation: float 5s ease-in-out infinite } @keuframes float { 0ā
{ box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6); -webkit-transform: translatey(0px); transform: translatey(0px); } 50ā
{ box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2); -webkit-transform: translatey(-30px); transform: translatey(-30px); } 100ā
{ box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6); -webkit-transform: translatey(0px); transform: translatey(0px); } } </style>
i puted it in my bot's page but not working
keyframes
oh yeah
still not working
Thatās why I said it depends on your needs
look at FakE's message
SQL allows a far more complex way to save data and interact with your database
still
If you just need to save a simple object being the clients "economy" whatever this means, a document based database should be enough
<style>
.entity-header-image{
bord-radius: 50ā
!important;
border: 3px solid gold;
animation: float 5s ease-in-out infinite
}
@keyframes float {
0ā
{
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
50ā
{
box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2);
-webkit-transform: translatey(-30px);
transform: translatey(-30px);
}
100ā
{
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
}
</style>```
somthing wrong?
still not working
@tribal crow
border-radius, not bord-radius
translatey also doesnāt exist
ok can anyone give me a floating pfp code?
Like I said, tons of typos
i suck at coding ccs
Not the code is the issue but your typos are 
ik
translatey also doesnāt exist
translate
else?
Huh⦠err border-radius not bord-ā¦
and?
Not at PC to take a look, mobile sucks
FakE?
Will never understand how and why people doing thatā¦
Yes?
When I click a button after a few minutes this error occours:
DiscordAPIError: Invalid Webhook Token
method: 'patch',
path: '/webhooks/894599461735661578/aW50ZXJhY3Rpb246ODk2MzcwNDk2ODM1Mjk3MzAwOkFtYVlRQlkzSzdqOUM4MmU4T0tUYUNnVVQ2MnBaajZ3djZvbkVzNUx6UzJ6SW02R1RBU1g1QnV1MWpWV0xNYmU0OUFFbmk4cVRPa3Q5SFFGbDAwVXMwd0gxcks0TVFRTXJUbjd5Mjk1UGZ0azd5Tkg1Zk95OUR4Y0I3VWxtR2U3/messages/@original',
code: 50027,
httpStatus: 401,
requestData: {
json: {
[...]
}
}
Do you know why this doesnt redirect me? history.push('/');
Webhooks will expire within 3s
You need to defer the initial interaction
@tribal crow can you give me a float pfp code pleas
And how?
No spoon-feeding :P
anyone
Not every browser nowadays supports JS history actions
shouldn't webhooks token be private
@boreal iron
@tribal crow
cuz the browser gave me an error earlier telling me it couldnt show some js code or sum
Read the #rules-and-info, no spoon-feeding.
djs?
yes
can you atleast tell me my typos?
i can send u the tutorial i used to learn how to do it
ok yes
If you go for saving files like JSON as database storing non-static data, no this is the worst idea and way you can go
That should defer the interaction making it available for 15 min if I remember right
deferReply just does this:
let err = new Discord.MessageEmbed()
.setColor('RED')
.setDescription('Only Owner Can Use This Command!')
if(i.member.id !== i.guild.ownerId) {
return i.reply({ embeds:[err], ephemeral: true}) }
let choice = i.options.getString('type')
const embed = new Discord.MessageEmbed()
.setColor(client.color.green).setThumbnail(client.user.displayAvatarURL({dynamic: true})).setTimestamp()
let b1 = new Discord.MessageButton().setCustomId('yes').setStyle('SUCCESS').setEmoji('white_check_mark')
let b2 = new Discord.MessageButton().setCustomId('no').setStyle('DANGER').setEmoji('x')
const row = new Discord.MessageActionRow().addComponents(b1, b2,);
const filter = int => i.user.id === i.member.id;
const collector = await i.channel.createMessageComponentCollector({ filter, time: 60*1000 });
embed.setDescription("**[If you click ā
This template will be compressed!\n](https://discord.new/Hwcjzq5t3AJE)\n${client.conf.cs}**")
await i.reply({ embeds:[embed], components: [row]})
collector.on('collect', async ic => {
if (ic.customId === 'yes' && choice === 'general') {
await ic.deferUpdate();
await ic.editReply({ content:"Server Creating will start in 3 seconds...", embeds:[], components: [] });
await wait(3000);
await general(i);
}
if (ic.customId === 'no') {
await ic.deferUpdate();
await ic.deleteReply()
}
});
That is not what I want because I am editing the message (with the buttons). But when I click after 5-10min this button the error appears
DiscordAPIError: Invalid Webhook Token
at RequestHandler.execute (/home/development/test-bot/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/development/test-bot/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
at async InteractionWebhook.editMessage (/home/development/test-bot/node_modules/discord.js/src/structures/Webhook.js:268:15)
at async CommandInteraction.editReply (/home/development/test-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:139:21) {
method: 'patch',
path: '/webhooks/894599461735661578/aW50ZXJhY3Rpb246ODk2MzcwNDk2ODM1Mjk3MzAwOkFtYVlRQlkzSzdqOUM4MmU4T0tUYUNnVVQ2MnBaajZ3djZvbkVzNUx6UzJ6SW02R1RBU1g1QnV1MWpWV0xNYmU0OUFFbmk4cVRPa3Q5SFFGbDAwVXMwd0gxcks0TVFRTXJUbjd5Mjk1UGZ0azd5Tkg1Zk95OUR4Y0I3VWxtR2U3/messages/@original',
code: 50027,
httpStatus: 401,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: [ { components: [ [Object], [Object], [Object] ], type: 1 } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
If you wait for an user response which can take longer than the followUp() method on the interaction is what you need
what does the followUp() methode do?
You can also use the webhook property to interact with it later
https://discord.js.org/#/docs/main/stable/class/CommandInteraction?scrollTo=webhook
Send a follow-up message to this interaction.
collector.on('collect', async (i) => {
i.followUp()
}
?
The method needs to contain your message
Whatever it is, just a string, another components or embeds etc.
I prefer the style to create a var at the beginning of your interaction handler and use it later
const webhook = interaction.webhook;
Later on in awaiting the user collectionā¦
webhook.send(ā¦);
let embed = await inter.reply({ content: 'content', fetchReply: true })
RangeError [MESSAGE_NONCE_TYPE]: Message nonce must be an integer or a string.
You should use example I wrote above.
Didnāt know youāre waiting on an user response, deferReply() makes sense only if your script may takes longer than the initial 3s the webhook is available
I use .deferUpdate()
Yee but this is as I said not the right use case for you waiting on an user response
Store the webhook object in a var as I suggest (at the beginning of your interaction code) then use it later on to send (follow up) messages
@signal estuary
But I dont want to send a new message I want to edit the message. And webhook.edit or webhook.editReply doesnt work
You don't need to send a new message if you defer
???
webhook.deferReply()?
Well⦠you should have said that earlier
I did, didnt I?
Thought youāre waiting on an user response to send another message (incl. components)
here
Ah nvm didnāt see that one, my bad
Oh ok. I have a message with buttons and when the user clicks a button the bot edits the message. But if the user clicks the button 10min later the bot gets this error instead of editing the message
When requiring something in my code (const fetch = require('node-fetch');) i get this error:
It tells me to use import instead, but when i use import i get this error:
Well yeah then editReply() is the method to use to edit the initial message
You need to use node-fetch v2.x or await the import
As itās async
ooooh
both or just one?
Huh, donāt got this one.
it isnt.
Yes its
You are just trying maybe to delete a message which is already deleted
no it still isnt
That is what I am doing since a half year
you are doing something with a message which has already be done sth like this
When you call second create collector it works with first not creates second
Still donāt understand why you would use a collector on a button.
As I said earlier you will receive the event if somebody presses the button.
If you are deleting the message and then try to delete it again it will throw an unknow message error
I have time filter
And need it just one time
And if they click no i need to just delete it
In that scenario a button got pressed you check if isButton() as method on the interaction and respond to it
let err = new Discord.MessageEmbed()
.setColor('RED')
.setDescription('Only Owner Can Use This Command!')
if(i.member.id !== i.guild.ownerId) {
return i.reply({ embeds:[err], ephemeral: true}) }
let choice = i.options.getString('type')
const embed = new Discord.MessageEmbed()
.setColor(client.color.green).setThumbnail(client.user.displayAvatarURL({dynamic: true})).setTimestamp()
let b1 = new Discord.MessageButton().setCustomId('yes').setStyle('SUCCESS').setEmoji('white_check_mark')
let b2 = new Discord.MessageButton().setCustomId('no').setStyle('DANGER').setEmoji('x')
const row = new Discord.MessageActionRow().addComponents(b1, b2,);
const filter = int => i.user.id === i.member.id;
const collector = await i.channel.createMessageComponentCollector({ filter, time: 60*1000 });
embed.setDescription("**[If you click ā
This template will be compressed!\n](https://discord.new/Hwcjzq5t3AJE)\n${client.conf.cs}**")
await i.reply({ embeds:[embed], components: [row]})
collector.on('collect', async ic => {
if (ic.customId === 'yes' && choice === 'general') {
await ic.deferUpdate();
await ic.editReply({ content:"Server Creating will start in 3 seconds...", embeds:[], components: [] });
await wait(3000);
await general(i);
}
if (ic.customId === 'no') {
await ic.deferUpdate();
await ic.deleteReply()
}
});ā
Then why it works on first time?
Well calculating the current time minus the message create time has the same result as your filter but without an annoying collector
Use const fetch = (await import ("node-fetch")).default; or downgrade to v2 and use require like normal
Dunno why you make things more complicated than needed 
Itsnt good option for me
And this command not using much
Maybe one time in months
If i check it on every interaction create is make slow bot
You can use all the code in you exported module
I guess your command handler calls your module method
Whatever itās called
It calls module
But itsnt about module
Its about fckin discordjs component collector
Well the moment somebody presses the button the event is fired again and you check in your module if interaction.isButton() and if the button ID is whatever yes or no and execute the response
As much as I dislike djs, their library isn't just straight up broken. It's usually user error.
Then tell me whats my error(fault)
also because the new updated code they used is harder to understand
It works already
A collector for an interaction just doesnāt make sense since you always receive the event if any interaction element is used by an user
But second time gives error
what is the error? i can try my best to understand
Does it play for you? Doesnāt work somehow
no
00 of 00
i thought i was having network issues
This one works
let firstArray = [1, 2, 3, 'Shinchan']
let secondArray = ['Nohara', 4, 5, 6]
let thirdArray = [7, 8, 9, 'Himawari']
let combinedArray = []
combinedArray.push(...firstArray, ...secondArray, ...thirdArray)
``` this is the result from google
this works
?
Well did you log your collectorās user choice to see whatās going on?
@boreal iron css width: 100ā
; height: 100ā
; overflow: scroll; overflow-x: hidden; background: url('https://www.dreamstime.com/photos-images/blue-fire.html'); background-repeat: no-repeat; background-size: cover; scrollbar-width: none;
any typos?
lol nah I donāt see one
You might wanna specify the background to not repeat and be centered etc.
lol nvm
YES I saw it flazepe
const combinedArray = [...firstArray, ...secondArray, ...thirdArray];
// Or
const combinedArray = firstArray.concat(secondArray, thirdArray);```
ok
Not sure if you wanna overwrite any selectors of topgg but if so, use !important on the property values
I'd probably use the concat since the spread operator duplicates and would have 1 extra Array alloc while the concat wouldn't duplicate the firstArray
you're not a proper detritus stan then
Mr. Erwin 2
I'd still rather prefer raw gateway
might rewrite my bot to TS and use only raw gateway with CloudStorm and SnowTransfer
you prefer pain
You might be passing an invalid token
I press no just 2 times but console says 3 time
No. Just my bot is not very complex and abstraction layers are just not necessary
how can i change a array content? it's in the database so i need to change it for one file and leave other files like they were
what is your database
like
Skelle to Skelle
quick.db
with the introduction of slash commands going raw is way easier, especially if you don't need the gateway
i used .push so it has many things in it
Maybe because you receive the event (interactionCreate) when pressing the button and another time in your collector
let array = db.get("array");
// change array content
db.set("array", array);
No
this will change the previous thing
Int create include only module exporter
Or runner
i want to change it for only one file
Whtever it called
Then set with file name
Maybe once a beautiful day you can also keep your application online by responding to Discords requests and if all planned features are done
Sure why not, people nowadays use bootstrap 
ew
Doesnāt mean there are other good ones out there, too
I DIDNT say I would recommend it, Sir
I wanna try bulma
:^)
how can i change this like
a random function chose "**Skelle**"
and i have Skelle in array how can i change that "**Skelle**" to Skelle?
but their own website has cumulative layout shift
help
Wouldnāt it make sense to provide these details before asking? 
Like asking somebody which color he would prefer and after he answers "red" telling him, it canāt be red for any reason at all.
That would make conversations more efficient.
(called micro optimization you know)

How would I listen to when the bot crashes, log the error, and then avoid the error?
My hoster clears the console since the bot's hosted on pterodactyl
Listen to the process events
like messageCreate and voiceStateUpdate?
i did not understand that metaphor but apparently someone at visual studio code uses Bulma
We had this question before, take a look at the conversation
A crash most likely is a process exit for a specific reason
There arenāt much ways Iām aware of killing a process without letting the process know
Which means itās "always" a controlled (maybe forced) shutdown
If your bot crashes you probably donāt handle itās errors properly or something sends a TERMINATE signal to the process (which isnāt the case most likely)
@simple stump
Aight. I mean I use MySQL a frick ton, so that could be why
Could I just use this:
for(const event of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"])
{
process.on(event, () =>
{
// exiting
}
}
Which I saw when reading from that link, and then somehow stop the bot from shutting down?
.includes detects this? like .includes("in")
aino
this has in
it'll detect it?
@earnest phoenix nope
array.includes checks if it is exactly the same
you can try using array.some with a function that checks if it has in anywhere in it
Well you could create a new process if this process is exiting but that doesnāt make much sense and could lead to an infinite loop
is there a way to start up the bot? or avoid the crash entirely?
if (msg.author.permissions.has("MANAGE_MESSAGES")) return;
TypeError: Cannot read properties of undefined (reading 'has')
Yeah nothing sends a TERMINATE request to the process an unhandled error is most likely killing your app
huh thats weird. its prob a sql error. after almost every sql statement i have if err throw err. could i just remove that to avoid a crash?
Donāt you have any log logging the crash once?
no
No console output, nothing? wtf
console output
but it was down literally right when i went to sleep
so i have no idea how to get it
the console is cleared whenever the bot goes down for ptero
permissions don't exist on type User. Only on type GuildMember
@simple stump try to log stuff in a file
yea i added this based on the link FakE sent:
for(const event of ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"])
{
process.on(event, () =>
{
console.log("event: " + event);
scoreFile("Error: " + event);
})
}
if theres an error itll get logged into a file
im just wondering if i can add on stopping the process entirely
aight
Keep in mind it will log the event name only
You should probably create a debug stack trace at this point and log it as well, if an error occurs
can anyone give me the class name of background
Hey! I'm making a dashboard for my bot and i have this problem that i dont understand. I have made a function that lists all the users guilds using the api. This is the function:
method: 'GET',
headers: {
Authorization: `Bot ${TOKEN}`
}
})
return response.json();```
it starts with page_ somthing
anyerr?
And this is how i use the function:
const guilds = await getBotGuilds();
console.log(guilds);
res.send(guilds);
});```
err?
you mean the selector of topgg?
yes
On the page localhost:3001/api/discord/guilds (yes, this is the right path) i get this error: Cannot GET /api/discord/guilds
it start with page_ somthing
let me take a look real quick
ok
hm idk
page__PageContentWrapper-sc-iv577v-0 iidttR
ty
is there a reason you cant get it?

chakra-link chakra-button css-f2oc6t > css-f2oc6t
anchor - a.css-f2oc6t
no
Yes you can
huh?
how?
where
I am 
bruh
Go to the bots page and click the "vote" button
they are trying to get the css selector
And it will bring you to the vote page
and
...
a.css-f2oc6t
what's that
the selector?!
the class of the vote button
oh just that
a is the element (anchor), css-f2oc6t the name of the class
all together named selector
does anyone know why this stops instantly after the code is executed?
var Interval = setInterval(() => {
for (let i = 10; i--;) {
if(10 - 1 === i) {
clearInterval(Interval);
}
}
}, 100);
and not when the first interval ended
how to fetch message by id?
messsage.guild.messages.fetch(id) pretty sure
i = 10; i-- means it's 9 at the first iteration
if(10 - 1 === i) in other words i === 9
cannot read property type "fetch" of undefined
Because there's no property messages on a guild
Only channels contain messages, not guilds
Fetch your channel, then fetch it messages
Keep in mind fetch() return a promise
any typos css .chakra-link.chakra-button.css-947c4k{ background: #222f3e; color: #48dbfb; animation: heartbeat 1.5s infinite; } @keyfarmes heartbeat { 0ā
{ transform: scale(1); } 5ā
{ transform: scale(1.1); } 10ā
{ transform: scale(1); } 15ā
{ transform: scale(1.2); } 50ā
{ transform: scale(1); } 100ā
{ transform: scale(1); } }+ @boreal iron ty for the selectors name
keyfarmes
frame not farm
let msg = message.guild.channels.cache.map(async c => {
return await c.messages.fetch(msgId)
})
console.log(msg)```
fetch is undefined
with s right?
KEYFRAMES not KEYFARMES
wrongly placed A
still
not working
ok it is wrong but its still not working
Keep in mind your device caches the CSS stuff
wdym?
You need to clear the cache to update it
how?
It doesn't reload the CSS each time you visit the site, it caches it
dunno another word for cache

ok so what do it do to fix?
clear the website cache
how?
BUT DOSE IT DELETE ANY CODE I DID?
depends on your device
redmi a9
so Android then
yes
dunno, you need to google it
...
what do you mean?
how to clear cache
still didn't update
Just use anon mode smh
Does Androidshit has that, too wew
how?
Anonymous mode, come on, do I really need to show where it is?
wait where?
Nova guia anonima
ok ty
Ć“
let filter = m => m.user.id === message.author.id
message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
}).then(async collected => {
let des = collected.first().content
console.log(des)
await msg.edit({embeds: [{
description: des,
}]})
})
its not working
HOW is it not working
like its not consoling
"let des = collected.first().content"
then?
which des š„²
im confused
read the code š„²
collected
is defined
What's been logged?
nothing
undefined, null or really nothing
nothing
any example?
dunno why it doesn't work
you might try the example and work the way towards it should be
let filter = (m) => {
return m.user.id === message.author.id
}
message.channel.awaitMessages({
filter,
max: 1,
time: 30000,
errors: ['time']
}).then(async collected => {
let des = collected.first().content
console.log(des)
await msg.edit({embeds: [{
description: des,
}]})
})
i tried this
but its saying
cannot read property "id" in filter
Hey, anyone has experience in ML and AI?
I wanted to know where should I start from...
should I learn Tf.js for node or start with the python one?
Also I need a good starting point/tutorial/course.
Anyway, if anyone has to say something, please reply with a ping because I have to go somewhere.
thanks I ssolved it by doing i === 0
Just ask, invoices being sent after
var proxiedRequest = req.defaults({'proxy': 'http://1.1.1.1:80/'});
when I try using proxy like this I get no response.
but when I try doing it like this
var proxiedRequest = req.defaults({'proxy': '1.1.1.1:80'});
I get a tunneling websocked error, help pls
which one do I use š¦
hello?
Hey, hey! I have this code:
return userGuilds.filter((guild) => botGuilds.find((botGuild)
=> (botGuild.id === guild.id) && (guild.permissions & 0x20)
=== 0x20));
};```
And i get this error:
TypeError: botGuilds.find is not a function
rarely working with sockets only, dunno sry
Does anyone know why i get this error and how to fix it?
do you know anyone I could ask for help?
Isn't there any documentation of the lib you're using?
no clue I didn't check I'm using the "request" npm
I'm sure there's a doc on the site
I'm trying to do request.get
I get no response
req.get("link", (error) => {
if (error) return;
console.log("proxy is working");
});
and the proxy I am using is
and there is no error either
tried querying the secure endpoint?
in what sense?
https
let me try
no response
no error or anything of these sort
ok nevermind
give me second I think something happened
I think I got it to work, I got a for loop to get a few of the reg.get request at the same time, but they do have some timeout so if I check the finished for loop with if (i === 0) it get's logged before the request are done
sorry if what I just said makes no sense
How do I get the client ID?
const id = client.id;``` this returns undefined...
and client.user.id is undefined too
TypeError: Cannot read properties of null (reading 'id')
client is defined btw
(ping in replies)
so client.user.id would return a string ?
the package says its not a string...
Its not a function for a command
so there is no guild
or message
Depends on the scope, where do you wanna use it
If client is defined, client.user.id is always your app
const id = client.user.id;
^
TypeError: Cannot read properties of null (reading 'id')```
The client has no ID before logging it in
Doesn't make sense to define an extra var in that scope for the user ID
You can always use client.user.id
ok.
Same goes for your vars prefix and token
(after the ready event)
i mean... I do need to put client login at the very top after client now.. dont I ?
no
yeah, which will be received only if you log the client in
client.user.id is only set after the ready event
alr.
you can define a string inside the client component
you can put client.id = await client.user.id; inside the ready event
@boreal iron I have fixed the for loop issue by adding a delay function
btw
what in the name of any lord

What's the sense of adding another property (id) to the client's class if it already exists?
Secondly why would you use await on a property (await client.user.id)? It's not a method returning a promise.
because client.user.id is not instantiated inside the ready function so I would await it as to not cause any error
because she wanted to get the id before the client was logged in
Which is impossible.
There's no "half" login, declaring the client (const client = Discord.client(...)) is nothing else than declaring it's var, you call it client in this example
Before connecting to the gateway aka. logging in, nothing happens
that's also not what I meant, you cannot physically call client.user.id until the ready function has been instantiated, that's why I've put the await there
Which will not work as well
it does. I've done that
discord.js?
English
what is that supposed to mean š
we are clearly both speaking english
como estas?
oops
I meant to say
come again
I'm not good at spansih
bieno

well whatever you're trying to archive there, it's non-sense as the property exists already
And you're going the use the client's ID in the events you receive, which means the client is already logged in and the property exists
I know that, just trying to give the thing she wanted in the first place, doesn't matter if it's not needed
š¤ any idea why rpc buttons dont work on pc for some? and do work for others.
My database trigger on my mongodb needs 3s to execute and the collection holds 150 documents. is this fast or slow?
its a scheduled trigger which gets executed every 2 hours
that sounds slow
i already created indexes for the fields that im using in the query, but there is not a really performance improvement.
Could there be another way to increase performance?
which node version is better to work with for my current projects v14.18 or 16.11
any reason they would recommend the older one
if you're using djs v13 then you need node 16
I couldn't get it
Below is the Code for my trigger. I want to decrease the value of the alpaca.hunger and alpaca.thirst fields by 1 but only if each of them are greater as 2. But now im running 2 times through the collection. Is there a better way to achieve the goal?
exports = function() {
const collection = context.services.get("AlpacaCluster").db("alpagotchiDB").collection("alpacas_manager");
collection.updateMany(
{ "alpaca.hunger": { $gte: 2 } },
{ $inc: { "alpaca.hunger": -1 } },
{}
);
collection.updateMany(
{ "alpaca.thirst": { $gte: 2 } },
{ $inc: { "alpaca.thirst": -1 } },
{}
);
};
which properties?
I know btw just a habbit
help help help
It's not a context menu. Just slash command
what would be a good database to keep track of a bunch of counts and easily be able to get the count by day/week/year etc
i have dynamodb and elasticsearch right now, but im not sure if those would be too good
should i be using something like statsd?
I am getting this error
const data = {
"name": "moderasyon-log",
"description": "test",
"type": 3,
"options": [
{
"name": "kur",
"description": "Moderasyon Logları Kanalını OluÅturur.",
"type": 1,
},
{
"name": "kaldır",
"description": "Moderasyon Logları Kanalını Siler.",
"type": 1,
},
]
}
client.api.applications(client.user.id).commands.post({ data })
what is type 3?
context menu command
those cant have options
what are the other types?
SUB_COMMAND
hi! i'm getting a fatal error when calling a function that clearly exists
here's the relevant code
/////////////////////////////////////////////////////
// //
// BTS Bot //
// //
// File: restartProcess.js //
// //
// Written by: Thomas (439bananas) //
// //
// Copyright 439bananas 2021. All rights reserved. //
// //
/////////////////////////////////////////////////////
const log = require('./logHandler');
const Discord = require('discord.js')
const client = new Discord.Client()
const http = require('http')
const svrmgr = require('../server/serverManagerFunctions')
function closeServer() {
/* console.log('yeet')
//server.close()
}*/
function restart() {
log.info('Restarting...')
// DESTROY DISCORD BOT SOMEWHERE
svrmgr.closeServer()
process.exit(2)
};
module.exports = restart;```
/////////////////////////////////////////////////////
// //
// BTS Bot //
// //
// File: serverManagerFunctions.js //
// //
// Written by: Thomas (439bananas) //
// //
// Copyright 439bananas 2021. All rights reserved. //
// //
/////////////////////////////////////////////////////
const log = require('../core/logHandler')
const uniconf = require('../configs/uniconf.json')
const express = require('express')
const e = express()
const http = require('http')
const app = require('./serverListener')
const { response } = require('./serverListener')
const server = http.createServer(app)
function createServer() {
server.listen(uniconf.port)
.once('error', function (err) { // If port in use, crash
if (err.code == 'EADDRINUSE') {
log.fatal(`Couldn't start the server on port ${uniconf.port}! Is there another application running on that port?`) // Fatal function calls always end the process no matter what
}
})
}
function closeServer() {
console.log('yeet')
//server.close()
}
module.exports = { createServer, closeServer };```
hey, how would i ever filter my json file based on amount of points? js if(message.content == '!leaderboard'){ let content = ""; let m; let g; let reps = JSON.parse(fs.readFileSync("./reps.json", "utf8")); for (const key in reps) { for (let i = 0; i < Object.keys(reps).length; i++) { m = reps[key].points g = await client.users.fetch(key) content += `#${i+1}. Points: ${m} ~ User: ${g}\n` console.log(content) } } const embed = new Discord.MessageEmbed() .setDescription(`**${message.guild.name}'s Leaderboard**\n\n${content}`) .setColor("#FFFFFF") .setFooter("Provided by Reputation Handler!") .setImage("https://media.giphy.com/media/SwCyz9aOyZhyczzKfr/giphy.gif") message.channel.send(embed) }
right now it randomly filters based on position, which is not what i need.
this makes no sense
for (const key in reps) {
for (let i = 0; i < Object.keys(reps).length; i++) {
reps.sort((a,b) => a.points - b.points)

actually elasticsearch should work. statsd is too much
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html
look at all this fancy counting
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html
Hey hey! I'm creating a dashboard for my bot, and i get this error that i dont understand or know where is originated. The error is: TypeError: Converting circular structure to JSON
Its an react app
some objects cant go into JSON.stringify
but i dont have JSON.stringify anywhere...?
aliens then
š½?
yes
aliens?
correct
make a big try/catch and log the exception
make it a huge try/catch
but there is like 20 js/jsx files o.O
are you getting the error in the terminal or in the browser console
Is it possible to get the message id from the createMessageComponentCollector filter
load one file at a time until you find the file causing the error
Ok so
I dont get the error when this is disabled:
const { guildId } = req.params;
const config = GuildConfig.findOne({ guildId });
return config ? res.send(config) : res.status(404).send({ msg: "Not Found" });
})```
show the full error
: JSON.stringify(value);
^
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Topology'
| property 's' -> object with constructor 'Object'
| property 'sessionPool' -> object with constructor 'ServerSessionPool'
--- property 'topology' closes the circle
at JSON.stringify (<anonymous>)```
is that all? nothing else after that?
there is
at ServerResponse.json (D:\dashboard-test\backend\node_modules\express\lib\response.js:260:14)
at ServerResponse.send (D:\dashboard-test\backend\node_modules\express\lib\response.js:158:21)
at D:\dashboard-test\backend\src\routes\discord.js:30:25
at Layer.handle [as handle_request] (D:\dashboard-test\backend\node_modules\express\lib\router\layer.js:95:5)
at next (D:\dashboard-test\backend\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (D:\dashboard-test\backend\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (D:\dashboard-test\backend\node_modules\express\lib\router\layer.js:95:5)
at D:\dashboard-test\backend\node_modules\express\lib\router\index.js:281:22[nodemon] app crashed - waiting for file changes before starting...```
Where do you get that from?
the error
User not found
