client.on('message', message => {
var args = message.content.split(/[ ]/);
const admin = alist.includes(message.author.id)
if(message.channel.type === "DM") return;
var command = message.content.split(" ")[0];
command = command.toLowerCase().slice(config.prefix.length);
if(!message.content.startsWith(config.prefix) || blacklist.includes(message.author.id)) return;
#development
1 messages · Page 539 of 1
can anyone delet this
this channel is for development related questions, not for asking for shit lmao
and glitch is for fucking websites

dbl is on do
@modern sable can you ask this guy to stop shit posting
@earnest phoenix DBL is hosted on a server and not glitch
@coral trellis there's a pin post with awesome useful resources for js ... could you please edit it so it says Object ORIENTED instead of ORIENTATED ?
also sorry for the trouble
Eh I’m on my way to the airport if I remember in a week then sure
Thank you
What help?
almost everyone here knows js lul
I queued my bot on the approval list, do I also need to invite it on this server ?
@grizzled crane you can't invite here the mods do that
and they will have to test and approve it first
also you should probs get a host maybe
ok
wait
const dbl = require("dbl.js");
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
module.exports = class EmbedCommand extends Command {
constructor(client) {
super(client, {
name: 'dbl',
aliases: [],
group: 'admin',
memberName: 'dbl',
description: 'TR Discord bot liste bot istatistiklerini gönderir.',
examples: ['dbl'],
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
async run(msg, args) {
let dblClient = new dbl.Client({
dbltoken: "dbls token",
id: "Your İD"
});
dblClient.postServerStats({serverCount: `${this.client.guilds.size.toLocaleString()}` , shardCount: `${this.client.shard.count}`}).then((stats) => {
msg.channel.sendMessage('Discord bot liste istatistikler gönderildi.');
}).catch((e) => console.log(`${e}`));
dblClient.getBotStats("Bot id").then((stats) => {
console.log(stats);
}).catch((e) => console.log(`${e}`));
}
}```
@proven obsidian
d.js or commando?
commando 
ok
Hello
const schedNumber = 1;
const currentSchedArray = new Array();
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched['schedNumber'])
console.log(schedNumberExists)
Uncaught syntax error unexpected token &
HI
understandable
HI
well, at least provide what line it occurs on
What line number, jesus
That's the only code
const schedNumber = 1;
const currentSchedArray = new Array();
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched['schedNumber'])
console.log(schedNumberExists)
Uncaught syntax error unexpected token &
This is the ONLY CODE
it doesn't say line number
That's the whole code.
where are you seeing the error
mobile
That's the end of the error
well shit, use a real interpreter
Can you?
i have no idea what Dcoder is
`npm ERR! Unexpected token { in JSON at position 69683 while parsing near '...": "^1.1.3"
npm ERR! {
npm ERR! "name": ...'
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npm-cache/8.14.0/_logs/2018-12-21T17_35_03_973Z-debug.log`
pls help me
**npm ERR! Unexpected token { in JSON at position 69683 while parsing near '...": "^1.1.3"
npm ERR! {
npm ERR! "name": ...'
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npm-cache/8.14.0/_logs/2018-12-21T17_35_03_973Z-debug.log**
help mee pls
cool
read
so you don't see the imgur link?
@keen drift its this app on the play store where you can "code" on mobile
const schedNumber = 1;
const currentSchedArray = new Array();
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched.length > 0)
console.log(schedNumberExists)
Can you really quickly try that
why are people coding on mobile
it's like an ide but it has most of the programming languages
what
That should be right because the filter actually
Filters something, right?
That above is right?
No access to pc rn
Anyone can try this pls
const schedNumber = 1;
const currentSchedArray = new Array();
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched.['schedNumber'].length > 0)
console.log(schedNumberExists)
numbers don't have the length function
what are you even trying to do
Oh yeah
It's just nothin
const schedNumber = 1;
const currentSchedArray = new Array();
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched.['schedNumber'] > 0)
console.log(schedNumberExists)
That's right.
Can someone check pls
that isn't
because json
i'm 99% sure you can do without the dot
also don't put it in a string
pretty sure
const schedNumber = 1;
const currentSchedArray = new Array();
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched[schedNumber] > 0)
console.log(schedNumberExists)
How can i check if property name is > 0
ok
what is that code even suppose to do
How can i do it? If the property name > 0 @keen drift
I'm trying to see if a property name same as the arg exists
Otherwise it won't continue command @keen drift
...
So how can i get property name.
Or value
const schedNumber = 1;
const currentSchedArray = [];
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched.hasOwnProperty(schedNumber));
console.log(schedNumberExists);
const schedNumber = 1;
const currentSchedArray = [];
currentSchedArray.push({
1: schedNumber
});
const schedNumberExists = currentSchedArray.filter(autoSched => autoSched.hasOwnProperty(schedNumber));
console.log(schedNumberExists);
what database should i use with dart

also if im making a bot what platform to use
for dart
i guess server makes sense
server probably
im gonna use mysql
im making my new bot in dart and it needs databases
oHnOeSitSsQL
Use postgreSQL
I think mySQL is a bit too much for a first database user or whatever. @knotty steeple
JSON file is better actually.
what
Use JSON file to save stuff
no
What
Oh ok.
json can be corrupted
Really?
So can datbases
so dont say anything?
if you read what i said you would know i wanted a database to use with dart which is a programming language
how is postgres better
I lied it is not easier(wait what) to use. But it is better for sure
Relations, ARRAY data fields,
There's no point in making a bot with dart
Literally the main reason everyone uses dart is for flutter
"All I'm saying mySQL is overkill postgreSQL is easy to use."

Mysql is literally easy just select values in table where id=''
how can i do send servercount dbl?
when i do the command for my bot to play a song it just says not found even when i do the exact song title
@loud salmon
i didnt mean that i could help you
your answer is pretty vague anyway
i meant to say put that in development
can someone help me pls
when i do the command for my bot to play a song it just says not found even when i do the exact song title
Ok so I haven't used VS code in a while how do I change the terminal from powershell to cmd?
Thank you
when i do the command for my bot to play a song it just says not found even when i do the exact song title
its nadeako
Then somethings wrong with whatever api you’re using to get the song
ok no but my bot is made of nadeko
🤔
Lol
still ask in nadekos server
ok
That was the wrong emoji
Nooooooo how’d u know
...
Yeah. You don't need to join this server to ask how to invite. Also probably could've just googled it
its not hard to do
yee
i cant tap authorize button
cause you need to be signin to your discord
i sign in
;-; then you don't have proper permission to do that, talk to the server owner to do it, or get the proper permission to do so
then do it on your own server
yes
easy
how i get this premesion
to add a bot to your server you need the permission "Manage Server". If you don't have it, ask the server owner to give it to you or ask them to add the bot
i logined on discord
did you login on the bot website?
the permission "manage server" is within the server you want the add the bot to
i cant login there
not that hard mate
next time, please look on online before coming to us for help that doesn't include making a bot, and running to problems with it.
@noble coral in ordered to get the permissionManage Server inside the server you want to add it to you must either (Have a role with either the permission of Manage Server or Administrator) and/or (Be the Owner)
yes
How can I make node work in the cmd terminal on VS code?
It isn't working and I have never faced this problem
It says Npm is not recognized
either install node in the correct folder or add node's environment variables to PATH
^
It's still not working
try reinstalling node
Ok
uh
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
check the logs
i have
-- Unit nginx.service has begun starting up. Dec 21 13:40:02 ajhasavps nginx[17324]: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:1 Dec 21 13:40:02 ajhasavps nginx[17324]: nginx: configuration file /etc/nginx/nginx.conf test failed Dec 21 13:40:02 ajhasavps systemd[1]: nginx.service: Control process exited, code=exited status=1 Dec 21 13:40:02 ajhasavps systemd[1]: nginx.service: Failed with result 'exit-code'. Dec 21 13:40:02 ajhasavps systemd[1]: Failed to start A high performance web server and a reverse proxy server. -- Subject: Unit nginx.service has failed -- Defined-By: systemd
nginx: configuration file /etc/nginx/nginx.conf test failed
check your conf file for syntax errors
server {
listen 80 default_server;
listen [::]:80 default_server;
gzip off;
server_name ip anotherip;
proxy_set_header X-Real-IP $remote_addr;
location {
proxy_pass http://localhost:3000;
}
}
i dont
nginx much ok
a
'node' is not recognized as an internal or external command,
operable program or batch file.
did you restart after install
what
I recommend this for the location {}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://serverip:port/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto $scheme;
}
what does it say
Dec 21 13:45:10 ajhasavps nginx[18284]: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:2 Dec 21 13:45:10 ajhasavps nginx[18284]: nginx: configuration file /etc/nginx/nginx.conf test failed
did you revert nginx conf back to how it was before
how exactly do you do that

I'll wait till you guys are finished
literally I put it layman's terms
sudo nano /etc/nginx/nginx.conf
then delete the server shit you added
show me ur nginx.conf
show me ur nginx conf
thats it
exactly
So i want to be able to launch a uri from a hyper link any ideas on how to do it? Anything i try does not work. The uri's are all stuff like spotify:track:3n3Ppam7vgaVa1iaRUc9Lp
So the uri's are ment to open applications
I cant figure out how to convert it to a usuable link
the hyper links need to be https or http
Thats the problem
Dec 21 14:06:02 ajhasavps nginx[22089]: nginx: [emerg] unknown directive "ser" in /etc/nginx/nginx.conf:1
I cant find a way to get a https/http that will redirect to the uri
I thought of using api's but i cant find any that would work?
@knotty steeple show config in hastebin
its ur thing
still show it
hastebin
how do you copy shit
what version of nginx
ye
so it's user www-data;
typos

ok works
cool
Error: listen EADDRINUSE :::3000 
how do i terminate whats using that port
porn
doesn't this interfere with it
listen 80 default_server;
listen [::]:80 default_server;
add ipv6 only
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
i've done that without issues in the past @topaz fjord
if (command == "f") {
if (!client.MisAdmin(message)) return;
let arg1 = args[0]
let arg2 = args[1]
client.unloadFilter()
let filterfile = JSON.parse(fs.readFileSync('./modules/filter/filter.json'))
filterfile[arg1].push(arg2)
fs.writeFile('./modules/filter/filter.json', JSON.stringify(filterfile), async (error) => {
if(error) {
message.reply(error)
client.loadFilter()
return;
} else {
client.loadFilter()
.then(async (res) => {
if(res == true) {
let msg = await message.reply(`Added ${arg2} to the ${arg1} key: ${filterfile[arg1]}`)
setTimeout(function() {
msg.edit(":boom:")
setTimeout(function() {
msg.delete()
}, 500)
}, 5000);
return;
} else {
message.reply("Error: " + res)
return;
}
})
}
})
}```
What's wrong with this? It works, it does work most of the time in fact, but it ALWAYS throws this error in console:
`UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object`
And aswell as sometimes it just stops, it lags my entire bot and just stops literally every other function, the bot goes basically completely unresponsive for no exact reason. I would think that the console'd error has something to do with it so.
Oh my god no why are you loading the file every time
look at that line
whats wrong with it-
whatever
even when my bot goes unresponsive after that and even the error in console it still rewrites the file with the new stuff
but for some reason it still makes the error etc.
sooo...
Where do I ask wth am I to do when my bot gets declined 2 times for the same reason - a reason that wasn't a problem in the first place
solve the issue
They told me my help command sucks but it tells everything it's supposed to
lol
It's one single message that explains the 3 commands it actually has interactions with
naming bots after yourself
need to add perms to it tho
anyways
yes
ask the mod who declined it
and go to the right channel
im "creative"
Husky u need to add descriptions to your commands
That's how it's help command works
You can’t just have the command
ik that @slim heart
Obviously not
Well you should care or else obviously you won’t get accepted
thats not going to get it declined 
my first bot had the same looking help command
no description
Ok samurai we know you’re special
In js I'm trying to pull data out of the discord oauth. I've managed to pull the token from the "response" correctly. Now idk how to make a authorized request to receive data from the scope requested.
Jpberry is right. If you don't put the description of the commands in the help command, then it's not going to help the user in anyway
yes im special
When you forget how to make a cmd handler
omg
Lol
lol
Get the code, send it to your bots endpoint, bot makes authorized request with the code to discord, bot gets token in return, either bot use token and returns info or bot gives token in response, take token, store it, make requests, get info, bada boom bada bang oauth in a nutshell
jokes more like
J - g
O - o
K - t
E - o
S - #memes-and-media
@slim heart ik that, im trying to figure out how to pull data other then the "code" aka "token"
yes
U use code to get token boi
docs say
Ok shutup the docs are dumb
Use the code
Request the token from discord
Receive token
Code and token are two different things
where do you request the token at then?
you redirect user to auth page -> user authorizes -> gets redirected to yoru page with an oauth code -> you send a request to the token exchange endpoint -> discord gives you a token
that's for the regular oauth flow
discordapp.com/api/oauth2/token/CODE HERE RIGHT??
no
you send the code in the request body
i just relized what i said
Or request header
no
not in the header
I do it and it works 
the code is sent in the request body for the token exchange endpoint
the TOKEN is sent in the headers for authorization
k
Discord
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
just read the example code
Also you should be sending it back to an endpoint or something because don’t you have to have your clients id and token to make the request?
Cuz I just set my response to token and store the token cuz I’m lazy
btw @knotty steeple the answer to my question was that i was using readFileSync so i was using sync io which yeah yeah, and then I just had to make it .readFile() and add a callback instead and it worked so
how do you handle reaction role and such ?
on reaction give role
do you store in db like id of message guild + id reaction = id role ?
kind of simple...
well set which reaction gives which role and then when the user clicks the reaction it searches through the db, gets the role id, and gives it
a table with message id, reaction id/unicode, role id would be enough
So I've been looking and apparently the mod-log didn't even record my bot getting denied a second time 
I instead just messaged the guy who denied it the first time
client.on("message", async message => {
if(message.author.bot) return;
if(message.content.startsWith(`@ripe burrow `) || client_settings.prefix){
var command = message.content.slice(`@ripe burrow `.length).toLowerCase();
var cmd = command.split(" ")[0];
var args = command.replace(cmd+" ", "");
var commandfile = commands.get(cmd);
if(commandfile) commandfile.run(client, message, args).catch((e)=>console.error(e));
}
});
Error: https://hastebin.com/uvapolujas.css
I have used this part in many of my bots why is it not working now?
@slim heart in case you still have the problem you mentioned, you're mixing sync and async, which can cause it to try to load the file while its locked saving
I haven
Have*
I know commandfile.run isn't a function
but it has worked before
so why isn't it now?
what is commands
would it be considered api abuse if I generate an invite for the servers my bot is in using a listserver command
commandfile.run is not a function, which means that run was not found in commandfile, which means that commandfile is wrong or undefined, which means that commands.get(cmd) found nothing, which means that cmd doesnt exist or is not a valid command
test.js
const Discord = require('discord.js')
module.exports.run = async (client, message, args) => {
message.channel.send('I AM ALIVE :joy:')
}
module.exports = {
names: ["test", "t"]
}
That is inside the command file
making server invites without the end user knowing is against discord tos
thanks
@_@
I didn't see what tim said
ill tell you go to #memes-and-media if you wont do that

but seriously no shitposting
how come my bot can only react once with the \🚫 but not with the \✅
code by me: https://hastebin.com/ewaramomup.js
and code by a friend of mine : https://hastebin.com/lixahozali.js
NOTE: This only happens to my bot, not everyone else
also they are both similar because we tested both of them
I'm working on implementing A* Pathfinding into my bot and I have no clue how I'm going to visualise the node coordinates...
@visual zenith I can give you the code I use for my bots suggestion system
sure?
rule 7
xD
wait what
code looks fine
XD
??
does anyone have an answer to my question?
what exactly is your question
well do you know how a* pathfinding works
it has a grid and it calculates the quickest way to dodge obstacles and get from point a to b
and it returns a bunch of coordinates
and i want to get those coordinates and put them in a grid or something
so you already have the algorithm, you just want to make a drawing with it?
yea
client.on("message", async message => {
if(message.author.bot) return;
if(message.content.startsWith(`@ripe burrow `) || client_settings.prefix){
let command = message.content.slice((message.content.startsWith(client_settings.prefix) ? client_settings.prefix : `@525815816411676673`).length)
let cmd = command.split(" ")[0];
let args = command.replace(cmd+" ", "");
let commandfile = commands.get(cmd);
console.log(command)
console.log(commands)
console.log(commandfile)
if(commandfile) commandfile.run(client, message, args).catch((e)=>console.error(e));
}
});
Command is undefined
that's what I got back from the console log
.startsWith is a Boolean
Returns a boolean*
let command = message.content.slice((message.content.startsWith(client_settings.prefix) ? client_settings.prefix @525815816411676673).length) what even is this
Am I just not understanding that
@lusty dew
It is supposed to allow me to use both prefix and mention
Is it only when u run a specific/any command?
Right now I only have one command
Its a test command
when I do s-test
it throws the error
ok whats the code in that file
const Discord = require('discord.js')
module.exports.run = async (client, message, args) => {
message.channel.send('I AM ALIVE :joy:')
}
module.exports = {
names: ["test", "t"]
}
and whats the name of the file?
hmmm
I don't understand it
does it say "loaded" etc. etc.
console.log(`${f} loaded and ${inspect(props.names).replace("[","").replace("]","")} are the available aliases`);```
yes
so it's not adding prop
Collection [Map] {
'test' => { names: [ 'test', 't' ] },
't' => { names: [ 'test', 't' ] } }
Senpai#5500 is online
{ names: [ 'test', 't' ] }
Thats the right one
My bad
I grabbed an old one
still not adding props
yea
try doing this
let props = require(`./commands/${f}`);
for(i=0;i<props.names.length;i++) {
commands.set(props.names[i], props)
}```
the only thing i could think of is the foreach loop is causing a problem idk tho
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`);
for(i=0;i<props.names.length;i++) {
commands.set('props.names[i]', props)
}
console.log(`${f} loaded and ${inspect(props.names).replace("[","").replace("]","")} are the available aliases`);
});
console.log(commands)
});
This is what you mean right?
or do I get rid of the jsfile.forEach thing
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`);
for(i=0;i<props.names.length;i++) {
commands.set(props.names[i], props)
}
console.log(`${f} loaded and ${inspect(props.names).replace("[","").replace("]","")} are the available aliases`);
});
console.log(commands)
});
Same error
commandfile.run is not a function
same console.log() too?
Collection [Map] {
'test' => { names: [ 'test', 't' ] },
't' => { names: [ 'test', 't' ] } }
Senpai#5500 is online
I don't either
I have used this same code before
I don't know why it's having problems now
i dont really know Discord.Collection() so i think its the same as every other one but idek
i know Enmap
oof
collections are just extended maps made by discord.js devs
const Discord = require('discord.js')
const client = new Discord.Client()
const fs = require('fs');
let inspect = require("util").inspect;
let commands = new Discord.Collection();
client_settings = require('./settings/bot.json')
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`);
for(i=0;i<props.names.length;i++) {
commands.set(props.names[i], props)
}
console.log(`${f} loaded and ${inspect(props.names).replace("[","").replace("]","")} are the available aliases`);
});
console.log(commands)
});
client.on('ready', () => {
console.log(`${client.user.tag} is online`)
})
client.on("message", async message => {
if(message.author.bot) return;
if(message.content.startsWith(`@ripe burrow `) || client_settings.prefix){
let command = message.content.slice((message.content.startsWith(client_settings.prefix) ? client_settings.prefix : `@525815816411676673`).length)
let cmd = command.split(" ")[0];
let args = command.replace(cmd+" ", "");
let commandfile = commands.get(cmd);
console.log(commandfile)
console.log(commandfile.run)
if(commandfile) {
commandfile.run(client, message, args).catch((e)=>console.error(e));
}
}
});
client.login(client_settings.token)
It says commandfile.run isn't a function I still can't figure it out
I've been having this strange issue where my not apparently seems to keep disconnecting and relogging very often. Does anyone know why this happens?
@sick cloud Can you help?
Do your commands file have a run function?
Yes
const Discord = require('discord.js')
module.exports.run = async (client, message, args) => {
message.channel.send('I AM ALIVE :joy:')
}
module.exports = {
names: ["test", "t"]
}
why did you mention me
Thats the command file
I can't figure out why it says commandfile.run isn't a function
Don't randomly mention people
I have asked many people
did what they said
still keeps popping that error
Also sorry
what lang is it
It's discord.js
VS code
See above for the code
k
const Discord = require('discord.js')
module.exports.run = async (client, message, args) => {
message.channel.send('I AM ALIVE :joy:')
}
module.exports = {
names: ["test", "t"]
}
this?
k
**
wtf is this
if(message.content.startsWith(`@ripe burrow `) || client_settings.prefix){
Its so you can use either Prefix or mention
you want it so when they type just the prefix it is gonna send a message? wtf
Hm?
I'm not sure, but I don't think the code is actually running the file, but rather setting the value as strings instead of an object? Does the send commands work?
nvm
Debugging...
Do your send commands work?
to make sure everything else works
/test command?
and it doesn't work
oh
yea
i see
uhh why are you using a discord collection
Try logging the type of the thing
its a collection
commands is a collection
uhh why?
It may be that your code is saving it as a string instead of an object
im pretty sure a collection is similar to an array, not an object
but you are treating it like an object
not sure though im not familiar with discord collections
also a collection doesnt have the set property
I don't know why it is acting like this now
^^
Oh
I know
module.exports.run = async (client, message, args) => {
message.channel.send('I AM ALIVE :joy:')
}
module.exports = { //this overwrites the run.
names: ["test", "t"]
}```
what
on the first line, module.eports is an object with "run" as an async function
the next line sets module.exports to only have a names array in it
k
removing the run function
fix @lusty dew :
module.exports = {
run: async (client, message, args) => {
message.channel.send('I AM ALIVE :joy:')
},
names: ["test", "t"]
}```
k
A collection is an extended js map
@quasi hearth It still doesn't send I AM ALIVE 😂
@lusty dew hmm. What is the log output when trying to run the command?
nono wait @lusty dew @quasi hearth was onto something keep all of your original code but on the bottom part do
module.exports.names = ["test", "t"]```
ur defining module.exports.run but when you do module.exports = {} again, it just clears out that original run because its rewriting the object
My current challenge is horizontal scaling (scaling across machines), as vertical scaling has become inefficient both budget and performance wise.
My initial impression and idea is to uses k8s (Kubernetes) to deploy my bot clusters. But part of v2 has a centralized API for a dashboard interface. But that’s going to be difficult as cache or data is scattered around nodes and I would have to use a centralized method like a message broker (rabbitmq/nats/etc.) to retrieve them.
One of my concern with that is the availability in case one node goes down; then partial API requests will fail. This is especially prominent when restarting for maintenance or to reshard.
Looking at most databases, the most common method of horizontal scaling is sharding and replication. So one of my idea is to create an abstraction router layer that forwards events and acts as RPC layer for data requests, effectively allowing replica sets per shard. But that seems like an impossible feat at my skill level and timeline. So, the other idea was to piggyback off redis for their method of distributed and replicated cache, and the API would query Redis for data instead of through my message broker. While this does work, I’m also concern on how I should invalidate the cache, say if a shard goes offline, then a guild removed the bot, the redis key would remain w/o knowing it has no use anymore. One idea was to format the redis key so that it would look like shard:x:data-type:data-id, then purge all data associated with that shard and repopulate with gateway provided data but seems unnecessarily hacky.
Then I came across something like FredBoat/sentinel (https://github.com/FredBoat/sentinel), which acts as a router to children bot nodes, which I have no idea what purpose it’s serving. It’s still scattering the data when the sentinel is sharded. Can’t find much, still a WIP repo and I don’t do Java /shrug
You probably have already considered Redis, but mentioning it regardless in case you didn't ^^
I think you can have decentralized Redis, as in you don't need to use its hierarchy feature
maybe can do something like guild-id:data-type:data-id as a key, then invalidate based on calculated shard id
or maybe include shard count along with shard id, since changing the count will also change the ids
Hi
@modern aurora Try keep conversations unrelated to development in #general or #memes-and-media :)
lol
Yes @bitter sundial but wats rong with iT
what error is it throwing
Kaden i Will invite you privé 1 sec
what error is it throwing ?
Hello? I was wondering if you guys could help me, I need to make a premium pais system I thought of doing it through role but I am not sure how you can get the roles of a certain server, thanks :0
pais?
Paid
Sorry
Also the token is like your bots password so now anyone can log in as your bot and do anything including destroy servers @modern aurora
discord.js
do you know how to get a certain guild
Wdym?
Guild = server btw
Ik
So once you have the guild iirc guild.roles is a collection of the roles
ok
you can find the role by name
Did u read the docs first?
On what part though
Wait, one second.
if (!message.member.roles.has(role)) return message.channel.send(premiumMessage)
const guildID = client.guilds.get("518346817558151181");
const role = guildID.roles.find("name", "Premium User")
But it just doesnt seem to work
thats not how you find a role
use a function
in the find
guildID.roles.find(r => r)
Hmm
r has the name property so you can check if that is equal to the role you want
no
Welp
the arrow function gives you each role object, and you want to check each role object's "name" property
hence role =>
yes
exactly
are you using that to check if someone is premium
Yes? Do you have suggestion of a better way?
that system can fuck up sometimes if discord decides to take a shit
you can store premium user ids in a database
that has the added benefit of storing extra information like expiry dates if you choose to add it
definitely a better way of doing it
Ok thanks :0
Do you have any places where I can learn the basics, I have never touched sql before?
just google learn sql
ok cool thanks
if you're not familiar with sql, you could also try a nosql database, which is more javascript friendly (.set() .get() instead of "SELECT N FROM TABLE")
here is a sample
SELECT items FROM table
Ahhh @quartz kindle Something like this? const talkedRecently = new Set();
i used sets for my daily cooldown 😩
regardless, there are literally thousands of databases out there
good luck picking one lmao
i'v been thinking about it for months and still havent decided for one
Sign In | SoloLearn: Learn to code for FREE!
1st is mysql
second is sqlite
third is a website to learn sql
sequelize is good
@uneven depot that's rather expensive, my original proposal is just store the shard id and invalidate itself upon new data
@spark leaf Yes I did bring up redis in my original statement and the problem that comes with that route
@keen drift fredboat sentinel is just so restarts are faster
because the ws connections aren't dropped
Quick question
Is there a way for LL to send the audio stream to two places at the same times
I need your expertise natan
no
Is there a shorter way of doing mongo.db('databaseName').collection('collectionName')?
@inner jewel is there another way besides using LL
¯_(ツ)_/¯
sending from one source to multiple destinations isn't impossible
just that no one bothered doing it
actually
lavaplayer has something that does exactly that
so you want to send the audio to the browser?
yes
you're out of luck then
you'd need a custom LL-like thing
and implement the audio -> browser yourself
but then again copyright is a thing and I don't want to deal with that
Hi
hi
Hi, if loopTime = 200 in the above code then is it bad idf 1k members run this code /\
why would 1k people start a match
@queen violet Scrims
Hi, if loopTime = 200 in the above code then is it bad idf 1k members run this code /\
scrims?
the fuck are scrims
PLS ANSwer my questin
pls answer his question
Hello
its not gonna work if im understanding this right
Who need help
you made a timeout for every 60 seconds
that removes 1 from a value
fortnite scrim = joining a certain fortnite match
Hi, if loopTime = 200 in the above code then is it bad idf 1k members run this code /\
and youre looking for when that time is 200
ITS NOT ONLY FOR FORTNUTE LMAO
stop repeating yourself
any gam where you can ready up and see game identifier
can someone mute this kid plz
still wouldnt work
Anywas, does anyone know if tht pastebin wold be bad if 1k people used at same time?
you do know that you cant join games that are already in progress, right?
forget the concept would it be bad?
theres no universal computing limit
yes
thats not how computers work
omg, If 1k people run that code from my server / computer and loopTime = 1500 would that be bad/
@queen violet
sorry didnt see ya
look
most of the time no one knows what you are saying
repeating it again and again isnt helping
hell i still dont even understand what he wants
why the hell
do you not just
make a list
and when 100 entries are on that list
you look for a match
you dont need to timeout and do all this stuff
- If i had 1k people running that pastebin all at the same time, and the
loopTimewas equal to 1500, would that be bad on memory? What would be a good memory for that?
man if my rpg bot was like this it would go to hell
Omg thats not thwe scrims part can people just answer that question because you will not understand wholely
THIS IS JUST TO RERUN A MATCH THIS IS JUT AN EXAMPEL
Hi, if loopTime = 200 in the above code then is it bad idf 1k members run this code /\
test it yourself we cant know if its gonna run well
can someone please
OMg, i mean will it be bad on memory?
^
thats what im trying to teach you
have matchfinding in my bot
tho not for fortnite
OMG I HAVE A CODE FOR THE MATCH PART THIS IS EOMTHING ELSE
its setInterval
????
jesus fucking christ i already told you
waht?
timeout = setInterval
🤦 ok im done

let time = 1200
let timeInterval = setInterval(() => {
if (time === 1){
clearInterval(timeInterval)
}else {
time -=1;
}
}, 60000)
yes running that 200 times will be bad on memory
also will take 60 times longer than youre thinking probably
and bad on reputation
It works tho
so does a fork bomb
not everything that works is good
ok read above code?
you do realize right
I updated it
explain something to me
^^^ ^^
and learn to write better looking code


