#development
1 messages · Page 1240 of 1
also avoid forEach whenever you can, super slow compared to native for looping
forEach was the only way i knew to do this haha
so it returned 147524 members, which seems unreal...
is the bot in here
right, ty
would this also work? (found it online)
<client>.guilds.cache.reduce((a, g) => a + g.memberCount, 0)
Try it and see, assuming it will.
How do I change the topic of a channel with Python via ctx?
would this also work? (found it online)
<client>.guilds.cache.reduce((a, g) => a + g.memberCount, 0)
it returned a really similar number, so I'm guessing it worked! ty
Use <TextChannel>.edit() with a kwarg of topic equal to type str.
no
do you want to edit the channel the message was sent in (hence "ctx" -> "context")
Uh-huh
Then use ctx.channel to get the channel
how can i make my bot respond when its mentioned?
client.on('mention')?
Are you using Discord.js
yes
Listen to the message event and see if in the Message instance if you were mentioned via message.mentions.users.
.users will be a collection. Check with the .has method with the bot ID as the argument.
You could also use regexp.
no
See the docs for the return type: https://discord.js.org/#/docs/main/stable/class/MessageMentions?scrollTo=users
if (message.mentions.has(client.user))
that works
but when i type smth like that _userinfo @dreamy jacinth name
it respond two times
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/[HIDDEN]-alpha - Not found
npm ERR! 404
npm ERR! 404 '[HIDDEN]-alpha@0.0.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
How do I put it in the npm registry?
Using has on MessageMentions is what you probably don't want as it takes into consideration a lot of other factors, such as @ everyone and @ here pings
Use .users.has("bot id here") instead.
I want to learn more about probability. Anyone has an idea how I can use probability and javascript to learn probability?
if mentions bot && does not begin with prefix
if you don’t want it to respond twice
or put a return if you want commands not to work in the bot
The properties you access are in order in how the docs display them. message is the root, and .mentions is a MessageMentions instance. .users is a property on that instance which has the collection and .has is a method on that collection which you give your bot ID.
In short, using the docs and reading it in order will help you solve the problem. I assume you did message.users.has instead which is incorrect. You should use message.mentions and do the rest of what I originally told you. @clear arrow
No
@clear arrow wtf is that
just do it the old school way
check if message content is <@dreamy jacinthID> or <@!botID>
yes but if i do that when for exemple i want to get bot's information _userinfo @dreamy jacinth it wil send the userinfo and the message
message.mentions.users.first()?
anyone know how to create a leaderboard using mongoose? d.js
didnt you already asked that
that its spamming the command
2 days ago?
whoops
big brain
5head
can someone check this, what is wrong with this?
unexpected token at the last line
nvm I solved it
anyone here who could test an eval command with me in testing-1
?
Doing?
@misty sigil do you have a little bit time?
aye
How do we get user id of the person who voted
@quartz kindle hey, if you are around, can I ask you something about % calculating?
js?
yes
what about it?
I created a class that creates a normal deck of cards
and now with that I am trying to calculate the probability
I am not sure if the numbers are correct
if you want you can see it in testing-1
just a question
what are the amount?
with the get.tech domain github thing
56 cards
it should be just (cards)/(total)
yeah
how can i point it to a cpanel website?
can you see it just for a second?
sure
probability_twocards(card,card2){
let probability=[]
let probability2=[]
deck.generate_deck()
deck.schuffle();
deck.deck.map(m => (m.value == card.toString(card))?probability.push(m).length:null);
deck.deck.map(m => (m.value == card.toString(card2))?probability2.push(m).length:null);
message.channel.send((probability.length/deck.deck.length)*(probability2.length-1/deck.deck.length-1));
}
does this help? Or do you guys need more code?
It doesnt show the right probability 🤔
why .toString(card)? why .push(m).length? Why .map()? Why null? Why is the method named "schuffle"?
So many questions
No need
Those questions are pretty standalone
Let me explain (brb opening laptop)
- toString(card) just to make sure it is a string, I am not even sure if it is important, maybe it will work without it
2.push(m).length, because I get a set of object, when I search for the card (2) "for example", I will get 4 objects in the array and that is simply the number then, I will use for my probability.
3.map() I use to filter those cards, I need. I get throught all the object and I only push the ones that makes the condition true m.value == true - shuffle is not important, you can ignore that, I have only used that to test something, but it shuffles the deck, bascially
- toString's first argument is the base to make the claculation on
toString(card) is not only not required, it could even cause unintended side effects
- push() returns the current length of the array, therefore .push().length is basically undfined
3 - .map() is used to transform an array and return a new array. you are not returning anything, therefore using .map is a waste
if you want to iterate over an array without returning anything, use .forEach or a for loop
- the correct word would be "shuffle" but you wrote "schuffle" with an extra C, hence why the question lul
lol
true, sry
It is because I mixed it up with my native language
ok, thanks for your input. I think I should be able to work that out
and the why null, that ternary is unnecessary, even more so when you dont really return anything
How would you do it w/o a teneray, I mean, I need a condition in order to filter the cards I need 🤔
.filter exists
wait who has a kill command
hmm ok
i technically do,but its to kill my own bots process
nvm imma play with my code
emergency shutdown kinda thing
thanks

of course there are checks beforehand
but you get the gist
well good thing that i went to check it
this somehow passed my rewrite

Hows everyones bots going?
@rare gale normal,i guess? why?
probability_twocards(card,card2){
let probability=[]
let probability2=[]
let card_1 = this.deck.forEach(m => m.filter(m => m.value == card));
let card_2 = this.deck.forEach(m => m.filter(m => m.value == card2));
probability.push(card_1);
probability2.push(card_2);
message.channel.send((probability.length/this.deck.length)*(probability2.length-1/this.deck.length-1));
}
@quartz kindle does this look better? 🤔 I get now a weird result: infinity
infinity sounds about right
imagine testing on production
sh sh sh

oh god
speaking of testing shit in production
i fucked up, yikes
now im a hypocrite
new achievement unlocked
i think a mod deleted it last time i posted that
prob not a good idea to put that there
tru
Yeah ||shiv is always watching||
anyway, so undocumented shit is against discord ToS?
technically yes
mmmh
xD

gj xD
when making bot dashboard
is it easier to html
then ejs
cause i need js for the discord stuff like getting guilds
script src
I think my rasp pi is corrupted, what do you think?
Why do you think thats "Corrupted" ?
mayb a file that isnt there anymore/was deleted/or is damaged
but that dsnt mean your pi is corrupted 
It's been crashing every 30m or so
I def think it's corrupted
especially since the entire File system is Read-only except for the camera footage
if anyone has a lot of free time
im stumped
im trying to create a web dashboard for my bot
and i need assistance

yeah
im using js
i was kinda hoping somone would give me detailed help
i have tried so many things lol
Well if you want the user to authenticate, look through this https://discordjs.guide/oauth2/#a-quick-example
In the npm package 
anyone good at java?
anyone good at java?
@indigo flax I know C# and therefor know Java to some degree
But, what is your real question?
@faint prism so i have a code
and
idk how to start the bot
@faint prism so like
idk what command to run
to start it
You can run via the main class or export to a JAR
HMMMMMM
@opal plank @faint prism sorry for the ping argh but I have no name!@8b80645a-b018-4d80-8596-04dceaaa7080:~$ java -jar giveawaytool.jar
Error: Invalid or corrupt jarfile giveawaytool.jar
i think youre looking to export an uber jar which contains all the dependencies your project requires
have you looked into the shadowjar plugin for gradle
did you get any errors building the jar?
does anyone have the patience to guide me through how to make ffmpeg work
its making me an angery
What language are you using
If it's js you can call it via
https://stackoverflow.com/questions/19762350/execute-an-exe-file-using-node-js
Or a library from mom probably
If it is C# or C++ you can use it api
Hi i have just done the slowmode command but i can't switch it off.
Code is here
const Discord = require("discord.js")
const ms = require("ms");
module.exports = {
name: 'slowmode',
description: "slowmode",
run: async(client, message, args) => {
if (!message.member.permissions.any(["ADMINISTRATOR", "MANAGE_CHANNELS"])) {
return message.channel.send("Oopsie, you don't have any rights to do this.");
}
let channel = message.mentions.channels.first(),
time = args.slice(1).join(" ");
if (!channel) time = args.join(" "), channel = message.channel;
// If the user doesn't includes the channel.
if (message.flags[0] === "off") {
channel.setRateLimitPerUser(0);
return message.channel.send(`<#${channel.id}> slowmode has been deactivated.`);
}
if (!time) return message.channel.send("Please includes the time format.");
let convert = ms(time); // This will results the milliseconds.
let toSecond = Math.floor(convert / 1000); // This will convert the ms to s. (seconds)
if (!toSecond || toSecond == undefined) return message.channel.send("Please insert the valid time format!");
if (toSecond > 21600) return message.channel.send("Timer should be less than or equal to 6 hours.");
else if (toSecond < 1) return message.channel.send("Timer should be more than or equal to 1 second.");
await channel.setRateLimitPerUser(toSecond);
return message.channel.send(`This channel: <#${channel.id}> has been slowing down for **${ms(ms(time), {long: true})}**.`);
}
}
@gusty inlet are you advertising or what?
Hello, if I have a discord bot, can you add them to your servers for support, let those who add them throw their server ids from dm and let them activate the premium feature, special commands will be added soon.
@gusty inlet advert
first half sounded like a question, the last part sounded like ad, and the whole thing didnt provide a single info we can use to help them

sorry
Hm can anyone pls help
i may be blind but why you requiring discord again?
you passing the parameter already, no need to re-require it unless you using it there
that wont fix ur issue though
ik
also not checking type can be quite a bothersome later on
wdym
time = args.slice(1).join(" ")
if (!time)
if i do 'ha ha' it may match
! just failson 0, null,undefined or empty string
unless ms() does that for you
also idk what parameter ms requires, but you're providing it a string
this bit
let convert = ms(time);
on the same example, if i input 'ha ha' it'll try ms('ha ha')
then as soon as you try this ts let toSecond = Math.floor(convert / 1000); it'll fail
you cant null/undefined/sring divided by number
Oh so do I remove that line?
?
check channel type
(aka dm's)
some of the stuff you might try to load dont have properties
in this case i dont see much issue, but it may arise
Wait but it doesn't have errors when i run the code
if (!message.member.permissions.any(["ADMINISTRATOR", "MANAGE_CHANNELS"]))
try running command in DM's
lel
try running command in DM's
@opal plank how?
member doesnt exist on DM's cuz its a channel,not a guild
dm the bot
run that command
u so funny
u so unhelpful
like, if i wanted a music bot to work, how do i do ffmpeg
lel
Anyone could explain how permissionOverwrites work?
What cha trying to do
trying to see if my cache is broken or not
that bit is fine
1.9mil viewers
but then you go on my bot
and im getting a REALLY big difference in numbers
so im really unsure if my bot has more reliable statistics than theirs
Try turn it off and on so it fetch everything again
Probably something fuck up the code
thats the thing,ive triple checked it
nothing seems off
needed someone thats proficient with Typescript or strong typed lang to give a peer on this
seems like you aren’t taking current viewers or something idk
the returned values are current viewers though
¯_(ツ)_/¯
and if they are offline that is also set to 0
so it cant be adding offline streams onto that count
do twitch bots shard or something? Idk
Judt relad cache everyrime a stream offline
i do that already
and if offline streams were fucked i wouldnt be getting 390/2000
i'd be getting 2000/2000 or something similar if that were borked
so the streams are definetly being properly tagged as offline
and since it happens at the same time,viewer_count should also be setting to 0 and not adding onto the sum
see the issue now?
c?.viewer_count =0
i couldnt find any bugs here, hence why i'd like someone proficient with Ts to take a look see if they can spot something
?
Wtf
what?
It sypposed to work
Just fetch the channel ehen in loop

i am doing that
i cant loop 2000 channels without wrecking the api
i need to cache them
Or just use tsitch stat api
just like lie about the stats smh
you arent getting the point
make a static number

solution 10/10
Make final value
Public static final
Idk whats wromg
then why'd say this
Public static final
and the viewers update too
AAAAAAAAAAHHHH
the tracker website does say it has room for deviancy but still, we talking about 1 million here

With a difference that large, I'd consider rereading their docs to ensure what exactly those numbers mean. Sometimes the numbers mean something different (like total viewers over the last hour vs right now)
the twitch side is 100 fine
though the tracker site seems to be WAAAY too off @faint prism
and im storing them as id,theres no way i got duplicates either
it says now
then i refresh and its almost half of what i got
like wtf
Are you using a library or an API directly
Are their docs not giving any insight?
Might want to open chrome dev tools and figure out where that 1.9m number is coming from
the formatting is fine, the responses are fine, the cache is fine, but thats way too much difference that im starting to doubt my code
wdym chrome/
?
It's the same thing I did with @Awesome's gta map help
oh
i see what you mean, holdup
in the tracker
im 100% sure its fetching from their lib
doubt they have it open source
api*
Well, if it's client side and it's loading something from their API with some JavaScript code, you should be able to use that get request for your own number
If it's server side, you'll probably have to do some more digging
Ping me tomorrow and I might be able to help you out if you haven't figured it out
yeah they dont ping the twitch api
its all handled internally on their end
twitch doesnt offer 'stats'
also
Lol
Scrape
Well scraping would be the only way to combat server side rendering.
And if you can't do that, hopefully it's client side rendered from an API request
they claim to be tracking every stream with 5+ concurrent viewers
mine is pulling the top 2000 streams
and im getting higher values
either theirs is way off than they claim, or mine is
Or they api is shit
either they are wrong or im wrong
twitch api as shit as it is,its somewhat stable
for this case at least
Figure out where the number is coming from on that website
I'll have to look later I'm in bed now.
Hmu tomorrow I'll look into their API
What even is the difference between synchronous and asynchronous programming
@earnest phoenix sync runs in sequence, async waits for a call before continuining the code to make sure the value is retrieved
Aliases exist
@opal plank ty for explaining, is it possible to have async in sync?
@naive elk uhhh what do you even need help with
@opal plank ty for explaining, is it possible to have async in sync?
@earnest phoenix yes
He want to implements command aliases
and vice versa
callbacks
@earnest phoenix no not aliases
Store the last used command for that user
If it.couldnt find a command, then yeah
@earnest phoenix basically all unknow commands get redirected to the last used command
@naive elk check if the command is not a valid one and if it ain't get the second last message of the user and run the command from it
if it cant find the command,dont run anything
@naive elk heres simpler one
no?
So
Eveytime someone run command
Store it into a list of data
and when command isnt valid then get the command in that data list
And run it
its bad practice to do that btw
Yeah
you shouldnt run commands on wrong commands
Why not just don't do anything when a command is wrong
-askhfgajs shouldnt run -help
if the user wants -help, they'lltype -help
dont do anything on wrong commands or you might catch false positivies
Yeah
if the command exists, run it,else,do nothing
Talking about command
How do edit command work?
what
Where when you edit message to diff command
It edit the thing

Aka

the event in discord.js
listen to either message or message_edit events
message edit should send both old and new message
No, i didnt mean that
And how do we get which message to edit?
@earnest phoenix the second parameter is a callback function
No
I mean

inside the callback function the first argument is the message
here let me do it in flowchart or what ever
hmmmm okay
The event detects when a message has been edited it does not edit a message directly
So
-
run command
-
Send embed -> msgtoedit
-
edit the thing
-
edit msgtoedit
-
you
-
bot
->define
wait
ik the docs for that
types
seriously don't get anything do i
Ah too much to make, skio
i type -help
Bot sends embed
i edit message to -ping
bot edits the embed to -ping output
how do i return a value from an async function to a global variable to be used in other operations
global vars bad
so far i only get undefined

no,just globals in general bad practice
you'll clutter your work
pass the variable whenever its needed
i think i figured it out
like d.js, it attaches client onto message for easy accessibility
well then how do i have a function that can return mongodb field values outside of the function
im just trying to store custom prefixes
why not have customizable prefixes
attach prefixes on client if you want it accessible somewhere
i never said db.call brings a string
it can be an array
an object
what if prefixes is a map/
map the guilds and set all prefixes to your default
then update the values when you do your database call
How can I shard my boot with logs?
how would that store the values for each server
How can I shard my boot with logs? @opal plank
cause isnt map non persistent
ShardManager for DJS
hence why you save your prefixes in database
thats why db.call is there in that snippet
databases are persistent
memory only lasts while your bot is online
the moment your bot process crashes it loses the memory
yea
or better yet, just map the guilds that have custom prefixes
dont even set the default prefix
thats what i did but all inside mongo
server collection for server info including prefix
so whats the issue?
im having issues returning a value from the async findOne
you cant just set const to a mongodb findOne
ok
Is a command that adds a role to mass members is allowed?
like it can add a role to 50 members.
yes
can u tell me the code is of which language compiler??
static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "Playing Solo";
discordPresence.details = "Competitive";
discordPresence.startTimestamp = 1507665886;
discordPresence.endTimestamp = 1507665886;
discordPresence.largeImageText = "Numbani";
discordPresence.smallImageText = "Rogue - Level 100";
discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657";
discordPresence.partySize = 1;
discordPresence.partyMax = 5;
discordPresence.joinSecret = "MTI4NzM0OjFpMmhuZToxMjMxMjM= ";
Discord_UpdatePresence(&discordPresence);
}
looks c to me
c or c++
Using mysql as database, how do I delete something from a table, specifying multiple columns?
Can my dashboard be typescript and my bot be python?
I mean, why not? A dashboard just interacts with a DB on the backend, doesn't matter what language is writing to said DB
I mean, why not? A dashboard just interacts with a DB on the backend, doesn't matter what language is writing to said DB
@earnest phoenix facts
Great lol
Also with mongo, how can I basicly like check a db (mongo) and see like if this is on or not
And if it’s not on just ignore a piece of code
Wait
Can I do, if var = true does this?
should work
@misty sigil I mean I’d check the guild settings?
I’ll sleep tho
reeee dont do that
use database for startup
keep something like redis or in memory
@drifting wedge
no
@tight plinth hey expert
amm ok so, me and my friends have a bot in 630 guilds, the "message" event and any other event is emitted like after 5-7 seconds from where it was created (big delay) and when we are switching to Eris its working with no delay, is there a reason for that ?
so be fast plz
oh
amm ok so, me and my friends have a bot in 630 guilds, the "message" event and any other event is emitted like after 5-7 seconds from where it was created (big delay) and when we are switching to Eris its working with no delay, is there a reason for that ?
@earnest phoenix What was the first lib you were using
cause d.js bad
^
@earnest phoenix your answer
also use sharing k thx
Are you using shards
we doing lawyer role play now?
d.js bad
this is only because of its aggressive caching
otherwise it is actually an ok library
use d.js-light
yeah i switched and i barely cache now
much better
it has beeen 2 weeks my bot dint get verified ☹️
customisable caching
my bot currently uses like 20mb ram
i like agressive caching, no need to fetch barely anything
😶

you may/may not need caching depend on what you do
discord.js light hot
remember that a lot of things in development are subjective to their specific use cases
you can choose to only cache a few things u need
instead of everything being shovelled into your mouth
Just
2- Fetch whatever needed on usage of a command or whatever
3- Repeat```
even if the cache does get cleared you'll still see a memory leak
i know this from years of experience with both discord.js and eris
is javascript memory-safe
and 101 other jokes you should tell yourself
lol
thats honestly a question that i dont have the answer to but generally speaking its hard
Is any programming language memory-safe
yes
L
all high level languages are
there are a few

wtf is that troll emoji
troll artistic
@earnest phoenix 
agressive caching, yummy
☹️
goddamn
Thats the fucking truth
125GB ram
It take time
can I have it

i use a vps in brazil now
Just buy a nasa computer
Did you think a fucking human can fucking approve 10k bot in 1 second?
commands are faster and more responsive
come to brazil
Did you think a fucking human can fucking approve 10k bot in 1 second?
@earnest phoenix If you're not lazy, you can in 1 hour


Go to Brazil, gain power and do
i could just not cache at all
I cache enough that my commands are responsive
that is an option
discordgo
i built my bot to be able to run on even vpses with extremely low memory
it needs like 5 mb max 
i cache all intents except guild presences, and dm and guild typing

hence why its currently using 8% of 125gb
@opal plank How many guilds with that much caching
and my bot runs at like 20mb
come to go we look like javascript but perform like rust (with gc)
thats twitch,i dont have handy my d.js node exporter rn

2k streams
that's with no users in cache
as soon as you stop caching users you see that kind of behavior
My bot with no users in cache
535MB rss in use
then youre doing something wrong
Whew
mines 157MB
Only the user ones
that's..
im using 442Mb but most of it its my fault,not dj.s
im caching things for twitch too on that
heh
the aggressiveness of caching in all js libraries is cringe
total all bots are using 1.3Gb
let us expand the scope of this issue
Do y'all think this is a good three lines of code to waste two hours on
Basically this makes it so no matter what way you mention the user be it a ping, id, half the username the bot will be able to get it 80% of the time
args[0] is the command and args[1] is the username
if (args[1]) { var user = message.mentions.members.first() || message.guild.members.cache.filter(m => m.user.id == args[1]).first() || message.guild.members.cache.filter(m => m.user.username.startsWith(message.content.substring(`C-profile `.length))).first() || message.author; }
if (!args[1]) { var user = message.author; }
if (user.user) { user = user.user; }
first problem
var should be const
second problem
you put your prefix (case-sensitive) in the same string as the command
bro we are in 2020 we be usin let/const es6 style
no var
why those brackets
also
cringe
why the {
@earnest phoenix yall know that yall can use my utility which do 90% of your code?
combine those filters
this is why npm bad

into one
user.user
app.get('/', (req, res) => res.send(html));```

how to make work?
why the {
@misty sigil "lexical declaration" in an if statement without{}throws an error
another problem i see with node's garbage collector is that it is not aggressive enough
no
one liners are valid
can't use let
don’t use let in if
i am compiling for dumb
aaa
this is the visualizer code....which is written in c so every bot is made by c only...
static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "Playing Solo";
discordPresence.details = "Competitive";
discordPresence.startTimestamp = 1507665886;
discordPresence.endTimestamp = 1507665886;
discordPresence.largeImageText = "Numbani";
discordPresence.smallImageText = "Rogue - Level 100";
discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657";
discordPresence.partySize = 1;
discordPresence.partyMax = 5;
discordPresence.joinSecret = "MTI4NzM0OjFpMmhuZToxMjMxMjM= ";
Discord_UpdatePresence(&discordPresence);
}```
if i use let it will stay inside the if statement and won't be available outside
dont use let in if
you can use let in if, its just that let is restricted to the current scope vs var
yea
do y'all think i am dumb enough to not know that yes i am dumb 



how bout declaring it outside?
@opal plank how the hell
what
this is the visualizer code....which is written in c so every bot is made by c only...
static void UpdatePresence() { DiscordRichPresence discordPresence; memset(&discordPresence, 0, sizeof(discordPresence)); discordPresence.state = "Playing Solo"; discordPresence.details = "Competitive"; discordPresence.startTimestamp = 1507665886; discordPresence.endTimestamp = 1507665886; discordPresence.largeImageText = "Numbani"; discordPresence.smallImageText = "Rogue - Level 100"; discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657"; discordPresence.partySize = 1; discordPresence.partyMax = 5; discordPresence.joinSecret = "MTI4NzM0OjFpMmhuZToxMjMxMjM= "; Discord_UpdatePresence(&discordPresence); }```
@silk chasm ?
just let thing; isn’t it
let thing;
{thing = 1}
thing
currently my bot is at 44mb
f
gonna let it run for a bit
is that a secret leak?
currently
now leave it running for one week and report back

rich presence doesn’t have to be in C
no thats an example copy pasted from the discord api
ah, i see

aight,time to go sleep
your bot shouldnt be consuming ram at all rust doesnt have a gc

where is that number coming from wtf
Quicko updated code:
let user;
if (args[1]) { user = message.mentions.members.first() || message.guild.members.cache.filter(m => m.user.id == args[1]).first() || message.guild.members.cache.filter(m => m.user.username.toLowerCase().startsWith(message.content.substring(`C-profile `.length).toLowerCase())).first() || message.author; }
if (!args[1]) { user = message.author; }
if (user.user) { user = user.user; }
global heap size?
app.get('/', (req, res) => res.send('Hello World!'));
how do i change hello world to index.html?
how are you reading it
so yeah its global heap

just fixed some unnoticed errors in my code
message.mentions.members because the command is restricted to one server
m.user.username.toLowerCase() and message.content.substring("C-profile ".length).toLowerCase() so the command is in-case sensitive
yeah that's it
i feel like a god now
how do I put html in node.js using Express???
so im tryna print some bot stats but it is returning nothing
const client = new Client({ disableEveryone: true });
console.log(client.uptime);
console.log(client.guilds.cache.size);```
(console log is empty)
how do I put html in node.js using Express???
@carmine summitres.sendFile("path/to/file.html");
i use this to get current bot memory
API documentation for the Rust Process struct in crate heim.
TypeError: path must be absolute or specify root to res.sendFile
bro ive honestly been baffled at how this gathers memory information
is ./index.html a correct file path
how do we get ID of the user who voted
i dunno
i should probably get both and display both eh
anyone knows how topgg api works or any docs?
and its named ./index.html
If i have done my bot programming how do i apply that file to discord application??
If i have done my bot programming how do i apply that file to discord application??
@silk chasm Code, use a function to log in under a certain token in the code
Get the token from your bot's application page, use it
ohk...thanks...
Tried without ./ yet? :^)
Imagine not allowing relative paths
does node not allow relative paths?
I assume it would, but I don't use node at all
yea
Edited even more and now it's almost accurate (accurate means completely correct iirc)
let user;
if (args[1]) { user = message.mentions.members.first() || message.guild.members.cache.filter(m => m.user.id == args[1]).first() || message.guild.members.cache.filter(m => m.user.username.toLowerCase().startsWith(message.content.substring(`C-${args[0]} `.length).toLowerCase())).first() || message.author; }
if (!args[1]) { user = message.author; }
if (user.user) { user = user.user; }
someone have a Giveaway Script ?
but then again, react is compiled
someone have a Giveaway Script ?
@earnest phoenix spoonfeeding
we won't just give you code
we can help withs tuff
Edited even more and now it's almost accurate (accurate means completely correct iirc)
let user; if (args[1]) { user = message.mentions.members.first() || message.guild.members.cache.filter(m => m.user.id == args[1]).first() || message.guild.members.cache.filter(m => m.user.username.toLowerCase().startsWith(message.content.substring(`C-${args[0]} `.length).toLowerCase())).first() || message.author; } if (!args[1]) { user = message.author; } if (user.user) { user = user.user; }
@earnest phoenix Why to use filter()?
You can use find()
what
that existed
WHAT
@earnest phoenix send docs pls
hello anyone help with this "stack": "TypeError: Cannot read property 'author' of undefined that error
@flint yew show the code
okay
@earnest phoenix go to Mozilla Developers Network
Array.prototype.find(...fn)```
bruh
k
ok i gotta actually develop now
@earnest phoenix go to Mozilla Developers Network
Array.prototype.find(...fn)```
@earnest phoenix bruh it's a collection not an array
discord.js collection
Have you realized you can use find on a collection
yeah
Also filter
||
||

@earnest phoenix https://hastebin.com/ributenibi.js
rss is at 60mb, vms is at 270mb
@earnest phoenix u here?
async run(message, args) {
const { text } = args;
const m = args.message;``` why
Give him time to reas code bruh
@earnest phoenix ?
Getting the message object from args
async run(message, args) {
const { text } = args;
const m = args.message;
const msg = await message.channel.send(`🔄 | Reacting to **${m.author.username}**'s message...`)
for (const c of text.toLowerCase()) {
if (c in map) {
try {
await m.react(map[c])
} catch (err) {}
}
}
return msg.edit(`✅ | Successfully reacted on **${m.author.username}**'s message with ${text}!`)
Isn't efficient and incorrect
error here
yea
k
Literally
what
WHY THE HELL const m = args.message;
okay
args is an array
@earnest phoenix If you’re going to try to help, be less of a dick
@earnest phoenix "stack": "TypeError: Cannot read property 'toLowerCase' of undefined
new error
now
have you tried reading the error
Show the error's full stack trace
for (const c of text.toLowerCase()) {
if (c in map) {
try {
await m.react(map[c])
} catch (err) {}
}
}
uhh const c?
text is undefined
@earnest phoenix do you even know js?
"stack": "TypeError: Cannot read property 'toLowerCase' of undefined
at ReactCommand.run (C:\Users\...\YK303bot\src\commands\morefun\react.js:40:30)
at processTicksAndRejections (internal/process/task_queues.js:97:5)"
making it a constant isn't an issue
Extending text from args is invalid
@earnest phoenix do you even know js?
@earnest phoenix not a lot but i am willing to learn more instead of f around complaining about someone
const { text } = args;``` this doesn't make sense
is that the same as args.text
You cant destructure text from args
args is an array not an object
Since it doesnt exist
Whats diffrent from const and let amd var
Like
const and let are block scoped while var is not
We can ude all of them without problem
Const cant be reassinged, let can, and var is just messed up
Ah
okay
const works in for-of, no?
Not sure tbh
I usually use let
is there a way to define a let variable that can only be used inside it's code block and like a const it's value cannot be changed
soo how to fix that like guys i am stack
1- const is assigning constants and can't be modified and is block scoped
2- let is assigning variables that can be modified and is block scoped too
3- var assigns variables but it isn't block scoped``` @earnest phoenix
I wouldnt use var unless you’re working on client end js (browser js)
I hack my website user PCs using browser js 
JavaScript is worse outside of file:// protocol
Very funny
soo how to fix that like guys i am stack
@flint yew Just
const { text } = args;to
const text = args.join(" ");```
Also I recommend reading about javascript arrays and javascript objects
@earnest phoenix thanks
Arrays are basically objects with an ordered list i don't get it
Arrays are way different than objects, they just don't have a special type
In js basically
yeah
async run(message, args) {
var output = ''
for (let c of args.text) {
if (c in map) {
c = map[c] + '\u200b'
}
output += c
} soo args.text also wrong yea?
that why getting that error
if you run run() without passing an args parameter'
"stack": "TypeError: args.text is not iterable
f
Just args
ahh
args is an array, you can iterate over those
args.text is UNDEFINED, because a property text does NOT exist in arrays
ahh thanks
As you tried args.text
Array.prototype.text``` would always be undefined unless you overwrite it's prototype
Why is js such a pain in the ass with its undefined crap
ye xd
Why is js such a pain in the ass with its undefined crap
@slender thistle Python is the same withNoneTypeor whatever that is
Not exactly per se
@slender thistle it isnt lol, people just need to not use non existing properties
It does error out when you try to access a non-existing property
What do u want it to do
why message.say is not a function
discord commando?
there's also message.channel.send
commando is different
const { sayMessage } = args;
if (sayMessage == 'N////A') return message.say('Please specify something for me to say!');
message.delete();
return message.say(sayMessage).catch(console.error);```
This is probably one reason why I don't wish to use JS for anything that's not frontend
even when change .say
do you have the smallest hint of idea how many times ive typed message.say?
?
discord commando?
@flint yew
other libs that i use has that method
kek
i use discord.js
Ngl i wish people who didnt know js or djs would be yeeted from here
Its annoying when people wont listen to: “go learn js”
@earnest phoenix what'
I have no idea why would someone name the send function as say
Message.prototype.say()``` is kind of a non sense
Ikr
@flint yew I meant do you use commando
yes
channel.say would make some kind of sense imo
It's not tho, it's just message.say
as an alias, at least
.reply is fine
.reply








