#development
1 messages · Page 1314 of 1
LOL
lol
i mean js is complicated
i might do some js
but i want to finish my bot completly
then maybe do something else with js?
Like filtering a bot is
if(message.author.bot) return
Lol
if(message.channel.type !== “dm”) return
Only take dms^
I kinda get context, kinda dont in py. probably still the biggest mystery to me.
I feel like its the py equiv of "this"
but at the same time its not
Py is really weird with the underscores and @s instead of just .s
tho, i mean tbh my like goal is to work at discord lol
arrays are lists, but py also has arrays
id be awsome to work MAKING like DSICORd
and also, everyone who ive seen, loves it there
Stop it. Get some help. C++ is best. 

I mean being a discord developer is not the same as a bot developer
@blissful coral ik
scratch best language
but making a bot is a way to learn
LOL
like i now, know some python
Dude what do you mean binary is the best
can python print entire objects?
Just code in binary
like i saw on glassdoor, theyre like no bad reviews for discord lmao
@drifting wedge uhhh, what's your cog import look like
1s and 0s aren’t bad bro
Just code in binary
@blissful coral i code in english
@quartz kindle *dictionaries
@drifting wedge uhhh, what's your cog import look like
@trim saddle wdym, like ext import?
JavaScript closer tbh
@trim saddle i mean, class instances
classes? i don't think so
is java ever useful?
minecraft
Minecraft
can python print entire objects?
C++ can. ||But you need to overload operators||
because like, his message instance is messed up, is there a way to print(message) so he sees what the fuck did message turn into?
.jar lulw
but like for actual coding?
@drifting wedge is it something like from discord.ext import commands
but like for actual coding?
@drifting wedge
Go for C# if you want to use java style language in real world.
@drifting wedge is it something like
from discord.ext import commands
@trim saddle yes
@quartz kindle most good class objects have __repr__ which is usually a string of data in the class
its the same
commands.Cog.listener()
I understand that i need to use the webhook to add the id to a database when someone voted
but what if someone voted when the bot is offlione
then it's your problem.
Go for C# if you want to use java style language in real world.
or kotlin
if you have a webhook set up
@trim saddle seperated from the bot
A lot of people also actually make secondary programs that only do the webhook and put it in the database
and then check the database for the id?
yes, ran seperately from the bot
then the only time it goes down is if the server goes down really
@earnest phoenix a webhook server doesnt need to be connected to the bot
@earnest phoenix a webhook server doesnt need to be connected to the bot
@quartz kindle i understand
you can make the webhook into a different process and just have it save to the same database that the bot uses
yes
or kotlin
or any C language. ||not really lmao, C/++ isn't same as C#||
so if the bot goes offline, the webhook server will still receive votes
and save it to the database the bot acceses when its online later
yup
👍
Or just have a separate instance of the bot that just has the webhook in it so if you want messages while it is down
So the second instance only has a webhook
the difference between C/C++ and C# is that with C# you can see well, while with C/C++ everything is blurry and you need glasses
the difference between C/C++ and C# is that with C# you can see well, while with C/C++ everything is blurry and you need glasses
I like manual memory management - eg.
are you allowed to have two different bot instances up as in two different programs? one program will handle specific commands and the other one will handle other commands.
@swift umbra use threads
Yo
In C it's easy to shoot yourself in the foot
@swift umbra yes you are allowed
In C++ you have the possibility of blowing your whole leg off
int main() {
int array[5];
array[69] // here you go free segfault
}```
I copied it from Bastion Bot code
Need someone to help me with canvas-constructor, ping me if you able!
Wtf
copy pasting is a bad idea 🤔
dont copy code lol
If i need it ...
@snow urchin dont ask to ask
free I honestly can't tell if that's allowed to compile considering a lot of things you can do which look weird
Ohhh, maybe im wrong say, bcs i bad speak english
2020-10-11 15:16:48.823 ERROR 22676 --- [ main] lavalink.server.Launcher : Application failed```
i get this when trying to run lavalink
I just tried to install Bastion at the request of the other, nothing changed
anyone mind explaining me what app.get('/', (req, res) => { does?
and where it is used for
it defines an endpoint at /
still copying code off of the internet is bad
unless it’s from stack overflow
@swift umbra bro, bastion code it made for your hosting, it special made for copy paste
where / points to depends on what route namespace you may be in
@silent cloud if you want to use xrequire: https://www.npmjs.com/package/xrequire
Thx
where
/points to depends on what route namespace you may be in
@sudden geyser ok thanks lite
I am trying to make the background of this canvas a linearGradient using canvas-contructor, when I try to do it, it does not work, anyone know what to do?
I will give it a shot
Made 0 difference
Still a blank bg
@quartz kindle Any idea's? (sorry for ping)
@snow urchin make the image in gimp 😳
what..
its an image that changes depending on certain data and colors
through nodejs
sounds like hella resources
do that so i can be right
4000x4000 is discords limit too right?
no
or was it 8000x8000
jpg intensifies?
my bot used to make them up to 8000x8000
but i lowered it to 4000x4000
because it would occasionally crash
2020-10-11 15:16:48.823 ERROR 22676 --- [ main] lavalink.server.Launcher : Application failed```
i get this when trying to run lavalink?
shivaco, i removed ctx
but its still not wroking
its not getting the guild id?
send your code
did you log your message object like tim mentioned?
i also added a font size option up with 500% which makes it hilarious
1 sec
yes, use hastebin
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
CODE BLOCKS
it's literally ```
I did that
either way you posted an error with no context
and your code is...
https://hastebin.com/omabahomuc.coffeescript this is the code, don't know if I needed to paste this or
Why are there 4 MongoClient's
anyone know why getting this error in help.js for usage
usage(argString, prefix = this.client.commandPrefix, user = this.client.user) {
return this.constructor.usage(${this.name}${argString ? ${argString} : ''}, prefix, user);
}```
it must give this usage: "ban @user reason",
Why are there 4 MongoClient's
@slender thistle its complicated af
but bascially.....
this on message
@flint yew you're missing backticks around the template literal: `
ranks you up - gives you $ on the currency system
and gets the prefic
and also, it checks if u ping the bot
@flint yew you're missing backticks around the template literal: `
@sonic lodge where u mean
which then it sends you: hey, my prefix is: {prefix}
(${this.name}${argString ? ${argString} : ''}, prefix, user);
becomes
(`${this.name}${argString ? ${argString} : ''}`, prefix, user);```
@sonic lodge that the error
that's the fix
huh
.addField(${search.name} Description:, search.description)
this working
but for usage not
i showed you the fix
okay
case 'join':
if(!message.guild.voicechannel)
{
if(!message.guild.voiceConnection){
message.member.voicechannel.join()
.then(connection =>{
message.reply('Successfuly joined!');
})
}
}
else
{
message.reply("you must me in a voice channel to summon me!");
}
break;
too old to work right? 😦
@slender thistle ? u there?
The user you have attempted to reach is dead. Please contact them when they seem alive enough to be bothered with Python.
👌
how do i get the channel a message is sent in with d.py:
like the channel id:
wait, how do i send stuff with message.send?
ignore all above exept message.send
oh wait right
you can upperCase a string


isNan() @gentle lynx
not like that
args is an array
args[0] is either undefined or a string
you need to parse it first
oh
ok so it replies when its not an int but it doesnt when its not
55 is
/* eslint-disable no-return-assign */
module.exports = {
name: 'heat',
description: 'Heats an ore or a food in the furnace in return for money.',
category: 'Main',
usage: '[Item Name] [Amount]',
aliases: [],
execute(message, args) {
if (!args[0]) {
return message.reply(message.client.wrongUsage);
}
if (!args[1]) {
return message.reply(message.client.wrongUsage);
}
if (isNaN(args[1])) {
return message.reply(`The amount must be a number.`);
}
let item = args[0];
item = item.toUpperCase();
if (!message.client.items[item]) {
return message.reply(`Item does not exist.\n\nNOTE: If the item name contains two words, type it without spaces, replace spaces with _.
For example: golden_apple`);
}
if (!message.client.items[item].heatFor) {
return message.reply(`This item is not heat-able!`);
}
if (message.client.items[item].name.includes('Ore')) {
const sql = `SELECT ${item} FROM inventory_ores WHERE ID='${message.author.id}'`;
message.client.con.query(sql, (err, result) => {
if (err) throw err;
});
} else {
message.channel.send(`food`);
}
}
};
OH
wait
nevermind
is NOT a number
im dumb
Just a quick question
For JS is sharding hard? I been to mutiple websites but they all make it look so easy
what signal
yeah i want it to return when it's not a number
if your like erwin, sharding is hard
im talking about args[1] not args[0]
It’s just a simple moderation bot so it doesn’t have any data storages
You could say it works like a static website
sharding is more like splitting workload of guilds into different processes
having each bit(shard) take care of X amount of guilds
i think its 2.5 guilds per shard as of discord's standarts
If not they shut it down
2.5k
2.5k*
lol
im drunk, gimme a break lmao
idk what you mean though eman
sharding is only needed once you got a ton of servers
Well yeah I but I don’t understand how to do it
splitting processes to handle x amount of servers so your main process doesnt get bloated
your lib surely does it for you
so lets starts there
which lib do you use?
JS
Discord.JS
lemme pull the docs on sharding for ya
here you have it
like i said, most libs already have it handy for you,i just chose to do my own sharding due to lack of options
Twitch and youtube do NOT provide sharding, so i had to make my own
Ah so it goes by file
trust me, you DONT wanna fuck with that, abuse as much as you can that the lib does the heavy lifting for you, sharding is a fine tuning process and quite complicated
Lol I can see how more advanced developers would want there own sharding tho
the hardest part of sharding in normal cases is making your code work across shards.
which a large portion of bots dont really need to do anyway
If I go by that website I would have to redo my bot completely
I use the old way of discord.JS
I prefer it
v11?
Yeah
v11 is deprecated and wont work forever
^^
Yeah that’s why I would have to redo it
intents 
you are on a very thin line rn by using v11
while v6 has been deprecated already, its not decomissioned
im currently just waiting for v13 to come out to port my code
Yeah I don’t develope much anymore since as soon as I finished my bot they came out with v12
theres a guide if you wish, on how to port v11 to v12
unlucky timing
there are very few breaking changes
Can you DM me the link
i cna post it here, one sec
Yeah and after v12 came out I got very unmotivated
just save that link
v13 should be coming any time soon
as v6 has been officially deprecated(but still the default one)
v12 is a lot more consistent in many ways.
Lol well I guess I will redo my bot :/
Only time I will be needing sharding tho is in v14 :0
99% of it probably doesnt need redoing
Who knows
its just adding .cache places mostly
its more adapting , not re-doing
you should only need to re-do stuff if you feel like your bot needs a major optimization, v11 to v12 is mostly adding cache and updating some decpreated methods, not a major rework
basically reworks come from your own code, not from the lib itself. Lib updates from d.js seem fairly easy to fix
Yeah, looking at it, it looks like they simplefied it a lot
my og bot took like 30 minutes to swap everything over
It probably won’t take me very long
It’s just old ban and kick commands
Just a simple moderation bot for simple users
ive scratched my code multiple times and started from scratch until i got a good and optimized code working, but that took multiple try and errors and LOTS of testing to see which was the most performant. I took the challenge to webscale my twitch bot, which has given me ample experience and confidence in my TS coding due to the fact i was able to create some rather amazing results comparing to whats currently on the market
Yeah lol it took me almost a year to get my bot where it was
Lol
people who were in general chat saw how i was able to join over 100k twitch streams within 40 seconds with my sharding, when the library im using alone would do it in 14h by itself. My sharding has been proves so effective im thinking about installing it on my main production server
i reduced a function processing time from 2 minutes to 6 seconds by changing vps and by splitting it into multiple processes
^^^^^^^^
14h to 40 seconds, i cant even math out how big of a performance change that is
xD
7%
xD
I'm using pm2, and even though i deleted process 2,3,4 - when i start a new process it's id is 5.
does that mean theyre secretly running in the background?
no
luckily i also got a ipv6 block with 26 ips in it, so i can hot swap them as needed to make sure im not abusing the api while still connecting a ton more processes onto it
pm2 uses a database to store process information
and databases usually dont reclaim past IDs when they are no longer used
im storing my processes on memory tbh, im just creating a unique name on them
ok ty thank
these https://ipv6.he.net/
my id is just slave + process number
you cant use the master/slave nomenclature anymore, because its racist
:^)
i use that

why cant u use master/slave
its a befitting name
one works, one sit idle handling the income

Is it expensive to run a high end bot like that!
lmao
?*
what is your definition of high-end?
Like sharding wise
like how many guilds?
So 2.5k servers or higher
nah
my bot is in 5k guilds, and i pay $3 per month
if you dealing with 50k + i assume a bit
you'd need a powerful server with ram
unless you smort
and use dj-light
:^)
Cause I know slav does around 100-300 a month American

<3
lemme check my ram for comparison
djs lite cheater!
What host do you use?
im currently on galaxygate
lmao
So you’re bot is only in 67 servers? But you have almost 200k unique users
indeed
lemme pull mine up
95k is from here, 30k is from dapi, and theres some rather big servers also using my bot
My bot is in 100+ servers but most of them are small expect this one
my bot speciallizes for streamers, as its an all in one bot for all major streaming platforms, its mainly streamers that use it, which means i get a higher income than normal users
i have 500k members, but none of them are cached xD
mb?
ye

Why is none of that cached
my twitch one i can flex, i have no complaints over the twitch cache i put, 66k streams cached but i removed the user cache for this experiment
because i disabled all caches
usually it sits under 50mb
psh, your caching too much tim
only thing cache in my twitch slave is streams
the users, as you can see here, make QUITE a difference
i cache users, but not djs users, my custom user class
i also cache api responses for 24 hours
200mb to 2000mb just with users alone
xD
though to be fair there are 1.7 mil users cached
while d.js has...
300k rounding up
so 600k would likely make up for the 2 mil ish i have on twitch
hey, i have a full music command, i just dont have the command to make the bot join the vc lol
then how do you know you have a music command? i mean how do you know it works
lmao
hey, i have a full music command, i just dont have the command to make the bot join/leave the vc lol
@tardy hornet
then how do you know you have a music command? i mean how do you know it works
@quartz kindle i dont lol
isnt it simply <channel>.join() ??
i havent fucked with music whatosver, that seems one hell and a half to deal with to make something decent
you'd need lavalinka nd buy ipv6 blocks to route them
lol
otherwise you'll get ratelimited from youtube
theres a daily quota
proper music bots needs investment
not trying to disencourage you, just making it a fair warning that you'll need to put in some money if it grows
i dont think i can even disclose how Rythm does it since i got info thats not public
but its one hell of a nightmare
I always wondered what rythm pays for its servers
i know they have like 6 locations or something wild
i dont know how much for the servers, but ive got info on how they deal with it internally
its a hellish nightmare i dont wanna have anything with
not even kidding
low end music bots and fun and good experience for a dev
lmao
high end music bots are costly, profitable and one hell of a nightmare
thats about all i can say
@solemn latch rythm just hit 10m servers
rythm is a dumpster fire
as in the servers they rent from a host @tardy hornet not the number of guilds
my server can likely run 40% of that without overdoing
yeah
@tardy hornet
i mean
the owner of the cluster dared me to make shit code and put a dent on that server
and so i did
within 4h iirc
175 bil tuple scans on the database
i completely used ONE core
ONE
O-N-E
gimmie one core plox
i mean

if it completely used one core
one core and a half
then its not multithreading at all?
if it were multithreading it should use like 20% of each core, not max out one
it was split, but i used up 8% of the total
here
i was using htop
it gives me a % overall value
while its split, i can check how much the processes were using
from the total, it was using 8%
this gives me ptsd from when i was working with music and i did a recursion method on accident that spawns a new thread everytime its called 
i think it has 32, lemme doube check
gib me your machine
also i lied, not 26 ipv6's, its 29
i think those values are outdate
im fairly certain its 5gigabits now
scalable
how fast is your disk again?
hmm good question actually
run nix-bench
lemme open putty rq
psh bitvise
curl -sS https://raw.githubusercontent.com/jgillich/nixbench/master/nixbench.sh | sh
isnt it simply <channel>.join() ??
@opal plank
case 'join':
message.user.channel.join()
break;```
@opal plank lol the closet i got
i just asked the owner of the host about it
@tardy hornet remove user
message.user.channel?
and add member.voice
give it like 10 min, she answers rather quickly
but still, this host is insanely good
i wouldnt be able to webscale this twitch bot that easily if it wasnt for it
i think its private
=js case 'join': message.member.voice.channel.join() break;
@quartz kindle like that?
yes
what i DO know is that its a google one
done
it even has its own backup power gen, i remmber this shit being hella over the top
indeed, im really grateful the owner let me use it
she didnt have much purpose for such a powerful machine, so she asked me to dent it
can you run nixbench on it? i sent you the command
lemme try
^ty
there is no next, it should auto run it as soon as it downloads
@quartz kindle
case 'leave':
message.member.voice.channel.leave()
break;
thats for leave then?
yes
ok ty
focusing on the single thread, this is my $3 a month vps
well 2 things left now, make that if the user isnt in the channel the bot wont join,
and to test my music command
and i got no idea how to do the first one
it seems its not really that good on write speeds
if it isn't scream at the user
mine 40$ monthly 😦
whats weird to me is that it pulled the other test barely in hours
but it makes sense being google
thonk
AES and Gzip seems higher on mine
google's disks are suck
though im not gonna lie, i have no idea what they mean
cryptography and compression
gzip is compression performance, AES is encryption performance
sha256 is hashing
hashing is important though not as much for me
cojudos
there are some stuff im having to hash
they are all cpu intensive operations hence why they're used to measure cpu performance
pls magik @quartz kindle
wat
wot[
me largo de aqui
@quartz marsh #general-int espanõl
sip por?
solo puedes hablar en español en #general-int weon
ok chao cojudos
wait, @earnest phoenix can i just else it?
or its not working like that

or its not working like that
there we g o, dealt with
xd
anyway Tim, this host is hella powerful
but yeah its a pitty google's disks are so bad
its been handling 80k per 15secs fine
i should likely update my graph since its technically wrong
im updating values every 15 secos
i still have google's free forever machine, the f1-micro with 600mb ram, disk speeds there are 35MB/s lmao
sjekhq88293788qwye nm3djisszskmdedfejbonjuroto 0wmc+qnwxdmmemierdsa mc'icraki mather fuckejee03jnfihrejwmo-n|1d 0cxnnn89819982892
@tardy hornet
if(vc variable)
//defined
else
//undefined
320K messages/m
not accounting for the other shit
@split hazel can you warn @quartz marsh pls? trolling
did you ever get a bot running on it @quartz kindle
ye
how did it go
my bot was on it until like 1500 guilds
tf
35mb/s? LMAO
yup
probably should be recommending it a bit more then
ye google is great to start with, much better than glitch/heroku/replit
yep was typing the same thing
from my standarts those speeds are fast, though i assume they arent good for the upscaling standarts im going for
my problem is that my project relies on an old C code from 1988 or something
that does a shit load of file reads
YIKES
so i need disk speed
for example i have a feature that needs to scan 20k+ small files
oldest project code
400'ish mb/s, thats a bit more than double of what i got
@earnest phoenix wdym by vc variable?
which is the one that tool 2+ minutes in google
your voice channel var
thats interesting though
@quartz marsh please don't
ഗർഭിണികളുടെ മക്കൾ
i mean, i guess you can blame it on that, most of the stuff i had to do wasnt readily available for me
can you not port the code to js?
-m 748242384378396764
🤐 Muted Gatosensei#9638 (@quartz marsh)
no, the thing is like 50k+ lines
hmmm
and does lots of cpu intensive stuff
is it fine to have such code integrated with the bot?
its still being updated today, last update was a few months ago
the one area i dont have experience with is integrating multiple languages in one bot
but the whole thing is designed to work on files
i modified it a bit to allow for some functions to be called on strings instead of files
but i cant do that for all of them
hmmm i see
i love seeing this kind of stuff, as a dev, i mean
i dont plan on only sticking with Ts/js
so seeing that kind of integration intrigues me
i dont plan on moving out of js
lmao
i mean, integrating C/C++ in node.js is not that big of a deal, node.js has tons of tools to do it
even some of my close group of friends use Ts nowadays after spending years on other langs such as Cpp, c#, rust and some others
among them includes people with 40+ years of coding, and a couple ex/current discord emplyees, i take their opinions very seriously
even though im confident in my Ts skills, i know for a fact ive yet to learn from all of them
C++ seems an unbailable tool for devs
ye
being able to link C/C++ to node.js is one of its strong points
this way you can access tons of old but gold code standards and algorithms
the shit that every single thing out there relies on
what i aim for is possibly try to port that code, but the fact that it hasnt been done before shows me 2 paths;
1- its not doable
2- its not as performant
so im a bit stuck between the cross and the sword
hoping to accomplish everything in one language but then wanting to learn other langs
some code is simply unportable, or rather it would be way too hard to port it
its a bit scary to jump into another lang and revive the noob days of js/ts, the amount of shit you get for being a newbie is insane
i wanted to do it somehow diffrent
re-living that thing over again is a bit of a concern imo
if(!what do i put here) return message.channel.send('please join a voice channel first.')
i had couple of stuff to put
none of them worked
i remember back in the days where i had to ask what is a varible? what is an array? if i havent been blessed with such good people that commited to helping me as a new dev to learning, i dont think i would've been where im at
thinking about learning a whole new lang with new people is a scary though, to put it bluntly
the amount of shit you USUALLY**** get is insane
there are very big exceptions to that if you put the commitment into it
I'm trying to run this but I keep getting the error messageReminderModel.find(...).forEach is not a function in mongoose. I'm trying to find everything with no filters, can anyone help?
(await messageReminderModel.find({}).forEach(data => {```
(await messageReminderModel.find({})).forEach(data => { ?
it'd help if I showed more probably my bad
no
const messageReminderModel = mongoose.model('messageReminder', module.exports.messageReminderSchema);```
```js
//Node-Scheduler Function
nodeSchedule: async function scheduler() {
try {
(await messageReminderModel.find({}).forEach(data => {
let currentUnix = Date.now()
if(data.time <= currentUnix) remindUser()
schedule.scheduleJob(data.time, remindUser);
console.log("Scheduled a reminder.");
}))
} catch (err) {
console.log(err);
}
}
}```
just put a closing bracket after before .find
wait thats it?
should be
now I'm getting
at Object.scheduler [as nodeSchedule] (C:\Users\Samst\Desktop\RemindMe\core.js:96:43)
at processTicksAndRejections (internal/process/task_queues.js:97:5)```
works now, thanks
oh one more issue
I'm getting TypeError: Cannot read property 'on' of undefined at Object.messageReminderAdd (C:\Users\Samst\Desktop\RemindMe\core.js:18:9) at Object.<anonymous> (C:\Users\Samst\Desktop\RemindMe\index.js:82:6) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32) at Function.Module._load (internal/modules/cjs/loader.js:879:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47
When trying to run js bot.on('messageReactionAdd', async (reaction, user) => {
"bot" is defined as js const index = require('./index'); const bot = index.bot
let me see what you're exporting from index
bot is saved in my module.exports as so js module.exports.bot = new discord.Client(({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] }));
why you saving your bot under a module export?
i have functions in another file that I need to use it in
while it should work, it'd be mostly best to have it on the index where the main/master stuff should happen
since client is a master piece of your bots code
yeah
i'm trying to have a core.js file with the 3 core functions
so my index.js isn't huge
i feel that tbh
while this isnt a requirement nor a necessity of your code, i'd highly recommend putting your client declaration on your index.js
Nah Erwin
index should contain your major assets
like i said #development message
that i pass the client to
how do I do it?
I mean yea, as a standard but if you wanna make your life easier with your own standard
if you're working alone it shouldnt matter
again, i mentioned that
its not related to error
just as good practice
creating your client is the major and most important part of most of your code
I only see one issue here
having it declared on your index should be the most important thing
js instead of ts
Elian
> all
^^
u can code in js, just google luck handling errors
its much better for fix errors before you even compile your code
buts that just personal opinion, just like what i mentioned above
creating your client is the major and most important part of most of your code
@opal plank i do this in my index file
you may very well code in Js if you so wish, im not gonna judge
i just need to use the variable in my other file
@gritty bolt thats the thing, your index should serve as the dispatcher(aka, your main file) to dispatch it to other events, if you require it on one file, you'd need to chain it on a then() onto it, since its a major keystone of your project
require() is a promise iirc
so you'd have to wait for it to complete before running the rest of your code
thats why declaring it on your index is a major_++
well
i dont mean attaching extra things on your client, but the simple fact of declaring you client on your index
does anyone know how to fix my issue
unless its a module, it should be in there
but didnt I declare it there though?
like i said, you need to await it
so like with an async function?
which is what i meant byt .then()
require() is a promise
wait for its completion
i MAY be wrong, i just checked the code, its NodeRequire(), it might be hoisted
it seems weird that it'd resolve in sequence
so pretty much the reason it's coming up as undefined is because I haven't waited for it to load yet?
aka sync
lemme check one thing rq
well my compiler isnt screeching, so i assume its a promise
do call me on that if im wrong though
ok i still really dont get how to actually fix this
and then it'll stop coming up as undefined?
lemme double check code, one sec
Red kinda sus idk
try requiring {bot} right away
didnt work
i'm defining that here though I thought
const index = require('./index');```
unless i just dont know how to define it
which i wouldnt be suprised if i didnt
try js const { bot } = require('./index.js'); bot.on() ...
const discord = require('discord.js');
const ms = require('ms');
const { index } = require('./index.js');
const mongoose = require('mongoose');
const schedule = require('node-schedule');
const bot = index.bot```
```C:\Users\Samst\Desktop\RemindMe\core.js:7
const bot = index.bot
^
TypeError: Cannot read property 'bot' of undefined```
use what i said
not bot
{ bot }
module.exports exports an object
if you want a property inside of it, use { }
const discord = require('discord.js');
const ms = require('ms');
const { index } = require('./index.js');
const mongoose = require('mongoose');
const schedule = require('node-schedule');
const { bot } = index.bot```
C:\Users\Samst\Desktop\RemindMe\core.js:7
const { bot } = index.bot
^
TypeError: Cannot read property 'bot' of undefined
at Object.<anonymous> (C:\Users\Samst\Desktop\RemindMe\core.js:7:23)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Samst\Desktop\RemindMe\index.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
[nodemon] app crashed - waiting for file changes before starting...
still wont work
im so confused though
your reqesting index, when you named it bot
but isn't that requiring the file?
also make sure core is your main file
it should
then why require index when index is your main file?
because i need my bot varaible
how?
in a function
function sayHelloToWoo(client) {}
sayHelloToWoo(client)
if you truly do not have a reason N O T have your client instated in your index, then read this https://discordjs.guide/
to keep it more tidy
but CLIENT is an important key of your file
nothing is actually happening in there other than function storage
i need to use my client variable though in my functions
so I need to find a way to pass my client variable into them
so js messageReminderAdd: async function messageReminderAdd(bot) {...?
@gritty bolt
even i have stuff imported from other files
theres a PROPER way of doing it
delcaring your MAIN client isnt a good idea, whatosever
i'd HIGHLY recommend delcaring it on your index
I define my client in my index and pass it via the function
so like what I did above?
check the guide i sent you for commands in different files
const Discord = require('discord.js');
const client = new Discord.Client({ ws: { intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MESSAGE_REACTIONS'] } });
const { InitClient } = require(`${process.cwd()}/custom_modules/client/initClient`); // Loads all the commands
const initClient = new InitClient(client, Discord);
is how i handle mine
wuts the best vps and most reputable?
I use AWS
digitalocean probs
highly recommend them
there isnt one
$ price isnt really an issue, but reputability is
most known for vps
its preference
just like which lang is better
some vps offer better prices
some are free but limited
some are expensive but offer really high end hardware
it depends on your needs, just like a lang
when would i need to move out of heroku?
i am looking for a dedi with a gpu 🤔
cuz like servers =! usage
i'd move out of heroku asap
because you can
- host your own db clusters
- host more than one thing
etc
const { InitClient } = require(`${process.cwd()}/custom_modules/client/initClient`); // Loads all the commands
const initClient = new InitClient(client, Discord);```
would you mind explaining to me what this is doing?
actually getting a real ip is nice
it passes the client into the thing
okay
and im just passing it the client and the discord lib
when would i need to move out of heroku?
@drifting wedge when you care about user experience, as heroku doesnt offer 24/7/30 experience, its 27 days a month iirc
welp, time to go back reading
@drifting wedge when you care about user experience, as heroku doesnt offer 24/7/30 experience, its 27 days a month iirc
@opal plank i have 2 accounts
@quartz kindle lemmme know if you wanna continue that discussion
k
Is there a way to do music filters on ffmpeg e.g nightcore, bass boost etc
sooo i added this among us bot and when you start a game it makes a new channel. Then I ended the game and its supposed to delete the channel but it like glitched out. Now when i try to delete the left over stuff I cant and its bugged. If anyone intelligent would like to help i can send server link and u can help. thanks
you need to ask the developer of the bot on their support server
what is that
well its not so much a problem with the bot just that i cant delete the channel
but couuld be a bot problem idk
We aren't discord support
🤷♂️ i have no where else to ask
the person who made the bot
ask the developer of the bot on their support server
Does anyone have a among us bot that can auto mute in discord when the game starts, then unmutes in emergency meetings etc
yes but broken lmfao
Is there a way to do music filters on ffmpeg e.g nightcore, bass boost etc
@pure lion![]()
![]()
![]()
![]()
Does anyone have a among us bot that can auto mute in discord when the game starts, then unmutes in emergency meetings etc
@thick raven no that’s impossible
Among us may have a feature like that in the future but I highly highly doubt it
maybe possible if you Inject the DLLs™️
this guy says it works tho
they do work, but you need to have your own bot yourself
on your own pc
which requires work
Not sure if I'm down to doing that bai
isn't there one in that reddit thread
cry are you aware of how to do audio effects on ffmpeg?
I really don't know how to use reddit
I have no idea where to look for documentation
it's just a message board
also, why dont people just give out a role and then mute the role
or you know, find friends who are not 11 and can actually be quiet

my solution was to just build a small UI to mute all people in a vc
there's also a way to keep that one slot free but you need to host the bot on your pc with the among us game; reading memory
since among us is unity it's extremely easy to read memory and find the game state
however that won't help you identify which player is which in discord
How do I get guild count with broadcastEval and sharding?
I think you want to use fetchClientValues not broadcastEval for that
Ok
Have this:
const getServerCount = async () => {
// get guild collection size from all the shards
const req = await client.shard.fetchClientValues('guilds.cache.size');
// return the added value
return req.reduce((p, n) => p + n, 0);
}
client.user.setActivity(`${getServerCount} Servers!`, {type: "WATCHING"})
should do
I'm needing help with intents
getting object promises @solemn latch
https://ziad87.net/intents/ Here is a intents calculator @earnest phoenix
https://discordjs.guide/popular-topics/intents.html#enabling-intents and a guide on intents
I've specified the intents my bot is going to be using in the code, and i've enabled it on the discordapp.com/developers page.
const client = new Discord.Client({ ws: { intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_WEBHOOKS", "GUILD_MESSAGES", "DIRECT_MESSAGES"] }});
And it still says that I can't add it to other servers because of the lack of intents
Is your bot verified?
yea
is it verified with that intent?
^
ie did you request it
idk because it didn't ask me intents on the verification form
it should have
all the way at the bottom
Fuck, I don't remember what I put then
I keep getting
ReferenceError: Cannot access 'user' before initialization
with this code
const user = await user```
what is this supposed to do?
because you are asking for making user with user
bot.on('messageReactionAdd', async (reaction, user) => {
console.log(reaction);
if(reaction.emoji.name === "⏰") {
let errorEmbed = new discord.MessageEmbed()
.setTitle("An error has occured. It has been reported to the development team for further review.")
.setColor("#FF0000");
const messageLink = reaction.message.messageLink
const user = await user
let timeEmbed = new discord.MessageEmbed()```
Where did you define user in the past.

I like manual memory management - eg.





