#development
1 messages · Page 86 of 1
Ratelimits make no sense imo.
Since they are responding to an interaction.
Only one could pop up on an interaction
that wouldn't be possible, they would work the same as modals as you said
just no inputs
now that makes sense
It still would be awful, and a good reason for me to not use a bot
tldr don't be annoying
A message doesn't interrupt my flow.
If I type a command I might want to type a second right away.
Pop-ups would make that not be possible for no real good reason.
I also like to use hot keys on discord.
Maybe I want to swap channels, now I need to do extra steps before using that hotkey.
you mean clicking escape
but it is good for announcements or something, like you have a button that says new update and if people are interested, they will click on it and there is a message that pop out
I hate modern ui for that very reason
that'd still be annoying
All of that could be communicated with a good embed imo
Or even just a message
yeah but you could just send an ephemeral message
basically the same thing
well yeah, just saying
but less annoying
even if it weren't an embed and was just a message sent afterwards that'd still be annoying since 99% of the time users don't care about updates
they want to run something and get an expected result
I dont necessarily disagree that it could be useful.
Sometimes it's hard to get users to read stuff, and a pop-up might make that easier.
But really, if a user doesn't read who cares.
specially for low-tech people
:))
a command guide would be nice for pop up
because embed limits character
Pop-ups would too imo
you could use buttons to pagination across multiple sections of the guide though
i think that would be a better process
Select menus are better anyway
yeah
I don't really like it (my opinion), because they are laggy somehow
Plus, walls of text for command lists are much worse imo.
I find them to be practically unreadable
i don't find buttons laggy 
i mean embed edit
don't really find them laggy either, most of my bots commands rely on paging through embeds and it works fine
well yeah, I use it too
well you as a user have ping to discord and then that needs to reach the bot and then the bot needs to reach discord and discord need to reach you
so if you and the bot have 300ms ping to Discord each then it would take around ~1.2s
you->discord 300ms
discord->bot 300ms
bot->discord 300ms
discord->you 300ms
does anyone have an idea? Ive been messing around and cant find anything for 7 hours now
TypeError: Cannot read properties of undefined (reading 'user')
const { SlashCommandBuilder, client } = require ("discord.js");
const { EmbedBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("info")
.setDescription("bots info"),
async execute(interaction) {
const embed = new EmbedBuilder()
.setTitle(`${client.user.tag}s Info`)
.setDescription(`All info about ${client.user.tag}.`)
.addFields(
{ name: "Members", value: `${client.users.cache.size}`, inline: true},
{ name: "Guilds", value: `${client.guilds.cache.size}`, inline: true}
)
await interaction.reply({ embeds: [embed] });
},
};
You need to get the client out of the event
?
In your case it is interaction, so your client will be interaction.client
thx
you mean variables?
Ello there
hi
how you been
this is development, there's no how you been
:c
Hello, I touch very little canvas and suddenly I need a little help with this thing:
ctx.beginPath();
ctx.arc(55, 95, 30, 0, 2 * Math.PI);
ctx.clip();
ctx.stroke();
ctx.drawImage(avatar, 15, 55, 90, 90)
ctx.beginPath();
ctx.arc(55, 190, 30, 0, 2 * Math.PI);
ctx.clip();
ctx.stroke();
ctx.drawImage(avatar, 15, 110, 90, 90)```
And suddenly I'm supposed to have two round avatars
And I only have one, the second doesn't even appear
- You're not closing the previous path, call the
closePath()method to do so - Once you clip into the current drawing context using the
clip()method, it stays there, so to unclip you need to save the state of the context using thesave()method before clipping, and then restore the state of the context using therestore()method after clipping to unclip
Question: I want to make my 1 - 5 buttons edit apon clicking the <- or -> buttons to match up with the list I'm providing.
When a user clicks on for example ➡️
case buttonsList[8].data.custom_id:
{
buttonCollector.resetTimer()
page = page + 1 < pages.length ? ++page : 0;
row.components = []
for(i=0;i<5;i++) {
row.addComponents(buttonsList[i])
}
buttons.deferUpdate(interaction.editReply({embeds: [pages[page]], components: [row, row2], ephemeral: true}))
break;
}
But trying other ways aswell, I don't seem to be able to change the label. All the lables when beginning are
//this is buttonList array
new ButtonBuilder()
.setCustomId(revisedRandId())
.setStyle('Primary')
.setLabel(`${page + 1}`), // + 2, +3, +4, & +5 for 1 - 5 buttons
any suggestions?
Seems I had to redeclare the array within the case for the arrows. But it works now so disregard.
hey
hey, I'm trying to add "h1" in my description, and tried like this, but nothing happened, what am I doing wrong exactly?
anybody knows why this is happening?
my txt gets cut in half
it depends on screen size

<h1> Introducing </h1>
but check the convo in #support
can you not make text bigger in headline?
Thx !
@odd citrus how did you make your background image so clear?[3:45 PM]Mine fades away in the black shadows, yours beautiful and light blue[3:46 PM]you rock btw
If it doesn't work, you probably know the answer
` npx node ./src/index.js
node:internal/modules/cjs/loader:1170
throw err;
^
SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
at parse (<anonymous>)
npx node ./src/index.js
node:internal/modules/cjs/loader:1170
throw err;
^
SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
at parse (<anonymous>)
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1167:22)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/home/runner/Discord-500-Commands-Bot-1/src/index.js:10:17)
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)
exit status 1`
help plz
https://scs.twilightgamez.net/g/dQDGp.gif can you wrap ur error like so
lemme try
npx node ./src/index.js
node:internal/modules/cjs/loader:1170
throw err;
^
SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
at parse (<anonymous>)
npx node ./src/index.js
node:internal/modules/cjs/loader:1170
throw err;
^
SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
at parse (<anonymous>)
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1167:22)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/home/runner/Discord-500-Commands-Bot-1/src/index.js:10:17)
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)
exit status 1
ty
there you go
how can I change the color of my text?
You have a given file, you have a given line, check what is there
The error shows that you have a string where it shouldn't be
i cant figure out!
in webhooks.json
/home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json here?
Yea
but there are only 58 lines
I wonder if 1826 is the character count
um lemme check
What is the command to add color on text? like <h1>
yes
Great! Me as well
i think there is no such error there
if u dont mind can i invite u in replit?
XD
I'm good. You can share you json here tho..
k wait
And to be fair, seeing the code itself that writes to the json probably will be handy.
there u go
um>
What's "Token" actually.
Webhook token
Ah cool
yep
can people yoink that and do naughty stuff 
Wait
what do u mean?
as in don't share things that only you or ur team is ment to see
But it's the same token and id I guess
deleted
yes
Zoo to the rescue! 
Then why do you copy and paste it so many times when you can have it in one line
i am not that good in programming hehe
what can i write? btw .
Anyhoo. What I would suggest doing to help us help you.
You can share your json, but make sure the "token" values are hidden from us, just like delete it temporarily. Then, share us the code that calls the json just incase it's from there
but its half
half is deleted
can u plz solve
{
"startLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"shardLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"errorLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"dmLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"voiceLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"serverLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"serverLogs2": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"commandLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"consoleLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"warnLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"voiceErrorLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"creditLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
}
"evalLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
},
"interactionLogs": {
"id": "1063091856373727282",
"token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
}
}
my internet provider is here, so I may have to go for a bit. What code calls there values? Maybe NyuNyu can solve it while I'm afk
💀 those tokens are invalid, aren't they
No scroll up ull see his issue
no
it's also half his token zoo so dw
@deft wolf
You’re missing a comma after your creditLogs object
ohhh
thanks my fault!
even if it did, I don’t think that someone using a replit template would find it that easily :p
Also replit is pretty garbage with intellisense
That's true
Hey there! I wanna ask that can i format code using shift+alt+f
?
Depends on the IDE or code editor you're using
I'm using vs code
Will it work?
But most IDEs and code editors provide a way to customize your keybindings
So that will not work?
Actually, I am not on pc right now so I'm asking
On what operating system?
Windows 8.2
What you said is the default formatting keyboard shortcut on Windows, so yes it'll work
Will my code look good?
Even if it doesn't, you can customize it to work with any keybindings you want
Ok.
Ty
That depends on the formatter being used, but usually the formatters will make your code look good
Okk
© Uo | 2021 - 2023
All rights reserved
System >> Version 9.0.4 loaded
System >> Starting Shard #1 ...
(node:700) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:707) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166
reject(new Error('SHARDING_READY_TIMEOUT', this.id));
^
Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
at Timeout.onTimeout (/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166:16)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
[Symbol(code)]: 'SHARDING_READY_TIMEOUT'
}
exit status 1
what's the issue?
plz reply anyone
where do you get the secret key from?
developer portal
what?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
my axios is not for discord
oh
from the website
© Uo | 2021 - 2023
All rights reserved
System >> Version 9.0.4 loaded
System >> Starting Shard #1 ...
(node:700) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:707) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166
reject(new Error('SHARDING_READY_TIMEOUT', this.id));
^
Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
at Timeout.onTimeout (/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166:16)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
[Symbol(code)]: 'SHARDING_READY_TIMEOUT'
}
exit status 1
could u plz help me out
do you need sharding? Id assume no so remove it
where will i find it>
In your code...?
ik but where
i also didnt write myself my friend done it
then ask him
he is off for serverl weeks
where can i find it tho
I dont know because code doesnt look the same for everyone
everyone writes code that looks different
You gotta look for obvious words like "shard" or "manager" in your code
i got where is shard but can u tell how to remove it?
try around
can u tell
no
😦 OK
looking at that code it seems like your bot doesnt do anything
so removing the code wouldnt do anything
neither would keeping it do
Bruh
my bot was working fine before like 30mins ago
after it restarted
please learn to code
it dosent start
i am new to code
plz help me out to solve my error
yes?
like what am i doing?
tbh that code just looks like a template from github
I suppose he should remove Javascript from his bio for now
☠️
which java version is good for lavalink
I advise you not to ignore those warnings
the one listed in the repository
i tried installing v13
this happen
how did u install java? through apt?
sudo apt install openjdk-13-jdk
try running java --version
java is not installed
hm, do echo $JAVA_HOME
when i run install cmd its shows this
ah, that's apt then
well, u don't install like that, I thought u somehow managed to isntall it already
java isn't on apt
how to install then
there're instructions on openjdk
i find on google i didnt get anythign
show what u searched
can u send me the website where i get the tutorial
did u search for it?
apt-cache search jdk to see if your distro even have repos for it
jdk isn't on apt, u gotta install manually
it is on some distros
the one that's available there is long obsolete
true
iirc it was still 8 or 11
but tbf I never update to the newest java lmao
does lavalink run on java 17 ?
try it and see
name, I got the tutorial link on my clipboard, I just want the truth
did u search or did u lie?
which onew
it's worth it, some stuff like GC got heavily optimized recently
yes, that's the tutorial
read the first link
...I think ur missing the point
but well, go on then, install it
btw, the one in that tutorial isn't openjdk
it's oracle jdk, and you'll need to sign in to download
also you'll be liable if u ever monetize ur bot
mfw I ended up using dockers to avoid compatibility issues on specific java versions
yeah get openjdk
java isn't really hard to install on ubuntu tbh, just wget the release and set JAVA_HOME envvar
been there
much easier than doing it on windows
lmao how
no
fucking
clue
so I never bothered with new versions that caused my java-based bot to die
so dockers it were then
I never got compatibility issues when upgrading versions, perhaps one of the libs u used relied on unsafe packages (like sun)
I'm waiting for the next release that'll introduce virtual threads
and switch pattern matching
like ```java
switch (number) {
case Integer i -> ...;
case Double d -> ...;
case Float f -> ...;
case Long l -> ...;
}
nah, got to a point where i had enough of switching to different versions because of me being dumb on setting it up properly
i never got the compile shit on it so
TypeError: Cannot read properties of null (reading 'avatarURL')
const joinembed = new EmbedBuilder()
.setTitle(`Thanks for Inviting RocketX to Your Server`)
.setDescription(`My Commands are </ping:1062467283785625783>, </info:1062842490450878515>, </server:1062467283785625784>, </help:1063171713375940680> `)
.setThumbnail(client.user.avatarURL())
client.on(Events.guildCreate, (g) => {
const channel = g.channels.cache.find(channel => channel.type === 'GUILD_TEXT' && channel.permissionsFor(g.me).has('SEND_MESSAGES'))
channel.send({ embeds: [joinembed] });
})```
Your embed must be built inside to be able to access the client
client.on(Events.guildCreate, (g) => {
const joinembed = new EmbedBuilder()
.setTitle(`Thanks for Inviting RocketX to Your Server`)
.setDescription(`My Commands are </ping:1062467283785625783>, </info:1062842490450878515>, </server:1062467283785625784>, </help:1063171713375940680> `)
.setThumbnail(client.user.avatarURL())
const channel = g.channels.cache.find(channel => channel.type === 'GUILD_TEXT' && channel.permissionsFor(g.me).has('SEND_MESSAGES'))
channel.send({ embeds: [joinembed] });
})
More like this
- you have absolutely no client defined
The only thing you have access to is the server where the bot will be added
might want to make it channel?.send instead, since it's possible that there wont be any channel to send message to
fair
I'm also wondering if the channel won't return a few channels
@lyric mountain hey my lavalink is not connecting
idk why i used default 2333 port and the external ip of google cloud
does the log show something?
try pinging that port
from your vps
btw, gcloud is by far not enough for music
at least not the free tier
music is very resource-intensive
anyway, try pinging the port
literally ping
yaa wait
btw when i ping the vm from my windows terminal it work and ping the ip
can anyone explain me how an interaction can be in a "null" channel ? 😅
it shows the latency
What is .isDMBased() because it's the first time I see it
but still bot cant connect
Alright, I found it
see if u didn't miss any of the install steps
and if the port is properly configured
lavalink is running properly
check if a channel is a dm
port i used is 2333 as given in the docs
I know, I already found it in the documentation
did u open the port?
how ?
i have a repo on github with lavalink files
i used same step and file on linode
and it work on linode
but not on gcloud
and port is open
aren't u using the original repo?
i used the file from the original repo
lavalink just need 2 file lavalink.jar and application.yml
yes, I asked cuz u said "I have a repo"
but if ur getting files from the original repo then it cant be lavalink issue
are you 100% sure the log doesn't say anything?
also double-check if the port is open
I may have misunderstood but it still doesn't work:
ctx.beginPath();
ctx.arc(55, 95, 30, 0, 2 * Math.PI);
ctx.closePath();
ctx.clip();
ctx.drawImage(avatar, 15, 55, 80, 80);
ctx.beginPath();
ctx.arc(55, 190, 30, 0, 2 * Math.PI);
ctx.closePath();
ctx.clip();
ctx.drawImage(avatar, 15, 155, 80, 80);
what is it supposed to do?
have two round with avatar
one below the other.
Problem I dont know too little about canvas.
And I don't think I understood very well what Voltrex explained to me.
If someone doesn't give a bot manage messages and I run <message>?.delete since I know that adding ? is for if something could work, will it still throw the missing permissions error? Idk when using ? is proper to use.
error on my part because I wrote too quickly I edited the message and even by changing that nothing
and when I delete the other the second appears
//ctx.beginPath();
//ctx.arc(55, 95, 155, 0, 2 * Math.PI);
//ctx.closePath()
//ctx.clip()
//ctx.drawImage(avatar, 15, 55, 80, 80)
ctx.beginPath();
ctx.arc(55, 190, 30, 0, 2 * Math.PI);
ctx.closePath()
ctx.clip()
ctx.drawImage(avatar, 15, 155, 80, 80)```
Just a random thought, its both ctx, is one just overwriting the other?
I don't understand what you mean sorry?
bot not having manage messages permission won’t make “<Message>” undefined. i suggest you to make a void catch instead. idk if that’s good but i use it on my every single delete
Gotcha. Thank you.
Also realised my invite URL on top.gg basically was just the bot getting invited w/o permissions. So that's sick
even tho I'm pretty certain I used my default invite URL but whatever. 
ctx.beginPath();
ctx.arc(55, 95, 155, 0, 2 * Math.PI);
ctx.arc(55, 190, 30, 0, 2 * Math.PI);
ctx.closePath()
ctx.clip()
thx
java be like
g2d.setClip(new Ellipse(centerX, centerY, sizeX, sizeY));
dont forget new Center(integer)
honestly I just put the coordinates directly 😅
I do enjoy how straightforward java graphics framework is
graphics2d
oh ok I didn't t ry that one
to be fair I'd expect it to be straightforward considering it's 20+ years old
it's the official built-in framework
trying to figure UDP out is a little confusing
Made a moc-embed of me trying to think of how to make this as pretty as I can even tho emojis will always imo look the best.
How does this look?
https://scs.twilightgamez.net/jdzVV.png Can't replicate it 100% however it's close enough
Is it just me or does the top left emote not look centered in the button
Looks fine to me
I wish I could make buttons smaller, and have a max of like 10 so I can string them across like how I do emojis now
none of them are
the color of the BOT label is throwing me off
what errors?
The Way it's setup is throwing me off
Good evening, I have a problem with the node-gyp installation. This is what the console tells me:
(although I have visual studio installed with desktop c++ I don't understand)
open windows power shell in administrator mode
npm i -g windows-build-tools
"Downloading installers failed. Error: TypeError: 'process.env' only accepts a configurable, writable, and enumerable data descriptor"
https://scs.twilightgamez.net/g/0KBzg.gif well it's uglier but got it to work.
Now discord needs to allow size options for these things and a limit increase per row for me to feel satisfied. 
What language are you using?
Js
U could use 🔇 for mute
Oh cool
perhaps asking a specific question would help?
good point
https://scs.twilightgamez.net/Tu1O8.png I assume it would look more like how urs looks
strange
Doesn't render for me lul
It will be like that
It's what me and waffle sent
I just can't see it cuz mobile
The UTF representation is different-looking because that's what discord needs to be sent
I got 2 different emojis 😛
If u send that emoji in the chat it'll become the one in discord
You can't send it :mute: since it's expecting one char, it's just discord will render it differently when posting that to a button
aight
It's just unicode vs discord render differences
how much time does it usually takes to approve the bot?
how do you get a secret key when it comes to using axios
i didnt understand how the secret key works

._.
Banned
What's goingbon
Thanks

context?
It’s gonna be different for every service but I’m assuming you just mean an api key?
@real rose also here
tik these balls
Hey how does djs permissions “serialise” method work?
Like permissions is a bit field or something and then when I call this method it returns an object
What’s the logic behind this?
The actual code is pretty simple: https://github.com/discordjs/discord.js/blob/8c265b628d90eb5161e3f96cff49522782a899a6/packages/discord.js/src/util/BitField.js#L118-L122
It just takes the list of permissions, filters for the ones the permission instance has, and returns an object of it
Serializing permissions is really only useful if you need the permissions in a more generic format
So they’re adding up numbers ?
Any DOM variable that returns a number based on amount scrolled is always zero for me
No. Serialize filters for the permissions the permission object has and returns an object representing it. Internally, checking permissions just uses bitwise and (&), which is inline with how Discord handles permissions (as a single int)
If you're interested in the actual bits, a permission in its bit form is just a number, but as a set, constantly doubled, starting at 1, then 2, 4, 8, 16, 32, etc.
To get the sum of permissions, you just sum up the numbers to get a single number
The numbers doubling allow them to be distinguished. If you want to see if a user has admin (represented as 1), you just do perms & 1, where perms is the sum of permissions, and see if the returned number is the same (if it is, they have the permission; if not, they don't)
If you want to read more, see https://discord.com/developers/docs/topics/permissions
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Nice thanks!
If you want a more thorough guide into how to program with bits, I recommend this guide in Swift (not JS, but a familiar syntax, so you may be able to interpret it; plus the images are good): https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html
is there any maintained package similar to canvacord?
There is none, just use https://npmjs.com/package/canvas to make things yourself
There's also https://npmjs.com/package/canvas-constructor which is basically canvas with additional utilities
is there any template for a level card?
Okay and?
It might take some time sometimes depending upon how busy the staff is. Just wait, nothing more, nothing less
@untold steppe me 2 week wait
Ya, it might take a long time sometimes, if they say 2 weeks, expect 1 month
@untold steppe ok thanks
so what do you guys do when everything works but you still got these errors around
click on quick fix and hope a good solution is available
it's complaining that you haven't assigned a type to filteredData
you could be lazy and just say : any so it shuts up
or assign a proper type for the situation

well in that case it's just a button function to filter items soo i think i'll go with that
What would be a good way to work around this specific error. This occurs when someone invites my bot, plays music, and just kicks the bot. Since the music player is active and as soon as it leaves a disconnect event fires and says "Finished playing music!" but since its a no-longer cached channel, it can't.
Promise {
<rejected> Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
at Message.delete (/etc/opt/NyuMusic/node_modules/discord.js/src/structures/Message.js:783:30)
at Timeout._onTimeout (/etc/opt/NyuMusic/src/library/functions.js:250:104)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'ChannelNotCached'
}
}
.on("disconnect", async (queue) => {
const getEmbedFromDB = await client.database(`SELECT message_id, voice_channel_id FROM music WHERE queue_id = ${queue.id}`, false, true)
if(getEmbedFromDB[0]) {
let m
try {
m = await queue.textChannel.messages.fetch(getEmbedFromDB[0].message_id, {limit: 1}) //it fetches fine appearently.
}catch(err){}
if(m) {
if(m.id === getEmbedFromDB[0].message_id) m.delete()
await client.database(`DELETE FROM music WHERE queue_id = ${queue.id}`, false, false)
await client.successEmbed(`Finished playing music! Disconnecting...`, queue.textChannel, 7500) // but here it fails.
}
}
})
Its an await which means a promise, which means you can catch it and just log an error message or something (never void errors its a bad practice) but it’ll result in your bot not crashing
Huh?
So the cache part. Obviously the bot leaving will uncache a channel however, its still able to fetch it.
Can you elaborate
read my comments in the code
Ahh
So if I get it right
The bot can fetch the channel even though it’s not in the server?
Is that what you mean?
It appearently does because if(m)
Mhm
I havent used djs since v13 but maybe you can get a list of all guilds of your bot and check if the guildid of that channel is in that list
ty
I'm surprised you can delete the message given that the bot was kicked
ya it's specifically throwing that error within client.successEmbed() at this piece of code
return setTimeout(() => {if(channel.messages.cache.find(m => m.id === timeOut.id)) timeOut.delete()}, time)
probably not the best way of doing a timeout
but it works
It doesn't fail when calling you're calling your custom successEmbed() method as you commented, it's thrown when you delete the message
Ahh
Look at the call stack in the error
at Timeout._onTimeout (/etc/opt/NyuMusic/src/library/functions.js:250:104) yes this part
which is
^
I forgot to put that part in my above code my b
but the whole reason this is even failing
is because it's still able to fetch an uncached channel
What exactly is the timeOut variable declared as?
the successEmbed
sec
client.successEmbed = async (str, channel, time) => {
const sucEmbed = new EmbedBuilder()
.setColor("#00FF00")
.setTitle("✅ SUCCESS")
.setDescription(str)
.setTimestamp()
if(channel && !time) {
return channel.send({embeds: [sucEmbed]})
}
if(channel && time) {
const timeOut = await channel.send({embeds: [sucEmbed]})
return setTimeout(() => {if(channel.messages.cache.find(m => m.id === timeOut.id)) timeOut.delete()}, time) //here
}
if(!channel && !time) {
return sucEmbed
}
}
Well one way to solve thzt would be to store all the succesembeds in a map (create your own cache) and remove them after x amount of seconds and also remove everyone of a guild when the bot gets kicked and add another if statement to the timeout for if the guild of the message is in the map
If you get what I mean
That's not gonna work, you should try deleting the message and catching the error
It works quite well actually. It only fails on this specific instance
I meant that it's not gonna work for this scenario
Ah fair 
I could just .catch() ya
but my main question really and I'm glad you're here voltrex
m = await queue.textChannel.messages.fetch(getEmbedFromDB[0].message_id, {limit: 1})
Why does this work when its uncached
What is uncached? The channel?
Well everything
because...
The person who played a song, kicked my bot while it was playing
so it ran through the code and if(m) returned true so it ran the rest
There's a very high chance that the bot sent a request to that endpoint and successfully fetched the message right before it was kicked
It would've failed if it was sent after it was kicked
I see.
so realistically, best thing to do is just to .catch() and move on with my life 
Yes
works for me
There can be a lot of edge cases with the Discord API so spam catch everywhere /s
I specifically did that whole
let m
m = fetch message
if(m)
thing to prevent this but I still got beaten by random users who magically know ways to make my bot hate me
1 sweaty nerd who tests his own code for hours on end vs 1 random user who wants to listen to music. Who will win, find out next time in the next episode of...
also is this valid js timeOut.delete().catch(err)
It's funny how the users are able to find every edge case you didn't even expect to see
it doesn't need to be in a try catch right
%Promise.prototype.catch()% requires a function
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
I see
🙂
function ignore(f) {
try {
f();
} catch {}
}
would need to await
:(
I need help with a duration command to show much of the song is left (I use youtube_dl and d.py)
Store the timestamp when u start a song
Then just do start + duration - current
And convert the millis to ur desired format
If u have a pause command make sure to store a pause timestamp too
fuck sockets
can I just go the "fuck it" way and have js just make a request to some endpoint every 10 seconds or so
What's the problem?
keeping track of active sessions, making heartbeat messages towards the sockets
Though I'm certain its me not fully understanding that library am using
so just closed it and didnt bother with it anymore, its 5 am anyways
Keeping track is fairly easy, just have a map where u ads sessions on connect and remove them on disconnect
is what I did, with IDs along it since I wanna occasionally talk to these sessions when needed
You're supposed to send a ping regularly, if any of the clients fail to pong back just send a close frame and remove it as inactive
yeah but its probably just the shitty library am using
I always used java for the backend, so idk any good ws server libs
Is this js or py
working fine last night
why is my bot offline but is running on replit?? working fine last night
we dont know
😦
what could be the reasons?
np pkill 1 worked
What is the best place to host a vps for a discord bot? For less bot ping.
Wdym start and duration?
It's probably best where you live and if you want to have a public bot, it's rather something in the center, such as in Europe in France or Germany
Personally, I have a VPS in France and I don't complain much about the ping, but it would probably be higher if I had a VPS in the United States
Eh, one week passed
Just one more
Lowest ping is around 20ms in Ashburn
Close to discords main dc
my bot is now already two weeks in verify and still no response
Timestamp when song is started + duration of the song
In some of my server the bot is not online even after a restart
i did 4 restart but still the same server
i know it was 13.62k server before restart
Someone give me topgg invite link pls
thanks
anyone has a clue how i move this image more to the right? I've tried mr but it didnt do anything
if it's a flex, you can use justify-content space-between or space-around to make a space between it that will make the image move to the right
or with position:absolute
absolute 
absolute, if you dont care about your users
why use mr if you wanna move it to the right?
oh bootstrap?
tailwind
icic
ok thanks
Can also create an invisible div between them
how would that work?
changing the width of the div, so it moves?
I am working in ICICI Bank but then I realised this is what I see I see 🤓

Shortcuts 🙈
I'm trying to make a select menu and this appers
{"code": 50035, "errors": {"data": {"components": {"0": {"components": {"1": {"_errors": [{"code": "COMPONENT_LAYOUT_WIDTH_EXCEEDED", "message": "The specified component exceeds the maximum width"}]}}}}}}, "message": "Invalid Form Body"}
Why is this happening?
what is that width?
Am I allowed to use the topgg sdk to make and publish my own library. [ to make use of api more easily? ]
as long as you dont claim its official
not an official topgg stance, but I don't see why not.
but also, the sdk is very simple to use already.
More simple
Xd
I mean, most things in the sdk are one line, one parameter.
I dont see how they can be simplified.
If you can find a way to simplify it though, I dont really see why we wouldnt allow that.
Yes, setting a margin would work too
get📊 is more simple
much easier to write
How do I get the duration of the song is what I’m asking since I use youtube-dl
Which one do you use
I notice you use python but there are a lot of youtube-dl libs
i feel honestly kinda dumb asking this.. but how the f. do i get a DiscordJS client object into a loaded module?
index.js
src\commands\ban\addwatch.js
loads
src\lib\watchlistmanagement.js
which uses client.watchlistDB2 which is created in index.js
fixd
either thread the client through your code via param passing or separate your client so it doesn't require things that'll need to depend on it
or, if you have a discord.js object, just access .client on it
I'd recommend the first or last one
Isn't what you are trying to achieve the opposite of the use-case of useEffect?
fixd fixd
TypeError: (intermediate value).setName is not a function
// https://api.popcat.xyz/showerthoughts
const { EmbedBuilder } = require("discord.js");
const { SlashCommandBuilder } = require("discord.js");
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("shower")
.setDescription("Sends A Shower Thought"),
async execute(interaction) {
const embed = new EmbedBuilder()
.setName("Random Shower Thought")
.setImage("https://api.popcat.xyz/showerthoughts")
await interaction.reply({ embeds: [embed] })
}
}```
const embed = new EmbedBuilder()
.setName("Random Shower Thought")
not possible
.setTitle
that's a slash command builder though oh I see now
lol
thanks big bun
np trigger warning roblox
SHUT UP
js mfs when their IDE doesn’t highlight a basic non-existent function error
lol
aren't you using js rn
👀
OK.. i've actually managed it to work.. kinda
My Problem now is that if i return something.. its always undefined.. like wtf.
"im gonna break my monitor, i swear" - calmly said by some random guy on the internet
I have no idea what you are talking about rn
same
so.. i have this function.. right?
const sqlite3 = require('sqlite3').verbose();
const watchlistDB2 = new sqlite3.Database('./database/watchlistDB.sqlite');
module.exports = {
async checkWatchlist(userID) {
var checkWatchListSQLStmt = `SELECT * FROM watchlist WHERE userID = ${userID}`;
await watchlistDB2.get(checkWatchListSQLStmt, [], (err, row) => {
if(err) {
toad.error(`CMD: /addwatch | ${err}`);
} else {
if(row) {
console.log("Is on Watchlist")
return true;
} else {
return false;
}
}
});
}
}
and when i call it somewhere else.. like that for example const check = await wlm.checkWatchlist(watchlistUserID); its result is always undefined
The Fun stuff is.. the console.log from the function works. so i know it got a result
if (err) nothing gets returned either
Also
I'd make a map of some sort of all the watchlist users, as making a lot of calls to an sqlite db is not good
Thats what i dont understand.. how can bools be undefined
Djs is written in ts
because if there is an error you are not returning anything
But i know that the query works.. because the log said so
You’re returning from the callback function and not the function itself
Return outside of the callback and your problem will be solved
Didn't even realize the scoping problem
Also do you even need to use a callback when using asynchronous
The async stuff was just a troubleshooting step because im interally raging lol
Okay.. even that didnt work.. also.. my table has now an imprint of my head
so uh
File "air.py", line 55
print(f"pm2.5: {pm25ug}, pm10: {pm10ug} ug/m^3")
^
SyntaxError: invalid syntax
cc: @spark flint python master pls help
no im busy
now getting
Traceback (most recent call last):
File "air.py", line 4, in <module>
import requests
ImportError: No module named requests
Based
import requests
😭
are you forking a bot
ImportError: No module named requests
i got requests already
i'll say the same as i would say to someone using js
learn the basics of the language first
pip3 install requests
ive got a project due tmrw
cant do that
try pip install requests
root@rockpi-4b:~# pip install requests
Requirement already satisfied: requests in /usr/local/lib/python3.8/dist-packages (2.28.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests) (1.26.7)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.8/dist-packages (from requests) (2.0.9)
root@rockpi-4b:~#
File "air.py", line 104
cmd = self.cmd_begin()
^
IndentationError: unindent does not match any outer indentation level

please just help me
ill learn later
i dont have time
i literally can't
class SDS011(object):
"""Provides method to read from a SDS011 air particlate density sensor
using UART.
"""
HEAD = b'\xaa'
TAIL = b'\xab'
CMD_ID = b'\xb4'
# The sent command is a read or a write
READ = b"\x00"
WRITE = b"\x01"
take that back
Is there a way to check if my bot is in a server with just an API call with the secret token, and not with an actual bot client?
I don't think so, given that'd imply some access to the member list, which requires an account
Though if by "secret token" and "not with an actual bot client" you just mean being able to request from the API without establishing an actual (websocket) connection, it should be possible, given the auth header. Actually maybe not, since you'd need to act as the bot.
Yes, u can only know which servers ur bot is in through the actual bot
If bots could authorize oauth2 you could use the servers endpoint, but they can't
Right. I think I figured out a local wa yto do it, if the server doesn't have a config then they most likely don't have the bot invited lol.
inb4 user kicks your bot while it's offline
Why I do a "Check all guilds / members" on boot thing and if anything has changed or is missing it'll throw it into my DB
this is not relevant to us whatsoever
do a speedtest
Why command still usable in dms?
You may need to wait for it to update
I had a similar situation where one of the commands worked in dm despite the fact that they are all written in the same way so that they could not be used in dm. After a few hours everything worked as it should
get a bot approved
Did i miss a memo or something like that?
If i define a Variable inside a function... i should be able to access it outside it?
no
then how the f should i get data from it?
the return value
didnt do shit for me
i just get an empty object out of it
but i know that there is data
but it hides from me
can you actually provide code
Of course...
case 'statistics': {
const watchlistDB2 = client.watchlistDB2;
const entryCountForGuildStmt = `SELECT COUNT(dbID) FROM watchlist WHERE guildID = ${interaction.guild.id}`;
const entryCountGlobalStmt = `SELECT COUNT(*) count FROM watchlist`;
var entryCountForGuild, entryCountGlobal;
entryCountForGuild = watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if(err) {
client.toad.error(`CMD: /admin statistics | ${err}`);
} else {
return row['COUNT(dbID)'];
}
});
watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
if(err) {
client.toad.error(`CMD: /admin statistics | ${err}`);
} else {
entryCountGlobal = row['COUNT(*)'];
}
});
console.log("Guild: " + JSON.stringify(entryCountForGuild));
console.log("Global: " + entryCountGlobal);
break;
}
Is there a way to get Discord's perception of time when running an interaction? I'd like my purge messages command to account for when Discord considers a message too old (currently I'm just taking my perception of time, going back two weeks, and adding a minute)
ah sh.. thanks for that discord.
You can either extract the timestamp from the snowflake or do this:
https://github.com/DasWolke/SnowTransfer/blob/master/src/methods/Channels.ts#L420
Minimalistic rest client for the discord api. Contribute to DasWolke/SnowTransfer development by creating an account on GitHub.
oh btw.. im using sqlite3
use better-sqlite3
Problem solved 
it unironically solves lots of problems with the older lib
besides, don't use var ever
also I'm not sure, but isn't .get async?
@slow ibex cm here
be scared
normally i use const so..
well.. tried all of them tbh
it isn't the solution to the issue, but will prevent u from getting memory and scope issues
The callbacks are already in an Async function
still
And i tried it with await but no change
you're returning a value, but if .get is async u need to await it
show the output
Guild: {}
Global: {}
global will always be empty cuz u cant assign a value inside an async callback
Oh no no no.. global != global.
put console.log(row) inside the first callback
see what it returns
and use aliases for aggregates
count(dbID) AS total
also, row is more likely to be rows, since it can return more than one row
this is what printed?
i just reverted that stuff while troubleshooting
show the current code please
yep
case 'statistics': {
const watchlistDB2 = client.watchlistDB2;
const entryCountForGuildStmt = `SELECT COUNT(dbID) FROM watchlist WHERE guildID = ${interaction.guild.id}`;
const entryCountGlobalStmt = `SELECT COUNT(*) count FROM watchlist`;
let entryCountForGuild = await watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if(err) {
client.toad.error(`CMD: /admin statistics | ${err}`);
} else {
console.log(row);
return row;
}
});
let entryCountGlobal = await watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
if(err) {
client.toad.error(`CMD: /admin statistics | ${err}`);
} else {
return row['COUNT(*)'];
}
});
//im gonna loose my fcking mind... why cant this be like the good ol' PHP days
console.log("Guild: " + JSON.stringify(entryCountForGuild));
console.log("Global: " + JSON.stringify(entryCountGlobal));
break;
}
is that sqlite3 or better-sqlite3?
sqlite3
"sqlite3": "^5.1.4"
does not look like that library supports async/await syntax
it only uses callbacks
that's beyond cursed
And it wasnt a problem for me so far.
therefore you must either use it the callback-hell way, or promisify it yourself
callbacks pretty ez tho
Idk if related, but I believe mariadb supports it if that's the route you wish to go.
easy yes, but unreadable (in this case)
the callback-hell way: ```js
watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if (err) {
client.toad.error(CMD: /admin statistics | ${err});
} else {
console.log(row);
watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
if (err) {
client.toad.error(CMD: /admin statistics | ${err});
} else {
console.log(row)
}
});
}
});
Oh.. i did that a couple of times so far.
and i hate it
why the f. did i forgot that..
i think im sleep deprived lmao
promise-way would be ```js
const prom = new Promise((resolve, reject) => {
watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if (err) {
client.toad.error(CMD: /admin statistics | ${err});
reject(err); // idk what's the fail version of resolve
} else {
resolve(row);
}
});
});
console.log(await prom);
well, that's why they created better-sqlite3
imma make this piece of crap runnable and then i look into better-sqlite3.
I have to fix this shithole quite fast so.. yeah.. already rewrote everything from JSONDB to Sqlite3
the query has to be inside the promise callback
const prom = await new Promise((resolve, reject) => {
watchlistDB2.get(...., (err, row) => {
if(err) reject(err);
resolve(row);
})
})
when did discord change the colours of their text highlighting? (the codeblock highlighting i mean)
wasn't it like that for js?
better-sqlite3 is much easier to use because its completely synchronous, so it works just like normal js, no async, no callbacks, no promises
The Promise way is actually cleaner and it worked like a charm. Thank you
caution must be taken tho, since u can lock ur runtime with shitty-written queries
Is there a way to timeout it?
for example if there is no result after 5000ms then just error out?
I didn't mean the promise, was talking abt better-sqlite3
ah k
since it's sync u need to make sure you dont lock ur only thread
yes, u can
const time = setTimeout(() => reject("Timeout"), 5000)
just make sure to cancel the timeout on success
was it when they changed the font?
already answered u
you did?
^
oh that
i also didnt notice any difference with syntax highlighting
case 'statistics': {
const watchlistDB2 = client.watchlistDB2;
const entryCountForGuildStmt = `SELECT COUNT(dbID) FROM watchlist WHERE guildID = ${interaction.guild.id}`;
let entryCountGuildPromise = await new Promise((resolve, reject) => {
watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if(err) {
client.toad.error(`CMD: /admin statistics | ${err}`);
reject(err);
} else {
resolve(row['COUNT(dbID)']);
}
})
});
const entryCountGlobalStmt = `SELECT COUNT(*) FROM watchlist`;
let entryCountGlobalPromise = await new Promise((resolve, reject) => {
watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
if(err) {
client.toad.error(`CMD: /admin statistics | ${err}`);
reject(err);
} else {
console.log(row);
resolve(row['COUNT(*)']);
}
})
});
console.log("Guild: " + JSON.stringify(entryCountGuildPromise));
console.log("Global: " + JSON.stringify(entryCountGlobalPromise));
// TODO: Embed magic
break;
}
Definitely better than before
# test
## this is an md
lol
before it was like this:
https://cdn.discordapp.com/attachments/272764566411149314/1011418741222940682/unknown.png
now it is:
i hate it, but then thats cuz i used it got my bot's menus rather than actual markdown
so in its actual usage its probably still ok
same
client update maybe?
oof was a recent update then
indeed, the js one is also different now
welp now i gotta change ALL my bot's menues to something that looks presentable
sigh
rip
mine also has some of that, but im just gonna leave it the way it is lol
i dont even know how it looks now
I'm guessing that ancii colours still are only supported on pc
I know that codeblock colouring only worked on android but oh well
also bruh my cd player command has melted for some reason
have to bork it and run the aux command for the audio link and then run the cd command to start the drive
and then connect the aux cable to the headphone jack of my cd drive
your bot is still the craziest bot i've even seen
lol
huh?
https://nettigo.pl/attachments/415 PDF of the sensor sheet
need to change it to active mode
yea
its in byte code shit
which i dont understand
and im not sure how to change the mode
@quartz kindle pls help if u know this stuff
i know nothing about machine code/hex really so i cant really help much
this is very weird but does anyone know why I always get a different json structure when requesting https://www.reddit.com/r/cursedimages/random/.json?
no, like the structure is different. in one its { data: [] } ... in the other its [ {} ]
I don't know then
like it works half of the time
suppose i fetch
result = User.findOne({ id: user.id})
amount = 1
//suppose result.wallet = 100
result.wallet += amount
result.save()
then am getting result.wallet = 1001 instead of 101. its adding the strings instead of the amounts.
I'm talking a fair guess that whatever result.wallet is, is string based
then you appending it to that
check the type of wallet
I have no idea what could be causing it. I personally use snoowrap npm for reddit and haven't had any problems with this library
what happens if you do result.wallet = result.wallet + amount
same thing I know, just wanna see what it does
since 100 to 1001 sounds like string appending to me, dunno why it provides you a string though
leme try probably it was still adding the strings according to my friend who tried it
strangely nothing changed.
i used this code:
const user = message.mentions.users.first() || message.author;
const result = await User.findOne({ userId: user.id }) || new User({ userId: user.id })
let amount = args[1];
if (!client.config.owner.includes(message.author.id)) return message.reply("u cant use")
result.wallet + amount
result.save()
return message.reply("done")
ah wait read wrong 💀
hmm after using result.wallet = result.wallet + amount still it added the strings
cant you check the type of result.wallet using typeof or whatever to use in js to check the type of something
hmm let me try
Could use Number(whatever) + Number(whatever) I think that's what I ended up doing with my currency system
inb4 it turns out not to be a number and you get NaN
let newBal = balance[0].currency + 100
well in my db I store them as ints
so I didn't do that
cause even if you 1a at that point parseInt will ignore a and give you 1 iirc
no idea, but that easy to fix
const data = Array.isArray(json) ? json[0] : json;
when its an array, it will have more than 1 item tho
and the url changes to /comments/
i assume amount, which comes from args, is an input from discord, and if so, it is a string, so result.wallet + amount is actually number + string
mhm, is there any way i can add both of them as numbers so it would end up like normal addition & not joining of strings
parse amount as int lol
Isn't that what we were just talking about
thanks everyone for your help. finally fixed it with your help 
ill try that too, thanks again
how can I do something like this:
let ok: interfaceXYZ<interfaceZYX>
?
aka how can Imake my interfaceXYZ support arguments?
wdym by an interface in an interface
I already got it, I mean this:
Interaction Already Replied
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const save = require("../models/bans.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("ban")
.setDescription("Moderation +")
.addUserOption(option =>
option
.setName("user")
.setDescription("Member to ban")
.setRequired(true))
.addStringOption(option =>
option
.setName("reason")
.setDescription("reason"))
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers),
async execute(interaction) {
const user = interaction.options.getUser("user");
const reason = interaction.options.getString("reason") ?? "No Reason Provided";
const embed = new EmbedBuilder()
.setTitle("User banned")
.setDescription(`${user} has been banned for **${reason}**`)
.setThumbnail(`${user.avatarURL()}`)
.setColor("Red")
await interaction.reply({ embeds: [embed] });
await interaction.guild.members.ban(user);
},
};```
when should I switch to a microservicec architechture (web backend server)?
I trying to build a mobile app, that has a server behind it
but I don't know, if should build microservices from beginning or not
you use InteractionDefer and then InteractionResponse?
hm?
Like you defer the interaction and then send the actually message?
because when it shows that you already replied the message
you should edit the message, or just send a followup message
fixed
you were supposed to make the server before the frontend
yes
now I'm starting the project
but I don't know what architechture to use
wdym "architechture"?
you know, there is a monorepo, microservices and so on
just make a backend
like, normal server
don't worry too much abt those things, make whatever works then optimize ur way up
I know, but maybe in the future I will scale it up and one server cannot handle it, so I need to split it in the future. What if I split it from the beginning (ik, it won't be that big, just learn, how it works)
having 20k+ users is just a dream, but yeah :D
just make a single server, if u need to scale it later just install the api in the other servers and let nginx balance it out
20k is absolute nothing
unless u buy the worst possible server available, u wont have issues until u hit hundreds of thousands
yeah, my idea was using kubernetes and nginx to host it
start with splitting the backend into two processes, that way you can design with horizontal scaling in mind since the beginning
you mean like threading? or smth else?
sure, threading also works
ah, well I will use golang as my main lang and it has auto threading, so I think I don't need worry about that
no lang has auto-threading, unless you mean something else
it basically does
I mean goroutine


