#development
1 messages · Page 1047 of 1
Is that it
you will be staring at this until you make the full switch
yeah no not really
Frick
This is gonna be hard
I haven’t even been accept into bot lists
I’m still the queue for 3 bot lists
It’s been over a month
from what i can see, in v11 you can simply add intents yourself
Oh my god pls tell me how
new Discord.Client({ws:{intents:YOUR INTENTS NUMBER HERE}})
the only difference is that you have to give a number, you cant use the v12 helpers that give them as names
Are you going to look at the dm box? @quartz kindle
I've been waiting for you for 10 minutes :?
@quartz kindle what do intents mean and how do they work I don’t get it
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
intents mean "hey discord, i want you to send me only this this and this"
instead of "hey discord, just send me everything you got"
yup
fucking hell
its a blessing tbh
less useless payloads
because with intents, you can finally get rid of presenceUpdate
presenceUpdate is cancer
No idea what that is
90% of your bot's bandwidth and cpu usage is presenceUpdates
Interesting
client.on("presenceUpdate")
I don’t use it
when people change online/offline status, etc
90% of bots out there dont need this
and before there was no way out of it
which means a shit ton of wasted resources for both bots and the discord api
Good thing I have unlimited bandwidth
when i enabled intents for my bots
my server's bandwidth went from 400gb per month do ~20gb per month
I don’t think my bot has a bandwidth monitor
your server should have, if you are on a vps
rip
So if I was downloading something and used 100mb/s it would log that
Not the bandwidth
@brittle orchid use client.on("guildMemberUpdate")
If you are using discord.js Discord.Intents
Where Discord is require("discord.js")
Or you can use this https://discord.com/developers/docs/topics/gateway#gateway-intents
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
intents are a bitfield, which is a binary representation of a sequence of "on/off" settings
for example, 0010 means off off on off
oof
and each intent is given a specific position of this binary number
b r u h
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this lists all intents, and their positions in the binary
I read it
however, you have to pass the value as a decimal number, not binary
is it normal that when I first used lavalink searching was fine and now I don't get any results because I get an error saying it didn't find any tracks even though it shouldve
so it works like this
Makes me wonder if it would just be easier to just have them all on
and no its not my code my code was fine I didn't change anything
when using binaries, they are counted from right to left, and each digit represents a value that is double the one before
for example 1111 means 8+4+2+1
if you had 0111 it would be 0+4+2+1
whats this error
if you had 0101 it would be 0+4+0+1
@hazy sparrow read it

lets say you want the following intents from that list: GUILDS, GUILD_MEMBERS and GUILD_BANS
What you a saying is beyond my knowledge
Tim they are not big brain enough like us
GUILDS is the first position, so 0 or 1
GUILD_MEMBERS is the second position, so 0 or 2
GUILD_BANS is the third one, so 0 or 4
to enable GUILDS and GUILD_MEMBERS and GUILDBANS, you would send 111 which equals 4+2+1 which equals 7.
so if you send ws:{intents:7} you get GUILDS, GUILD_MEMBERS and GUILD_BANS
lol
Is there any chance you could do the new client with all of them on and comment what the frick each of them mean?
binary stuff aint even that hard lol
I’ve been learning programming for a few months and they’re teaching me python not js
I’m learning js on my own
@obtuse jolt js supports bitfield operators, so you can literally use them
for example
ws:{intents:(1 << 0) + (1 << 1) + (1 << 2)}
will work
that looks easier
@hazy sparrow code
ok wait
ohh
ty yxri
np
can someone help me get my private key for my website, i've got the certkey and idk how to get the private key
Your bot has to be approved to get API keys
🍿
you mean for SSL/HTTPS?
SSL
your website is in express right? is it running in a linux server?
to get ssl you could use certbot
yeah, its running on express and on a linux server
do you have an nginx reverse proxy?
when using lavalink when I try to search for a song it tells me it didn't find any tracks and that shit worked 2 days ago
did you ever install nginx?
i haven't
I added my boat to the site 3 days ago, it is still not accepted
It's meant to be 3 weeks
alright so you have two options. you can add your cert keys to node.js and use them in express, or you can install nginx and setup a reverse proxy
the nginx method is recommended for performance reasons
i'll use nginx then
nginx is much faster than node when dealing with cryptography, and nginx also acts as a layer of protection, preventing direct access to node.js
so the setup looks like this: internet <-HTTPS-> nginx <-HTTP-> node.js
and with nginx you can use certbot which can set up SSL automatically using letsencrypt
yeah, I've got the certbot thing done i believe, i've got the certification thing and i just need the private key and idk how to get that
When you're done being big brains, I want to ask why the forEach on my dynamic help command only gets 24 of the 30-something commands
I'll send code in a sec
tim, would it be any of these?
alebot
what does that do
const { MessageEmbed } = require("discord.js-light")
module.exports = {
name: 'help',
usage: 'aa!help',
async execute(client, msg, args) {
let helpembed = new MessageEmbed()
.setTitle('Help')
.setFooter(msg.author.tag, msg.author.displayAvatarURL())
.setColor(`#7289DA`)
client.commands.forEach(h => {helpembed.addField(h.name, h.usage, inline = true)})
msg.channel.send(helpembed)
}
}
@delicate shore a lot
embeds are limited to 25 fields
ohfuck
tim, any ideas?
@digital ibex check the live folder
open the folder
yes
@pure lion either split it into two messages, or make a different setup altogether
@digital ibex privkey is the private key
fullchain is the certificate
kk
Does anyone know react?
nvm ill slice it
@pure lion you can do collection.first(10)
tyy
>>> 1 << 0 + 1 << 1
4
>>> (1 << 0) + (1 << 1)
3
``` for a second I thought my brain went idiot mode but then I remembered the order of operations 
:^)
How would one code a despawn feature similar to cords for example so when something new pops up it's replaced

In py
.
you need to keep track of the old ones by message id and channel id
then on new one, check if channel id is the same, and delete the old message id
I see
tim, where can i find the private key?
its privkey.pem
o ok
porque si
P%help

xD
https://hastebin.com/agekajedeq.js
How would I make a triviastats command xD
openweathermaps api
Nice!
i tried to change my bot name but it isnt changing, i refreashed the bot, dsicord, everything still o
you have to change the name at discord.dev
all done
save also
maybe wait a whule
my net so slow typing it at 4:31

@wheat hornet IST?
he prolly lives in irak or smtng
lol
https://hastebin.com/agekajedeq.js
How would I make a triviastats command xD
@spare mirage
@hazy sparrow u indian too
yea
i tried to change my bot name but it isnt changing, i refreashed the bot, dsicord, everything still o
@hazy sparrow it takes awhile to change
kk
also u might have changed the application name instead of the bot's name
are you guys on the TEA Series side or on pewds side?
i did both
alright all what u have to do is wait
are you guys on the TEA Series side or on pewds side?
@spare mirage PEWDS
good boi :D
ok :3
name changing was pretty much instant last time i did it
@spare mirage nor t nor pewds
i think i had trouble with it
only coding
lol
https://hastebin.com/agekajedeq.js
How would I make a triviastats command xD
-games played
-win/loss
still name not changed ;-;
@spare mirage database, Math.ratio
are u using js or py
Use enmap you'll be fine
@quartz kindle how do I slice in a collection without using slice?(doesn't work)
well
you can do .first(20).last(10)
lmao
but a much more efficient solution would be a loop
fuckfuckfuckfcukfcufkcufkcufkcufk
can anyone sugest me a good command
let messages = []
let embed = new MessageEmbed()
for(let [key,value] of collection) {
embed.addField(key,value)
if(embed.fields.length === 10) {
messages.push(embed);
embed = new MessageEmbed()
}
}
``` lol
i literally want to get the 10th to the 19th >:c
can anyone sugest me a good command
no
pls
a command that does my dishes
link all your lightbulbs to some controller, connect it to a server, have your bot connect to it, and make a command that turns your lights on/off
its still a discord bot
how
magic
OwO
and then get hacked and let the hackers play disco in your house
@quartz kindle you know earlier when you said I would need to keep track of old messages through message id and channel Id and on the new one check if channel Id is the same and delete the message id how would I manage to do that if it's on a ton of servers
Like 500+
Why my leavechannel command doesn't work ? I got no errors when i use the command
let LeaveChannel = require("../../models/LeaveChannel");
module.exports = {
name: "leavechannel",
description: "Set the leave message channel",
category: "Config",
aliases: ["lc"],
run: async (bot, message, args) => {
LeaveChannel.findOne({ Guild: message.guild.id }, async(err, data) => {
if(err) console.log(err);
if(!data) {
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("Nu ai permisiunea sa faci asta!")
let channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]);
if(!channel) return message.channel.send("Trebuie sa specifici un canal ! (ID sau Mention)")
let newData = new LeaveChannel({
Guild: message.guild.id,
Channel: channel.id
})
newData.save()
message.channel.send(`Canalul a fost setat la ${channel}`);
} else return;
})
}
}
@hazy sparrow wtf is pipe
what pipe
cannot read property of pipe of undefined
So I currently have this:
${client.moment.duration(cd, 'milliseconds').format("h[h] m[m] s[s]")}
But is there a way to make the h[h] disappear when the cd is less then na hour?
thats ur error
theres no pipe in my code
send the full error
ok
@tulip ledge maybe regex?
what the hell is pipe
@hazy sparrow You're trying to access a key "pipe" of an object that is not defined
i have no pipe in my code
@tulip ledge Check whether the millisecond total is more than one hour and modify the format accordingly
You clearly do
ChickenDev, you could do something like:
let formatStr = "";
if (check if less than hour, if not) formatStr += "h[h]"
formatStr += " m[m] s[s]"
And then use the formatStr in the format function
lemme send the code brb
Alright
over 2k letters ;-;
lmao
wut?
The error isn't coming directly from your bot bow pro
not gona read it all in white it hurts my eyes
it's coming from discord.js
then what to do?
It's because you provide no files in the .attachFiles function
over 2k letters ;-;
my bot has a bin command that works with files x)
help.awaitReactions((reaction, user) => user.id == msg.author.id && (reaction.emoji.name == '👍' || reaction.emoji.name == '👎'),
{ max: 1, time: 30000 }).then(collected => {
if (collected.first().emoji.name == '👉') {
help.edit(helpembedPG2)
console.log('working')
}
})
also i need help
oh nvm
Fixed it within the first second
@vernal vapor channel IDs are unique across guilds
so you just need an object to store channel IDs
object/dict/whatever python uses
Is there a way to procedurally generate random base64 strings
what for?
Sure, make a string or a list of all legal base64 characters and pick random elements repeatedly
ok s i wanted to makea die command with arguments aka prefix roll 7 would generate a random number from 1 - 7 but i have no idea how. heres my code so far
module.exports = {
name: 'roll',
description: "this is a dice command. it generates random numbers from 1-x or by default, 6. .",
execute(message){
message.channel.send( ":game_die:" + "|" + message.author.username + " rolled a " + "**" + Math.floor(Math.random() * (6- 1 + 1) + 1) + "**")
}
}
6-1+1 is redundant lol
what for?
secure ID-ing (not for the bot, I'm just curious)
n = args[0] || 6 // get value from arguments or set as 6 if no arguments given
Math.ceil(Math.random() * n) // Math.ceil rounds to the upper number instead of lower number
i know?
why write that down tho?
@pure lion there are a billion methods to generate unique IDs
even something as simple as (Math.random() + Date.now()).toString(36)
Math.random() is not so random anyway
uuid are some of the ways i use it, its hard to crack down
thats why you combine it with Date.now()
you have a random component and a date component, guaranteeing a high level of uniqueness
the rest is just encoding, base36, base64, hex, doesnt matter
I prefer using crypto module with base64 to each their own
yeah, it depends on use case and how secure you need it to be
the tradeoff is always performance x security
128 bit uuid are pretty unique
How to use FindOneAndDelete? ( mongoose )
read the docs
deleteOne() gang
@quartz kindle would intents work now?
yes they work now
you can easily test
client.on("presenceUpdate",console.log)
without intents, that will spam your logs
with intents it wont
deleteOne() gang
Always the better option 😄 👍
Well the problem is that it's python and I haven't learnt that yet 
Was responding to BoTerator unless that's you
O shit I thought you were asking a general question 
It seems that one of you abreviations is failing
why so
for some reason lavalink stopped working
I can't search any tracks
anymore
its not my code
I changed nothing
and im using the latest version
so I don't understand what the problem is
I can play tracks with urls and I can do everything else but not search
don't spam
It seems that one of you abreviations is failing
@gray finch no lang works
thats not spam bro
@marble juniper you could have typed everything in one or three lines
@delicate shore your args2 only removes the prefix, not the command
so args2[0] is the command, not the first language
hmmmmm
I dont use arguments tho
@quartz kindle
if(command === "translate"){
const args2 = msg.content.slice(PREFIX.length).trim().split(/ +/g);
if (args2.length < 3) {
msg.reply(speech.BOT_TRANS_SPECIFIC_ERROR);
} else {
let argFrom = args2[0].toLowerCase();
let argTo = args2[1].toLowerCase();
let lang_from = language.filter(ele => ele.name === argFrom)[2].abrv;
let lang_to = language.filter(ele => ele.name=== argTo)[1].abrv;
let text = args2.slice(3).join(' ');
console.log(text)
console.log(lang_from)
console.log(lang_to)
translate(text, {from: lang_from, to: lang_to})
.then(res => msg.channel.send(res.text))
.catch(err => console.log(speech.BOT_TRANSLATION_ERROR + err));
}
}
this is giving same error
that is issue
(node:3730) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'abrv' of undefined
After bot command help message shouldn't be a ' ;'
Idk if that solve
But ill check more
@quartz kindle ok so this is what my bot logs
i think it's doing everything
in logs
but not sending messages
You didnt add discord dependencies
You need a part of code
i ahvbe
const Discord = require('discord.js');
Where
@delicate shore did you fix the args2?
Idk i didn't saw that line
yes
i did
if(command === "translate"){
const args2 = msg.content.slice(PREFIX.length).trim().split(/ +/g);
if (args2.length < 3) {
msg.reply(speech.BOT_TRANS_SPECIFIC_ERROR);
} else {
let argFrom = args2[1].toLowerCase();
let argTo = args2[2].toLowerCase();
console.log(argTo)
console.log(argFrom)
let lang_from = language.filter(ele => ele.name === argFrom)[1].abrv;
let lang_to = language.filter(ele => ele.name=== argTo)[1].abrv;
let text = args2.slice(3).join(' ');
console.log(text)
console.log(lang_from)
console.log(lang_to)
translate(text, {from: lang_from, to: lang_to})
.then(res => msg.channel.send(res.text))
.catch(err => console.log(speech.BOT_TRANSLATION_ERROR + err));
}
}
my code tim
error
why .filter()[1]
in fact you shouldnt even be using filter
you want to get 1 language from the languages list
not multiple languages
just use .find() and remove the [0]
@quartz kindle you mean i should remove language.filter and do lanuage.find
yes
did you remove the [1]
yes
show code
if(command === "translate"){
const args2 = msg.content.slice(PREFIX.length).trim().split(/ +/g);
if (args2.length < 3) {
msg.reply(speech.BOT_TRANS_SPECIFIC_ERROR);
} else {
let argFrom = args2[1].toLowerCase();
let argTo = args2[2].toLowerCase();
console.log(argTo)
console.log(argFrom)
let lang_from = language.find(ele => ele.name === argFrom).abrv;
let lang_to = language.find(ele => ele.name=== argTo).abrv;
let text = args2.slice(3).join(' ');
console.log(text)
console.log(lang_from)
console.log(lang_to)
translate(text, {from: lang_from, to: lang_to})
.then(res => msg.channel.send(res.text))
.catch(err => console.log(speech.BOT_TRANSLATION_ERROR + err));
}
}
show logs
k
here
let lang_to = language.find(ele => ele.name=== argTo).abrv;
affected line
You have 1000 lines in index js?
there is no hindi in your list of languages
there is no hindi in your list of languages
@quartz kindle there is
not in the file you sent before
oh
wait
yeah
lo
lol
@quartz kindle but if i do
s!translate swedish korean Hej världen
there is still error
same error?
then its an error in the translate function
ooh
Copyright (C) 2002-2020 RealVNC Ltd.
RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark
registrations and/or pending trademark applications in the European Union,
United States of America and other jurisdictions.
Protected by UK patent 2481870; US patent 8760366; EU patent 2652951.
See https://www.realvnc.com for information on VNC.
For third party acknowledgements see:
https://www.realvnc.com/docs/6/foss.html
OS: Raspbian GNU/Linux 10, Linux 4.19.118, armv7l
xauth: unable to write authority file /home/pi/.Xauthority-n
xauth: unable to write authority file /home/pi/.Xauthority-n
On some distributions (in particular Red Hat), you may get a better experience
by running vncserver-virtual in conjunction with the system Xorg server, rather
than the old version built-in to Xvnc. More desktop environments and
applications will likely be compatible. For more information on this alternative
implementation, please see: https://www.realvnc.com/doclink/kb-546
Running applications in /etc/vnc/xstartup
The virtual session failed to start. Session log:
Anyone know why its not working? Trying to do the command vncserver on my raspberry pi. Only started happening today.
Any ideas?
also, to avoid the abrv error with invalid languages, check if the language exists first
let lang = languages.find(...)
if(!lang) { return ... }
but it's not working anyways
what does the error say?
anyone know why lavalink just breaks and is like "nah im not gonna find any tracks no matter the query"
what does the error say?
@quartz kindle nothing
it worked and then not anymore
nothing after the error line?
nope
ig I will have to ask here for a year or longer
sorry link, i dont use lava
^^
k
@delicate shore change + err to , err
ok
error
came
at /rbd/pnpm-volume/aa72828e-329b-4d4b-a55d-e8f868d6e1c2/node_modules/.registry.npmjs.org/google-translate-api/2.3.0/node_modules/google-translate-api/index.js:105:17
at processTicksAndRejections (internal/process/task_queues.js:88:5) {
code: 'BAD_REQUEST'
}
it's api problem ig
bad request means you did something wrong, or the module did
well lavalink doesn't have a support server and in the support server im in for the node module im using thier server is dead
so no place to ask
oh
well lavalink doesn't have a support server and in the support server im in for the node module im using thier server is dead
@marble juniper use YTDL core
it was horrible
no rate limit
bruh
or anything
Just because you use it doesn't mean it's the best
bad request means you did something wrong, or the module did
@quartz kindle so i need to go through whole code?
@delicate shore it seems google-translate-api hasnt been updated in 3 years
module.exports = {
name: 'ping',
description: "this is a ping command!",
execute(message){
const cf = Math.floor(Math.random() * (2- 1 + 1) + 1);
if(cf = 1){
message.channel.send `${message.author.username} + it was heads!`
}
if(cf = 2){
message.channel.send `${message.author.username} + it was tails!`
}
}
}
am i doing it correctly?
i get this error
ooof
how do i make my bot change states slower
Change on a timer
setInterval is after
no
u need what?
that the state changes every minute because I am abusing the api
BANNED
but I do automate it
indeed, though Jake has said a couple times not to automate the api in short term
if its long periods, its fine, they dont care
only once every 60 seconds tho
but stuff like that they do
60 seconds is still considered api abuse pretty sure
Since I put it to change every 60 seconds, I know I have to touch some of this: setInterval (function () {(is incomplete)
60 seconds is still considered api abuse pretty sure
@solemn latch i know
or is it 120 I can’t be bothered to check CODe
Discord has a very loose interpretation of API abuse; as quoted by them:
American Jake01/21/2018
@Danny automating the API in that way /is/ abuse. Automatically doing "X" every N is generally not a good idea. Where X could be posting a message, changing someone's nickname, renaming a role, changing a channel topic, etc...
Generally bots should only react to user actions...
Although, for very large N we generally don't care. But for small N, we do care. Think rainbow bots, etc....
"N" is not really defined, as rate limits are not a good thing to try to get very close to. You're going to have to mostly use common sense here, compare how close you are the rate limit, how often you do this, etc.
Common sense ain't so common
where I put the 60 seconds in setInterval (function () {
the rule is, if you have to ask, dont do it
At the end of the options
i made a bot better then members+
/g.

the only thing I need because my bot is on 80 servers and I want to have it legal
no
setInterval(() => { code here }, 60000)
its a param, you p put it in the second parameter @earnest phoenix
Discord API server might be what you want though
is setInterval a loop?
-faq 1 @woeful void
@woeful void
😦
How owuld I trigger a piece of code every week at the same time??
indeed
It runs on an internal @spare mirage
setInterval(() => { code here }, 60000)
thanks I need that
is setInterval a loop?
yes, setTimeout is just "wait X ms and then do Y"
setInterval is a timer, not exactly a loop, but a timer that repeats itself
okoko
everyweek is bad for intervals
-bot
use scheduler
😦
Are u talking to me Erwin?
Bull does stuff like that
in a week is too big of a time gap
Yes that's what I'm scared for
use scheduler
-faq 1 @woeful void
@slender thistle i alredy do that but when i search at top.gg i dont find my bot
😦
it runs code cron
Oh Woo ur bot got accepted gg!
Yep
you can set up long timers that survive offline bots without any external lib nor database
scheduler is a function?
O
Hows that work @quartz kindle
you just need to recalculate the timer on every startup
i mean yeah
aaa
Ooh
lmao
I see
tim what do I have to put where it says [code here]?
for example, if you want something to run every day at midnight, on startup calculate how long until next midnight, then set a timeout for it, then an interval
I basically want to reset a certain thing every saturday at 2pm in belgium
Thats CEST
how do i add a cooldown to commands? like if the commands are not 5 secs apart, the bot wont respond.
finally my bot is now legal
tim do you have a bot of your own?
i have 3
im losing my shit rn
oh wow
And how would I do that then? Using scheduler?
you could use that thing i sent you
you made currency commands tim?
which saves you from a lot of date manipulation which is a pain
Tim has some weird calculation bot thing
no, i dont have currency commands
what does your bots do then?
wtf am i overlooking? s is skipped, but not h or m
So usig schedule I can run something every saturday at 2pm Cest?
one its for astrology, another is a captcha and the last one shows the content of discord message links
@tulip ledge yes
oh ok
why am i coding at 10am?
I want my bot use 1️⃣ in react but when i use :one: in message.react(":one:")
it not working
unicode
Oh oh tim, I recently got my telescope out @quartz kindle
I lost the eyepieces(rip had a $200 set)
Going to get some new ones here soon.
Going to try and get some camera gear too and do some astrophotography.
\1️⃣
oh thanks
awesome
why am i coding at 10am?
@opal plank lol im coding from 9am, its 7pm now
does anyone here have a detailed guide (video or docs) for making a database setup?
is that really unicode? 0-0?
let date = new Date(2020, 7, 11, 14, 00, 0);
let wipeGuilds = schedule.scheduleJob(date, function(){
// My Code
});
Ok so how do I make it so the date changes every time the function ran? Do I save it to a database?
Oh and how do I use timezones in Date()?
yay it work, but idont know how to type it x.x
type what?
1⃣
@opal plank this
why would you type that?
copy it on the code in the reaction part. after that you dont need to type it anywhere
bruh ive been staring at this for the past 10 minutes trying to figure out if theres a typo
➡️ for this and 2️⃣ and more other reaction 😅
one its for astrology, another is a captcha and the last one shows the content of discord message links
@quartz kindle how u did strology
can someone who's not hangover tell me what im missing here?
lmfao
m and h passes fine
@opal plank
its that stupid s not catching
splice doesnt play nice with for of apparently
for real? -.-
how to get the unicode of ➡️ ?
even though im filtering it?
you're splicing the same array that you're looping over
yeah
@night bridge \:emoji:
so the array gets iffy and skips stuff
use a for loop instead of for of
any that work >_<"
i'll try that, but still boggles me its not playing nice with it
cuz i did see that coming, thats why i cloned it
args = original
nargs = args clone to be modified
yo tim i have a question for ya
for of will still loop over the array indexes, just give you the value instead of the index
how did you clone it?
do you know how to store things in database tim?
@hazy sparrow Depens on what database you're using
you can nargs = Array.from(args), or nargs = new Array(args) or even nargs = [...args]
or nargs = [].concat(args)
i need a suggestion for that too
lmao
i was trying map before
though that was getting a bit over the top
thought it'd be fine with a shallow copy
Tim btw question. My friend stores stuff in his database like this:
user-userid: {
JSON OBJECT
}
He doesn't use JSON tho he uses sqlite but is it smart to store data like that?
yeah
@hazy sparrow databases are extremly well documented and guides on them are extremely common
yeah like it's smart?
@tulip ledge its fine to store json objects in a database, the only problem is that you cant index them, nor access them partially, you will always have to use them as all-or-nothing
i hate js
lmao
i want a guide specifically for discord bots
fucking references
but having 11 different tables each with like 20 columns is fine aswell? Lmao
Or should I use the JSON object?
from what i've learned, dont mix json and postgres. specially jsonb
_<" sorry i still got error like this even i do
message.react("\:one:");
keep shit in string format, for your own sanity
unicode
\1️⃣
i told you
@hazy sparrow there are a billion databases out there, for example SQLite, MySQL, PostgreSQL, MongoDB, and many more
What the heck
1⃣
let statuses = [
`over ${bot.guilds.cache.size} people`
`b!help`
`Im not idle! I just like yellow color it fits with my banana :D`
]
setInterval(function() {
let s = statuses[Math.floor(Math.random() * statuses.length)];
bot.user.setPresence({ activity: { name: s }, status: 'idle' })
}, 40000)```is this considered api abuse?
use this
i want for SQlite or anything that is easy to learn for a beginner
40 secs?/
when i pasted it on visual studio code, it become \:one:
yeah
if you want to use SQLite, the best library for node.js is better-sqlite3
1⃣
this becomes one?
What you do with a database will be the same no matter if its for a bot or not @hazy sparrow
But tim? Is it fine to have 11 tables and like 10-20 columns per table?
yes its fine
economy system kinda
@night bridge
whats that emoji?
Even if I have lets say 1000 usrs (only like 6 tables are for users) then it'll still be fine?
unicode
1️⃣ and 2️⃣
should be fine, depends on how its organized
@opal plank your working fine
@tulip ledge i tried your and i got error x.x
What you do with a database will be the same no matter if its for a bot or not @hazy sparrow
@solemn latch bot economy system
@night bridge what error?
yes thats fine
unknown emoji
but isnt varchar limited to 255
Should I set the varchar(2000) to TEXT?
cannot read property of guilds
var char at least on postgres can go up to 8bytes iirc
Should I change it to TEXT?
dont quote me on that though, i vaguely recall
this not working. it got error
@spare mirage ooo 8ball command
yes
U to like: \ 🤔 and then u get \🤔 and then u copy this and paste it in there
apparently mysql supports 16bit varchars, so until 64k
let me try again
Yes and it's the total of all varchars together
const bot = new Discord.Client();
SO if u have a total of 64k in varchars in 1 table you can't make more
oh rly
I do botlogin
Yes I experienced it myself lmao
ofc
weird
bot.login(token);
But should I change the Varchar(2000) to TEXT?
1⃣
why even limit it?
well, i digress, letting it error once it gets to max isnt a good idea either
Cause I use id's like this: TY36-TI74-OY89 and they can have a max of like 10 meaning the max is 180 and to be save Imade it 2000 lmao
I know what was wrong
i'd use TEXT yes
kk
It's MODIFY columname TEXT riught?
Wait though
The data I currently have$
Will it go away?µ
When I modify it
Jezus I can't type on this keyboard ffs
µ this?
How can i create category for all commands? (With fs module) It's possible?
Idk it's on my keyboard
Wdym @earnest phoenix
Like this?
Or in the help command?
sorry maybe i'm bad at coding, i got this error after copied your text from T_T
U to like: \ 🤔 and then u get 🤔 and then u copy this and paste it in there
try to do react but always failed x.x
Noo
why \
😩
\🤔
So in fs theres this function called isDirectory() to see if it is a directory or not.
What I do is I have this function and ask for 2 parameters: dir and (error, files)
If the isDirectory() triggers I trigger the function again and add the directory to the dir parameter
@earnest phoenix
copy this
and don't use text
If that made sense
just do :thinking:
or unicode
":thinking":
@tulip ledge so what can i do?
\🤔
or unicode
@opal plank you really like unicode
just use unicode oh my god my braincells are decreasing
What do you mean?
cuz they ARE unicodes
I told u what to do
Omg u people
Here Result
unicode
msg.react("\🤔")
\🤔
Create a function, loop through all the files and folders in the "commands" directory
Then check if the file/folder you are checking is a directory using fs's isDirectory() function
If it is a directory rerun the function and add the directory to the parameter
just copy paste an emoji from internet
@earnest phoenix
funny right? it got error 😅
msg.react("\🤔")
@night bridge
@tulip ledge I don't understand
no
i have the feature disabled here anyway
thanks it works now!
if i wanted react multiples so i need repeat msg.react(emoji); as many emoji i wanted?
Okay
.then?
or await
^
oh
you need an async function for that
you dont need async if you dont care about the reaction order
how can i add a cooldown to my commands in a command handler?
d.js guide
sec
ez, next
hmm ty
for (emoji of arrayemojis){
msg.react(emoji)
}```
this will work? xd
thats a smart idea
yes it will work
sometimes I just sit here watching this channel for an hour gaining braincells
@earnest phoenix You create a function lets say we call it loadCommands()
const loadCommands = module.exports.loadCommands = (dir ="./commands/") => {
// Rest of code
}
Inside there we're going to do a fs.readdir(dir, (error, files) => {})
inside of that we're going to run a forEach loop on the files gotten and run the isDirectory() function on the file
If it is a directory isDirectory() returns true so you can just do file.isDirectory()
Then if it is true we call the loadCommands like this loadCommans(dir + file + "/") and return
File is a folder name so it should now filter through: ./commands/fun/
If it is not a directory it doesn't go into the loadCommands "loop" meaning we're not returning so under the if(files.isDirecotry() you can just do your usuall adding stuff to the client.commands set
Woah
I mean I learnt alot by helping people
I didn't mean that lol
sometimes I just sit here watching this channel for an hour gaining braincells
@spare mirage relatable
but i never will understand what tim says, hes too advanced for me
I want to create with fs yes but with eval, xd
if you dont understand something, i can maybe explain better if you ask
Like creating new ones?
Tim lowkey carries this whole channel on his back, praise the lord
(y)
@hazy sparrow tim isnt humane
indeed, an angel
You can create directoreis using the mkdir package
i am a slave
angel is more befitting
ok tim we'll make a variable.
if(bow = coudn't understnd tim){
bow.channel.send("lmao tim")
{
= sets, not equal to
you dont need a package
Euhm
there is fs.mkdir
no @opal plank tim is an angel who wets code in your mouth
I knew it was mkdir but didn't know fs had it
Tim lowkey is a cow and everyone here is milking code from him
Lmao
Lol
ok tim we'll make a variable.
if(bow === coudn't understnd tim){
bow.channel.send("lmao tim")
}
@quartz kindle what do you say?

