#development
1 messages · Page 1571 of 1
and then checking if it includes ] in it
more logic but would likely be faster if not on par with regex
You could also iterate through the whole string
thats an option too
let pos = 0;
let inPlaceholder = false;
let lastPropertyStr;
let val;
for (; pos < str.length; pos++) {
if (inPlaceholder) {
if (str[pos] === ".") {
val = obj[lastProperty];
lastPropertyStr = "";
}
else if (str[pos] === "]") inPlaceholder = false;
else lastPropertyStr += str[pos];
}
else if (str[pos] === "[") inPlaceholder = true;
}
This is the first thing that comes up in my mind. Not sure if it's faster than regex or just doing a ton of splitting but it's an option
let entries = [];
let temp = '';
let str = string.slice(0,string.indexOf('['));
for(let c of string) {
switch(c) {
case ']' : if(temp.startsWith('[')) { entries.push(temp); temp = '' };
break;
case '[' : temp = c;
break;
default: temp+=c
}
}
for(let e of entries) // entries.split('.')
remove previous unused chars before string
then simply keep adding until it hits a ]
when it does, clean the temp and push it to entries array
also check if it starts with [
actually

that wont work
there
let me test that rq
yup, works fine
let string = args.join(' ');
let entries = [];
let temp = '';
for (let c of string) {
switch (c) {
case ']':
if (temp.startsWith('[')) {
temp += c;
entries.push(temp);
temp = '';
}
break;
case '[':
temp = c;
break;
default:
temp += c;
}
}
console.log(entries);
@tight plinth
probably best to try a performance test
not sure how my regex will od against that
since im doing capture groups it should be a bit less performant
const msg = message.content.toLowerCase();
const afterowo = msg.slice(3).trim().split(/ +/);
function checkCommand() {
return afterowo.includes() === list;
}
// Counting code
if (msg.startsWith('owo')) {
if (list.some(checkCommand(afterowo)) === true) {
message.channel.send('That was a command.');
}
else if (list.some(checkCommand(afterowo)) === false) {
message.channel.send('That was not a command');
}
Could someone help me fix this I keep getting the error that false is not a function
i guess you didnt understand what i said yesterday
if(list.some(itemFromList => afterowo.includes(itemFromList)))
if you want to convert that to a function, then the argument has to be on the function side
function checkCommand(itemFromList) {
return afterowo.includes(itemFromList)
}
ok
then you can do list.some(checkCommand)
How would I do the item from list?
May I propose an alternative, if you are doing a performance test try this one too
that sounds interesting
gives you some more flexibility with error messages, too
How do I do the item from list part?
its a variable, you literally name it whatever you want
Ok
My problem was that the eslint was telling me not to have function checkCommands(list) because list is declared in an upper scope, but when it is not there it fails
Ty
@cinder patio can you dm me the code you made? trying to copy code from a screen shot is pain

yea sorry
Is there any way to fix git pull while my processes are handled by PM2? When I run my update command I get one message returned, but other than that nothing happens and it doesn't return any errors.
are we running performance tests?
I just implemented function calls because I love procrastinating
:^)
YES
should i join?
lel
ex dee
If by that you mean you do em, yes please :^)
HEHE ```Your bot is 40% close to being reviewed. When your bot is accepted or declined you will receive a DM from Luca in our Discord server.
POG
congrats
Fixed, I needed to update PM2 and NPM.
@shut carbon Congrats mate.
Good luck on your journy!
How can I get it so that if any part of a message contains a word it detects it.
For example:
"jdjdjdjlolhshsh"
It would understand that the message had lol in it.
try this @cinder patio @tight plinth ```js
function replace(string, object) {
for(let index = string.indexOf("["), n = 0; index > -1; index = string.indexOf("[", n)) {
const end = string.indexOf("]", index + 1);
const extracted = string.slice(index + 1, end).split(".");
let val = object;
for(let i = 0; i < extracted.length; i++) {
val = val[extracted[i]];
if(!val) break;
}
string = string.slice(0, index) + val + string.slice(end + 1);
n = end + 1;
}
return string
}
+ var + que?
Doesn't that only allow for one placeholder, so you'll have to call the function multiple times
if there are multiple placeholders
ooh I see
this is basically the code i use in my FTSet lib for manipulating strings lul
performance is almost the same as native arrays
Nvrmd I got it but forgot to save 
That's 10k iterations though
well whats it is with 10 iters
Should I also test em in different consoles?
probably ¯\_(ツ)_/¯
@quartz kindle Tested on google chrome
Wait yours does a check if the value is undefined, mine doesn't, guess I'll fix that
Still the same
yall just working on the replace object right?
yeaah
how did mine rate for the actual parsing of the entries?
between my regex and the function
I managed to implement function calls 
oooh
I dunno you didn't provide complete code so I didn't test it
can you link the message
It’s my discord giveawaybot
right here
@slender thistle ads ^^
or, attempted ads 
also giveaway bots
sketchy
anyhow
@cinder patio just replace args.join with your thing
@limpid topaz Don't advertise
Sorry
But @slender thistle can you tell the owners that I’ve just added my bot to top.gg
just be patient
We will review it when the time comes
Ok
lol
Your code only finds the placeholders, doesn't actually replace em
yeah, thats the bit i was talking about
the rest is the function you guys are giving
specially yours
its just to replace provided an entry and an object, no?
it doesnt do the searching, per se
It does the searching and the replacement of the placeholders
same with tim's
thats kinda smart tbh
Hello, my bot don't working.
It is all that I have.
Oh, this code don't working too
var ds = require('discord.js');
var bot = new ds.Client();
bot.on('ready', ()=>{
console.log('Clear Maid app started');
})
bot.login('');
I started verification process yesterday
Are you getting any errors?
Your filling in the token right?
Did you save the file?
And it working
sea
Yes, I also want to swim in the sea now, and not to f**k with this stuff
@cinder patio try this
function replace(string, object) {
let res = "";
for(let index = string.indexOf("["), n = 0; index > -1; index = string.indexOf("[", n)) {
const start = index + 1;
const end = string.indexOf("]", start);
const extracted = string.slice(start, end);
if(!extracted) continue;
let val = object;
for(let i = extracted.indexOf("."), t = 0; val = val[extracted.slice(t, i > -1 ? i : void 0)]; i = extracted.indexOf(".", t)) {
if(!val || i === -1) { break; }
t = i + 1;
}
res += string.slice(n, index) + val;
n = end + 1;
}
return res
}
on it
Around 0.10ms (10 iterations)
Sometimes 0.11, sometimes 0.10, sometimes 0.9
on 10 iterations i get 0.02 here lmao
Brave?
function replace(str, obj) {
let inPlaceholder = false;
let lastPropertyStr = "";
let val = obj;
let res = "";
loop:
for (let pos = 0; pos < str.length; pos++) {
if (inPlaceholder) {
switch(str[pos]) {
case ".":
val = val[lastPropertyStr];
if (!val) break loop;
lastPropertyStr = "";
break;
case "]":
res += val[lastPropertyStr];
inPlaceholder = false;
val = obj;
lastPropertyStr = "";
break;
default:
lastPropertyStr += str[pos];
}
}
else if (str[pos] === "[") inPlaceholder = true;
else res += str[pos];
}
return res;
}
urs a lil bit faster
interesting
disable gc 🧠
what engine does Brave use
okay wait
xD
not all users get cached 👀
laughs in 128gb of ram
Beauty of discord mobile
32 cores smh
I'm jealous
cant wait to completely port it
even though I don't have anything to do with all that RAM and cores
port what
you're getting that startup cause of all the initial fetching probably
1600 server using 3gb is unconciveable dude
those 2 tests of startup were on my test bot
not on the main
thats the thing
the one that caches MORE took LESS time
look at users
just port it to WebSocket
the total is just all users across all guilds, the second one, users, is all in cache
yet it takes longer to finish

@quartz kindle what do you have to say in d.js's defense and in favor of your lib?

is d.js v13 not out yet?
nopw
I'm waiting for slash commands to come to d.js in particular
you mean the starting time? there is a minimum of 5 seconds delay between each shard, besides that none of my single shard bots take 10 seconds to load lol
prob not worth it tbh, not until they add some stuff that im not sure im suppose to comment about, so imma leave it at that
implement your own is the best bet so far
cuz it'll be changing soon
they're worse than doing command handling through the message event
the only advantage you get is two whole entities are parsed for you and you get a fancy UI
I think it highly depends on what your bot does, and slash commands are perfect for one of my bots, currently I'm in the middle of rewriting it with slash commands, but I'm waiting for the official release instead of doing hacky stuff
thats all i can say tbh
not only for js, a lot of libs arent adding support for slash commands yet
they'll be worth it once discord implements more UI related stuff - the shit they showed in the prototype (polls, interactive embeds etc)
yeah thats the thing i wasnt sure i was suppose to talk about
don't know whether the question should be when or if
they're known to not exactly own up to their promises
I mainly want to switch to slash commands because of the client-only replies and the ability to hide the arguments of a command, makes the chat way less cluttered for a game bot like mine
I'm currently using the private discord.js api methods
if, actually, WHEN changes come, you can simply edit it yourself without relying on a broken lib until they update themselves
Also, you cannot add attachments to interaction responses currently, so the bot's development is in limbo until discord implements that lmao
I can't use webhooks because I want to make the response client-only
you can send the usual way an embed though
or followups, however discord calls em
I don't think you can, it still needs to be an attachment
as in, message.channel.send(attachment) instead of respond the interaction
but then it's not client-only
Who here knows about shards/sharding. My bot is in 170+ servers so obviously I don’t need it rn but I just wanna be prepared. How do I do that?
that's the thing
Upload the image somewhere else first and use the URL to embed it
can someone teach me how to use SQLite with JavaScript??
that's too much work
fair
It's not
I'm not sure about that
dm me if you want
Tim is basically your living StackOverflow
just 9.99
tis a bargain
coaches hate him

||Im not sponsored by Tim(but you can if you want to Tim, wink wink*)||
but nicer
Welcome to the shop dev!
Here we have some nice packages that can help you in programming.
Introducing Tim pack (Extremely rare)
Tim pack
• Will help you a lot
• Chance of becoming friends with him
• 10 question a day
↓
$10
Tim pack premium
• All the previous pack features
• Will help you even more and might even spoon-feed
• Will become friends
• Share his secret knowledge of how he became a living StackOverflow
↓
$50
Tim pack: the ultimate StackOverflow edition
• All previous pack features
• Constant spoon-feed, will do anything
• He might write your projects for you
• Might plan to meet you in real life
• Might give you shout-outs
↓
$NaN
this is gold
indeed lol
LOL
not bad xD, probably I have loan for @Tim#2373 , he gave me so much help lol.
I think you went a bit overboard with $NaN, I don't have that much money 😔
are there any good services that will alert me when by bot goes offline. is there an api i can call to see if my bot is online?
pm2
lol
pm2, grafana, forever, theres a lot of tools that would do the job just fine
i would recommend pm2
just make a heartbeat log and then use grafana to see if that heartbeat isn';t there?
forever will actually prevent you bot from going offline by attemping to restart it, pm2 is a proper monitor, grafana is what i use since it can do http requests and handle errors by sending me message or some shit
statsd
grafana has an alert feature, i usually just ping my api, on error => handle whatever you want
sending messages on whatsapp, mail, discord, whatever you want tbh
though its quite hard to setup
thanks, i'll try that out.
i use statsd/grafana at work
i use to. now we use pagerduty
i still prefer elk + grafana for most monitoring
< grafana
doesn't grafana show a little alarm bell on the graph if there is an alert setup
@quartz kindle imma buy Tim pack premium but I will pay in hugs
i think so yes, though i dont have it setup on this panel
**
ERROR:
Discord API Error encountered.
Invalid "code" in request.
LINE:
/* LIBARYS */
const express = require('express');
const router = express.Router();
const Cookies = require('cookies');
/* OWN FILES */
const authClient = require('./../javascript/auth_client');
/* GET DASHBOARD ROUTER */
router.get('/dashboard', async (req, res) =>{
const cookies = new Cookies(req, res);
const code = req.query.code;
try
{
const key = await authClient.getAccess(code);
cookies.set('key', key);
res.redirect('/dashboard');
}
catch (err)
{
res.redirect('/401');
}
});
module.exports = router;
**
Why bold markdown 🗿
marcodown
Oh, hi Mark Down
imagine naming your son mark down
that looks sick
wait how do you even
also I doubt the error is coming from there
**
console.log('hello world');
**
**```js
"nice"
how can i do
why would you want to do that?
um
-_-
{
if (num % 2 == 0)
// jump to even
goto even;
else
// jump to odd
goto odd;
even:
printf("%d is even", num);
// return if even
return;
odd:
printf("%d is odd", num);
}
int main() {
int num = 26;
checkEvenOrNot(num);
return 0;
} ```
i think that's c or c++
imagine if he copies that code and he's using js 👀
Why are you assuming they're using C++
i dont assume they want to do that
because it's most likely
I don't think anyone who knows C++ will be asking that question, lmao
what lib are you using?
nvm
That message is global right? you cant have it set to different phrases for each discord server
ok 🍗
that looks modern than c lol , possibly c++
goto statements are like switch statements. they should never be used The use of goto statement is highly discouraged as it makes the program logic very complex.
also if/else statements
lol , yes they are
they are needed for basics
if/else and switch statements get compiled down to that, so yeah, also you should use it only when you have no other options
the docs are not good
that was the first google result about it
that's horrible imo ```c++
auto even(int num) -> bool
{
return num % 2 == 0;
}
auto main() -> int
{
int num = 26;
std::cout << "Number " << num << " is "<< (even(num) ? "even" : "odd") << '\n';
return 0;
}```
far more better
i like it
it was an example of how goto works lol
oh
lol
someone wanted to use gotos
but in what language?
they didnt say
well if it were C it's fine. in other modern languages there should not ever be need even to use them
if (me > 1) {
bla bla bla
if (me > her) { // this and
bla bla bla
}
else { // this not working
let jumpTo = 25
const index = Math.max(jumpTo - 1, 0);
cache.index = index - 1;
this.callNextAction(cache)
}
}
else {
//if the variable isn't the value, do this other js here (dbm false)
let jumpTo = 37
const index = Math.max(jumpTo - 1, 0);
cache.index = index - 1;
this.callNextAction(cache)
}
lol
They're using JS
Also what is that weird return type notation
it's "modern" C++
bruh
well i like that wae and in one discord 90% of people prefers it that way
well yeah not really
this instead of return this;?
use std::io::stdin;
fn read_line() -> i32 {
let mut input = String::new();
stdin().read_line(&mut input).unwrap();
input
}
yea
I don't mind it, but I'm used to using return so I'll stick to it
makes sense
yes
mehh i'll stick with c++ and some other random good programming old-school languages what are older than 2k century
scala does the same thing with returning the last line
I'm not really a fan of rust tbh
scala lets you do this. val x = if (true) "A" else "B"
basically a lambda i see
Where do i order? 
fn is_big(num: &i32) -> &str {
if num > 100 {
"yes"
} else {
"no dumbass"
}
}
Tim's DMs 
bool is_big(int num) { return num > 100; }```
returning a std::string, basically C++ string in a function could become expensive since yes
just better to return boolean
wait i dont even need ternary
no 
k
is there ternary on rust?
kinda
but it's more ugly
thing = if condition { something } else { somethingElse }
ok same as kotlin then
you can do weird stuff with rust
i always thought the ternary operator and the OR operator should have the same level of precedence
let thing = {
let i = 2;
i + 1
}
// thing is 3
smh thats too weird for me 😰
ffs, my ts compiler just screamed looking at that snippet Cholo
val twentySomethings =
for (user <- userBase if user.age >=20 && user.age < 30)
yield user.name```
imagine compiling rust with ts
well ugh u can do lots of weird stuff in C++ too but it's highly not recommended to do them in modern C++
lowkey, js might actually let that pass
nah
js isn't that weird
no because you return i + 1
so it returns i + 1
i++
and the return value goes to thing

yes rust is weirdish compared to other popular langs
i was joking, dont quote me
jaava
++
++
4 pluses aligned like this and made italic looks like a hashtag so that's the whole premise behind it being named c#
we don't talk about java 
c, c+, c++, c+++
java, jaava, jaaava
js, jss, jsss
i think c# was made way after java
c#, c##, c###
there's f#
C# is microsoft's java
f#
Fminor
With mongoose, how would you change the Boolean value of something to just be the opposite of whatever it currently is?
i tried f#, i just couldnt get into it, functional languages are just LSD for programmers
So many languages with #
even C? 
what about binary
everytime someone mentions c i remember of this https://v.redd.it/bjofqqt4h2z51/DASH_360.mp4?source=fallback
is binary really a programming language though
i still have PTSD from cs year 1
jemalloc > malloc :^)
theoretically yes
jefree > free then?
well atleast it's data oriented
UE4 assets would like to talk to you
fucking unreal editor using more ram than that video mem usage
never
ever
lmao
they just forgot few free()'s
have you tried mimalloc?
what about opening every jetbrains ide at once?
kekw
i tried alt f4, worked beautifully
lmao
no more memory issues
forgetting free() in a recursive function 
smart pointers 🧠
this message has the same energy as having chrome, discord and spotify open at the same time
✨ chromium ✨
oh no
lets run electron 20 times, 10 for renders, 5 for process and another 5 for who the fuck knows what
so basically... a normal electron app
stares intently at discord
you can always disable hardware acc 
2021 seems like a really great year for chromium alternatives
like baidu
a lot of projects meant to rival chromium are coming out of alpha stages
lets be honest, firefox is the closest we'll get to a competitor to chrome
people dont usually keep up with the news, specially about browsers
well yeah
i still don't understand how people prefer chrome
ItJustWorks™️
even if it's for the styling alone you can modify firefox to look like chrome
that's what i did
its like arguing against windows vs linux in a sense
yes
yes
firefox is just bad, at least for me
edge is again, chromium
you should commit 
shit
(this)
edge tresh
firefox ✨ nightly
i mean edge ran faster than chrome for me
i always have issues with firefox, not rendering stuff correctly, css shadows on firefox are ugly af, firefox's js engine produces weird results...
thought im purely speaking from memes, i dont know if theres any big difference in performance for edge
but if firefox is faster there i go
i have not had a single bad experience with firefox
and i've been using it since 3rd grade
you're just used to it
firefox is amazing for css editing, though chrome is a lot better for debugging and inspecting shit
specially for memory analysis
agree on that
im used to chrome's rendering, so ff just looks weird to me
i use bRAve
say yes to chrome kids, stay in school
cus they give my PrIvaCy
no
JK brave is a scam 
I trust opera more than brave
Opera + mac = gamer combo
opera got sold to a chinese company :/
im using brave rn as well, but i was very apprehensive at the beginning
tim is brave
because there was a shitshow of chrome clones going on for a while
ba dum ts
Brave has been found to do more dodgey shit than what im willing to forgive
like wut
why dont we all unite under the clearly superior bloated chrome? 
dunno if its bloated, but holy shit the memory usage is high compared to other borwsers
mozilla seems to be the only company with good intentions tbh
even though they started pushing their own services through the browser but that's understandable as they're losing a ton of money
For a company that is supposed to be for privacy being found to inject their own referral links, lack of support for users, Brave's ad system ends up being that brave make the money instead of the website while you still deal with le ads, then theres the 2019 incident where they used to claim fundraisers on behalf of others which was... A interesting find.
at that point why not just any chromium browser with a ad block 
Putting your own ads while blocking websites ads is actually super sketchy imo.
it is INCREDIBLY Sketch
honestly worse than top.gg tbh
in there terms they have a clause which going back to the 2019 incident meant they could claim to be giving someone donations using your 'rewards' for seeing their ads and just had the right to keep the money because they are 'providing the service'
because brave is faster / less bloated
at least it was last time i measured ram usage and such
anyone tried iridium browser?
nop
but honestly I ditched brave since they got caught doing some of this stuff so early on
privacy my ass
a lot of browsers got cucked when google disabled google sync with other chromium browsers
mozzila as cry said are the only real development company that actively practice what they preach
i would use firefox more, but there are things about it i simply dont like
mm fairs
i have it installed for testing and shit
there's also ungoogled-chromium
heard its pretty good
Tim! Your library is golden
Seriously though, my discord bot previously would hover around 48% -> 55% and steadily increase until an update was pushed out to it. Now, it just stays fairly consistent between 40% and 43%
I took the fuction out of my main file and put it into its own json file. I have it declared, how do I get it to activate?
What function 👀
PS C:\Users\AKFar\Desktop\Chaos Bot> pm2 start randombot.js
pm2 : File C:\Users\AKFar\AppData\Roaming\npm\pm2.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
+ pm2 start randombot.js
+ ~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\AKFar\Desktop\Chaos Bot>``` why is this happening?
File C:\Users\AKFar\AppData\Roaming\npm\pm2.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.
const { list } = require('./owocommands.json');
module.exports = {
name: 'count',
excute(message) {
const msg = message.content.toLowerCase();
const afterowo = msg.slice(3).trim().split(/ +/);
// eslint-disable-next-line no-shadow
function checkCommand(list) {
return afterowo.includes(list);
}
const thisWord = 'owo';
// Counting code
if (msg.startsWith('owo')) {
if (list.some(checkCommand) === true) {
message.channel.send('That was a command.');
}
else if (list.some(checkCommand) === false) {
message.channel.send('That was not a command');
}
}
else if (message.content.includes(thisWord)) {
message.channel.send('👍');
}
},
};
:)
I want to have it alone to make it easier to work with and avoid having spaghetti code
how can i print the number in thousands?
ex: 20 -> 020
You're in the hundreds.
You could measure the length off the number in a string format (or just see what the number is) and prepend 0s as needed.
oh then if number lenght = 3 no "0" if lenght = 2 then add 0
ill try to make it with code
Quick question guys
adding onto that is this in JS or other lang
confirmMsg.react('✅');
await confirmMsg.awaitReactions(
(r, u) => r.emoji.name === '✅' && message.author.id === u.id,
{ max: 1, time: 60000, errors: ['time'] },
);
await town.upgrade();
The await confirmMsg.awaitReactions resulted in an error with DiscordAPIError: Unknown Message (basically, a user reported that deleting a message would still upgrade the town). It's odd though - shouldn't the error have been caught and not executed await town.upgrade();?
That is wrapped in a try/catch?
js
@quartz kindle yes
yourNumber.toString().padStart(3, "0")
thanks ❤️
I'm getting the error Cannot read property 'excute' of undefined
part of index.js:
// When there is a message detected...
client.on('message', message => {
// If the message was made by a bot ignore it
if (message.author.bot) return;
if (message.channel.type === 'dm') return message.channel.send('Sorry, no commands are run in dms.');
const { counting } = require('./countingfolder/counting.js');
try {
counting.excute(message);
}
catch (error) {
console.error(error);
message.channel.send('There was an error counting');
}
counting.js:
const { list } = require('./owocommands.json');
module.exports = {
name: 'count',
excute(message) {
const msg = message.content.toLowerCase();
const afterowo = msg.slice(3).trim().split(/ +/);
// eslint-disable-next-line no-shadow
function checkCommand(list) {
return afterowo.includes(list);
}
const thisWord = 'owo';
// Counting code
if (msg.startsWith('owo')) {
if (list.some(checkCommand) === true) {
message.channel.send('That was a command.');
}
else if (list.some(checkCommand) === false) {
message.channel.send('That was not a command');
}
}
else if (message.content.includes(thisWord)) {
message.channel.send('👍');
}
},
};
assuming its smart enough to return the original
excute
fairly certain you need to require everything
yes
dont destructure it
well you spelled them both wrong
you have a default export
I'm dumb 
your object doesnt have a counting property
name: 'count',
execute: message => {}
};```
don't do drugs and code at the same time
where counting in there ben?
your object has name and execute
so where is counting ?
const { counting } = require('./countingfolder/counting.js');
yes
this is trying to get the property counting from your export
only pads if needed
which, well, is not there
Ok
either import default or add a counting property/function on your object
ah, figured as much
Does anyone know if the different types of errors are documented?
await confirmMsg.awaitReactions(
(r, u) => r.emoji.name === '✅' && message.author.id === u.id,
{ max: 1, time: 60000, errors: ['time'] },
);
I need to basically catch all errors there. If I don't, it accepts the promise and continues on with the logic execution .. lol
that's not what its for
by default awaitReactions doesnt throw any error
that option is there if you want to force it to throw an error when the time expires
if you remove that option, it will not throw, it will just return
I know
I ran into a situation where I encountered a user who deleted the message that was being awaited. My catch(err) caught it; however, the promise was technically resolved due to this: https://github.com/discordjs/discord.js/blob/8a7abc9f06d44bf693e35a615bb6ba2c3eb1d6e7/src/structures/Message.js#L377
But can you force it to throw any other error besides if it's just time? What if the user deleted the awaited messaged?
DUDE! No way
I was on the exact same page.
Oh, wait. No I wasn't
Can you link me to the github page where that was?
this.stop(reason) -> I found that
there's also "time", "idle" and "user"
is this another "discord.js being special 2020" moment
Yeah, I found those at the link above. I appreciate you looking into that, Tim!
Do you still have this up? Where was it 👀
wow xD
looks like that i have some issues with settimeout, anyone knows why?
handleInterval is a function tho
it also happens to corrupt the entire db, but whatever, i'm still testing it 
setTimeout(() => { handleInterval() },...) fixed it
you can pass the function right away btw
setTimeout(handleInterval, x)
yeah thtat works too
makes it looks cleaner and shorter
i have somehow another problem. I have this code
and the function starts with this
somehow, i is undefined
but i need it
then you'd have to do it the way you wrote it
setTimeout just executes the callback
i dont think it passes anything
it can pass arguments to the function

How do I know how many servers my bot is in?
I have the Server Members Intent enabled, what do I pass through as my client options to enable them? Checked through the discord.js docs and tried Intents.FLAGS.GUILD_MEMBERS but makes my bot "not respond".
you need to pass ALL of the intents you need @earnest phoenix
Discord.js
guilds.cache.size
<client>.guilds.cache.size
assuming you have all guilds cached
if you're sharding or changed your caching behaviour, it will be different
I got it working thanks for the help Not Erwin, Thomas, and Tim
👍
Now I have to create the database system. I plan on storing counts on a server by server basis on a few different categories. Should I have it make a table per server and have the rows be per user and each column be different data? Or something else? (I plan on using sqlite)
why do you need that?
Table
| guild_id | count 1 | count 2 |
| 272764566411149314 | 10 | 30 |
| 412006692125933568| 13 | 1 |
That was my plan. Is there a better way?
idk what exactly you doing, so thats best i can offer
Ok
cd
you are in the smug folder
cd code
you are now in the code folder
cd ../
you are now back to the smug folder
cd ..

Also... Doesn't discord.js already know what send is?
or a User
clearly not
dont fight the compiler xD if it says it doesnt, 99.9999% its right, it doesnt
are you doing that in a DM?
console.log(message.channel) before that
.setTimestamp();
console.log(message.channel)
message.channel.send(embed)
}
```?
if that doesnt log anything, then your compiler is right, channel is indefined
then use console.log(message)
wait, did I put it right? its on onather line?
switch?
yup
sorry im dumb...
just check your command handler
im assuming he's passing something that isnt message
alr.
fairly certain you're passing something that isnt a message
fairly certain you're right
there you go
function arguments are passed by order, not by name
in the command file, you have message as the first argument
your first argument is Message, but you passing CLIENT
in the main file you have it as second
that would work, yes
but like i said, client is inside message
YIKES
WOWOWOWOOWOWOWOW! It actiualy works!
Thank you guys so much! I've been trying to fix this for like 3 hours now.
🙂
👍
👍
3fast5u
airbourne high five
_ belly slam_
Oh look
2 retards
^^
Its Erwin and Tim
flooding that chat with blue
Hell no
quick, just say some development related stuff to fool the mods
if(1 == 0) go to general
pls help why my bot no work
while(true) client.channels.cache.find((a) => a.name === 'development').send('stuffThatShouldBeInGeneral')```
pffff i let discord api handle my ratelimiting, like a true champ
buckets?
bucket is how much ratelimit you got, to put it very bluntly
they already do in the main lib
the 429's on gateway/bot are a bug afaik
Yea it is
its just annoying
since if discord force disconnects all 128 Shards on chip
its uh
not fun
to detritus?
link
3fast5u
ratelimit buckets search term
i finished rewriting the ones you wrote to the new format
gonna push soon
alrighty
you know making it so I can remote desktop into my pc was the best decision ive ever made sometimes
makes life so much easier when away from home
IKR!
uhh
if you can afford to run your home pc 24/7
bruh both ssh and remote desktop from mobile is a bliss
imagine not having a laptop pluged 24/7 on the wall
or is it just message log?
i do
my i put it in sleep mode
when not using
because electricity bills
i think i pay around 80 bucks/month with 3 pcs running 24/7
80 brl?
wake on lan exists
which is what I use
put it to sleep, send a WOL packet to my main pc from work
and then RDP
ez pz
does wake on lan work on wifi?
yes
Wait
I've had it work on wifi
idk if that was just luck based on device tho
there is also another remedy
you sent an empty hastebin... you didnt save it
If you have a spare mobile phone setup a USB Ethernet cable
yup
I make up like
368 brl
lmao
then use a different bin
try hatebin
or pastebin
or whatever, theres a shit ton of bins
vscode setting sync go brrrrrrrrrrrrr https://img.pyrocdn.com/hTsjmcSm
hey
const profanity = googleProfanityWords.list();
if (message.content) {
if(message.author.id !== client.id){
const profane = !!profanity.find((word) => {
const regex = new RegExp(`\\b${word}\\b`, 'i');
return regex.test(message.content);
});
}
if (profane) {
if(message.author.id !== client.id){
let m = insulter.Insult();
message.channel.send("<@"+message.author.id+"> "+ m)
.catch(console.error);
}
}
}
}```why is this returning me the error:

because you defined it in the wrong scope
how is that?
you have ```js
if() {
const profane
// profane only exists inside this block
}
// profane doesnt exist here
if() {
// profane doesnt exist here
}
owh
React or vue whats the best to learn first?
so i need to change the identation?
either indentation of declare it outside
how could I turn a number like this
0.9584867874
into
95.84867874
? (javascript btw)
you mean
- 100
*100
ah, yes, my abd
my abd
the booze finally starting to hit my brain
maybe
called it
I mean
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.
its 12:45 am after all
there we go
hold on tim
"hey guys i want help, but i want help from only one person and nobody else"
even then the pastebin syntax highlighting sucks lol
thats the console.log you added lol
oh lmao
lol
so
module.exports = {
name: 'kick',
execute: async(client, message) => {
const args = message.content.slice(prefix.length).trim().split(/ +/);
if(!message.member.roles.cache.some(r=>["👻・Trail Moderator", "🧨・Moderator", "🛠️・Director Team", "👽・Director of Partners", "🛠️・Director of Staff", "🔰・Management Team", "🎓・Chief Operating Officer", "Administrator", "director", "👑・Chief Executive Officer", "🔰 Owner", "Moderator" || "founder" || "Founder" || "FOUNDER" || "owner" || "Owner" || "OWNER" || "M.S.T owner" || "-👑- Owner" || "ADMINISTRATORS" || "Administrators" || "administrators", "boss", "boss crew", "bosses", "bosss", "founders", "mod", "moderaters", "moderater", "Moderaters", "Moderater"].includes(r.name)))
return message.reply("Sorry, you don't have permissions to use this! (is you do hava permissions, but this command still doesnt work, check if you have role named exacly **Administrator, or admin.**) If you have your own roles that you would like to add, so you didnt needed to have that role, or if you have your own role, just join our support server and message it in the help section.");
let member = message.mentions.members.first() || message.guild.members.get(args[0]);
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.kickable)
return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided.";
await member.kick(reason)
return message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
}
}``` this is my kick cmd.... And it cant deffine what prefix is... shouldnt it take the info about that from `index.js`?
So I need to put this: ```js
const config = require(./config.json)
const prefix = config.prefix












