#development
1 messages Ā· Page 1995 of 1

Please keep chats appropriate and on topic
@sly sierra you specifically I'm not warning again.
This is your last one
your father left you
alright
brooo that is hella sussy
im not into that kind of stuff tho
i only like clean balls
Keep the channel on topic.
how do i console log the profile info from this
var bodyParser = require("body-parser");
var cookieParser = require("cookie-parser");
var cookieSession = require("cookie-session");
var passport = require("passport");
var twitchStrategy = require("passport-twitch-new").Strategy;
var app = express();
app.set("views", __dirname + "/views");
app.set("view engine", "ejs");
// Middlewares
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(cookieSession({secret:""}));
app.use(passport.initialize());
app.use(express.static(__dirname + "/public"));
passport.use(new twitchStrategy({
clientID: process.env.TWITCH_CLIENT_ID,
clientSecret: process.env.TWITCH_CLIENT.ID,
callbackURL: "https://meloidum.c-h-a-r.repl.co/auth/twitch/callback",
scope: "user_read"
},
function(accessToken, refreshToken, profile, done) {
}
));
passport.serializeUser((user, done) => done(null, user));
passport.deserializeUser((obj, done) => done(null, obj));
app.get("/", function (req, res) {
res.render("index");
});
app.get("/user", function (req, res) {
res.redirect("/")
});
app.get("/auth/twitch", passport.authenticate("twitch"));
app.get("/auth/twitch/callback", passport.authenticate("twitch", { failureRedirect: "/" }), function(req, res) {
// Successful authentication, redirect home.
res.redirect("/user");
});
app.listen(3000);
@azure lark you shared secret
console.log(profile) in function(accessToken, refreshToken, profile, done) {
} perhaps?
yeah that works but do you know how i could display that info in a json format on /users page?
????
?
no idea
Any faster way to do this?
I want to use a script tag instead of continuously repeating the <li> tag.
Make an array of languages and then add html to the body and construct the string together with what is repetitive and fill inbetween value(s)
I did the first step but got lost with the second.
Couldn't find a documentation, too.
[...languages].map(i => <li class="...">${i}</li>);
Like this, overall?
<script>
['HTML', 'CSS'].map(i => <li class="skills__list-item btn btn--plain">${i}</li>)
</script>
Well, that didn't work.
I think this is pure HTML and not some React JSX stuff
You could manipulate the dom
Pardon?
and doesn't give you brain damage
yes
Oh, okay!
what framework are you using
None, I use pure CSS.
then you should have to repeat the li stuff or try using dom apis
Oh, I don't mind.
also the li isn't even inside a ul
please don't tell me your script is INSIDE the ul
<script>
<ul class="promises__list">
["hi"].map(i => <li class="skills__list-item btn btn--plain">${i}</li>)
</ul>
</script>
Like this?
NO
Assign an ID to your ul and append your li elements to the ul
<script stuff />
<ul>
<li></li>
</ul>
it ain't a good idea to insert the elements using js because it wouldn't render for environments that have js disabled
such as search engine crawlers
Yeah, fair enough, I suppose.
["a", "b"].forEach(el => {
const element = document.createElement("p");
element.innerText = el;
document.body.appendChild(element);
});
the tag is li
what would be the best way to extract top200 songs from spotify
tried https://pypi.org/project/fycharts/ and https://www.npmjs.com/package/spotify-top-tracks but both return 503 errors
A fully-fledged installable python package for extracting top 200 and viral 50 charts off of spotifycharts.com
Get Spotify's top songs by country from https://SpotifyCharts.com. Latest version: 0.2.2, last published: 5 years ago. Start using spotify-top-tracks in your project by running npm i spotify-top-tracks. There are no other projects in the npm registry using spotify-top-tracks.
bro it took me a few seconds to get the data without a shitty library

lol just dont use a library
"headers": {
"accept": "application/json, text/plain, */*",
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"sec-gpc": "1"
},
"referrer": "https://spotifycharts.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "omit"
});```
you're welcome?
epic ty
you can also rewrite it for python if you want
i cba 
ah alr
i'm trying to write in js anyways
defffo not making a scraper and downloader 
yeah this is all you need
await fetch("https://charts-spotify-com-service.spotify.com/public/v0/charts", {
"headers": {
"accept": "application/json"
},
"method": "GET"
}).then(d => d.json());```
british
also i found a better api that pre fetches spotify daily https://capy-cdn.xyz/vfwFXp3W.png
i managed to get it to log song names 
nice
In React I have a functional component and a compontent in it. I got a state that only affects the component but if I change the state it rerenders the whole functional component. How can I change that?
that doesn't help... I don't rebuild a whole application just because it rerenders a single thing wrong.
What do you mean by
functional component and a compontent
Do you mean by a regular function and then a class for components
function Example() {
return (
<div>
<ExampleComponent />
</div>
)
}
I rewrite entire applications because I don't like their memory usage
I made a quick example about it. It should only rerender what's inside ExampleComponent and not f.e. the paragraph. (In this example on click)
function Example() {
const [state, setState] = useState(false)
return (
<div>
<p onClick={() => setState(!state)} onLoad={() => console.log("Rendered")} >
This text shouldn't get rerendered!
</p>
<ExampleComponent update={state} />
</div>
)
}
pretty sure there are some things you can do to stop react from rerendering stuff
that doesn't mean they have to
how do you know its getting rerendered
Here setState will be immediately ran, you need to wrap it in an anon function
I could make onLoad={console.log("Rendered")} and it would log it everytime the button is clicked.
() => useState()
well that's now just wrong in this example but your right!
The same goes for the console.log
:)
still that's not the solution to the problem
React.useMemo maybe?
don't think so
I already saw that possible solution but it doesn't really help
https://codesandbox.io/s/upbeat-volhard-xxmhe7?file=/src/App.js here's the problem in a CodeSandbox
That's exactly ur problem
code inside {} gets executed immediately
by wrapping it in a function you are passing a function which gets called every time the element is loaded
Also I don't think onLoad works in react anyways
idk I just tried it to demonstrate it
you mean the console.log("test")?
the thing is
I have a map function that renders data dynamically and my Child component (ExampleComponent) is in such one
maybe give a better example or better yet the actual code
Isn't the rerending expected
Given your useState is bound to where you created it.
that's the actual code (or a part of it) It's wrapped in some divs but that doesn't matter
And which component always gets re-rendered?
well wait
actually the whole thing gets rerendered and I only want ItemButton to rerender xD said it wrong
when does the whole thing get rerendered?
when the state updateItem gets changed (false/true)
it's never used anywhere else except in the Component (<ItemButton key={item.item_id} update={updateItem} handleCartAdd={handleCartAdd} handleStorage={handleStorage} item={item} wait={wait} />)
What's the meaning of that value? How does ItemButton use it
The component get's rerendered. (It get's switched twice like true -> false -> true and so it rerenders once)
I have schema in my code
I have a document in my mongodb
I updated schema in my code
How to update document in mongodb with saving datas
so you're using it just to re-render the ItemButton component?? That doesn't sound right
You could find all documents with the old structure and migrate them to the new one
But if your old schema is in production, I'd suggest you leave it as-is and build on top of it.
Well actually it has a diffrent case. I have a Modal (HeadlessUI) and if it rerenders the whole component the Modal get's closed but I just want to update the storage (and with it the currently displayed value) and for that I need to be able to onle rerender the ItemButton
What you mean as production
As in it's deployed. Your end users have interacted with it.
e.g. creating a user with a name
{"_id":{"$oid":"621a663e49c76713034034ad"},"id":"924474401704001546","language":"en","plugins":{"visible":true},"__v":{"$numberInt":"0"}}
I want to add it a new element when getting it
Can you just show the entire code for your component which renders the Modal + ItemButton
ItemButton: https://haste.lyrotopia.net/uqodobiluk.js
nono I mean the component which uses them
And the modal?
jesus, have you thought of creating smaller components for this? Also parsing cartContent a few times can't be good
But look I try to explain it here:
Items | Modal
If you change a value from an item, let's say you delete it from the cart it changes the items possible "orderable" storage.
And with this it should rerender Items. So it displays the current storage. But it rerenders almost the whole component so the Modal gets closed and you would have to open it everytime to make a single change
Yes I know I'm aware that the code isn't good looking at all and I will re-organize it. But not before this works because then I would know what's going wrong if I create Components and organize the states etc. it would get even more messy š š¬
I wanna say ads on topgg are actually working fine, even if the site has quite a few issues

does anyone know how to change the terminal icon using nodejs?
how do i fix this
yes
message.guild.roles.cache.get('931167957713817631').members.map(m => m.user.id)
how can i make it not use cache
fetch
h
Show your code...?
i got it working now
used existing code, just fetched all users instead
so all were in cache
cant change icon. Have to bundle the script together and change a shortcut's icon or bundle it all to an exe and have an exe icon
@civic scroll bro pls
or anyone
so i have a flexbox container right
.rate-target-container {
display: flex;
justify-content: center;
}
but for some reason after adding a flex-direction: column; to make elements flow down it invalidates the justify content center
making it not center anymore
Mmm css issues gotta love em
i hate css so much
we all do
not only because its difficult but because i am terrible at designing things and making them look good
same here
justify-content works in the direction of the container
if you flip the direction you have to flip justify-content with align-items
bro you are beautiful thank you
justify-content doesn't mean "center horizontally" it means center along the direction of the flexbox container
i just updated discord.js-light to version 4.6.0 from 3.5.11 and now im getting this error. path should always be there
whats the best way to determine when someone revisits a tab so i can refresh page data?
as in clicks to visit another tab and clicks back sort of thing
i think there is a focus event that you can listen to
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === 'visible') {
backgroundMusic.play();
} else {
backgroundMusic.pause();
}
});``` just found this
might try adjusting that
window.onfocus = function() {
console.log('Got focus');
}```
use addEventListener instead
yeah
just copied that. but using window should let you know when they alt + tab to a different applications and then back to the browser
Tim help me
step 1
say brazil is good
step 2
@quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle @quartz kindle
does discord.js require above version 14 for nodejs ?
@woeful pike do you happen to know a good way of using twitter emojis in your webpage instead of default os ones
i found a library but that only gives you a svg
I figured it out already without needing to to do that
twemoji?
yeah
Emoji for everyone. https://twemoji.twitter.com/. Contribute to twitter/twemoji development by creating an account on GitHub.
requires v16+ iirc
thanks for the link
oof
appreciate it
Would it be safe to set ārestTimeOffsetā to 200 for the main purpose of reacting faster to a msg lol
odd question but uh
what is the best way to download a spotify song with nodejs
yeah djs requires node 16.6+
listen to the "ratelimit" event and check for yourself
you might need to manually delay reactions if you use a too low offset
djs's ratelimit handler sucks for reactions tho
Console logging the event i see an object. Timeout, limit, ect. This is spat out from reacting. Can you explain what ātimeoutā and ālimitā specifically means in terms of the ratelimit?
limit = how many per X you can do
timeout = within how much X time you can do that many
reactions should be 1 per 250ms
messages 5 per 5s
Ok so having my offset 85 i have
Timeout: 335
Limit: 1
reactions are weird because everything else is X per N, for example 5 messages per 5 seconds
reactions instead are always per 1
instead of 4 reactions per second, for some reason they do 1 reaction per 0.25 seconds
š
which screws up a lot of rate limit handlers
so you just need to scale it down
djs's ratelimit handler emits a ratelimit event everytime you go beyond the limit
for example if you send 6 messages in under 5 seconds, it will send the warning on thr 6th message
but since the limit for reactions is 1
if you send 2 reactions to a message, it will trigger the warning
almost every time
lol
nice
imagine using reactions
The reset-after headers are in milliseconds eh?
Checking my client rate limiting implementation to see if I need to fix stuff
uh i am trying to use a embed for my description but its not showing in preview
Hmm nope, it's in seconds and I'm using parseInt for that header.
Do they send decimals?
I'm glad I saw this message now hah.
X-RateLimit-Reset-After - Total time (in seconds) of when the current rate limit bucket will reset. Can have decimals to match previous millisecond ratelimit precision
Hi peeps
why hello there
general kenobi
is there a way to use role id instead of pinging it? for ex: ?role-add <role id> <member id>
yeah. Parse the string and try to verify if it's a valid Snowflake as much as you can then fetch if it's correct as far as you're concerned. What you can check is if all chars match \d+ (DO NOT LIMIT HOW MANY CHARS IT CAN BE SINCE IT WILL OVERFLOW EVENTUALLY)
You can also deconstruct the snowflake and check if the Date is less than the current Date.
Then try to fetch it
Just split by space and grab first index
I outsmarted your outsmarting
which counts towards your global limit
which hurts you
therefore you haven't outsmarted me
I'm still superior 
oh my goood
Caching the roles could work
I outsmarted both of u here is the solution: stop coding kthxbai
based
and that's why you major in business instead of cs
would prefer a business major over cs probably tbh
I need to think of a c++ project to try out
I never know how to dive more into depth in a language
anyone have any ideas
Definitely not audio processing
sounds like u need smth like that Ophidian :^)
The world needs more discord bots or how about an entire library? 
An HTTP server.
Why use c++? Why not make a discord lib in C ;)
I hear Rust is the new hotness.
Oh yes it is š¦ š¦
rust is rusty
Ping
Dong
No, you say "pong".
Yeahh you say pong then then reply with the ms
You Sir, stop trying to change me!
Trying to eliminate the need for command line ffmpeg in my lavalink rewrite while still offering support for ffmpeg filters. Using an addon called beamcoder and it's pain
how do i listen to the message event with the new discordjs lib?
client.on('message') doesn't seem to work. The only thing i am going to do is tell them to use slash commands if they do a !help command
messageCreate
Error: HTTP Exception: 400 (You can only bulk delete messages that are under 14 days old.)
Any other way around for this?
Check the timestamp and compare with current date or just catch the error and handle it
But if youāre asking how to bulkDelete messages older than 14 days, you canāt. Itās an API limitation set by discord
Was that limitation always there?
Yes
and it will fail, if atleast one message is older than 14 days.
Discord wont try to delete some messages, right?
I donāt know how djs handles it internally
you can still delete messages older than 14 days individually š, if they are ready to make their bot do it
Sounds like an API abuse issue at that point though
Thereās a reason thereās a limit
Deleting one or two messages? Fine, delete a ton individually? Not a good idea
can I fetch last 14 days old messages ?
True
I mean with a ratelimit (say 1 delete every 1.5 - 2 seconds) it's not actually abuse. But yeah your point makes sense
How can I disable the sending embed if the bot doesn't have the permission?
Wait for the successful mute and then send the embed
No, you can't reliably guess if it'll succeed or not, because a request can fail for reasons out of your control
message.channel.send({embeds: [embed]})
await message.guild.members.kick(members).catch(() => {
message.reply("Missing Permission")
})``` is this the right format? or the `.kick` first?
I recommended to do kick first
ah wrong code line
Just check if the client has kickMembers permission in the guild. If it does kick and then send embed. If it doesnt then send missing permission error.
The catch() block can give any type of error and not just missing permissions. maybe the user had a higher role heirarchy wtc
targetMember.roles.add(role).catch(() => {
message.reply("Missing Permission")
})
message.channel.send({embeds: [muteEmbed]});``` this is the format im using, but still sending the embed
I don't know much JavaScript sorry
I don't know what's that do
if(!message.guild.me.permissions.has("MANAGE_ROLES")) return message.channel.send("My role does not have the manage channels permission");``` i have but not sending
are you kicking the user? or muting them? or adding a role?
Im confused...
got wrong descriptions lmao but im muting the person
and yes adding the Mute Role
Honestly why check permissions at all just check if the user has a higher role then them
:p
the prob is when the bot doesn't hve the perms it still sending the embed
Ah
Dang
when the bot runs into the error, it is caught and the bot handles it inside the catch() and then continues to execute the next line. Try using the try catch block instead of .catch() and return when the bot hits a error
I don't think there should even be a need for a try/catch here tho
well yeah, checks can be added to prevent all errors before trying to add the role
didn't work
Are you sure the bot doesn't have the permission?
yep
Does your bot have administrator?
nope
Mmm
It seems like the if statement is running through cause it evaluates as true
Do you think it could be because they are using strings over flags?
iirc they don't recommend using strings anymore as it can cause some issues (unless I heard wrong)
I dont think so. .has() should support it. But lemme confirm, its been ages since i touched djs
Well yes it still supports it
ohh
but it is highly discouraged to use it
I would think there is a performance or technical reason to it (one I dont know)
Yep it supports strings
Well yes it does support strings but they discourage from using them
either way it is a good idea to swap to using flags anyway if the devs don recommend strings
Even if it doesn't fix the issue
Please š donāt š use š the š strings š
The API returns strings, but it has to be converted into a BigInt otherwise bitwise logic would not work
I just can't find a solution... It's so complicated
It adds quite a bit of complexity, as you have to convert the string into the bigint equivalent, then perform the bitwise logic.
Just using flags / bigints without the extra conversion is much more straightforward.
const seconds = Math.round(process.uptime());
const days = seconds >= 86400 ? Math.floor(seconds / 86400) : 0;
const hours =
seconds >= 3600 ? Math.floor((seconds - days * 86400) / 3600) : 0;
const minutes =
seconds >= 60
? Math.floor((seconds - days * 86400 - hours * 3600) / 60)
: 0;
const secondsRemain = seconds - days * 86400 - hours * 3600 - minutes * 60;``` if i put this on mongodb, how can i make it updated every seconds?
you definitely don't want to do this
wait why
save a date to the database and derive the remaining time by comparing that time with the current time instead of updating a database every second
once i did that, but it keeps sending the gmt format something like that
with country on it
you can fix formatting, this isn't the correct approach for it though
date-fns lets you format dates the way you need
package?
yeah, you can also use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
ah thanks for recommendations
my only issue is the scrollbar behaves really weirdly for some reason
but that could be a browser problem
Finally
d a r k t h e m e
it should be illegal for a site not to have a dark theme
smj
now that i think about it
d.js should just use core.js
it will make it backwards compatible with older node versions and keep their "fucking annoying and cringe desire to use the latest sharp edge syntax" on every update
or just use typescript or babel which allow u to use the latest features
and transpile the code to es5
yes
that too
no need to bundle polyfills which only increase size
not like djs is shit already
adding more shit to the pile wont hurt
I think the next big version is rewritten in typescript?
i'll probably end up maintaining a custom version of d.js which is transpiled to an older node or uses core
or did they scrap that
if they dont use ts or something like that
it isnt too much work to maintain
just merge every once a while
hey guys
where do you usually host your bots?
on a cloud service or you buy a server box?
vps
vps?
by translating
private: replit, other free hosting
thx weeb
Anyone help me
For what
If u can pls dm me
You can write here
I can't add vote only cmds i read https://docs.top.gg/libraries/javascript/#webhooks but i can't understand can u help me to add vote only commands
You can do it simply by reading the docs here https://topgg.js.org/ and https://www.npmjs.com/package/@top-gg/sdk
Documentation for @top-gg/sdk
Official Top.gg Node SDK. Latest version: 3.1.3, last published: 3 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 7 other projects in the npm registry using @top-gg/sdk.
I also read it but can't understand
Read it again if you want us to give you a code block we can't do that
Did you already try the code example, adding your webhook token to it etc.?
Yes I tried
But no success
Pls help me
Well then, show your code - without your webhook token
or not
i need help
I swear this phrase triggers me.
I want some opinions on this rpg bot im making. I am trying to make it as fun as possible so I wanna add some competitiveness to it. My thought process was to try and model it similar to how those mobile games are like Rise of Kingdoms or Raid Shadow Legends, where a person has "power" essentially how strong they are. The goal is to become the most powerful. I am wondering if I should continue down that train of thought of trying to model it after those mobile games or come up with a different approach to a competitive model.
can't exactly take it in the same direction as mobile games because of graphical limitations
where is the raid shadow legends sponsorship segment
stop using glitch for discord bots man
Just log your "intermediate value" and you will see it's not what it's supposed to be
arent you pinging your glitch project to "host" your bot
so its against the tos and you can get terminated for that
lmao
exactly
Glitch isnt a hosting
yes
get a vps if you have money
and learn basic js then discord.js

THANK YOU SO MUCH FOR THIS LINK
Lol
How do you make HTTP requests to a GraphQL API? It seems to be different from making regular HTTP requests. Where normally I can specify the path like this:
function someFunction() {
console.log("Doing the thing");
axios.post("https://some_website.com", {
id: 15125
}).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
})
}
GraphQL seems to do this differently. Don't question the website, but I'm trying to use this:
https://anilist.gitbook.io/anilist-apiv2-docs/overview/graphql/getting-started
Example query request section.
with graphql you send your desired fields basically
it's very confusing tbh
even worse for who's managing the api
Ah I see. Yeah GraphQL is weird. First time using it š
Hit their single GraphQL endpoint (I think https://graphql.anilist.co/) and supply the query and variables in the request body
Iāll look into Apollo-client. Iām currently using axios so ĀÆ_(ć)_/ĀÆ
Yea Iām a bit confused how I supply the query/variables.
You don't need Apollo for this. I'd argue it'll make the process much more complex
You give it a json string
Ah I see.
With query and variables
Set the query and variables as JSON variables and pass it as a parameter?
Yeah that worked. Thanks!
graphql is so overengineered
y'all remember this
I'd prefer GraphQL over what we currently have with REST APIs any day of the week
It's nothing like REST at all
A single endpoint where querying and mutating is separate
Where joining different resources is simple
Where the single structure of operation(options): resource is standardized and all clients feel the same
Where there is an actual standard to APIs as opposed to some generic convention (REST) that's often not followed or built on top of other standards (e.g. swagger)
Trying to dumb GraphQL down to "just being over engineered" is disingenuous imo
Many REST APIs replicate what GraphQL has already done and provide lessāselect fields, joining resources, query language, etc.
pov you think graphql is the future
I think it's ideas are
I've applied them to a REST API I'm building and it's been so much better than what most REST APIs give us
Just like how React was revolutionary and people move to Svelte but carry on the paradigm and ideas it showed them
@quartz kindle looks like that beamcoder doesn't support piping streams for filters. I have to stick with command line ffmpeg
their filterer doesnt work?
Kind of an odd situation im in and idk if anyone would have any knowledge on what is happening.
I was creating music functions using the library āDistubeā and kinda got myself ratelimited. Oh well. So i put my bot on my linux machine (same wifi but using a ipv6 tunnel) and for the most part, itll join, queue the song, immediately leave, and thats it. I can queue specific songs no issue but most fail. After thinking it was a distube related issue I figured out that when I disabled my ipv6 it works 100% no issue. I wonder why that could be. Distube uses ffmpeg, ytd-lp and other related things. Any ideas?
Absolutely no idea
ytdl can only download a video at the speed youtube allows, which is just enough to buffer the video
could be something related to that
ipv6 isn't supported by everything quite yet
Well strangely enough, using my friends server setup identically as mine in terms of ipv6 tunnel and packages, it works flawlessly for him on ipv6 tunnel.
While mine i must disable my tunnel for it to work
ipv6 is so messy
its supposed to be our future replacement and lifeline for ipv4 running out of ips
it already is, there are no other options
yet not that many services support it let alone broadband providers
to be fair, ipv4 isnt close to running out yet
so it makes sense that support is bare
yeah but not too far either
that's true, and I expect more and more services will start to use it
anyone know HTML here 
probably the most
if we didnt reuse ipv4 ips we'd already be at that stage š
oh yea and double too
maybe
I mean, there's a chance y2k38 will come before ipv4 overflow
<body>
<img src="https://imgur.com/gallery/drjvJbY" alt="image">
<h1 class="test">IdleMiner Bot</h1>
</body>```
do you know why the image isnt showing, just showing the alt text
do imgur links not work
wrong url
oh
that's imgur url, not the image's
the correct url will always be prefixed by i. and have the extension at the end
i also dont get how html lets you get away with not closing some tags
quite inconsistent
something has already been suggested to fix this though
there'll always be some who leave it for later tho
wait so I cant use imgur for it
sometimes even big enterprises
you can, right click -> copy image address
oh ty that worked š
Because it's not HTML (strict) and the need to close these sort of tags wasn't even needed anymore since HTML 2, I think
try xml 
His entire code block isn't valid HTML anyways, doesn't contain html tags nor the doctype
although the usecases arent the same so the issue doesnt really apply, it is a worlds' difference. Just tag something with the closing character immediately if it only is one element
But modern browsers are capable of handling this
I'd like that consistency in html, but this wont ever be added to respect legacy
I'd like the closing character to just not exist for elements without children, where we'll be left with this:
<br>
A small change. :)
breh
discord rlly know what they doing with cloudflare
they banned my application after 1.5 year of development-_-
constatly runnin on the uptimerobots cloud
I actully didn't host it on replit, it's on uptimerobots
Uptimerobot I assume is just pinging your host.
But you have the code hosted on repl.it
Else where do you have it hosted
its very obviously repl.it
tou can tell by that ss
and also, 1.5 years of development and you're still using replt it? Interesting way of doing things
technically, it's hosted by replit, but the computing power is by uptimerobots, I assume
thats not how that works
I was just working on the AI
It doesn't matter what services you munge together in your bot's process. You're still using repl.it, which is the problem.
any alt?
Replit is the host
Heroku?
consider spenting like $4 a month for a vps
breh i'm broke af.
although it'll be shit for AI
Get a £2 even
but it'll still be better than Repl
it's not smt big
just bunch of if statement
just host on oracles free cloud servers
just tryna brague by AI
yikes
oracle
ima have to stop you right there
works fine
lots of things to hate on but at least they provide their services for free with a pretty neat environment/specs
If you want free hosting just search for them (e.g. Heroku). Just know what you're getting yourself into.
can I host it on a old machine.
Like a 2009 macbook?
like 2004 Windows XP
maybe
on my grandad's place.
if it can run modern websockets from common language sdk's
but, I don't get it, why have I got banned from discord?
and if you can actually get the software running
Youāre not banned
make a ticket to t&s to figure that out
Itās just ratelimited
so someone else on your IP got fucked
No point
which intern fucked you
I have no idea what the error is
Itās not banned, just ip limited for like 60 mins
but they said temporarily banned
They got rate limited for a day
oh lol yea thats a ratelimit
Yeah
lmao
guess I'll leave that project dyin on my local pc.
literally wait a day and you'll be fine
ight
I'll switch the host when I get past 100 servers
to get enough moni for the vps
contabo is jokingly cheap, you can pay it from a 13 year olds' pocket cash
and its really high quality for the price
Try asking your parent/guardian
rip
I don't think I mentioned you had either, it was in manner of speaking
Host your bot on heruko until it grows enough for you to care to host is on an actual VPS
heruko?
i'll check that
I feel it's not enough worth it
let's wait till the bot grows
doesnt heruko use the same ip across multiple envs
that wont work out well if a tcpclient is ran on just one
guess i'll just hosted on an old pc
till then
have fun attempting that lol
what language are you writing it in anyway
python.
lovely, have fun porting
does anyone got unverifed bot for no clear reason without notice about that?
Please clarify.
bot just got unverifed
probably best to make a support ticket to discord
Bot was verified, but before 30 min, bot just got unverified again for no clear reason, and without any notification.
This not make any sense
good chance its a caching issue, but you can make a ticket either way if not
I have a function that returns an embed:
function returnEmbed() {
const embed = ...;
return embed;
}
And a function that adds the embed to an array and sends it:
let embeds = [];
function doSomething() {
for (let i = 0; i < someNum; i++) {
embeds.push(returnEmbed());
}
message.channel.send({ embeds: embeds });
}
However, I get the error embeds[0].description is a required a field. How would I fix this?
if you dont have any values set inside the embed before sending it, it will throw an error because its empty, makes perfect sense to me
populate either a field, or the description, or the title of an embed for it to be created successfully
I do have data in the embed.
you definitely don't if you're getting that error :p
const embed = new Discord.MessageEmbed()
.setTitle(info.title.romaji)
.setDescription("Info on " + info.title.romaji + ".")
.addField('Format', "`" + info.format + "`", true)
.addField('Titles', "English:\n`" + info.title.english + "`\nNative:\n`" + info.title.native + "`", true)
.addField('Status', `\`${info.status}\``, true)
.addField('Episodes', `\`${info.episodes}\``, true)
.addField('Average Duration', `\`${info.duration}\` minutes`, true)
.addField('Average Score', "`" + info.averageScore + "/100`", true)
.addField('Popularity', "`" + info.popularity + "`", true)
.addField('Source Material', "`" + info.source + "`", true)
.addField('Adult', "`" + info.isAdult + "`", true)
.setFooter("Requested by " + message.author.tag)
.setTimestamp()
.setColor(message.member.displayHexColor);
took the words right out of my mouth
I logged all the data and none of it is null
can you show your actual function code
What's strange is that I can send the embed individually
But I can't send it all at once via an array.
When my bot should reply to a message but has no "send_messages" permissions in the channel, it ignores it because I always check whether
message.channel.permissions_for(message.guild.me).send_messages
.However, I see errors in my logs where it doesn't ignore it and tries to reply. Error is 403 Forbidden (error code: 50013): Missing Permissions.
How is that possible? I could not reproduce locally
you are not returning anything
the function is returning undefined
why do they publish dev versions to npm @_@
does the message contain embeds, images, files, links?
hmm good idea I suspected it could be related
I'll have to add to my logs to know, thanks :]
If you send embeds for example then also check if you have the permission to send them
yeah looks like it could be a link sometimes. but i don't really wanna check whether I'm gonna reply with a link OR file OR whatever..
maybe i should just ask for admin perms for my bot? do most ppl do that?
lol
Why donāt you know which content youāre sending?
You should better require message send, embeds, message links permissions then
Instead of administrator perms
the bot learns what to answer, it's user dependent and it may change from time to time
it has those but probably some channels have it disabled for some reason. any good way to "stop listening" to such channels at all? waste of events
Errr no the event is always the same
You gotta check the permissions for your bot when the event is triggered if it hasnāt enough permissions then return the event
Like you did here
But if you also send embeds, links etc. expand this permission check
And check if your bot has the permissions to send embeds and links or donāt reply


Ok man ty
lmao
client.rest.on instead of client.on
@quartz kindle @split hazel
The leak also includes the algorithms for all of Samsung's biometric login features, bootloader source code from all recent devices, confidential source code from partner Qualcomm, source code from Samsung's activation servers, and full source code for Samsung account authorization and authentication, including APIs and services. In the medium and long term, this information should certainly provide an attack surface for Galaxy devices.

link?
i would love to see the bootloader leak
to see how they generate their bootloader lock codes
im assuming samsung also locks them
lel
If thatās a real source I gotta laugh my ass off
Samsung confirms hackers stole Galaxy source code https://t.co/Jhl1kEM2kM https://t.co/mwkUlHsP2K
1921
307
Seems to be as devastating as checkm8 for iOS
checkm8 wasn't a source code leak though
giv source plz tank yu
Well I didnāt say that
The results can be devastating
this is WAY more devastating than checkm8
gg chinese galaxy clones incoming
But still you will have more access you should have which will result in scammers fucking off more people
I mean I would never put anything important on a jailbroken iOS device, too
ayo whos breaking out of jail
lizard
I wish I didn't see this lll
lol
should I be concerned now as a samsung user
Imagine updates being pushed to Galaxy devices by attackers being able to authorize themselves as authority with malicious code
Surely samsung is gonna do a security patch of some sorts.... right?
Yes turn off your WiFi and mobile internet forever. Now!
tf
yeah just tell them to give you more than 2 years of software updates
jailbreakers be like: why yes I do want to run closed source literal exploit code on my device
well before there were good reasons to jailbreak
today for the average person not so much
it's way more of a pain now cuz if you restart it goes away
doesnt the device need to request for that info first?
and you have to resign the app that re-enables it every 7 days if u don't have a dev account
i dont see how attackers could push updates to it
Dunno I would bet pushing updates to devices is also a thing
But yeah doesnāt make much sense
As you donāt know how to contact them
they could spoof and intercept samsung servers with a mitm attack
who restarts their phone
ic. ty
possibly with dns poisoning as well
we never restart our phones but we're reluctant to not restart our laptops
i am lmao
I sometimes shut down my phone entirely to save battery lol
that's probably killing your battery
how
I mean since Snowden we know big manufacturers are perfectly hiding their metrics communication and packages being send home
just going through the process alone
If I have an array:
let genres = ["action", "adventure", "comedy", "drama", "fantasy", "horror", "music", "mystery", "psychological", "romance", "sci-fi", "slice of life", "sports", "supernatural", "thriller"];
How would I get the item most similar to a String?
bruh
you'd probably want a frequency table thought you meant most frequent
use a big long algorithm
yeah but most likely they are all device-initiated requests. will be good to have insight into how much telemetry there actually is in the galaxy os
aight then. yea nvm mb that was a stupid qusetion haha.
you can use levenshtein
there are many libs on npm for it
what i was gonna say <3
you could also use this https://www.npmjs.com/package/string-similarity
Finds degree of similarity between strings, based on Dice's Coefficient, which is mostly better than Levenshtein distance.. Latest version: 4.0.4, last published: a year ago. Start using string-similarity in your project by running npm i string-similarity. There are 499 other projects in the npm registry using string-similarity.
levenshtein is the homie
Yeah true but malicious code in apps or on websites could fuck off any user ig
this one is the easiest option lol
Even more now
I mean you can attack each Galaxy in public networks now acting as man in the middle Samsung security server
Ffs
Driving around in your car fucking off Samsung users with a public WiFi hotspot
As most people donāt disable WiFi anyways
its crazy to me people leave autoconnect on
Also does this even do anything lol
Just toggle this off ez
mogus
Like 99% of the people I know having smartphones donāt disable WiFi, Bluetooth, tracking or anything (when leaving their home)
I got bluetooth enabled cuz of the corona warn app lol
my wifi turns off automatically if I'm not somewhere Ive logged into wifi before š
bluetooth is always on, but mostly because of my watch
My wifi turns on in places I use wifi frequently and turns off everywhere else
yeah
so basically everytime im at home
that setting
lol
it saves me so much battery life when on the road
yo thanks for this, looks like dice is indeed better than levenshtein
lmao
leftmost col = searched word
colored cols = closest result according to algorithm in the header
ok
and the error is obviously how accurate it was
well how accurately it can display the result i think
lmao imagine using that shit
the red rows are the errors
came to find the most similar string, walked out with a history lesson on string algorithms
matches that the algo got wrong
ikr xd
My parents wanted me to install it
lol
Idk if I need it anymore honestly
its pretty useless
I got another app with my covid-19 recovery certificate on it
So I don't need it at all lol
seems to be slower than levenshtein tho
fastest-levenshtein is about 4x faster than fast-dice-coefficient
if speed maters use levenshtein then idk
I feel like Tim is benchmarking the entire world
im editing the fast-dice-coefficient benchmark to include fastest-levenshtein
lmao
the author posted this
but im running their exact same benchmark file
and i get completely different results
lmao
It looks like English but I aināt understand anything 
provided their benchmark is 3 years old
and node.js made huge performance improvements since

am working on it tho
I sent you some moneysā¦
Youāre mine now!!
im kinda having to work simulatenously on my bot and api, since my bot depends on it
yesh
i made slash command autocomplete with the api source files, so i dont need to query the api for this
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat
what is this french your doing?
french?lmao
yisun, kesun, sundre?
those are names of asteroids
ahhh neat š
doing text search on 500k asteroids is expensive =X
searching for what kinda text?
find asteroid by name
not viable to like, 'pre-parse' it and store the data in some name=> data object?
i mean, i guess your doing that if your using the data for slash commands š
One message removed from a suspended account.
yeah but you still need to loop over all names to find a match
yea, but only once, then you can object[name]
once per search
im caching search results tho, so if someone searches for "abc", i'll cache that result for the next time "abc" is typed
yea, good time to spend some cache š
im also using one of my libs for storing the data, so i get faster matching than arrays
I have a custom cache module I've privately maintained for like 5 years. š
oh, which lib?
ftset
there is no github for this? i can only find npm package š
~ trying to plagarize your for loops here š
nvm i found it š
One message removed from a suspended account.
@sage bobcat
ooohh interesting
hello
i have 3 role as He/Him She/Her They/Them
i want if someone get one of them remove the other two
what should i do for that ? (i dont want to write 3 if statement for each one)
djs
by name or by id?
Well yea I wanna take it as far as I can
That is tthe goal of this project
take it to the farthest it can go
Role button or command?
+19 options 
yes
this one is the biggest autocomplete one tho, the others are not even close
the autocomplete for database matches is like 40k, this one is a bit over 600k, split over 7 files for different categories
plus it needs to work like an array since the user can select multiple items from it
Ay ay sounds expensive
Well I mean in reference to my database itās still not much but proves anyways an optimized database is one of the most important things
lmao another great news of today
Leading US internet providers incl. backbone are cutting of RU costumers
That means new IPv4 will be available soon 
lel rip
In reference to this RU is preparing to cut their internet off from the entire world
I laugh my ass off
idk if sqlite with FTS5 would be faster than this, possibly with a large enough index
Well makes me smile as my index is round about 466GB iirc
xDD
id
I was close
guildMemberUpdate event
you want to add the role with code and remove the others with code? or you want to add the role with discord and detect and remove the others with code?
Still not sure what approach I wanna take with this rpg bot š
i want in guildMemberUpdate
if someone get role 1
bot remove role 2 and 3
and also if get role 2 remove 1 and 3
and for 3 remove role 1 and 2
Maybe you should create a list of your selected id
ok so what should i do next
i can write it in a hard way
im looking for easier way
When member get a role in that list remove the other role that isn't the role that was added
I can't give you an example idk JavaScript
well exact this is my question
how to remove others except that one
Loop thru the roles the user has and if the role.name = the role they recieved ignore, the rest remove em
That's it
Good luck making your bot tho
const roles = [id1, id2, id3] // he/him, she/her, they/them
let added;
for(const role of roles) {
if(!oldMember.roles.cache.has(role) && newMember.roles.cache.has(role)) {
added = role;
break;
}
}
const other = roles.filter(x => x !== added);
for(const role of other) {
if(newMember.roles.cache.has(role)) {
await newMember.roles.remove(role);
}
}
something like that
If I have a function that takes time to return like this:
function myFunc() {
let someValue = "yes";
// HTTP requests to https://myapi.net
axios.post("https://myapi.net", {
id: 15125
}).then((res) => {
console.log("It worked!");
// Return res.data.
return res.data;
}).catch((err) => {
// Log the errors.
console.error(err);
return false;
});
return someValue;
}
The code works fine and, "It worked!" Is logged. However, the function always returns yes and never res.data. How do I make the function return res.data?
Aight. tyy
you can do this instead, looks nicer:
async function myFunc() {
try {
const res = await axios.post("https://myapi.net", { id: 15125 });
return res.data
} catch(e) {
console.log(e);
return false;
}
}
or even this
function myFunc() {
return axios.post("https://myapi.net", { id: 15125 }).then(res => res.data).catch(e => !!console.log(e));
}
Would it be possible to edit a replied message? I can edit a sent message, but not a replied one.
Ah I forgot that I needed to include fetchReply haha. Thanks!
Well yeah you should have been more specific then
Thatās only required for replies on interactions
little problem
Hey guys
I don't know a easier way of doing this so its less code but
Anyone know a way where I could compress this down a few lines?
Basically I have an array of 3 elements and each element being another array with 3 numbers inside as a tictactoe board layout
When a player makes a move I am doing a check for which location it is (1-9) and then it correlates it to the correct board slot in the array form. Then it checks to make sure that if the board already has a X or O (1 or 2) in it then it doesn't replace it there
i took a totally different approach with my tic-tac-toe game š
I just store the id's that each player chooses, and then i can easily check if a 'square' is already taken etc
Well, you have this.board[Math.floor(location / 3)][(location - 1) % 3]; to get the current position in the board.
My bad for not specifying earlier. Unfortunately editing the reply doesn't work and I get the error, Unknown Message.
await interaction.reply({ embeds: [loadingEmbed], ephemeral: true, fetchReply: true }).then(async (msg) => {
console.log(msg); // Logs correctly.
functions.searchGenre(msg, genreName, 1); // msg.edit doesn't work
}).catch((err) => {
console.error(err);
});
Ah yeah thats a lot simpler way of doing it
I have the winning lines part to do a final determination just like yours but its in a different part of the code
Thanks Klay for the info
if the removed role wasnt one of roles in roles array then it will remove all of the roles from member...
msg might is probably anAPI message object not a djs message object
Oh I see. So I'd have to fetch the message by it's ID then?
Well position 6 would be floored as 2 and thats the 3rd line
Err no I mean it got fetched already
Or you wouldnāt be able to log it
Oh oops. How would I get the correct object then?
Itās probably your function expecting your parameter msg to be something different
yea im just trying to edit the message replied
Just try msg.edit(ā¦) please to make sure Im not wrong
Instead of using your function
Yeah I did that it returns unknown message
Wut
await interaction.reply({ embeds: [loadingEmbed], ephemeral: true, fetchReply: true }).then(async (msg) => {
//console.log(msg);
msg.edit("test");
}).catch((err) => {
console.error(err);
});
Whoops that showed my name lol
aight
You could minus location by one, like Math.floor((location - 1) / 3).
o that worked lol. thx for your help š
mb i shouldve tried that first
Unless its 0 right?
So it'd be
Will it be 0?
Hmm weird
Given your code ranges from 1 to 9
So ephemeral messages canāt be edited?!
yea idk haha
I think it works as intended.
Hmm Iām unable to search the docs atm, letās see if @earnest phoenix replies. He usually knows that stuff
Aight nw. Ty for your help!
What does those $9 and $5 mean?
So you can access the results as a variable.
https://sourceb.in/eGj8xOxTeO captcha canvas error
Error: Client network socket disconnected before secure TLS connection was established
Error: socket hang up

alguien que hable espaƱol??
idk whats causing that weird error, but all your console.logs are wrong
.catch(err => console.log(err)) or .catch(console.log)
not .catch(err => console.log), this doesnt log anything
i got the main error now js Cannot read properties of undefined (reading 'awaitMessages')
no
that means you are trying to do something.awaitMessages but something is undefined
š
is it going to appear if the bot cant send a dm to user?
you will have the answer when you fix all your catches
ahk

