#development

1 messages ยท Page 514 of 1

west raptor
#
message.guild.members.forEach(async (m) => {
    if (!m.displayName === 'Test') return;
    m.setNickname(m.username)
})```
#

ive tried so much

#

i dont know why this is working

#

isnt*

sick cloud
#

probably not in that code

#

probably in other code

west raptor
#

thats what i thought at first to

#

but

#

it wont fucking log the error

#

so

#

amazing

earnest phoenix
#

You could instead use Promise.all()

#

that way, if one promise fails, you'll be able to get the error

#
Promise.all(message.guild.members.map(async m => await m.setNickname('whatever'))
    .then(callback)
    .catch(console.error)```
west raptor
#

ok

#

am i retarded

#

๐Ÿ™ƒ

earnest phoenix
#

you just copied my code word for word

#

ยฏ_(ใƒ„)_/ยฏ

#

and you can't use implicit return with an if statement thonkku

high tinsel
#

I was happy too early...
"if(message.channel.permissionsFor("the ID of my bot").has("SEND_MESSAGES")){" shows as correct code, but don't prevent the error ๐Ÿ˜ž

#

*the error that happens when people use a command in a channel where the bot can't respond...

west raptor
#

looks like its my code

#

so i have to fix that

#

yay

#

๐Ÿ™ƒ

hushed berry
#

@high tinsel which error is it

high tinsel
#

UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

#

@hushed berry

hushed berry
#

perhaps its for other permissions besides send messages

#

embeds, perhaps?

high tinsel
#

Wait, embeds have separated persons?
If so, how do I include more permissions in this thing?

#

@hushed berry

hushed berry
#

i dont know

#

i dont code in js

#

๐Ÿ˜Š

smoky spire
#

hasPermission can take an array of permissions

bright spear
#

canine have you seen the docs

quartz kindle
#

yes, embeds have separate permissions

high tinsel
#

Do you know how is it called, I can't find it... @quartz kindle

sick cloud
#

EMBED_LINKS

quartz kindle
high tinsel
#

I tought EMBED_LINKS was just for links displaying as embeds...

sick cloud
#

embeds are one thing

quartz kindle
#

since embed is basically a json object, im pretty sure they are sent to the api and stored somewhere

#

and discord loads them like they would any other url

high tinsel
#

You are right, now it works!

earnest phoenix
#

How can I run another NodeJS file from within my original NodeJS file?

sick cloud
#

require

earnest phoenix
#

var prov = require('./is_prov.js')

#

Then would I use:

#

prov()

#

?

sick cloud
#

yes, if the file is exporting a function

earnest phoenix
#

what if its not

sick cloud
#

then it wont work

fervent delta
#

can i get the guild from a channel?

sick cloud
#

yes

fervent delta
#

how?

earnest phoenix
#

do I need to do anything else other than the require then?

sick cloud
#

channels have a guild property usually

#

uh

earnest phoenix
#

@fervent delta DiscordJS?

sick cloud
#

no

fervent delta
#

yep

sick cloud
#

@fervent delta channel.guild then

fervent delta
#

i need to get the guild from the channel in which a message is sent

#

and message has no channel property

sick cloud
#

it does??

#

are you blind

fervent delta
#

nO

sick cloud
#

<message>.channel

fervent delta
#

oh yeah it does

#

๐Ÿ˜“

#

im blind

sick cloud
#

ok

#

lol

#

you can also use .guild

#

msg.guild

fervent delta
#

yep

#

should work?

sick cloud
#

but yes

fervent delta
#

ohyeah

sick cloud
#

it's on red, even with !important

earnest phoenix
#

@sick cloud try changing b

quartz kindle
#

link?

sick cloud
#

okay

#

i got it

earnest phoenix
#

its b right

sick cloud
#

i think

#

idk

earnest phoenix
#

yeah

#

i just tried

sick cloud
#

tho

earnest phoenix
#

i gues

#

step 1: remove that white
step 2: profit

sick cloud
#

remove white where

earnest phoenix
#

legit everywhere

#

mmlol

sick cloud
#

its

#

the

#

theme

#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

earnest phoenix
#

o

#

ic

#

then make it all white mmLol

quartz kindle
#

it shows as default for me

#

but then again, the entire dbl website is screwed up for me

sick cloud
#

gradient bg, no dark theme or user styles = gud page

earnest phoenix
#

make everything gradient

#

also use adblock mmlol

quartz kindle
#

did you set a background image?

#

that new certified thing

sick cloud
#

none of my actual bots are certified

quartz kindle
#

oh lul

sick cloud
#

waiting for apps

quartz kindle
#

i set mine, but it never shows for me

#

its been like 2 weeks

#

i even tried in other browsers

earnest phoenix
#

i dont see any gradients @sick cloud Thonk

sick cloud
#

ur using dark theme

earnest phoenix
#

o

#

o ic

#

fix that shit

sick cloud
#

bc its all dark and the layout breaks

earnest phoenix
#

oof

#

oeuf

quartz kindle
#

i give up

#

the cert background thingy refuses to work

earnest phoenix
#

scam confirmed

fervent delta
#

ok

earnest phoenix
#

someone give me blurple color

night imp
#

@earnest phoenix lookup discord branding

earnest phoenix
#

ugh but i have to open a new tab

night imp
earnest phoenix
#

anyone elses lavalink just break after newest d.js update

rain kindle
#

Anyone knows how to get amount of users that talking in one specific channel from yesterday?
for example : in #general there are 7 active user that chat yesterday
I tried using

client.on('message', msg =>{
const channel = msg.channel.name === 'some-channel';
channel.fetchMessage()
.then(message => console.log(message.content))
.catch(console.error);
})

But it prints nothing
Anyone can help?

earnest phoenix
#

๐Ÿ˜ฉ

#

basically you are doing true/false.fetchMessage()

#

also i believe its .fetchMessages()

#

step 1: learn to code
step 2: read docs
step 3: profit

#

step 4: use profit to buy vps

fervent delta
#
const app = express();
const server = http.createServer(app);

app.get('/',function(req,response){
  console.log("[SERVER]" + "received from "+req.get("X-Forwarded-For")+" : "+req.method+" "+req.originalUrl+" (Authorization: "+req.get("Authorization")+")");
});

app.post('/',function(req,res){
  console.log(req);
});

server.listen(3000, () => {
  console.log('[SERVER] Listening');
});
#

my server

#

Hosted on: http://0.0.0.0:3000/dblwebhook

#

And ik that dbl can access it as it logs a different ip

#

which isn't mine

#

meh i tried the vote event nothing happened

sick cloud
#

if i have a command like -create -d some args -p some more args, whats the most efficient way to capture them in an object, like { d: "some args", p: "some more args" }

fervent delta
#

split them according to the params (-p, -d) and capture what lies in front of them

#

and then convert it into an object

floral stone
#

Any ideas on how to do custom scrollbar css for iframes?

languid dragon
#

i dont think you can for iframes

#

the site inside the iframe itself needs the CSS IIRC

floral stone
#

Ahh

#

I can do that

#

Thanks

languid dragon
#

np

floral stone
#

@languid dragon didn't work but thanks โค

languid dragon
earnest phoenix
#

no cross browser rip

bleak sapphire
#

anyone have an example for a uh oauth2 in python?

#

specifically flask

clear hound
earnest phoenix
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });

What do I put for "password" in this?

#

ping me if you reply

midnight widget
#

@earnest phoenix Your auth

#

your key

earnest phoenix
#

What's that

#

Ohhh

midnight widget
earnest phoenix
midnight widget
#

The lightbulb clicked

#

๐Ÿ’ก

earnest phoenix
#

along with the token?

midnight widget
#

yes

earnest phoenix
#

k thanks

viscid aurora
coral trellis
#

It's telling you how to install the Library of Discord.JS

midnight widget
#

d.js has installed, continue

viscid aurora
#

oki

#

How do I install

sinful lotus
#

read the guide

viscid aurora
#

thx

#

Im such a noob lol

bleak sapphire
#

hey how do I store the ouath2 session of my user so that when they open my website back they are logged in automatically

topaz fjord
#

create a cookie

bleak sapphire
#

Ye but the thing is I don't know what to store in it xd, I'm kinda new when it comes to oauth2

#

is it the oauth2_state, oauth2_token or what

quartz kindle
#

just store whatever you need

#

if you need their id, store their id

bleak sapphire
#

oh well i guess im trying too hard lmao

solid cliff
bleak sapphire
#

ye but it didn't really say anything about storing a session but nvm imma just do what tim said

solid cliff
#

import session from flask and just session['oauth2_token'] = token lurk

bleak sapphire
#

doesnt work for me Thonk

solid cliff
#

whats not working

bleak sapphire
#

It still asks for authorization when i relaunch the website

topaz fjord
#

I store credentials in my db

bleak sapphire
#

mmm imma just read mee6 source

earnest phoenix
#

Cookies seem to be the easiest way to do things with oauth

#

Storing in a database seems a bit unneeded

bleak sapphire
#

well cookies are limited

topaz fjord
#

@earnest phoenix I mean like I store the name, id, and tag so I don't need to readd to my db

earnest phoenix
#

Wait, why though

#

The name and tag can change

topaz fjord
#

ids wont

#

so I update every 24 hours

earnest phoenix
#

That's kinda weird too

#

Just store the id, and fetch the user when you need their info

pine eagle
#

hey yeah... im currently improving my python skills and would like to programm a discord bot in python.

#

right now, im adding my bot.

#

so: Whats the Bot Prefix? where is it used/displayed?

#

can someone give me an example?

earnest phoenix
#

hey yeah... im currently improving my python skills and would like to programm a discord bot in python.

#

right now, im adding my bot

#

so: Whats a variable? how do I use one? (i havent a clue about programming)

#

can somebody spoonfeed me?

#

sure man

#

tfw i dont even use python

#

but its probably

#

prefix = "autism"

#

and it work

#

ez clap

#

python hella gay btw

stuck compass
#

the bot prefix is literally just what comes before a command xP

rapid citrus
#

it also gives the same error on blank projects, lul.

violet depot
chrome olive
quartz kindle
#
if (!lng[message.guild.id]) {
                    lng[message.guild.id] = {
                        lng: 'en'
                    }
                } else {
                    lng[message.guild.id] = { lng: `${args[1]}` };
                }```
#

it only updates if it already exists. if it doesnt exist it resets to "en" and doesnt update

chrome olive
#

hmm ok

#

@quartz kindle this is ok?

quartz kindle
#

should be yes

#

you dont need to post the entire code, just the relevant parts

chrome olive
#

ok

#

P. S. [ if i restart the bot , it will work ]

#

like the prefix is ok

#
{"501383981690781706":{"prefixes":"="}}
#

is set but does not work

#

@quartz kindle

quartz kindle
#

hmm

#

your prefix is being updated only in the update file, not in the main file

#
main file -> load prefix
    update file -> load prefix again
    update file -> change prefix
    update file -> save prefix to file
#

your main file is never updated

#

your function has to somehow send the new prefix back to the main file

chrome olive
#

and what i need to delete?

#

@quartz kindle

#
      if(!prefixes[message.guild.id]){
        prefixes[message.guild.id] = {
        prefixes: 't!'
      };
    }

bcause "i have this const prefix = prefixes[message.guild.id].prefixes; "

earnest phoenix
#

Why can't you just put something like this before your command handler

if (prefixes[message.guild.id]) prefix = prefixes[message.guild.id].prefixes
else prefix = "default prefix"
chrome olive
#

this does work

#

i think

quartz kindle
#

the problem is that he loads the prefix into memory in his main file

#

and his other files load the prefix again from file

#

the prefix in the main file remains untouched still in memory

chrome olive
#

and .....how i can fix it ๐Ÿ˜ƒ

earnest phoenix
#

rip

chrome olive
#

like i don't understand what is the problem

quartz kindle
#

all your files get the new prefix when they are executed

#

but your command files get executed every time a command is run

#

but your main file only gets executed once

chrome olive
#

oh

quartz kindle
#

so you have to change your system

#

or move everything that needs a prefix to command files

#

so you have nothing that needs it in your main file

chrome olive
#

ok i will try

quartz kindle
#

anyways, its not a good idea to read and write files that much

chrome olive
#

"so you have nothing that needs it in your main file"
So should I make an event handler?

#

@quartz kindle

#

Because I do not know how to do it

quartz kindle
#

hmmm

#

what you could do

#

is remove the database files from all your commands

#

and have them only in your main file

#

and pass them through your command handler

#

also, move the entire settings update function into the main file

#

something like this

#
main file -> load all databases
main file -> update settings
main file -> handle commands
    command file -> execute```
#

you have to resolve the prefix and language in the main file, before you send it to the command file

#

and your update settings command has to be inside the main file, not in a separate file

#

so it updates the settings that are in memory there

chrome olive
#

bot.on("message", function (message) {
    try {
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
//=== [ No Bugs ] ===\\
      if(!prefixes[message.guild.id]){
        prefixes[message.guild.id] = {
        prefixes: 't!'
      };
    }
    if(!lng[message.guild.id]) {
        lng[message.guild.id] = {
            lng: 'en'
        }
    }
    const prefix = prefixes[message.guild.id].prefixes;
//=== [ Ping Message ] ===\\
        if(message.content === `<@${bot.user.id}>`|| message.content === `<@!${bot.user.id}>`) { 
        var embed = new Discord.RichEmbed()
            .setTitle(`My prefix in this guild is \`${prefix}\``)
            .setColor(config.bot.maincolor)
        message.channel.send(embed).then(msg => { msg.delete(10000) })
    }
//=== [ Main Feautures ] ===\\
            var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
            if (message.author.equals(bot.user)) return;
            if (!message.content.startsWith(prefix)) return;
            let cmd = args.shift().toLowerCase();
//=== [ Command Handler ] ===\\
        try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
    } catch(e) { console.log(e) }
});
quartz kindle
#

move this

#
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));```
#

outside of the message event

chrome olive
#

ok

quartz kindle
#

you only need to load the files once, not every time

chrome olive
#
bot.on("message", function (message) {
    try {
//=== [ No Bugs ] ===\\
      if(!prefixes[message.guild.id]){
        prefixes[message.guild.id] = {
        prefixes: 't!'
      };
    }
    if(!lng[message.guild.id]) {
        lng[message.guild.id] = {
            lng: 'en'
        }
    }
    const prefix = prefixes[message.guild.id].prefixes;
//=== [ Ping Message ] ===\\
        if(message.content === `<@${bot.user.id}>`|| message.content === `<@!${bot.user.id}>`) { 
        var embed = new Discord.RichEmbed()
            .setTitle(`My prefix in this guild is \`${prefix}\``)
            .setColor(config.bot.maincolor)
        message.channel.send(embed).then(msg => { msg.delete(10000) })
    }
//=== [ Main Feautures ] ===\\
            var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
            if (message.author.equals(bot.user)) return;
            if (!message.content.startsWith(prefix)) return;
            let cmd = args.shift().toLowerCase();
//=== [ Command Handler ] ===\\
        try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
    } catch(e) { console.log(e) }
});
#

this

quartz kindle
#

yes, you can check what is the current language, and pass the language to your command handler

#

commands.run(bot, message, args, language)

#

so your command files know what language it is

#

without loading the language file

chrome olive
#

first i need to define the language

#
const language = lng[message.guild.id].lng;```
#

done

quartz kindle
#

yes

#

and your update settings functions need to be inside the main file

#

like your ping command

chrome olive
#

done

#
Main file =
 commands.run(bot, message, args, language);
Inside the command =
exports.run = async (bot, message, args , language) => {
quartz kindle
#

yes

#

and inside the command files remove the prefix/language readfile

chrome olive
#
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
#

this

quartz kindle
#

yes

#

instead of lng, you use language that you have in the command handler

#

and prefix you dont need

chrome olive
#

ok

#

and i need to remove this

#
        if (!prefixes[message.guild.id]) {
            prefixes[message.guild.id] = {
                prefixes: 't!'
            };
        }
        if (!lng[message.guild.id]) {
            lng[message.guild.id] = {
                lng: 'en'
            }
        }
#

from the command

quartz kindle
#

yes

chrome olive
#

ok

#

and from the set prefix command i can delete this?

        fs.writeFile("./assets/prefixes.json", JSON.stringify(prefixes), (err) => {
            if (err) console.log(err)
        });
        fs.writeFile("./assets/languages.json", JSON.stringify(lng), (err) => {
            if (err) console.log(err)
        });
#

@quartz kindle

earnest phoenix
#

Hmm...I detect some dynamic JSON usage

quartz kindle
#

no, you need that to save the settings if your bot restarts

#

but put it in the main file

chrome olive
#

ok

#

FUCKING IDIOT BOT

quartz kindle
#

lmao

#

show me the main file again

chrome olive
#

wait

quartz kindle
#

where is the settings function?

#

i told you to move it to the main file

chrome olive
#

what?

quartz kindle
#

the code to change language and prefix

#

must be in the main file

chrome olive
#
      if(!prefixes[message.guild.id]){
        prefixes[message.guild.id] = {
        prefixes: 't!'
      };
    }
    if(!lng[message.guild.id]) {
        lng[message.guild.id] = {
            lng: 'en'
        }
    }
    const prefix = prefixes[message.guild.id].prefixes;
    const language = lng[message.guild.id].lng;

//=== [ Main Feautures ] ===\\
            var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
            if (message.author.equals(bot.user)) return;
            if (!message.content.startsWith(prefix)) return;
            let cmd = args.shift().toLowerCase();
//=== [ Command Handler ] ===\\
        try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args, language, prefix); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
    
        fs.writeFile("./assets/prefixes.json", JSON.stringify(prefixes), (err) => {
            if (err) console.log(err)
        });
        fs.writeFile("./assets/languages.json", JSON.stringify(lng), (err) => {
            if (err) console.log(err)
        });
#

not this?

quartz kindle
#

nope

chrome olive
#
language.lng = { lng: `${args[1]}` };
#

this?

quartz kindle
#

and the writeFile must be inside the code to change prefix

#

yes, that

#

the entire code

chrome olive
#

but it's a problem

#
        fs.writeFile("./assets/prefixes.json", JSON.stringify(prefixes), (err) => {
            if (err) console.log(err)
        });
        fs.writeFile("./assets/languages.json", JSON.stringify(lng), (err) => {
            if (err) console.log(err)
        });

to prefixes and lng i put language and prefix?

quartz kindle
#

you put whatever you loaded using readFile

chrome olive
#

hmm

#
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));

i need to put again this ? =))))

#

in the set command

quartz kindle
#
const prefixes = readFile(etc...);
bot.on("message")
if(command for changing prefix) {
    check if prefix is valid
    prefixes[guild].prefixes = newprefix
    fs.writeFile(prefixes)
}```
chrome olive
#

in the main file

quartz kindle
#

yes

chrome olive
#

And yet I'm curious
after all, do I remove it from the set command?
ย ย ย ย ย ย ย ย  fs.writeFile ("./ assets / prefixes.json", JSON.stringify (prefixes), (err) => { ย ย ย ย ย ย ย ย ย ย ย ย  if (err) console.log (err) ย ย ย ย ย ย ย ย  }); ย ย ย ย ย ย ย ย  fs.writeFile ("./ assets / languages.json", JSON.stringify (lng), (err) => { ย ย ย ย ย ย ย ย ย ย ย ย  if (err) console.log (err) ย ย ย ย ย ย ย ย  });

quartz kindle
#

remove it from everywhere, except the set command that is inside the main file

chrome olive
#

ok , i can't make a set command with a handler?

quartz kindle
#

nope

#

you have to delete the set command file

#

and move the set function to the main file

#

because thats where the prefix is sitting in memory

chrome olive
quartz kindle
#

almost

#

need to fix a few things

craggy bear
#

Useful nodejs function for whoever wants itjavascript function mkdir(path) { let fullPath = "./"; path.split("/").forEach(folder => { if (folder !== ".") { if (!fs.existsSync(`${fullPath}${folder}`)) fs.mkdirSync(`${fullPath}${folder}`); fullPath += `${folder}/`; } }) }

chrome olive
#

what

quartz kindle
#

you dont have args yet

#

you have to create args

chrome olive
quartz kindle
#

and the fs.writeFile() looks incomplete, where is the rest of the code? utf-8, callback console.log

chrome olive
#

ye

#

ok

#

wait sryt

craggy bear
#

Why are there spaces in your path?

quartz kindle
#

move the main features section to the top

#

so you have args

chrome olive
#

ok

quartz kindle
#

and so you stop the function if message comes from a bot

#

before you start doing stuff

#

put it after you set prefix and language

#

and before the startswith

chrome olive
#

just , without

#
    if (message.author.equals(bot.user)) return;
quartz kindle
#

just do if(message.author.bot) return;

#

that will stop all bots

chrome olive
#

ok

quartz kindle
#

including your own bot

chrome olive
#
if(isNaN(args[1]) 
works?
quartz kindle
#

that will stop numbers yes. accepts only text

chrome olive
#

bc i want to put this to set prefix

quartz kindle
#

you want to prevent numbers in the prefix?

chrome olive
#

exclude

#

yes

quartz kindle
#

either if(!isNaN(args[1])) return

#

or you can remove numbers with regex and continue

chrome olive
#

but the owner can put !

#

or ? or t!

craggy bear
#

Is msg.author.equals(client.user) faster than msg.author.id === client.user.id?

quartz kindle
#

strict comparison should always be faster than any function

amber junco
#

I require assistance

quartz kindle
#

cannot read property tag of undefined

amber junco
#

I know that

#

But cant seem to fix

quartz kindle
#

suggestion.js line 11

#

whatever is before tag is either wrong, empty or non-existent

amber junco
#

.setAuthor(message.author.user.tag, message.author.user.avatarURL)

#

it is the code

craggy bear
#

Author is already a user object

#

Author.user isn't a thing

amber junco
#

I dont understand

craggy bear
#

Just put author.tag, bot author.user.tag

#

Not*

quartz kindle
#

message.author.user.tag = message.user.user.tag

#

user.user doesnt exist

amber junco
#

o yeah

#

.setAuthor(message.user.tag, message.user.avatarURL)

#

is this it?

quartz kindle
#

you didnt change anything?

amber junco
#

now

quartz kindle
#

yes

#

no

amber junco
#

is it correct?

quartz kindle
#

not message.user

#

message.author

amber junco
#

ohh

craggy bear
#

Either do message.author.tag or message.member.user.tag

amber junco
#

k

#

nope

#

doesnt work

#

should I ss suggestion.js?

chrome olive
#

FUCK THIS SHIT

#

@quartz kindle

amber junco
#

lmao

#

cold ping

chrome olive
quartz kindle
#

you dont check if a command exists

#

let commands = require(./Commands/${cmd}.js);

#

if you do prefix lalala it will look for lalala.js

chrome olive
#

hmm ... i can put

return;
}```
quartz kindle
#

better do something else

#

when your bot starts, on the top of the file, where you do fs.readFile

chrome olive
#

yes

quartz kindle
#

do fs.readdir

#

and save it in an array

#

so you know which commands exist in the commands folder

chrome olive
#
    var dir = "./Commands"
    fs.readdir(dir, (err, files) => {

}
quartz kindle
#

and then, before the command handler, you check if cmd exists in the array

#

yes

chrome olive
#

i put this above the fs.read

#

?

quartz kindle
#

wherever you want, just before .on("message")

amber junco
#

I tried it out It won't work

#

I am probably being a pain in the ass rn...

sturdy chasm
#

once I have given my bot access to all the info it needs (it's 4 books of rpg traps), what else will it need before it's allowed on the botlist website?

#

I know it'll need to be online

quartz kindle
#

it needs to work

#

not crash

#

etc

chrome olive
#
if(!files.find('name', 'set')) {
    return;
}
#

it's ok ?

#

@quartz kindle

quartz kindle
#

use readdir to get an array

chrome olive
#

aaa I know i'm noob , how =)))

quartz kindle
#

like ["command1.js","etc.js,"bla.js""]

#

and then do if(array.includes(cmd)) { command handler }

#

or if(!array.includes(cmd)) return

#

you can use const commandlist = fs.readdirSync("./commands")

#

but then the array has .js but cmd doesnt

sturdy chasm
#

sometime today, would it be alright if I try to invite my bot over to one of the 2 testing channels?

quartz kindle
#

you have to apply in the website

#

if your bot is approved, then it will be added

#

then you can use the testing channels

sturdy chasm
#

ah, ok

quartz kindle
#

if the bot is minimally functional, it will be accepted

#

at least one working command, that isnt ping or help

sturdy chasm
#

I have several

chrome olive
#
    if(array.includes(`${cmd}.js`)) {
    let cmd = args.shift().toLowerCase();
        try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args, language, prefix); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
        if(!array.includes(`${cmd}.js`)) return;
    }

like this?
@quartz kindle

valid frigate
#

wot

earnest phoenix
#
  • I advise against reading commands synchronous ly if you can avoid it
valid frigate
#

your catch block will catch everything including what happens to the command

quartz kindle
#

you already have cmd = args.shift().toLowerCase(); before, no?

chrome olive
#

no

quartz kindle
#
    var args = message.content.substring(prefix.length).split(" ") || message.content.split(" ").slice(1);
    if(message.author.bot) return;
    if (!message.content.startsWith(prefix)) return;
    let cmd = args.shift().toLowerCase();```
chrome olive
#

oh

#

yea

quartz kindle
#

so remove it

chrome olive
#

done

#

@quartz kindle array is not defined

earnest phoenix
#

Define it

#

Or don't use it, dunno

quartz kindle
#

array is the name of the array you created with readdir

#

that contains all the file names

chrome olive
#

for me is dir

#

var dir = "./Commands"

quartz kindle
#

thats the address of the folder

chrome olive
#

or
const commandlist = fs.readdirSync("./Commands")

quartz kindle
#

not the list of files inside the folder

#

commandlist <- array

chrome olive
#

ok

quartz kindle
#

so commandlist.includes()

chrome olive
#

oh shit

#

& no error

#

....

#

@quartz kindle

quartz kindle
#

show your main file

chrome olive
quartz kindle
#

why did you put your entire bot file inside the readdir callback? lmao

#

do it like this

#
//=== [ require files ] ===\\
let prefixes = JSON.parse(fs.readFileSync("./assets/prefixes.json", "utf8"));
let lng = JSON.parse(fs.readFileSync("./assets/languages.json", "utf8"));
let config = require('./assets/config.json');
let commandlist = fs.readdirSync("./Commands");
//=== [ Events ] ===\\```
#

and remove the other one you did

#
    const commandlist = fs.readdirSync("./Commands") // <-- remove
    const prefix = prefixes[message.guild.id].prefixes;
    const language = lng[message.guild.id].lng;```
#

and

#
if(commandlist.includes(`${cmd}.js`)) {
        try { let commands = require(`./Commands/${cmd}.js`); commands.run(bot, message, args, language, prefix); } catch (e) { console.log(`[TREVIL-CMD-ERROR] ${cmd} not found.`) }
        if(!commandlist.includes(`${cmd}.js`)) return; // <-- remove this
    }```
earnest phoenix
#

Or don't read commands synchronously

quartz kindle
#

yes

#

but let him get it working again first

earnest phoenix
#

I tend to tell people, why do things synchronously and block the event loop, when you can use async

#

Kind of defeats the main idea of nodejs

chrome olive
#

๐Ÿคฆ

quartz kindle
#

once its working, then we can move to fix it

chrome olive
#

same prob

quartz kindle
#

@_@

chrome olive
#

=)))

#

i think

earnest phoenix
#

Are you just copy pasting stuff?

#

Do you understand what Tim is telling you?

chrome olive
#

y

earnest phoenix
#

If not, then you're making it very hard on him and you

quartz kindle
#

he understands

#

i sent him lots of pseudocode and he did it correctly

earnest phoenix
#

Hmm...I'm not convinced.

chrome olive
#

๐Ÿคท I'm noob =)))

earnest phoenix
#

Scrolling up, there were some mistakes that were easily preventable...

quartz kindle
#

try putting a console.log(commandlist,prefix,language)

#

here

#
//=== [ CMDS ] ===\\
    if(message.content === `${prefix}set`) {```
#

before the if

#

lets see if everything is correct

chrome olive
#

//=== [ CMDS ] ===\

    if(message.content === `${prefix}set`) {
console.log(commandlist,prefix,language)```
#

? =))

quartz kindle
#

before the if

#

and check your console to see what comes up

chrome olive
#

console.log(commandlist,prefix,language) if(message.content
i don't think

#

console.log(if

#

[ 'setup.js' ] 't!' 'en'

#

@quartz kindle

quartz kindle
#

looks correct

chrome olive
#

ik

quartz kindle
#

and if you do t!set nothing happens?

chrome olive
#

yes

#

it's broken i think

#

it's because the command it's broken

#
    if(message.content === `${prefix}set1`) {
        message.reply('coaie');
    }
#

and reply the message

split dune
#

Why you use messagecontent :/

chrome olive
#

idk

hollow fulcrum
#

is dis java OwO

chrome olive
#

=)))

quartz kindle
#

the reply works?

chrome olive
#

yes

quartz kindle
#

try console.log(args)

#

in the same place as the reply

#

see if the args are correct

#

something inside the command is broken

chrome olive
#

yeah

#

the prob is args i think

#

[ 'set' ]

#

same

#
what's the wrong
var args =
 message.content.substring(prefix.length).split(" ") 
or
message.content.split(" ").slice(1);```
quartz kindle
#

the second option is better i think

chrome olive
#

lol

#

//=== [ Command Handler ] ===\\ let cmd = args.shift().toLowerCase();
TypeError: Cannot read property 'toLowerCase' of undefined

#

@quartz kindle it's because i changed the args?

quartz kindle
#

yes

chrome olive
#

oh wait

#

i need to create just a prefix command

#

and another for lng

quartz kindle
#

if you do message.content.shift()

#

you dont need to do args

#

shift() modifies the original

chrome olive
#

where ? to if(message.content === ${prefix}set) {

quartz kindle
#

better do like this

chrome olive
#

if(message.content.shift(`${prefix}set`))```
#

?

quartz kindle
#
cmd = message.content.split(" ").slice(0,1);```
#

but cmd contains the prefix as well

chrome olive
#

oh yea

#

and i not put args[0] and args[1] no?
i put just cmd

quartz kindle
#

so you can do cmd = message.content.split(" ").slice(0,1).slice(prefix.length);

#

wait no

#

cmd = message.content.split(" ").slice(0,1).join("").slice(prefix.length);

#

lmao

#

im getting tired lul

chrome olive
#

ik =)))

#

bc i'm noob

#

You stayed to help me for two hours

quartz kindle
#

i should get paid for this lmao

chrome olive
#

=))))

#

yes

quartz kindle
#

if(message.content.shift(${prefix}set)) {

#

nonono

#

put this back how it was

chrome olive
#

oh yea

quartz kindle
#

Lol

chrome olive
#

and inside the command

#

It does not work like that, but let it do something else, separate

quartz kindle
#

cmds is message.content.split(" ").slice(1) ?

chrome olive
#

var cmds = message.content.split(" ").slice(0,1).join("").slice(prefix.length);

quartz kindle
#

then thats wrong

#

cmds is the command, for the command handler

#

not the args

chrome olive
#

let cmd = args.shift().toLowerCase();

quartz kindle
#

the thing is

#

slice doesnt modify the original

#

shift does

#

for example

#
array = [a,c,b,d];
array.slice(1) // [b,c,d]
array.slice(0,1) // [a]
console.log(array) // [a,b,c,d] not changed
array.shift() // [a]
console.log(array) // [b,c,d] shift removed a from the original```
chrome olive
#

and this is wrong message.content.split(" ").slice(0,1).join("").slice(prefix.length);

quartz kindle
#

so when you do args.shift() you're deleting the 1st item from args

#

that one uses slice, not shift, so it doesnt delete the original

chrome olive
#

ok

#

args.shift() = prefix & lng

#

.slice(1) = the specified prefix & language

quartz kindle
#

no

#

just delete everything

#

and start from message.content

#

and do what i said

#

args = message.content.split(" ").slice(1);
cmd = message.content.split(" ").slice(0,1).join("").slice(prefix.length);

#

args go to the set command

#

cmd goes to command handler

#

if your command is t!set % for example

#

args = ["%"]

#

cmd = "set"

sturdy chasm
#

I assume that a Java.gitignore template would also work for javascript

chrome olive
#

I cry

#

right now

#

I'm extremely nervous

#

WHYY

#

i want to install sqlite

quartz kindle
#

try running cmd as admin

toxic forum
#

think you,re missing gyp

mossy vine
#

do non-cert bots get full html access in long description?

topaz fjord
#

yes

#

cert bots get js

mossy vine
#

alright cool thanks

steel heath
#

is there any way that i can get the information about a server in another shard without using broadcasteval?

topaz fjord
#

nope

#

well unless you use internal sharding @steel heath

steel heath
#

whats that

topaz fjord
#

internal sharding is on d.js master and it treats all shards as one

steel heath
#

im using d.js master's sharding manager

topaz fjord
#

I'm not too familiar with it yet though

#

it got merged 2 days ago afaik

steel heath
#

well im just trying to make something to check if the bot is in a guild

ruby dust
#

I heard shard 0 is the main shard that works with all other shards

topaz fjord
#

shard 0 gets all the dms I thought

ruby dust
#

that too

#

it can also be some servers

#

but it's the main shard still

topaz fjord
#

I don't think shard 0 has all the data though

steel heath
#

mhm

#

umm, i still cant figure out how to make it check if my bot is in that guild

zenith moss
#

This is kind of a dumb question but how do you add clickable text like โ€œsupport server | invite | voteโ€ with all being clickable with different links

#

Lib d.js

steel heath
#

[Support Server](https://dis.gg/xxx) | [Invite](https://d.app/xxx) | [Vote](https://d.org/bot/xxx)

zenith moss
#

Alright

topaz fjord
#

@steel heath just broadcast eval getting the guild

#

one will return null, the other wont

#

you will only be able to get the guild if your in it

zenith moss
topaz fjord
#

no u need quotes around it

steel heath
#

ik but when i try that with EJS it keeps logging memory leak warnings of message event

zenith moss
topaz fjord
#

Around the whole thing

zenith moss
#

Alright

earnest phoenix
#

@steel heath what does ejs have to do with this?

steel heath
#

i am trying to build up a dashboard with it EqCute

smoky spire
#

Markdown isn't supported in the footer

zenith moss
#

Iโ€™m so dumb ๐Ÿ˜‰

earnest phoenix
#

So...

#

Still don't understand how ejs has anything to do with this

topaz fjord
#

ejs doesn't have anything to do with getting guilds ๐Ÿ‘€

steel heath
#

well i was trying to broadcasteval inside it

hollow fulcrum
#

if people == len(bl) + 1 and not len(bl) == 1:

#

wont work

earnest phoenix
#

Well, dont. Lol

hollow fulcrum
#
        fw = await ctx.send("The following users are in the blacklist:")
        for people in bl:
            if people == "Def": continue
            peopler = client.get_user(people)
            people1t = peopler.discriminator
            people1n = peopler.name
            ee = f"{fw.content}\n{people1n}#{people1t}"
            if people == len(bl) + 1 and not len(bl) == 1:
                fw.edit(content=ee)
        if fw.content == "The following users are in the blacklist:":
            await fw.edit(content="No users are in the blacklist. **WOW!**") #runs, even if there are people
        return```
steel heath
#

then how do i fetch all guilds, render it inside to the file and check if the guild exist

earnest phoenix
#

Fetch the guilds, check if the guild exists, then render

#

In that order

zenith moss
#

Soo, .addField(โ€œSupport Serverโ€) also doesnโ€™t work, can anyone just give me a example please, I donโ€™t use mark down that much.

earnest phoenix
#

Maybe you should Google it ๐Ÿ‘€

#

You're on the right track, just not there completely

steel heath
#

thats what happens when i broadcasteval

zenith moss
smoky spire
#

Update to latest master so you can use internal sharding and don't need to use broadcast eval

steel heath
#

how do i use that

smoky spire
#

This is only available if you install the latest master branch
npm i discord.js/discordjs
If you are not on the correct version, you will get an error about an invalid option.

// Internally sharding automatically
const Discord = require('discord.js');
const client = new Discord.Client({ shardCount: 'auto' });
// Interally sharding with specific shards
const Discord = require('discord.js');
const client = new Discord.Client({ shards: [0, 1] });
earnest phoenix
#

it fucks d.js-lavalink

topaz fjord
#

lmao

hollow fulcrum
#

SyntaxError: can't assign to operator
Reloading...
File "C:\Users\TeeHee\Desktop\UltraBot\bot.py", line 202
await ctx.send("Command list:{0} - {1}".format('\n'.join([cmd.qualified_name for cmd in client.commands]),''.join([cmd.brief for cmd+1 in client.commands])))
^
SyntaxError: can't assign to operator

#

but why

vast lotus
#

hahaha

#

๐Ÿ˜„

earnest phoenix
#

hahaha

#

๐Ÿ˜„

zenith moss
#

I still canโ€™t figure out markdown with links

#

Iโ€™ve looked everywhere

#

That doesnโ€™t work

hollow fulcrum
#

what are you trying to do

earnest phoenix
#

@steel heath show your code.

steel heath
#

dms

#

@earnest phoenix ^^

earnest phoenix
#

My DMs aren't on

#

Is it urgent that you have to dm?

steel heath
#

i just dont want to show this yet cuz i dont think im going to figure it out but lol, this thing mustve worked imo:

earnest phoenix
#

Uhm

steel heath
#

ah i need one more loop for broadcasteval

earnest phoenix
#

I'd rather you not use async forEach

#

It's not going to perform like you expect.

steel heath
#

uh oh

#

any other ways for that?

#

i think you understand what im trying to do

earnest phoenix
#

Also. In the loop, that condition will always return true

zenith moss
#

oops

earnest phoenix
#

Since the broadcastEval returns an array

#

Which is truthy in this scenario

#

@zenith moss bro. The answer is in that picture

steel heath
#

yeah i just realised that too but whats the other ways

zenith moss
#

It doesn't work for me or I am just being dumb

earnest phoenix
#

You have the right idea, you're just missing it slightly

#

The picture literally tells you how to do it

zenith moss
#

Oh well

earnest phoenix
#

I'd use a for..of loop, that way you can actually take advantage of await. Second, I would filter the array for values that are truthy, and see if there is anything then.

#

So something like
Array.filter(arg => arg)[0]

steel heath
earnest phoenix
#

I said for...of

#

And why are awaiting filter which is not a promise and is synchronous.

steel heath
#

ah, wait, i need to learn how to use it

#

idk ew

#
for (let guild of req.user.guilds) {
   const check = await client.shard.broadcastEval(`this.guilds.has('${guild.id}')`);
   const filter = check.filter(c => c == true)[0];
   if (filter) guildExist.push(g.id)
}``` umm
inner jewel
#

why not check.find(c => c == true)

steel heath
#

sure

bright spear
#

@zenith moss FYI in discord markdown links only work in embeds and webhook messages

zenith moss
#

I know

topaz fjord
#

but cant webhooks send embeds

zenith moss
#

I am using it in a embed

steel heath
#

ded

#

that code didnt work

#

just like i expected

#

wait

#

oh god

#

yay

#

really

#

also thanks @inner jewel for that suggestion thanks really

#

i was trying to build these 3 lines for couple hours

inner jewel
#
await Promise.all(req.user.guilds.map(guild =>
    client.shard.broadcastEval(`this.guilds.has('${guild.id}')`)
    .then(r=>r.find(c => c == true))
    .then(r=>r ? guild.id : null)
)).filter(r => r !== null)```
#

this would allow running all evals in parallel

steel heath
#

umm, thanks but how and where can i use that, like, do i replace the code up there ^ or...

inner jewel
#

that would return an array with the existing guild ids

steel heath
#

~~can i get some examples EqCute ~~

last nexus
#

Hey, how can I add my bot to the server of yours again I was using a code that anyone who votes on the bot would receive a thank you only that he started to do mass dm sorry for what happened

Code I used

message.author.send('Obrigado por votar ativei seu vip')

})```
**I fixed the bug**
inner jewel
#

you never use the voted value

zenith moss
#

I figured it out finally, thanks @earnest phoenix

earnest phoenix
#

@inner jewel what the heck?

#
await Promise.all(req.user.guilds.map(guild =>
    client.shard.broadcastEval(`this.guilds.has('${guild.id}')`)
    .then(r=>r.find(c => c == true))
    .then(r=>r ? guild.id : null)
)).filter(r => r !== null)```
seems a bit more verbose, and not really needed
alpine robin
#

Any know the code to repeat the songs ?

sick cloud
#

no

#

you need to make that

inner jewel
#

that runs all the evals in parallel

#

instead of serially

#

for-of + await in the loop body will only start the next eval after the current one finishes

placid flax
#

so im trying to add functionality to scrape discord issues and post them as they become available

topaz fjord
#

fun

#

It wont be accurate tbh

#

Discord status page lies

#

the only thing that doesn't is the ping mmLol

placid flax
#

right now im scraping https://discord.statuspage.io/history.json and https://discord.statuspage.io/incidents/<incident code>

#

the second one being more accurate

#

was wondering if anyone had a better idea than just running the whole thing through beautifulsoup and checking the "status code"

#

of course the json doesnt need to go through bs4

#

just throw me a ping ig ๐Ÿ‘

sick cloud
#

@placid flax its a json file

#

just make a GET request

earnest phoenix
#

^

sick cloud
#

and you'll get json back

placid flax
#

json doesnt have the handy things im referring to as status codes

#

identified, update, resolved

sick cloud
#

then work them out yourself

#

they do??

#

take a look

placid flax
#

they do not

sick cloud
#

they

#

do

placid flax
#

thats the api not the current issue ๐Ÿคฆ

sick cloud
#

how sad

placid flax
sick cloud
#

scraping will just get you banned

topaz fjord
#

@placid flax the json does have it

sick cloud
topaz fjord
placid flax
#

how does that get me banned

topaz fjord
#

shows the code in the incident array for the month

sick cloud
placid flax
#

for one, this bot isnt on DBL, two, discord uses statuspage which is a third party error reporting company

sick cloud
#

look there

placid flax
#

such hostility for a simple question

sick cloud
topaz fjord
#

no

#

the code

#

not a status

sick cloud
#

scraping wont do shit

placid flax
#

yes thats what i want

sick cloud
#

then there

#

incidents arr

placid flax
#

๐Ÿ‘

#

the whole purpose of this was to post the incidents to a channel as they occur, not repeatedly scrape through all of the issues. tl;dr im too lazy to open status.discordapp.com and i want a bot to post it for me

#

unless bot gateway dies then rip

#

i dont see how thats bannable shegounamused

earnest phoenix
#

how i supposed to write that?
await member.guild.addRole(role.id);

sick cloud
#

member.guild

#

makes sense

keen drift
#

i wish discord update their status page more often

#

a lot of the incidents doesn't get recorded

hushed berry
#

@placid flax bannable as in, your IP will get blocked by statuspage :p

placid flax
#

with infrequent requests to the json? assthink

#

i understand 2000+ requests per hour but

hushed berry
#

shrug, im just clarifying what they meant

placid flax
#

got me all worried

inner jewel
#

can't you use webhooks?

placid flax
#

possible

hushed berry
#

yeah lol

sonic badge
#

hey, I'm trying to set up webhooks for tracking votes, but I can't seem to get anything to happen - I made a webhook in a server of mine and copied the url into my bot's edit page but when i click either the test or save button nothing happens

placid flax
#

thatd actually be better

inner jewel
placid flax
#

dunno how to use webhooks for that tho since statuspage allows you to subscribe via json and shit but discord only has email notificatiosn enable-

#

wellp

#

nevermind

#

i spose i need to learn more about statuspage

#

thatll work thank

#

โค

sonic badge
#

idk why i can't seem to save or test the url i have for my webhook in my edit page

bright spear
#

@sonic badge does the url have 0.0.0.0

sonic badge
#

It's just the URL generated when I create a webhook user in my server - I thought that's what I needed to copy

#

It doesn't have 0.0.0.0 anywhere in it

bright spear
#

oh no

#

its not a discord webhook

#

you need to receive the post request in your webserver

#

if you use JS then dblapi.js can handle it for you

sonic badge
#

oh, ok

#

That's not what i'm using, but ty anyway

bright spear
#

well then set up a webserver

#

and yw

floral stone
#

@languid dragon That helped, thank you.

fervent delta
#

Umm...
How do we go about adding modlogs? Like the ones in dyno?

earnest phoenix
#

what lang?

fervent delta
#

JS

earnest phoenix
#

uhh

#

what lib

fervent delta
#

Currently using djs

earnest phoenix
#

use the events

fervent delta
#

With commando framework

#

Hmmm

earnest phoenix
#

gross commando

fervent delta
#

My index will get cluttered

earnest phoenix
#

anyways

fervent delta
#

Lol

#

K

#

Thanks

earnest phoenix
#

np

quartz kindle
#

Lol

earnest phoenix
#

commando is not only gross, but slow

#

yes

#

One of the slowest frameworks you could ever choose

#

I've used my fair share of frameworks: until I came to a conclusion that I hated them all

quartz kindle
#

i havent tried any

earnest phoenix
#

Not all because they were bad, just because of the lack of control I had when using them

#

i complain about things that reminds me of the old me

quartz kindle
#

i like to do everything myself

earnest phoenix
#

when you use a command framework, you give up a lot of control

#

i remember why i moved to d.js

#

over how the nitty gritty things are handled

quartz kindle
#

it can also be a pain in the ass to debug, because you have no idea what the framework is doing

earnest phoenix
#

is it bad that i moved to d.js without a framework only because i didn't know how to make a ban command in commando?

#

what

#

commando is d.js

quartz kindle
#

^

#

lmao

earnest phoenix
#

yes i know

#

so what you said doesnt make sense.

#

darn

#

And uhm

#

i wanted to look "relatable" but now i look stupid

#

making a ban command is literally the same thing regardless of what framework you are using

#

look

#

maybe the arg parsing is different, but the core code for the ban is the same

#

i didn't know that in march

quartz kindle
#

inb4 google makes a framework:
"ok google, ban user id"

earnest phoenix
#

Alexa, ban 419243569820336130

quartz kindle
#

Siri, ban Alexa

earnest phoenix
#

ok google ban siri

quartz kindle
#

cleverbot, ban google

earnest phoenix
#

bing, ban cleverbot

quartz kindle
#

yandex/yahoo/duckduckgo/ask ban everyone to #shitpost

earnest phoenix
#

k cool

viscid aurora
#

Hey guys, what version of Node should I install?
10.13.0 or 11.1.0

quartz kindle
#

whichever you want

viscid aurora
#

oki

earnest phoenix
#

hwo to remove this ugly line from dbot bot page

#

i dont mind having ads

#

but like the line is bad

earnest phoenix
#

f12 -> inspect with dev tools in browser -> find the class/id -> hide it with css Thonk

#

but what IS it? i cant find it

earnest phoenix
#
#bot-details-page #details .container {
    border-top: none!important;
}
#

oh

scenic charm
#

  throw err

  ^

Error: Could not locate the bindings file. Tried:

 โ†’ /rbd/pnpm-volume/91372360-a950-4a6f-9b0f-7167d6107039/node_modules/.registry.npmjs.org/better-sqlite3/4.2.0/node_modules/better-sqlite3/build/better_sqlite3.node```
scenic charm
#

how can i fix that

bright spear
#

@scenic charm update the node version in package.json

#

I recommend 10.x

scenic charm
#

@bright spear i ll try

serene cobalt
#

just a tip

#

sqlite3 is trash

#

Use postgresql

drowsy lily
#

No it's not.

#

Sure it doesn't scale well enough to serve a discord bot on hundreds of thousands of guilds but it's good enough for most use cases below that, and saves you a ton of trouble figuring out how to run a full blown database service without losing or exposing data, how to keep it available, and how to back it up correctly.

earnest phoenix
#

sqlite on any multi user application peepoKek

#

sqlite for concurrent reads topkek

#

sqlite OMEGALUL

sick cloud
earnest phoenix
#

@sick cloud yes

#

but what

#

lol

pale marsh
#

@sick cloud show code?

earnest phoenix
#

margin-right: 80px;

#

facepunch no dont. ur markup probably just wrong

#

๐Ÿ˜‚

earnest phoenix
#

Can someone tell me how a basic antispam would work?

#

Do i store the values in an array?

quartz kindle
#

you can do something like fetching last 5 messages and get total time interval

#

but doing that for every single user is quite expensive

#

you could set up a database that records message timestamps with auto-expire of like 5 seconds

#

and check if user has too many messages in the db

earnest phoenix
#

Or, skip the DB completely

#

I'm not sure what language this is

quartz kindle
#

yeah you can do auto expire with setTimeout

earnest phoenix
#

Are they even using JavaScript?

quartz kindle
#

no idea

earnest phoenix
#

.

#

I'm using Discord.js

#

I'd like to store several things somewhere, like prefixes

amber pivot
#

Hello

amber junco
#

What are embeds?

midnight widget
earnest phoenix
#

embeds are the nice messages in the box

ruby dust
#

in d.py, does member_count return an int or a string?

slender thistle
#

An int

ruby dust
#

idk why I said string

#

I meant a list of member objects

slender thistle
#

.members - list
.member_count - int

ruby dust
#

k

slender thistle
#

:wesmart:

mild lily
#

can someone do like a database 101

inner jewel
#

databases store data

zealous veldt
#

they do? blobhmmm