#development
1 messages · Page 2051 of 1
does it use analog cpus?
Hey guys, for the new slash commands.. for aliases should I just register another command with the alias? or is there a way to make aliases
I don’t see why using aliases makes any sense anymore
The description tells you what the command does, so why would you use multiple commands with the same description doing the same?
Makes the list of commands when entering the / much more confusing then it needs to be
yeah makes sense
one more question, for the options if you require a user input like /profile <user>
would it be USER or Mentionable
Discord.Constants.ApplicationCommandOptionTypes.USER```
the docs have gotten quite abit messy and hard to navigate for stuff like this ive been trying to find it
this is where im confused
Heres my options
options:[
{
name: 'user',
description: 'user',
required:false,
type: Discord.Constants.ApplicationCommandOptionTypes.USER
}
],```
Would it be this?
const { commandName, options } = interaction;
const other_person = options.getUser('user');```
mention me please when someone has the time to answer
it's user
Since you don’t the builder tools, just use the right integer for the type according to the discord docs
well id rather use the commandtypes because its more readable then a random int
True but djs fucks up their versions every time
djs is so unintuitive to work with nowadays
idk if its because of the discord api and their hands are tied or
honestly I kinda like the new djs
it is more advanced
and theres more to learn
but its still pretty good
Which might be different (again) in the next version
Even such simple things like accessing the command types
me too, I really liked it but dapi needs the stupid slash commands
idk why they moved to that like how are xp systems gonna work
yeah that brings additional complexity with writing bots
also theres many weird gray areas like nsfw in ephemeral replies
especially with registering commands, whats considered api abuse with that? everytime my bot boots up it needs to register the commands, because I have global ones and private whitelisted ones
You gotta build a proper handler registering only new commands, updates existing ones only if anything has changed or deleted the ones which aren’t locally loaded anymore
You should not have to register the command each time the bot boots, only when there has been changes 🤔
I made a handler
Which can be easily archived by fetching the app commands once your bots starts and compare the fetched ones to your locally loaded ones
nsfw in ephemeral replies
Yeah, thats a nono, unless it is ephemeral in a NSFW channel
do you wanna see it? its not very efficient just got into slash commands
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
these slash commands are getting way out of hand for me
kinda jumped into the update process and didn't expect so many changes
Instead of using an availability for local and global you could use an array of guild IDs the command should be registered to
null or no guildIDs property in my case means it’s a global command
Therefore I can even create guild commands for specific guilds only
well I just use a whitelist system for music
as its not very allowed
and stuff like eval etc
for like 2 servers
But still registering the commands on any startup is a very bad idea
As the registration process takes up to an hour for global commands
well im not even sure how to check if a global command exists
Means overwriting commands by re-registering them can lead to the case the old commands throw an error when being executed until the update has been pushed to all guilds
By fetching the application commands on each startup
Lemme…
I can show you an example how I’m doing the job
Yeah that happens when registering the commands on a startup which are already registered
As the replacement process takes up to an hour to be pushed to all guilds
what if I just push all to local guilds
because they're instant
instead of using any global
But the (old) command ID (application ID) is NOT valid anymore once you overwrite it due the registration process
That's also a very bad idea
That results in API spam once you push tons of commands to ANY guild on a startup
I thought discord changed the way registering global commands works and it should not take an hr anymore
🤔
And you will also run into issues once you have to restart the bot a few times a day as there's a limit on how many registrations you can do per day globally/per guild
why did discord need to do this to devs ;-;
I mean let's be honest
Registering something is ONE TIME process
that's what the same says
that's why the update endpoint (PATCH) exists
Don't get confused by the size
once getting into it, it's actually very simple
Yeah you do huge indentation lol
I'm simply fetching the global application commands, loop throw them and my local loaded ones, compare them to each other and register/update/delete them if needed
(for global and guild commands)
it's just one TAB but getting replaced with a lot of spaces by hastebin, not my fault
my editor is replacing TABs with 3 spaces
basically
=> load all commands that are already registered
=> compare them
=> delete ones that aren't there
=> create ones that are new
=> update them if anything changed in their description
=> if nothing changed just continue to the next command
exactly
I do also loop and compare the command options not only their description
But to make it a lot more easier, the description should be enough
or just make a private command to just bulk update all of them
for options and descriptions
That's what I was writing at this moment
To enforce an update
As discord sometimes fuckes up app commands
that makes sense, im suprised discord inforced slash commands, I know it took a load off the api but technically its just moving it to a different system
if discord servers go out imagine all the bots booting back up and re-registering their commands if they were coded like mine
it's like with everything... it takes some time to get into something new, but slash commands aren't that bad
if they would only get the features everyone asks for
well discord sometimes listens
but yk the connection thing
3 years ago people kept asking for soundcloud and they still haven't added the support
might be true, but they take forever to implement something into their ecosystem
yeah they really do, but it does make sense, they gotta deal with lots of stuff
that's not how you should do it if you enforce people to use your new technology
especially if it's missing a lot of promised features
all I ask is for allowing creation of commands with variable syntax depending on supplied arguments
this ^
Not sure where to post this, but I'm trying to create a proxy between two servers using minecraft-protocol. How I achieve this is relatively simple, but now I'm having trouble sending packets to the client. I get the error in Minecraft, "Malformed data: JSON". Code: https://sourceb.in/UdUFo9dt7n
Oh, I'm also working with Minecraft version 1.8 which is why client.write is a bit different from the example on GitHub.
is the client expecting a json?
yes i believe so
hey
console.log your request to see what you're sending
also on the client-side if possible, to see if it's receiving the same data
okay. will do ty
Has my bot been approved?
the packets specifically? if so yea im sending json data. at least i think so. it sends { keepAlive: some_number_here }
c++/gcc compiler did-you-know #1 - did you know you can make use of 64-bit numbers fully in 32-bit compiled architecture code? this is since gcc provides runtime support for them
Okay I updated the code a bit.
client.on("packet", (packet) => {
for (let a in packet) {
console.log(a);
console.log(packet[a]);
client.write(a, packet[a]);
}
});
Good news is that it logs stuff correctly. Bad new is that there's a new error now haha. Anyways if anyone has any ideas lemme know
No
was denied ?
Also no
Are you still waiting?
When did you submit it?
I'll see the day there
Bad terminator maybe?
Inb4, waiting time is around 1-2 weeks
Maybe. Idk Minecraft Protocol is painful. The documentation doesn’t tell me anything about what I want to do which is just duplicate packets sent lol. And they don’t have a support server 🙏
I mean, minecraft doesn't even support mods, they had to makeshift a wrapper
05/6
@boreal iron Sorry for the mention man but just asking, what does the ```js
await this.client.application?.commands.fetch({ withLocalizations: true })
Im asking because ive never seen { withLocalizations: true} before
So no, you need to wait longer
That’s fair.
it uses that 32-bit extended feature right?
Physical Address Extension (PAE), sometimes referred to as Page Address Extension
i dont think so
its software simulated
its still pretty cool tho
gcc handles it behind the scenes
so you dont do any extra code or thinking
thats why i changed up some of my underlying os code so that it supports certain gcc runtime features like this
That does fetch all registered application commands to the API
The localizations option in a relatively new feature of discord supporting multi language
@quartz kindle by the way to track time accurately in an os you have to get the total elapsed cpu clock cycles, find how many cycles elapse per second and then use some maths to figure out the rest
its not pretty
especially since some cpus have boost and slowdown frequencies
@cloud bough regarding command’s localization
Im fetching all registered commands on a startup to have something I can compare to my locally loaded ones
one doesn't simply make a "simple discord library"
if you're gonna get raw you'll have to deal with handshakes, endpoints, websockets and ratelimits
this just to CONNECT to discord servers
If I wouldn’t do that I would never know if there’s a registered command existing but the local one has already been deleted (or not)
well, you can, but you wont find any videos or easy stuff
only the raw docs and willpower
Are you even sure you wanna create a library?
Like what is the purpose of it?
If you want a really challenging project that will take a lot of trial and error, why not
Yea,
for fun
FIFY
its not hard to create a barebones library
just use ws to connect to the websocket for example
that's the first step then
ws is nice
well you will have to understand them at some point, they are pretty well written and not hard to understand
Then you will experience errors, needing proper error handling, then you will run into rate limitations, needing proper request handling, etc.
if there's any terminology in there that you dont understand, then you need to learn about what they are talking about first
check out ws on npm
You start with something simply requiring a lot more effort than you think
contrary to cof cof winapi docs cof cof
Fun fact, I work with one of the guys that created it
oh nice
could be better but the ws spec is complicated and they dont wanna go anywhere more creative with it
i use ws to scan all new ssl certificates and check for scams 
Yeah. I may have been talking about why I wasn’t the biggest fan of ws to my manager, who then mentioned it to me that einaros is actually working in the same company
Like literally a few desks down
just be like "hey bro, kinda don't like ws, pls make it good. thx"
Well… he isn’t actively contributing anymore
ah
yeah thats often what happens when a library takes off
the creator retires and the community keeps it running
Yeah. Understandable tho
Open source projects is a full time job and not often well paid
ye
Nah but ws gets the job done
yeah
as a client is more than good enough
as a server there are better alternatives, but you dont need a ws server for discord
Anyone have ideas why I cant get my webhook to register?
When i manually make a POST to the same endpoint it works
but not when I click Send Test
how are you testing it
Postman
on the same pc/server?
no
oh
Have you deployed it to a external accessible url?
Humm… any firewall rules to only allow your IP?
I’m on my iPad atm unfortunately
ive got no firewall rules and it says anybody with the address can access it
🤔
And you updated the Top.gg setting with the full URL and made sure you got the correct password?
From the docs:
On the edit page you can see another input for Authorization. Here you can provide a shared secret that you can check for on the server side.
To verify requests are coming from us, look for the value in the Authorization header and make sure it is the same as the value you provided in the form.
Ah… I got no idea then :/ hopefully someone else may have some ideas
no worries, thanks for your ideas 😄
Hosted at DO?
yea
iirc make sure the firewall in your dashboard isn’t active too
Or at least allows a connection to your specified port
As well as the local server firewall
It seems to be open, I can make the request from inside and outside my own network
i can let anyone else try too
Providers nowadays tend to put a firewall infront of cloud/virtual servers customers can customize in a dashboard
Hmm
Really stupid one, if you recently updated dns it may not have propagated yet when Top.gg tries (only if you don’t use IP)
Did you try to use the save button BEFORE hitting the test button?
ive tried with both the IP and my subdomain
or maybe you've done https://<ip> instead of http://<ip>
I had to use the save button each time before hitting test
The topgg website is just… yeah a mess
Yeah a ssl error could also prevent a connection if there’s no valid certificate
looks fine for me
but see its the same exact request
Took ages for discord to handle that file lol
Yeah
doesnt matter if its the correct auth or anything, it would still pop up in the console
seems my SSL cert should be fine i think
Still give http without ssl a try
Hit the save button before test
Keep that in mind
Possibly even refresh the tab between saves (to be on the really safe side)
ill have to modify my server 1 sec
hello

At least that narrows down the problem xD
Self signed cert or open encrypt?
was letsencrypt
so maybe topgg doesnt like my cert?
Probably
Make sure to always use the full signed cert
There are usually 2 types of certs
Or full chain
Idk anymore how it’s called exactly
currently am using privkey.pem and cert.pem
should i use fullchain.pem instead of cert.pem?
Yes!
Always
Always attach the full chain certificate file to your apps and services
ahhhhhhh that was it
thanks a ton!
first time doing any letsencrypt stuff so thats super useful to know
Not doing so can lead to ssl errors like:
unable to get local issuer certificate
unable to verify the first certificate
On the client trying to open a connection and doing a handshake with your endpoint
I’m not sure if that fixes your issue with topgg tho but a lot potential issues with other services
I can guarantee you that
Well it may tries a non-secure connection if the secure connection fails
But good if it works now
Going to sleep now, have a good one
you too!
@wheat mesa that's actually really impressive for a first rust project
smh you should see my first rust project
you tried rust? 
php 
Thanks! Loving rust’s pattern matching, I think it’s made a really robust option for developing things like this
mind if i refactor 
Go right ahead
I’m always happy to get feedback on things I could be doing differently
I should probably put a WTFPL on it 
WTFPL based license
fax
shouldn't this work in theory? ```js
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "img.jpg")
const embed = new Discord.MessageEmbed()
embed.setColor("RANDOM")
embed.setImage(attachment)
interaction.reply({embeds: [embed]})```
For some reason its not properly setting the image
Hell yeah
I did see attach files, but im not sure where the function is in the docs
I did a bit more research and came up with this but it doesn't work either, apparently attachment.url is undefined ```js
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "img.jpg")
const embed = new Discord.MessageEmbed()
embed.setTitle("title here!")
embed.setColor("RANDOM");
embed.setImage(attachment.url);
interaction.reply({embeds: [embed]})```
https://github.com/discordjs/discord.js/blob/stable/src/structures/MessageAttachment.js#L89 looking at the source, you don't pass anything in for the 3rd parameter, which means url will be undefined.
It doesn't really make sense for an attachment to have a url before it's uploaded to discord anyways
(unless it's on a third party cdn of some sort)
speedyos update: im adding actual debug tools such as asserts everywhere because i cant take the undefined behaviour anymore
its making me go insane
there will be asserts in non-critical areas but to enable asserts in very performance sensitive areas you need to define a flag to include them in the actual code as to not impact performance when you dont need to
soo i trying to create event handler by following youtube tutorial, But i getting error when i trying to run the bot:
F:\discord_bot\Apolo\Handlers\Events.js:10
(await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file) => {
^
TypeError: (intermediate value) is not a function
at module.exports (F:\discord_bot\Apolo\Handlers\Events.js:10:9)
PS F:\discord_bot\Apolo>
F:\discord_bot\Apolo\Handlers\Events.js:10
(await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file) => {
^
TypeError: (intermediate value) is not a function
at module.exports (F:\discord_bot\Apolo\Handlers\Events.js:10:9)
PS F:\discord_bot\Apolo>F:\discord_bot\Apolo\Handlers\Events.js:10
(await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file) => {
^
TypeError: (intermediate value) is not a function
at module.exports (F:\discord_bot\Apolo\Handlers\Events.js:10:9)
PS F:\discord_bot\Apolo>F:\discord_bot\Apolo\Handlers\Events.js:10
(await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file) => {
^
TypeError: (intermediate value) is not a function
at module.exports (F:\discord_bot\Apolo\Handlers\Events.js:10:9)
PS F:\discord_bot\Apolo>
does anyone know why i getting this and how can i fix it
Image
Image
PS: if someone answer, feel free to PING me xD
ps: fixed it
by following youtube tutorial
I heavily recommend against it
like, while it's a nice way of understanding what each thing does, you should NEVER follow it to the line, both because you'll learn absolutely nothing from it and because there's a high probability of you copying outdated code
attachment://img.jpg
someone me
help, I put my server on Topgg, I want that as soon as the person votes bot some sla mentions the person in a channel and says
nice
@user voted for our server and won 20k bananas
How do you do it?
#topgg-api Use webhooks
https://docs.top.gg/resources/webhooks/
is there an api that allows us to configure the command permissions from our bot?
like /config admin-role:@some-role. then i modify the admin commands to require that role
not yet afaik
intellij contextual error detection scares me
Lmao
Finding out you can't use a bot too react to a message with emojis that were just created. Anyone know the timing on that? Maybe an hour?
this shouldn't be an issue unless you're using cache and ur lib requires the emote to be cached
source: I do exactly that for temp emotes (create -> use -> delete)
Hmmmmmm
Then I should look into how I handle emojis then
I use tims light thing, probably should just hardcore cache those lol
is ur bot the one creating the emote?
No.
then simply retrieve it
The user created it 15minutes before inviting the bot.
instead of using cache
Hmmm...
Hmm
So no more of this then?
That's how I've been reacting is just the goofy character stuff
depending on the lib this can lead to a lot of errors
for example, in jda emote refers to custom emotes, while emoji refer to unicode emojis (it'll throw an exception if u mix it)
idk abt tim's djs
react takes either.
but anyway, is emojiId returning null?
No.
is it returning the actual id?
Hello, I would like to know if anyone has any API for when a member votes for my bot, it appears on my server.
what is nn:?
I know the naming might be confusing but emojiTag means it's a custom emoji, otherwise it's unicode.
yes, top.gg's voting webhook
look into #topgg-api
To react with custom discord emojis you have some text (usually it's name) and it's id
You can also do <:nn:ID> and it works
shouldn't u be getting the name too instead of hardcoding it?
It's not needed no.
It also helps when putting into an embed or message as the character limit goes down.
well idk then, but try using the actual name to see if anything changes
also try with : before the name
Trust me it's JUST these emojis the user JUST created. As you said it's most likely not caching.
this shouldn't lead to caching issues since ur not getting the emote, but using it
I thought d.js would've pinged discord but it makes sense for them to check their own cache, but it returns DiscordAPIERROR: Unknown Emoji
Lol
try using the actual name
It's not the actual name please I did that in the past before 
when you lose your keys you always look in the most obvious places
IF EVERY single emoji didn't work then I'd be more willing to retry the native name.
well, not much I can help with then
do note it's a DiscordAPIERROR not a lib error
That was my point
that means discord itself isn't recognizing the emote
d.js only hands off the Id anyway
D.js only cares about the name being more than 1 character long
what if it caches by id so you don't need to supply the name?
It's all parsed in d.js, I've gone through this rodeo with d.js
like, before sending it concats the cached name
But yes it being a API error makes me think it's just needing some time.
That should not occur, it's likely that Discord does not expose newly created custom emojis to be used instantly, it's an error from Discord's side so nothing much you can do other than timing it out, probably for a few seconds
discord needs some time to find its own emote that's clearly added to the guild?
But this shouldn't be the case, all custom emojis should be available to use no matter how early it was created
I can create a billion slash commands and still have to wait hours but works instantly for a single guild
😏
I use instant custom emotes, they do not have a cooldown before being usable
Right
if it didn't allow then my NQN module wouldn't work too
I'm starting to think this is caused by Discord.js-light rather than the Discord API, I have never encountered this issue with the actual Discord.js
But I'm unsure how it would cause that to occur in any way
hmmmm
please at least try with the name + id combo
That'd require me to add saving the role name to my db anyway to change all that functionality for a single server
Hmm
hardcode the name
like, for testing's sake
or tell the user to create an emote with a predictable name
Try creating a custom emoji using the bot and use the said custom emoji right after it's created, see if the same issue occurs
Test bot was able to use newly created emoji but it's ion the server when created.
I guess I'll kick and readd.
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "img.jpg")
const embed = new Discord.MessageEmbed()
embed.setTitle("title here!")
embed.setColor("RANDOM");
embed.setImage(`attachment://img.jpg`);
interaction.reply({embeds: [embed]})
``` kinda like this? (sorry for late reply)
you need to add the image as a file
.reply({ files: [attachment], embeds: [embed] })
Ive tried that, for some reason it just doesn't work
hm weird
it worked today, but it sent the image then the embed
I want the image in the embed
that's why u use attachment://name.ext
setImage is correct, and so is tim
let me check if this works
embed.setColor("RANDOM");
embed.setImage(`attachment://img.jpg`);
interaction.reply({files: [attachment], embeds: [embed]})
this works
thank you! it took me awhile to figure out
u don't need ` in setImage if it's a static string btw
idk if js has additional processing if u define a string with ` instead of "
that would be interesting to figure out though
like, using ` tells the runtime that there might be value injections in that string, so it needs to check each character for a match
we need someone who knows the depths of js to answer that
I doubt it doesn’t get optimized anyways, probably doesn’t matter
it especially doesn't matter when using discord.js 😂
what value injections?
that's not possible
This ${variable}
I wont call it concatenation
Interpolation
that
var a = null
var x = a || true
X would come out as true correct?
yes
null, undefined, false, and 0 come out as “falsy” values in js
const template = require("../../templates/request")(amount, null, interaction.user.id, null)
Code with input
module.exports = function (amount, uuid, discordid, robloxid) {
var obj = { amount: amount || 0, uuid: uuid || require("crypto").randomUUID(), discordid: discordid || null, robloxid: robloxid || null }
return obj
}```
code that makes it
Hi
aka ex for uuid it's null so it would create it's own uuid
oh u made it sound like something malicious lmao
don't use var
also u can use ?? instead of || to prevent some niche issues
What's the difference?
?? wont check if the value is false, it'll check if it's null/undefined
Alr good tip, thanks
and put require("crypto") in a global scope so you don't need to require it every single time that code is called
its only in 1 line
/**
*
* @param {number} amount
* @param {string} uuid
* @param {string} discordid
* @param {string} robloxid
* @returns object
*/
module.exports = function (amount, uuid, discordid, robloxid) {
const obj = { amount: amount ?? 0, uuid: uuid ?? require("crypto").randomUUID(), discordid: discordid ?? null, robloxid: robloxid ?? null }
return obj
}```
the whole script
thing is, you're importing crypto every single time then discarding it
ye
fixed that, thanks
Can you explain that a bit more?
discordid: discordid ?? null is like if (discordid == null) return null
it's redundant
Won't be something I'd remember for now but yeah ty
isnt that called a ternary operator
I have trust issues 💀
that's a null-coalescing operator
it's equivalent to var != null ? var : other
(include undefined there)
whats the difference between that and a ternary? ternaries seems extremely useful but i havent actually found a way to apply them anywhere
it's shorter
like, in places where you'll be doing a lot of if-null-then checks you can shorten the verbosity by using null-coalescing
ohh so generally used for cleaner code
in other langs it's the elvis operator, idk why js uses double interrogation
It's literally 2 characters why are we going into this so much 😄
would that prove useful at all here?
well, null is falsey, so u can just do !sentMessage
brain moment however i can also replace the catch with || null
null-coalescing is more used in value assignments than checks
i can imagine. i still havent personally found much that i can apply these things specifically but ill def test it out
like
const a;
if (b != null) {
a = b;
} else {
a = "A";
}
becomes
const a = b != null ? b : "A";
becomes
const a = b ? b : "A";
becomes
const a = b ?? "A";
that could 100% be useful just for general code shortening
ye
the only issue is if a can be a falsey value
ye
b ??= "A" 
the what fuck?
i hate my os so much
one shit goes wrong everything goes wrong
and you have to unwind everything that goes wrong to find the root cause
problem is it aint too easy without a proper gui debugger and segmentation faults
and the best part: who you gonna blame?
IBM
there's always someone before you in the queue eh?
maybe
computers and cpus are a mess
they're just old poor designs on top of old poor designs on top of old poor designs
but you do get backwards compatibility (kind of) so good?
theres certain parts which make use of 1 byte numbers. some 2 byte numbers, some 4 and some 8
just what was available at the time
العرب الي هني ترا قناة قيات صارت هذي تفلو عليهم
actually im gonna start implementing algorithms i make in javascript first then port them to my os
because its easier to write a safe concept with a high level language first
anyone know what is causing this?
code is
but the error is not comming from my code
tryed a bunch of difrent things but nothing is working
just get nondescript errors
this is the original error i was getting
and this is the code befor i started messing with it
What is that join; for
idk
Have you defined it before trying to do join.subscribe()?
its just there and i have used that codt to stream an audio file over a vc and it works
yeah join is defined at the top of the file
block not file
What is it defined as?
Just saying doing join; does literally nothing
removed it and it didnt chance the error so i guess it doesnt
i havent really messed with vc stuff since d.js broke everything in v13
found a really good example for previous conversation in here
access(file, constants.R_OK | constants.W_OK, (err) => {
console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`);
});
so idk whats happening
why isnt join a function
its just playing the audio thats the issue
just goes
tryed googling the error but there is no one with the same issue
huh?
Wass he’s in hank.js lol
yeah
yeah its like 4 commands
i am retiring as a bot developer
would you mind sending the block surrounding line 172
i know
It's not necessarily "his" error, it's being thrown inside of djs voice
oh yea that is a good point
But it's most likely being caused by something he's doing
are these things defined:
joinVoiceChannel
Player
yup
i used the exact code block with some minor difrences to play an mp3
works fine so idk
you have these things?
opus is required
Can you go to line 8 of @discordjs/voice/dist/index.js
i was gonna ask that 
I'd look at the github but it's in typescript so it's compiled into js at that point
i dont have djs voice installed atm
idk only one if i remember cuz only one would install
the audeo codecs i mean
think i got ffmpeg
cuz opus is broken and wont install on my server
npm i sodium
npm i tweetnacl
npm i libsodium-wrappers
npm i @discord.js/opus
npm i opusscript```
if you dont have those
first 3 look like linux packages
D:
what
you don't need all of those
i believe opus is required
probably not but its good to have them if you need them
you're not supposed to install all of those
that is line 8
just one from each category
ok nvm it's optimized minified js lmao
that is a very long line 8
indeed
are there like
whats hank.js line 172?
any actual parsers for minified js documents
lots of them
Player.play(micStream);
what is Player defined as
so whatever micStream is, its not a valid stream
const Player = createAudioPlayer()
oki discord voice stuff
its the stream from the servers microphon input
@quartz kindle this is basically what he has atm
using node-microphone package
its just a wrapper for somthing called arcord thats installed on linux
was inspired by someone who made the same thing on d.js v12
and it apparently just worked like this ```js
let micStream = mic.startRecording();
msg.guild.voiceConnection.playStream(micStream);
but that was v12 befor discord desided that making stuff simple was a bad idea
tried testing other node packages since the one im using has literally no documentation other than basic usage
but one hasnt been updated in 7 years and the other fails to install
but they are all just wrappers for the arecord thing
so
djs voice requires the player.play() argument to be an AudioResource instance
which can be created by using https://discord.js.org/#/docs/voice/main/function/createAudioResource
so your code should be something like ```js
const resource = createAudioResource(micStream);
Player.play(resource);
ok so i did that and now its saying
it's just createAudioResource(micStream) from looking at the docs
ok nice
no errors now but just silence
but im guessing that that not to do with the code but the audio input its self
authough the bot doesnt havr the activity ring thing
wait never mind
had this issue before too
but idk what it means
googling doesnt bring up anything usefull
only does it if I run the command twice without rebooting the bot
Late reply but have you fixed the issue?
So, what's wrong ?
interaction.message.edit({
embeds: [ embed ],
components: [ row ]
})
Okay I got it fixed somehow
(interaction.message as Message).edit({
embeds: [ embed ],
components: [ row ]
})
Someone has code for vote logger like i am trying from a while but that doesn't work the url doesn't recive anything on vote
Idk if this was a right Channal to post in
APIMessage not Message i think you should use Message<boolean>
nm, but you should use the exact type
Okay I managed to shut ESlint with that too
Thanks
What is the minimum number of commands a bot should have to be approved on topgg?
There is none
We don’t count amount of commands, we just want there to be at least have a working function
Well, a /ping command wouldn’t be a function
like just having a functionality of recording a vc
But let’s say you had one command /chess that was a full on chess game, then yes
Yeah exactly. So if you had one command /record and that’s it, it would be fine
oki thanks
so far all the code runs and is working as far as i can tell, no errors at all there is just no sound. i guessed that this was probably due to the arecord audio program its self needing configuration since the node packages is just a wrapper for it and whilst i got everything to work on that end (can record a wav file taking the input from a mic jack) there still is no sound
is that PHP ?
I'd rather learn quantum computing than learning that
lmao ive seen that like almost 2 years ago surprised its still getting used
you know its bad when someone thought it was php
im following the documentation on autocomplete and was wondering what this part does, i would guess it sends some content in the channel but nothing happens js const response = await interaction.respond( filtered.map(choice => ({ name: choice, value: choice })), );
you know what the autocomplete prompt is?
ah i had an example bot that used them but i dont have the code anymore
ahh
you first need to have a command parameter set to autocomplete do you have that?
yes
i have everything working but i just dont get what that code block is supposed to do
so whenever a user gets to that parameter in the command it should query your bot for data and the data you send back (the code block) is shown to the user as a list to select from
its used in cases where for example a user has multiple accounts in your bot and you can let the user select one easily
i understand what the autocomplete is for
just making sure
thats what the code block does
it sends a list of things for the user to select from
ohh wait
nvm im dumb
i thought const filtered = choices.filter(choice => choice.startsWith(focusedValue)); did that
thats just a filter, its not sending anything to discord
i realize that now
$nomention
$title[$username's Balance]
$description[
💵 | Dompet
Rp.$getUserVar[rupiah]
💰 | rekening :$getUserVar[bank]]
$footer[$username#$discriminator[$authorID]]
$addTimestamp
$footerIcon[$authorAvatar]
$thumbnail[$userAvatar]
$color[$random[00000;99999]]
i got it two work finaly, it was not using the correct input device and since idk how to change the paramiters through the new input(); thing i just edited the default in the module is self to test and it works now so heck yea
so thx for yours and tims help
what… no no no no no! Don’t edit the lib! There’s a reason it’s like that
funnily enough discord.js is the only lib i've ever needed to edit
either because of a bug that hasnt been patched yet or stupid breaking changes which wouldve otherwise took very long to fix

Bot crashing with this error even though there is still memory left
Sounds to me like you either need more RAM or you have a memory leak
(Gonna go with memory leak on this one)
Does your bot’s memory usage keep growing after starting?
Bringing back the message reaction discourse from yesterday
Apparently you can just give it the ID to the react method and it works fine now
No longer need to prefix with some random name
how much ram do you have?
and how many servers is your bot in
lol well idk how to format the arguments because just inputing them how they are in the cli doesnt work so idk
and there are no docs with indepth explanation so idk
@quartz kindle discord has very sad protection against people connecting to the "qr code login" thing outside of a browser
it checks for common browser headers including the from header to be discord otherwise it will refuse connection with status 403
i mean they tried but
i wouldnt've bothered
interesting
upon connecting you have to sent a custom generated public key where then discord will send you back a test string which is encrypted which you have to decrypt then send back
My suggestion command for my new bot, you run the suggest command, it pulls up a modal, then it sends a message to me, I approve or deny. Then it sends a DM to the user. 🙂
very cool
you can use ejs but dont have to
theres many options
theres many tutorials online how to make a dashboard
Webpage dashboard right
Ew ejs
It's not that complicated, but if it's your first time then it might be a lot to take in.
If you use express it's going to be used to make request to discord and your database so that you can get user data.
const { MessageEmbed, WebhookClient } = require('discord.js');
const webhookClient = new WebhookClient({ url: 'https://discord.com/api/webhooks/MYid/MYtoken' });
const embed = new MessageEmbed()
.setTitle('Some Title')
.setColor('#0099ff');
webhookClient.send({
content: 'Webhook test',
username: 'some-username',
avatarURL: 'https://i.imgur.com/AfFp7pu.png',
embeds: [embed],
});``` Why is this returning 405 error?
nice
thanks
np
is this a good idea?
Is what a good idea
Duality of a man
how do i add a link to a button?
type: 'link'
link: 'https://example.com'
true man
fixes his own problems and doesn't even bother others with how
Well,
- You leaked your API token, make sure to regenerate that
- Are you sure that endpoint returns a JSON?
Oh ye that was the problem it's not a Json
Hey it shows thumbnail should be in format of https but the top.gg sdk docs says it should be like this what to do? Using vote.user.avatar
doesnt vote.user returns an id 
user.avatar is an avatar hash
You can't use it?
Umm...so i have to retrieve avatar from id? But how
const user = client.users.cache.get(vote.user)
console.log(user.displayAvatarURL())
Thanks? And what about username should it be user.memebr.usernsme? And also what if user doesn't have Avatar
Umm and discriminator should be user.disxriminator right?
user.discriminator yea idk if u typoed by mistake or
So can't i use like
user.displayAvatarURL() || someimage link so it will grab tha image link if avatar doesn't exists
Typo lol 😅
if displayAvatarURL() returns undefined/null when user doesn't have an avatar then sure ig
Umm..okay thanks :)
Sry to disturb but dispalyavatar throws error. 
.setThumbnail(`${user.displayAvatarURL()} ` )
Hmm using this
Lemme log that
Yeah returns undefined
hmm
Maybe vote.user.id and not vote.user 
no
is it possible to make server vote logs?
Umm..okay
prolly the client is not able to find the user
Why tho 👀
.. mm?
Well i am sending test signals that why?
not cached ig
nah
But it is cache-ing 
nvm
idk then
can u show the whole code how are u trying to get the vote.user
server.post('/dblwebhook', webhook.listener(vote => {
// vote is your vote object
let channelId = client.channels.cache.get(`971718503914680340`)
const user = client.users.cache.get(vote.user)
console.log(user)
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle(':crazy: New Vote On Top.GG :disco:')
.setURL('https://top.gg/bot/960381632471240744/vote')
.setAuthor({ name: 'Role Icon#3800', iconURL: 'https://i.imgur.com/Gm6IiXu.png', url: 'https://youtu.be/dQw4w9WgXcQ' })
.setDescription('Some description here')
.setThumbnail(`${user.displayAvatarURL()} || https://i.imgur.com/Gm6IiXu.png ` )
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
channelId.send({ embeds: [exampleEmbed] });
}))
Ignore nuincence stuff
u sure the user is undefined?
.setThumbnail(`${user.displayAvatarURL()} || https://i.imgur.com/Gm6IiXu.png ` )
i see something wrong in this method

Yeah user returns undefined
What 
Can't you fetch it instead ?
fetch and get are same?
hmm idk then
No ?
Fetch gets directly from discord api
Get gets from cache
const { displayAvatarURL } = await client.fetchUser(user.id)
.catch(console.error);
Console.log(displayAvatarURL)
@near stratus like this?
client.users.fetch ig
const user = await client.users.fetch(vote.user)
What about avatar
same thing
Also change to
server.post('/dblwebhook', webhook.listener( async (vote) => {
Hmm..okay
.setThumbnail(user.displayAvatarURL() || 'https://i.imgur.com/Gm6IiXu.png')
Oki
use avatarURL(), not displayAvatarURL()
displayAvatarURL() returns the default discord avatar if the user doesn't have one
Nice fallback they got
Now that I think
Change it to ```js
.setThumbnail(user.displayAvatarURL())
@lyric mountain don't mean to bother you if you're busy/asleep, but is there a way to improve the performance of printing in java? Trying to print a string (just once) that is uh... VERY big. Takes about 400ms to print it to stdout when using BufferedOutputStream. Any tricks you know of to improve it?
Yeah i want to do that like if user doesn't have avatar return the default discord avatar so what to use display avatar or avatar url
what are you making in Java?
displayAvatarURL
Okay
Someone "challenged" me to make something that prints (with complete accuracy) a * b where a and b are numbers >= 1e5 in length, in under a second
BigInteger makes it really easy to do that however
I got the whole execution time to about 430ms
But the printing is what takes absolutely ages
Reminded me of how I printed information for an entire guild in Rust and my application seemed to have issues responding to the interaction in time because of that
Hey ${user.username} doesn't work.
you forgot the backticks
You need to use ` in order to use string interpolation like that
Yeah backticks are there in cod3
Show your code because I’m doubting that :p
Sry my mistake i bymistake ` replwced by ' lol sry
No problem. Happens to everybody at some point in time
💀
Hey but for some reasons the vote msg is sent twice
Can you send your code? Not sure how to help without that
yes thats why
what a really nice feature to celebrate the weekends
Oh IC thanks
No idea why they would send 2 POST requests, that seems almost intentionally confusing 
Easier to send one POST with a value prop attached or something like that
How to do this maybe for that yesterday thing it's setTimestamp() but what about voted at and can vote again?
You get a timestamp from the POST request on those two things, no?
Those labels are just <t:unix_timestamp_in_seconds:R> or something similar to that format, you can look up all the different formats online by googling “discord Unix timestamp feature”
How do I get that unix code actually it is a website which does vote logger of top.gg for you there it was feature to unable it now idk how i do that in my code
I don’t know if the unix timestamp is sent along with the post request, but in the case it’s not, you can create one with javascript’s date api or a 3rd party library like moment, then add (I assume?) 24 hours on to the timestamp, and that’s when they can vote again
Hmm...looks complicated lemme try 
Not very complex, don’t worry
get the current timestamp using Date.now(), add 43200000 (12h) to it, and put that inside <t:timestamp:R> (divide by 1000 and round it first) or as the footer timestamp
can someone answer me?
the names sure but invites is it possible
you can do the same for voted at, but just use Date.now() and remove :R
Do not use your bot to get invites to servers it’s in. That’s a privacy concern
no sir just wondering
The only exception is if the server owners have specifically given permission, or if the purpose of the bot has something to do with that and it is clearly stated somewhere
i said that im wondering if its possible
How do I use this like bot.monthlyPoints or vote.bot.monthlyPoints?
Thanks but i new used it like it is javascript or moments
monthlyPoints isn't sent with webhooks when voted
So vote.bot.monthlyPoints is obiviously not a choice
You have to fetch it from api
(Date.now() / 1000) + 43200
Hmm...ic
This thing anywhere in code 👀
Understanding EcmaScript 6: The Definitive Guide for JavaScript Developers
http://www.r-5.org/files/books/computers/languages/escss/fp/Nicholas_C_Zakas-Understanding_ECMAScript_6-EN.pdf
The Principles of Object-Orientated JavaScript
http://www.r-5.org/files/books/computers/languages/escss/fp/Nicholas_C_Zakas-The_Principles_of_JavaScript-EN.pdf
JavaScript with Promises
http://www.r-5.org/files/books/computers/languages/escss/fp/Daniel_Parker-JavaScript_with_Promises-EN.pdf
Beginning Functional JavaScript: Functional Programming with JavaScript using EcmaScript 6
http://www.r-5.org/files/books/computers/languages/escss/fp/Anto_Aravinth-Beginning_Functional_JavaScript-EN.pdf
Source: Xig (#development message)
Hmm....
do people actually read those
How to round it off?
Math.floor()
i doubt
43200 shows 11 hrs and not 12 👀 isn't that a problem should i change it?
No sry
My mistake
last book link poofed 😔
I never expected anyone to click on em
well i am gonna read them in my free time
guys I have a lil problem with a bot
nvm got it
whats the problem
"Emoji must be a string or GuildEmoji / ReactionEmoji"
yes, and the code looks like that:
like what 💀
show code
show success and error variables
the emojis are defined in a document
Are you using v13 right?
"error": "❌",
"success": "✅",
.send({ embeds: [embed] })...
still cannot figure out your point..
wth
m.react
i'll try

my bad i am blind
still not fixed
yep
show full code fr
still the same 😄
Hey how do retrive monthly vote for my bot?
then pass that variable in the react method
wut
hm.. I tried that and it didnt worked
as a string?
i'll try again but I know the result..
u prolly did it with message.react
await m.react("✅")
wtf
💀
😭
^^^^
happens sometimes 😄
Hey i am making vote reminder system so i have timeout which dms a voter. But the problem is -
1 st user voted - it records it and starts timeout
2nd user voted - deletes the first users and keeps second users
So by this 1 st user get a late dm at same time as 2nd user what to do?
Fetch the bot (js: https://topgg.js.org/classes/api#getBot)
Use the monthlyPoints field value
Documentation for @top-gg/sdk
Thanks
use redis
also That problem seems to be fixable without redis
show code
Yeah 2 min i am on mobile
k
How can I do filter montlyPoints?
bot.montlyPoints
Like after fetching bot i can do -
let a = bot.monthlyPoints
console.log(a) //this will show the amount of vote
Right?
probably
Bruh

Yeah mb
Documentation for @top-gg/sdk
bruh when did discord add forms for bots?
Bro my token is correct tho shows unauthorised
Around a month ago, they were in the testing phase 2 months ago
oh fair enough
cuz i saw some one made a discord bot exactly the same as mine but it uses thoughs instead of being like mine and just using a prefixed command
bad token
Try regenerating and use new one
Slash command adoption for May still an increase on previous months. I reckon maybe 75% of my users will be using only slash commands before the end of the year.

