#development
1 messages · Page 1988 of 1
So what would be the proper way then, to pass my database instance to the child?
Can I pass them sort of like I do with arguments to modules?
if you want to keep them stateless
just pass events via ipc
master shard event -> ipc -> child -> ipc -> master database call -> ipc -> child -> response via http or -> ipc -> master response via http
thats spicy.
however database connections are usually very easy to create an maintain
Oh so I would basically build an event handler sending the event via ipc to the child
you should easily be able to create a separate db connection on each shard
master shard event -> ipc -> child -> dedicated database call -> response via http or -> ipc -> master response via http
Well the goal was to create the database pool in the master
if you are working with sql pools, then you need a separate pool on each child
you can make the pools smaller to compensate if you want
Oh ok
however it would be more advantageous to just keep a connection always on instead of using a pool to connect/disconnect
To be honest, internal sharding should get you a long way. I would definitely be looking at other options if I was considering process forking.
I feel like that somehow ruins my entire plan then
Im barely missing the basics here but I’ve never done this before it thought about it
what exactly is your goal?
do you have a rough idea of what you want in terms of infrastructure?
could you draw a diagram if need be?
Yeah I have an explicit plan
But I can’t do anything else then trying to explain in words atm
Because you know why
driving?
I’m usually like to discuss the theory about the things when I’m driving
To have time then to do things when I’m at home
Yeah
lel
so as i understand
you kinda want to go the oppositie direction of what people usually do
instead of having multiple processes handling shards and forwarding them to a centralized processor
you want to have a centralized shard handler and forwarding events to multiple event handlers
Basically yes
techincally that is much easier to do than the other way around
If you were building a massive bot, you would likely have a gateway service pumping events into rabbitmq or something.
You could then have zero downtime deployments.
And being trivial I thought I simply create my gateway connection and database connection in the master which creates a child process and I’m just passing my database and client (gateway) vars to the child when creating it
Simply spoken
well you cannot pass the connection handlers
Separate the bot logic from the gateway handling, so you hardly ever have to restart your shards.
like if you create a database connection, for example const connection = await database.connect();, you cannot send the connection variable to a child process
Yeah which was the reason I thought then to emit an event in the child and pass the data to the event listener in the master then
yes you can do that
Yeah the issue is it would be required for the gateway connection, too
Which makes is absurdly complicated
whats so complicated about it?
Well wouldn’t I need to build an event handler in the master which would deal with any discord like event I’m using?
// master
shard = new discordshardsomehow();
shard.on("message", data => {
child.send(data)
});
child.on("message", response => {
discord.post(response)
});
// child
db = new database();
process.on("message", data => {
do something with data;
result = maybe do db.fetch();
process.send(result)
})
in stupidly simplified terms
Ah I see the master does require a shard manager for the gateway connection here even if I just create one child
Ideally children are un-aware of their parent. The parent should only really be spawning the required amount of shards, and doing some process monitoring.
Shard(s) (if you use a mix of process and internal sharding) should have everything they need in their own process.
That’s a different story then as I need to get into sharding then even if it will always just be one shard

UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
is it bcs my bot don't have permissions?
Aye
Nah same error

Dude if you don’t provide any code and errors how should anybody be able to help you?
well the master would use internal sharding
@boreal iron
its something about the DiscordAPI lmao nothing about my code
i mean, this is what i understood you want to acomplish
Yeah which would bring me to the point to get into sharding then
I have all my presence intents enabled
internal sharding is dead easy to do, you literally just set the number or set "auto"
no children are created, its all in the same process
You’re missing the permissions FOR what you’re doing
For example sending a message
Hmm I really begin to think about efficiency here.
I somehow believe now it’s better to throw any connection handler into my mail file then and build up anything else in modules I can basically reload at any time
In theory my idea was great but I see it’s actually more complicated to accomplish it then throwing anything into modules I can reload at any time
Yeah I see
Well then thanks
That saved me a lot of time
Sleep well then, it’s your time 
Any replit developers I need a help
const ban = await message.channel.send({content: `Are you sure you wanna ban \`${user}\`...`, components: [but1, but2]})
const collector = ban.createMessageComponentCollector({
filter: (b) => {
if (message.author === user) {
return client.createError(message, `❌ | You can't ban yourself!`);
};
},
});
collector.on("collect", async (i) => {
await i.deferReply({
ephemeral: false
});
if (i.customId === "confirm") {
await message.guild.members.ban(user);
i.editReply({ embeds: [ new MessageEmbed()
.setColor("#F2C5F9")
.setTimestamp()
.setDescription(`Successfully banned **${target}**`)] })
}
})
did you mean: ${user}
Dang yeh
lol
@austere surge but still error bro
whats wrong
sec
apparently theres supposed to be a ) at the end
Wait lemme check coz i wrote whole code on dc
where is the confirm being sent in the code
Interaction edit reply that's the confirm message ig
Like when a person will use ban cmd bot will send a content with two buttons one is confirm and other is cancel.
The confirm one is working as it bans the user but the I.editReply is not working
Catch ur promises
.catch(err => { handle error })
Nah I'll pass
..
how to add like this image in bot page top.gg any one pls tell
if any video tutorial there pls give
nobody is going to write your code for you 😛
Please write my code for me
:)
I actually have no idea what im doing rn
I know 🙂
Simple HTML
oki but doing first time so any video there not html that image one
<img src="url" alt="image1" />
You can also simply paste your image URL into the description
That should also work
But I recommend using HTML
how can ik when a thread gets archived?
By listening to the thread_update event according to the docs
Emitted whenever a thread is updated - e.g. name change, archive state change, locked state change.
and I can unarchive a thread with bot, right?
how can i change this to an image for css... i check my code in codepen it works.. idk why it doesnt in top.gg custom css
I want to do if a user vote to my bot , adds role on the support server
Really ?
yes'
i use vote tracker tbh... cant hassel using all the apis and stuff... i got some code in my github you can check stuff there
https://github.com/denzven/Denzven-Graphing-Api-Bot/blob/master/commands/vote_msg.py this one.. @wooden tusk
wtf werid link
better
big
nah its a event... its an easier (for me) cuz idk using the api as of yet)
Hmhm
any css help in this pls
https://codepen.io/denzven-ignatius/pen/dyZqZpv the codepen code i was saying
it's a terrible idea to put text inside an image because it breaks seo and accessibility
nvm i fixed it by using a couple of importants
but how do i force dark now....
i used to see an option in bot settings.. but idk it disappeared
I see bad things for your future
is it a bad practice? i worte this css https://cdn.jsdelivr.net/gh/denzven/Denzven-Graphing-Api-Bot@master/topgg_css.css jus rate it please
!important is a very bad practice
i have 13 of them 😶🌫️ any other way to avoid them? because its getting overridden by the default css from top.gg
hmm cool
how can i force dark tho
That is both easy to do and against TOS
as long as the bot has manage invite perms you can do it
oh boi thats terrible thing to do lmao
Why so? They would want to be spoonfed not explained.
Because then people will have an idea of what to do and actually do it
They would do it at their own risk, but oh well.
Stackoverflow really seems a lot of fun watching questions and having no idea how to answer them.
.repeattheselector.repeattheselector.repeattheselector.repeattheselector.repeattheselector.repeattheselector.repeattheselector.repeattheselector {
background: red:
}
actually i think it would be okay if you use important
it's valid if you're overriding default css
Here's a fun fact:
We trust tim so much that if he sends actually bad code we'd copy it without any questions
using important is something you only do as a last resort iirc
^
It can fuck up css hierarchy if I remember correctly from what google said
there ya go
@green pebble so yeah it's fine to use !important ONLY if you're overriding top.gg's css
I remember I used important on almost everything
but that is because I was using bootstrap on my site
kids these days
and bootstrap si really annoying
One of the reasons why I stopped using it
using bootstrap is a bigger crime than using important
I was beginner dont hate me
😔
same
I still am beginner but I learned not to use bootstrap 
i used to put text inside img tags
Now i use my own css
took a long time to realize img tags can't have children
use bulma or chakra ui
infertility hits hard
its always the right choice
chakra < Mantine
^
mantine is better
I use mantine over chakra when I use react
mantime
I mainly use angular these days tho
I like it over react
link i have something to tell you
people care about mantine as much as they care about detritus
which is... not much
people should care about mantine
it beats chakra by a long shot
yes
yes
I bet chakra can't do modals, drawers and manage date times, notifications, etc
yes
if mantine is accessible then i would use it
I think mantine is perfect for a document editor lol
cuz of its rte
rich text editor etc
or for forums
it is
can do modals can do drawers what's your point
it is
modals are cool and so are drawers
that is my point
can do notifications too
who doesn't like sending notifications on their site
do you mean mobile browser notifications or just a text box at the top of your site
I think you can position it in any of the corners I can't remember tho
well yeah chakra has that
…
"JavaScript developers are known for their ability to reinvent the wheel"
- Fireship, 2022
But does chakra allow you to queue notifications?
honestly tho so true
yes
I just steal other people's code
mantine's hooks seem cool tho
why do it myself if someone already does it
ye
https://mantine.dev/ there are buttons that let you trigger notifications lol
mantine does have some cool hooks
This seems very useful to me personally
You could probably make like a document editor website with this
and the notifications system
markdown always better
Oh and you can install a code highlighting component as well
lol
They use it on the mantine site as well
I think I will make a document editor website with mantine
kinda like docs.google.com lol
but with darkmode support
Cool then....
But how can I force dark... I'm trying a lot of different stuff but I'm not getting it to work
Can you even force dark mode on top.gg
If people have it on lightmode wont it just overwrite your pages css anyway
idk
also yo wtf
I don't even submit bots
I noticed my bot has 93 votes suddenly
Türkçe bilen var mı ?
Alright now to stop voting on links bot
:(
@marble juniper Türkçe ?
No
Although there is a translation bot server, why is it not here?
wdym
yea.. i want to do that.. cuz all the css i did jus breaks in lightmode.. and im not getting how to do it...
i added this too but no difference
there was.. as long as i remember.. but it isnt there anymore idk y
visiting my bots page in private tab rly fvks it up..
https://top.gg/bot/851532461061308438 this is the link btw
You can just not force it
Till top.gg fixes the problem you can do one of these:
- Make your page look good on both light and dark mode.
- Make your own color scheme for the entire bot page that overrides whatever theme the user has selected.
oh boy is that css fucked on light mode
i suggest going for the first option
god that is disgusting
it's not too difficult either
It is
yup 🥲
how do i make a color scheme for the entire page that overides eyerthing??
i kinda have that as the last part... for the blue colors
Enable dark mode
Goto your bot page
Open devtools
Copy EVERYTHING from the styles tab
Maybe I'd make a lib that lets you do that easily
i didnt get the last part... thats like a bit a lot of css there
wait i think i know a way
you can override the class chakra-ui-light on the html tag but you can't put javascript on your bot page to remove it 
uh
I've added a new "thing" to my schema, how do I insert it to all the available profiles in the db that doesn't have this "thing"?
I added a new item in my schema (mongoose/mongodb) so I want to insert it to every documents in the profileModel collection if they don't have it already
Refactor moment
Wouldn't it be better if u just set a default value if none found?
oh well I can insertOne if none is found, right?
If an access token expire after 7d, can i still refresh it ? Also, does the refresh token can expire ?
Token for what?
oauth2
Inserting is for a separate document. You probably want a set operation with updateOne
let memberActivities;
onMount(async() => {
let response = await get('http://localhost:9090/admin/dashboard');
memberActivities = response.activities
console.log(memberActivities) // Output: response.activities
});
console.log(memberActivities) // Output: Undefined
var controlActivity = memberActivities.filter(function(spotifyActivity) { // Cannot filter this because memberActivities is undefined
if (spotifyActivity.id === 'spotify:1') {
return true;
}
})
It returns undefined because it runs the code before the value is assigned
The function you pass to onMount will be called some time in the future, so trying to assign it a variable isn't going to do it.
What can I do to make memberActivities wait for a value to be assigned?
use the value inside the callback
and try updating whatever you're trying to do from within there.
don't know what framework you're using that handles it
i use svelte
do you have to always fetch the data AFTER it has been mounted?
can you not assign it a value during compile time
Yoo
hi
Question are if statements with multiple checks like if 1+1=2 && 2+2=4:
Ran left through right?
Or does it check both at same time in python
left through right
it would only ever run the second one if the first one returned true
with || it would only run the second one if the first one returned false
Conditionals are parsed and executed from left to right, although math expressions have their own set of rules for hierarchy
Ahhh that solved my biggest issue thanks for that @earnest phoenix
Love you for that no homo
I had doge but sold it long time ago
Like 2 weeks
It was fallin
Thanks voltrex
So if 1+1=0 it wouldn’t have even tried to check the second if condition?
yep
Perfect got it
if (smth) doThis();
can be written as
smth && doThis();
That's the behavior of the AND operator (&&), if you for example use the OR operator (||), the behavior will change, it will check for the second conditional if the first one fails
i already explained that five messages ago but ok
Yeah i figured that but i was like what if it randomly check the 2nd condition in the if statement before the first one like random pick from 2 condition n then it ran the other one
lmao why
Idk thought it might just be a thing lul
Well thanks guys I’ll apply that to my code n fix it later on
bye
Bye
alla hafiz
Thats sounds like a muslim thing idk what it means…
The compiler can misinterpret an expression and confuse their hierarchy if the expressions are colliding with each other, for example some compilers can interpret 1 > 0 && 6 < 7 || true as 1 > 0 && (6 < 7 || true) while it should be (1 > 0 && 6 < 7) || true
I assume that's what you're worried about
Are the || supposed to be a or statement or just shows whats its supposed to return lol?
That's an OR statement yes, those can collide with each other, hence can be misinterpreted, so that's probably what you're worried about, although most compilers interpret these correctly, so you don't have to worry about it much
Ahhh i see interesting
But lowkey confused why would you check the value n then just return it as true lol whats even the point of the checks
Yeah but that's just an example, nothing about the values, just the operator behaviors
I see gotcha
Will requiring something constantly affect performance?
if(cmd.info.privated.dev && !require('../config.json').DEVS.includes(message.author.id)) return
no. require is cache'd. if you require 'config' from one file, its cached for every future file (within that process) that requires the same file.
^ if you wanted to not cache it and do a fresh require each time
Okay.
If however, you are referencing the object obtained from your require, ie config, multiple times within a single file, you should (imo) do one single require for that file at the top of your program/file, and then reference that variable throughout your program, instead of having to write require('config') everywhere
Yes I know.
I have this at the top:
const configInfo = require('../config.json');
I just had a curious question about the require(); function.
no worries 🙂
another note on require:
if you have a module that exports an instance of an object, the first time you require that module, the object is created. all other times you require that module, it uses the same instance.
What a performance saver. XD
ie, that always has the same instance of DataStore
when i require the module
when a user upvotes your bot, you would need to have a server online listening and waiting for a webhook event to be sent to it from top.gg (send upon vote). your web server would then have to notify your desired discord server etc
dont think you can? not 100% tho
You can’t
A v6 idea
By default use link buttons for jump to the giveaway in win messages. someone said that, sad
lol, lets see what the oldest version i have is... 😂
if you look at top.gg's docs I'm pretty sure they have a comprehensive tutorial on how to set up listeners for voting
Official Top.gg Node SDK. Latest version: 3.1.3, last published: 3 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 7 other projects in the npm registry using @top-gg/sdk.
There is an example
Cache user in guild and add role ?
Cache user in guild and add role ?
you're not gonna learn anything if someone else does the work for you :p
we can give you tips and stuff, but nobody is going to give you a full functioning program
^
dang that code is so bad 😂
If you want to start learining how to use Discord.js, you can start with reading the guide, documentation, or a tutorial off YouTube.
imo, learning to write a bot is a great way to learn about programming, and how difficult it actually is 😂
I wouldn't say writing a bot is necessarily really difficult, but if it's one of your first projects, it's quite a task
you'll learn a lot from doing it
I had been writing code for a solid 6/7 years before I started on bots, and I still to this day stumble into things im like 'wth?!'
the discord api is vast
The most WTH thing ever is discord.js v13 message intent changes.
it's difficult to know everything
Can't wait for v14!...
I'm curious how much v14 will actually change
Too much things to update
They also deprecated 'message' and changed it to 'messageCreate'.
Again, unneeded.
lol
depends on your definition of unneded
thats not the worst of changes tho. fairly easy to change a string for your event name
Yes, either change the file name if you have an event handler or change one line of code.
Wait, I have a meme on that.
waiting...
And it will be Embed
djs devs complaining like it's the end of the world when one function gets renamed
It is!!1!!!1
RichEmbed: MessageEmbed,
MessageEmbed: Embed
plus, the message to messageCreate change was due to the fact that the event in the actual api is named messageCreate
const embed = new Embed()
I still prefer message.
I see the future and did client.embed = new Discord.MessageEmbed so everytime i need embed i just type
let embed = client.embed
And if they change ill just update client.embed
wtf 
oh no
They forced me to this lol
no, you did :)
Maybe
Or just pass MessageEmbed in your command handler so you can change it.
For example
const commandHandlerStuff = {
message: message,
client: client,
args: args,
Embed: MessageEmbed
}
cmd.run(commandHandlerStuff)```
this is the price you pay for a library part of an ecosystem that's unapologetically modern
that looks even worse
just have a common utils class that you use for these things
hello.js
exports.run({ Embed, message }) => {
const embed = new Embed()
.setTitle('Hello, World!')
message.reply({
embeds: [embed]
})
}```
what the fuck
also why bother exporting client if you can just do message.client
^
I never knew that was a thing...
WAIT
i agree
available on pretty much any discord.js class/structure
if you have an object from discord, 99 times out of 100 it has client attached to it somehow
yea, getting client from junk is real easy
Shesssss
why is this.client=client needed?
Do you guys just allow copilot to do 90% of the work for you? 🤷♂️
I don't like using copilot
~ never tried copilot
Very intrusive with its autocomplete
Intrusive got that right.
Why not
Intrusive as in it pulls up autocomplete in the worst moments/when I don't want it
Plus I use sublime text so no copilot
Copilot is the best AI code completion tool i've used though
VSC
VSC is superior change my mind.
sublime text clean 
for a few reasons that i can see.
~ your passing the client object to super, the parent class likely already holds reference to it.
~ when a message or slash command interaction is created, you can get the client object from that, so there is no need to store it in the command at all really
sublime bad
vsc good
Already i just need client when i running
repl
sublime isn't as cluttered as vsc imo
I still prever vsc because that's what I'm used to though
I want to eventually move to neovim
It also learns from past code you've written.
//Block NSFW Commands
if(cmd.info.nsfw && !message.channel.nsfw) return message.reply(`❌ **This command is NSFW only!** ❌`)
Going to change that to an embed though.
yeah but I'd rather abstract that away
since there's probably a lot of duplication
random question for yall: how many lines of code is your 'ping' command? 🙂
Disincluding white space?
I don't have one
yea sure 🙂
😮 why not?! lol
19
is that just the execution code when it runs?
or the whole file size
If I did have one, it'd probably be 8 lines.
whole file size
Without is 31.
ooh nice, care to share? 🙂
Oh no lol
😭
That is actually cool.
lol thanks ❤️
Mine is just Bot and API Latency.
49 😉
most bot ping's have the little (edited) thing and it annoys the crap outta me lol
add 20 more and than we can 😉
🤨
What're you doing, registering the user in to the pentagon?
It should be sent to a private channel.
@rose warrencan you solve this ?
message.channel.send{(content: console.error)}
don't ping a community manager for a coding issue
smh
hmm

this error seems to say that your client id for the spotify plugin isnt defined properly
How tf does it go backwards to?

lmao
you mean my ping command? how does it remember previous data?
Never heard of time traveling?
No, like, the graph is going backwards at times
oooohhh, the 'line_tension' is above 1.0, which gives little spikey boi's that look dope 😄
Same can be done . setDescription(${console.error})
Like these moments
What is line tension?
Swap your brackets and ()
the smoothness of lines from point a -> b

by using a value over 1.0, it goes 'wonky' and wraps around itself and such. leading to this effect
Shouldn't u decrease it then?
Lmao
also, makes my ping command unlike anyone elses 
for the other graphs i use nice straight lines, as that data is more valuable and needs to be more precise (imo)
love me a nice graph 😂
You obviously like graphs
yes.
+1 for using docker
How this guy playing with his bot
that is a great question.
I know how to get that to show on the bot's about me section. is there some place i can somehow attach that bot to my own about me?
discord rpc?
do you mean something like my activity
yea, that is via rpc?
yes
set? There isn't a already created value to set
let common = profileData.ownedCards.common || "No cards found";
^
TypeError: Cannot read properties of undefined (reading 'common')
at Object.run (/workspace/commands/user/cards.js:12:37)
at run (/workspace/events/message.js:79:22)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
``` breh
it worked like 5 mins ago
it's like this in the db
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
@earnest phoenix
change the last line to export default Document
this happens
reload page
yeah you need to extend Document
do you have some more APIs or do you have just these?
idk of any more
What kind of APIs are you looking for
low effort easy to use ones i guess 
I hope they're not just looking to throw in whatever to add more features
I like the idea of that api (https://some-random-api.ml/) but the fact its main page has missing images does not inspire confidence.
i do no such thing lol
but yea i get an error from that link there
wth? why are they blocked?
They're not loading for me either.
sus
they are for me
Yeah for me, too
they arent displayed for me in firefox, chrome, edge, or opera 😄
Probably issues with the cdn or your IP or country might have been blocked temporarily by flaticon
might be blocked in your country or something?
why do you have opera
because i use it for my test discord account 🙂
and to test website etc
(sql) anyone know how to create a column field in a table with a default value
There’s no excuse for having Opera installed - never!
I feel violated
I think DEFAULT?
Also how can you declare if a field can be null or not
how do I use it
NOT NULL
mongodb > sql
Just DEFAULT ? where ? is your value.
mongodb > postgres > sql
INSERT INTO x VALUES ("string", 10, default, null)
Can be computed, such as a UUID generator
If I don't declare that it means it can be null right
Ok you officially suck Sir
still sucks <3
postgres is amazing
what superior option do you use?
wtf stealing from me now
right now datascript
@atomic kindle loves your opinion
a twitter user when they see something that offends them

sus
but if I can't use that postgres
imagine ur irl name was tat
I don't like it but there's not much else
tat rn
coding is for nimrods
postgres is amazing doe
it is
it's still sql so it's going to suck regardless
database
im not familiar with that, but the examples on their github remind me of jsfuck 😂
not the best but yes it is top tier
and if you disagree u disagree
Yeah it's not popular
Only used in a niche community
But it's very nice
and much more flexible than sql
that looks absolutely horrible lol
If you want to do more research just search for Datalog
sql is way easier to understand than this
that's because you aren't used to it :)
you could say that for any programming language
once you learn it you don't want to go back
Klay hating sql, Klay being a big troll
I'm big troll
You big troll
but really I don't like sql but still use it
REST APIs
Yes but what kind of REST API
I don’t like lots of things in real life and I’m still used to them 
just join the metaverse
node.js REST API's
still not specific

omg im dying
Took your words seriously when hating about Opera, but this is a big no no
An anime API, for example, is more specific.
Oh
Does anyone here actually like mongodb
surely
and would they use it in prod
i use it everywhere i can
Meme apis pls
lol
look if rapidapi has anything in stock
idk if I would use it
Personally I don't like that MongoDB has no relationships
the data is not structured
i am using mongodb so
you can use mongoose to force a structure/schema
but then what's the benefit of mongo
But thats just a lib
Sure?
And also
for me the benefit is having my entire source written in js
I have found mongoose to be a hell to work with
Wut? Transforming it into a relational database? 
I like schemaless databases (so parts of MongoDB) since it's much more tolerant with the data you put in it, but still want a schema for certain behavior, like maintaining relationships between keys.
I'm using localhost mongodb on my server and actually i didn't encounter any problems but yea mongodb is slow
with sql you at least know what data can be in each row
since mongodb is unstructured you have 0 idea
unless u know ur code
That's kind of the point
There's an implicit schema in mongo
You still know the keys there because you're asking for them
Meme REST API's
or reddit
that's what i do
i could spoonfeed my entire code and the user won't be able to use it because it's detritus
That way u always have up to date memes
sadly most of them are making fun of a war
cough 🇺🇦
Watch them make memes about ww3 when it actually starts to break out
I mean, meme subreddits are predominantly composed of 14-year-olds
So it shouldn't be a surprise r/memes or whatever is a circlejerk arena
r/dankmemes more like r/dankporn
sus
Now what
bruh wtf did u just find
wtf wtf wtf wtf wtf wtf wtf wtf
wtf wtf wtf wtf wtf wtf wtf wtf
wtf wtf wtf wtf wtf wtf wtf wtf
wtf wtf wtf wtf wtf wtf wtf wtf
Im trying
he said that when someone removed his belt during an esports tournament match if you don't know lol
kinda sus ngl
I only used rapidapi once (though not for API work), but there should be instructions for how to use that API.
when the api has no docs
It should be illegal for an api to have no docs
No documentation is the best documentation
change my mind
like who tf is gonna want to fuck around with ur api to know what it does
At least list the endpoints if ur not gonna make docs
Documentation is intentionally hard to ward off idiots who'd abuse the API
Change my mind
damn so that's why hypixel's api sucks ass
Hypixel stinks
Imagine not having a super long token so nobody can use your api
Nah I mean my api is protected so only I can use the api lol
you use a token for it?
Hi, I tried creating new bot and it won't start with node . or node index.js
I tried in cmd and VScode terminal
It won't work
Plz help
did you use npm init?
hello i want to add distube package to my code and i get this error
npm ERR! node_modules/distube
npm ERR! distube@"^3.2.1" from the root project
is it possible to detect when someone is marked as spam by discord? i'm using discord.js
Pretty sure thats not possible
I mean there is no api endpoint for it
so yeah
Can I get the arena cards from array? it's hard to explain in text
like I have an Object containing all the cards' information and I'd like to get the owned cards' arena from there
like get all the cards from object to inventory and filter them by arena
in arrays
Am I able to embed my website onto my bot’s description?
I need your help guys
Got it, thanks
ok
Remember the rest api "youtube comment"
?
I bugfixed a error when you press space on the message
https://some-random-api.ml/canvas/youtube-comment?username=$username&comment=$replaceText[$message; ;-;-1]&avatar=$userAvatar[$mentioned[1;yes]]]
But is like this
might be one of the public flags. Check the docs to see if there is one
ah
i'll go try check
@spark flint How do I make the message have space without giving an error?
I used a script that replaces the spaces in the message to - . So what character do I use to replace the space for the message to have space in the photo?
replace the - with a space?
although you shouldn't do that since arbitrary text can still include -
If this is for an API, you should URI encode the string and then decode it as you create the image
I used a script that replaces the spaces in the message to - .
Well, why'd you do that?
Is it so it goes through a URL? Does using percent encoding work?
uri encoding should work. Most http server wrappers like express can auto parse uri encoded strings
Just don't encode the entire url. Only encode the arbitrary text
asked and was told its bugged
so


how can I change my bot name?
I change it in discord.com/developers, but the bot name does not change
Give it a few or kick and reinvite
I've kicked it and added it back
it does not get changed though
Did you change it in the bots developer portal
do i need to delete my application and make a new one?
No
Did you change its name in the bot tab of the application
I think you have to change it there as well
discord weird like that
mhm lemme send something
Yea just cause it changed the applications name doesn't mean it changed the bots name
iirc discord requires you to change it in the bots tab as well at least i've had to for the past 3 years
oh
https://scs.twilightgamez.net/OqY6Z.png what is this called so I know what I'm searching for? D.js
invite bot by clicking on its user on the side
I dont think you can do that via discord.js
Welp. It do be like that
If you can it is probably somewhere in the docs but if you can't you can just go to your bots developer portal and add the invite link there iirc
I found it. Ty much 😛
You could possibly try using flex and align-items:center justify-content:center
Idk if it would work tho
Flex?
idk it didnt work
i want it like
next to the text
essentially
i dont have any wrapping/div stuff bc i'm not sure what to use
should i remove this
i tried making it float to the right but it doesnt work like i want it to
it's because when the message had spaces the image doesn't work
so i did this
const Discord = module.require("discord.js");
const memberModel = require('../../database/welcome')
module.exports = {
name: "suggest",
description: "Anything",
run : async (client, message, args) => {
const msg = args.join(" ");
if (!msg) {
return message.channel.send("Add a suggestion please");
}
const data = await memberModel.findOne({
GuildID: message.guild.id,
})
if (!data) return;
const guild = await client.guilds.cache.get(data.GuildID);
const schannel = await guild.channels.cache.get(data.ChannelID)
await message.channel.send(
`${message.author}, Your Suggestion has been submitted!`
);
const embed = new Discord.MessageEmbed()
.setTitle("New Suggestion")
.setDescription(`${msg}`)
.setFooter(`Suggested by ${message.author.tag}`)
.setColor("RANDOM");
console.log(message.channel)
schannel.send({ embeds: [embed] })
.then(function (message, str) {
message.react(":suggestionyes:946209266044370964");
message.react(":suggestionx:946208906521231420");
})
.catch(function () {});
},
};
/*if(client.guilds.cache.get(data.GuildID) && client.guilds.cache.get(data.ChannelID)) {
let data = False
let xx = True
var x = {}
if(!xx && x) {
return console.log(error)
}
}*/```
how do i fix this?
schannel is null/undefined
but we defined it
it is null
how do i fix it?
schannel isn't actually a channel
it’s a multi guild system
thats cool
but we can’t figure that error out
Log what guild is
Pls someone i really need to do this
Ok it’s a multi guild it sends to what ever channel the server owner sets it to
Okay but log what guild is
ITS ANY GUILD
The bot has already been submitted
It literally can't be any guild when you are fetching a specific one based on the data.GuildId
oh
🤦♂️
huge brain
i’m confused af
you do not understand
I assume schannel is a channel in your own discord, that suggestions would be sent too correct?
it’s any channel you set it to
Ah.
Well
Was trying to understand it myself lol
see the approach he was going towards.
I can say that it is either the guild he thinks he is getting doesn't have that channel or the guild he thinks he is getting isn't the one he is getting
For commands like those where a user / admin sets a channel I'll create a database entry saving the ID and channel Name, that way I can compare the channel names are still the same and if not update the name by checking the ID, if they're both incorrect, I remove the entry all together and throw and error.
Simply fetching the channel via it's ID naming it channel or something and doing channel.send(embed)
pfft why save the ID just save the entire channel 😎
I actually don't know if that would work but possibly I don't see why not
Save entire channel, fetch channel and send
Just simpler to just have the id imo
that way you dont have to do any channel lookup
then just fetch it via id
Tho if the channel no longer exists you're fucked
Exactly.
since it will be rather hard to tell until you send a message
or do anything with it
https://scs.twilightgamez.net/NriRr.png an example being my reactrole database table
I probably save too much but I like the entires
Just get the channel and check if it exists first, although they don't seem to be understanding that as a solution
I don't get how they're not understanding it 
I have started making my database tables by hand
Ever since I started using C# that is
Cause they are a js"developer"
I'm rather newer to databases but I do like mariadb atleast thus far since using it.
@hidden gorge here is an example
// Get channel.
const schannel = guild.channels.cache.get(...);
// Check if the channel exists, if not return.
if (schannel === undefined) return;
// If it exists, send a message to it.
await schannel.send(...);

if(!schannel)
smh

It's better to check for the values directly than just blindly using the logical NOT operator (!), since direct comparison is faster and more verbose
Well guess what
I didn't ask
176.198.75.251
Damn he got your ip you're fucked

is it actually quicker tho
I've always just used !thing vs doing thing === undifined || null || 0 ect...
Damn bro, I'll be sure to find you from the SSID slots used in there and also tell your neighbors, say goodbye to your Wi-Fi
If you think about it, you’re technically checking for more than one value by using if(!something) compared to if(something === undefined)
(Also I would definitely believe voltrex on V8 stuff lol)
In our V8 engine, the logical NOT operator (!) checks for multiple values, so it's better to compare them directly rather than letting the compiler guess it
Intersting.
Is it that big of a time difference where it would be worth changing 100's of line of checks in my code 
Probably not tbh
If it’s really performance based in the first place then maybe, but it’s probably an extremely tiny difference
The difference varies in the order of values that are being checked, for example, an empty string is the last value being checked, if you're mostly using it for that, then yeah, but not much in reality
It's only recommended to use the logical NOT operator (!) for boolean values
I primarily use ! when checking for null / undifined values in a database lookup
const thing = SELECT thing FROM table WHERE id = whatever
if(!thing[0]) return
Probably not gonna notice any difference until you’re starting to do lots of iterations
Plus v8 might do some fancy stuff behind the scenes to optimize that check as much as it can
that sucks
Heyo miyu
kuu
You really need to check groovy out, you'd love it
Best of js and java
Recently I was doing some documentation delving, it's impressive what they achieved with it
Groovy as in the moosik boot
Language
got it
It's also noteworthy that you get to use everything java has, even the libs
Since it's 100% vanilla compatible

I could always try to get into the basics of java now that I'm getting more comfortable with JS... But after being with Icarus for so long, java just looks like a pain in the ass for the most part
But give groovy a go when you can, I can say 100% it's satisfying to use it
It feels like js sometimes
I'm just not a fan of the whole
Public void String args shit they do
1
It doesn't have that
I mean, it can if u want, but not necessarily
Also groovy doesn't require typing
Also another thing java does I realised is that you HAVE to specify what kind of variable your creating
String thing = "thing'
or whatever it is
not a huge deal but just little things
In groovy u can do thing = "thing"
Also it has if (!aNullValue)
Nope, but I use it on my cards' effects
ah i c
While I could switch to groovy entirely I kinda like java's strict typing
that's fair.
can't you still explicitly specify types anyways
Ye
But let's say intellij prefers that I use groovy as groovy not as java
Many yellow highlights
i'm sure you can configure it to not do that
it's annoying when IDEs decide "hey you should be less specific about what you want here"
when i was writing in java for my computer science class the IDE kept suggesting I use var instead of the type
i put the type there for a reason, shut up you stupid computer
Hello, anybody has any idea about why my form is not giving any value in a dropdown input, i am using express and ejs
does anyone know anything about interaction file uploads yet
I think they are still working on it
no it's available
assuming you're talking about uploading files in general
don't know about the attachment type they recently added

