#development
1 messages ยท Page 1425 of 1
google your library and then add input sanitization onto it
hmm my library?
yes
djs?
the library you use to connect to postgres
I don't understand 
It's weird because it was working perfectly fine some weeks ago without this option being enabled
someone @ me if they know how to change the buttons on my bot page with CSS
because the change happened a few weeks ago and intents are now requires if you want to do anything member related
and a quick guide for editing other elements, like i have the inspector menu, just what am i supposed to look at for editing
try it and see
but yes that should work
just selecting the classes and overwriting their properties
how do I change my bot's bg color
same answer i just gave above
O h
I see.. Thanks! Though I don't get how I'm supposed to include this new function in my code yet x)
the snippet lite gave in the message i linked are the client options you're supposed to use
the client options go into the client constructor
google might clear up your confusion
i would link you resources but im on mobile just typing is a pain in the ass
preview doesn't seem to work though
uh any code snippet to make the background color black?
lol
so I think I understand it now, for discord bot use it doesn't seems like something super dangerous to worry about. Even so I am gonna go ahead and "santize?"
it. I am looking at validator npm rn its kinda confusing on what I should use tho
you can lose all of your data
your users can leak it
how can i do that
by sql injection; they're injecting their own statements that can make your db go boom
the first answer i found for pg input sanitization links to an SO thread and if you scroll down you can see how you can use prepared statements that automatically sanitize your input
alright i did search that and it wasall php and eventually i came to validator but ill look at that
I understand, don't worry; it's just that I'm kinda nubie at programming so I'm not used to program new things at all x)
So, in my case, which flag/option and how should I use in my code to make my command work correctly? And I'm sorry if I'm bothering you now, lol
i think its SERVER_MEMBERS or something like that, again check the message i linked
it has a link to a valid list of intents you can use
you basically put intents you need in an array
@earnest phoenix Not very familiar with sql or psql or db at all, perhaps you could tell me some of the special characters that should be filtered?
I am gonna try to use this thing https://www.npmjs.com/package/validator
i want the bot to do "variable%"
but i dont know how do get the variable and the % in the same message
this did work
if(message.content.startsWith(prefix + "cutieness" )){
if (message.channel.nsfw === true) return;
else message.reply('Sorry this is not a nsfw channel!')
this did not work
if (message.channel.nsfw === false) return;
else message.reply("This is a Nsfw")
}
how do i fix it
wtf is this garbage
wtf


that one seems somewhat useful does it not?
if(/@.*./.test(string)) return true;

but without installing a whole package bloating your code
@stark abyss i dont understand why you need a third party lib when the one you're using is probably already capable of prepared statements and sanitization
oh
ok
how do i put a variable and text in the same message
Ah I think I understand now
i am not sure what you mean but
let user = "idfk"
message.channel.send(` Welcome to this server ${user}`)```
Thanks cry, I think I understand how this works now. I should be able to find the right resources now. I am gonna sleep now lmao gn
can u help me #development message
Help
@lucid prawn what do u actually want to do?
do just want to check if the channel is nsfw?
hmm
is it possible to install opus without root perms?
so u just need to check if the channel is nsfw, if it is, then u send an embed
and then u can put an else statement
How do you get a bot to tack a % to the end of a number that varies based on user inputs
if(message.content.startsWith(prefix + "fuck" )){
if (message.channel.nsfw === true) return;
else message.reply('Sorry this is not a nsfw channel!')
}
else(!message.channel.nsfw) return
else message.reply("This is a Nsfw")
like this @stark widget
is it possible to install opus without root perms?
if(message.content.startsWith(prefix + "call" )){
if (message.channel.nsfw === true) return;
else message.reply('Sorry this is not a nsfw channel!')
}
if(!message.channel.nsfw) return
if (message.channel.nsfw === false) return;
else message.reply("This is a Nsfw")
Like I want the bot to display a % at the end of this
rn u are checking if the message is prefix+fuck, then if it not, u are checking if the channel is not nsfw, and it is amess
is it possible to install opus without root perms?
ok, im back
how do i put a '%' at the end of final.
@lucid prawn first of, check if the the message is prefix+ call, then in the {} brackets, u can do another check if the channel is nsfw or not
@limpid bear https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
@lucid prawn this is how if checks work:
if(condition){//do something with it
}
@twilit geode api reference
@stark widget the {} thing is called body
if () { //Statement
//Statement body
}
put that in my code like this
if(condition){
if(message.content.startsWith(prefix + "fuck" )){
if (message.channel.nsfw === true) return;
else message.reply('Sorry this is not a nsfw channel!')
}
if(!message.channel.nsfw) return
if (message.channel.nsfw === false) return;
else message.reply("This is a Nsfw")
}
i know js
then why are u messing up
From the look of the code, no you dont.
i just not did that before
Just learn how syntax work or the language work
@lucid prawn learn atleast basic js
And you will know how to fix your code
that would help
ye
the command worked when it no nsfw
it did not work when i turn it on
@stark widget
@earnest phoenix do you know a way to get opus without root access?
Uhh
Idk how opus work
k
rip
Send the the opus doc, i will see what i can do
@lucid prawn please learn js please
ohk
@lucid prawn just take my word
Learn js.
Its better to learn the language and then watch tutorial after
Bad
i never watched a tutorial can u recommed one
Bad
I mean learn js then watch tutorial about js not making a bot


W3 schools for begginers
Mozilla docs for intermediate
Actual node docs for advanced
i fixed it and i will learn js bye @earnest phoenix
Is here fine
@earnest phoenix is here fine?
ok
my error is this:
C:\Users\OneDrive\Documents\GitHub\DynamoBotReboot\index.js:6
const dbl = new DBL('the auth token is here', client);
^
ReferenceError: Cannot access 'client' before initialization
at Object.<anonymous> (C:\Users\thoma\OneDrive\Documents\GitHub\DynamoBotReboot\index.js:6:180)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47```
but what do i need to change?
You read the error
And search google for solution
And read the code
And fix it
In a nutshell
Let me think
You didnt initilize the variable client
So your code should have smth like
const client;
// or
let client;
// or
var client;
ok
its already there
Initilize it then
kkhttps://opus-codec.org/docs/
Opus documentation
also i am using a service called something.host
i found this for ffmpeg, hopefully we can edit some parts to work for opus```wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz && tar xf ffmpeg-git-amd64-static.tar.xz && rm -rf ffmpeg-git-amd64-static.tar.xz && mv ffmpeg-git-/ . && rm -rf ffmpeg-git-*
@earnest phoenix
if that would help
๐
client.once('ready', () => {
console.log('BOT ONLINE!');
client.channels.cache.get("783533581808959499").send("logged in");
client.user.setActivity(`${prefix}help in ${client.guilds.cache.size} servers`, { type: 'LISTENING' });
});
im trying to have it msg in a channel that it has come online, but im getting this error and I dont know what it means
(node:684) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/runner/NonUtilityBot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/runner/NonUtilityBot/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
(node:684) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:684) [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.
wait
i might be dum
read it and you will then understand it
I THINK I JUST DID A BIG STUPID
quite possibly
my fucking god
im so stupid
i thought it was a code error
or some of discords new bot perm shit
I need some help whenever i close the debugging console my bot goes offline is there a way to keep the bot online all the time????
I am using atom to code my bot
and whenever the python console closes the bot's commands don't work and it goes offline would i need a website??
i think your console is your terminal?
wwhere you started running the bot?
how would i change this is my first time using atom
so idk
when you turn off your pc, does your OS still run? obviously not, in the same way if you close the program that is running your bot, it won't stay on
console = core of your bot
so i always have to have it open
if you close it it is ded
alr m8 thx @proven ivy
your welcome
if you want to keep it running 24/7 without having your pc turned on, look into renting a cheap VPS
how do a make a bot message go on to the next line
no
yeah
look i have cPanel Web Hosting
Can I Host My Bot There ?
I Got 1GB RAM
also no
Why ?
because it isn't a vps
oh
it's a webhost
But I Got SSH Also
well it cant be this
i mean if it can run your language, sure
@limpid bear /n is not the same as \n and for gods sake please learn js because that code makes 0 sense
yeah
so when it asks:
the URL you want the webhook to be sent to
how do ik what that is...
\n is a unicode character like any other, you include it in your string
<br> is same as \n
@twilit geode the url to your web server
The logic is similar, the functionality differs between environments
what kind of web server... My ISP doesnt allow me to open ports on my internet
not... entirely...
What does a webshook do?
Can I Host My Bot On My 2nd PC
in the simplest terms it's a reverse API
instead of you making requests to the site, the site makes requests to you
jesus
What happened ?
@twilit geode please tell
bro im the one who doesnt know lol
you need to have an active web server listening for requests
your upload is higher than your down lol
rent a cheap VPS that will act like one
Yeah
How much time will it take to make my bot review
Generally inj Our Area No One uses Upload So I Get Upto 700Mbps
I uploaded it
mine was about a week, a couple days ago
uh... anyone know how to fix this?
everytime you ask an extra week gets added
bot.on("message', message => {
is that glitch ?
error f
yes
yeyy
i have to use glitch till next year cuz cpu usage
any one help
same
i use heroku anyhow many problems
i have almost 15-16 accounts on Heroku as it provides 450HRS Of Worker Time
Per Month
cc addd
Brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
u indian aa ?
more hour
cough pi zero cough
well, we can't help you if you don't state what exactly is your issue
imagine going to the doctors and just saying "this hurts". okay, where does it hurt? when did it start? what type of pain?
yah
hahaha
nice
me too

??
@earnest phoenix
@earnest phoenix
@earnest phoenix
i dont understand how that is even remotely spoon-feeding
@earnest phoenix
@earnest phoenix
keep your autistic tendencies outside of the chat
@earnest phoenix
stop spamming dude
have to drag it out of them @earnest phoenix
gg
that's how it is with most people here, it's like having a conversation with a five year old
lol
Heroku
nothing is free
2020-12-02T06:08:37.831596+00:00 app[worker.1]: token_bot.on("message', message => {
2020-12-02T06:08:37.831597+00:00 app[worker.1]: ^^^^^^^^^^^^^^^^^^^^^^^
2020-12-02T06:08:37.831598+00:00 app[worker.1]:
2020-12-02T06:08:37.831598+00:00 app[worker.1]: SyntaxError: Invalid or unexpected token
2020-12-02T06:08:37.831599+00:00 app[worker.1]: at wrapSafe (internal/modules/cjs/loader.js:915:16)
2020-12-02T06:08:37.831599+00:00 app[worker.1]: at Module._compile (internal/modules/cjs/loader.js:963:27)
2020-12-02T06:08:37.831600+00:00 app[worker.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2020-12-02T06:08:37.831600+00:00 app[worker.1]: at Module.load (internal/modules/cjs/loader.js:863:32)
2020-12-02T06:08:37.831601+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2020-12-02T06:08:37.831601+00:00 app[worker.1]: at Module.require (internal/modules/cjs/loader.js:887:19)
2020-12-02T06:08:37.831601+00:00 app[worker.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-12-02T06:08:37.831602+00:00 app[worker.1]: at /app/index.js:39:21
2020-12-02T06:08:37.831602+00:00 app[worker.1]: at Array.forEach (<anonymous>)
2020-12-02T06:08:37.831603+00:00 app[worker.1]: at /app/index.js:37:11```
Brr

does this thing no longer support today or what
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
it won't matter which version you use
its alrdy the latest ver
^^^
what ?
which means if you run into issues, there won't be support for it
haha
sad times
๐
Hey Can I Install Ubuntu in My 2nd PC & Host My Bots What About It ?
or in VMs
oh just noticed your message, you can do it on glitch btw, but it sometimes need to reactive by opening the project again (around every 2h-3days)
put this on server.js before the token part
setInterval(async () => {
await fetch("https:// (your project name) .glitch.me").then(console.log("Pinged!"));
}, 300000 <you can change this to any number 1-300000, but better 200000+ for no logs spam>);```
if u're taking the risk tho..
What About Azure ?
you could do github student too, i think it gets you 100$ for digital ocean or azure
same
i just posted 3 reliable ways you can do
if you care about quality, dont use glitch or heroku
if you dont give 2 f's about your bot's uptime and quality, go ahead and use them

if you care about quality
Crossing this out
haha
i noticed one thing
i need to restart my bots everyday to make sure its working properly in heroku
i use glitch cuz ill get my new laptop after new year, my current one always consumse so much cpu usage
you use glitch cuz you bad dev
and that
glitch wont keep your bot on 24/7
I have a $2/month VPS host multiple bots for me without any issues
yes, then he goes and uses uptime pinging bots to try and keep his bot alive
not always, but i can still make it active when my laptop turned off atleast
even though glitch and heroku arent meant for bot hosting
lol
which is against their TOS btw
i have 35 Dollars Hosting / Year For Website
Heroku doesn't sleep even
nah, never turn off my laptop even im sleeping, just restarting it xd
it just poofs
Heroku, sleep it's 12am
it restarts once in 24 hrs
1000 with attached CC
550 h sounds about right
Yup
550 hrs is less/month
if you going to put a credit card, might aswel go AWS for a whole year for free trial
yeah
how to develop a bot on discord anyone want to give examples ๐ i have learnt many coding languages like JS , JSX , python , C++ , lua ๐
yeah
and for the guide go to discordjs.guide
ok
what do you mean by dev kid? well everyone with green names is a dev for sure, but a kid?
idk
im having flashbacks from when i was acting like this when i was 14

bragging about knowing popular stacks but you actually just know the names
lmao
Lmafo
lol
can some one say how to add permission to a channel during creating by bot that everyone cant send message
@dark coral i assume you mean young developer
You are not 13?
no... not yet...
@coral trellis
this is my brothers account
you break Discord TOS you know
bcs of COOPA all users need to be atleast 13 years old
Fun fact, i am 13 year old bot dev :^)
i also
i made a website without cms
What's cms
I reported :)
think wordpress etc
Content management system
Oh
yes
Cool
They were banned
this is my brothers account
NanoMaxico
RIP
possible just a cheap excuse
why should he use his brothers account wtf
he didnt even know what TOS means
or he just used his real birth date on initial registration and then got flagged
can some one say
thanks
how to tag a user how joins server by bot
what?
in discord.js you can just parse the member object to a message and it will mention the user
we cant tag like @ name
u tagged someone
channel.send(`${user_object}`) will mention the user
you use strings. javascript just joins strings
if you want to use them in math convert them to a number
use int
how do i use int
parseInt(args[i]) is how you parse one of the arguments to an int
int(var)
use Number() in your case
i used number on the args. but same results.
well you parse them again into a string
send(Number(args[0])+Number(args[1])+Number(args[2]))
I'm not really good with databases but is requesting a guild config from mongodb something ok to do every time a message is sent?
nope
Is it a bird ๐ฆ
Is it a plane โ๏ธ
No it's a superbrain (8) ๐ง
cache your results
Database are designed for lots of queries and smart databases cache anyway. Doesn't mongo do this ?
If you're also using e.g. redis for your cache that is working the same way
so you're saying mongodb caches it ?
I don't use mongo, I'd assume so? That was my question
no mongodb doesnt cache (only keys)
ok look. the code i sent is an error message. and the problem was args 0 was not more args 1. but it says that it is.
ok
regardless whether the database caches or not you shave off extra time to access the database when you keep a local cache
i recomend using a map. i have currently a local running redis server for caching
I locally cache the results of complex queries only
But I'm using a mysql database and it does cache very effectively, for a database on localhost you won't see a performance issue with this even with tens of thousands of servers if done right
For the local cache I use std::unordered_map
yeah for localhost it scales super well, there's practically zero latency
it's unrealistic for large bots to use the same machine for their shards and to keep a database though
you could still use a local cache tho
yeah
My system expects that each server has a local instance of a master-master mysql cluster on it
But I won't have to scale out until at least 200k servers
Which really is huge bot territory imho
this is a nice thing with mongodb, you can super easy scale it *vertically
it's best to do optimization as soon as possible rather than letting it be an afterthought imo
i was going to say this earlier but i forgot what i was going to say lol
well most people who dont put efford into scaling Mysql servers properly tend to just bruteforce it with more powerful hardware
Yes, however avoid premature optimisation... Does js have a proper runtime profiler?
I use valgrind to profile my c++ and determine where optimisation is best placed
im fairly certain it does
Every interpreted language really is written in C or C++
But tbh V8 is a memory hog
how to make bot
CPU efficient for a js interpreter but at the cost of ram
what
If you want CPU and memory efficient js at the cost of compatibility look at duktape.js
i think about switching to C# from js but its so much stuff i have to port over
id say it's worth it
the net core, or rather just net now, garbage cleaner is insanely good
i know its worth but so much stuff to re learn
My bot is currently on 3gb ram
barely 100MB but with about 300 Guilds
You can get similar efficiency with well written C#
the server here has some helpful #502193464054644737 where your answer will be answered
Aegis is an odd library, it'll take 200mb just to start up with no guilds but memory increases super slowly, and linearly with guilds
43000 guilds and 3.3 million users is 3gb for me
hmm. switched a while ago to Discord.js-light and it cut down Memory usage by a lot (used to run with about 200-300MB ram while serving 80 Guilds)
There's CPU oddities though caused by a library bug
If i were to rewrite my bot i would probably use java... But I'm fine with eris and node js currently
ew java
thats like saying "if i was going to rebuild my brick home i'd use sugar cubes"
each to their own i guess!
and why do u hate java ?
i dont hate java - i hate the way its taught academically in colleges, universities.
i see very little efficient well written considerate java that isnt a memory hog, because of stupid practices
java can be done well, it doesnt happen often because of the culture around it
lets not include android dev, theyre forced to be efficient there, more so than desktop/enterprise/server
when i learned it, there was a culture around it that went like this:
"java has a virtual machine, you should imagine that this machine has infinite ram, capability for threads, and cpu, and scaling what you write to fit on real hardware is the job of a systems architect"
typical fortune 500 thinking.
it breeds bad design and antipatterns
but this isnt the fault of the language, but the fault of teachers
it also used to be the case, many years ago, that java WAS inefficient no matter what you did because the garbage collector sucked ass... thats not been an issue since uh... java 1.8, a loooong time ago
I learn by myself mostly and java seems really easy to me cuz i know basic Js
js is nothing like java
the syntax seems similar, same as it seems similar to C++, they both have classes, use semicolons to terminate lines, they have the same flow structures but both demand architecturally different code to work right
if you wrote java like you write js, you'd be in a pickle in no time flat
and vice versa
Most of languages have similar syntax to C++
most languages in the same syntax family do yes
when I was taking courses a couple years ago they still emphasized the importance of efficiency and optimizations even on a vm
then you have things like python, BASIC, erlang, perl, etc, that look nothing like C
@tranquil drum good, it seems android has rubbed off on them then, they dont teach that shit no more ๐
at least not where you learned
Haha the same professors teach lower level stuff too
w3schools seems pretty good for java 
w3schools seems pretty good for.... uh..... hmm..... accessing when the official reference for your language is down?
I guess I'm trying to defend java a little bit since it's my favorite server language along with rust
one of my friends swears by java, loves it
Did someone say Java?
we have debates about it often ๐
no go back to sleep Aurel ... j/k ๐
yeah, im glad to hear that people arent teaching java wrong any more
well i think you just had a bad experience while learning java. But the language itself seems good
ive been a C++ person for decades, but C++ has its flaws, iteration time (time waiting for compiles) is the worst there is
with C++ its like you save tons of time at runtime, but at the cost of sat twiddling your thumbs when you could be coding, so you'd best get the code right lol
I think java's great, I just wish reflections and some other typing were more straightforward
that's why I like rust so much haha
"bot compiling, thats 10 mins to watch youtube" (TEN minutes. im not kidding. ten minutes, and it spits a huge binary out the other side):
trivia@mx1:~/triviabot/build$ ls -alh
total 235M
-rwxr-xr-x 1 trivia trivia 54M Nov 26 23:49 bot
-rwxr-xr-x 1 trivia trivia 11M Oct 6 12:56 module_bandwidth.so
-rwxr-xr-x 1 trivia trivia 26M Nov 25 15:04 module_diagnostics.so
-rwxr-xr-x 1 trivia trivia 11M Oct 6 12:56 module_presence.so
-rwxr-xr-x 1 trivia trivia 130M Dec 1 22:23 module_trivia.so
true but the code you have to write just looks arcane
yes, for the bot part
and PHP for its api and dashboard because i like to hear people shout REEEEEEE
yikes
indeed, but its worth noting that a discord bot spends 99% of its time i/o bound
the other 1% parsing json
so your biggest saving from C++ is memory efficiency, if done right, not CPU
so yeah heres the benefit in terms of memory use, each cluster has 5500 guilds and uses only 400-500mb ram
trivia 1647 1.9 1.1 2308112 388892 pts/15 Sl+ Nov27 138:35 ./bot -members -clusterid 2 -maxclusters 8
trivia 3981 1.7 1.5 2065932 510000 pts/18 Sl+ Nov23 214:15 ./bot -members -clusterid 4 -maxclusters 8
trivia 11948 2.0 1.3 2439184 446192 pts/20 Sl+ Nov26 161:38 ./bot -members -clusterid 5 -maxclusters 8
trivia 13033 1.8 1.0 2111504 343488 pts/17 Sl+ Dec01 24:45 ./bot -members -clusterid 3 -maxclusters 8
trivia 18947 19.4 1.1 2093400 370416 pts/6 Sl+ Nov29 685:47 ./bot -members -clusterid 0 -maxclusters 8
trivia 25935 1.8 1.1 2242576 385444 pts/13 Sl+ Dec01 22:51 ./bot -members -clusterid 1 -maxclusters 8
trivia 29042 1.9 1.4 2303492 481720 pts/21 Sl+ Nov29 88:41 ./bot -members -clusterid 6 -maxclusters 8
trivia 29099 1.8 1.0 2119696 346456 pts/22 Sl+ Nov25 187:31 ./bot -members -clusterid 7 -maxclusters 8
im on aegis.cpp
I'm also on jda and my shards use ~200MB
a total of 43000 guilds, 3.3 million users, god knows how many millions of roles, hundreds of thousands of channels, all cached in ram as std::unordered_map
did you write your own discord client?
its designed to scale outwards, i can take each of these cluster processes and in theory run it on a completely standalone machine, it doesnt need a central controlling process
no i used aegis.cpp which is based on asio and websocketpp, but afterwards i became a library dev on it, to add my own features directly to it e.g. cluster support
i didnt want to have to maintain my own fork of aegis so i spoke to the dev and got commit access
I'm jealous, I'm using tcp to share some state across shards
i share as little state as possible, and it store it in the mysql db
the mysql db is my coordinating data set, that way i can in theory just scale out the mysql cluster and it 'just works'
but im about 150k servers away from having to scale out yet and i need more funds to be able to do that
@swift umbra sure, thats the intent, but most libs dont easily allow it because they design with a central control process
and the central control process might talk to the shard processes over ipc such as a unix socket, or a localhost tcp socket
eliminating the central controlling process or structure makes it easier to do
at the expense of making the bot harder to code initially
I guess I got lucky with jda being able to shard across servers
for example aegis, as it stood when i started using it, only supported single process sharding, each shard is a new websocket connection and a member of the same asio thread pool in the same process
the clustering feature lets me split it out, so i have 4 shards per cluster, and 8 clusters for a total of 32 shards
i'd advise getting sharding working long before even 1000 servers
that way when you need it, youre not left panicking, just flip the switch and shard
its usually not as simple as just 'enable it in djs'
stuff like getting user counts and stuff only accesses the local vars?
instead of the shard broadcast ?
the way ive done this is kept shards from talking to each other as much as possible
e.g. shard 2 never needs access to a user record in the cache of shard 4
oh and when you get to sharding.... one thing to remember that trips people up
but a cache on shard 2 can't be accessed by shard 4
ALL DMs come in on shard 0 ๐
the JDA instance is only the instance of that vm
not a problem for me as my bot doesnt accept user dm's, but if your bot does... need to be prepared for that
i only send DMs and thats done via REST so not an issue
one physical process per shard?
that sounds a bit painful tbh
Pls help what to do now
right, but if your shards are on different machines then you can't share the cache between them
You installed discord.js
how does it share cache then, shared memory?
@tranquil drum how to delete it
npm uninstall discord.js
Oh thx
I don't think it does if you're on different machines
what no love for discord.js version 11
ignore me... sarcasm
that's why I had to set up a tcp socket
is it something lightweight and binary, or something horrid like json or .... ew... xml
at least you didnt say xml
but i'm only sending the bits I need
lol android uses xml for so much
xml and its ungodly heavy parsers
pom.xml - where australians store information about british people?
come to gradle my friend
Is there any website same as repl and glitch
you cannot win teemaw, if you strike down his xml schema, it will become more bloaty than you could ever imagine.
@tranquil drum i uninstalled that then downloaded again but it is not in the folder I wanted to be
long live xml
I used window PowerShell
you need to change your directory in ps to the directory of your project
@swift umbra does heroku has private project option ?
I did that @tranquil drum
javascript web apps ๐
Ok
if you're in the right directory then you can just run npm install again
Ok
free apps on heroku are publicly accessible, but the code is private
heroku does give you a free subdomain on herokuapp.com though
.xyz is for $12/y
i seen $1.18 in name cheap
@tranquil drum but how to use heroku and host for 24/7 ?
it's like a first year discount thing
You have to pay for the hobby dynos
๐ค wdym ? @tranquil drum
they have a dyno tier called "Hobby" which is on 24/7
@tranquil drum link ?
free dynos sleep after 30 minutes of inactivity
there should be a pricing link on the site
if you use github
you have to creat a Procfile file
in that if you put web:
then it is only on when you open your subdomain page
if you put worker:
then it on 24/7
Can i use uptime robo to make my web 24/7 online ? @tranquil drum
@tranquil drum still nothing i tried deleting then installing I was in the right directory
But it always downloads in another folder
If it's a tool that hits your site periodically then yes
However free heroku accounts only have 550 hours every month
@tranquil drum uptime robo pings website in every 5 mins
can you send screenshots?
well free dynos only have 550 hours every month so it'll be offline for the other 170 hours
Oh
so it's installed in New folder?
Yes
is that not where you want it?
tip of the day
pressing print screen key takes a screenshot of your desktop that you can paste into discord
sending photos of a screen is normally what my parents do 
And what most new Developers do 
really? ๐ฎ
hello i have a question can you make discord bot using js that can read peoples linked discord acc on namemc and their mc name
never saw it till i came here
well the part of taking a photo with the phone
lol
namemc has an api most likely for that
im in js
you'll need to scrape the site then most likely
though no clue how that is done
what do you need?
what happen?
Ids should be the emoji ids, correct?
yeah you should be able to iterate through them if you want to store the ids
through what teemaw said
Pick any way of iterating through a List you want
You canโt do that since getReactions() returns a List<MessageReaction> instead of a MessageReaction
You need to iterate over the list to access the MessageReaction
Check out forEach
Itโs a method of List
Something like
getMessage().getReactions().forEach(reaction -> {
long emojiID = reaction.getReactionEmote().getIdLong();
// Do whatever you want with emojiID
});
emojiID is then the ID of each Emoji from the reactions of the message
why am I getting this error ?
! [remote rejected] main -> main (push declined due to email privacy restrictions) error: failed to push some refs to 'https://github.com/usrrname/.........git'
Although Iโve set my git --global user.email to the no-reply email adress which I fund in my github email preferences, I still get this error: $ git push origin readme-dev Counting objects: 8, done.ย ย ย ย ย ย ย ย Delta compression using up to 4 threads.ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย Compressing objects: 100% (8/8), done.ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ...
someone asked me to check this place out
i was so miffed by what i found i decided to share it
your email you stored inside your git configuration most likely doesn't match the one from your repository (if i read this correctly)
anyone else spot something wrong here? lol

ah yes, website is called sqlclusters, they mention that they don't support clusters
oh
price point was really good otherwise
thanks
they even know making clusters in Mysql is pain
Itโs cause your repo has the option enabled to block commits that reveal your email
ohhh
tbh, i'd be looking into google cloud mysql cluster or such, if i needed that
Either disable it or change your local git config email
they modded it to make master-master clusters easier iirc
Do they support clusters for other sql backends though
i just get a 2nd 5$ VPS and install Mongodb on it. then i launch them together with my existing Node in Clustered mode and im done
thats great, if you use mongo
I actually tried using Mongodb, got the installation instructions, read the docs while it was installing, then immediately removed it again because i didn't understand anything 
not ready to move from mysql yet
its simple. install docker then run the MongoDB container. saved me so much headache
even if mysql is a pain, it's the most comfortable form of database for me
yeah it's not the installation, it's how to use it
there isnt really need to move from or to mysql/mongo, pick the right one for your use case first and stick with it ๐
Mongo selectors are sick
and theres nothing to say you cant use both!
I use them for couchdb ๐
well i moved from Mysql to Mongo, and im still fine with it
mongodb is essentially a key/multi-value store
not an ACID compliant transactional db
they have different use cases
But the selectors though
Mysql does some stuff better than Mongo, one good example is caching and you dont need to run duplicated keys bcs of linking Tables. Mongo on the other hand is not bound to a Schema
How would I make a help cmd? using js
if you were able to move from mongo to sql without having to re-engineer much or anything, you probably were using mysql as a k/v store e.g. like myobj = mysql->get("some key");
ive wrote myself a migration tool that worked but i guess everyone who reads the code gets a stroke
@cursive forge what have you tried?
I shifted from MySQL to mongo
I am trying to make it a function
It was much better for me then sql
https://discordjs.guide/command-handling/adding-features.html#a-dynamic-help-command @cursive forge give this a try
I don't got a command handler lol
without you could make it manually, but i suggest getting one and then make a dynamic help command
the discordjs.guide also got some help for making command handler
Oh wait I thought bots could use all emotes
i dont think its possible. since you need to know the uid of the emote (if its a custom emote)
you could probably use a Server to set there your custom emotes and then use the emote on other servers
Well you can only use emotes where your bot has access to the guild
You could probably do JDA.getEmoteById() to see if itโs cached
Although you could also just try to react with the emote and handle the error of the bot canโt
I'm trying to draw a simple line chart of my bots ping on node js. Is there any simple API or library i can use?
chart.js
its an npm library right?
yes
ok.. ill try using it
I can rename the ticket 2 times, and when I try it for the 3rd time, it doesnโt work.
Eventually, 8 minutes later, it renames to โ3โ
Does this have anything to do with discord itself, host, code, idk?
You get ratelimited, you can only change the channel name twice a 10 minutes
When I try to hide the channel it just flickers and doesn't hide, anyone know the problem?
channel.createPermissionOverride(event.getGuild().getPublicRole()).setDeny(Permission.VIEW_CHANNEL).queue();
(Everyone is the server can see the flickering, including people with and without roles.)
quick question
i have a setup command
and im using await messages so it's like
enter the muterole id
and i want the await messages to get the id from the message but it doesn't
let role = args[0]
await message.channel.awaitMessages(m => (m.author.id === message.author.id) && (m.content === `${role}`), {
max: 1,
time: 20000,
errors: ["time"]
}).catch((err) => {
return message.channel.send(new Discord.MessageEmbed()
.setColor('#ff3636')
.setDescription(`${no} | Setup has been canceled, didnt send a message in 20 seconds.`))
});
yeah its admin only
well admin - guild owner
i tried using brackets and just role
but i dnt know how to get it to like realize they sent the role id and set it
uh no error
sEE
it doesn't set it after it says setup has been canceled
wym by log?
my console just says no value specified because it doesn't get the role
hm
async function getResponses(message) {
const validTime = /^\d+(s|m|h|d)$/;
const validNumber = /\d+/;
const responses = { }
for(let i = 0; i < prompts.length; i++) {
await message.channel.send(prompts[i]);
const response = await message.channel.awaitMessages(m => m.author.id === message.author.id, { max: 1});
const { content } = response.first();
if (i === 0)
responses.prize = content;
else if (i === 1) {
if(!isNaN(ms(content)))
responses.duration = content;
else
throw new Error('Invalid time format') | message.channel.send('Invalid time format!, Cancel giveaway!');
}
else if (i === 2) {
if (validNumber.test(content))
responses.winners = content;
else
throw new Error('Invalid entry for winners!') | message.channel.send('Invalid entry for winners!, Cancel giveaway!');
}
}
return responses;
}
}
}
What about using MessageCollector()?
That can also wrk
like this
,
U have to define the response to collect it
I don't think your filter is correct
m => m.content.match(/^(\d{17,19})$/) && m.author.id === message.author.id```
how do i put multiple permissions in a permissionoverride at once
it uses an object
if you know how to make one you can add mutiple permissions
(atleast in js)
like diss

wuT
well this doesnt work
(Permission.MESSAGE_READ | Permission.MESSAGE_WRITE)
your using js right?
what verison
14 ik
why are you-
this is not js
oh
or an ancient version
nvm lol forgot that , exist
d.js v12 right?
message.author.hasPermission(['MANAGE_MESSAGES', 'BAN_MEMBERS']);
shouldn't that work
or something
o
wut is dis?
Yo why doesn't this work? if(!message.channel.id === theChannel.id) return;
I've logged them both and they're different but for some reason it's not returning
are both channels cached?
yes
the 2nd channel is an actual channel or a object containing the id?
!message.channel.id means NOT message.channel.id, which returns false
@young flame
let passed = false;
let collector = message.channel.createMessageCollector(m => m.content.match(/^(\d{17,19})$/) && m.author.id === message.author.id, {
max: 1,
time: 20000
});
collector.on("collect", collectedMessage => {
passed = true;
let role = message.guild.roles.cache.get(collectedMessage.content);
if (role) {
// Do whatever if the role exists
}
});
collector.on("end", () => passed ? message.channel.send("You didn't send anything in 20 seconds") : null);``` your entire thing simplified
so you are comparing false === theChannel.Id
wut
yea what GoogleFeud said
o
you need !=
looks complicateD
Ah right, thanks guys @lusty quest @cinder patio
Umm why am I getting this error
Handler.js:39:14)
at async GuildMember.edit (C:\Users\Marine sensor\Desktop\discord-ba-bot\node_modules\discord.js\src\structures\GuildMember.js:312:5) {
method: 'patch',
path: '/guilds/783359880466792488/members/442622170565443584',
code: 50013,
httpStatus: 403
}
did you got the Gateway intent for members?
Your bot doesn't have permission to do a patch action on a guild member
Umm
How can I give him the permission?
btw I didn't script this, I paid someone to script it for me

ask the guy who made it.
He's saying don't dm me ever
Bruh
o
He's like ask development chat
Omego lul
10/10 scam
what are you trying to do?
hayperToday at 3:27 PM
Development channel
Dont dm me ever again.
Its yourside not mine
It aorl on my zide
Work side
Stop dming me
It's hayper ?
Yea
Hayper the one that's in this server ?
ye
Hayper... So the emergency food made a discord bot
emergency food?


So can you help me to fix this issue?
^^ i'll help if i can...
Just give the bot permission in whatever server it's trying to do that thing on the guild member
Whatever role
He has all the perms :/

it made everything red ._.
Screenshot?
i found this
ok
on stackoverflow
Or your bot's role is lower than the highest role of that guild member
you are the owner of the server
the bot can't change your nick
I know
yep
i have explained this like a million time
._. chill chill
Of course, it's throwing an abort error
๐
handle the error lol
so, you are trying to change your nickname in your server?
but you are the owner of that server?
its not an excuse lol
Imagine not checking for the bot's permissions before doing an API request
Na na na when I say !update the bot goes off and it says this error
ildMember.js:312:5) {
method: 'patch',
path: '/guilds/783359880466792488/members/442622170565443584',
code: 50013,
httpStatus: 403
hm
process.on("unhandledRejection", () => {})```
handle the error and the bot will stay online
Didn't code a shit
//ur code
}.catch(err => console.log(err))
sorry if i wrong.
It was all haypers favor
I literally sent something to fix all your promise rejections
Hold on step by step
then learn javascript first. then get back onto your bot
What should I rn
Where do I have to add that? At the end or top?
Bottom
k
Of the code
process.on("unhandledRejection", () => {})
@earnest phoenix it said uh "await is only valid as a async function"
@summer acorn i should have trust you can make bot with you 
@young flame put async before collectedMessage
o
Yes








๐ป <-- thats a ghost that's also an OG.



