#development
1 messages Β· Page 49 of 1
Nothing loging
Says this again
Restarted the project, logging it now, but nothing shows up
It says this when i send test
Ok, read this carefully: accessing that on your browser will ALWAYS error because it's a POST endpoint
That IS expected
Browsers send a GET request, GET is not POST so it errors
What should I do to fix it though in my code?
Never tried this before, mainly i use JS β οΈ
I do this to get the vote info
And this my server
You cannot fix, you'll never be able to access using a browser
Because you shouldn't
Topgg uses post, so it'll work
The test button is broken tho
Then what should I change to get the vote info though? π€
It works now though
Then print vote to see what it returns
app.post('/dbl', webhook.listener(vote => {
console.log(vote)
//...
});```nothing logs
I just noticed, are you even supposed to use it like that?
Isn't topgg sdk standalone?
Yea according to top.gg sdk it says to do like that
Wdym?
Well, then you put the wrong url on the bot page
If it isn't logging then it ain't even entering the scope
Just noticed i enter the wrong url,
I fixed it though, but it still shows the Cannot get / error and nothing logs
That's it, I give up
You really didn't understand that IS A VERY EXPECTED ERROR
You're trying to make a dog meow
I have this as my code for getting vote info now: ```js
const port = 4000;
const express = require('express');
const { Webhook } = require(@top-gg/sdk);
const app = express()
const webhook = new Webhook('myPassword')
app.post('/dbl', webhook.listener(vote => {
console.log(vote)
if (!vote) return false;
if (!vote.user) return false;
console.log(vote)
.catch(e => {
console.log(e)
});
}));
app.listen(port, () => {
console.log(Webhook server online at ${port})
});
But what do i do in it now
Everything seems correct β οΈ
you don't access a post endpoint using a browser, that's what you do
What else should i use then?
Nothing, there's nothing to fix regarding that
You're not supposed to access it with a browser
If you want to test the webhook you can just use the Test webhook button on the webhook page of Top.gg
Finally, volt he's all yours
You aren't supposed to access the endpoint with a browser
Do you mean i shouldn't do app.listen()?
No that's correct, go to the webhook page of your bot on Top.gg, and click on the Test webhook, if your webhook is configured properly it should emit the event you're listening to, so you can get the vote and work with it
Like could it be my webhook problem?
This is I'm making my my server:
const http = require("http");
const { logInfo, logError } = require("../util/commands/log");
const server = http.createServer((req, res) => {
res.setHeader("Content-Type", "application/json");
let body = "";
req.on("data", (data) => {
body += data;
});
req.on("end", () => {
let parsed;
try {
parsed = JSON.parse(body);
} catch (e) {
res.statusCode = 400;
res.end('{"error":"CANNOT_PARSE"}');
}
res.end(
JSON.stringify({
error: false,
username: parsed.username,
})
);
});
});
server.listen(3000, () => {
logInfo("Server", "Connected");
});
```From this, how would i actually get my webhook url?
You aren't even doing what I'm saying, try it and see if you get the desired response
How would i do that though?
I've never used webhook stuff β οΈ
I only use JS
I literally said how you could do that, are you even reading?
I understood till Test webhook
I didn't understand how do i check if my webhook is configured properly
Just log something in your webhook listener, if it logs then it's properly configured, if not then it's not properly configured
For example:
app.post('/dblwebhook', webhook.listener((vote) => {
console.log('It worked!');
}));
I did console.log('running') to check if the event is running but nothing logs,
And on startup it says this error: (image 1),
Also, i enter the url of the webhook as the url in the image 2?
Have you tried logging the data you've received from the server? Try logging the body variable on the end event listener
Hey why is my code stopping from working when i use sleep(5000)?
because js is monothread
Show your code
I think they mean that their program either crashes or halts, which it shouldn't; the code execution should stop for 5 seconds in that case
js doesnt have a sleep function
ok so I have something like this
let dostuff
if (randomcheck) { dostuff = true }
if (!dostuff) return
...
}
continue some other code```
but it doesnt continue to the othercode if the check doesnt pass
that will not work if there are async functions involved
show actual code
the entire code is an async function
also, return is function scoped, not block scoped
{
{
return
}
// this will not run
}
// this will not run
oh
can I somehow do what I want to do then? just wrap the ... code in a if instead of the return?
yeah
ah yes, I forgor js lacks some "why tf doesn't this exist" features
its possible to use labels and break, similar to a batch script
but not really recommended
u can also do ```
if (whatever in this case true) {
if (randomcheck) {
...
}
}
continue some other code
then assume doStuff to always be true (since it had to be to enter that block)
So I'm coding a chrome extension, and I need to call a function when a url changes and matches a specific pattern, and when that tab's url changes again it needs to call a different function how would I accomplish this?
π€ would it be this?
https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-URLTransform
actually, probably the webNavigation events
I dont know either, I've never looked at chrome extensions or how they work.
All I did to find these resources is google "chrome extension events" and it provided everything you'll probably need
https://developer.chrome.com/docs/extensions/reference/events
thank you, i will look at it
if i have an html form:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>```
how would i make it so they can submit it, and when they submit it, compare their value to a github pages secret
i think theres some php involved but i just wanna check if the text put inside a certain field matches a secret
nvm found a way to do it with js
Did it but it not logs,
Could you tell the answer about the question related with the 2nd image first, that could be a reason of the error
show code
Server:```js
const http = require("http");
const { logInfo, logError } = require("../util/commands/log");
const server = http.createServer((req, res) => {
res.setHeader("Content-Type", "application/json");
let body = "";
req.on("data", (data) => {
body += data;
});
req.on("end", () => {
let parsed;
try {
parsed = JSON.parse(body);
} catch (e) {
res.statusCode = 400;
res.end('{"error":"CANNOT_PARSE"}');
console.log(body)
}
res.end(
JSON.stringify({
error: false,
username: parsed.username,
})
);
});
});
server.listen(3000, () => {
logInfo("Server", "Connected");
});
Vote stuff:```js
const port = 4000;
const express = require('express');
const { Webhook } = require(`@top-gg/sdk`);
const app = express()
const webhook = new Webhook('myPasswordHidedThat')
app.post('/dbl', webhook.listener(vote => {
console.log('running')
console.log(vote)
if (!vote) return false;
if (!vote.user) return false;
}));
What's wrong in it? @quartz kindle
whats that server for?
the error you posted previously is caused by your try catch not returning
it still tries to send the parsed json when it errors
its also running res.end() twice
When i logged body outside try and catch, it gave me this when i click test button
Is that what i need?
that looks like a vote object yes
but i still dont understand why you have 2 servers
Because I've not much experience with webhook stuff β οΈ
basically both codes you posted can be used to do the same thing
you dont need both, just chose one
I would prefer the 2nd one as that is of top gg sdk but it doesn't work, am I missing something in the 2nd one?
Also, is this the webhook url that i need to put or something else?
its that plus whatever you put in your post function
in the code above you have .post("/dbl")
so its your replit url plus that
...repl.co/dbl
also, the port has to be taken from env
app.listen(process.env.PORT)
because replit uses dynamic ports
Hmm
@quartz kindle hey i did it and it works
Though if my server address starts with sftp, is there any problem?
Like my main bot address starts with sftp, so i did serverAddress/dblwebhook on the webhook url on top.gg page
When it was on replit it worked but on the main thing i do this it's not working for some reason
It must be some url issue that it's not working
Is serverAddress/dblwebhook correct? My server address starts with sftp though
Sftp is for file transfer
But my server address starts with sftp, what should I do in that case
My server address with replit starts with https and that works now
But for my main project i use another host
@lyric mountain any idea what should I do?
not much I can do with only that info
your server is very likely to not start with sftp, you're just using it to transfer files
servers themselves don't "start" with anything
"SFTP Details"
The host where i host my bot shows this as the server address
it's showing u the address to transfer files into the server
not the public address
Oh
and no, I have no idea what url would be
Ig i need to ask the support where i can find the public address
never saw or heard about that provider
When i was using replit Tim said to add /dblwebhook, when i did the public address and /dblwebhook and it started working
But for my main bot i couldn't find the address
Is there some way to get the server address through server id?
Your server url would be your ip
Or the domain if ur provider gives one
Again, I have no idea what provider that one is, so I can't help but guess
This?
With https would i enter that or the up address only?
Oh
You don't have a domain, so u can't use ssl
So http://ipAddress/dblwebhook ig?
ipAddress:port ig?
Yeah it worked!!
so if my api has the route /broadcasts, which returns all broadcasts. should i have /broadcast/someid for routes which require an id, or should i keep it /broadcasts/someid, or allow any? π
With /someid because it's a domain-specific endpoint
Oh wait, just reread it
oh, /someid will be there regardless. but atm both routes (broadcasts, and broadcast) work
so like, js /broadcast /broadcasts /broadcast/someid /broadcasts/someid are all valid
But yeah, it's better to have channels instead of a global broadcast
i feel like, /broadcasts is better for getting all items, where it's more logical to have without the s for individual id pages/data
but then, its not really sticking to a true rest api then i dont think
U can cut that in half and use the same endpoint but with GET for reading and POST for posting
i mean, im using the same enpoint for all crud operations
~ wip
codes actually messy af, sorry to anyone who looked at it's eyes π
Not the worst I saw around here
ye, its not the worst, but im porting code from my old api, and updating a bunch, so its a huge mess atm
i actually wrote an api interface for contabo api recently, which is pretty nice: https://github.com/Dekita/contabo.js
but thats not really relevant. just gotta proove not all my code sucks π
~ think im just gonna go with the routes with the 's' as its more inline with standard resful naming conventions
nice, my new server can build my bot in 44 secs π
real 0m44.899s
user 15m45.678s
sys 1m1.034s
it does use like 25gb ram to do it that quick though
c++ moment
your bot is using c++?
6 months later: omg omg pls help my crypto module throws an error, something something is not a function!1!11!1
"it worked before, i didnt change anything!!"
Hello, I would need some help.
if (!interaction.channel!.nsfw) return;
When I hover over nsfw it would say
which version of djs?
nvm itsthe same anyways
if (!interaction.channel?.nsfw) return;```
make sure it is really a TextChannel, and then
if (!(interaction.channel! as TextChannel).nsfw) return;
Helloo, thank you it helped me a lot π
np π
How do you disable caching previous pages?
I navigated to the page before after logging out, I don't want that possible
Or smthn similair idk lol
that ain't cache
Whatever it is then π
I imagine you have some kind of token or id saved on the cookies right?
you're thinking it the wrong way tho, you dont need to prevent going back, you just need to check if the cookie exists
if it doesn't exists, redirect the user to the landing/login page
Local code instead of server?
local obviously
Is there an event I can listen to see if the user focused or smthn?
Thanks
Ive got a quick question
can someone link me to a place where to help me open apps with js
server side
wdym "open apps"?
Lets say i open google
I wanna open google, i run my js and it opens google and firefox
Im terrible at explaining
Yeah
what about the "server side" part?
With Node, we can run shell commands and process their I/O using JavaScript, instead of the shell scripting language. This makes the application easier to maintain and develop as we stay in the same environment.
this is what u want to call the executables
but I didn't understand the part where u specify "server side"
server cannot open stuff on client side
yeah thats what j meant by server side lol
Exactly what i was looking for. Thanks lol
it's not impossible, but I doubt it's even legal
Yeah, im not doing anything client side lmao
anything u need to run on the client should be clientside (duh)
i jus wanna make a program which opens rocket league, spotify and bakkesmod (a mod for rocket league) instead of having to open it 3 times lmao which is gonna save me a good 30 seconds every time i wanna play rocket π
oh wel
Ive stopped programmin long time ago it dont bother me much anymore im jus bein lazy a bit
client would be what you see, for example ur executable is entirely clientside
Thanks anyways for pointing me in the right direction tho
Ye after acc thinkin abt it it makes sense
server is what you don't see, like the internals of apis (api pages themselves are clientside) which are neither visible nor accessible without having access to the server itself
btw, you'll probably have an easier time doing that though batch scripts
since they dont need to be built to be executable
If we solve it for you, you don't learn anything.
You have an editorial and hint written, and even instructions.
Best is to try it out yourself, that's how you learn 
Bro 30min left my exam
We definitely won't solve your exams for you
If you can't solve it, rethink about it after the exam and rethink about how you could've learned it better for the next time
yeah we wont solve exams for you
thats the point of exams
to challenge you
also thats your last question
so spend your 30 mins on that
is this a good status page?
scoopy 
yeah
lol
It's just the same status page template as Discord and GitHub's, but it's good
i mean, that status page looks like those normal and often used status page providers
so yes it's fine
yeah i kinda made the systems
i run the fricken twitter account for scoopy lol
Making some HTML pages and I got this nice line of CSS
@media screen and (min-width: 500px) {
.too-small-screen {
display: none
}
}```
I want to know, how do I change a variable in JS if this is active
Just a true and false variable
It's basically just https://www.atlassian.com/software/statuspage
definitely not head of parnerships and globalx hosting mobile app developer lol
ok?
whats a scoopy?
what does this have to do with development or the context of the conversation though
idk
itβs my friend
"it's"
yeah so kind of better to stick to topic 
hes*
'it is'
dot
((inputnum) => {
const input = inputnum.toString();
if (input.length < 2) return 'length error';
const splitter = str => str.split('').reduce((r,i)=> r+= parseInt(i), 0);
const one = splitter(input.substring(0, 2));
const two = splitter(input.substring(input.length-2, input.length));
const pro = one * two;
return {one, two, pro}
})(4563275);
``` js answer to that exam question no one wanted to answer in python ~ cause why not
Can't you just use the query selector and get the value of e.style.display

Or you can probably also use getComputedStyle
e.g?
I mean, it's comparing a boolean to a string, ofc it's "false" for all 3 
Well since you use .too-small-screen probably want to use something else than getting the element by it
And otherwise try it and see
Yeah ID
It can just be
function solve(input) {
input = input.toString();
const firstTwo = input.slice(0, 2);
const lastTwo = input.slice(-2);
const firstSum = parseInt(firstTwo[0]) + parseInt(firstTwo[1]);
const lastSum = parseInt(lastTwo[0]) + parseInt(lastTwo[1]);
console.log(firstSum, lastSum);
const productSum = firstSum * lastSum;
console.log(productSum);
}
setTimeout(() => {
if (document.getElementById("too-small-screen").style.display != "") {
document.getElementsByClassName("too-small-screen-child0").item(0).innerHTML = "Gettin' there"
document.getElementsByClassName("too-small-screen-child1").item(0).innerHTML = 'Fetching moderations... <div class="spinner-border text-secondary" role="status"></div >'
document.getElementsByClassName("too-small-screen").item(0).classList.add("too-small-screen-active")
}
}, 200)```
200ms is now 10ms*
ehhh, does it go the addition automatically?
yea that is a bit neater tbf
What?
but your missing the addition yea
the first two and last two nums need to be added together
It's (first + second) * (last + second last)
Ah yeah the addition
Let me edit it rq
it's a longshot but anybody made a bot for feishu/lark before?
I need someone to manually approve my "1234 just testing account bbbbb" bot just to give myself permission to receive messages on the bot? lmfao
can't even find anything online because everything is in chinese lol
chinese doc is always fun. i remember trying to decypher dragonbones chinese doc for ages before finding some helpful info in english π
the docs are like:
create a bot app
verify the webhook url
write all the code
submit the bot for review
done! now you can message it
but like.. how do you test it 
how to code 101: type.
Edited, it's a bit more trivial but should be faster
lol tbh, i think we can mash our solutions together to create a better one
i always forget about the 'slice' function, so i think incorporating that into my solution would be good, or perhaps incorporating a reduce call into your solution
but that likely wouldnt be quite as performant as grabbing from array index
Yeah
Although it's also possible to get the digits from the specifics indexes instead of number to string and string to number conversion, but it's pretty trivial
Get the always up to date information about how many days have passed since a JavaScript framework has been published
wonderful
((inputnum) => {
const input = inputnum.toString();
if (input.length < 2) return 'length error';
const add = (r,i) => r += parseInt(i);
const map = (str) => str.split('').reduce(add, 0);
const one = map(input.slice(0, 2));
const two = map(input.slice(-2));
const pro = one * two;
return { one, two, pro };
})(4563275);
i quite like that as a solution. loooks neat. and really the performance loss is minor for such a call. i mean, if it was being called thousands of times per second, sure, optimize, but yea...
that site should be minutes/hours instead of days π
document.getElementById("too-small-screen").style.display always returns ""
nah
computedStyle nvm lol
for the sake of all that's carbon-based lifeform, use a function
that is a function though...
"immediately invoked function expression" i beleive is its technical name
easier to copy paste into console for tests π
yea lol, i have no need for the code, it was some guy doinga python test who was asking, i just solved it in js, cause why not π
ofc if i was using it, it'd be an actual function, likely in some class π
at least there's still people that didn't convert fully to functional programming
classes β€οΈ
functionally programming in an object oriented language is just dumb imo
:^)
lol
(The solution functions were called 99,999 times)
i mean, we knew getting from array index would be faster. but imo, for 100k iterations, thats not too bad. i guess it'd really depend on if performance was the main focus
yea thats fair lol
usually I go with even higher values, since JIT kicks in after some time
i mean, its still gonna be about half as quick π
array access is pretty much as fast as possible since it's a O(1) operation
ye for sure
works like a charm (command-specific help command)
Doesn't the result cache if you fun 100k times the same function?
100k is also pretty low 
it only caches if the value follows a pattern
tbf, the exam question didnt mention the function had to run any more times than 1 π
JIT will notice that and replace ur function with a linear scale
so performance obviously wasnt the focus, just getting the correct result was
Yeah, but we're benchmarking for fun
In the end, who the hell cares about performance for that yeah
lol
You would first not go for node
where a bench can be marked, wild voltrex will spawn π
Then we can talk about benchmarking again
And then the Rust users enter the chat
Oh well
Rust users?
gosh i hate when people straight up think about Rust
tells already a lot
I don't see what's wrong with that, Rust is almost as fast as C which is the fastest programming language, while being completely memory safe
Not going in that useless debate again
I'm saying that although I don't even use Rust, I just maintain it's codegen back-end
It's completely pointless and you know it yourself
imagine hating on rust
gosh i hate when people straight up think about Rust sounds a lot like it
My point is, when people think about speed everyone comes with Rust because of that overhype
That everyone blindly follows like a sheep
I mean there are benchmarks out there which show that rust is almost as fast as C
there's no "overhype" on that end
it's fast and it's proven
Yeah there is no overhype, it's just the truth
And guaranteed memory safety is what sells it mainly
yeah it's not only the speed
Rust programs vs C gcc programs (performance on 64-bit Ubuntu quad core).

Your 100k functions called that are exactly the same is not called benchmarking
It's called playing around
Most of the people don't even know how to benchmark correctly, myself included

Yet they come with their own meaningless "benchmarks"
When you call the same function with the same parameters all the time in two different languages there is a difference playing
Those benchmarks are looking pretty good for Rust anyways lol
And yet it uses less memory and CPU load
on most of these tests
yikes the go benchmarks tho
Hey Dev's
I have an err. While checking that client is in voice channel or not
The code
message.guild.me.voice.channel.id === message.member.voice.channel.id
I know that this is v12 code but i can't get how to to with v14
Thanks in advance
That's the exact same on v14
But be sure to check if the channel property is null or not
Thanks you
it's actually undeniable that C/C++ is (a bit) faster and smaller compared to Rust; the things i love about Rust is that it fixes literally pretty much all of my complaints on C/C++ and it even has several other good features that i haven't found in any other language
Yes we were just trying to say that
a wrapper will always be slower compared to its predecessor




how can i get message content in discord.js v14
its not working
Youβre gonna need to be more specific than βitβs not workingβ
enable message permissions on the dev portal
but your already getting the content of 'd', so that suggests you already have the intent enabled
yep but im goona reply with the message.content
like this message.reply(meesage.content)
as long as you are watching for the messageCreate event, and handling things within that, it should work fine.
no error
then it does not reach that line in your code, debug your code
message content is a string, why are you performing math operations on it?
and your trying to reply with the message itself
not the content
for exaple if the member type 200 the bot will be be accepte the number and multiply it
@neat ingot
no, i get what your trying to do, but your not converting the message.content, which is a string, into a number before performing math on it
which will likely lead to strange results
I believe js allows that, still a terrible thing to do without any check
plus that var over there
yea, it still 'works', but its pretty bad to get into the habbit of doing it
for sure
and if its not an exact number, NaN occurs
fair chance 'db.get' either needs a callback or to be awaited too
yea thats fair
and then, a channel will never be equal to a server
unless somehow the db.get calls when passed different ids, for channel and server, somehow return the same data
I miiiight believe that's some kind of "trading channel" or stuff, so db.get(server) would return the configured allowed channel
and then ~ you should never trust user input for such things. there are actual libraries out there to use for performing math with user input
i mean, tbf if your only doing the one operation on the given number, thats fine, but if you need to actually perform user input math
how do I get the total bot user count? aka the usercount of every server the bot is in combined? discord.js v14
iterate over each server, getting memberCount property
how do I go through every server though?
client.guilds
iterate over it
the data doesnt seem to have a user count anywhere though
the data doesnt even list all servers for some reason
well it'll show all guilds for that shard
not that you're even supposed to count all members
imo it's just additional processing to show a big number that nobody cares or would bother to check if u didn't simply put a random value
I only have one shard atleast I have that auto sharding option on because I got enough ram
ram doesn't matter much, it's more about processing power
yes more servers = more ram, but it's not the major bottleneck usually
simply put a random value
lol
well its true though
a fun fact, is that many shopping sites do that to bias the consumer
yk, those with "XX looking at this product" or smth
how can I combine all money from a list like this: (https://paste.rjansen.de/WLyrac3vq0) in js?
.reduce()
pretty vague, not too much but I dont know what params I need for it to work
it's indended to be vague so you search in google
gave u the name, throw it on the docs and see how it works
I couldnt find anything, I just did this in the end
inline try-catch π©
also u should start using for more than while for iterators, it was made for that
cant you just loop through the json instead of whatever that mess is ?
define a total variable
for loop through json array
get json object at index nth, get value from money key
add to total
dunno what conrun would do
continue run
sawconrun = true
Uncatched promise spam π
async function deleteModeration(uuid) {
return new Promise((resolve) => {
let request = new XMLHttpRequest()
request.open("DELETE", "/api/moderations/" + uuid + "/delete")
request.send()
request.onload = (target) => {
resolve()
}
})
}```
waitin' for sharex
well yeah, it's indeed uncatched
async function deleteModeration(uuid, element) {
deleteModeration(uuid).then(() => {
element.parentElement.remove()
}).catch(err => {
console.error(err)
})
}```
doesn't work like that

what errored is inside the promise
try {}?
no

.catch
And where should I place that?
Yes.
why are you calling the same function inside of the function
yes?
max call stack size reached would be the error
hello
hellno
letβs go I have made it to the interviewing process for a summer internship with State Farm
pog
display: flex new line?
2 flex divs under each other (well beside each other)
I want to make them below each other
nevermindo
flex-wrap: nowrap;
flex-direction: column;
Nice man
hellyes
you know I just want to point out that this was my first message here
I've come a long way since then π₯²
sure
How can I get development role?
When your bot is accepted, you'll get the role automatically
I don't see why not
okay , thanks
how can I check if a user sent a message in the last 5min in a specific channel? discord.js v14
fetch the channel messages and filter the timestamp to be message.timestamp >= Date.now() - 300000 and try to find a message by that user
I had prepared my ticket system private for it in transcript i want to save transcript and i am succesfull in creating html file for transcript but cant understand how to do it for a link like provided in tickettool
the way tickettool does it is by having a tickettool-based transscript and just providing the html file to its website
that then parses it to what it supposed to look like
you can also just echo back the whole html file theoretically
is it possible, when a state is true he uses Grow component else use Fade?
Hi I've been coding the quickSort algorithm using Hoare's partition scheme but I've ran into a problem with my version. Whenever the array has 2 equal values the partition scheme gets stuck in an infinite loop when moving the pivot points
alright so i got sent a nextjs project and there is a weird section on the static pages
it's static/chunks
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
the source code in these folders looks kinda obfuscated
you can wrap
it's weird that they didn't provide an intermediate component for this
you can try framer-motion
it provides 'variants' which also includes this if you define correctly
will definitely look at that ty
is there any way to make all websites load a "basic html" version? or does it have to be built into the website to be an option to beginwith?
built-in
you will have to implement them yourself
Does your bot have access to said emoji
bruh
just wanted to know if there was a way to make shit load faster
So your bot shares a server where that emote exists?
dont see why websites should use so many resorces for no reason
what are you asking fire?
im use an other emoji from other server
is your bot in that server with the emote?
emote ??
yes, the thing you are trying to use
To use the emote everywhere outside of that server, you must have the bot be in the server where the emote is
ahhhh ok im trying to do this
wait
its worked ty bro
As long as matches returns a bool value that should work
isn't there a startsWith method in java?
Some good sorters over here
https://discord.com/api/sticker-packs
Considering this link i wanna make a object like :
emoji : [
description : Id
description : Id
]
Or sort do thing so that i can get description and I'd... Like from a http request something (ig this is not possible)
I can't find a possible working way out
Or any other npm yk which can give me link of sticker gif or image when given name
can you elaborate? i dont really understand what you want
Check the link I sent...
You can see that it is of stickers it has name of sticker as description and its I'd
I need it in description: id format so that i can put it into cdn and then can use stickers noramlly
Did you understood?
Ik i need to use map and reduce but idk how
stickers.map(x => ({ [x.description]: x.id }))
And what is the stickers ?
Oh cool , is that browser or some website for this things?
btw, why are u using an emote when an emoji exists? π
simply paste \π on its place
browser extension
So...
sticker_packs.stickers.map(=> ({ [x.description] : x.id }))
Ohkπ
Is this correct?
sticker_packs is an array of sticker packs
then each sticker pack contains an array of sticker objects
if you want all stickers from all packs you have to map both things
Like
for (stickers of stickerpacks) =>
const total = {};
for(const pack of sticker_packs) {
for(const sticker of pack.stickers) {
total[sticker.description] = sticker.id;
}
}
or with a reduce + forEach
const total = sticker_packs.reduce((acc, pack) => pack.stickers.forEach(sticker => (acc[sticker.description] = sticker.id)) || acc, {})
const total = sticker_packs.reduce((acc, {stickers}) => ({...acc, ...stickers.map(sticker => ({[sticker.description]: sticker.id}))}), {})```
no assignments inside the functions
just add a () and it works
Hello, where I can calculate the results?
the results of?
are you sure about that? :^)))
this is the setup block js Array.from({length: 100}, (v, i) => ({ stickers: Array.from({length: 100}, (v, i) => ({ id: "adsf" + Math.random(), description: "adsf" + Math.random() })) }));
looks like Tim's code is faster
how dare you
just facts bro
whoops
that's why it's slower
const total = sticker_packs
.reduce((acc, {stickers}) => ({
...acc,
...stickers.reduce((acc, sticker) => ({...acc, [sticker.description]: sticker.id}), {})
}), {});
fixed
my code wins 11 times
idk what type of tests they run
Ben you are coping
a broken clock shows the correct time twice a day
wait
thats not what the numbers mean
lmao
the numbers are a performance indicator, ie operations per second
not the number of times the code "won"
no it's the elo rating
lmao
and in this case lower elo is better
wood division 4
remove the quotes
that should solve it
anyone know how i can translate a slashcommandbuilder to a string? for example
SlashCommandBuilder {
...data
}
to
/(commandname)
or
/(commandname) (subcommand1)
/(commandname) (subcommand2)
/(commandname) (subcommand3)
too many tries.. https://shot.rip/q1a
discord.js v13 ^
that's the worst possible highlighting I ever saw
I better, didn't saw
is ur whole code inside a comment?

Hey! Iβm not good at coding my bots but I really need help by someone that is good at coding them and I am Unexperienced in bot coding
Mind someone helping me?
well u need to tell us what u need help with
what language
etc
if your looking for someone to make a bot for you here then u prolly wont find it
maybe for money but
uncomment it so I can read
thats it
Well I want my bots to include slash commands and get online
And Iβm not sure how to do that.
this is just some testing
what language are u using?
what library too ^
I donβt have any language yetβ¦
But i do need help programming the bots
so u dont have any bot yet
@lyric mountain https://haste.cherrybot.xyz/amuroturub.js
so u want someone to make a bot for u?
ok, tf
IT IS CALLED TRIAL AND ERROR SIR
OK
I WAS TRYING
STUFF
THEN I GAVE UP
No I just made the bots but I want someone to get them online and add slash commands and code them.
which one is the most recent one?
Iβm just not good at Coding
uhhh
honeslty scraping this code
then u indeed want someone to make a bot for u
this code was me just testing
"making a bot" isn't just going to discord dev site and creating bot account
theres gotta be an easier way to do it
well, kinda
@vagrant sail no one is gonna make a bot for you unless its paid
I need a bot coder to code the bots to get online & add slash commands to them
I just made the bots
that means nothing
β¦
its like making a discord account
How do I even make the bots?
but the discord account isnt gonna speak by it self
you code it
using a library
such as discord.js
with code, that alone is what gives life to bots
I tried discord.py
anyway, this isn't the right place to find coders for hire, a mod will probably appear here soon telling that
all ab preference
^
but what u can do is look on top.gg for servers that have coders and u can askthere :D
may I say, I don't think you'll find anyone willing to code and host for free, so there's that
coding isn't hard, but you need to study the topic (coding, not specifically making bots)
^
i've written a number of bots for clients. its not cheap.
if you have time, and want to learn, do it yourself π
oh
else, get a deep wallet
nvm
I still have time but where do I begin?
no, no god hell no
then i would analyze code
and then
i understood what certain things do
and
i memorized
is terrible to start from youtube because u get dependant
true thats why i would just use youtube to analyze code
first u need to choose a language, I'd say either js, java or python
I donβt know where to start codingβ¦thatβs the problem
those are pretty beginner-friendly langs
Where do I start coding?
once u choose, go to udemy or codeacademy and take a few courses
some are free so u don't need to spend anything
Which ones are free?
imo, javascript would be the best place to start. but im super biased. love js β€οΈ
all langs are free, I'm talking abt the courses
you'll need to look at thsoe sites to know, there are many
do not think about bots yet, focus on learning how to code
I need a link to them firstβ¦
once u get a good grasp of the language, attempt a simple project like calculator or snake
yea, if you dont know any coding at all, starting with a bot is not going to be a fun experience. learn how to do basic junk in some language first
Learn syntax => learn logical thinking => build your own projects such as discord bots
THEN attempt a bot (a simple one, with stuff like ping and 8ball)
How about I try Dyno?
try to make a bot like dyno?
Well something different it
that's like trying to fight a bear with a stick and some potatos
what are you actually wanting/needing a bot for?
I might try doing one like Dank Memer but with economy + more.
Server managementβ¦basically for stuff that I do on my own server.
any economy bot is a huge undertaking, you need knoledge of databases, data structures, how to perform api calls, and a lot of knowledge of whatever coding language your writing the bot with
I already created the bot accounts now I need the botsβ¦which Is a hard part
it took me like, 6 months to write my first discord bot, and ive been coding for almost 10 years. its not something you can just throw together overnight without prior knowledge
Well because it was easier for you for other beginners it may be hard and some may get more experience than others
but yea, its not advisable to begin with just coding a bot, you will be so overwhelmed its not even funny π
gotta learn the language your using to write the bot first
Youβll struggle with so many basic things that the guide kinda hops over and assumes you know, which will lead to quick burnout and βI canβt do thisβ mentality
like, you wouldnt try to write a french novel when you only know english, right?
Well thatβs why I hate making bots when it comes to hard parts
Then donβt make bots
it's not the hard part lmao, it's the only part
bots are 99.999999999999% code
the remaining percentage is making the bot account
there are tools out there to help making basic bots. like, applications with a user interface that you can drag and drop components to build a bot
Make that 100,00000000% to code
those bots are generally looked down upon though, as its not 'your bot', its some other persons bot you have customized
Iβm gonna try making one first but idk it wouldnβt be easier if I looked in YouTube for easier ways to get a better script
looking at youtube is one way to make sure your bot dies early
always refer to official documentation or forums, they're the best places to find answers
official doc is intimidating af when your a nub tho.
youtube guides are timeless (that is, they might not represent the current state of things), and discord api is HIGHLY volatile
so it changes a lot in a very little timeframe
I once ordered a bot from a bot developer then it went offline in my server
no one is gonna perma host a bot for you, unless you are paying them monthly
they didn't
Thatβs a waste of money if you literally do that
they were tasked with making the bot, and they made it
making a bot doesn't include hosting or doing maintenance
those are separate services
it's like buying a car and expecting the seller to keep your tank full
ngl, thats why i dont write many bots for clients anymore. they always expect free maintenance, and im too nice lol
If thereβs no maintenance required then the bot is automatically gonna go offline
not really, you can host the bot yourself in ur own pc
by "maintenance" we mean "fixing bugs and adding more features"
I donβt have a PC correctionβ¦
^ bots been running for like 2 years without intervention
it reboots and such itself occasionally
I'd charge like $5 only for being available to do regular maintenance
that for small bots
SAAS is not cheap, clients usually expect it to be
I would Rather Copy & Pasting the code rather than typing a long code to write a big one
contabo is one of the cheapest i've found. there are some others like hetzner etc
That Saves you more time.
funny enough, it's the inverse
because copypasting makes maintenance hell
like, if the bot ever shows bugs, or u want to add something new, u wont be able to do
if you copy and paste code you have no idea what its doing, thats a huge security risk imo
because you don't know what u copied
that too
too easy to expose ur token and get ur own account hijacked
too easy to get properly hacked too if your running the code locally
Not unless you have a Safe Security System that prevents hackers installed.
i knew a dude who was writing hacks for rpgmaker mv, so the games he made would hack peoples systems.
there is no such thing as 'prevent hackers'
as the wise man says, "Time saved from choosing the easy route will return ten-fold later on"
you can slow em down, but thats it
If your on a platform just report them and theyβll be banned.
they wont
it's impossible to know who stole ur info
all discord will see is you doing weird stuff
if anything, ur own account will be the one punished
true π
why do you think discord scammers use people's accounts instead of creating one themselves?
Coding a Bot would waste half of your time
then have no bot ~ problem solved π
I'd not say "waste", more like investing
I feel like making a Discord bot is more harder than trying to enable Discord Party mode on your device
coding skills are highly valuable nowadays
plus while it might seems like a "big code" you really don't feel like it took a long time
it's like writing a book ig
you simply "go with the flow"
what other ways? please do tell
Literally that means it would be wasting a lot of battery
yep
Until 1% then it dies.
there's no "free" hosting
well, glitch
Well thatβs the worst thing ever
glitch has anti-pinging policy now
you'd be breaking the ToS if u used anything to keep ur bot online
lmao
Well how are you gonna get a bot online without breaking the ToS
paid host
at the end of the day, if you want your bot to run, it has to be on some computer running, if that computer goes off, the bot dies
this is why people pay for servers
inb4: not that expensive
I literally donβt have a computerβ¦
then you literally, need a host
Web hooks are also just like bots
not really
uh no - not really
webhooks only send messages, they cant do any kind of processing
There are small virtual servers for like β¬5/month - perfectly capable of running a small public bot
alternatively, if you want to host at home (and you have a stable internet connection) - i guess get a raspberry pi?
it still wont be free since u need to pay for the pi + energy bill
yea they're like β¬40 iirc
just get a hosting service, it'll be the cheapest option
top end models are a bit more
BUT before we talk abt hosting, you don't even have a bot yet
^
and if you have no computer, you have no way to develop one
Bruh
Well having a PC doesnβt mean you can use
Imagine having one cable missing 
The entire weekend
I mean, u CAN code without a pc
Develop your bot on mobile ποΈ
it'll be an awful experience, but possible
Make that your entire cables missing
Just one is missing 
can you run node.js mobile though? idk if you can
i guess, you could code a bot in something other than js lol
There used to be a package for nodejs for iphone os and it was node 12 and I was able to host my bot on my iPhone, but just for memes
oh, so you can run a vm basically? neat.
u can technically install ubuntu on a smartphone, the hard part is making it work with the processor and stuff
And no prime available on Sunday
Delivery guys should fucking work 25/7
If you make a bot then you would have to spend a lot of time with the errors
That would be a difficult issue
Cause if someone is reporting a error of your bot then itβs up to you to fix your bot.
yep
well, there is no way someone will write a bot for you for free, host it for free, and perform maintenance for free π
thats just not how the world works unfortunately thankfully π
If you follow some basic coding principles handling errors, finding and fixing em wonβt be a big deal
Thatβs true.
errors don't happen THAT often btw, unless u really dont know what ur doing
that why we said you should learn coding before learning to make bots
tbh, the last couple errors my bots have had, was caused by discord messing with their own api's and junk
oh, and one guy who had too many integrations and couldnt figure out why the bot wans't joining π
IDEs also show most errors before u even try to run it
just make sure not to ignore what it says and ur fine
I'm doing some mad code and getting the users with the most reports on my bot, i'm stuck trying to split after 10
const sorted = Object.entries(all)
.sort(([,a],[,b]) => b.length-a.length)
.reduce((r, [k, v]) => ({ ...r, [k]: v }), {})
.splice(0, 10);```
An error occured: TypeError: Object.entries(...).sort(...).reduce(...).splice is not a function
then when I do js Object.keys(sorted).map(async reporter => `${await client.users.fetch(reporter).tag} - ${sorted[reporter].length} reports, it returns [object Promise]
.splice doesn't exist on an object
ah wait good point
probably want to splice before reducing
Object.keys(sorted).map(async reporter => `${await client.users.fetch(reporter).tag} - ${sorted[reporter].length} reports`).join("\n")```
I tried doing it on that just before join, got [object Promise]
Since you use async in the mapper it returns a promise
.map(async anything) = [promise, promise, promise]
Promise.all()
ah
but in your use case its not recommended
you should use a for
to fetch users sequentially and not concurrently
don't ask to ask 
im not sure how to alter order
or how to use sql at all besides getting specific parts
so far i have this
1.
SELECT * FROM Customers ORDER BY Country DESC
2.
SELECT * FROM Customers ORDER BY Country ASC
3.
SELECT * FROM Customers
SELECT * FROM Customers ORDER BY Country ASC
SELECT * FROM Customers ORDER BY CustomerName DESC
4.
SELECT * FROM Orders WHERE EmployeeId = '2' ORDER BY ShipperId
5.
i have no idea how to add things with sql```
im not sure if 3 is right cause its worded weirdly
all of the questions are worded weirdly tbh
i just tried this for number 5
INSERT INTO Customers (CustomerId, CustomerName, ContactName, Address, City, PostalCode, Country)
VALUES ('92', 'Acme Supplies', 'Frank Lesser', '123 Main Street', 'Norwalk', '06850', 'USA')```
had to look up how to do it
3 is wrong, like, REALLY wrong
ORDER BY can have many columns separated by comma
they want u to do a double sorting
OHH
to add things u use INSERT INTO table (col1, col2, col3) VALUES (val1, val2, val3)
π
π«° when tf was this added??
π«΅ and this
tf is happening in unicode council?
is...is that a---nevermind, I don't want to hear the answer
I wonder why tf did they even bother using unicode slots for human emojis
like, I have yet to see a SINGLE person using them in a normal conversation
idk my stomach is pretty stuffed π«

π₯Ήπ«£
This took alllllll dayβ¦β¦.
Only slightly concerned of the fact that you're using 6% of Infinite CPU
itβs a test server lol
π«₯π«‘π«
does anyone why this turns into this (it turned the numbers into strings)
oh
I have a .toString() at the end 

yo
await player.destroy();
} else if (player.twentyFourSeven = true) {
await player.stop();
}``` wondering why its not working
what are you trying to do




