#development
1 messages ยท Page 1558 of 1
ye
yep
now node index.js or whatever .js you named as your main file
index.js, main.js, server.js, bot.js
wouldn't it be better to run it via pm2
those are all common names, but it depends on you
it would, but running it on terminal is fine too
it just wont restart if it crashes
Ye I did it
so now your bot should hopefully be online
when I shutdown my pc it will stop ?
correct
thats precisely why people pay for a hosting VPS, since it stays up 24/7
its like a computer they never shut down
^
I got a Synology - NAS .. Hopefully I will try to host the bot there
it doesn't get shutdown only if the The electricity was cut off
you could use a raspberry pi too
but if you're like me and never shutdown your pc, leaving it running is no issue at all
bots dont require too many resources, so its basically leaving the pc on idle
Yea a fact
it of course depends on what you coded your bot to do, but unless you're
on 300+ servers
using presence intents
doing some heravy image generation or stuff of the sort
you shouldnt even notice it running as far as resources are concerned
One told me if your synology nas doesn't get off
I can use docker file and load the command there
This is a picture of the synology nas if you don't know
hey mmh i need some help too
here is my code
for perm level
i add the moderator role to settings with a command
Check if the member doesnt have it too
but when a moderator uses a moderator command it doesnt work
mmm
cant remember i guess i tried but didnt work
let me try again
have you tried to console.log the variable to make sure its actually getting the right value
yup
Did you try Synology before or knows anything about it ?
nope, dont know anything about them
also, not only the scope, but also you are returning void if its nothing
your options of return for your check() function are true | false | void
those types dont match
then what should i do
oh no
i should try
@proven lantern my bot has been up for 24 hours nearly! Thanks for your help yesterday, it helped me much
If I can ask .. What host you used ? ๐
literally use anything which isnt freeโข๏ธ
VPS, of digital ocean
wut?
Thats Nice!
Digital ocean is kinda sketchy with their verification system
Yeah, it works like it should
Never had downtime
again, there is no good free host
Ok I get this error when it starts up ReferenceError: prefix is not defined
js
Its node js using discord js
My commands wont work because the prefix is not working
lemme check
on the main file?
ah ok
heres mine
const fs = require('fs');
const Discord = require('discord.js');
const config = require('./config.json');
i got the one for later
just not that first one
ok
thanks
if i write ?testing hello? with args.slice(1).join(" ") it returns empty character
I have a json object like this. how can I get the key of maximum value?
in this example max value is 6 ("yardฤฑm")
you can use Object.entries to get key-value pairs and Array.reduce to get the pair with the maximum value
yeah that also works
which one is optimized?
i'm not really sure tbh
i like Array.reduce because it just leaves one result, but i don't think that affects performance a lot
I guess I didn't understand the using of reduce in this
reduce should be more efficient i think
since you only need the first value, you dont need to sort other values
Object.entries(myobj).reduce((a,b) => b[1] > a[1] ? b : a, [,0])
i think it's not necessary to assign a to b, tho
yeah maybe not
what did you mean by saying asign a to b
by the way it worked thanks a lot
np
my previous answer had an unnecessary assignment that they pointed out
so i edited it
Oh okey
that's pog
yeah those are really useful for while loop assignments
they look a bit weird but are useful anyways
ye xD
one interesting thing i've found about js, is that for loops are actually faster than while loops
wait what
so using while loops pretty much useless now
performance testing is really something huh
Afaik, Object.entries return iterable which doesn't have reduce method on it.
returns an array
yea
its not the same as Map.entries()
Oh, right. My life was lie
for loops usually only iterate over an InterableIterator while while loops can do things for an indeterminable amount of time unless otherwise specified as an exit condition which can get reached.
the virgin Map.entries
That's why I always try to use maps
the chad Object.entries
For keeping maps
with Map.entries you gotta wrap it around an Array.from
Or just for of
or you can just do
for(let x of y) {}
ye iterators can be looped over in many ways
I remember at some time people were using nazi airbnb eslint rules which disallowed regular for loops
Lol
That think was sadist and useless
ah yes, nazi
- no variables with names that contain "jew"
Tim, we don't question big corpo's we just hold until they scream
buy GME
On the contrary, Google's style guides are the best :)
Lol, ok
You can like the company tech and appreciate their advancements and hate their politics at the same time
It's not black and white
I have a problem. I'm not sure it is about development. I am sending an image in Embed. but the original image and seen image are not the same. First one is the seen image and when I click open original it is the original image
i dont like facebook tech, thats what im saying
i mean
its not about politics lmao, thats secnd plane
facebook made react
exactly
at least that one's good
But it made it more accessable and reusable
I really have big problem about that
That's an elitists pov
not sure what that might be
maybe xd
and this isn't the server to ask that anyways 
I think I have a theory
The data comes from twitch api and the image is the thumbnail of the stream data.
and twitch is only changing the image not url
so you're not sending your own image? is it an image url?
yes
I think Discord really have problems about updating messages or whatever
Okey I see the problem thanks for your help
i dont think they update it
they probably save a snapshot of the image for previewing purposes
and that doesnt change unless you edit the message
if the image leads to an external url tho, they dont control that url
but they do control the preview
It doesn't matter you delete message and resend it. They just send preview. Because of that it doesn't update and there is no solution of my problem
The only solution is dynamic url
they cache image previews
as I think
No, they do, and it's fairly easy to prove this
they do it with link embeds too
they're cache for 1-2 hours client side and server size afaik
so yea, your only solution would be dynamic links
because its the only way to bypass the cache
I was trying to say I agree with you
By the way I hate cache
xd
We all do
The "Disable cache when development console" is open is the mans best friend
yes it is
oh, yea
I mean
caching is really nice
for production
for development
holy fuck
xD
Firefox recently got more agro with caching
and i keep forgetting about it
so wonder why nothing changes to realise its ff
now we got custom cache controls though
๐
It's easier than running another script.
wat
i made this thing into an actual package
lmfao
thanos js wtf
reasons to not have eval in every bot:
- Insecure
- Hard to setup correctly when clustering
- pretty easy to fuck something up when testing on the prod bot
isn't it automatically secure when you make it owner-only?
not really
why 
eval thanos.js in production

half the bot files deleted 
Insecure??? What? If a command that is locked behind specific authentication layers and the users who have effective access are competent enough to not execute potentially destructive operations, why should it be considered insecure?
You know how many people ive seen add owner only checked then accidentally remove said auth when they're developing stuff
wayyyyyyyyyyyyy too many
you can also still eval stuff leading to code changes or breaking things in production
just use a test bot ez
i'm not stupid
Like I mentioned, not everyone is as stupid as the next
you cant use a test bot to inspect caches and memory usage
have you seen the general userbase on discord 
Peeking into cluster memory usage is also very important to me
ram go brrr
heap size: 200MB. Snapshot size: 34MB
i prefer heap 60mb rss 130mb

Gotta remove in mem guild caches as soon as I get a postgres server set up
Then index stuff
guild cache is the single most useful cache
the whole point of cache is to provide quick access to something you repeatedly use
the most useless cache imo is channels
Is it possible to integrate both libs? discord.js and discord.io?
no
please dont try
I have discord.io
why
not in use tho
okay here me out here. You can use both but it is very jank
its been dead for years
really?
yes
Well im still using discord.js
Cache is a good thing
but how do we show all commands when !help is used
if you need the member cache and use it, then well... use it
postgres is going to be no where near the speed of cache
and also produce alot of problems in itself
like yano, how you handle and protect that data
how postgres caches the stuff
network latency
storage space
caching hot data yes, but the problem is that most of discord data is cold data
caching cold data is useless
cache stagnation or in your case disk stagnation
true, we recently moved all our cache to lazy eval so it only chunks guild members when the guild is actively using the bot
ye
cuts out about 7 Million users in a instant that dont need caching
i dont cache anything other than guilds
and the few users i fetch i delete after 24 hours
AVC needs both presence and members
how do we get the directory with the commands to fully connect to your main file?
damn rip
so smart caching is important
because I believe I've got the entire thing connected but it's not wanting to run any commands
Otherwise the bot just oofs
show code?
logic behind it is that it has to be accessed by multiple workers across different machines. Some operations which are essential to my bot's dashboard is more effective to setup a db cache than for the website to open a bunch of socket connections to worker threads
Okay.... But discord's cache is mostly stateful
A cluster only caches what shards it owns (or should atleast)
it doesnt need anything else because it will never interact with anything outside of that cache
@quartz kindle lemme open discord on the pc
secondly if you need a global cache then dont use postgres because you're going to kill your bot, server and DB because postgres was not made to be a cache db
the db is not an issue
I've already discussed this with multiple people
pretty much any db can do the job successfuly, if you use it correctly
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
client.once('ready', () => {
console.log('Ready!');
database design matters much more than the actual database software
Still just cuz postgres will do it doesnt mean you should 
if you design it well, why not
thats all?
Extra ram usage + cpu usage + disk read writes + being influenced directly by other heavy operations
Like you can use postgres
For context, I'm already using redis and the design decisions I've had to make are horrendous at best. It's also not suited for my use case as I need specific key value lookup which Redis doesn't offer as far as I know
but its going to be slower than an actual cache system
well that specific portion is not actually doing any connecting
there is also the issue that if your cache doesnt update often enough your db is gonna contain all sorts of dead data
that is completely invalid
const Discord = require('discord.js');
const config = require('./config.json');
const client = new Discord.Client();
const prefix = "!"
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
client.once('ready', () => {
console.log('Ready!');
});
client.login('');
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
try {
client.commands.get(command).execute(message, args);
} catch (error) {
console.error(error);
message.reply('there was an error trying to execute that command!');
}
});```
code blocks please
anything networked is gonna be slower than actual cache
oh whoops
Yes and disk ops on top make it even slower 
your issue can low key be done by setting up a gateway though but meh
If you're using a high performance SSD, does it really matter
I mean yeah?
Im using a mini board computer for mine
you never actually put the commands in client.commands
"I wonder if hitting my SSD with hundreds of thousands of hits a second is gonna cause issues"
The SSD is rated for a high volume of iops
you create a command list but dont put it in the client
@quartz kindle using the if statement?
Either way, I was gonna use an in mem relational DB
how can i slice first word then join the rest?
database softwares use smart internal caching
requesting data from the db doesnt necessarily mean disk operations
Postgres' default setup generally will unless its a perpendicularly hot collection
array.slice(1).join("delimiter")
if your text is not split yet, text.split(" ").slice(1).join(" ")
and also if you have a very big cache each lookup is also gonna be a log(n) lookup time which can get pretty expensive as it gets bigger
@quartz kindle module.exports = { name: 'ping', description: 'Ping!', execute(message, args) { message.channel.send('Pong.'); }, };
this is one command
Maybe im thing about this in too much of a production way
in a seperate file
thats not the issue
the issue is your command list is empty
your client.commands is an empty collection
what if statement, there is no if statement
when i was learning a week ago there was
so id put !ping?
I wasn't going to be using Postgres' default configuration. Like I mentioned, I'm gonna be indexing specific columns so that lookup times are minimal
or a different format
@quartz kindle i tried using args.slice(1).join(" ") but it kept slicing and return empty characters
Thats still log(n)
cuz its a B-Tree search
commandFiles.forEach(file => {
let name = file.split(".")[0];
let command = require(`./commands/${file}`)
client.commands.set(name, command)
})
@rigid sandal
oh is that why they wont work?
lol
you have to take each file, require it and then put it in client.commands
wdym kept slicing? show code
and example text you want to slice
im trying ?command suggest and then if i dont write anything else after, it goes blank
indexed columns are not log(n) are they?
arent they log(1)?
isnt that what indexes are for? hash tables?
is your args ["?command", "suggest"] or is it ["suggest"]?
SQL systems use B-Tree's on their hash
does anyone know some good bot hosting services?
cuz mine keeps getting declined for being offline
while I sleep
A index produces a B-Tree where it's order is determined by its Hash
switch(args[0]) {
case "report" : {
} break
case "suggest": {
await client.sendSuggestion(message, client, words, args)
}
}```
Why? Idk they probably have some reason to choose a B-Tree
pretty sure that's not how switch works
i imagine because using a O(1) solution causes UPDATE queries to become O(n)
There are some listed in pinned messages, if you scroll down a little
I use GalaxyGate, they're pretty cheap for a decent VPS
const suggestion = args.slice(1).join(" ")
if(!suggestion) return NoInput(words, "suggestion", "suggestion")```
If you don't plan on hosting for a full month, I'd recommend Vultr as you pay per hour, rather than paying the full amount at the start of the month
but they do support hash tables if you want them
how would an update query be o(n)?
oki thanks
It may be different for hashmap based indexes but generally if its modifying the data it requires updating all instance where the data size has changed because it start and end pos will be different than the original
but you dont need to do that
you dont
you create a new address location and mark the old one as sweepable
and point the index to the new address
lol sorry
which is why DBs generally go with the delete and re-insert it again approach, which is obviously alot cheaper
why is it doing this?
Cassandra and Scylla both require this being done explicitly so using UPDATE actually requires an environment variable being set on the DB's runtime
Do you have multiple clients running at the same time?
all of this is completely ignoring MongoDB btw
no not to my knowledge
how do you cache globally?
but why would one ever do a full resize for an update operation?
i wanna add a caching system for a feature ill be adding
Big data at times
i mean, sure, if you reach a size threshold you need to resize, but you dont need to reallocate all entries
sometimes its cheaper to simply spend the time to re-index over having duplicate data sets
only time i can imagine it being reasonable
every other time though its easier
also dont dbs keep data in memory for a bit before flushing it to disk?
so it has plenty time to optimize disk writes
and avoid anything o(n)
SQL normally does yeah
or well buffers it
why inserts are so cheap
meanwhile with mongo ```
{"hello": "world"} โ
\x16\x00\x00\x00 // total document size
\x02 // 0x02 = type String
hello\x00 // field name
\x06\x00\x00\x00world\x00 // field value
\x00 ```
sql is a big help for functions on logging usernames and passwords
Im actually coding a website that will have a signup and login function
Just noticed mongo limiting collection sizes to u32 ๐
mongoose only returns the value if your schema contains the value
TypeError: client.commands.get(...).execute is not a function
didnt the mongo hype die down yet?
lmao
that wasnt there before
one of your commands doesnt have an execute function
oh
is it where server.js is empty?
@low orbit thats simliar to the sql script i wrote for storing names
I hope so
Honeslty their data structure on disk is a lil mad
im happy i never got into mongo
Mongo is great for small projects tbh
idk, i dont use mongoose/mongo, but required makes more sense
i dont like mongo for small projects
because why would you run a full db server application for a small project when you can use sqlite
Theyve used a fork of mongo for a while dont knoe if they still do
True
But sometime nice being able to link projects
ye if you need cross-process synching, then ye
im happy with my sqlite and internal sharding
My senior dev recommended a few in memory relational database I've never heard of such as MonetDB which I might use, but they also highly recommended Postgres for whatever reason. Under normal circumstances, I wouldn't have chosen it since I've never heard of it applied in that scenario, but my senior is considerably smarter than I am in multiple fields.
This is why I'm asking multiple people. Just to get a general idea of what I actually want
i've never used postgre, but i always heard good things about postgre
from reading a few docs about it, it feels like postgre is the linux of databases
incredibly powerful but incredibly complex as well
so surely you cant go wrong with postgre
as long as you can set it up correctly for your use case
We'll see
Ree missing the s off postgres
Postgres is incredibly powerful yeah
Just unbelievably complex especially caching, in memory tables, allocation, pgsql lang etc...
Mastering postgres is like mastering another language
Biggest peeve with it though is its incredibly awkard to scale compared to other dbs
Or well to be specific nosql dbs like mongo, cassandra etc....
I was also recommended Apache Ignite
Tim and I discussed at an earlier date and he mentioned that he was able to get good performance with an SQL based solution acting as a cache
Sql is pretty suited to discord type data
But equally its not specifically designed by default to be used like a cache
$(document).ready(function(){
var cnt = 2;
$(".addCF").click(function(){
$("#westarz").append('<input type="text" name="kod'+cnt+'"> <a href="javascript:void(0);" class="remCF">delete input</a>');
cnt++;
});
$("#westarz").on('click','.remCF',function(){
if (confirm("delete?"))
{
$(this).parent().parent().remove();
}
});
});
</script>
<input type="text" name="kod">
<a href="javascript:void(0);" class="addCF">add</a>
Hi, I created a code to create a new input when I click on the add button here, but it didn't work, do you know how to help?
Though theh have the infa to act like one, better solutions exist now mostly in the realm of nosql
What seemed non negotiable to give up was both in memory and relational
I wanted to try to create my own proprietary solution, but I am no data scientist
I mean cache in general doesnt really need to be relational
pls help.
Becahse its cache, generally its quickly accesable via a single key and is designed to be hit hard and fast
Relational designs are for data storage efficency rather than speed of operation
Well. For my use case, I might need to create relations between two different tables based on a specific query. Although perhaps not so necessary if I don't be stupid when I try to find what guilds a user is in.
You said this was for your dashboard yeah?
Also for other worker threads like clusters and some other micro services
I mean for the dash that can be done all with oauth2
think of the node process itself as a cpu cache/register
if you need it more than once in the next 10 seconds, store it there
if not, store it in a secondary cache
some in memory database
Cache it all 
if you ever need 3 layers of storage
Das getting a lil extreme
if (message.channel.id != 788598477231620096 || message.channel.id != 795802857046540320 || message.channel.id != 788598399326355457 || message.channel.id != 788598418460639233)
But it goes in for every channel
im not brazilian, but i did live in brazil for 10+ years
Do you speak pr br fluently?
is that if ending with a return?
or with the code to run?
ye
Can you give a hand understand this guy in my support server 
lmao sure
yep
and it doesnt now
well
so
it will update the json file
but it always updates
even tho i told it to ONLY run if its not the channel
or channel(s)
then change all || to &&
why? It wouldnt work then cause the message would need to be in Multiple channels????
Why not just use a array
I may not be js savvy
But a massive block like that is
Unhealthy
you're using !=
so you need IF != AND != AND != -> return
anyone able to help me with this? this is all the code past where everything stops working and I literally cant figure it out
https://pastebin.com/5D3VBJU9
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.
if you want to only allow those channels
@quartz kindle do you think you could help me with this?
Yikes. Writing to the global const
me?
big question
its a bad habit ik
Yes
im honestly just trying to get it working
how do i start a nodemon so my bot can restart to the slightest changes
for now
Never do that for a command. That's a race condition waiting to happen
I need it perfect lol
define not working
like
Are you getting an error
Try logging everything till you get an error lmao
I can already see plenty of issues
wtf is this if(isNaN(global.time === false))

thats probably it
lmao
isNaN false would return false lol
what about true, Tim?
i dont know how it got there
its there lol
yes you're blond
blonde
Blond noises
r word
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'Connection Error:'));
db.once('open', function() {
console.log("four");```
this is where the issue is
its one of those three lines
Do you remove the listeners at all
i dont beleive so
its a really bad idea to create listeners inside code that runs more than once
every time you run that command, you will have more and more error event listeners
when an error happens, it will log 500 times
if you used the command 500 times
ok
good to know
i still dont understand what the issue is in those 3 lines
we dont make it to four
is that it?
probably because the database is already open
I've literally never seen anyone interact with their mongodb like that
Can anyone help me?
it happens on a fresh start
You should have a pool w a connection in your main file
Woww
that's the best course I've ever seen!
thank you so much!
Or a single connection in your main file lol
Then why a-
and magically that worked for a little bit
This clownery
its bad
Stop looking for bandaid solutions lmao
ik
dont ask to ask
Imo revert back to your old code where you handle your db in your main file lul
And fix it from there
Cuz what you're doing rn is not scalable
im trying to do that
i dont remember how I carried over the connection though
setInterval(() => dbCheck.dbCheck(bot), 60000)``` this is how I start it, could I just pass everything through there?
like my db connection?
erm can you give me more context with your main bot file of what you're doing
you should be able to pass it through as a param/arg
im not too familiar w mongoose so i have to check the docs a bit tho
reminderAdd.messageReminderAdd(bot, db);``` this is how I start the function
seems as though you're already passing the state of the DB connection
so you shouldn't need to create new ones
i want to pass the db itself
so i can do db.once()
and preform the action that way instead of opening it 5 million times
if i do that tho, its undefined
scratch that
it just doesnt work no error
so then you're passing something undefined, so it's a deeper issue than that
no its defined
thats why i said scratch that
i was scrolled up lol
db.once('open', function() {```
this right here is the issue
i just dont know how to find out what it is
-bash: line 7: nodemon: command not found
its so i can use rs
to restart
when i make a change
but gave me that error
Hi
I get some trouble
at VoiceConnection.authenticateFailed (/app/node_modules/discord.js/src/client/voice/VoiceConnection.js:296:27)
at /app/node_modules/discord.js/src/client/voice/VoiceConnection.js:324:61
at Timeout.<anonymous> (/app/node_modules/discord.js/src/client/BaseClient.js:83:7)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7) {
[Symbol(code)]: 'VOICE_CONNECTION_TIMEOUT'
}
Should I learn how to use a database or use a json file for storing data?
Is there a suggested guide and database for discord.js?
i recommend learning SQL and using better-sqlite3
sqlite is an embedded database, it runs together with your code, doesnt need a dedicated process
and learning the SQL language will make it easy to use many other databases out there later if need be
Ty
is mongo harder than just standard SQL?
mongo is easier to start with, but harder to configure and use right
yeah that sounds just like my experience lol
Recommend using postgreSQL with something like DBeaver to start with
I use postgre
Should I get the DB browser for SQLite?
its good to help you visualize your data
Ok
@quartz kindle im still having the same issue from earlier but i've tried messing around with it for an hour or so,
//MongoDB Connection
mongoose.connect('redacted', {useNewUrlParser: true});
global.db = mongoose.connection;
const db = global.db```
this is my index file,
```js
db.once('open', function() {```
in my other file doesnt work and i dont know any other way to use it across other files without using global
like im stuck
global
how else do I do it
its the only way i've gotten my db into the other file
and i dont get why it still doesnt work
Have both files require a file which exports only an Object and then Object.assign to that Object
so like a file that connects to the db, then export the db object to other files?
No. You can connect to the db in the main file and then require the file which exports an Object then Object.assign(objectFile, { db: mongoose.connection });
You'll have to require the command files after this is done, though as trying to destructure an object which may not have a property yet, might throw an error
well i already have a file where i export variables
so would adding it there work?
its actually where I store all the schemas and models
๐คฆโโ๏ธ
i dont get what the object and object.assign stuff means
i've used module.exports but to be totally honest I dont get what that means
like can I have an example
of just like anything using that
{} is an Object
Object.assign(targetObject, properties)
both targetObject and properties is an Object and targetObject is getting the references from properties duplicated into it.
what is .assign doing though?
like i dont understand how I can use that now in my context
example usage
const oldObject = { test: 1 };
const newObject = { something: 2 };
Object.assign(newObject, oldObject); // { test: 1, something: 2 };
Implementation:
index.js
const passthrough = require("./passthrough.js"); // {}
const mongoose = getMongooseDBConnection(); // probably not actually named this. Just for demonstration.
Object.assign(passthrough, { db: mongoose.connection });
require("./add.js"); // notice how this is after the assign.
add.js
const passthrough = require("./passthrough.js");
const { db } = passthrough;
db.doWhatever()
This is more efficient than passing the state of something through a function
so the first block is add.js, a seperate file right?
What? No. The first block is a demonstration. Look at the implementation
oh oh oh
why not use the spread operator? const x = {...{test: 1}, something: 2}
i meant passthrough
spread duplicates the data instead of passing the references afaik
not memory efficient
const passthrough = require("./passthrough.js"); // {}```
basically what is this referencing
an empty file I make?
an empty file which only exports {}
I mean. You can put stuff in it, but I keep it empty and assign stuff to it
Does anyone know any good and reliable websites for hosting websites
If it's just a static website, Heroku
https://vercel.com/ is like Heroku 2.0
Error: Cannot find module './Functions/empty.js'```
//MongoDB Connection
mongoose.connect('', {useNewUrlParser: true});
Object.assign(empty, { db: mongoose.connection});
require("./reminderAdd.js");```
Then you're not providing a valid path. require only accepts relative paths to the file you're currently in or absolute paths.
not the cwd
that was weird
alright gonna try it
im praying that it works
and that i didnt mess it up somehow
If you didn't resolve that cannot find module error, then it won't
i did
ok
did you restart after you fixed it
Are you attempting to require that file before the Object.assign through some sort of readdir
no
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.
thats index
Why do you export stuff in the index 
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.
this is what add.js would be
oh thats to get the bot to work in other files
true
what is line 74
yeah
did you mean to use the variable you declared at 52
that used to be defined somewhere else
as the function
so yes i was gonna try and use that
assuming i cant?
assigning to global 
Oh my god
require('events').EventEmitter.prototype._maxListeners = 100;
LOL
I FORGOT ABOUT THAT
OH GOD
i wrote that 3 or 4 years ago
back when I used this for something else
some random person told me to
so I did
ยฏ_(ใ)_/ยฏ
just gonna delete that real quick
That random person who told you to do that is retarded

yeahh
i need to fix a lot
probably why i cant find out which of the 50 million issues is causing everything to go down
How was "./Functions/reminderAdd.js" being required previously
Ah. I see. Okay. So, what are you using messageReminderAdd for in the index
it's supposed to link to the file where the messageReminderAdd function actually is
i pretty much just split up every function into its own file
so i didnt have a massive index
???
The variable messageReminderAdd isn't being used at all in the index. Why is it being required in the first place?
So. You assign something to the global variable when you could just export it?
That's not in the index
no???
reminderAdd.messageReminderAdd(bot); would currently throw an Error since reminderAdd is undefined
If you're just trying to pass the state of bot to reminderAdd, you can use the passthrough as well
still nothing happening
why do I need the passthrough in the first place though, is there not a simpler way just to pass my db variable into the file?
No
In all honesty, you can but it's not clean.
Would you rather pass the state of something into a function every time you try to call that function, or just have it be a 1 and done and actually have that function have parameters it only needs
obviously i'd rather do the second way
but i think im not understanding how to do it
Put console logs in your add file to see if it's loading properly and if functions are actually being called
Okay. So. What debug info are you getting
i know its not getting past where I hit the Object stuff
then try console logging before the Object stuff
Oh my god
bot.on('message', (message) => {
bot.user.setStatus('online');
bot.user.setActivity('')
});
put a console log before and after the mogoose connect
Object.assign(blank, { db: mongoose.connection});
doesnt go past here
according to console.logs
woah wait
i restarted
and it just did it?
wth

ok
so we make it into the other file
with our db
db.once('open', function() {```
still does nothing
Probably because it's already open
Yeah
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
at checkListener (events.js:112:11)
at NativeConnection.once (events.js:435:3)
at MessageCollector.<anonymous> (C:\Users\Sam\Desktop\RemindMe\Functions\reminderAdd.js:53:16)
at MessageCollector.emit (events.js:315:20)
at MessageCollector.EventEmitter.emit (domain.js:467:12)
at MessageCollector.handleCollect (C:\Users\Sam\Desktop\RemindMe\node_modules\discord.js\src\structures\interfaces\Collector.js:100:12)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
code: 'ERR_INVALID_ARG_TYPE'
}```
db.once(function() {```
what do I use instead
nothing
just do the code that's inside that function
Preferably don't cry about it
can someone tell me about context and pass context
Can you explain your issue? I don't know what you mean by context and pass context, so explaining may help.
Yes, but context in what context? Variables? Scopes? Language use?
Context is broad, so the definition of context may suit you. Sometimes, a variable's context may mean the value / what it currently represents, like a user.
oh thanks all
Variables can be block scoped which means they're limited to a specific context. This means that you cannot use it outside of that scope
tysm
a context class in a library is quite literally a textbook definition of the word context
it couples variables together in a single class, ergo context
bruh
pass_context in dpy?
iirc that is outdated code and you don't need to worry about that.
anyone here knows how to fetch data from a tuple list?
What
hello im need of help
currently im hosting a lavalink server but is not using the correct port why?
can i see your config @earnest phoenix
which one?
the lavalink one
Guys, the MANAGE_CHANNEL permission includes MANAGE_PERMISSIONS, right?
uh i dont think so
lavalink start up with 8080
so i change it to 8080? right @misty sigil
Like, for changing channel permissions
it doesn't
Damn, I'll have more stuff to solve then
Like, I have a lock/unlock commands
But I can't lock the channel if the bot doesn't have manage_perms perm
If only the logger threw any error at all
Node: '127.0.0.1', has error: 'Unexpected server response: 401'.
this i what i get it
Bro why
commands.has_permissions(manage_server=True)
Not working ?
Thatโs unauthorised @earnest phoenix
how can i turn a user ID into an avatar URL?
you need the avatar hash
how can i get that?
from the user object
i have the user object, because i can get the username of it and everything
but it cant get the avatarURL
it has the same password and everything why is unauthorised? @misty sigil
im getting sleepy on no
Can anyone tell ?
๐ฅบ
i have the user object, but when i try to turn it into an avatar url it says nothing in console and doesn't even send the message
why do i see a yellow sphere with two candy corn on it with a turd lying under them

show the object
Read the docks
Thanks
Np
dbl.getUser(vote.user).then(user => {})
k
Loggers
You'll see the avatar property
hm
i dont think i will be able to setup this today ugh
it doesnt even detect a vote anymore
Use https://cdn.discordapp.com/avatars/<user id>/<avatar hash>.png?size=<size>
Is node.js better than python ?
i had it working earlier
๐ฅบ
very subjective
"how to start a civil war in one step"
once again why do i see a yellow sphere with two candy corn on it with a turd lying under them
^
every language excels at something but falls flat in something else
oh god
now i can't unsee this
LOL
"is x better than y" is very dependent on your use case
No cap
Go away
real programmers use a pen to physically write code into their hard drive
Hmm
punch card programming
i just realized intellij looks a lot nicer now
Pls no emoji spam
pog invite url
yes it's my secret hentai server
๐ณ

Hi, all! I have a question about bot submission: do I have to provide a link to my bot's code?
no
doesn't matter if your bot is open source or closed source
as long as it isn't a carbon copy of another bot
It's my own bot, not a copy. Thank you. ๐
Also, on the "Bot Edit" page on top.gg, there are some numbers listed in grey in the "Other owners of this bot" and "Servers this bot is in" fields. Are those numbers random, or pre-populated based on some information?
Ok, thank you! ^_^
no clue, what's the error maybe
There are so many redundant things. Why are you assigning userAvatar but not using it? Is user even defined? str(user) str() there is kinda useless. Also, there's a shortcut for ctx.message.author which is ctx.author
line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Expected discord.Colour, int, or Embed.Empty but received type instead.
You need to pass either an instance of discord.Colour, int or Embed.Empty, not a class type to the color kwarg as the error says
ok
@earnest phoenix bro bro

@earnest phoenix
i am so happy
yeah
i had copied the code
and it worked that time
but stoppped working
now i got it
What you posted there would never work
tysm for making me understand
๐ญ
I was just saying what the error says, but np
how can i use a custom font for styling my page



