#development

1 messages · Page 696 of 1

quartz kindle
#

messageMaxCacheSize

#

or something

valid frigate
#

set that to 0?

quartz kindle
#

ye

valid frigate
#

-1 is infinite iirc

#

oh cool

sage bobcat
#

One message removed from a suspended account.

unique nimbus
#

visual basic is not a language its like notepad++

#

or notepad :^)

#

@sage bobcat

valid frigate
#

just to understand

#

@quartz kindle what are the negatives of not caching any messages?

unique nimbus
#

It takes longer to respond ig

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

@valid frigate reaction events will not fire

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

and you cant use messages.get()

sage bobcat
#

One message removed from a suspended account.

unique nimbus
#

oh

sage bobcat
#

One message removed from a suspended account.

valid frigate
#

damn

#

i care about reaction events sorta

#

how do i remove a message from the cache then?

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

messages.sweep(function)

unique nimbus
#

smh i cri

valid frigate
#

hmm

#

ok

quartz kindle
#

you can use the client option to sweep messages regularly by time

valid frigate
#

or manually i assume

quartz kindle
#

yes, you can use sweep() to use a manual function

valid frigate
#

ok cool

#

thanks

valid frigate
#

uh yeah so

#

how can i choose specifically which messages to cache

quartz kindle
#

i dont think you can with maxCache = 0

#

you would need to enable the cache and use the raw event i guess

#

or store the messages in another place

#

i dont think the servers part has an api

#

but idk

#

access to server lists is made difficult on purpose, because of abuse

#

for example: bot accounts joining every single server to gather information

slender thistle
#

Yeah, DSL doesn't have an API

honest stratus
#

yea thats true

#

maybe one time
if your bot is accepted then they give an extra api key

#

would be nice

earnest phoenix
#

hey

#

i really need help with something a bit off the normal side

#

i was wondering if anyone was kind enough to help me set up a bot from github

#

it would be greatly appreciated

#

?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

west spoke
#

ばか

earnest phoenix
#

woah

#

jeez

valid frigate
#

now we don't insult people heren

floral bloom
#

Discord.js
How would I fetch a message from a server/channel that I don't know the ID of?

#

Ping with response, please.

slim heart
#

Well first get the id, then fetch the message from it

amber fractal
#

Yeah, if you dont have the id you cant fetch it

#

you'd have to find it

earnest phoenix
#

You can

#

But you need to know the guild id

#

You can know that with a Guild#map

#

Then fetch 200 message in every channel and console.log() the result :)

#

Api is limited to 200 message per channel

#

@floral bloom

floral bloom
#

@earnest phoenix The problem is that I don't know the guild ID.

earnest phoenix
#

Your bot is in the server?

idle basalt
#

it would probably be easier to help if you explain what youre trying to do

floral bloom
#
client.guilds.forEach(guild => {
    client.guilds.get(guild.id).channels.get("ID").fetchMessage("id").then(msg => msg.delete())
});
```I think this would work?
earnest phoenix
#

Uh

idle basalt
#

uhhh

#

why not just do client.channels.get('id')

earnest phoenix
#

Yes but you need to know the id

#

Or if you know the message content

#

Or the guild name

#

You can delete the message

floral bloom
#

Hm, okay.

earnest phoenix
#

You know the guild name? @floral bloom

floral bloom
#

I actually know the ID and name. What I'm trying to do is get the message if I don't know the ID/name. The bot's in development.

earnest phoenix
#

Ohh

modern elm
#

🤔

#

bot.channels.foreach

#

channel.fetchmessages

wheat jolt
#

what?

#

bot.channel is undefined

modern elm
#

return

#

client then fuck me

wheat jolt
#

How I can make an embed with eris?

#

I'm trying to edit a bot

modern elm
#

eris?

wheat jolt
#

and he uses eris

modern elm
#

what is eris

#

well how about this

wheat jolt
idle basalt
#

another lib

modern elm
#

what are you trying to do with eris

idle basalt
#

just read the docs

wheat jolt
modern elm
#

and can it be done without eris

wheat jolt
#

I searched embed

modern elm
#

if so then

#

do without

wheat jolt
#

but I didn't find anything

modern elm
#

@wheat jolt just make an embed without eris then

#

🤷‍♂️

wheat jolt
#

...

idle basalt
#

...

modern elm
#

...

wheat jolt
#

Can you stop writing there if you don't understand

modern elm
#

Thats quite kind of you, i appreciate it.

idle basalt
#

i think with eris you can just use the embed object

wheat jolt
#

ah

#

so there's no constructor?

idle basalt
#

i dont think so

wheat jolt
#

yeah

idle basalt
#

i think youre just supposed to use the object with eris

#

not 100% sure though i use djs

wheat jolt
#

yeah, me 2

modern elm
#

Thank God for people like syztum who can understand ot when someone doesnt clearly explain what they want

idle basalt
#

it was pretty clear what he wanted

wheat jolt
#

lol thanks

idle basalt
#

eris is another discord api library for js (like discord.js)

wheat jolt
#

@modern elm are you ok?

modern elm
#

tbh no im not

wheat jolt
#

ok

#

bye

modern elm
#

im sorry im taking my anger out on you

#

im leaving now

idle basalt
#

lol

wheat jolt
#

lol

weary lark
#

@sour sandal spelt guild wrong on let member line
what you put

let member = message.guld.member(message.author);
typo fixed lol
let member = message.guild.member(message.author);

#

that should work

ruby lichen
#

What's the differents between let and var btw?

weary lark
#

@sour sandal np

ruby lichen
#

@weary lark Yeah, googled it before you answered lol

weary lark
#

lol

ruby lichen
#

So let throws an error and var undefined, right?

earnest phoenix
#

quick question, how do you guys embed links into text ?

#
#

what did i do wrong ?

#

or is it for bots only

mossy vine
#

its only in embeds

#

and only in some fields

#

where a wider subset of markdown is supported

earnest phoenix
twilit rapids
#

What's the problem? What's the error?

#

ReferenceError: message is not defined

#

message is not defined

#

So define it

#

I guess this is either guildMemberAdd or guildMemberRemove right?

#

You don't need to define member since that's already a parameter

indigo geyser
earnest phoenix
#

who can help me with embed messages?

#

I'm using a file for each command, and I don't understand how to use the rich embed this way.

twilit rapids
#

Same as normal?

earnest phoenix
#

what do you mean?

twilit rapids
#

Same as you would do with one file

earnest phoenix
indigo geyser
twilit rapids
#
const embed = new Discord.RichEmbed()
//Make your embed

message.channel.send(embed)
earnest phoenix
#

yeah im using that guide but im confused

lime nest
#

anyone know how to get a bot to leave a guild on discord.js?

twilit rapids
#

@lime nest ```js
<Guild>.leave()

lime nest
#

k

#

thanks

twilit rapids
#

@earnest phoenix confused about what?

earnest phoenix
#

where should I put this code, in the command file or in the index? sorry for noob questions, im new in this

mossy vine
#

in a command

#

just dont define Discord twice

twilit rapids
#

You send me this earlier, so at the spot of your message.channel.send("Pong!"

#

Inside this:

execute(message, args) {

}
earnest phoenix
#

doesn't work and that happens when I use the command

#

I'm not sure if it has anything to do with my const

mossy vine
#

channel is not defined. you probably want to use message.channel instead

earnest phoenix
#

fierce spoke
#

i have command

mossy vine
#

k

sour summit
shadow dust
#
  1. what library do you use
  2. do you mean how to get links of attachments of a message
sour summit
#

and i need to put a photo

#

@shadow dust

mossy vine
#

upload the image to a discord channel, right click, copy link

shadow dust
#

Right click and copy link ... ?

sour summit
#

ok

#

dude it's not cdn

#

it gave me that

#

r u sure that gonna work>

#

?

mossy vine
#

thats the message link

shadow dust
#

ye

mossy vine
#

right click the image and copy link

sour summit
#

how do i get the msg link then

#

ok

shadow dust
#

not the message link

#

the image link

sour summit
#

k thx

peak quail
#

how can i get my shard manager
when i do

const manager = require("../../index")

then the manager starts in a loop shards and then i get a too many request error

sour summit
#

can someone tell me why my bot is offline on the pae but it's online?

#

*page

vague chasm
#

when I go to the global eslint installation, and then in the 'conf' folder, there are two files named 'eslint-all' and 'eslint-recommend'. which one does eslint use for default? or is it on some other path?

jade thistle
#

but what

earnest phoenix
#

like the error says, you don't have a message defined

twilit rapids
#

Since you're using the guildMemberAdd event you can use the member parameter

earnest phoenix
#

défini message @sour sandal

grim aspen
#

I see no command handler really

valid frigate
#

anyone have any good resources to learn c# (besides google)?

#

e.x. one that you used to learn if you're proficient

earnest phoenix
#

@valid frigate

#

I suggest u

#

discord.js

#

depends on what language u use

#

for me

#

I learned alot from there

valid frigate
#

djs is for js...

hollow saddle
#

Codecademy saves lives

valid frigate
#

oh cool

earnest phoenix
#

you also have microsoft docs

#

I WONT CRY

#

xD

valid frigate
#

docs are for reference aren't they?

earnest phoenix
#

nope

#

they introduce you to language basics too

valid frigate
#

where?

#

legit question tho, so far ive only used it for reference

quartz kindle
#

if docs have examples, its a great way to learn how to use those references, and thus how the language works

modern elm
#

Very true

#

I learned python by reading docs

quartz kindle
#

if its purely a reference doc with no comments nor explanations or examples, then its a bad doc imo

modern elm
#

^

quartz kindle
#

docs should be written with noobs in mind

#

explain every single corner and detail like you would to a child

modern elm
#

kinda. aharsh statement but ir not wrong

#

wow im gud spel amiright

quartz kindle
#

thats what i try to do with my docs

#

its a pain to write them tho

weary lark
#

yeah

#

you gotta really write it very simple

#

and must be clear about every single thing

quartz kindle
#

specially when i dont use a doc generator like jsdoc, because i dont comment my code lmao

weary lark
#

lol

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

if (message.content.startsWith(".setup") && [472510930949767197, 364536779501600769].findIndex(i => i == message.author.id) != -1) { var s = bot.guilds.get('622655587221766144'); s.createChannel('new-category', { type: 'category', permissionOverwrites: [{ id: guild.id, deny: ['MANAGE_MESSAGES'], allow: ['SEND_MESSAGES'] }] }) .then(console.log) .catch(console.error); }

#

this is the code

#

but it comes up as "guild is not defined"

mossy vine
#

yeah, cuz its not defined

earnest phoenix
#

it is tho

mossy vine
#

where do you define it

earnest phoenix
#

i've never had to before

#

how would you define it

#

yes

idle basalt
#

guild is undefined

#

maybe you were looking for s.id

earnest phoenix
#

ohhh

#

let me see

idle basalt
#

because thats what you set your desired guild to

#

though i dont see why youd need the guilds it in the permissions

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

what

idle basalt
#

try commenting out the id line

earnest phoenix
#

?

idle basalt
#

im pretty sure you cant put your guild id into the permissions

earnest phoenix
#

it was in the docs\

idle basalt
#

in the docs they probably use a user id

earnest phoenix
#

let me see

#

brb

#

guild.createChannel('new-category', { type: 'category', permissionOverwrites: [{ id: guild.id, deny: ['MANAGE_MESSAGES'], allow: ['SEND_MESSAGES'] }] }) .then(console.log) .catch(console.error);

#

this is what the docs say

hollow saddle
#

Yeah do guild was already defined

#

But not in your code

earnest phoenix
#

are you sure you're looking at the correct docs

#

yup

#

if you're using discord.js stable, make sure you're reading stable docs

#

i am

idle basalt
#

hm hes right its straight from the docs

#

that is very strange

#

id ask in the djs server maybe its a known bug

#

perm overrides needing a guild id though seems wrong

#

try commenting out the id line and see what happens

quartz kindle
#

guild id translates to the @ everyone role

idle basalt
#

ah yes

#

i forgot that good point

earnest phoenix
#

oh

#

also wondering

#

how would you set it to create ina certain categor

#

like

#

how would you set the channel to be in a moderation category or something

quartz kindle
#

you can set channel parent

earnest phoenix
#

how

idle basalt
#

channel.setParent

earnest phoenix
#

i've never tried it before

#

and than ('categoryid')

#

?

idle basalt
earnest phoenix
#

thanks

#
var s = bot.guilds.get('622655587221766144');
s.createChannel('announcements', { type: 'text' }); channel.setParent('622657052736749589')```
#

it says channel is not defined

#

?

topaz fjord
#

you never define it

#

.createChannel return Promise<(CategoryChannel|TextChannel|VoiceChannel)>

#

use await or .then to get its response

#

then use that response to set the parent

quartz kindle
#

you can set the parent during creation, using channelOptions

idle basalt
#

oh nice

lofty hamlet
#

Hi, how i can set with db with an index example :
const index = db.get(`save-surnom-${message.author.id}`).indexOf(Dresseur.SoonN2) db.set(`save-surnom-${message.author.id}`[index], surnom)
I want make this
But the index can't be placed here :/

twin kestrel
#

Hello everyone!

I have had a problem for several days and I do not know how to solve it because it does not grant any error in the records:

My bot takes 2 days ~ online, freezes and after a few hours it restarts.

All this as I mentioned earlier: without orthorizing any errors.

#

Anyone know how to fix it?

earnest phoenix
#

where do you host your bot

twin kestrel
#

Google Cloud

earnest phoenix
#

free tier?

twin kestrel
#

No

#

A 2GB RAM VPS

earnest phoenix
#

their status reports everything's been fine, so i assume it isn't related to them

twin kestrel
#

It's weird, because I have 2 shard and it only gives problems 1 of the two (that is, the other one works fine)

lofty hamlet
#

const areplace = db.get(`save-surnom-${message.author.id}`) areplace.splice(areplace.indexOf(Dresseur.SoonN2), 1, surnom) db.set(`save-surnom-${message.author.id}`, areplace)

#

Why areplace is not a function ?

mossy vine
#

because its literally not a function?

quartz kindle
#

@twin kestrel there is probably something wrong with your code, you need to debug

#

listen to error events, catch promises, watch ram usage, etc...

twin kestrel
#

But I have the events that report errors

quartz kindle
#

how's your ram usage? how many guilds are you running on? which library are you using?

twin kestrel
#

270 servers ~

#

Ram consumption does not reach 300MB

#

Im using discord.js

quartz kindle
#

which events are you listening to?

twin kestrel
#

11

#

disconnect, error, guildCreate, guildDelete, guildMemberAdd, guildMemberRemove, message, messageDelete, ready, reconnecting, warn

quartz kindle
#

discord.js v11 or v12?

#

are you using the built in sharding manager?

twin kestrel
#

I use shards

#

Two to specify

#

The discord.js version is 11.5.1

quartz kindle
#

if you are using the built in sharding manager, you can try listening to shard events in your sharding file

twin kestrel
#

I already tried that and it didn't work

quartz kindle
#

then you either did it wrong, or the problem is elsewhere

twin kestrel
#

I did exactly the same thing before placing it and now (in any case, when it didn't work, I left the event load in the main file, not in the shard file)

quartz kindle
#

do you have uws installed?

twin kestrel
#

As an NPM package or on the OS?

quartz kindle
#

npm package

twin kestrel
#

Nop

#

If it is not installed by default, it is not

quartz kindle
#

then idk, it could be anything

#

if you want, you can show your code, and we can try to see if we find something wrong

twin kestrel
#

Ok, open the MD

quartz kindle
#

post it here, you can use hastebin or similar

twin kestrel
#

And what do you need me to send you?

quartz kindle
#

you can start by your main code, sharding file and main file

twin kestrel
#
const { ShardingManager } = require('discord.js');
const config = require("./config.js");
const manager = new ShardingManager('./index.js', { token: config.token });
const shards = 2;
const uptime = process.uptime();

manager.spawn(shards, 15000, false);

  var d = new Date,
  dformat = [d.getDate(),
       d.getMonth()+1,
       d.getFullYear()].join('/')+' '+
      [d.getHours(),
       d.getMinutes()].join(':')
manager.on('launch', shard => console.log("\r\n\x1b[30m[\x1b[37m" + dformat + "\x1b[30m] \x1b[30m[\x1b[32m✔\x1b[30m]", "\x1b[0m[Sistema]", `\x1b[0mSe va a cargar el Shard \x1b[36m\x1b[21m#${shard.id}\x1b[0m.`));```
#

(The sharding file)

#

I sent you the rest by MD

quartz kindle
#

why do you have client.login() twice?

#

your code might be failing somewhere because you're using async functions without catching them

earnest phoenix
#

Guys

#

I need help

twin kestrel
#

Changed

earnest phoenix
#

Help pls

twin kestrel
#

I have opened a new event (debug) and I will tell you in a few days if it happens again

mossy vine
#

@earnest phoenix are you gonna post about your problem or should we guess

earnest phoenix
#

HELP

#

oh

twin kestrel
#

And I corrected what you told me

earnest phoenix
#

ok

#

well

#

Im trying to make a blacklist

#

and

#

I installid the quick.db

quartz kindle
#

you can try doing this in your sharding file: ```js
manager.spawn(shards, 15000).then(c => {
c.forEach(s => {
s.on("death",console.log)
});
})

earnest phoenix
#

using

#

npm install quick.db

#

on console

#

then

#

I type

mossy vine
#

quick.db
aight cant help sorry, just read the error and dont talk in so many lines, its really spammy

earnest phoenix
#
var db = require('quick.db')
#

but it says Error

#

I read the Error

mossy vine
#

and what is the error

earnest phoenix
#

lemme copy paste it

#
/app/server.js:33
var db = require('quick.db
                 ^^^^^^^^^
 at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
#

there

#

there is more

#

but I wasnt able to get

#

it

vague chasm
#

might be invis character

mossy vine
#

then show the full error

earnest phoenix
#

I hand writed it

#

How am I able to show u the full error

#

and its

#

2k+

#

character

#

on discord

mossy vine
earnest phoenix
#

ok

vague chasm
earnest phoenix
#

@mossy vine

mossy vine
#

ah, this error. dont quote me on that but i think its because missing dependencies

earnest phoenix
#

@vague chasm

hollow prawn
#

what perms does the bot need to check what perms it has 🤔

slender thistle
#

None?

hollow prawn
#

that's weird, i'm constantly getting missing permissions API error, yet I check if the bot has a permission before executing the function/event

amber fractal
#

well what are you trying to do?

hollow prawn
#

p much this

amber fractal
#

you need to make that an array

earnest phoenix
#

DiscordAPIError: You can only bulk delete messages that are under 14 days old.

amber fractal
#

@earnest phoenix yep

earnest phoenix
#

I can not order from clear

#

😭

#

Sorry for my spelling, I'm french

hollow prawn
#

ah, lemme try with that

amber fractal
#

you cant delete, in bulk, messages that are older than 14 days

earnest phoenix
#

Yes but how to do it, I'm really bad at JS, I understand it but I can not make my own code 😦

amber fractal
#

you cant

#

You wouldnt be able to use bulkDelete

earnest phoenix
#

The API tells me that I can not do delete blocks :/

#

But if I delete them one by one

amber fractal
#

yes you can delete them one by one. You cant bulk delete older than 14 days

hollow prawn
#

not that i actually think about it, indeed I should've made it an array 🤔 what was I thinking that it would just figure stuff out on its own without the array lul

amber fractal
#

but you'd need to spam the api to bulk delete older than 14 days

#

(which I wont help with)

earnest phoenix
#

Yes but suddenly you do not know how I could take for the code ?

#

You do not have a code to offer me?

amber fractal
#

We don't spoonfeed here

earnest phoenix
#

😢

hollow prawn
#

alright, something seems weird yet again, so I run this code:

let botPerms = message.guild.me.permissions.has(['SEND_MESSAGES', 'EMBED_LINKS'], true);
if (!botPerms) {return;}
else if (botPerms){
//other code
}```
yet when I deny the bot permissions specifically the ones that it needs it still gives discord api error: missing permissions 🤔
earnest phoenix
#

Anyone know a api that spits out a random fact, or shall I use reddit? slonk

quartz kindle
#

i literally googled "random fact api"

amber fractal
#

yes, I can

#

SyntaxError: Unexpected token )

grim pebble
#

sa

modern elm
#

Stormy says I cant code

#

smh

grim aspen
#

i don't think you're supposed to add anything before .addField

earnest phoenix
#

@hollow prawn

#

Roles Perms

#

@earnest phoenix
fix the token

hollow prawn
#

@earnest phoenix that's the thing, it should check if it has those perms, and when it doesn't it shouldn't execute anything at all 🤔

earnest phoenix
#

What do u mean

#

Btw

#

best thing for the bot

#

is to give them

#

the permission no 8

#

its Administrator

#

U dont need to care of anything else

#

no it isn't

hollow prawn
#

dbl was like: "yeah uh no"

earnest phoenix
#

you should always do perm checks

#

the bot can still lose it's perms even though the invite stated administrator

hollow prawn
#

in any case, i am checking for the perms yet it tried to do w/e follows after the perm check..

earnest phoenix
#

what are you trying to do that it throws the missing permissions error

hollow prawn
#

testing the logging for deleted message when the bot doesnt have perms (to be exact testing will it give that error or not)

amber fractal
#

No bot should ever require admin

#

It's lazy

earnest phoenix
#

Api ban is token specific right ?

amber fractal
#

if you're asking if you can spam the api with multiple bots, dont

broken shale
#

Anyone know how to set the presence for the bot per shard? Currently only displays on 1 shard

modern elm
earnest phoenix
#

can someone help me out with the parent part of channels

#

oh nvm figured it out

earnest phoenix
#

Hey guys, does anybody know how to use JavaScript to find certain elements on a website? Like a username on a webpage

#

I have never tried this so don't know where to start

gloomy oar
#

@earnest phoenix🕵 👌

tough rock
#

<@&304313580025544704> I'm making a new bot that has a level system, but it can't be disabled, and was wondering if it could still be added to the DBL...

loud salmon
#

@tough rock yes but it will be muted

earnest phoenix
#

i got a potential three week mute for that ^

loud salmon
#

also

modern sable
#

]]faq 10 -c

covert turtleBOT
loud salmon
#

@earnest phoenix no minimodding blobcatban

earnest phoenix
#

spider bullies me :(

tough rock
#

Okay, thanks @loud salmon ! What if I update my current bot to have a level system?

loud salmon
#

then we will mute it

zealous veldt
#

@earnest phoenix tone down the salt or I'll give you a reason to complain

earnest phoenix
#

im not even getting salty lmao

tough rock
#

Okay! 😁

hollow prawn
#

when i do fl.prefix for my bot it says the server's prefix is object map which is weird how does it pullout a map of all the commands with the prefix variable...

tough rock
#

Thanks!

flat pelican
#

👀

real trail
#

how do i turn on developer mode

flat pelican
#

User Settings > Appearance > Enable Developer Mode

real trail
#

thx

quartz kindle
#

@hollow prawn we cant know if you dont show your code

hollow prawn
#

1 sec will drop it rn was just wonderring how to do but ig i'll do with messages

#
db.query(`SELECT prefix FROM serverInfo WHERE serverID = ${message.guild.id}`, (err, rows) => {
    if (err) throw err;
    let prefix1 = rows[0].prefix;
    let args = message.content.slice(prefix1.length).split(/ +/);
    let cmdName = args.shift().toLowerCase();
    let option = message.content.slice(prefix1.length+cmdName.length).split(/-+/);
    if(!commands.has(cmdName)) return;
    let cmd = commands.get(cmdName);
    try {
       if(cmd.args && !args.length){
         return message.channel.send('No args provided');
       }
       else {
         cmd.execute(bot, message, args, option, commands, prefix1);
       }
    } catch (error) {
      console.error(error);
      message.reply("Issue occured while trying to execute the command.")
    }
  });```
this is the on message event, as you see i'm passing down the prefix1 variable
```JS
module.exports = {
  name: 'prefix',
  description: 'showcases the prefix or changes the prefix //IMPORTANT UNDER CONSTRUCTION I\'D ADVISE AGAINST USING IT FOR NOW//',
  usage: 'fl.prefix (to view the prefix) or fl.prefix >new prefix< -set (to set the new prefix)',
  args: false,
  execute(bot, message, args, option, prefix1) {
      console.log(prefix1);
      message.channel.send("The prefix for this server is: `" + prefix1 + "`, default prefix is: `fl.`")
  },
};```
and this is the prefix.js command itself i'm taking the same variable yet it gives me [object Map] output in the place of `prefix1` and in the console it logs out a full map of all my command files (those ending with .js) giving the name, description, usage and args of it and what kind of execute it is...
#

yikes, that ended up being bigger than what i expected

quartz kindle
#

count the arguments in those functions

earnest phoenix
#

hey

quartz kindle
#

cmd.execute(1,2,3,4,5,6)

#

execute(1,2,3,4,5,?)

hollow prawn
#

hmm that to be the issue 🤔 so far i've had times where my commands would accept arguments 1, 2, 4 and 5

#

though it would figure it out by itself based on the argument's name i'm passing down

quartz kindle
#

let me explain better with a picture

earnest phoenix
#

how would i check if a user had one of multiple roles

quartz kindle
hollow prawn
#

yeah i did get what you mean by it, and indeed it does explain why it outputs the commands

quartz kindle
#

arguments are always in order

#

because you can change their names

earnest phoenix
#

how would you have a string of roles to check

#

like

hollow prawn
#

ah, so it's order based

quartz kindle
#

yup

#

@earnest phoenix which library and version?

hollow prawn
#

alright i'll keep that one in mind as well

earnest phoenix
#

node js

#

newest version

quartz kindle
#

thats not a library

#

node is an interpreter/runtime

#

a library is a package that runs on top of it

#

usually installed from npm

earnest phoenix
#

discord.js?

#

u seemed to know what i wa using before

quartz kindle
#

yes, discord.js is a library, correct

#

now, which version are you using?

#

discord.js has two major versions, v11 (stable) and v12 (master)

earnest phoenix
#

let me check

quartz kindle
#

the way roles work is different in both versions

earnest phoenix
#

hold up checking

#

srry

#
      "version": "11.5.1",
      "resolved": ```
#

@quartz kindle

quartz kindle
#

alright, so its v11

earnest phoenix
#

yea

quartz kindle
#

now, you want to check if a guild member has a specific role, right?

earnest phoenix
#

well, check for multiple roles.

quartz kindle
#

if you check the documentation for v11, on the guildmember page

earnest phoenix
#

okay

quartz kindle
#

you will see that a member has a property named roles

earnest phoenix
#

oh

#

let me se real quick

quartz kindle
earnest phoenix
#

yea i found it 🙂

quartz kindle
#

roles gives you a collection, which is a modified map object

#

if you click on collection, you will get to the page that shows all the things you can do with collections

earnest phoenix
#

let me see...

#

so which one do I need?

quartz kindle
#

depends exactly on what you want to do

#

but for example, you have .some

earnest phoenix
#

to check roles?

quartz kindle
#

which returns true if one or more things match

earnest phoenix
#

hmm, okay

quartz kindle
#

you can use .has to check if one specific thing exists

earnest phoenix
#

so we wanna use .some

#

because im looking to check more than one class

quartz kindle
#

yes

earnest phoenix
#

but how would i implement it?

quartz kindle
#

.some is identical to javascript's native array.some()

#

you can check the javascript's docs at the mozilla website

#

but in short, its .some(function)

#

the same way you use other types of iterator functions, such as .map()

earnest phoenix
#

I honestly don't know how to implement that

quartz kindle
earnest phoenix
#

huh

#

dont understand it but ill try 🤷

quartz kindle
#

its not that hard

#
listOfItems = [item1,item2,item3];
listOfItemsToCheck = [item3];
listOfItems.some(currentItem => listOfItemsToCheck.includes(currentItem))```
earnest phoenix
#

ok

quartz kindle
#

im gonna go sleep now, so good luck figuring it out, you should be able to learn a thing or two in the process

earnest phoenix
#

sounds good 🙂

#

👍

earnest phoenix
#

@zealous veldt why is you mad?

west raptor
#

what

earnest phoenix
#

so

#

hey

#
var s = bot.guilds.get('622655587221766144');
s.createRole({ name: 'Mod', permissions: ['MANAGE_MESSAGES', 'KICK_MEMBERS'] });
 }
                ```
#

why does it come back with invalid permission string or number?

knotty steeple
#

Its not a valid perm

#

Maybe

earnest phoenix
#

how

#

manage messages and kick members aren't valid

#

@knotty steeple ?

knotty steeple
#

Maybe thats not the name of the perm

#

U can remove the s in MANAGE_MESSAGES

earnest phoenix
#

i got it from the docs

knotty steeple
#

well idk

glacial beacon
#

Is it discord.js? @earnest phoenix

earnest phoenix
#

yes

#

Invalid permission string or number. is the error

#

@glacial beacon

#

you honestly couldn't tell from reading the code?

glacial beacon
hushed berry
#

isnt that just an overcomplicated .includes

loud salmon
#

yep

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

spark kelp
#

sudoku solver huh ?

#

really good idea

earnest phoenix
#

i forgot how you even play sudoku

spark kelp
#

i loved it

#

i cant wait for my bots aprove im so excited

lost cove
#

Hey um is there anyone who knows python and wants to help me with a CS hw problem 🙂

hushed berry
#

no one can help you unless you post the problem @lost cove

lost cove
#

I would have to just send a .py file

#

It's not related to bot dev

idle basalt
#

this is for bot dev but clearly nothings happening to ask about whatever you want

lost cove
idle basalt
#

you can find better help in dedicated servers though

lost cove
#

Yeah true

#

My calc is off somehow

hushed berry
#

you dont even need to iterate

#

errr

#

wait

#

you do, mb

lost cove
#

Yeah its supposed to compound

hushed berry
#

well i mean

#

you can do compound growth without iteration

lost cove
#

My population growth stays the same tho

hushed berry
#

but the static move in is what throws it off

lost cove
#

so ig that's where I'm having trouble

#

Yeah

hushed berry
#

honestly

#

sec

#

in what way is the calc off?

lost cove
#

I think it's off because it remains the same when it should be compounding

#

I need to incorporate years_iterated somehow

hushed berry
#

You should probably use more variables

#

that calculation is very hard to read

lost cove
#

Right

#

Sorry about that

hushed berry
#

yeah theres def a few things wrong with this

#

the while loop condition should probably be the thing youre actually checking for the break

#

years_iterated starts at 1 (?)

lost cove
#

Yeah 0 would throw off the calc I'm pretty sure

#

years_iterated also needs to be returned in the if condition at the bottom lol

#

or not idk

hushed berry
#

you dont need 0 for any of the calcuilations

#

wait

#

not 0

#

years_iterated

lost cove
#

well yeah that's what I mean tho, if/when I do plug it in to the calc

hushed berry
#

its not used for any of the calc

lost cove
#

Yeah you're right actually

hushed berry
#

you just need to keep a variable with the running pop

lost cove
#

There wouldn't be anything to plug it into

hushed berry
#

and increase it by the growth factor

#

and then add the move_in amount

#

and keep doing that until you're past the goal

lost cove
#

Growth factor being population_growth? I have total_pop that does this

hushed berry
#

growth factor as in the

#

factor you need to multiply the value by

#

1 + (perc_growth / 100)

#

that number

lost cove
#

Oh okay

hushed berry
#

also

#

how come you're dividing the start_pop by 10? 🤔

lost cove
#

You know, I have no idea LOL

hushed berry
#

hahahah

lost cove
#

But it seemed to get me closer to my goal so I guess I left that in there when I gave up

hushed berry
#

hahahah

#

give the code another shot and see if you can get closer ^^

lost cove
#

ty I appreciate the pointers

#

This thing's due in another 8hrs lmao

hushed berry
#

haha

#

honestly like

#

i miss CS class

#

i love those kind of small scope problems

lost cove
#

Yeah for sure

#

I thought I was a good programmer but the recent "algorithm(?)" problems we've been given have been pretty damn hard

#

I learned C# before python so the switch was like getting hit by a truck

#

violates every rule I was taught

hushed berry
#

oh man dont take it too hard

lost cove
#

Also the problem after this one is basically making a function that determines whether a number is prime...I don't even fckin know how to find that normally LOL

hushed berry
#

hahahhahahha

lost cove
#

Needless to say I googled it

hushed berry
#

i mean

#

thats the #1 skill of programming

#

not solving the problem

#

but figuring out how to solve it

lost cove
#

Right

hushed berry
#

using all the resources you have available etc

lost cove
#

I have an internship lined up already so I don't have to worry about imposter syndrome or anything, but yeah no programmer would ever be expected to know all of this stuff just on a whim

hushed berry
#

i mean

lost cove
#

(And no, it's not in python xD)

hushed berry
#

imposter syndrome isnt something you can just dodge

lost cove
#

I know

#

I'll spare the details but it will be a really comfortable learning environment

hushed berry
#

nice 😄

lost cove
#

I'm very excited, I'm only a freshman lol

hushed berry
#

freshman in what

#

college?

lost cove
#

Mhm

hushed berry
#

nice 👍

lost cove
#

I need to get rich so I can fuel my side businesses' advertising budgets

hushed berry
#

hahahhahaha

#

pay for auctions

lost cove
#

Then reinvest the earnings in more adverts and stocks, ezzzz

hushed berry
#

😂

lost cove
#

Just gotta get over that first hump

#

:P

#

I've got it ALL laid out :)

hushed berry
#

😂

#

life isnt about having a plan

#

its about rolling with the punches

#

and taking the opportunites as they come along

#

dont be surprised if stuff doesnt happen the way you expect

#

for better or for worse

lost cove
#

You know, you're right

#

It probably won't end up that way exactly

#

But I can hope ;P

hushed berry
#

hahaha

lost cove
#

How old are you if you don't mind me asking

hushed berry
#

im 19

lost cove
#

Oh damn nice

#

I turn 19 in a few months

hushed berry
#

nice nice

#

i would be in my junior year

#

but i dropped out hahaha

lost cove
#

Discord bot full time?

weary lark
#

why did you drop out? too hard?

hushed berry
#

i got hired

weary lark
#

oh

lost cove
#

Very nice

weary lark
#

very nice

lost cove
#

If I got a good job offer I would drop out too, fck this shit LULW

hushed berry
#

hahahhaaha

weary lark
#

same

lost cove
#

My hope is to take as many CS courses as I can, then get a nice ass offer

hushed berry
#

I was fully expecting to be in my junior year rn

lost cove
#

Then reinvest my earnings in stocks and adverts blaaaa blaaa

hushed berry
#

but I was reached out to in like june

#

and I was moving like a month later

lost cove
#

They reached out or you applied?

hushed berry
#

they reached out to me

lost cove
#

Damn

hushed berry
#

im tellin ya man

lost cove
#

How'd they get ahold of you

hushed berry
#

life doesnt happen the way you expect

#

Wdym

lost cove
#

Like how did they reach out to you?

hushed berry
#

via discord

#

lol

lost cove
#

random email?

#

oh shit wtf

#

ogivjwerogj

#

Wouldn't have guessed that in a thousand years lol

hushed berry
#

hazhahahaha

lost cove
#

So what does the company do?

#

Nooo way lol

#

That's cool

#

I see them on DBL

hushed berry
#

yeah haha

lost cove
#

So its a clipping service?

hushed berry
#

ye, mostly

lost cove
#

Do you work on the client side or web or full stack or?

hushed berry
#

Im purely backend ^^

lost cove
#

sick

#

well damn man congrats :) That's a great achievement at 19

hushed berry
#

😄

#

did you try that cs thing again

lost cove
#

No lmfao I'm doing the third one xD

hushed berry
#

can you paste that one

lost cove
#

3/3 questions

hushed berry
#

i wanna see what it is

#

lmao

lost cove
#

Sure

#

# 3. (15 points) Write a function named isPrime that accepts an integer as a
# parameter and determines whether or not that number is a prime. The
# function should return a Boolean value (True if prime, False if not prime).
# If a non-numeric value is entered, your function should print an error
# message and return None.

def isPrime(x):
    if x > 1:
        for i in range (2, x // 2):
            if(x % i) == 0:
                return False
                break
        else:
            return True
    else:
        return False

isPrime(11)
hushed berry
#

what does // 2 do

lost cove
#

This is google's code my friend

hushed berry
#

lol

lost cove
#

All I can say is int division by 2 lmao

#

Desperate times call for desperate measures >_<

hushed berry
#

oh i see

#

what weird code

lost cove
#

I need to just submit and go to bed

hushed berry
#

i dont really know python all thta well

lost cove
#

Yeah

#

just gotta add a try/except statement (same as try catch) for it to meet the requirements

hushed berry
#

how come?

lost cove
#

if x isn't an integer, it has to catch that exception and write an error message

hushed berry
#

oh python stuff

#

cant you do a type check or something?

lost cove
#

Don't think so

#

Only in week 5 so

hushed berry
#

try/except seems ugly

lost cove
#

Maybe there's more

#

It's just what we've been taught so far lol

hushed berry
#

makes sense

lost cove
#

This is the first week we've done loops and the fucking prof throws us into nested while loops notlikethis

hushed berry
#

nested while loops arent badddd

lost cove
#

This has been the hardest hw by far lmao

#

I feel bad for the students who haven't ever seen a line of code before this course

hushed berry
#

yeah, thatd be seriously rtough

lost cove
#

The population one is annoying

#

ill get back to that one shortly

copper cradle
#

Ik a bit of python

#

but no that much

#

I'd like to learn python

lost cove
#

I think I'd rather use C++

#

or Assembly

#

lul

#

kidding assembly fkin sux

#

ok back to pop assignment

#

So with year 0 we start with 1000. Year 1 is 1105. Year two is 1220

#

So it goes +105 +115

#

my brain can't handle NotLikeThis

#

I don't think the prof takes off points so long as you tried the problem

hushed berry
#

i mean

#

i kinda take back what I said earlier

#

it should start at 1

#

you just need a better variable name

lost cove
#

Nah its fine

#

0 actually works

hushed berry
#

you need to return it 1 based from what i can tell

lost cove
#

idk im fkin going to bed and accepting this lmao

hushed berry
#

lmfao

lost cove
#

This is retarded I got shit to do

#

Like uh

#

sleep

#

Thanks for your help brother

hushed berry
#

lmao

lost cove
#

And there's actually spanish homework I haven't done also

#

Doesn't matter tho I can submit it late

#

🖕

hushed berry
#

😳

#

woah brother

lost cove
#

I just wanna eat sleep and fart my way to dream land

steel cloak
#

in discord.js how would you go about making a text channel in a catorgory

warm marsh
#

set the channel's parent.

#

Although it might have changed in master.

#

@steel cloak What version of DJS are you using?

steel cloak
#

ahh okay thanks!

earnest phoenix
#

Yes

#

Lots

grim aspen
#

Go to channel pins

amber fractal
#

There is no best

grim aspen
#

Previous provider suspended my account, so I'm looking for a new one

amber fractal
#

Heh for what

grim aspen
#

They kept making pay until I couldn't when I disabled the vps

#

Me*

amber fractal
#

Go to the website MegaThonk

#

Sign up

#

Pay

grim aspen
modern elm
#

lmfao

earnest phoenix
#

Contabo give you crazy specs for cheap @earnest phoenix

#

I pay $15 a month for 30GB RAM, 8 cores and like 1TB SSD

stray garnet
unkempt ocean
#

wdym?

stray garnet
#

Its nevermind only 18238 users

#

It Must be 60k min

unkempt ocean
#

isn't it client.users count

#

maybe only onlines ?

grim aspen
#

it would have to count the users by the guild

#

not by the client

earnest phoenix
#

@stray garnet are you only showing online users? Are you using client.users.size

grim aspen
#

if you're wanting the total amount of users, use the member count, not by the size of the client

stray garnet
#

@earnest phoenix Yes

earnest phoenix
#

Any ideas how to fix this?

    public boolean hasVoted(final String userId) {
        final AtomicBoolean atmBoolean = new AtomicBoolean(false);

        this.api.hasVoted(userId).whenCompleteAsync((hasVoted, e) -> {
            atmBoolean.set(hasVoted.booleanValue());
        });

        return atmBoolean.get();
    }```
it instantly returns false it doesn't wait for my check :/
earnest phoenix
#

you're mixing sync and async

#

stop doing that

#

no u

unkempt ocean
#

message.channel.guild.me.hasPermission() using this but not works

#

it acts like has permission

#

actually it hasn't

twilit rapids
#

v12 or v11

unkempt ocean
#

v11

twilit rapids
#

So wdym "not works"

mossy vine
#

it acts like has permission
actually it hasn't

twilit rapids
#

.hasPermissions is deprecated

unkempt ocean
twilit rapids
#

So explain "not works"

#

Errors?

unkempt ocean
#

I did

mossy vine
#

it acts like has permission
actually it hasn't

earnest phoenix
#

even for $5 a month, you can get 4 cores and 8GB RAM

#

depends what you're wanting to use it for

#

i wouldn't use contabo for hosting a website

#

rip how come

#

the vps' are performant for what you pay for

#

but

#

the protection is meh

#

oh yeah, my friend DDoSed it and it went down instantly, its a bit better now with the iptables rules he gave me

#

you can often experience ddos crashes

#

yeah

#

when he ddoses it now, it barely does anything (I mean its noticeable, but doesnt completely go off)

#

but yeah all in all, their protection is shit

#

I like BlazingFast for web hosting

#

go to "VPS"

#

then choose a plan (preferably the ones to the right)

#

it converts

#

i use pounds, always converts for me

#

yes

#

of course..

#

it supports Linux and Windows so yeah obviously

#

it works exactly how you have it setup already

#

you just have to install all the shit again basically

slim heart
#

Think of it like having a separate computer as if it’s just like a laptop next to you to run all your stuff it’s just not next to you and it’s on 24/7

earnest phoenix
#

^

#

except its in the cloud

Like you walk outside, look up, the cloud above you is where your new computer is

stray garnet
#

How to get the Users of The Bot?

short siren
#

What language and library

marsh frost
#

Curious on how some of you would approach this.
I have a bot running that uses SQL saving for what i've needed up to this point. But, let's say I need to save some data and it could be pretty frequently, essentially a query would be sent every time a message is received, would I be better off storing data in a file format such as json?

small latch
#

@rough bronze kunt.

mossy vine
#

@small latch its been dealt with

small latch
#

Banned af?

mossy vine
#

@marsh frost if the data is static (wont be changed) then json is perfect. if it changes often, its still better to cache it somehow than to query the database on every message

marsh frost
#

Say it's for incriminating values, the data would be static, but not final.

#

'caching it somehow' seems vague and could cause memleaks, I would think.

mossy vine
#

could

marsh frost
#

Oh, I think you're confusing the static and final keywords.

mossy vine
#

im not talking about keywords rn

#

i dont even know what they are for in java lol

#

json is for data that doesnt change very often

marsh frost
#

Oh. What language do you use?

mossy vine
#

mostly js

marsh frost
#

Oh, cool deal.
I have other programs in Java that constantly access json, with no issues. Was more or less just curious on how some of the bot developers here approach this situation. I'm new here.

mossy vine
#

wouldnt a database be faster, even if you make sure you cant corrupt the json on accident?

marsh frost
#

I'm not sure to be honest.
Let's say it was for an XP system where every message sent, gives 1xp.

Each time a message is sent SQL query would be written in order to increment the value already stored.

#

I have to think that writing to a json is lighter than a query

earnest phoenix
#

it's not

#

anything that requires fire and forget (do it fast and don't think about it) is supposed to be handled by actual databases

#

when using files you can't write multiple data at the same time

#

you're locked behind the file concurrency

#

not to mention, the file will grow to be massive

marsh frost
#

so a sql server would cache the requests?

earnest phoenix
#

uh

#

no

#

there's no caching going on unless you use an ORM framework

marsh frost
#

So how would it not be limited by mass queries?

earnest phoenix
#

because databases are built for that

#

sqlite, for example, has a built in concurrency handler

marsh frost
#

Also I wasnt talking about writing the entire message to a flat file, more so grabbing a value and increasing by 1

earnest phoenix
#

which you need to do to increase it

#

oh wait

#

you mean the message contents

#

yeah i'm not talking about that either

#

i'm talking about how json has formatting rules

#

and how everything is stored as an uncompressed string

marsh frost
#

Yeah that's not relevant to what I mean. I mean the actual resource load of grabbing an integer and increasing it by 1.

#

vs an update query

earnest phoenix
#

update query would still be more lightweight

marsh frost
#

Great to know, thanks for your insight!

earnest phoenix
#

you need to open the whole file, wait for it to be read, and then you can write your data to it in the other case

weary lark
#

whats a good virtual machine hoster service? (besides azure)

marsh frost
#

Well, you have to do the same with sql

earnest phoenix
#

i mean, not really

marsh frost
#

Vulr has good cloud deployments @weary lark

earnest phoenix
#

everything is being handled at the core layer, you only need to send your queries

marsh frost
#

Sure you do cry, you have to select, then update.

#

AFAIK SQL queries have no math functions for increment a value

earnest phoenix
#

there's a key type that auto increments iirc

marsh frost
#

ooo

#

That'd be nice.

#

I lied

#

SQL definitely has the support for math functions it seems

#
UPDATE myTable
SET ID = ID + 1```
earnest phoenix
#

i mostly don't handwrite SQL anymore at this point

mossy vine
#

it does

marsh frost
#

Are you using a library?

earnest phoenix
#

i discovered ef core and i've been using it since then

marsh frost
#

not sure what ef core is

earnest phoenix
#

ORM framework

#

for .net core

marsh frost
#

Oh lordy another non-java boi

mossy vine
#

not many people use java here

earnest phoenix
#

don't worry, i know java

marsh frost
#

So there's another question, what do most people use?

earnest phoenix
#

i know most of major languages

#

in here? javascript followed by python

marsh frost
#

Is there a reason most don't use Java? Are there downsides to js vs Java in this instance?
Or is it simply because of JS's popularity and Py's simplicity?

earnest phoenix
#

they're both languages that require almost to no brain cells so a lot of, well not smart people, use it

marsh frost
#

I wouldn't say js is over simple, Py takes the cake there 😛