#development
1 messages · Page 1551 of 1
some run archaic vulnerable versions too
but they won't update because that costs $$
so
My is like this
But this one is like this
How can I make mine look like this
if you call it via backend no one will see it tbh
i will never get used to chrome not parsing json
that's what I am already doing
Why?
so why did you want to "beautify" it?
It looks cool
it doesnt change how your API client will read it
ok :-:
yea don't
also as cry said blame chrome for not parsing it
if u using JSON.parse, then do this JSON.parse('to be parse', null, 4)
res.json is what I am using
or use this https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa
but why
it makes no sense i know
pog
but the issue is that Chrome by default doesnt parse Json properly
heya
what's wrong
let content = args[0];
let role = message.mentions.roles.first() || message.guild.roles.cache.get(args[1]);
if(!role) return message.channel.send('Mention a Role!')
if(content === 'add'){
let members = message.guild.members.cache.filter(m => !m.roles.cache.some(role));
members.forEach(m => { m.roles.add(role) });
const embed = new Discord.MessageEmbed()
.setTitle('Done!')
.setDescription(`I added ${role} to every person in this server!`)
.setTimestamp()
.setColor('RED')
message.channel.send(embed)
}
if(content === 'remove'){
let member = message.guild.members.cache.filter(m => m.roles.cache.some(role));
member.forEach(m => { m.roles.remove(role) });
const embed = new Discord.MessageEmbed()
.setTitle('Done!')
.setDescription(`I removed ${role} from every person in this server!`)
.setTimestamp()
.setColor('RED')
message.channel.send(embed)
}```
fn is not a function
is there somthing similiar to wordpress for nodejs?
I've tried it
It's nice
You can host it for free: https://github.com/TryGhost/Ghost/releases
oh cool thanks
member.user.tag?
member.user.tag
GuildMember.tag does not exist
Depending on your database, you can set up intervals natively for it to do something to every entry. For instance, MySQL/MariaDB has this.
If not, if you're using NodeJS, you can use setInterval which accepts a function as the first param, then a number for milliseconds as the second
but how would i keep it active after i restart the bot?
like do i need to actively save there times indivisually?
if so thats fine i just dont have the function implementation on how i should approach it
You can set a timeout to target a specific time such as if you're doing something hourly and there are 57 minutes left in the hour, you can set a timeout for 1000 * 60 * 57
which starts the loop
kk
and ty
oh and
how would i do a custom shop?
where i can like add items and remove items but buy using the ds!shop command it list everything that was added?
i have the adding and removing editing and stuff like that down
i just dont know how to display all the items
Depends how you want things to be displayed. Most people will opt for using an embed which is significantly better than trying to format plain text
yeah i wnt an embed
but like
how would i get each item
their prices and description and like
display it
Probably store the price, name etc. in a database and just grab it from that
Or in a file, if you don't feel like using a db
yeah ik that
but when your sttoring it if it s a db or not
its a single thing
not a collection
which is why i said how would i display "all the items"
not grab them seperately that would take uup to much time and be inefficient
expecially if its per guild
Well, if you're using SQL, depending on how you store it, you can do SELECT * FROM Table WHERE guild_id=? to get all items in a guild.
depends on what database you use, MongoDB will return a json object. mysql idk anymore havent used it in years
hm
From what I see on w3s it returns an array, which might not be too effective if you want to grab a specific item
On MySQL
sqlite will probably also return an array since its SQL
If it's just a matter of displaying every item, an array would be fine
yo
o kk
you can always try image generation
if an array has multiple elements with the exact same value what would indexOf return
Arrays are fast to loop through, it's just that they're not too effective when you want to find a specific element in it
The first one it finds, I'd assume
back when i had a public bot i got fed up with discord's bullshit formatting and started generating my own images in whichever format i wanted
kk
It's rocket science
koompleecated
I wanna do more frequent image generation, but I don't wanna compile native deps which'll work on my windows dev env and also prod
so, stuck with Jimp which isn't efficient
if you're using nodejs you should check out [canvas](android users weebs https://npm.im/canvas)
isn't canvas kind of chonky
idk
i was talking about canvas
h
h
that would be the webJS canvas lib. Not node-canvas

commando is a command framework tho
they're both implementations of exactly the same thing
read the description of the package
I know what it is
H
also owo what's webJS 
i d k
Front end JavaScript
bruh
i have 0 pings
anyways can somebody halp meh
If you're a fan of jank, do image manipulation through an html file and then render it and screenshot it somehow
How do I change body background in top.gg?
I tried
.entity-content__body { background: RED}
But doesn't work and yes I used <style></style>
It would return the index of the first occurring entry
Is there supposed to be two underscores?
pls no puppeteer chrome takes too much ram
and also you're gonna be using the same exact canvas API for the html file
I make mine a gradient like this.
You can view here: https://top.gg/bot/405208699313848330
body {
background: linear-gradient(135deg, #fead7b, #c76d7f, #462371);
}
Thanks
@lament rock what if someone was to increase this
also, if you wanted your description to not have a background so that it falls through, you can do this
.entity-content__description {
background: none;
}
You might also wanna add border: none; to .entity-content__description
Yes
Best CSS:
.description {
background: white;
color: white;
}
How can I register what is written in MongoDB?
For example: M-language set en
how do I register in English?
Wdym
Can you explain more
İn models folder I write
languageCode: String,
but I didn't understand how to do it in commands.
Umm
You have to create new object and then save the doc
you'll probably be able to get some help from @earnest phoenix if you're having a hard time explaining us in English
Okay, thanks.
oh btw #general-int
Problem fixed
anyone knows whats the difference between lavaplayer and lavalink?
lavalink is a webserver wrapping around lavaplayer so non JRE apps can use it
it's java though so you can expect meh performance
body {
background: linear-gradient(135deg, #fead7b, #c76d7f, #462371);
}
``` this right?
@crimson vapor look i did lucas sorce code
nah i just entered node and did .load util.js and it did that
anyone know what does this called a > b ? a : b
ternary?
thx
has anyone used, tailwind css??
anyone familiar with rate limiting?
https://discord.com/developers/docs/topics/gateway#rate-limiting
sending 2 requests/1 second, is this including MESSAGE_CREATE?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
interesting, makes me wonder how big bots are able to do it (unless client rate is adjusted) without using leaky bucket algorithm
the message-sending is per channel btw
interesting, thought for quite some time it was by guild, then client itself
ex X-RateLimit-Global: true //or false for guild
hmmm
heard it's pretty hard to hit rate limits, but see it happen with larger bots from time to time
H m doesn't work
<style> .entity-content__body {
background: linear-gradient(135deg, #fead7b, #c76d7f, #462371);
}
</style>
i have used it at last
def runClient(): client.run("TOKEN")
but not working ?
wrong code 😕
if you never call runClient() it won't ever run
oh
why are you wrapping it in a function though?
def runClient() ^ SyntaxError: invalid syntax
def is only used to define the function
before there was no problem but now not working
i have also used
client.run("TOKEN")
i have used it earlier
but now not working
just call it directly, no need to wrap it inside another function
ok
Why does this not work
^^
Can someone help me pls
I changed it so that the class is targeting body. Read the edited version
@lament rock also thanks & loved your bot haha
But I did border: none and it doesn't worl
Work*
I get black borders
bots with more than 400k guilds use a different APi / Websocket backend
they also have probably different Rate limits
Why does this not work?
.titleandvote .votebutton {
background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
border: none !important;
transition: all .2s ease !important;
color: white !important;
}
.titleandvote:hover .votebutton:hover {
box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
border: none !important;
outline: none !important;
border-radius: 8px !important;
}
.titleandvote:active:focus .votebutton:active:focus {
background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
border: none !important;
outline: none !important;
border-radius: 8px !important;
}
Yes I added style if someone can help pls ping me
@lusty quest economy or music
?
both are oversaturated with bots
idk come up with something unique
music bots are a pain in the ass, economy bots are already some large and popular one there that you wont get replaced unless your bot does something unique
hm
also there are still things you could do something unique lol
here are some ideas:
Make a Unique Mini Game bot
Make a Bot that tracks satelite Positions
Make a Bot that follows you around and question everything you do
my bot already tracks satelite positions lmao
i was gonna make a bot that gives soap suggestions-
but guess what
THERES A BOT THAT DOES THAT
smhhhhhhhhhhhh
coming up with something unique is hard, but if you manage to pull it off you probably get headache about how tf did i scale the bot again next week.
depends, most unique bots can be pretty niche
my bot's growth is very slow paced because of that
Brain hit the nail on the head i guess
tim what bot would you want to see?
hey now, no stealing ideas :^)
im not
AI that translates code from one programming language to another
already a bot that does that
yes translate my js to C
Be the C to my Cython
Lol
Cython new best lang
Cython >
Wth really?
Wtf no it’s a joke lmao
if you need an idea, write a Discord Bot that uses AI to debug Code and make fix suggestions.
thats freaking amazing ngl
Python to C# when
only devs would use it
ikr
Why would you make that a discord bot, though
make it a website or a vsc extension
come up with a unique game idea that can run on discord
turn based pong
space invaders with emojis
well there is a quite a hype of Devs and a large chunk of them are bad and dont know how to debug.
just add the bot here and you dont have to answer basic debug questions
app.get("/image/meme", async (req, res, next) => {
// code
});
app.get("/imge/dankmeme", async (req, res, next) => {
// code
});
I have never used express before
and I have to every-time write the same code again and again for a diff endpoint
Is there way I can just do app.get("/image")
And get the / request which is after that?
app.get("/image/:file", async (req, res, next) => {
req.params.file
})
if im not mistaken
I have asked this before but... Can I get help about it again?
Alright Thanks!
Just another ques
Does it returns a string
yes
yes
alr thanks
about...?
Why does this not work?
.titleandvote .votebutton {
background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
border: none !important;
transition: all .2s ease !important;
color: white !important;
}
.titleandvote:hover .votebutton:hover {
box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
border: none !important;
outline: none !important;
border-radius: 8px !important;
}
.titleandvote:active:focus .votebutton:active:focus {
background: linear-gradient(-30deg, rgba(244,105,13,1) 0%, rgba(248,203,22,1) 100%) !important;
box-shadow: inset 0 0 100000px 0 rgba(0, 0, 0, .25) !important;
border: none !important;
outline: none !important;
border-radius: 8px !important;
}
Why this not work
wut lmao
you cant hover two things at once
nor focus on two things at once
Something like this should work right
yes it should
Alright
you probably want to toLowerCase it as well
idk\the more i hear about how everything has to much
makes me not wanna code in the first place
find something niche that you like and code in that area
I scrolled up and got it.. sorry
for me its astrology/astronomy
alright
although i've taken quite a liking to node.js libs and benchmarks so im wasting lots of time with those instead atm
i like music bots
make an audio waveform generator bot
but when i ask for suggestions its always "oh theres to many of those", "be more unque its not gonna get anywhere" stuff like that
I got an error :(
if you like music then do music, but dont be too competitive about it
because you know its a highly competed field
ok...
dont focus on success. focus on excellence and success will chase you
~ from some indian movie
👍
indeed it is
I removed them but still doesn't work
ahh yes fun, i break down my behemoth of a single file containing common functions into single files and then indexing them
Also how do I make my review stars color change to yellow?
doing that with 90 c++ functions on a 3k line file rn
pain
yea
?
but its easyer to read afterwards
been doing it for 2 weeks actually, on and off
Okay
does the first one work? .titleandvote .votebutton {
Wait how to do this https://cdn.hopefuls.de/xQ1v
https://cdn.hopefuls.de/GJ5A
i don't know css but i think you need , between class names
@daring prawn https://stackoverflow.com/questions/2099252/how-can-i-apply-styles-to-multiple-classes-at-once
yeah you need ,
what page is that?
and why do you still have the old design?
It is not from me
@quartz kindle search that link in this channel
I wanted to make that one but don't really know how
you realize thats from 2 months ago, and its for the old website
the new website is very different
So I can't make it in the new one?

technically you can
but rearanging the whole design of a website with css alone is a very complex task
just take the current design and change the things you wanna change
tim appreciate the pets >:(
<3
lmao
And how do I thank tim guy
inspect element is the best way
I'm in phone rn
hi
then wait until you can do it on pc
its the only reliable way
Best rdp specifications for music bot?
Hey since that worked out
I wanted to know how can I get the query using express which person gives
like /Reddit?q=aww
...rdp?
I wanna get the part after ?q=
yes
req.query
Oh ok
Thanks
But what if there are more than 2 queries
Like ?msg=Hi&&?Lang=English
/reddit?a=sometihng&b=bla
Yes that
req.query.a // something
req.query.b // bla
as in, remote desktop protocol?
Yes, a device in Germany
that has nothing to do with music bots
I will use the device as the server my bot runs on
yes, but it doesnt matter
you can use rdp, ssh, or anything else, doesnt matter what configuration you use
it does not affect the bot
its only how you connect to the server
The specifications of the device do not affect the performance of the bot ???
ram and cpu yes, but rdp no
rdp is the connection protocol
not the computer
you mean what cpu and ram the server should have for a music bot?
depends on how big the bot will be, music costs a lot of resources
i would start with a minimum of 2gb ram and then see how big your bot gets
yes yes
const Keyv = require('keyv');
module.exports = {
name: 'purge',
description: 'Bulk deletes a certain amount of messages.',
usage: 'clear `amount`',
async run(message, args) {
if (!message.guild.me.hasPermission('MANAGE_MESSAGES')) {
let msg = await message.channel.send('I require the `Manage Messages` permission in order to perform this action!');
msg.delete({ timeout: 2000 });
return;
}
const amount = parseInt(args[0]) + 1;
if (isNaN(amount) || amount < 2 || amount > 100) {
let msg = await message.channel.send(`You must enter a number higher than 0 and less than 100.`);
msg.delete({ timeout: 2000 });
return;
}
message.channel.bulkDelete(amount, true).catch(async (err) => {
console.error(err);
let msg = await message.channel.send(`Can't delete messages older than 2 weeks.`);
msg.delete({ timeout: 2000 });
return;
});
const clearEmbed = new Discord.MessageEmbed()
.setColor('#90ee90')
.setTitle("purge")
.setDescription("succesfully purged the messages")
.setTimestamp(new Date());
message.reply(clearEmbed).then(m => m.delete({timeout: 2000}))
}
}```
in idle my bot use 400mb of ram
1vcpu and 2GB RAM Good ?
Oh found out..
amount < 2 || amount > 100
You must enter a number higher than 0 and less than 100.
did you meanamount < 1
for now yes
then you have to wait and see how big it gets
although if the bot holds little state that's a ton of memory
Hey sorry but how do I make a gif come in my page like the footer or as soon as u go to the bot page u see a gif
what is the new dblapi.js?
@frosty valve top.gg-sdk?
oh, ok
Yeah how
Tried doesn't work
then you did wrong
Do I like put the link directly or using css?
with markdown or html
yo
How can visual studio show the text typed by the user in colored text (basically formatting PLAIN TEXT inside an input element) ❓
huh
you mean syntax highlighting?
yeah
you cant put html inside the element
and css is pointless
vsc has their own highlighting engine
it's open source so you can check it out if you want to
otherwise look into highlightjs
googling around gave me this
How to log in discord web us acunt discord apk
windows 10 pro 1809 or window server for bot??
I haven't tried Linux not once
there's a first time for everything
i use vicoal studio code Is it in Linux system?
windows servers are way to expensive
you would just deploy your bot files there and run with whatever runtime you're using
not only are they expensive but windows machines are unreliable and eat too many resources compared to linux ones
Now I am going to buy RDP and have options. I should choose the system, so what should I choose
yea
also the filesystems are quite inefficent
well this where badly phrased
windows software raid is inefficent
which distros are you offered
id go for ubuntu if it's an option
or any other debian distro
red hat isnt bad too
but is less new user firendly
I have no experience with Linux
or debian is also fine
Can any of you help me in Linux
i can
you are aware that this can be a quite lengthy journey right?
it depends on how fast the person can learn, ive met people here who where unable to use a ! in a function for 2 days
your voice variable is already a channel
you can also remove that if check by doing ```js
voice ?? "None"
im having an aneurysm now
bye
https://github.com/0Exe/electron-tictactoe can anyone help me out? in the src/js file, how can i do it without just doing ifs?
whats that
the answer is arrays
any time you're writing a bunch of if statements like this - chances are you're not thinking about arrays, I kinda expected to be looking at a bot, so that's about all the advice I can give, I don't know webdev
dw about the web stuff
like html/css
just literally the js
basically the ifs statement
how would i do array?
@earnest phoenix
ok, let me check a thing:
for em3 to be highlighted, both em1 and em2 must match given pattern, right?
sure 🙂
well not necessarily
em3 is the 3rd square
so any pattern that has the top right square works
ok, let's start by removing this parts:```
let em1 = document.getElementById("1");
let em2 = document.getElementById("2");
let em3 = document.getElementById("3");
let em4 = document.getElementById("4");
let em5 = document.getElementById("5");
let em6 = document.getElementById("6");
let em7 = document.getElementById("7");
let em8 = document.getElementById("8");
let em9 = document.getElementById("9");
you can put it like this:
ty btw 🙂
let squares = []
for (int i = 0; i < 9; i++) {
squares[i] = document.getElementById(i + 1);
}
this will fill the array with the elements
what does the stuff in the for loop do?
like i dont understand that
the rest i do
but not the int i = 0; i < 9; i++
ah, that's a bounded loop
replace int with let actually
let i = 0 means the loop will start with variable i set at 0
i < 9 means it'll run until number 9, exclusive
oh also
it doesnt reset the game
after someone wins
which it should
cuz look
you were already answered
KuuHaKu is typing
godhaku
then to check the array for 3 X's or 3 O's, you can use something like this:
let winner = null;
for (let r = 0; r < 4; r++) {
let columnCount = 0;
let currCharInColumn = null;
for (let c = 0; c < 4; c++) {
let char = squares[c + (3*r)].innerHTML;
if (char === firstCharInColumn) {
columnCount++;
if (columnCount === 3) winner = char;
} else if (firstCharInColumn == null) {
firstCharInColumn = char;
columnCount++;
} else break;
}
}
something like this
well, there's still diagonal check
alr that makes sense
but it's just to get the idea
vertical and horizontal is already there
basically, you have an array of 9 elements
mhm
r equals to row number
c equals to column number
to get slot, squares[c + (3*r)]
that's because all 2nd-row elements will be in indexes 3-5
and 3rd-row elements will be in indexes 6-8
for (let c = 0; c < 4; c++) {
let char = squares[c + (3*r)].innerHTML;
if (char === firstCharInColumn) {
columnCount++;
if (columnCount === 3) winner = char;
} else if (firstCharInColumn == null) {
firstCharInColumn = char;
columnCount++;
} else break;
}
this checks the current row
if the currentChar is null, it assigns it and increases counter
if it's not null, but matches the current square, it increases the counter
if it's not null and doesn't match, it exits
actually, stopping to think, the way it checks vertical elements would not work
updated my code, now it checks only horizontal
to check vertical, you just need to flip direction:
let winner = null;
for (let c = 0; c < 4; c++) {
let rowCount = 0;
let currCharInRow = null;
for (let r = 0; r < 4; r++) {
let char = squares[c + (3*r)].innerHTML;
if (char === firstCharInRow) {
rowCount++;
if (columnCount === 3) winner = char;
} else if (firstCharInRow== null) {
firstCharInRow= char;
rowCount++;
} else break;
}
}
this is the same as row-counter, but it'll check for columns
and finally, for diagonal:
let winner = null;
for (let d = 0; d < 4; d++) {
let diagCount = 0;
let currCharInDiag = null;
let char = squares[d + (3*d)].innerHTML;
if (char === currCharInDiag ) {
diagCount++;
if (diagCount === 3) winner = char;
} else if (currCharInDiag == null) {
currCharInDiag = char;
diagCount++;
} else break;
}
for (let d = 2; d > -1; d--) {
let diagCount = 0;
let currCharInDiag = null;
let char = squares[d + (3*(2-d))].innerHTML;
if (char === currCharInDiag ) {
diagCount++;
if (diagCount === 3) winner = char;
} else if (currCharInDiag == null) {
currCharInDiag = char;
diagCount++;
} else break;
}
basically, you want to check exactly indexes 0, 4 and 8 (first diagonal) then 2, 4 and 6 for second diagonal
if the current char changes, you already know it'll not be a winning sequence
did that make any sense?
after all that, you just need to check the value of winner
it'll either be null, 'O' or 'X'
msg.toLowerCase() === 'command'
msg being the content
toLowerCase*
message.content
it's not a function? lul
oh, nvm
just noticed the lowercase C
ye
@earnest phoenix just show the msg content
i do not have to understand why this gives me the Guild object and not the id right? ```js
const {guild} = message //message passed by command handler
console.log(guild.id); //gives me the Guild Object not the ID
replace guild.id to guildID
this makes no sense?
the guild object i get also contains the field id: " "
Why are you putting the if statement inside a command? Oh dear
you don't know what you're doing, do you
i know
but for some reason i get the object and not the id, ive checked now 2 times that ive uploaded to the correct folder
hmmm i wonder if this is possible
well then back to the drawing board and time to figure out why it broke, thanks to github ive where able to revert to an older version
oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) Invalid "refresh_token" in request for gunicorn / flask / nginx
what token did you send to refresh?
How do I ake my background gif like this https://top.gg/bot/779230692960632832
make*
wdym
thats weird to look at
how does that bot have 18 reviews with only 128 servers lmao
are they buying reviews?
review-locking commands
you have to send a refresh token to the oauth service to refresh your auth token, if you send the wrong one you get the error. you get your refresh token when you connect to oauth
next level strats
imagine 
Turkish bot
xD
doesn't surprise me
like its wierd if u just open the page
if u reload it works
but if u just open the page it wierd
that gif background hurts to look at on that bot as well
hm?
always
or wdym
they always did so too
i dont recall it embedding a couple months ago

the fuck?
they get now more informations than they used to
hmmmm thats interesting, i completely missed it
also, another question, if you set message cache to be 0 on d.js, and you initiate a collector when that message is passed, does the reference get deleted and stop the collector from working? or does it not delete the message reference until its not being used? or am i completely misunderstanding how the collector works internally?
im having some odd behaviour, which is, when i initiate 4 message collectors on 4 different messages, only the last message sent's collector work. Which is odd, shouldnt d.js shield the collectors message to not be deleted so it doesnt stop working?
a collector basically creates a client.on("message") event and stores all received messages in a new collection
like wdym?
its not even oath
its just nginx
thats the thing, if i set my cache to 1, and send 4 collectors, only the last one works
its oath
messageCacheMaxSize: 1 and try sending 3 message collectors, the behaviour im getting is that only the last one works
wdym only the last one works? that makes no sense
exactly
code?
let me send you in dm, too much Portuguese shit
is it a message collector or a reaction collector?
duckgo
yandex
baidu
Hello
Just a quick question
You know yddgrasil?
that bot with the userphone command
Does it require GUILD_PRESENCES Intent?
yoo, any thoughts what this log means?
i mean, obviously that you need 2FA 😂 but where does it come from
It comes from you performing an API action that's locked behind 2FA protection since it's enabled for the server.
hmmm, so If me as the bot owner don't have 2FA and a user on a server requiring 2FA tries to use a command with for example Manage Messages the promise fails and throws that log?
yes
is presence from message.author or message.member?
alriight, thank you guys 💖
author returns user
member returns guildmember
Can someone pls provide the link of web which provide free of cost python course
Ya but we need to pay for it bro
Well if you want a high quality course then sure a little bit of money to spend on a udemy course isnt bad
if you have a github student account you can get a free "One Month" course for 30 days
How can i save things via json file etc? I want to make settings, so that you can disabel commands on a server. So the command doesnt only work on exactly this server, but on the others it works. How can i do this? How can i save things?
A JSON file may not be the best solution to this problem, but you'd need to read the file, parse it to something readable (for your program), modify it, then parse it back to JSON and write back to the file. I don't know what language you're using, nor should you really be using JSON if you want to have dynamic settings. A database (e.g. SQLite) may be better for the job.
Im using java-script for my bot
use a proper database like sqlite, Mysql, Postgres, MongoDB, json is not really suitable for being used as a database
can someone recommed me a tutorial or a video or a doc where i can do it?
java-script lmao
did you know what you want to use?
Mysql, postgres and mongodb require a server
sqlite can be used locally
https://www.npmjs.com/package/sqlite readme file
Assuming you know SQL
whats sqlite
the mongodb server can be hosted on the same computer btw
any database can but you need to know how
The only good database /s
it's fast
Should I use it
yes
ok
if ur using mongoose, def if ur using mongodb then stay with it
One tool may be better than the other in certain areas.
I don't need to use the moment library but it may be handy since it's extensive on dates and time
But I choose to use dateformat instead
sqlite is nice, but annoying to use if you start to shard across mutiple machines
I chose to use built-in Date for now
since I basically reinverted the wheel, implemented almost everything on my own
for a 5 guilds bot
imagine an inverted wheel
well i didn't want my node_modules folder to grow into like 5 GB and didn't want package hell™
dateformat relies on no dependencies
ah ok
@opal plank you have that file with the guy who sent like 20-30 requests to get the weather in a bunch of locations
oh, wait
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.
ty
indeed
no way i would let the actual definition of bad code be lost through the ages
imma submit this onto urban dictionary or some shit, its worth that much
put it on reddit
I reslived the issue @quartz kindle it was because I didnt format
You are right formatting is easier
wtf please
callback hell
and too many embed fields
just BLEGH
make an infinite scrolling gif out of it
i gotta try to move to a new db
json file is failing me
75 servers in 24h is more stressfull than you think
how much time did it take for top.gg to approve bots again?
maybe it's different now
1 week
I'm questioning whether I should write my own parser or use an existing one like acorn or esprima
prob use acorn
ooh or maybe use a parser generator
"move to a new db"
"json file is failing"
acorn is pretty damn good, dont see much of a use writing your own parser
The thing is, I'm not parsing javascript, but a custom language, which is simpler than js
It's very similar to js though, so acorn is definitely an option
i'd probably try sticking with acorn if possible, its a lot of work to make your own parsers
12 days for me
yes
Acorn in itself is also very complex, there are so many different nodes
And the docs are pretty shitty
true, but i dont see that as much of a bad thing
this is a downside, yes
The docs don't say what the node really represents, they only show the structure, yeah I can guess but sometimes it's not clear enough
while if I make my own, it's going to be optimized for my language and it's going to be way simpler
I've used parser generators before but I can only find one that's for JS
and it's wip 😢
Guess I'd have to use good ole bison and yacc and have a C++ backend and all that
wait there's bison in js 
Hey does someone know how could i code a command which changes the language of the bot ?
you can store guild settings in a database
then you could use something like a json file to store messages for each language
Hii can I get help it nothing bad just one simple error that isnt higlighted
i18 is a localisation framework
whoa that's really pog
i dont use it for now but i plan to use it, if i understand how it works
a other way would be making a local file/database entry with your translations and map them
hmm... antlr4 vs jison, which is the better parser generator?
I think I'll go with antlr4, it has more starts and the generated parser can also be used for other languages
-help
JSON5 gang
what lang?
I'm gonna use it for js
but it supports java, c++/c, go, C#, swift, php
it looks fun to work with
I'm trying to install node v12 on my ubuntu vps, but everytime I try to install it, it just installs v13
is there a reason you specifically need v12?
it says it supports any version over 10.20.1
are you sure you have all the requirements for sqlite installed?
which version are you using of sqlite? better-sqlite3 is the most used one.
My bot is for some reason saying I need sqlite3 to be installed
They're entire separate databases lmao
are you using sqlite in your code?
No lmao
Are you using discordjs commando for your bot
discord.js
just d.js

why would you need sqlite anywhere in your code
Maybe another module requires sqlite3 to be installed?
show the dependencies object inside your package.json, some trash package may need it
it might be a problem in the env file could you send it here so we could check
imma pastebin it
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.
did this man just send the wrong file
The modules i've got installed are discord.js unirest express body-parser mongodb
did i
no
we said package.json NOT package-lock.json
there is no package.json
lmao
wait what's unirest
Never called npm init
there should be a package.json
uh
i didnt think node even would run without a package.json
it would
then how does one fix the issue lmao
Probably why node start is failing is because there is no main file
Nope
Send the dependencies for unirest
Local hosting runs perfectly fine
No other package in that looks sus
But since i've moved everything over to my vps, it's messing up
form-data mime request
copy pasted modules?
Nope, re-installed
I'm locally hosting my bot using node v12, that's why im wondering if it's v13 that's giving me issues
Since the VPS is on node v13
99% of v12 things work on v13
do these shell commands one by one in order:
npm uninstall
npm init -y
npm install discord.js express body-parser mongodb
This should make a package.json and also reinstall every single module
It's always the reverse bro
Discord.js versions that use nodejs v14 wouldn't work on replit because replit is on nodes v12
Uninstalling all modules
one sec
Ok
lol
npm init -y gave me an error
nvm
it didnt
just me being stupid
@solemn latch is copy pasted modules bad tho?
out of curiosity
yeah
just going from different node versions you should really reinstall your modules.
how the heck would someone else tell you what packages you need for your project
changing systems you absolutely should.
Do those get ran in the bots folder or in root?
@earnest phoenix why not in the bots folder
Okay
Re-installed everything
Went to run the bot
Error: Cannot find module 'sqlite3'
But nothing needs it
what code editor do you use?
i dont remember if atom searches all files
try control + f then search sqlite3
CTRL + F searches the file thats open
hol' up
I think I got something
nvm
all crap lmao
Should I try installing sqlite on the vps again?
what did you find?
how can i write in files for example text files or json files via a discord bot?
use fs
i already use it
generally speaking, you should not write to text files or json files with code as its easily corruptable.
if you need to write data, you should be using a database.
Alright
i dont want to store data. I just want to write in txt files
I kinda found a way around it
I used to use the god awful package discord-economy, which auto installs sqlite when installing the package
Seems to have worked but I don't wanna keep discord-economy on there lmao
just want to know how to write in a txt file
just fs.writeFile()?
yeah
or go to the documentation of fs
confused
same
@signal estuary Might help a bit more
https://www.w3schools.com/nodejs/nodejs_filesystem.asp
fs.writeFile("./report.txt", report + msg.author.tag)
should this work? "report" is nothing else then msg.content
I would add a space or \n after report + for visual purposes
and keep in mind that writeFile() replaces the content in the file
doesnt matter if he uses writeFile he doesnt want to store it ;p
He doesn't? 
But-
🤷♂️
if(err) throw err;
})
Hes writing in the file, but hes deleting the first message, when a new message comes
yeah thats how writefile works
but he should delete, he should write it, but not delete the other message, which is already stored in the file
oh you want appendFile()?
whats the different?
it... appends
appendFile would add onto the file, instead of replacing the content
It takes what's already in the file, and adds the new stuff onto it

writeFile replaces, appendFile appends
uh thx xD

Joe uses json database because it's easier
Joe uses appendFile to add new data to json
Joe be smart
[object Object]
Poor joe
I'm trying to figure out how I can use es6 with the shardingManager... I keep getting a "cannot use import statement module" error after passing my "./bot.js" file to the shardingManager constructor.
can someone tell me what is this
bot.user.displayAvatarURL()
the user's avatar
I Got This Warning And Want To Fix It. I Want To Know, Where To I Put The CLI Flag In The Code?
End Function
Where is That
why alternate caps
What
Um
you don't have enough permissions to do what you're doing
Yeah
don't tell me VB standards tells u to write like that?
So Dont I Have tp Put The Flag
apparently yes 
I Dont Know What A VB Application Is
Why does every word start with a capital letter 
exactly
there's no flag
the bot doesn't have the required perm in the server
Yeah it does
If it did, you wouldn't get the error
Ok Ill Check
OH I GET IT NOW, I NEEDS TO BE AT THE TOP OF THE HIGHERACHY
Ok Thanks!
cool, now we also have sql syntax

anyway, yw
sql is such an angry language
One message removed from a suspended account.
Please, select all data from table users
wrong syntax
SELECT * FROM USERS
correct
lol how did you fail a container build?
One message removed from a suspended account.
I wanna become a programming teacher just so that I can scream at my students when teaching them SQL
show your dockerfile
i think you will enjoy the breakdowns caused by regex
TODAY WE'RE LEARNING ABOUT SQL QUERIES
One message removed from a suspended account.
Who am I kidding, I hate children, I could never be a teacher
Although, it feels like half of the teachers hate children too so idk :,)
dont be a teacher on elementary schools, do it when they are able to legally Drink, if you are in the US then RIP
imagine making oral tests about regex
anyone passing by the door would think it's an alien school
the autistic kid will do it like a mantra
forward slash opening parenthesis period plus closing parenthesis forward slash g m



