#development
1 messages · Page 53 of 1
Does anyone know what I'm doing wrong? thanks
Should it be .values instead of .filter?
??
Assuming that your custom botCommands property is a collection, the array() method was removed a while ago, so you should use the values() method which returns an iterator, and use the Array.from() method on it to convert the iterator into an array
Array.from(message.client.botCommands.values())
Ah, i see. Thanks so much!!
Does anyone know why my filter isn’t working? Like it totally makes my collector stuck. I am pretty sure that the member id is the user in the database as well. It just does nothing
Whats the best way to make UIs Like this and actually Code them? For the First id say Figma but the second one idk, Im tired of pure HTML + CSS
whats figma
interface design app
Personally I use Figma to design and then some CSS framework to make the implementation of it e.g. Chakra
Thanks, I'll Look into it, do you know any Templates that Look similar to my Screenshot?
Not by head but you can probably find one if you search for an admin dashboard template
omg, I never used react / any framework and now im hooked, its so easy to do anything

Finally I dont have to touch css files 🤩
You eventually will have to at some point
Not everything will be as you wish
So you'll probably need to edit things from time to time with custom styling
well yeah, I dont have to write 200lines of css to optimize it for mobiles atleast ( I hope)
laughs in Python
what
they are the exact same file but renamed
yes, the login file has the function renamed to login
nvm, It has to be Login, not login
@whole knot
why is this Button not executing the dologin function?
try just js onClick={doLogin()}
i'm sure that just calls the function whenever the component renders
Ah
it's disabled
the button is disabled
thats intentional
its enabled through js
and I can indeed see it changing color when clicking
how is it enabled through JS?
On the screenshot disabled will always be true unless Button passes something else to the actual button componnent
If you're 100% sure then the only other thing that comes to mind is that some other parent / child listener is stopping the event from propagating
document.getElementById('LoginButton').disabled = false
that's your problem
you almost never interact with the document API directly in react
The Button component thinks it's still disabled because react uses a virtual DOM
you have to save the value of disabled in a state and update it when you have to:
const [isDisabled, setDisabled] = useState(true);
return <DarkMode>
<Button disbled={isDisabled} ...>
...
omg, thank you so much
Ive been trying for 3 hours lol
while you are here, do you know what causes this? the Navbar has the exact same Code (using chakra btw)
I've only used chakra like once so I can't really say without more code
you've probably hardcoded the color
with theme libs you 99% of the time use theme colors instead of raw colors
I now dont know why the navbar even works
ok, got it working by putting it all in a different component
@livid crow
ok so i know this isnt really bot realated but its still web related, kinda. so i have two raspberry pis or something right, I need one to send a message to another and the other way around too. i dont need any data to be sent other than a ping or something. the senario is that one receives a voltage on a pin and i need to send a "true" condition over the internet to another pi to put voltage on the pin on the other side. i got all that stuff done but idk how to send a message from one pi to another over the net. this wont be over a lan but over the internet. any simple suggestions? want to make this as low tech as possible to eventually just use a microcontroller like an esp32 rather than a pi.
idk how internet stuff works other than how to host a website tbh
so idk the protocolsl or anything so this might fall under the catagory of IOT
you could do it through sockets or a simple webserver running on express or in python, flask
and then just hook them up to your wifi and allow communication for these
So, I'm trying to have a check box that toggles the background color and the solution I found was to set a class to a checkbox and with a :checked specifier, select a nearby element and change its properties, but what if I don't want to select a nearby element and want to change the body itself?
Here's what I have currently:
<body>
<nav id="topnav">
<a class="active navitem" href="/">Home</a>
<a class="navitem" href="/about">About</a>
<a class="navitem" href="/dash">Dash</a>
<input type="checkbox" class="toggle">
</nav>
<div class="landing">
<img class="landing-image" alt="Amanda, a red-haired cat girl with headphones and a white shirt smiling at the viewer" src="/images/amanda-mummy.webp" />
...
.toggle:checked + body {
background: var(--inverted-main-gradient);
}
Is there even a way to select the body?
You could use js to change the background when the checkbox is checked
I don't want to use JS
pure css tricks like that only work on children, there is no way to select parent elements
So, I have to create a div above the nav bar and place the checkbox before that and somehow move the checkbox so that it's not awkwardly before the nav bar?
This sounds like a hassle
there's no shame in using js tho, if that makes maintenance easier
have you seen those css-only tabbed menus? they use similar tricks
web is html/css/js after all
I get this ugly mess because the body bg is no longer specified and is based on a container div
people block js
you can make fully functioning tabs with css only using invisible radio buttons
tbh, it'll also make 60% of the internet not work
unless ur using tor, I see no reason in blocking js
trackers/ads
the browser itself tracks u
sucks
and ads are 99% of the time blocked with a dedicate extension, not by disabling js entirely
Anyone who blocks js and expects shit to function properly is just out of luck
it's like removing someone's lungs and asking to run the tour de france
should've told me sooner
I figured out my issue
I set the position of the checkbox to absolute and it removed it. Then, I could just create a label for that checkbox
I'd like some opinions on it https://amanda.moe/
ah ok I'll look into it
const filter1 = i => i.member.id === gamedatabase[key].user1
const collector = r.createMessageComponentCollector(filter1,{
componentType: "BUTTON",
time: 10000,
max: 5,
});
collector.on("collect", (i) => {
console.log(i)```could anyone please tell me why when i add the filter the collector like doesn't work at all
even if the right user clicks on it>
It just freezes the collector
Because you're supposed to pass the filter as an option to the object
https://discord.js.org/#/docs/discord.js/main/class/Message?scrollTo=createMessageComponentCollector
voltrex i could marry
Oh damn girl 

indeed
anyone here know regex?
It won't work if the client doesn't have sufficient permissions to change a member's nickname, or if the member is the server owner

So as of now I need help making a thing and it's to send a start message when my bot is added to a server
any ideas?
example bots can be many
nvm
it was guildCreate
One I don't recommend as it can be annoying, two if you really want to, just look for the first chattable channel and send it there on join
every guild starts off with a text channel that has the same ID as the guild which is the general chat. If that channel exists, there are good chances it's still general
me who deletes that channel and makes a new general channel

Hi
hi?
app.use(express.static(__dirname + '/public'));
in main.js
<link rel="stylesheet" type="text/css" href="css/style.css">
in html
but its still not loading css
why not just use await
and use a try catch
.then().catch() can get really messy
you probably forgot to await something
then you probably forgot to handle it in a try catch block
how do i make a website i don't want to use HTML
blocking js to avoid trackers/ads is like removing your body to avoid diseases
Python
that's cruel
Just use js but all the html is in a raw string that gets inserted when the page loads 🧌
but you would still need a <script> tag 
will this wait for the data to be fetched in react?
fetch('some_url', { method: 'GET' }).then(res = res.json())
no
unless you explicitly add await
maybe context matters, I wanna display info about a user in a component, currently using xhr the data only shows after you refresh the components, not page
is there any other way? for some reason I cant make components async because then its just a pending promise
node:internal/fs/utils:348
throw err;
^
Error: ENOTDIR: not a directory, scandir './slash_commands/iogames.js/'
at readdirSync (node:fs:1446:3)
at /home/dragontahmid1/Descargas/New-discord-bot/handler/slash_command.js:9:30
at Array.forEach (<anonymous>)
at module.exports (/home/dragontahmid1/Descargas/New-discord-bot/handler/slash_command.js:8:41)
at Object.<anonymous> (/home/dragontahmid1/Descargas/New-discord-bot/index.js:11:98)
at Module._compile (node:internal/modules/cjs/loader:1149:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)
at Module.load (node:internal/modules/cjs/loader:1027:32)
at Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
errno: -20,
syscall: 'scandir',
code: 'ENOTDIR',
path: './slash_commands/iogames.js/'
}
Node.js v18.10.0
``` hmmmmm
probably this is doing it ```js
client.guilds.commands.set.foreach( async => {
[...client.slash_commands].map(x => x[1].data)
}).catch(err => {
console.log(err)
})
you'd need to show us slash_command.js
const { readdirSync } = require("fs"),
ascii = require("ascii-table");
let table = new ascii("Commands");
table.setHeading("Slash Commands", "Load status");
module.exports = (client) => {
readdirSync("./slash_commands").forEach(dir => {
const commands = readdirSync(`./slash_commands/${dir}/`).filter(file => file.endsWith(".js"));
for (let file of commands) {
let pull = require(`../slash_commands/${dir}/${file}`);
client.slash_commands.set(pull.data.name, pull);
table.addRow(file, '✅');
if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
}
});
// Log the table
console.log(table.toString());
}
slash_command.js
so you have a regular .js file in there and a dir
see here
your first readdirSync returns iogames.js and miscellaneous in an array
yes
then you try to read each as a directory
ah
try zooming in
k
Anyway, you'll want to read the directory and filter out non-directories. Some links on how to do it:
- https://stackoverflow.com/a/24594123/14695788
- https://nodejs.org/api/fs.html#fsreaddirsyncpath-options
An example with the code below.
readdirSync("./slash_commands/", { withFileTypes: true })
.filter((d) => d.isDirectory())
.map((d) => d.name)
.forEach((dir) => {
readdirSync(`./slash_commands/${dir}/`).forEach((file) => {
// Now you have a `dir` and `file`, load it.
})
});
bruh i thought js on websites was just for dynamic stuff like video players and web apps and stuff
why else would js be used other than complicated stuff you cand to with html and css
i mean thers dynamic elements and stuff i guess
but then i hate those cuz all it does is make the page take ages to load
unless its worth it
what's the thing that luca has a command for that lets you monitor your bot?
nvm, it's pm2
i think
¯_(ツ)_/¯
Yup! 
ajax, contact forms, sliders/galleries, singlepage app, and a gazillion other things lel
it doesnt really make it slow to load, unless youre doing shit stuff
most of the "but it can be done with html/css" sacrifice most of the maintainability of the project
since they use edge cases or stuff that are so intricate that you simply cannot maintain it after a few weeks
nowadays it doesn't matter much if you dont use the most optimized path, internet is no longer limited to a couple kbps
also as tim pointed, js impact on loading times is minimal
bruh tell that to hald the bot websites that i look at like dank memers page
takes ages to load
because it's not js
they're limited by discord ratelimit
whats that got to do with the website
you need to use discord to login to the site
hey guys we were making top.gg vote logs using dblapi.js and there is no error and I am running it on repl and for some reason there are no logs and no errors
don't blame the whole language for an infinitesimally small edge case
you can bet all your money that it's not js that's making the page slow
and you can even check that, just press F12 and see performance tab
you'll see what's truly taking ages
use topgg sdk
dblapi is deprecated
all i know is that alot of web pages with fancy shit take an age to load
blame the devs, not the language
never looked into it just assumed thats what it was
i mean yes but then the devs just go on about "maintainability"
yeah thats cool but if it negitivly impact user experience than thats not good
https://cherupil.com/ an example of stuff js can do (sayuri found this site)
if it was js' fault, the page wouldn't even load
ok thats pretty cool and onyl took like 4 seconds to load
not saying its js' fault im just daying its over used
something thats over used is bootstrap, had to use that to make a website in collage and its the most pointless thing ive ever seen
nah, it's underused (as in, the original html trio)
Hi haku
most devs use frameworks or site builders that add much boilerplate to the site
if it was to be done through raw html, the same page could be much faster
hi misty
yeah but the issue then is you gotta load a bunch of stuff in the frame work that you never use but still takes up load time
that's assets, not js
One thing to also think about with page loads is images & any imported css
the site has to download that every time
i hate that too
Also resizing massive images with css to a smaller size is never a good idea as it has to happen on every page load
this
Another thing I learned is about retina displays
basically twice as many pixels can appear in the same grid making the image cripser on apple tech
so a 600px image can be downsized to a 300px image and still look crisp on a apple phone and also look better on non apple phones
assets and styles are always what takes most of the loading time
Yea
there's a reason why most TOR sites don't use css at all
Also just people doing wacky css
Who needs css? 👀
a lot of css stuff if done wrong can make load times longer
I've learned some useful information in this linkedin course on css essentials 
Anyone whos not in the 2000s and wants to make a good impression on people to compensate for how lonely they are in life
Are we considering 2000s old now :c
yes waffle
then there's http://endless.horse/
its been nearly 23 years
2000 is almost a millennial
Im also sure that auto correct used the wrong word but idk Im too tired to care
I dont like how uneven this is
We have to write linked list shit
Imagne being in school
I cannot figure out why my linked list add method is not adding in the correct order
It’s based on the compareTo method but it’s still wrong for some reason
I was supposed to but my dad told me while I was half asleep that I have a doctors appointment then falls asleep himself and when I wake up he blames me I didn't keep him awake
@lyric mountain you know Java very well, how do you make a linked list add in a specific order based on the stored object’s compareTo method
aside from using LinkedList<>?
Making our own
like, have all keys be indexes
yes, still using a map behind the scenes would be a good option
Not allowed to change the instance variables unfortunately, it has to be a raw linked list
We have a class that holds an instance variable of type ProductNode, which is a linked list
...
It’s very basic, ProductNode has an instance variable called data which stores the Product, and then a reference to the next node called front
ok so...you're making a linked list...that uses a linked list?
No no
We’re making a class that wraps around a linked list
Sorry I should’ve been more specific
The class I’m writing code in has an instance variable that is a linked list, so I guess you could say that
cant u just call the linked list methods?
bruh someone in this server literally copied it??
?
See a website on the about me of someone that is exactly that
Linked list only has setData, getData, setNext, and setFront
Just other domain etc.
lmao
It’s our own linked list, not from the Java stdlib
ok, so THAT linked list is what ur trying to make?
I’m trying to make a class that stores that linked list as an instance variable
And then we’re making methods that wrap around it
class MyList<T> extends TheOtherList<T> {
bro lmao that's a fuckin sue case
what a shameless ripoff
they even blocked F12 (and right click)
ikr
Sending email to the original owner to make them aware 
My main problem is that my add method doesn’t add the element in the correct order, since it’s supposed to add based on the compareTo ordering
BRO
Yeah here it definitely didn't began with creativity
they didn't even bother to remove cherupil photos

ok so back to waffle
Sorry Waffle for killing your conversation 
btw, the logo is CC (Christopher Cherupil - second C is flipped) 
how are u implementing compareTo?
also, what is ur Node class?
My idea was as follows:
Loop through the linked list while the next element is not null
Compare the data at the current element to the one being added via its compareTo method
If the result is less than or equal to 0, then it will be added after the current element (current.compareTo(oneBeingAdded) <= 0)
If they don’t belong in front of the current element, continue looping
Otherwise add it to the end of the list
The Node class and Product class are written 100% correctly, they were provided to us in the assignment
The compareTo method just compares the names of the products with their respective compareTo methods as well
Not really, the add method is just based on sorting order
The other methods however do not preserve sorting
I'm struggling to understand the whole thing tbh
The first add method
ok so you're the one writing ProductList I suppose
Oh maybe I need to be checking if the element belongs BEFORE the current element or not
what is being used to store the values inside ProductList?
an array, a list, what
ProductNode
ProductNode is a collection?
No, it’s our basic implementation of a linked list
sigh
I gtg, I’ll try to fix it during my comp sci class
just as an addendum, use .iterator() instead of a while loop, or if possible, .stream()
Not possible, it’s not a collection
that is a mess by itself
now I understand why most people come out of college hating java
like, it's a damn biased method of teaching, no wonder why they see python and say "oh wow, this is much easier than java"
kek
@earnest phoenix btw I just checked, they even got as far as registering the site in dmca
tho they didn't verify the account
Skill issues
Will email the owner
good idea

hmm
Yes very spooky plastic gun 
ye, we saw it lul
and obviously "coding can be boring af", when u don't code at all
I wonder how I got dmca striked, but ended up winning the case 🤯
Would be interested how a DCMA takedown from an Apple Senior Engineer would feel like for his parents 
looks like a typical American
his response:
blyat cyka jobany urod
nah his face is definitely russian
So… evil you mean?
The difference is that an American would know how to hold that gun correctly 

more dumb, less evil

i consider americans more evil xd
more dumb […]
Brings us back to Americans
i mean, yes, americans are dumb af
but russians are more often than not even dumber
because they are fueled by vodka
:^)

fake taki dumbo
dumbo ooga booga
oh my :^)
That's what she said I suppose 
He's
Azerbaijan or something like that
According to previous messages 
https://github.com/Mistyerious/TrickOrTreat I made this in like 15m so far how does it look? (Have yet to implement rate limiting on the gateway, reconnects, invalid sessions and such)
I am doing this for Halloween
pog
I do have plans on making this something serious if it goes well though
So if I do I might make it in rust
17 problems wow
nah just code quality things
Still 17 problems
17 problems found 
And never fixed
banned both rn
Do it
here java jumpscare
type casting
var lst = (ConnectionListener) listener;
switch (event) {
case AsyncPlayerPreLoginEvent e -> lst.onConnect(e);
case PlayerQuitEvent e -> lst.onDisconnect(e);
case PlayerJoinEvent e -> lst.onJoin(e);
}
soon
unless your application has to work on lower versions of java
rip then
look KuuHaKu, I have to go through the pain and agony to keep legacy support
im not djs on v500
how...how far is your legacy support, may I ask?
27 years
to note, am not the maintainer of that plugin but
spigot plugin
which has support for minecraft 1.7.10
jdk 8 then, oh the pain
must admit though
stupid me has mostly been working on jdk 8
never bothered to upgrade apart from the obvious one when log4j came
there's so much improvement to the language as a whole, it's awful when I need to go back to older LTS versions
Agreed.
hi miyu
there's this one too
Only thing I'm like kind of not a fan of and It may just be a me thing is the emojis being used and how they're a nice blue and an ugly grey
The grey ones are disabled
Over all, supposed to be easy on the eyes and the dark mode is really just an easier on the eyes and also mostly and experiment
a thing that I'd suggest, is making the fonts here slightly bolder
like, not enough to be called "bold", but slightly thicker
Thiccer
Maybe
It's much easier to read on the site itself rather than the image
perhaps it's also because I'm seeing a downscaled version of the whole site
Idk if you plan on adding more to the page itself, but if you are would making the actual music player which I assume is the top left one, span across the bottom be a better choice to give you more page space for other stuff.
ah ok
also...did you try comic sans to see how it fells in that site?
it gives me some comic vibes from the thicc outlines
might pair nice with comic sans
No. Just that it's a live stream
Also, the font is Discord's Whitney
Are you able to determine what a live stream is by the API? If so
maybe change 0:00 to "Live video"
or something
if it returns 0 length it's safe to assume it's a live
Technically
{"op":4,"d":{"track":{"class":"RequiresSearchTrack","id":"RK8e4JQgPfo","title":"Pixel Galaxy","length":236,"thumbnail":{"src":"","width":0,"height":0},"live":false,"uri":"https://youtube.com/watch?v=RK8e4JQgPfo","source":"youtube","author":"Snail's House"},"position":2}}
or just really short
LavaLink gives good info most of the time
One thing I am super not happy with is this
idk what to do here tbh
Put your logo
Rounded edges
More subtle of a gradient than that (it’s difficult to achieve proper contrast with a gradient between colors that drastic)
Also might want to use bigger font for the Welcome Back section, and remove the border around the entire thing, and instead go with a bigger font and bolded letters
There's a stop in between the colors for that reason, but I personally like it
depends on bot theme/design really yeah
So I just made a big fuckery of my codebase
Tried implementing a system similar to how djs handles dispatch events from the gateway so I can easily process them without the need of doing so for every single event when I am connecting my shard
https://github.com/Mistyerious/TrickOrTreat Mainly speaking of the #handlePacket in the Shard.ts, Actions & Handlers stuff
on which major did you finish? v500?
huh
d_m_js soon
Ok
Fuck you markdown
You and auto correct should burn in hell
Wtf
TypeError: member.sendCustom is not a function
at /home/container/src/dashboard/dashboard.js:621:10
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5) Promise {
<rejected> TypeError: member.sendCustom is not a function
at /home/container/src/dashboard/dashboard.js:621:10
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
}
.sendCustom({
embeds: [
new MessageEmbed()
.setColor("GREEN")
.setFooter({ text: `Powered by https://universebot.xyz` })
.setTitle(`Application #${ticketID}`)
.setDescription(
`Hey ${
member.user.username
}! Your form was Submitted and ready to be judged.\n\n**Form ID**: \`${ticketID}\`\n**Time:** ${moment(
new Date()
).format("dddd, MMMM Do YYYY HH:mm:ss")}`
),
],
})
.catch(() => {});
What am I doing wrong??
.sendCustom doesn't exist on whatever you're trying to use it on
Lmao you helped me actually, thanks!
I don't know what was I thinking
My bad
General question. How does NextAuth's (https://next-auth.js.org) Credentials (Username / Password) work exactly? Like is it some soft of OAuth2?
Or in general, how would I make a Username / password authentication in my app between frontend and backend? I thought about just authenticating, generating token, storing in localstorage and just give it an expiration timestamp
L
So it looks like it is similar to what passport does
It supports a variety of methods of authentication
Email / Password or Oauth2 of some sort whether that be through Auth0, Google, Twitter, etc
And it gives out a JWT once it successfully auths by the looks of it
JWTs are cool cause it leaves little validation for you
You can also have your own way of storing the "session" though
Ye ik JWT are cool in general but a downside is that you can't expire them, like make them unavailable..
Huh
As far as I know
but still, that doesn't matter too much for the system itself right? xD
Maybe if the user logs out I don't want all the date to be somewhere around
Thats when you'd delete the JWT
As an admin of the site you might delete the user or update their permissions
I store my jwt as well because I’m dumb and don’t fully understand it
With JWTs I dont think you really need to store them yourself
That's the point of JWTs, stateless. There's no use in storing them on the server
Otherwise you're kind of just reinventing sessions
So no point on using JWTs
JWTs are fine for something that only needs minimal security
personally I'd use oauth
Helps prevent attackers as the actual credentials are on the server and nothing gets sent to the client other than a token which they can't get unless you give it to em
Which at that point is your fault
I mean, that's mostly used/made for third parties but yeah you can use it
Discord uses oauth for their logging in
Thats why each user is assigned a token on login
They made their own oauth server iirc though
so they don't use smth like Auth0 as a thrid party
As far as I know yes
They send the login creds to the server and it responds back with a token iirc
Yeah I mean that doesn't necessarily mean oauth2
I also do the same, just send a token back
I don't know where it was but I read something about it
I though oauth2 was just used for applications
So that they can get data from discord
That's the purpose of oauth2
I mean they can use it, it just doesn't really make sense
Point of oauth2 is to allow a website or application to access resources from other web apps on behalf of a user
Mhm
Does someone know how to get started with discord outh2 in website , i have some references but they are in php and i want in html css
You'll need something else than HTML/CSS only, and HTML/CSS will be used either way
yeah you cant make oauth in pure html/css, oauth is not something visibly done
lol
it is a process that allows your application to receive access to scopes on a account
or am I wrong @boreal iron
ah yes oauth in html and css
I mean you could technically do it with js but why

js in the sense of implementing javascript on your website
Nah that lol has been dropped regarding that question
I wanna do discord bot in css
Was there some discussion here
Can anyone say how to get emojiid without nitro
doubt that's possible if you can't send the emoji
yeah you'd need nitro for it, have the bot go through all emojis of your guild and use the one you'd need
right click it and hit copy link (or somehow get a hold of the image) and the link has the ID in it
or use / or \ before the emoji i forgot
"without nitro" since you cant send emojis without nitro
i mean if he is on the server he still can do that 
oh lol forgot you can use emojis on your own server
What about animated once
can someone help me with my cloudflare?
oh yea, idk if normal users can send that i forgot
The best way is using some kind of bot made by urself for this stuff
whats up
A missing DNS A record that mentions origin IP address. A CNAME record in the Cloudflare DNS points to an unresolvable external domain. The origin host names (CNAMEs) in your Cloudflare Load Balancer default, region, and fallback pools are unresolvable. Use a fallback pool configured with an origin IP as a backup in case all other pools are unavailable. When creating a Spectrum app with a CNAME origin, you need first to create a CNAME on the Cloudflare DNS side that points to the origin. Please see Spectrum CNAME origins for more details
i can’t figure this out
Got anything for `redirected you too many times'?
well if you have no entries then nothings gonna happen
@ is the root of the site, aka yoursite.com
if you want a subdomain such as www.youtsite.com, replace the @ with www
i have many
why do you have a cname on your domain if that domain is hosted on cloudflare
then add a root entry (aka a new entry that has @ in the name, make sure it is a A record (A = your server ip)
root means your domains root, aka yoursite.com
non-root, aka a subdomain, would be www.yoursite.com
ok
If you want cloudflare to serve your website through their proxy (aka through cloudflare for example as a ddos protection), make sure the "with proxy" is selected
cloudflare only proxies http-based ports such as 80
but if it does look like this (ignoring the name part, you can both directly use your full domain or just @ ) then the cloudflare setup should be correct
so if you want something such as a webhook you're using for top.gg voting as a plain example, you'd need to either use port 80 or use something like apache2/nginx to reverse proxy that. Though thats another entirely different thing
nah not a cname
or is replit giving you these details?
yes
nice images that wont load there
yeah
How to link your custom domain to your repl! Hello everyone and today I will be going through how to link your custom domain with your repl with cloudflare being the DNS provider! Here are what I will be going through today! Contents Introduction What are domains? What is Cloudflare? Setting everything up Getting the replit code. Setting up cl...
that one
yeah make sure it isnt proxied then
the cname
toggle the switch "proxied"
I can visit that site, works fine
might not be what you'd want to see but that works
so thats up to replit now
and gone again, worked for a second
im relinking it
i have $0
once you can, doesnt mean right away
and i use it for my minecraft’s server ip 😂
Freenom is the newest addition to the league of affordable hosting services but there’s more. You can find the cheapest domain name registrar, which usually start at around $8.88 / year for a .com. You can also find a hosting package that also includes a free domain, though it’s usually only going to be free for the first year. So the cheapest d...
u smell
you too
Ty <3
hey guys i've got a bit of a mathematical question
I have a summation of these fractions: 1/2, 3/4, 7/8, 15/16 etc
for the regular formula 1/2^n
How would i come up with another formula
that would give the same outcome
so for example n = 1 gives 1/2 ofcourse with that outcome, so n = 2 will give 3/4
You smell
I think that's as reduced as it can be
any other formula will be just unreduced versions of it
like 4/8 ^ n, or (2/4 / 2) ^ n
there's the sigma notation version (that represents the summation of 1/2 ^ n) that's
n
Σ 1/2 ^ i
i=1
hey umm, on button interaction "dispose" or "end" events how do i make all the buttons i've sent as disabled?
edit the message, setting the new buttons
thanks
Does someone know the software these docs are using because they are all very similiar?:
https://stripe.com/docs/api?lang=node
https://appwrite.io/docs/client/account
https://docs.github.com/en/rest/actions/artifacts
Like this code example on the left and sticke to the section and parameters etc. on the right. It's so similar 
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Appwrite provides web and mobile developers with a set of easy-to-use and integrate REST APIs to manage their core backend needs.
sorry but, there's nothing similar in them 
that's just the standard documentation structure
yup i see but this is for mathematical induction
do you know that by any chance?
So everyone of them built the same behaviour and site structure? I know the look very different etc.
ye
there's a standard for documentation writing
like there is for scientific research structuring
if u want a builder for something similar, there's https://readthedocs.org/
Read the Docs simplifies technical documentation by automating building, versioning, and hosting for you. Build up-to-date documentation for the web, print, and offline use on every version control push automatically.
So don't worry about b, it's easy. However i would need an easier function for that one above
So we need to prove a
there are also a thousand other builders tho, just choose ur flavor
I already came up with a solution, but it's a hard formula so that would be too hard to proof in the inductive step
bruh okay I was thinking about basic swagger first but it's kinda ugly 👀
that's not asking u to find other formulas
that's asking u to write the direct formula
yeah
so without having to use the summation part. So for example n = 3 would immediatelly return us 7/8
That would be impossible to prove in the inductive step
we need something simpler with the use of /, 2, * , ^
f(x) = 1 / 2 ^ x
That's the same as the base summation formula,
I don't really get what exactly u want
And it wouldn't suffice as take x = 3, it would return 1/8 instead of 7/8
have you ever had mathematical induction and summations?
how so?
it'd return 1 / 8
1 / (2 ^ x)
remember bodmas
wait, just reread what u wrote
why should it return 7/8?
That last formula you see is the base formula, but this is a summation. So that means that you need to add each value up to each other. So imagine you have n = 1, you get 1/2. N = 2 gives 1/4 etc etc. But remember, it's a summation! So n = 2 would give 1/4 + 1/2 = 3/4
and so on
so n = 3 = 1/8 + 1/4 + 1/2 = 7/8
have you ever had mathematical induction?
can't u really use sigma?
it's discrete mathematics i can't
when i enrolled for this cs university class i expected coding instead of doing this 😭
cs? I don't see where tf you'd use something like that lmao
There’s a lot of math
yeah but...not something like this
We are not even coding, only focussing on the 'brain' behind the code and the functions etc
It's because i enrolled into an university instead of college. In college they mainly focus on coding.
Yeah that is what i had, but it will be a hell to prove using math. induction
a proper cs answer would be simply ```c
double x = 0;
for (int i = 0; i < n; i++) {
x += 1 / Math.pow(2, i + 1);
}
Huh? Math induction?
this is discrete mathematics whahah
mathematical induction
I’ve never had a discrete math class
oowh
What is the format for answering this question
Let me send you an example of a proof
methmatics
no u
are u sure u joined cs and not math?
So do sigma notation
Now they wanted to find a formula that equals to sigma 2i + 1
which would be n^2
and we need to find such formula as well
I don’t think I understand
and indeed this would be correct, but it would be like impossible to prove using mathematical induction
Ah
I should be studying for my calc test next period 😭
I should've never enrolled into computing science bro
wtf is this
like 80% is maths that fuck my ass
99% of colleges/universities will require you to take a discrete mathematics class at some point
I don’t understand what the point of converting sigma notation into an n notation really is tbh, they’re just the same equations represented in different ways
it's just a summation. You can call all numbers k, and the predicate holds for that k.
Now you need to prove that k + 1 holds as well
it's really vague and all, but thanks for trying
I’m aware of what the notation means, I just don’t see the point
Yeah they just want to fuck us
Why would they not just allow you to write in sigma notation
Because you wouldn't be able to proof it in the next steps
you would have to rewrite that same formula with k + 1 as parameter
Why they gotta prove basic math 😭
It's because in basic maths, they assume that something holds and thus is true, but that ain't really the case
Top or bottom param?
It starts at a positive integer
Oh wait yeah
I gtg now, gl with that question
wahahhaha alrighty, thanks mate
Might help to ask some math geniuses in another server
It's okay, thanks and good luck with your classes as well
that'd be much easier with loops ☕
not sure what that mean, but isn't the architecture bound to the cpu itself?
ye I was thinking about that too but 1 mom
I found out you can define platform: e.g. linux/amd64 in a docker-compose.yml file and that should work.
Alright so question
Lets say I have
switch(t) {
case ReadyOpCode: {
// do some stuff relating to ready
break;
}
PacketHandler[data.t](client, data)
break;
}
Would this go through ReadyOpCode and then go to the PacketHandler and execute?
is that even valid syntax?
I doubt it. You should have that logic outside of the switch
if you wanted to only do stuff if the op is one you recognize and a default handler using the default case
my dns is cloudfare, but what type of certificate do i generate (client/origin) for a mailserver
no because u added break
these are the dns records for the mail server (and another txt w/ domain name)
if u want a fall-through switch u must not use break
That could be troublesome
and yes, that syntax is invalid
i have one rn but it doesnt work
for sure, that's why most ides warn u when u forget to break
not that we have such weakness in java ☕
Yea I misdid some stuff
I only say its troublesome because I want to run a handler for every event received
just put it outside the switch
[Function (anonymous)]
C:\Users\dyeaa\Documents\github\misty\typescript\trick-or-treat\src\structs\Shard.ts:86
PacketHandler[data.t](this.client, data.d);
^
TypeError: handlers_1.PacketHandler[data.t] is not a function
Am I missing something?
btw PacketHandler[data.t] is that [Function (anonymous)] thing
still not workin
try logging the typeof the thing
it might be an array
if it says object, then lmao
and store it in a variable and call it
was gonna ask if it was a constructor, but that would throw an error about needing the new key word
iirc
idk
its possible you cant call anonymous functions but what do I know
No you can call anon funcs
you're getting an event for which you dont have a function
just do if(PacketHandler[data.t]) PacketHandler[data.t](...)
const fn = PacketHandler[data.t];
if(fn) {
fn(this.client, data.d);
} else {
console.log(`received unknown or unsupported event: ${data.t}`);
}
Oh that makes sense
I love seeing stats like this so much
although I need to rethink some UI across the board
Thanks that worked
what's special about it
i removed my stats command because i removed sharding
Quite low memory usage… i guess there isn’t much cached?
How can I get my bot to listen to a port?
start a server
got a doc on that?
well what kind of server do you want to run?
like what is the port gonna be used for?
it uses detritus 🚀
Ewww
Do you guys do packs for myths of moonrise

I actually dont!
Virtually nothing from Discord except guild IDs
a music bot


memory usage was what I was eluding to. I used to chill at 600MB for 1500 guilds a long time ago in the gateway v6 days
but I was a lot more dumb back then as a dev so
Bot doesnt respond to commands. I have GuildMessages intent also
no code no help :C
That sums it all
I'm wanting to build a bot that has guild-level ranks + global. Global seems easy enough; however, what is traditionally done for guild-level?
Ie. when someone new uses a command for the first time in a server, simply add them to that "guild"
What about when they leave the server? Does the bot listen for that member leave?
Unless there's something stupid simple that I'm not realizing 🤔
Ig I can answer that
For my bot I have only one kind of profile: local
The global profile being the highest one
You could have something like a profile with nested profiles, like loritta does
not sure what id need to share.
This that the advantage of allowing server owners to edit the user's xp without affecting the global level
But also has the disadvantage of having to keep track of two separate profiles at once
Ku, I did not provide enough context. When I say ranks, I mean game ranks. There's a global leaderboard; however, I have an open feature request to implement guild-level ranking. I'm struggling on how I would capture when a user "leaves" a server so that they're not tracked anymore on the leaderboard for that guild. Unfortunately, I don't see a straightforward way of doing this without tracking who leaves a guild (which I believe requires an intent)
Code relating to your command handler, code relating to your gateway intents, code relating to your ping command specifically, etc
More on this, I see other bots with guild-level leaderboards ... but they don't have any privileged intents.
Ah so no level?
U don't really need any tracking at all, simply check if the user is still listed on the guild's cache
Most libs will remove it as soon as the user leaves
If all else fails, try to fetch the member
It'll either return the member or not
Does this require a privileged intent?
There are only 3 priv intents
Guild messages, guild intents and...I don't remember the last one
But I don't recall guild members being one
Gotcha. Does this work the same with slash commands?
I guess as long as the bot is in the server, it works 🤷
Yeah, it does
I also assume that my implementation may be an issue here. I'm not using the Discord Gateway to receive interactions - I'm using an outgoing webhook.
How you receive ints isn't really a matter, all you need it to be able to access member cache
Tho that's considering you're using a lib
Yeah, that's doesn't exist for Webhooks.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
If I need to list the guild members from an API invocation, I'm out of luck here. That would require a privileged intent.
Ie. using a webhook, I don't have a physical bot at all.
Then you can't really, it doesn't require a priv intent but you can't "see" the server unless you have a bot there
why do you need a list of members for a level bot?
Interaction-only "bots" are strictly a trigger-answer kind of bot
You can't do anything on your own
If anything, simply show the whole learderboards regardless of the member being in the server or not
The excuse can be "they were once, and scored a rank"
Yeah, I could do this. Swallow the risk; however, I'm sure people would complain 😄
People will always complain
yeah you dont get GUILD_MEMBER_REMOVE w/o guild_members intent
but why not apply for it if your use case is there
Yep. But for a bot such as VirtualFisher, it reports guild-level leaderboards without the intent.
Is members a priv intent?
yes?
I'm guessing they do this by using their bot's guild cache. (like Ku has been mentioning)
I always remember there were 3, but I only remember the first 2
the big 3 are message content, members, and presence
using their guild cache in what way
you dont need a list of members in the server to do lists, if you have their user id you can just display their info
Guild-level leaderboard is definitely possible, you just won't be able to track which members are STILL in the server
which is what most level anything bots do
(people will get mad if they get reset for leaving the server anyways so double win)
Right, so this gets back to me original question. How would you do this?
Person A joins guild a -> does /play and generates a high score
Person B joins guild a -> does /play and generates a higher score
Person A leaves
Person B -> does /leaderboard
I don't want Person A to show up the guild leaderboard. VirtualFisher does this today without privileged intents.
if they dont have the privileged intent they dont know the user isnt in the server anymore
they likely just show them on the leaderboard anyways
your best solution is to not mind if someone has left and instead just have an admin command to remove people if they please
Unless the user had to authorize through oauth2
You know, if this is the case my bad for this conversation haha. Let me get a member to join my test server right quick
Tho that'd be clearly obvious
Anyone want to join my test server for a quick test? lol
and obnoxious to actually implement at scale [^ku]
100000%
I'm worried about the scalability of the solution that I choose, ofc.
I'd not worry much about scalability for an interaction-only bot, the weight is much lighter than a regular bot
Unless you reach millions of servers
i mean the oauth part
Yeah, I meant this too when I said 10000%
A webhook bot is simplistic, hosting the API on a server and allowing discord to send events is dead simple (thankfully)
No libraries needed.
There's not much you can do without either the intent or oauth
Right
As I said, interaction bots only see what gets interacted with
Right, def aware
User presses a button -> bot knows user pressed a button
Tbh that's part of the reason why I'd never be able to switch to interactions fully
Hello I need some help
o
which itll never be but add a check that redefines it after fetching the partial
That's a djs thing tho, not specifically ts
The difference is that js won't tell u something is wrong until shit happens
TypeScript is technically the same way in some cases
It is, but it saves you from debug hell sometimes since it is typed
case GatewayOpcodes.Dispatch: {
switch (data.t) {
case GatewayDispatchEvents.Ready: {
this.#session_id = data.d.session_id;
this.#readyAt = Date.now();
break;
}
}
if (PacketHandler[data.t]) {
PacketHandler[data.t](this.client, data.d);
} else {
break;
}
break;
}
This is largely how I handle events is this crude at all?
Yep, agreed. In my professional experience though, TypeScript doesn't really protect you as much as you'd hope. It's still a nice to have regardless though.
U don't need switch for a single branch
It wont be just that one
Right now ready is the only one I do anything with internally though
I haven't done stuff with the other ones
Btw u don't need brackets for cases
It makes it look cleaner to me
Unless u want to isolate variables
I like the brackets being there cause it lets me know where it ends
But yes, switch-case is probably the best way to handle such stuff
The alternative would be if-else, but it's horrible
Make sure you extract as much common code as possible from the branches tho
So right now I can freely spam the gateway
1 day ratelimit be like
Listen to ratelimit header
And make sure you don't retry any 4xx errors
Didn't touch gateway, so idk
hi
Interestingly enough, they leaderboard updated after the user left to not include them.
No privileged intents. 🤔 ... I wonder how they did it
Use the discord.on_member_update event
You can then use before.is_timed_out() and after.is_timed_out() - then the member has either been timed out, or un timed out
https://discordpy.readthedocs.io/en/stable/api.html#discord.on_member_update
https://discordpy.readthedocs.io/en/stable/api.html#discord.Member
Yeah, got that established now. Just working on the duration
timed_out_until on the member object
Yep
is None if no timeout is active
Returns an optional datetime, if timed out
Can it still be timedelta'd?
the timedelta is based in utc
oh wait
yeah you can just convert a datetime to a timedelta if you'd want the duration
ngl discords built in way is good too, unless you need precision
oh you'd need to subtract the timeout until with the current time for that
Can't use datetime.datetime.utcnow though
why not, what's the error
is it because there's some timezone-aware logic behind it?
Can't subtract offset-naive and offset-aware datetimes, yeah
per stackoverflow, remove the timezone awareness
at least that's what I think lol
I'm pretty certain I had to deal with it before lmao
Hold on, lemme ask UTC to remove its timezone, lol
lmaoo
or another answer from that same stackoverflow, datetime.now(timezone.utc)
but I don't think that's any different from utcnow
No, would probably throw the same error
We could probably ask Discord to include a duration option in their API since the feature is so new
or an event itself entirely
which would make sense seeing what it does, such as disconnecting a user from VC, disallowing rejoining it etc
Also, GitHub CoPilot wants me to use timed_out_reason. That doesn't exist, right? Lol
no lol doesn't exist
Figured
if you're entirely fucked, you might need to fetch the audit logs for the reason lmao
I was supposed to write a college essay two hours ago
lmaoo
I think I'm going to stop here, lol
hey guys, does anyone know what the & is in c++
like int function(int& test){}
Like why tf is there a &
and what is the difference between the above and this: int function(int test){}?
google?
I tried
I see
but i still don't understand the difference between them
Pointer refference iirc. If you edit &test you edit the original variable passed to the function whereas if you edit a you only edit the variable test within the function
must ask
what practical purpose do pointers have
you can essentially have a function that directly modifies the value without having to reassign it by the return value of that function right?
Wouldn't this literally just do the same?
I see! So imagine i have ```c++
int function(int& test){test = 5}
function(9);
```c++
int function(int test){test = 5}
function(9);
```Now the variable test will be set to 5 as well?
you'd probably need another variable, but essentially on the second one, the "test" is within the function scope and doesn't change the value of the integer passed
on the first one, 9 would become 5
am I right family friendly
^ yeah that’s right
Owhhh wow i understand it now
so tldr easier said:
& allows you to directly change the value of the variable you passed in
or better said, inherit
Normally it’s advised against mutating parameters passed to a function as that can lead to undefined behaviour
So with the ```js
int function(int& test){test = 5}
function(9);This would indeed be set to 5. However forjs
int function(int test){return 5;}
test = function(9);```
Like thihs right?
Because we cannot change the test within the function, we must change it outside as we call by value
these are essentially the same mechanics yes, the second one benefits code functionality
and in the first snippet we call by reference and can directly change the variable
readability*
owh my teacher says that the first methtod & is better to use
^ and you cannot access the test variable in the first example as you define it within the function parameters




