#development
1 messages ยท Page 2015 of 1
When u load ALL members into the cache you're effectively destroying your whole process by flooding it with data that'll only be used once
If you're up to sacrificing accuracy you can iterate over all guilds and get the memberCount value
But that's also slow depending on how many guilds you have
The fastest way would be to get rowcount if you use some kind of relational database
does getting overall members count from all guild is faster or
That only if you use some kind of leveling or economy
Faster than retrieving all members yes, but less accurate
At the end of the day, is it really important to show member count?
well gonna use that option for now probably
Like, nobody cares about member count, it's just a big value thay you cound make up and nobody would know
I'm just testing on bot activity part.
"testing" yes, I saw that story a few months ago
But anyway, you do you
Just remember it's a somewhat costly operation
I see, sorry if I'm bothering you, I'm kinda new on bot developing.
client.guilds.cache.reduce((a,b) => a + b.memberCount, 0)
its fine to use that, thats what i use too
its not 100% accurate, but it its 99% accurate most of the time
Anyone here work with NextJS at all, and would know how to workaround this issue?
Not really bothering, it's good to be curious
Sorry if it sounded too harsh
this only show overall members from all guild bot are in right ?
if the members were sent to the client
ah nvm. memberCount is static guild prop
I wish they'd rename the property to approximate_member_count like they do with invites
also how do I make bot grab guild id, is it using fetch() ?
like any ?
If it's the guild a command is ran in, it would be simply something like message.guild.id, anything else you can fetch.
I mean like, the bot is in A server and try to get the guild id without providing the id.
it all depends on the context

what is your starting point?
if its a message the bot received, then its message.guild.id
if its an interaction, then its interaction.guild.id
if is a voicestateUpdate then etc...
Js has random() for collections?
They have it too easy tsk tsk
Collection<K, V> is an arbitrary class extending Map<K, V>. It's up to the implementer to add helper functions like random. Map's prototype is relatively small
Js has generics (the types I mean)?
Yes and no
its a typescript concept, but it's a paradigm that applies to anything logic based
Map.get(key: K) where K is usually a string
it's arbitrary, but the concept is there
A Map can also have mixed keys which makes things complicated, but JS isn't type safe
thanks fam it work
@lyric mountain i updated all my hrefs and it works thank you
do I need to specific ms time if I'm going to make giveaway command
dont think so
https://sourceb.in/muw7HuTLED js message.editReply is not a function
hi how to change a github pages website?
created a giveaway message, but the winner is undefined when giveaway ended, how do I make the winner is random people that react to the message ?
Are you sure the message you're referring to has an embed
Try printing message.embeds, maybe even the message ID and verify that the message you're getting is the one you want
why are you using eval in middlewares?
uh what does your _middleware file look like
this is how it was https://i.callumdev.xyz/zftp6.png
This is it now, but the main issue is I can no longer access session data, like verified, banned etc, the stuff we have stored on the user session https://i.callumdev.xyz/oz4sl.png
Why does cd folder not work in github workflows ๐ค
nvm figured it out
:/ that's so uncool next.js
Tried this?
I'm rather curious how you don't know what intents are
Google will help you better than my currently comfyblob self
Ah yes, my client object is client.event
No. Events happen BECAUSE OF intents
does each server has it's own db ?
I wanted to make a list giveaway command that list currently running giveaway on a server you in.
dang. apparently 4 russians have downloaded my rpc app. that it a missed opportunity for a node-ipc install ๐
how do i get the presence of a guild member?
I was trying to use https://webhook-topgg.com to make a vote embed, but this error keeps occurring and I'm not sure why
I've tried cdn.discordapp.com and media.discordapp.net and both didn't work
I studied the documentation on discord.js embeds, but all fits
Can I get some help?
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
Is it possible to interact with a .html file using NodeJS? Ex:
myDocument.js:
const htmlFile = require("index.html");
module.exports.myFunc = myFunc;
function myFunc() {
// do smth
return "hi!";
}
index.html:
<!DOCTYPE HTML>
<html>
<body>
<script>
const myDocument = require("myDocument.js");
let smth = myDocument.myFunc();
</script>
</body>
</html>
No, you can include js files with <script src="./path-to-file.js"></script> Otherwise if you wanna link things together like it's nodejs you can look into bundlers like https://vitejs.dev/
or you can use js modules which is probably a better idea
what's the use of message.guild.id ?
to identify the guild in which the message was sent
I try to make the bot find modlog channel to see the config of the bot in the server
then store the configs in a database
each server's config being stored with the server id as key and value being be config
using db.get ?
depends on the API
.addField('Mod Log Channel', `${db.get(`modlogchannel_${message.guild.id}`)}`)
tried this and it's said null
because you hhaven't saved it
write something then
it doesnt exist in database soo add a fallback for it
the modlog channel already set
also prefix is null despite I try change the prefix
if that db is stored in RAM
you are out of luck
you have nothing to store it persistently on disk
add this on like prefix, modlog function ?
so when the bot process ends, all db data goes with it
sort off ?
but where do you store it on disk
how else is the bot gonna pick up the config when it boots up
define db: runtimeDatabase {
when update {
update data, this
update data, storage
return true unless exception: false
}
}
define storage: persistentStorage
when bot boots up {
copy storage -> db
}
define cmd {
when set (args)
bool status <- call db.set, args
if (bool is true)
send Message
otherwise
}
assume let's not care about persistent storage, that should work
Hello, I am trying to remove a field from all documents in my mongodb database. But, it doesnโt do anything, all documents still have the reactionRoles field. Can someone help me? This is the current code I have.
const guildDatabase = require('../../database/guild')
guildDatabase.updateMany({}, { $unset: { "reactionRoles": ""}}).then(res => console.log(res))
how do I get db of a server is it like db.get
what do you mean?
try without : ""
so for example I get modlogchannel id by doing
`${db.get(`modlog_${message.guild.id}`
because I already do
db.set(`modlog_${message.guild.id}`)
was asking to do the same method for a guild/server
yeah
also what's message.guild do again is it getting the guild/server name or something ?
message.guild contains the data of the guild in which the message was sent
not just names
Doesnโt work
When adding data to MongoDB should I create a list if it's different data for the same guild with the same topic of using that collection? Or should I create different query's in the db?
Create a new cluster for each guild :troll:
so guys
I'm using a cli
on nodejs
does anyone know how to possible center the text? :/
I mean I already found a way to center the text kinda, get the width of the window and divide it by half
but what if there's a text on both sides
nope
it's the cli app I sent before, I'm trying to fix some stuff in the GUI
hold on let me take a screenshot
I came up with something
I'm about to test it right now
hopefully it works
well almost?????????
I'll post my code, but beware, it's very very very very bad, and very bloated
const usernameCenterResult =
`${cyan(">")}` +
" ".repeat (15 - `Username: ${Username}`.length / 2) +
`Username: ${Username}` +
" ".repeat (15 - `Username: ${Username}`.length / 2) +
`${cyan("<")}`
const typeCenterResult =
`${cyan(">")}` +
" ".repeat (15 - `Type: ${Username != "Zero" ? "Account" : "Admin"}`.length / 2) +
`Type: ${Username != "Zero" ? "Account" : "Admin"}` +
" ".repeat (15 - `Type: ${Username != "Zero" ? "Account" : "Admin"}`.length / 2) +
`${cyan("<")}`
const prefixCenterResult =
`${cyan(">")}` +
" ".repeat (15 - `Prefix: ${Prefix}`.length / 2) +
`Prefix: ${Prefix}` +
" ".repeat (15 - `Prefix: ${Prefix}`.length / 2) +
`${cyan("<")}`
centerText += "\n" + centerAlignText(usernameCenterResult);
centerText += "\n" + centerAlignText(typeCenterResult);
centerText += "\n" + centerAlignText(prefixCenterResult);
please don't kill me I know it's bad
if anyone can fix it, I'd be really grateful to you
tf is that tf
yk leftPad exists right?
what?
List but aligned to the right
-----------------------------
Alan
Alan but longer
You see, left padded
Yes
that still won't help me center it... no?
I want have the same amount of spaces before > and <
you can use both leftPad and rightPad
I've never used that function
const MAX_SIZE = 30;
let name = "Alan";
let padded = name.padStart(name.length + Math.floor((MAX_SIZE - name.length) / 2), ' ').padEnd(MAX_SIZE, ' ');
huh no way
Pain.
js has way more utility methods than u might think
more than necessary I'd say
less than necessary actually
ah yes, js lacks isEven()
too bad I don't know 99% of it lol
I've seen memes about it haha
bruh Java is huge and packages like apache commons and google guava exist
give it a read when u can
like, delve in the docs
we don't talk about guava
is it because it's by google?
but like, javascript is missing so much for what a language should have
everyone flairing their arms because javascript added .at so you can do negative indexing
woo hoo features and good progress
no man why
I'm utilizing Express to host a web server, but I keep getting the error that there isn't any Access-Control-Allow-Origin header even though I set one. I've tried nearly everything, whether it be setting the header client side for axios, using other HTTP getters like got, http, and request-promise, using the CORS package for Express, etc. Nothing seems to work which really confuses me.
server.js:
https://sourceb.in/7E8aPSmaEe
index.html:
https://sourceb.in/UMWhsfenmO
bundle.js problem code:
axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*';
const response = await axios.get(url);
considering theres an array method called first and last theres no reason for there not to be
big agree
it's inflated af
plus it makes more sense than x % 2 === 0 given we work with simple stuff like that
I still have Gson ptsd
lol
really, you wouldn't believe how complicated they managed to make a simple JSON construction
I was relieved when I discovered Moshi
they can do WHAT?
arr.at(-1) would return the last element in the array
arr.at(-2) the second to last
and so on
what if the array is size 10 and u use arr.at(-10)?
first element
@lyric mountain
you won't believe what just happened
I changed every variable to let in my script
and guess what
it broke
at least u cant pass values lower than negative maximum
were u using variables outside of their scope?
yes....
so you can't use let like that
that's dumb
that's actually a logic flaw
how are you gonna have passwords then
variables are supposed to exist only within their scope
?
var password
//further further further in their script
password = something
basically something like that
it's what broke my script
...how about using global variables?
he did
Ah lol
can't change every variable though
but now the code broke cuz they were using var's hoisting problem
because some it breaks
Disregard ๐
it never gave me any issues though
you might need to fix your structure
or just put the variable on class scope
(if ur using classes)
your method didn't work @cinder patio
const defaultSpace = 15;
let usernameCenterResult = `Username: ${Username}`;
let typeCenterResult = `Type: ${Username != "Zero" ? "Account" : "Admin"}`;
let prefixCenterResult = `Prefix: ${Prefix}`;
usernameCenterResult = usernameCenterResult.padStart(usernameCenterResult.length + Math.floor((defaultSpace - usernameCenterResult.length) / 2), ' ').padEnd(defaultSpace, ' ');
typeCenterResult = typeCenterResult.padStart(typeCenterResult.length + Math.floor((defaultSpace - typeCenterResult.length) / 2), ' ').padEnd(defaultSpace, ' ');
prefixCenterResult = prefixCenterResult.padStart(prefixCenterResult.length + Math.floor((defaultSpace - prefixCenterResult.length) / 2), ' ').padEnd(defaultSpace, ' ');
centerText += centerAlignText(cyan(">") + usernameCenterResult + cyan("<"));
centerText += centerAlignText(cyan(">") + typeCenterResult + cyan("<"));
centerText += centerAlignText(cyan(">") + prefixCenterResult + cyan("<"));
console.clear();
console.log(white(`${centerText}`));
feud?
wasn't he the one that suggested using padend and padstart
it was me
dirty string manipulation code hurts me
if you have a better way then speak up
I didnโt say I had a better way, I just said that string manipulation code is yucky
function padCenter(str, size) {
return str.padStart(str.length + Math.floor((size - str.length) / 2), ' ').padEnd(size, ' ');
}
I mean it's not like a disagree but I can't do much about it
alright give me a second
thanks ๐
and please use smaller variable names
like, they need to be descriptive, but not THAT descriptive
also I noticed ur not using \n
terminal support newline
or if u must, you need to calculate how many characters can fit in the terminal horizontally
else it won't break at the right spot
I do
oh actually true
the tricky part is that terminal is resizeable, so u can't use a fixed value
that's precisely why I have a function to check for updates ๐
and then it automatically redos the function
and updates the gui
that's weird
the username bit is a bit off center
also why is the entire thing a bit of center
it couldn't be ansi codes could it?
ANSI codes just affect color in your case
yep, however their pure form has a bunch more chars
centerText += "\n" + centerAlignText(`${cyan(">")}${padCenter(`Username: ${Username}`, 15)}${cyan("<")}`);
centerText += "\n" + centerAlignText(`${cyan(">")}${padCenter(`Type: ${Username != "Zero" ? "Account" : "Admin"}`, 15)}${cyan("<")}`);
centerText += "\n" + centerAlignText(`${cyan(">")}${padCenter(`Prefix: ${Prefix}`, 15)}${cyan("<")}`);
char count
and since this is how I'm putting the code do you think it affects?
you see, even doesn't have a center
1 2 3 4 5 -> the center is 3
1 2 3 4 5 6 -> the center is either 3 or 4
so you need to adjust the > < based on how many chars there are
that's fine, I'll just increase the number a bit it so it won't be as noticable
why don't u put them 1 char away from the text?
the way it is currently is a bit "stiff"
centerText += "\n " + centerAlignText(`${cyan(">")}${padCenter(`Username: ${Username}`, 20)}${cyan("<")}`);
centerText += "\n " + centerAlignText(`${cyan(">")}${padCenter(`Type: ${Username != "Zero" ? "Account" : "Admin"}`, 20)}${cyan("<")}`);
centerText += "\n " + centerAlignText(`${cyan(">")}${padCenter(`Prefix: ${Prefix}`, 20)}${cyan("<")}`);
what do you mean?
> Username: Zero <
> Type: Admin <
> Prefix: - <
that's how I had it before
it doesn't look good
wait you mean to add one more char to the width between username and zero?
what if I add a text that is gonna make it even
hmm not really what I meant
> Username: __________ <
like, reserve a fixed size
and fit the username there
ohhhhh
I'd still have to calculate the size of the text to fill it up with spaces later, no?
also what if the text is too big
actually what IF it is even if the code you gave me
it might break
well, that's a tricky detail
btw just a little nitpick, but console commands are supposed to be -h and --help
single for single, double for multi
it's fine I'm not trying to make it accurate
I know I'm asking for too much, but
is it possible to make everything line up with "username"
wdym?
just add a padEnd to the entire line
padCenter(text.padEnd(usrName.length, ' '), 50)
Repost. I've also tried:
let headerConfig = {
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true
},
};
const response = await axios.get(url, { crossdomain: true }, { withCredentials: true }, headerConfig)
that way instead of Type: Admin you have Type: Admin
yep, that works
if the server cors whitelisted?
cuz like, cors blocks on the server not on the client
well kinda
since it moves to the very left
o ic. no i dont think so. im not very familiar with express haha. how do i whitelist cors?
Not 3 or 4, but 3 and 4
You either round down or round up
No idea for express
Well, neither 3 or 4 is the actual center though :p
Char pos is an integer ๐๏ธ
Okay nw.
store it as 35 and just divide by 10 ๐
const cors = require("cors");
app.use(cors({origin:["",""]}));
is there anyone who knows why my bot dosnt play music, its on v13 discord.js and yesterday works fine but today donst work idk why
because doing music is nothing but a headache
did you check if your ip wasn't banned from yt?
its playing live stream radio station
any error on the console?
like, you need to give us something, we can't just guess what's the issue
no error
no code, no error, no solution!
code:
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
})
const player = createAudioPlayer()
connection.subscribe(player)
const resource = createAudioResource(`stream link`)
player.play(resource)
bot joins vc but it dosnt play stream
I've never seen functions like that before, no idea what lib you're using or if those are custom functions or anything
discord.js
@discordjs/voice?
yes
I don't think you can create an audio resource from a stream link
from looking at these docs
No idea, never used djs voice before
ugh
in v13 the djs voice is horrible
true
v12 was more straightforward
you're trying to call strip on something
the most important part you omitted (the last lines)
It was working last day today I wake up and this error pops up
look, "working <insert timeframe here>" isn't really a valid justification
it isn't working now, that's all that matters
Its not a part of my code
are you using discord.py?
Yes
you're aware that it's a dead library right?
they resumed updates?
same dude, idk if he has a team now tho
Wasn't strip the name of software used to take identity proofs by discord?
tf after that huge memo I imagined he'd leave forever library maintenance
yea
its just weird when there is another fork wanting to continue his legacy but somehow he came back which make d.py community bit awkward
basically what's happening is that something is trying to call <something>.strip but <something> doesn't have it
show the last lines of your print, THAT'S where the relevant info is
pressure maybe?
i dont think there is any pressure since there is a lot of other popular forks replacing d.py
but there's always the "stayers" that refuse to migrate code
yea
.
From print did you mean the error last line
its replit db ig
well, the only thing I can think is that token is undefined or null
that means this is returning nothing
I removed dot env and it worked
that's...erm...well, idk how that solved it but ok
yea cuz u dont need dot env
And does anyone know how to automate Google form response.
wdym?
how do I fix mongo bad auth
either wrong login or wrong password
Google form response automation so that I don't have to open the link everyday and fill my attendance ๐
that's technically illegal
and maybe impossible since google uses reCaptcha for everything
1, no, don't do that, just attend your classes like you're supposed to.
2, google is very good at detecting bots when filling in forms, and it would be difficult to make anything like this.
3, breaks ToS of google, probably is against your school's policy, and therefore we won't be able to help you with that here 
classes are important
^^
your education is probably one of the most valuable things you will receive for free (depending on what you define as "free"), take advantage of it while you can
also a big part of one's social life 
It might not make you rich, but it definitely makes your chances of success much higher
^
you won't be able to get that kind of social interaction once you're out of school
thanks
There are no classes you just have to fill it everyday even on sundays
Then fill it out
I donโt think itโs too difficult to fill out an attendance form :p
uh is it possible to make footer text bold ?
trying to make an embed but wondering if it possible to make the text bold at footer part.
no
so you can't ? alright then, thanks for the info.
so what's possible for the embed for the bold text
I mean the embed part, like description and field ?
description and field values. Field names cannot use md afaik
Uh it said null reading 'user'
.addField('**โข Owner:**', `${message.guild.owner.user.tag}`, true)```
this is what I use
The guild owner isn't always cached, fetch them using
https://discord.js.org/#/docs/discord.js/stable/class/Guild?scrollTo=fetchOwner
Alternatively, use mentions
if you can get away with not caching something, the better
Discord says they never send official DMs from a user or bot account, but jokes on them; The system account is a bot
User {
client: [Client],
partial: false,
username: 'Discord',
discriminator: '0000',
bot: true,
id: '643945264868098049',
avatar: 'd9fa72d57744dea056b12e2b34a87173',
flags: 4096,
system: true
}```
This is also hilarious
how do I make bot grab random post from reddit
read reddit's api docs
get request to https://reddit.com/r/<SomeRandomSubReddit>.json
I use
const Rads = Reds[Math.floor(Math.random() * Reds.length)];
const res = await Fetch(`https://www.reddit.com/r/${Rads}/random/.json`);
const json = await res.json();
if (!json[0]) return message.channel.send(`Your Life Lmfao`);
const data = json[0].data.children[0].data;
Reds I put all the subreddit
"memes",
"me_irl",
"dankmemes",
"comedyheaven",
"cursedcomments",
"wholesomememes",
"cursedmemes",
];
cool
Help
const DiscordOauth2 = require("discord-oauth2");
const oauth = new DiscordOauth2({
version: "v9",
clientId: settings.websitebot_client_id,
clientSecret: settings.website.bot_client_secret,
redirectUri: settings.website.callback,
});
let data = await oauth.tokenRequest({
code: req.query.code,
scope: "identify guilds email",
grantType: "authorization_code",
redirectUri: url,
});
console.log(data)
DiscordHTTPError: 401 Unauthorized on POST /api/v9/oauth2/token
any one can help me
for this error
Why does this string: luckie@luckiecrab.nl
not match this pattern? js /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
The regex is really hard to read
Maybe look at email regexes made by other people verified to work
I did, this one didn't work and others emails without a domain extension would still be fine.
tried to experiment my bot run using heroku before hosting it on my vps but this things comes up, I already npm rebuild, npm install those 2 package but seems stuck on this.
Change your node version
I fixed mine by using the version 16.13.1 of nodeJs and node is not in your package.json
you mean the one from heroku ?
Your using the version 17 that's probably why. Downgrade to 16.13.1 to see if it works
how I do that
I haven't use heroku for a while and I forgot how to use it properly
But I'm sure that you'll find the answer on the internet
alright thanks, I'll look for it
No worries
I don't get why I get err on 'commands' that is undefined
await client.guilds.cache
.get('846752749555286027')
.commands.set(arrayOfSlashCommands)```
I tried changing the version on the package, push it to github, when I run the console the version dropped to 8.5.0
"engines": {
"node": "16.x"
},
Quick issue, why is nginx saying a file that clearly exists is 404.
I enabled directory index so it is 100% clear the file is there.
https://i.callumdev.xyz/tfgg2.gif
this is a terrible reg ngl
what u did could be simplified to /^[\w.]+@[\w.]+\.\w{2,3}$/
I didn't make it lol
Can you show me the conf file? There might be an issue with how you've written paths.
Very simple config, shouldn't have any issues https://i.callumdev.xyz/dopco.png
Have you tried removing the last backslash from the root directive?
It might be creating an issue where the file it's looking for becomes dir//file.
@snow urchin.
Have you tried it or was this the issue?
Tried; fixed, guess it was cache ๐ญ
pls 
What are you trying to do exactly? Guilds do not have a "commands" property.
load slash commands only in one guild :/
and it worked
It worked? So, what's the issue?
how do I set a node version for heroku, looks like if I do >=16.x on package.json it bring me to 17.8 version.
put '=version u want' I think
I think I already try it, hold on.
yeh still the same
That would definitely make things a lot easier to distinguish
lol yea. my lecturer person was trying to explain it to them last week and I could tell everyone was insanely lost. but she was using reference examples which should have been done by value, and that really wasnt helping matters imo ๐
for sure!
This concept is hard to teach in languages where every non-primitive is passed by reference by default
she shold just made a tiny class and passed that around
or some instance of a default class
Well, itโs not TOO difficult to teach, you just have to have an understanding of what a reference is in the first place
references and pointers blew my tiny mind when i first learned of them ~ really tricky concept for a nubie
Our teacher just explained it as โA reference is a memory address that points to an object, so when you access methods on that memory address, you can change the object associated with itโ or something similar
Granted, my class is Java so we donโt have to worry about the ref keyword
thats how i tried to explain it to the class people who were still confuzed
not sure if i helped them or not ๐
Yeah
how do I call the concept of loading html code after the real site has already loaded?
the image below shows the basic layout of my page and I want to load the green area and have a js request to get the red part
lazy loading seems to be somewhat what I need but looking that up online only shows images
tho I want it to load actual html code (without an iframe)
https://cdn.discordapp.com/attachments/607849386461888512/956245858490384434/IMG_0104.png
lazy loading regardless of what ur loading
How do I get the mongo DB object ID ONLY in python?
get the document by id?
oh okay
...that was a question actually
Oh, yeah. Then that's what I meant
use find
Okay
how would I do it?
I tried js async function fetch_list(el) { const response = await fetch('/api/getlist'); const html_text = await response.text(); document.getElementById(el).innerHTML = html_text; }
but someone told me it's not secure because of xss
well, it isn't secure because of html injection
Can I do something like this with an if statement?
const hasMysteryboxUpgrade = Object.keys(inventory.inventory).includes('mysterybox');
if (!hasMysteryboxUpgrade) inventory.inventory['upgrades'] = 1;
else inventory.inventory['upgrades']++;
while you can, you really need to rethink ur variable names
looks fine to me
inventory.inventory
that's what xss is, but I have no idea how else I am able to do this
Fair enough.
Ofcourse on a file that has 3k lines.
by not loading an entire html but only sections of it
this is what I'm loading
{% for entry in list %}
<div>
{{ entry }}
</div>
{% endfor %}```
not sure how I would do that tbh
like all apis do
return a json array
then with js you can easily insert elements on the page
but wouldn't that be a buttload of extra work?
define "extra work"
I have to write something that uses the json data instead of just already having it the way it's supposed to be
I mean, you're the one that defines what "the way it's supposed to be" is
you asked how to prevent xss
retrieve the data and fill on-site instead of retrieving an entire html
aight
but if someone could interfere into the html code I'm sending they could do the same with the json I'm sending, right?
not really, at most you'll get a parsing error
You using react?
like, if the payload is a html, the middle man could insert malicious runnable code
no
with a data-only json payload, he'll be able to at most insert curses or plain malicious links (not clickable unless put inside <a>)
and of course, in both cases he'd be able to steal the transferred data (that's why u don't transfer sensitive data unencripted)
so lets say I am gonna make it json instead, so my api returns the response below, how would I use that to get html code?
{'list': [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]}
first of all you'd not have 'list'
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0] is enough, it's a valid json
after u retrieve that data, parse it into an array and use js to insert the elements (on raw html)
or use the appropriate approach depending on your front-end framework
How to add a new element to HTML DOM in JavaScript? - To add a new element to the HTML DOM, we have to create it first and then we need to append it to the exis ...
ok I've rewrote it to create the html within the function, this is ok?
async function fetch_list(el) {
const response = await fetch('/api/getlist').then((response) => response.json());
const base_container = document.getElementById(el);
response.map(value => {
var container = document.createElement("div");
container.textContent = value;
base_container.appendChild(container);
}
)
}```
are u keeping IE (read: not edge) compatibility?
How do I convert a torrent into a readable stream in the browser? I'm using NodeJS, Express (for a web server), and Browserify (for WebTorrent), but since WebTorrent only works for WebRTC I can't use WebTorrent. Sorry, ik this isn't technically related to DJS but I've been asking around and haven't been able to get an answer haha
if not, replace those vars with let
just asking, what's the purpose of that?
ig it's nice to support as many browsers as possible, tho not supporting IE on purpose sounds like a great idea as well
IE support is bound to die this year
var causes some weird issues, I'd advise for u to replace it
aight, to let it is
damn, people really do be hating IE lmao
it's not hate, but supporting it is like dragging a dead weight
it WAS a good browser, when sites were no more than a few KBs in size
nowadays it can barely enter youtube
oh btw, use a for loop
map is only when u want to modify the output of a stream chain
someone just told me to use const instead of let in my case
yeah it'd be more fitting
Having an existential crisis on enmap database here
When anyone creates a new join-to-create setup, it sets in the database
The thing is it doesn't push the database to the host because the code's hosted in Heroku from GitHub
It doesn't auto-update the enmap database files from my initial code
Not sure if I should go back to self-hosting though as it may provide major downtimes for my discord bot.
This is still a major issue as you have to setup the join-to-create again every few days which is frustrating and very unprofessional
how do I loop through the elements of a list without having to do stuff like my_list[i]?
heroku isn't really meant for file-based databases
I realised
if u must, setup a way to save the database externally
But how?
or just use some service-based database
I'm not familiar with mongodb and such
for (elem of elements) { }
idk how big enmap databases are, but you could use services that have an upload api
obviously, encrypt the database before uploading
then every time you start your bot just download it
there's a catch tho
you'd need to upload on a regular basis because heroku has random micro-restarts
that also means sometimes losing unsaved data
Guess I have to go back to self-hosting
you could use replit or hosts that have a free plan
or pay for a vps, they aren't expensive
PS C:\Users\HamoodiHajjiri\Desktop\Typescript> tsc
tsc : File C:\Users\HamoodiHajjiri\AppData\Roaming\npm\tsc.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ tsc
+ ~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I don't understand, yet, what's causing this issue?
powershell has "safety" measures that most of the time only get in the way
yes
I remember fixing this somehow, canโt remember what I did though
more funny thing you can bypass them
Should I perform Set-ExecutionPolicy RemoteSigned?
I mean, if someone gained access to ur pc why tf would they use pshell instead of cmd?
No, thereโs a way to use a different command
if anything, just call cmd prompt from pshell
it's like making a heavy and fortified gate without having a fence
Problem: Getting โcannot be loaded because running scripts is disabled on this systemโ error! On trying to run a PowerShell script from the PowerShell console, received this error message: โFile C:\temp\GenerateRpt.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https...
I mean...
Use tsc.cmd instead of tsc
Thatโs what I did and worked for me on my system
What's the use of .cmd?
What does that do, and when do we use it?
Instead of using tsc, just type tsc.cmd instead
I donโt know why, but it works
Just the same
I'm aware, but what does it do?
The same thing as tsc
"You must be 18 to use this site"
if (command.endsWith(".cmd")) {
execute("command");
} else {
printf("%s cannot be loaded because running scripts is disabled on this system.", command)
}
True!
LOLLLLL
Why does typescript compile to ES3 and not ES6, supposedly.
What's the property in the object, called?
Also, does tsconfig.json have a default object?
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
answers all your questions
For a torrent converter. They can paste a magnet and it will fetch the torrent and stream it.
interface User {
name: string;
age?: number;
};
What do you call the ?.
Is there a name of it in typescript?
Also, why is it not seperated with a , but a ;?
because they are like ```java
public class User {
String name;
Number age;
}
I use djs v13, I can't use replit
if u used commas, it'd be like ```java
public class User {
String name, age;
}
why?
I can still use something like:
interface User {
name: string,
age?: number,
};
comma means something exists within the same execution line
You need node 16+ to use djs v13, but replit only supports v12 or v14
I can't remember
you can use node 16 on replit
Nothing ever worked for me
I'll just self-host anyway
just made a chat room for staff only
socket io?
pain request i think i made the css and the hta access while my friend worked on the index
why don't u use a socket network?
that way u get the message sent instantly to clients
idk we both beginners it sounds confusing lol
that's how I did the chat for my pixel game
it only take about a second to load the chats
it's kinda easy, I'd say easier than setting a rest server
ill look into it then
im hosting it on gatorhost how would i be able to use node?
what lang did u use?
php
ok thank you
you'd have a backend somewhere to handle the requests tho
that's where the previous node article comes in
unless ur fine having only a 1 <-> 1 communication
ill try it out!
How do I check if a port exists already? Basically I am doing this:
function createServer() {
let randomPort = functions.createPort(); // generates a random number from 1-9999 for the port
functions.createServer(randomPort); // creates an http server. so the website will now be http://localhost:1234 or something.
}
But sometimes a server may exist already. Is there a way to check if a server is busy or smth?
??
try-catch
idk why i didnt think of that earlier omg. mb ty
kekw, it's weird but probably the most convenient solution is to try-catch stuff
regarding port stuff it's always a headache and the closes way to check would involve a lot of low-level shit
oh btw, remember to enable reuseAddr
else u might get a ghost port
You might want to generate a random number from 1000-9999
๐ will do. tysm
This is a list of TCP and UDP port numbers used by protocols for operation of network applications.
The Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) only need one port for duplex, bidirectional traffic. They usually use port numbers that match the services of the corresponding TCP or UDP implementation, if they exist....
The Character Generator Protocol (CHARGEN) is a service of the Internet Protocol Suite defined in RFC 864 in 1983 by Jon Postel. It is intended for testing, debugging, and measurement purposes. The protocol is rarely used, as its design flaws allow ready misuse.A host may connect to a server that supports the Character Generator Protocol on eith...
Why do I keep getting this error when trying to send an E-mail using nodemail? Error: Connection timeout at SMTPConnection._formatError (/home/runner/DAVM/node_modules/nodemailer/lib/smtp-connection/index.js:784:19) at SMTPConnection._onError (/home/runner/DAVM/node_modules/nodemailer/lib/smtp-connection/index.js:770:20) at Timeout.<anonymous> (/home/runner/DAVM/node_modules/nodemailer/lib/smtp-connection/index.js:229:22) at listOnTimeout (node:internal/timers:557:17) { code: 'ETIMEDOUT', command: 'CONN' }
smtp server error
Yeah, but how can I fix it?
you cant
If it's a command block you want, we can't help you
basically a command that creates a private channel that only you and the mods can see?
what library are you using?
I know
are you using discord.js?
Use translate
if you're using discord.js
https://discord.js.org/#/docs/discord.js/stable/class/GuildChannelManager?scrollTo=create
so you don't have a bot at all yet?
you should ask on their support server then
we can't really help regarding other bots
Then we can't help you
It would make more sense to ask the support server of the bot you said
In d.js v13
How to have choices instead of an option
for more detail on kuhus answer you should catch the error which stops crashes and then have some kind of retry mechanism and if the retry fails after 2-3 times then you should give up
it doesnt crash, it catches, it just won't connect whatsoever
went looking through old messages and found this glory https://pastebin.com/SNMA66Fv
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
bros the reason async await exists in js
wth ๐
Using NodeJS, how would I create a Blob and parse it into a playable format for the <video> tag?
const { Blob } = require("buffer"); // What I found online, but the type is different compared to the browser.
let filePath = URL.createObjectURL(new Blob([torrent], { type: 'application/x-bittorrent' }));
I'm using WebTorrent as a package, but the original code only allows me to get a torrent's blob URL if the source code is in the browser (which makes sense). I'm trying to do the same thing except for NodeJS. This is the code that WebTorrent uses:
get torrentFileBlobURL () {
if (typeof window === 'undefined') throw new Error('browser-only property')
if (!this.torrentFile) return null
return URL.createObjectURL(
new Blob([this.torrentFile], { type: 'application/x-bittorrent' })
)
}
I made some changes to the ui of my rpc app. currently reworking everything to properly support theme options. I've been writing personal websites for years and only just learned about css variables ๐
wondering if anyone has any more suggestions for improvements to the gui ๐
Already looks pretty neat. Good Job 
How to disable global error handler from processing the error if the error is handled by the local error handler.
context?
if the error is handled locally it should not become global
unless you're in the web
i have a command that can raise two errors. Error 1 is specific to that command Error 2 is missing arguments which is more common error. Now i have added a local handler for this command that only handles the error thats specific to it and not the missing arguemnt error which, is handled by global error handler as its required for apprx. every command.
THis specific error is just missing arguments error but with more explanation. For Example : ?cmd <parameter1> <parameter2> will raise missing arguments error when any argument is missing.
Accourding to that, will want to send a message explaining why that parameter is required and what to add as paramter. This explanation is specific for each command and thus can't be managed in global handler. But there are some commands taht don't require any explanation. Those should be handled by global handler saying argument is missing.
```will raise error like this :
``` param 2 is a required parameter because its needed for <reason> and you have to enter <details> there.
```whereas
`?cmd3 __`
doesn't require explanation so the missing arguments error will be handled by global handler like this
Looks like you forgot to pass a parameter
What exactly are you using as a command handler? It sounds like you just need to scope errors
bot.topggpy = topgg.DBLClient(bot, dbl_token)
TypeError: init() takes 2 positional arguments but 3 were given
I believe the error is self-explaining
im so out rn
i have been migraating to slash commands
and nth work
s
just tell me
did you read the second line?
yea
what does it say?
TypeError: init() takes 2 positional arguments but 3 were given
yes, so how many arguments does init() expect?
witch init?
Traceback (most recent call last):
File "/home/container/main.py", line 74, in <module>
bot.topggpy = topgg.DBLClient(bot, dbl_token)
TypeError: init() takes 2 positional arguments but 3 were given
the next lines
container@pterodactyl~ Server marked as offline...
[Pterodactyl Daemon]: ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon]: Exit code: 1
[Pterodactyl Daemon]: Out of memory: false
[Pterodactyl Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
that dosnt help.
there should've been more to that error
kinda
class Echo(commands.AutoShardedBot):
def init(self):
super().__init__(
command_prefix={","},
owner_ids={775030123749441536},
intents=discord.Intents.all(),
case_insensitive=True,
start_time=datetime.utcnow(),
)
one of those inits are expecting 2 arguments but receiving 3
search in your code anywhere there's init written
all have 2 things
def init(self, bot):
self.bot = bot
def init(self, max_size: int = 128):
class Echo(commands.AutoShardedBot):
def init(self):
super().__init__(
command_prefix={","},
so idk
only one is this
def init(
self,
prefix: str = "", suffix: str = "",
max_size: int = 2000,
scale_to_size: int = 2000,
max_lines: t.Optional[int] = None,
) -> None:
self,
prefix: str = "```",
suffix: str = "```",
max_size: int = 2000,
scale_to_size: int = 2000,
max_lines: t.Optional[int] = None,
) -> None:````
..
try ctrl + clicking DBLClient to see its internals
I can't find that lib's source code
?
it works locallyt
not on a server
the same code?
yep
did you remember so save it?
is the lib updated?
i have topggpy 2.0.0a0
I'll need to wait someone more experienced with either pterodactyl or that lib to see where's the issue
How would I convert a NodeJS buffer into a playable format that normal JavaScript can play using the <video> tag?
stream it
make an new path/endpoint in your server/router that sends the buffer
and give the <video> tag the url to it
So the <video> tag can only utilize URL's? And how would I stream it? I'm creating the server in NodeJS and then sending the HTML manually, but I would prefer to not create multiple HTTP servers unless necessary.
https://sourceb.in/TUd1CsKRvA
from the server you would send each 'chunk' of data to the client. your client would then take each chunk, and put it into the buffer/create a buffer from it, and you can then use that buffer to save, playback, whatever. I included a pic of somewhat similar logic I have used before but for saving a video file from a buffer. instead of saving, you would play it.
I just have local command handler that checks if the error is instance of commands.MissingArguments. same for the global error handler. The way how they handle the error is different. The local command handler gives more insight into the error, while global error handler is more generic and handles those error which are not handled by local error handler..
Let me share the code
i'm confused
Thank you! That makes a lot of sense. To make sure I got that correctly, from my NodeJS server I would send a chunk of data from the buffer to the HTTP server I created? How would I send the data?
idk what the pipe call is when using the http lib, but using express it'd be something like this: ```js
const express = require('express')
const app = express()
const origin = 'https://example.com'
app.get('/*', async (req, res) => {
const proxy = await fetch(${origin}${req.path})
res.writeHead(proxy.res.statusCode)
proxy.res.pipe(res)
})
app.listen(process.env.PORT)```
actually, what is it your trying to do? why do you need two servers?
Thank you! That's super helpful.
like, if your just wanting to stream data from your server to the client, thats only one server, no?
Essentially I'm utilizing the library WebTorrent which creates an HTTP server with the link to the original file. I can scrape that link, but it leads to no where. So I devised the idea of getting the buffer of the torrent and then streaming it by creating a new HTTP server. I can't use WebTorrent in the browser because WebRTC doesn't work, so I have to do all this work in the backend.
so your basically creating a server to act as a proxy between torrents? ๐
axios({ method: 'post', url: "http://localhost:3000/api/users", data: { title: links[0].text, magnet: links[0].url }} ).then(async(res) => {
let port = res.data.id;
let server = torrent.createServer();
server.listen(port, async() => {
const http = require("http");
http.createServer(function(request, response) {
}).listen(port);
});
There's a bit more to it, but that's the general idea.
uhh
maybe? ๐ dw abt it ๐
mostly just doin this for fun haha. dumbest idea ive come up with tbh
lol, dumb ideas usually are fun ๐
frfr
import http outside the callback
mb. i forgot to move it haha
you don't wanna import every time you request the thing
calling one reference is better than fn calls
yea thats fair
๐ tyy
i dont believe http supports pipelining. not sure imma do some research on that. worst case ill just use express
also the fetch part is sending an http request to the localhost server or wherever the buffer is stored? sorry not sure if i interpreted that correctly or not
wait nvm i saw the link you sent mb.
dang thats unfortunate. nvm imma use express then
express isn't bad ๐
almost all my sites/api's use it
really nice optional url parameters and such
haha. thats true ive used it a bit. im just having a bit of issue cause every time a new torrent is requested i create a new port
which prob isnt a good idea but express can only listen to 1 port i believe
i tried having it listen to all ports but that didnt seem to work haha
you could umm
might make things large than you anticipated
but you could use something like docker to spin up containers (instances of your torrent server)
thats likely way more work though ๐
haha ty i will look into that ๐
would yall say commands like avatar, serverinfo and userinfo are general commands or utility commands?
utility
and depends what you mean by general
something quick you'd usually group it as utility
Sorry for being late but this is the code first image shows the global error handler and second one shows the local error handler of the smogon command.
uh, so I have economy system on my bot, how do I keep the data from not getting wipe on every bot restart
I was testing it on heroku so want to make sure it work fine before deploying it to vps
wouldn't isinstance(error, ignored_exceptions) check if the error is a tuple rather then going though it?
how are you storing your data?
use a database 
mongoose ?
psql
mongoose not db
if mongodb
I use quickdb for storing
saw that coming
yeh I'm still new on coding.
then you dont really need to do anything
heroku uses an ephemeral file system, they are the ones deleting your data, if you move to a vps it wont be deleted
I mean, everytime I deploy new build on heroku, it somehow wipe the data for every restart.
planning to move into vps, after testing it with heroku.
if you plan staying at heroku then switch to an actual db like mongo/psql/mysql/mssql
if you're moving to vps don't bother (as tim said sqlite works fine on any system that doesn't delete files)
If you're testing then having the data on heroku for 24 hours should be good enough for testing/ building
But it will keep write the existing data even after restart right ?
Alright then, thanks for the info.
I have mongo setted up(the link and such) but don't know where to start.
if you want my suggestion, just move to a vps right away
the sooner the better
dont waste time on heroku
Uh i don't the problem lies there.
you dont the problem?
@quartz kindle I don't have the error atm because right now it's apparently working however it probably won't in the near future
it just says "Value" is undefined pretty much
show the full code then
const response =
let result = response.map(value => value.name_value.split("\n").filter(x => !x.startsWith("*"))).flat();
result = result.filter(function (item, pos, self) {
return self.indexOf(item) == pos;
})
and where is if (response.statusCode !== 200) { or if (arrayLength === 0) {?
below this piece of code
why?
I can't get them before getting the json first, no?
you can check statuscode before json, and you can check length before map
const redeem = new MessageEmbed()
.setColor(black)
.setDescription('Please enter your code by sending it to the chat.')
const n = await ButtonInteraction.update({ embeds: [redeem], components: [] });
const nFilter = (nInt) => nInt.message.id === n.id && nInt.member.id === n.id;
const nCollector = new MessageCollector(interaction.channel, { nFilter, max: 1, time: 10000 });
In the nFilter function, how can I check if the nInt member id is equal to the member id in n?
so you mean before the response?
even so how would that help in solving the value error?
idk what the actual error is, but i can identify possible points of failure, for example the request can fail, the json can fail and the response can be invalid or not an array
you cant trust the api to always give you what they are supposed to
agreed that's why I also decided to try scrapping the body of the webpage (not the api) and then use regex to turn it into a json
however it gives me the same issue
it sometimes works and sometimes doesn't
not n
also that filter will not work
nFilter is not a valid collector option
just a thought, couldn't it possibly be a sort of rate limit / IP barrier that prevents my program from accessing the website?
thinking about it makes me think no, because if I just take the url and put it on chrome it suddenly works again
yes it can, that possibility is included in the points of failure i mentioned above
hmm
You already are, the filter option should be named as filter, not nFilter; or you can also do filter: nFilter
should I just try catch that and give an error of API being unavailable if I ever get that error?
let response;
try {
response = await fetch(`https://crt.sh/json?q=${_domain}`).then(response => response.json());
} catch(e) {
console.log(e);
return;
}
if(!Array.isArray(response)) {
console.log("not an array");
return;
}
let result = response.map(value => value?.name_value?.split("\n").filter(x => !x.startsWith("*")) || []).flat();
``` these are a few checks you can add for example
I forgot that they've added the "?" check
how does it work again?
also can I just get rid of the try catch since I have a handler, it will give me the error anyway
a?.b is the same as a ? a.b : undefined
oh that's new
should I else if that?
you dont need else if you return inside the if
I know, I wanted to do that solely because I want the code to look decent
its decent if it looks right
Hmm.. so why is this error?
const redeem = new MessageEmbed()
.setColor(black)
.setDescription('Please enter your code by sending it to the chat.')
const n = await ButtonInteraction.update({ embeds: [redeem], components: [] });
const nFilter = (nInt) => nInt.message.id === n.id && nInt.user.id === interaction.member.id;
const nCollector = new MessageCollector(interaction.channel, { filter: nFilter, max: 1, time: 10000 });
TypeError: Cannot read properties of undefined (reading 'id')
at MessageCollector.nFilter [as filter] (C:\Users\HamoodiHajjiri\Desktop\Rewrite\src\slashcommands\utility\subscription.js:79:72)
It's saying n.id is undefined.
having both return and else for no reason is not decent
I was thinking about readability not the programmers point of view, although you are right I guess
you probably need to add fetchReply: true
What, where?
.update({embeds, components, fetchReply:true})
Still, same error?
ACTUALLY, should I just combine all of the if statements into a switch case? right now there's 3 of them, but I bet I can come up with a fourth check to fill it up
it doesnt matter
but it will look better
Slower, though, I think.
switch cases are actually faster
console.log(n)
Yeah, I put that in all the places, and undefined.
also I would leave the default to be the rest of the code
so if it doesn't stop somewhere in the switch it will just run the code
that's pretty smart ngl
and you added fetchReply?
show code
Yes.
const redeem = new MessageEmbed()
.setColor(black)
.setDescription('Please enter your code by sending it to the chat.')
const n = await ButtonInteraction.update({ embeds: [redeem], components: [], fetchReply: true });
const nFilter = (nInt) => nInt.message.id === n.id && nInt.user.id === interaction.member.id;
const nCollector = new MessageCollector(interaction.channel, { filter: nFilter, max: 1, time: 10000 });
nCollector.on('collect', (aCode) => ctr = aCode.content);
nCollector.on('end', async (collected) => {
if (!collected.size) {
embedError.setDescription('โ The **15 seconds** time limit has reached.');
return await interaction.channel.send({ embeds: [embedError] });
} else {
collected = collected.first();
interaction.channel.messages.fetch(collected.id).then(msg => msg.delete());
resolve(null);
};
});
the code is pretty neat I like it
Isn't it the job of filters?
dont you want to filter for the channel id and the member id?
I'd just put the redeem embed into a global variable so it doesn't made the code look bad
Why not just use the createMessageCollector() method instead of the constructor?
Message component collects the message interaction components, not the message which I suppose is what they want, but yeah the awaitMessages() method is also a good option
I'm collecting a message, only, and applying filters.
maybe intid returns undefined?
const n = await ButtonInteraction.update({ embeds: [redeem], components: [], fetchReply: true });
const collected = await interaction.channel.awaitMessages({ filter: m => m.author.id === interaction.member.id, max: 1, time: 10000 });
if (!collected.size) {
embedError.setDescription('โ The **10 seconds** time limit has reached.');
return await interaction.channel.send({ embeds: [embedError] });
} else {
collected = collected.first();
interaction.channel.messages.fetch(collected.id).then(msg => msg.delete());
resolve(null);
};
Heya, for some reason command returns as undefined when I console.log it but I cant figure out why that is
Hope someone can help me
module.exports = {
name: "interactionCreate",
run: async (client, interaction) => {
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (error) {
console.log(error)
};
}
};```
This works?
const redeem = new MessageEmbed()
.setColor(black)
.setDescription('Please enter your code by sending it to the chat.')
await ButtonInteraction.update({ embeds: [redeem], components: [], fetchReply: true });
const nFilter = (nInt) => nInt.member.id === interaction.member.id;
const nCollector = new MessageCollector(interaction.channel, { filter: nFilter, max: 1, time: 10000 });
nCollector.on('collect', (aCode) => ctr = aCode.content);
I need a project idea
yes that should work
log interaction.commandName
I've tried that, it returns ping (which is the command)
log client.commands
check your command loading code
undefined as entry name/key
you are storing the command with undefined as a key
I never saw that undefined before, idk how
show where you do client.commands.set()
I suppose you're setting command.name in your loader rather than comnand.data.name
I've made that mistake before as well
This is what I use
const commandFiles = await globPromise(`${__dirname}/commands/**/*.js`);
commandFiles.map(res => {
const file = require(res);
client.commands.set(file.name, file);
client.categories.add(file.category);
});```
Knew it
do all your commands use { data: { name: "" } }?
just make sure all commands are using the same format
Yeah, I was going to do that
๐
How do I play mkv files in the browser? I understand standard JavaScript can only play mp4, ogg, and webm files, but the files I currently have are only mkv files.
you can try playing it with type="video/mp4"
if it doesnt work, then you need to convert your files
Ah. Yeah it plays, but the video doesn't show. Are there other audioplayers/libraries that support mkv?
not afaik
okay so
i'm working on a lockdown command but whenever i run it it won't lockdown and i think it's cause of how i'm getting my role?
this is where i update the channel tho
const ok = await interaction.channel.permissionOverwrites.create(role, { SEND_MESSAGES: true })
.catch(() => null);
if (ok === null) return;
and this is what the role identifier is
const { role } = await client.db.updateGuild(interaction.guild.id);
@solemn latch pls halp 
nvm i fixed it
I'm getting Protocol error, got "A" as reply type byte redis while using redis-server or redis-cli command
How can I do big indents instead of doing <hr> many times for html?
Using padding/margin for your element
And <hr /> is an horizontal line (break), it has nothing to do with indentation
For example
<span style="margin-left: 20px;">text first tab</span>
You may wanna define some CSS rules for it
Okay, thanks. And yeah. I'm working on the css for this as well
does anyone know how to prevent TCP from clamping two packets together?
i looked online but the only answer i got was "TCP is a streaming protocol bro" ok cool now tell me how to solve the problem
how i can fix this?
the misalignment?
hmmmm?

what did I just say?
