#development

1 messages · Page 930 of 1

earnest phoenix
#

He used bot

#

And what

quartz kindle
#

🤦‍♂️

earnest phoenix
#

your discordjs version

#

^

quartz kindle
#

if he was using v11, the error would be cant read size of undefined

#

not guilds of undefined

earnest phoenix
#

oh

quartz kindle
#

Lol

earnest phoenix
#

why did you

#

add

#

a full stop

#

in front of bot

#

i installed 14.2.0

quartz kindle
#

he went the PHP way

earnest phoenix
#

even Tim the expert is disgusted

quartz kindle
#

@earnest phoenix you need to do string concatenation

#

do you know what that is?

#

for example

#

if you do js a = "abc" b = "zyx" then you can do a + b to get "abcxyz"

#

similarly, you can also do "abc" + b to get "abcxyz"

#

but you cannot do "abc".b which is what you tried to do

#

also, you put it in the wrong place

pale vessel
#

what is this php?

quartz kindle
#

you have to add it to the "help" not to the watching type

earnest phoenix
#

`${//guild size}` works too

still merlin
#

is > a common prefix

earnest phoenix
#

yes

quartz kindle
#

at this point i believe all single digits are common

still merlin
#

is # a common prefix ;-;

earnest phoenix
#

} is not common pogey

#

yes

pale vessel
#

Æ is not common too

earnest phoenix
#

ẗ̶́͝h̸̋̓i̴͒̽s̴̏̂ is also not a common prefix i reckon

nocturne grove
#

@ would be a nice prefix

earnest phoenix
#

Just use the bots mention tag GWomoDrakeYea

nocturne grove
#

or both 😉

#

🤔

earnest phoenix
#

hello sir, this not offtopic GWossuKannaSip

nocturne grove
#

nice meme channel we got here 😂

mossy vine
#

@earnest phoenix what do you mean

earnest phoenix
#

angeryBOYE you deleted it

midnight blaze
#

I am trying to set up an ev command for a test bot, but I can not figure it out 😦 something doesnt really work, no matter what I try.

#
if(command === "ewv") {
  if(!message.channel.id == "id")return;
  else{
  try {
    if(toEval) {
        const toEval = args.join(" ");
        let evaluated = eval(toEval)
        let embed = new RichEmbed()
        .setTitle("eval")
        .addField("To evaluate:", `\`\`\`js\n${beautify(args.join(" "), { format:"js"})}\n\`\`\``)
        .addField("Evaluated", evaluated)
        .addField("Type of:", typeof(evaluated));
      message.channel.send(embed);
    }
} catch(error) {
      message.channel.send({embed: {
      color: 15158332,
      title: "Evaluation Cancelled",
      description: `${error}`,
      author: {
        name: message.author.username,
        icon_url: message.author.avatarURL
      },
      timestamp: new Date()
    }});
  }
}}

this doesnt work for some reasons.

here what the chat gives me. I tried some stuff, but yeah.

quartz kindle
#

i wouldnt put ` inside each other, even escaped, usually causes headaches

#

just do "```js\n" + beaufity() + "```"

#

you can also get the full stack trace if you use error.stack

midnight blaze
#

ah, thanks! I ll try that

still merlin
#

Would do not disturb be "DO_NOT_DISTURB"

#

in this code:

earnest phoenix
#

check the docs

warm marsh
#

DND

#

or lowercase

pale vessel
#

what's so hard about checking the docs

warm marsh
#

People forget they exist and just ask as they expect everything to be spoonfed.

midnight blaze
#

I found a way to solve that beautify problem, I use prettyJs now

#

but I still can not send messages.

#

hmm

#
  if(command === "ev") {
  if(!message.channel.id == "id")return;
  else{
  try { 

        let toEval = args.join(" ");
        let evaluated = eval(toEval)
        let embed = new Discord.MessageEmbed()
        .setTitle("eval")
        .addField("To evaluate:", `${prettyJs(args.join(" "), { format: "js" })}`)
        .addField("Evalauted", evaluated)
        .addField("Type of:", typeof(evaluated));
      message.channel.send(embed);
    
} catch(error) {
      message.channel.send({embed: {
      color: 15158332,
      title: "Evaluation Cancelled",
      description: `${error}`,
      author: {
        name: message.author.username,
        icon_url: message.author.avatarURL
      },
      timestamp: new Date()
    }});
  }
}}
#

no error

quartz kindle
#

weird

#

can you ?ev toEval?

nocturne grove
#

it won't solve your error, but it says evalauted now

midnight blaze
#

xD

#

yeah

#

@quartz kindle no I can not

#

it says: toEval is not defined

#

when I do that

quartz kindle
#

what if you do ?ev (() => toEval)()

midnight blaze
knotty steeple
#

it does

#

math doesnt need to be defined

#

lmao

earnest phoenix
#

xd

midnight blaze
#

xd

willow wraith
#

How do I make canvas as a gif?

fast trench
#

Code it

quartz kindle
#

canvas does not support gif

dusk saffron
#

Hi guys

fast trench
#

getting the error js (node:24900) UnhandledPromiseRejectionWarning: Error [BAN_RESOLVE_ID]: Couldn't resolve the user ID to ban.
with the code js const memberId = args[0]; const reasons = args.slice(1).join('') client.guilds.cache.forEach(async guild => { await guild.members.ban({ memberId, reason: `${reasons}` }); });

frail ocean
#

Is memberId valid?

fast trench
#

meaning is it a real discord account?

next mica
#

how would i do a latency check command in discord.js v12

quartz kindle
#

websocket or rest?

next mica
#

idk

fast trench
#

meaning is it a real discord account?
@frail ocean cough cough sorry for the ping cough cough

quartz kindle
#

websocket = client.ws.ping

#

for rest you need to compare the time it takes for a request to finish

next mica
#

just trying ot get it to display the latebct

#

idk how

quartz kindle
#

for example ```js
let time = Date.now()
let msg = await message.channel.send("bla");
await msg.edit(time taken: ${Date.now() - time}ms)

next mica
#

ok

#

thanks

#

crashed

quartz kindle
#

see edit

next mica
#

await only valis in a async funtion

quartz kindle
#

then make it an async function

#

client.on("message", async message => {

next mica
#

its chat spaming

#

@quartz kindle

willow wraith
#

How then he did it @fast trench

quartz kindle
#

@next mica well of course, make it a command

next mica
#

i fixed it

quartz kindle
#

@willow wraith using a different library to handle the frames

willow wraith
#

How do I do it then

quartz kindle
#

search for a library that does it

#

there are many

fast trench
#

How then he did it @fast trench
@willow wraith idfk...did I do it? lmao

earnest phoenix
#
async function kickCommand() {
     if (message.content.startsWith('.kick')) {
        // get the first mention
        const member = message.mentions.members.first()

        // check if the command author has permission to kick people
        if (message.member.hasPermission('KICK_MEMBERS')) {
            try {
                // kick him/her!
                const kickedMember = await member.kick()

                // tell the message author that this member was kicked
                message.channel.send(`:wave: ${kickedMember.displayName} has been successfully kicked.`)
            } catch (e) {
                // handle the error
                message.channel.send(`Failed to kick the member due to ${e.message}`)
            }
        } else {
            message.channel.send(`You don't have the permission to kick people.`)
        }
    }
}

doesn't do anything when I do .kick [Insert random person]

next mica
#

how can i make it when some runs a command it detects it eithe as captial or non captial letters

nocturne grove
#

All of a sudden, my (tester) bot doesn't fire all events, what am I doing wrong?

client.on('guildMemberRemove', async (member) => {
            console.log(member.user.tag);
});```
#

ow nvm I see what this idiot did

#

@next mica compare their text with their message.content.toUpperCase(). If that's true, you know they used caps

#

if that's what you mean

next mica
#

like

#

it runs the command Captial or not in the activation words

nocturne grove
#

you mean the PING command only gets executed when they send PING, not ping?

#

like that

frail ocean
#

So you want it to be caps sensitive? If so somewhere you either got toLowerCase() or toUpperCase(), remove that and it should work.

nocturne grove
#

^

next mica
#

i dont have that

nocturne grove
#

then it's already case sensitive

next mica
#

well

#

i want it not to be

#

i want it to work

#

if its both ways

nocturne grove
#

ohhh

next mica
#

so

#

[p]test and [p]Test

#

both work

nocturne grove
#

compare their content toLowerCase() with your command name

frail ocean
#

So if you don't want it to be caps sensitive, do:

var command = message.content.toLowerCase()

And instead of message.content you do command

next mica
#

where do i put the car

#

client.on('message' , function(message){
if(message.content === '[p]test'){
message.author.send('Just testing my personal message ability');
}
});

fast trench
#

in a garage

next mica
#

var

frail ocean
#

Inbetween the client.on and if.

next mica
#

then it would detect both ways

frail ocean
#

Then it wouldn'tmatter if you did:

[p]test
[p]TesT
[p]TEST
[p]tEsT

next mica
#

so do i do message.command

frail ocean
#

Anything like that it'd be fine.

halcyon ember
#

so say I have a reward, which is 1. I have 5 users, each with 10, 20, 25, 5, and 40 respectively. How do I convert it into a percentage of global values and split that 1 reward?

frail ocean
#

No, you'd replace message.content in the if statement with command.

next mica
#

ok im testing now

#

thank you

lyric mountain
#

@halcyon ember rule of 3

#

If 1 is 100%, how much is 10%

#

Repeat for each value

earnest phoenix
#
let info = new Discord.MessageEmbed()
        .setColor('363940') 
        .setDescription('**PAPER STATS**')
        .addField('📂 Total Servers', `**${bot.guilds.size}** guilds`, true)
        .addField('📡 Total Channels', `**${bot.channels.size}** channels.`, true)
        .addField('👥 Total Users', `**${bot.users.size}** other users.`, true)
        .addField('💾 Memory usage', `${Math.round(used * 100) / 100}MB`) 
        .addField('💾 Node', `${process.version}`, true) 
        .addField('💾 Library', 'discord.js', true)
        .addField('💻 Operating System', `${os.platform} ${arch}`, true) 
        .addField('💽 CPU usage', `${cpu_usage}% Used`) 
        .addField('⏲️ Uptime', `Days: ${days} | Hours: ${hours} | Minutes: ${mins} | Seconds: ${realTotalSecs}`, true)
        .setFooter(`${bot.user.username}`, bot.user.displayAvatarURL)

msg.channel.send(info)
#

help ?

next mica
#

thx @frail ocean

lyric mountain
#

@halcyon ember note that if the total reward is 1, all you need to do is divide by 100

halcyon ember
#

@lyric mountain am i supposed to do that for every user value in my score?

lyric mountain
#

Don't you know how to do rule of 3?

halcyon ember
#

what is that

sudden geyser
#

@earnest phoenix what version of Node.js are you using.

earnest phoenix
#

i think the latest one

lyric mountain
#
X		=		100%
Y		=		Z
#

So Y * 100 / X = Z

#

Replace the values with the ones you have

copper cradle
#

@earnest phoenix update your node version to v12

earnest phoenix
#

@copper cradle discord.js ? is already v12

lyric mountain
#

He mean node, not djs

sudden geyser
#

Node.js.

#

Not Discord.js.

halcyon ember
#

im confused

#

x is my total reward

lyric mountain
#

Let's say you wanna know how much is 33% of 123

#

33 * 123 / 100 = X

mossy vine
#

how can i rewrite this to work with d.js v12?

users = await message.reactions.get("🔫").fetchUsers();
for (user of users){ ```
copper cradle
#

@earnest phoenix I said node not discord js

lyric mountain
#

That is the rule of three, the easiest way to get any percentage

halcyon ember
#

yea i have like 50 users on a score, each one has a different y value. how am i supposed to put each one in?

copper cradle
#

do you not know how to read?

lyric mountain
#

What is the total?

halcyon ember
#

changes all the time

lyric mountain
#

Ok, so I'll call it TOTAL

#

You'd do it like this:

#

desiredValue * 100 / TOTAL = percentage

halcyon ember
#

for starters i dont even know how to get the total from a score lol

lyric mountain
#

Or if you want the value instead of tge percentage :

copper cradle
#

I literally said update your node version
and the dude literally replies dIsCoRd.Js?

lyric mountain
#

desiredPercentage * TOTAL / 100 = value

halcyon ember
#

ok so

lyric mountain
#

Save those two equations somewhere, it might help u later

halcyon ember
#

i have reward of 50. say user 1 has rate of 20 and user 2 has rate of 70. how do i make it do that and add the respective amount to the user?

lyric mountain
#
100% = 50
20% = X
#

Transforming that to equation:

#

20 * 50 / 100 = X

#

Do the same for 70

halcyon ember
#

so i need to do that for every value in the score

lyric mountain
#

Yep

#

desiredPercentage * TOTAL / 100 = value
Use this equation

copper cradle
#

@earnest phoenix did you update it already?

halcyon ember
#

but it aint realistic to write that out for every user

#

is there like a for statement to do that for every user in a score?

lyric mountain
#

Yes

#

Just use variables in the equation

earnest phoenix
#

@copper cradle yes

lyric mountain
#

And put it inside a loop

digital ibex
#

how can i create a reaction collector with eris, i'd like to create my own instead of using something like eris-additions, even tho it doesn't have it

lyric mountain
#

Reaction collector?

#

Like, count the amount of reactions?

halcyon ember
#

how do u do that

#

i dont understant scores at all lol

lyric mountain
#
function getSlice(share, total) {
	return share * total / 100;
} 
#

Here it is, although spoonfed

halcyon ember
#

so i say

#

function reward(share,total)

mossy vine
halcyon ember
#

then when i want to give user the reward

#

i do reward(userhash, 50)

#

but how to put that into a for statement

lyric mountain
#

Hash?

halcyon ember
#

yea thats the rate

#

thats a variable

#

that i set at the start

lyric mountain
#

Just iterate your users

halcyon ember
#

huh

lyric mountain
#

How are you getting the array of users?

halcyon ember
#

how tf to do that

#

i dont have the array of users

#

i have a score

lyric mountain
#

Dude

halcyon ember
#

?

lyric mountain
#

How are you getting the score then?

halcyon ember
#

score.value

lyric mountain
#

Where is that?

#

Code plz

halcyon ember
#
        score = client.getScore.get(message.author.id);
        if (!score) {
          if (!score) {
            score = { id: `${message.author.id}`, user: message.author.id, btc: 0, eth: 0, usd: 100, i3: 1, i5: 0, i7: 0, i9:0, x1900:0, x1920:0, x1950:0, x2920:0, x2950:0, wx2970:0, wx2990:0 }
            const embed = new Discord.MessageEmbed()
                .setColor('#7FDB7F')
                .setTitle('Use $profile to see your newly created profile!')
                .setAuthor('Account Created', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
                message.channel.send(embed)
          }
          client.setScore.run(score);
        }else {
          const embed = new Discord.MessageEmbed()
          .setColor('#ff9933')
          .setTitle('You already have an account! Use $profile to see your account')
          .setAuthor('Error', 'https://cdn.discordapp.com/emojis/710585568660291584.png?v=1')
          message.channel.send(embed)
        }```
grizzled raven
#

@mossy vine what lib

mossy vine
#

d.js v12

#

i get that its because uncached

grizzled raven
#

yeah you need to fetch the users

mossy vine
#

but how do i fetch them

grizzled raven
#

users.fetch()

mossy vine
#

IF I DONT EVEN GET THE SNOWFLAKES OF THE USERS THAT REACTED

grizzled raven
#

lol you are able to fetch them lmao

mossy vine
#

ok what the fuck is this library

lyric mountain
#

@halcyon ember that code is very confusing

grizzled raven
#

i think its because the v7 api or whatever doesnt send reaction users when you fetch a message

amber fractal
#

It doesnt

lyric mountain
#

You're checking for !score twice in a row

amber fractal
#

It says it doesnt give reactions when you fetch a message doesnt it?

digital ibex
#

no @lyric mountain, the same thing with djs which has awaitMessages, the same thing but in eris

lyric mountain
#

You assign it before and after the check

grizzled raven
#

well v11 does

#

also nvm

#

they both use 7 so

digital ibex
#

but with reactions

lyric mountain
#

@digital ibex what?

#

Ah

#

Is that about message pagination?

digital ibex
#

djs has message.channel.awaitMessages, i want the same kinda thing with eris but with reactions,

grizzled raven
#

yeah idk why d.js v12 doesnt and v11 does bit

digital ibex
#

hoping that makes mroe sense lol

halcyon ember
#

@lyric mountain huh whats wrong?

digital ibex
#

no its not

amber fractal
#

v11 auto fetches in the background

#

v12 disabled that to allow it to use less resources

#

Because reactions arent always needed

grizzled raven
#

oh ok

lyric mountain
#

@halcyon ember if score is already true, you don't need a second check

#

Also, you redefined the score value

halcyon ember
#

no likee how do i make a statement to put it into that equasion

lyric mountain
#

Idk where you want this

#

Like, where do you need it?

grizzled raven
#

i dont seem to be able to find where d.jsv11 auto fetches the reactions but

halcyon ember
#

so currently i have a function thats set to run everey 10 minutes

lyric mountain
#

Right

halcyon ember
#

inside that it currently just sends a message to a specific channel

#

but I want it so that whenever that function runs it calculates rewards and distributes them accordingly

lyric mountain
#

Which message is sent?

#

A message containing all users?

halcyon ember
#

it just says 'test'

#

it sends to a channel

lyric mountain
#

But what will it contain?

halcyon ember
#

it doesnt say anything

#

im going to remove that and change it to the reward distribution

lyric mountain
#

Ok dude, but I need a real scenario here to know where you'd calculate the share

halcyon ember
#

omg ok im just going to explain the entire bot then

lyric mountain
#

No need

bronze sail
#

is there a way to get a list of the people that reacted to a message? (discord.py)

halcyon ember
#

just why i'd need to generate the distribution?

lyric mountain
#

If you're gonna list all users you'll need to iterate over each

bronze sail
#

wdym?

lyric mountain
#

Just calculate the share in that iteration

halcyon ember
#

how do i do that from the score?

lyric mountain
#

@bronze sail not talking to u, just do message.reactions

bronze sail
#

ooh ok

lyric mountain
#

Ah, python

#

It might be different then

#

Just look at the docs

#

@halcyon ember that's the issue

#

Idk the value of score

#

Since you've defined it twice

#

@grizzled raven halp

halcyon ember
#

huh let me check

bronze sail
#

ye im confused im looking at the docs, but it doesnt explain something

halcyon ember
#

i mean i just followed this guide

lyric mountain
#

That changes EVERYTHING

#

And makes that code even more confuse

bronze sail
keen path
#

obfuscation achieved

lyric mountain
#

@bronze sail message has reactions property

bronze sail
lyric mountain
#

You just need to iterate over it

#

And get which user reacted

bronze sail
#

but idk where to use this

#

like how do i do this:

halcyon ember
#

bruh

bronze sail
#

i want the bot to send a message then react to it, then another command will get the reactions from that message

keen path
#

what are you using?

lyric mountain
#

@bronze sail you want a reaction button?

bronze sail
#

?

halcyon ember
#

im so confused

bronze sail
#

no i already know how to get the bot to react

#

i want to get the reactions from a certain message

lyric mountain
#

No, I mean

keen path
#

I think it's a "how many reactions does message X have" command

bronze sail
#

$$reactions <messageid>

lyric mountain
#

Reactiokn button, a reaction which has a function once clicked

keen path
#

what framework are you using?

bronze sail
#

sure

#

i think were both confused here

tight plinth
#

So apparently my bot (using lavalink+shoukaku) leaves the vc sometimes before playing songs, and I found a error "Something broke" in the lavalink server logs. How can I solve this issue?

lyric mountain
#

Oh no, not another issue

tight plinth
#

It's the last one

#

@bronze sail smh

bronze sail
lyric mountain
#

See the returned song payload

#

Some songs can't be played

tight plinth
#

The bot logs returns a "song Finished" event, but no error

#

And then if the user retries it works

#

With the same song

lyric mountain
#

Maybe it's because of YouTube ads

digital ibex
#

u got an idea 4 what i can do KuuHaKu?

tight plinth
#

Ads

#

Fuck them

halcyon ember
#

@lyric mountain ok so the score code i have first checks if there is already a entry for the users. Then if there is not it creates a new one with the values I added in. Then I have a variable totalrate = score.i1*1000+score.i2*2000+score.13*3000. Which allows me to tell the user their current rate. But score is matched to the user id of the message author

lyric mountain
#

What you want is related to reaction button functions @digital ibex

digital ibex
#

yes @lyric mountain

tight plinth
#

Time to meme: can I use ad block with lavalink

digital ibex
#

i'm not using Eris' command client

lyric mountain
#

Then find a lib for that, it's not easy to do

tight plinth
#

Well fuck

lyric mountain
#

Reaction buttons are very tricky to do if you don't know how to directly handle events

modest maple
#

@tight plinth Normally if it cuts out mid way its because the Video stream timed out

digital ibex
#

yeah, thats why i'm doing that 😓

#

oki, thanks

lyric mountain
#

@halcyon ember just apply that function there

tight plinth
#

Hmm

halcyon ember
#

but i want a for statement for every user

lyric mountain
#

Then do that for every user

#

You will need to iterate over them sometime

halcyon ember
#

how tf to do that

lyric mountain
#

That's the question

#

Without a code I can't say how would you do it

#

That code you've shown I've not understood

halcyon ember
#

what part of my code u need

#

the score?

lyric mountain
#

I need to see how and where you're calculating each user's score

halcyon ember
#

i dont calculate the score

clear wraith
#
                                                                      ^
SyntaxError: Unexpected token :```
?
halcyon ember
#
        const xmrhashrate = score.i3*1500+score.i5*2500+score.i7*4000+score.i9*5000+score.x1900*4500+score.x1920*8000+score.x1950*10000
            const embed = new Discord.MessageEmbed()
            .setColor('#ff9933')
            .setTitle(message.author.username+"'s Hashrate")
            .addField('RandomX (XMR)', convert(xmrhashrate))
            .addField('Ethash (ETH)', '0H/s')
            .addField('SHA-256D (BTC)', '0H/s')
            .setFooter('$invite - Add me to your server')
            message.channel.send(embed)
          }``` thats where it prints it out
lyric mountain
#

But how are you getting every user's score

#

You gotta be iterating somewhere

halcyon ember
#

im not

summer torrent
#
                                                                      ^
SyntaxError: Unexpected token :```
?

@clear wraith {}

lyric mountain
#

So you gotta do that first

summer torrent
#

not []

halcyon ember
#

i havent did anything to get all the users score

#

i dont know how to either

lyric mountain
#

Do that first

#

Then we can go calculate each one's share

halcyon ember
#

how

clear wraith
#

O

lyric mountain
#

Idk, do a little research, that's specific for your bot

clear wraith
#

Ok

lyric mountain
#

Not u

halcyon ember
#

k

clear wraith
#

lol, IK

halcyon ember
#

i cant find anything on google about iterating something from a sqlite base

quartz kindle
#

how are the scores stored?

modest maple
#

I mean you dont rlly iterate over SQLite db

#

you iterate over the cursor after executing a Select query

halcyon ember
#

right its stored in sqlite tied to the user

#

i mean theyre in a file

quartz kindle
#

and what do you want to do?

#

compare scores from many people?

halcyon ember
#

what i want it to do is basically get the values from everybody

#

and then put them into a math equasion to distribute a reward

quartz kindle
#

the easiest way to to that would be to get everyone

#

in better-sqlite3: database.prepare("SELECT * FROM table").all()

#

that will basically dump the entire database into an array

halcyon ember
#

oh

quartz kindle
#

of course thats not the most efficient way to do it, especially if your database grows large

#

but to make something more efficient requires some thought

halcyon ember
#

i have a const xmrhashrate = score.i3*1500+score.i5*2500+score.i7*4000+score.i9*5000+score.x1900*4500+score.x1920*8000+score.x1950*10000 and i want it to geenerate that for every user

quartz kindle
#

generate it one time only, or generate it and save it?

#

is it gonna be different every time it is generated?

halcyon ember
#

then theres a total reward of say 5 and user 1 has 100 user 2 has 40 and user 3 has 60. i want it to distribute the 5 reward over to the users based on how much of the total

#

yes its going to be different

#

well itll only be different if somebody changes their profile in the bot

quartz kindle
#

are you making a blockchain bot?

#

xD

#

what if you have 500 users

#

does the 5 get distributed among all 500?

halcyon ember
#

yep

#

yes it is a blockchain bot

quartz kindle
#

is it global? not per sever?

halcyon ember
#

global

quartz kindle
#

so the most efficient way is to probably have SQL do the calculations internally

#

instead of getting everything from it, calculating and the shoving everything back inside

halcyon ember
#

i have better-sqlite3 idk if that workss

quartz kindle
#

it will work, you just need a somewhat complex SQL to do it

halcyon ember
#

how to do that? i dont really understand sql

#

also does it get slow if im making it run every 20-30 seconds

quartz kindle
#

for example, you could do something like SELECT i3*1500+i5*2500 FROM scores to have sqlite calculate it inside

#

i didnt test it, so idk if thats the proper syntax

#

but its possible to go further and use the value to directly distribute and update the database

#

without ever returning the value to you

buoyant niche
#

hi

#

hi

halcyon ember
#

well i guess that works

#

but how to make it do that for every user

quartz kindle
#

if you dont use the WHERE clause, it will run for all entries by default

#

if you want to get all results, you have to use .all()

#

instead of .get()

halcyon ember
#

so i just throw
SELECT i3*1500+i5*2500etc.. FROM scorees and that returns array or what

quartz kindle
#

if you use .all() it should return an array

#

so test it, idk if it will work

#

you might need to put them in parenthesis

modest maple
#

Will SQLite even accept you giving it a math equation when it expects column names?

halcyon ember
#

and how am i supposed to make it process that array to distribute rewards

quartz kindle
#

that will take a more complex query, i never tried doing something like that

#

ill try playing around with it a little

halcyon ember
#

ok thanks im so confused on making it work lol

modest maple
#

I dont actually think SQLite can even do that

halcyon ember
modest maple
#

Somthing like Postgres would allow an entire logical operation etc... but SQlite is bare bones

halcyon ember
#

i mean right now i just have it calculate it whenever the user asks for it

modest maple
#

whats the issue with that?

halcyon ember
#

there is no issue

#

what i want is it to calculate that for EVERY user to distribute rewards

modest maple
#

Overall i would advise not doing it that way

#

and instead doing it when a user checks or somthing

#

because if that DB gets bigger it will eat shit when you try to get everything and apply it and update it

#

its just a bit inefficient

halcyon ember
#

i mean is there a better way to do it?

modest maple
#

doing it when a user checks or somthing

#

Theres no point distributing rewards to a user that might never use it or check it

halcyon ember
#

what im makin is like a crypto minin game

#

and i want it to distribute rewards everytime a 'block' is found

#

just like how it actually works

pine jacinth
#

I am developing in C# and ran into a problem with the api.
This is in my ReadyAsync:

AuthDiscordBotListApi AuthDBApi = new AuthDiscordBotListApi(_client.CurrentUser.Id, Environment.GetEnvironmentVariable("DBO_TOKEN"));

            _ = Task.Run(async () => {
                IDblSelfBot DB_Bot = await AuthDBApi.GetMeAsync();
                await DB_Bot.UpdateStatsAsync(_client.Guilds.Count);
                await Task.Delay(1000 * 60 * 10);
            });

But 4th line throws a NullReferenceException. What am I doing wrong?

copper cradle
#

@clear wraith you tried to pass in an array instead of an object

#

you can't do this [ something: 'something' ] but you can do this { something: 'something' } this is basic

quartz kindle
#

@halcyon ember here's an example of updating a database directly from selections

halcyon ember
#

huh let me see

#

oh so it works?

#

like the math

quartz kindle
#

here i successfully set all "name" columns to the result of "hint x 1500 + test x 2500" of each row

halcyon ember
#

yea so it works

quartz kindle
#

yes it works, just its a lot more complex to do such operations in raw SQL

#

but its probably more efficient since there is no round trip to and from your process

halcyon ember
#

so how am I supposed to get that and put it into a math equasion to distribute rewards

quartz kindle
#

idk how i would do the distribution part tbh, i'd need to research on it

halcyon ember
#

oh

#

rip

#

well if you can find anything lmk thanks

clear wraith
#

you can't do this [ something: 'something' ] but you can do this { something: 'something' } this is basic
@copper cradle I did that... and now it says canvas is not defined even though i have it defined above.

slender thistle
#

cavas

copper cradle
#

cavas

earnest phoenix
copper cradle
#

roman you gotta learn to reas my dude

#

it says cavas

#

you need canvas

earnest phoenix
#

anyone?

quartz kindle
#

did you install canvas correctly?

earnest phoenix
#

(if youre talking to me, yes)

quartz kindle
#

including the dependencies?

clear wraith
#

Ohhh shoot. I need to learn how to type.

#

oof

quartz kindle
earnest phoenix
#

no

clear wraith
#

@copper cradle I read books everyday... and i still can't type... Kinda sad.

#

lol

copper cradle
#

lol

quartz kindle
#

well, dyslexia is a sign of superior intelligence

#

or so they say

still merlin
#

Is GitHub and website required when adding a bot

copper cradle
#

no

steel drum
#

@still merlin i think having a git-repository is very helpful (regardless of if its public or private)

bronze veldt
#

hi

vital cobalt
#

just forcibly write what you want and teach vs whos boss

quartz kindle
#

in discord.js v12 all collection methods have been moved to .cache

sudden geyser
#

the version is the boss :^)

grizzled raven
#

why is length a property

#

lol ok

earnest phoenix
#

shush python user eek

topaz fjord
#

any lib over d.js anyday

quartz kindle
#

d.js-next gonna be > all

topaz fjord
#

no

quartz kindle
#

jk it probably wont

topaz fjord
#

any non js lib > js lib

#

fixed

quartz kindle
#

except for py

#

:^)

fickle arch
#

could anyone explain to me how to switch from const token into const settings (the places where my bot token, and information stored) because it shown error about unexpected end of JSON input i'm still kinda struggle on these.

still merlin
#

should this css be displayed on my bots page? (haven't submited yet)?

quartz kindle
#

@fickle arch the json format follows specific rules

copper cradle
#

@grizzled raven it's the same in python the len property

quartz kindle
#

it has to be like this ```json
{
"key":"value"
}

copper cradle
#

the len function is literally this
def len(a):
return a._len_

fickle arch
#

on the settings.json ?.

copper cradle
#

guess

quartz kindle
#

yes

#

if the file doesnt follow that specific format, it will be considered invalid

fickle arch
#

so the value was the token ?.

quartz kindle
#

json is very strict, if there is a single character wrong, it will invalidate the whole file

#

idk how your file looks like so idk

fickle arch
#

it just simple like ownerid,token,prefix,etc.

quartz kindle
#

yes but how is it formatted?

#

@still merlin your long description is not an independent page

#

its injected into the existing top.gg page

#

all your css rules and html need to respect this, there are already existing html/head/body tags and existing css you need to consider

still merlin
#

oh yeah-

fickle arch
#

it's like

{
  "ownerid": "youridhere",
  "prefix": "?",
  "token": "yourtokenhere",
}
copper cradle
#

that last ,

#

at the end of the last element

#

tho

quartz kindle
#

json doesnt accept trailing commas

copper cradle
#

that shouldn't be there

quartz kindle
#

if the comma is not separating anything, it should be removed

fickle arch
#

so after token no need comma after that ?.

copper cradle
#

yeah

quartz kindle
#

yes, since there is no next item

fickle arch
#

unless there another code after }

quartz kindle
#

no, nothing should ever be after }

#

you'd add a comma if you wanted another item under token

fickle arch
#

aight, i get it unless no need to add another under token so there's no need to put another comma ?.

quartz kindle
#

yes

digital ibex
#

hi, quick question. if i have array = [ { object1: { number: 1 }, object2: { number: 2 } } ] how can i get the last number, in this case object2.number? win javascript

fickle arch
#

after i replace const token with const settings it shown an invalid token was provided.

digital ibex
#

without me having to do array[0].object2.number ?

quartz kindle
#

@fickle arch how did you import it and use it in your code?

#

@digital ibex thats exactly how you do it

digital ibex
#

yeah

quartz kindle
#

there is no "without" doing that

digital ibex
#

but i don't want to hardcode it

quartz kindle
#

which part you dont want to hardcode? the index 0?

fickle arch
#

what do you mean on import it ?.

#

like const settings = require(./settings.json); or something ?.

quartz kindle
#

yes

digital ibex
#

so like, i'm trying to create a case system for modlogs, and uh

#

yeah, i can't really hardcode it

quartz kindle
#

which part of the data is dynamic?

digital ibex
#

thats the db stuff

#

its like

#

moderations: [ { mute: { case: { type: Number }} })

#

and other ones

quartz kindle
#

so you have an array of objects like that, and you want to find one object by their number?

#

then use the array.find() function

grizzled raven
#

@copper cradle but like bot.users.length??

digital ibex
#

ah, oki, ty

celest shard
#

Guys, does someone know how can I add this embed thingy to my website when displaying it in, for example, discord?

I have no idea.

earnest phoenix
quartz kindle
#

twitter tags and opengraph tags ^

celest shard
#

thaaank you :) couldn't find it in google.

vague kite
#

Is there any way to find out if someone has started streaming in a discord channel?

earnest phoenix
#

yes

#

their voice state will be updated

quartz kindle
#

VoiceState.streaming in discord.js

fickle arch
#

what is purpose of using mongoDB ?.

quartz kindle
#

mongoDB is a fully featured no-sql database system

#

its main purpose is to be the primary storage system of a program/project/website/server/service/etc...

earnest phoenix
#

how i use the function sort() ?

quartz kindle
#
.sort((firstValue,secondValue) => {
    compare firstValue to secondValue
})```
fickle arch
#

prefix is not defined
but in settings.json i had "prefix": "?"

#

it said the problem is around here

client.on('message', message => {
    let args = message.content.substring(PREFIX.length).split(" ");
steel heath
#

anyone's familiar with Crowdin webhooks/api?
||i am trying to make it send a message to a specific channel on new translations||

#

thank you

vivid cedar
#

How can i play spotify playlist

#

on discord.js

quartz kindle
#

@fickle arch how did you define PREFIX as?

fickle arch
#

before i use const PREFIX then i delete it and switch it with settings.json along side with other information.

quartz kindle
#

well your code is looking for PREFIX.length

#

which means its looking for PREFIX

#

somewhere in your code

#

if you deleted it, then it will not find it

#

and throw the error

fickle arch
#

so i need to like readded it ?

#

the const PREFIX ?.

quartz kindle
#

or change how you use it

#

you defined your file as settings right?

#

so make your code look for a prefix in there

#

instead of looking for PREFIX

fickle arch
#

so i added const PREFIX : '?'; below const settings : require ('./settings.json);

earnest phoenix
#

permissions or options?

#

elaborate

#

^

#

by right clicking on your server, then server settings

#

there you should see an option called "Roles"

#

np GWgoaMonikaSmug

#

sure. ask

fickle arch
#

like roles ?.

earnest phoenix
#

by enabling "seperate roles"

#

you're welcome again GWowoHehe

quartz kindle
#

@fickle arch you basically made your settings file useless lol

earnest phoenix
fickle arch
#

ahh i see lol.

simple stump
#

For some reason when I try to do:

            con.query(`SELECT * FROM fireballcool WHERE id = '${message.author.id}'`, (err, rows) => {
                if (err) throw err;
                const [ row ] = rows;
                if (row && row.time + 1 <= ts) {
                    con.query(`DELETE FROM fireballcool WHERE id = '${message.author.id}'`, (err, rows) => {
                        if (err) throw err;
                        const role = message.guild.roles.cache.find(role => role.name === "Cooldown");
                        message.member.roles.remove(role);
                    })
                }
            })

It never removes my role. However, in my MySQL database it says the correct numbers. The variable ts is correct to my knowledge, but the role is never taken away. My bot has full permissions and can add/take away roles from my alt which just joined the server. What is going wrong?

quartz kindle
#

add a console.log to it to see if your code ever reaches there

fickle arch
#

tried to invite my bot to my testing servers but when i click the link and press authorize it only shown X in the middle.

stable nimbus
#

So I am trying to create a tow command, and this is its response, but its not giving me everything I want. I need the bot to also provide the vehicle name which is provided through Message.content, so if someone could help me out that would be amazing!

Current Code:

const embed = new MessageEmbed()
                .setTitle('The Tow!')
                .setColor(0xFF0000)
                .setDescription(`<@${member.id}>` + '\'s car is being towed by: ' + `<@${message.author.id}>` + '!')
                .addField('The Vehcile Is: ', `<@${member.id}>` + '\'s' + message.content.slice(prefix.length).slice(command.length).slice(member.id))
                .setFooter(copyright);
                await message.delete();
                return await message.channel.send(embed);
            }
viral spade
#

Tim, maybe you remember, i am currently reprogramming my statistics bot. I wanted to ask, would it be wise to (as i have to redo a lot anyways), also switch from discord.js to eris /another framework?

torn nebula
#

what are you trying do here
message.content.slice(prefix.length).slice(command.length).slice(member.id)?

stable nimbus
#

Trying to remove the prefix, command length, and the member that I mentioned so I can put the member ID in the front with an 's

torn nebula
#

u can use .tag
instead <@${message.author.id}>

stable nimbus
#

.slice(.tag)?

torn nebula
#

message.author.tag

stable nimbus
#

I'm not wanting it to retag the author, the author is the second mention (Fuzzy)

torn nebula
#

so how you defined member?

stable nimbus
#

const member = message.mentions.members.first()

quartz kindle
#

@viral spade if you want to future-proof as much as possible, the best thing would be to make your own library, for the lack of better alternatives, or switch languages lol

#

pretty much all big shots have their own home-made libraries designed specifically for their use cases

viral spade
#

on another language is there a future-proof out of the box framework?

#

making your own framework, would this in a simple case mean fork f.e. the discord.js repo and cut off functionalities/reduce cache, that i dont need? Or are you talking about completely from scratch?

modest maple
#

Just not using discord.js would be a good start lmao

white anvil
#

depends how future proof you want to make it

quartz kindle
#

i would make it from scratch, another alternative is looking into detritus

white anvil
#

DETRITUS

#

💪

modest maple
#

Discord.js is fucking awful for big bots without being heavily modified

white anvil
#

making ur own lib is hard

modest maple
#

^^

quartz kindle
#

its not that hard, just annoying

white anvil
#

if u rlly want to do it, i suggest starting with a solid foundation

#

again detritus can help with that :-)

#

do all the rlly annoying socket stuff for you

modest maple
#

Unless it's d.js, making your own lib without knowing exactly what you're doing it'll probably be slower than the main libs

white anvil
#

detritus client has completely modular cache

#

all parts can be controlled independantly

#

eris or detritus are both good libs tbh, my only problem with eris is the shit typings and how the client is structured

modest maple
#

Eris is designed to be more lightweight

#

It just expects you know how Todo shit yourself

white anvil
#

detritus client is middleman

#

but it still requires you to have knowledge of shit

quartz kindle
#

@white anvil have you tried benchmarking detritus? because from what i've seen, their implementation of zlib is async, which is considered not ideal

white anvil
#

i havent benchmarked it

#

honestly if u want to know more about the lib its probably best to ask cake in the support server

modest maple
#

Js's async system seems painfully slow compared to other Lang's systems which confuses me

white anvil
#

its not slow its just weird

#

the whole promise concept is weird and kinda dumb

quartz kindle
#

not as dumb as py's indentation :^)

modest maple
#

Fuck offfff breh

#

Indentation is important lol

sudden geyser
#

silence python user blobzippermouth

modest maple
#

Smh

white anvil
#

@quartz kindle detritus just uses the node provided zlib which is generally slow

#

lol

#

i dont think the async part matters too much

modest maple
#

Async in most cases is a good thing

#

Especially discord bots

white anvil
#

there are some sync discord bots

#

very big brain

river vapor
#

akairo is nice

viral spade
#

Okay thank you for your answers. Then i would stay at discord.js for now and when i redo it, make it from scratch.

white anvil
#

dont make ur bot too big before switching

#

it will be too hard to port

modest maple
#

Tbf Eris should be enough for u lol

river vapor
modest maple
#

Idk how many bots use a custom lib at 14k guilds like

white anvil
#

vexera uses a custom lib

viral spade
#

so eris also good for over 1.000.000 guilds?

white anvil
#

thats in 300k+

#

eris is decent but it doesnt provide native clustering

#

detritus does

modest maple
#

Pokecord uses a modified version of eris

white anvil
#

keyword modified

modest maple
#

Why would u even need native clustering

white anvil
#

all big bots that use eris use their own modifications

modest maple
#

That kinda defeats the purpose lol

white anvil
#

because its better than relying on third party package?

#

or writing it yourself?

modest maple
#

The whole point of clustering is it allows scaling across multiple processes and machines

white anvil
#

yes

modest maple
#

Every big bot that uses clustering doesn't use the in-built system

#

Cuz it's fucking shit as fuck

white anvil
#

because there isnt any

#

detritus provides cluster client which is fully featured and also comes with cluster manager

modest maple
#

If you're going to cluster properly K8s or Swarm are some of the best methods

#

No harm in using a 3rd party lib when it does it better than the main lol

quartz kindle
#

there is no proper multi-machine solution

#

thats why im making one

modest maple
#

other than docker swarm or just using k8s

gloomy imp
#

I have low hopes for this question but....

is it possible to check if a channel id is in a certain server

modest maple
#

Iterate through all channels ig

gloomy imp
#

discord.js

white anvil
#

that wont work if you dont have a complete cache

gloomy imp
#

do what

pure lion
#

uh

quartz kindle
#

channels are always cached by default

modest maple
#

^

pure lion
#

how do i make my bot editable through commands in the server?

white anvil
#

there is rest endpoint to fetch all guild channels

pure lion
#

dumb question and stuff

gloomy imp
#

maybe I'll try doing it by name instead of id...

quartz kindle
#

there is?

white anvil
#

yes

modest maple
#

Yeah

quartz kindle
#

since when

modest maple
#

Idk why you would use it tho

white anvil
#

i would use it if i wanted all channels

#

since i dont have a cache

modest maple
#

I'm only worrying about cache when the bot starts using 30GB ram lol

#

<5GB is good enough for me at 55k

quartz kindle
#

well im not rich so

earnest phoenix
#

How i use sort() to the command top?

viral spade
#

So when we speak of frameworks to be better for large bots, are we speaking mostly about ram or are other resources even more important to save with a better framework?

white anvil
#

using 30gb with no cache is exponentially bigger in terms of guild count than 30gb with cache

modest maple
#

Also @quartz kindle You say there are no good multi machine scaling options, have you actually looked at kubernceles statefulsets

white anvil
#

@viral spade its kinda subjective

modest maple
#

Most big bots don't even use a framework lol

white anvil
#

depends what u want to do

viral spade
#

statistics, which means i need most of the data cached

modest maple
#

Ngl

white anvil
#

in which case there will be little difference between frameworks

modest maple
#

Stop using mysql

#

Lol

white anvil
#

mysql is fine

#

whats the issue with it

modest maple
#

Mysql is fucking awful until it got to V8 where it's only just caught upto postgres in speed

#

And postgres still crushes mysql in features and power

river vapor
#

yo answer his question mysql is my babe

white anvil
#

mysql scales rlly well

#

sure postgres is better but mysql isnt bad

modest maple
#

There is litterally no reason to not use postgres over mysql

river vapor
#

yeah but he said whats the issue with mysql

viral spade
#

okay @modest maple i will do

modest maple
#

Lacks utility, speed, security etc...

white anvil
#

mysql can be considered faster for a lot of operations

#

and is simpler to use bcuz no vacuum

modest maple
#

I'd hardly say postgres is hard to use lmao

river vapor
#

guy didnt say postgres is hard to use he said mysql is simpler

white anvil
#

a lot more web developers use mysql because it doesnt have features that they dont need

modest maple
#

TL;DR: MySQL is a bad database. Don't use it unless you have literally no other option.

Why shouldn't I use MySQL?

  • MySQL has no transactional DDL. This means that if you fuck up creating a table in the middle of a migration, you cannot rollback easily.
  • MySQL has a lot of security issues. New zero-day vulnerabilities are found regularly.
  • MySQL is owned by Oracle.
  • MySQL is slow. It beats Postgres etc at some things, but once you move beyond basic queries it begins to slog.
  • MySQL disconnects you randomly. Unless you setup your connection specially, it will break regularly.
  • MySQL allows all kinds of insane data to be inserted. '0000-00-00' is valid in MySQL.
  • MySQL is not ANSI compliant. You have to turn it on; even then it isn't fully compliant.
  • MySQL has no feature advantage over other databases; PostgreSQL has many more useful features (such as RETURNs).

There is no reason to use MySQL over PostgreSQL, or even sqlite3. See also:
https://blog.ionelmc.ro/2014/12/28/terrible-choices-mysql/
https://grimoire.ca/mysql/choose-something-else

#

It's a old review but still relevant

white anvil
#

security issues arent a problem if u arent a moron

river vapor
#
  • MySQL disconnects you randomly. Unless you setup your connection specially, it will break regularly.
    that's why we have connection pooling
viral spade
#

lol most of whats written there isnt true (anymore). its from 2014..

river vapor
#

yea

modest maple
#

Alot is still relevant especially speed

white anvil
#

mysql is a lot faster now than it was

modest maple
#

Only took upto v8

white anvil
#

so

#

who cares

modest maple
#

Where it still lacks behind postgres

white anvil
#

depends what you're doing

river vapor
#

i dont care how long it took them...

modest maple
#

I do lmao

white anvil
#

mysql also has some better misc stuff like query caching

river vapor
#

fuck does it mean to you, we're comparing the latest of both

modest maple
#

Postgres has query caching? Lol

white anvil
#

i agree postgres is better for complex query but in terms of web development where queries are normally simple it can be faster

modest maple
#

For simple sites sure

river vapor
#

For web development mysql is absolutely the choice

modest maple
#

But the utility of postgres makes up for the slight speed decrease

river vapor
#

hardly

modest maple
#

I will take postgres over mysql every time

white anvil
#

thats still very subjective

modest maple
#

If you're only doing light stuff you might aswell use a nosql dB all things considered

#

Which is what mongo is litterally based around (web development)

white anvil
#

nosql databases are usually harder to use

#

i dont rlly see the appeal tbh

mossy vine
#

harder???

sudden geyser
#

sounds like a flame war is emerging

mossy vine
#

man i can write javascript instead of selling my soul and a kidney to satan and writing some broken english

quartz kindle
#

lmao

white anvil
#

it takes like 3 days to learn sql

slim umbra
#

lmao

white anvil
#

its declarative for a reason

#

lol

modest maple
#

Not proper sql

#

There's the 'i can do some querys' sql

#

And then there's actually properly knowing it

sudden geyser
#

instead of selling my soul and a kidney to satan and writing some broken english
still sounds like javascript

white anvil
#

lol tbh

modest maple
#

True

white anvil
#

maybe i dont like mongo because its actually mongoose thats crap

modest maple
#

CPP is just selling your soul to satan then bending over for the pitch fork

valid frigate
#

mfw mongoose

mossy vine
#

mongoose is useless unless you absolutely need the schemas (you dont)

valid frigate
#

for somebody who uses typescript it might make sense

earnest phoenix
#

How i use sort() to the command top?

white anvil
#

people told me to use it and then i ran into problems no one knew how to fix

valid frigate
#

you have some sort of type definition

#

but

#

dont really use it anymore

white anvil
#

so i switched to postgres

modest maple
#

Yesssssssss

valid frigate
#

purely for the reason that mongoose broke

modest maple
#

Convert the man

#

Tbf mongo is slower byitself

#

But mixed with a cache db

#

It starts to crush SQL for short sharp querys

mossy vine
#

it may be slow but goddamn is it easy

modest maple
#

Which is why it's got popular

#

Reddis + Mongo or -insert mongo fork here I've forgotten the name- is a very popular combo

#

And pretty quick

white anvil
#

reddis moment

mossy vine
#

just use redis as your db

white anvil
modest maple
#

Isn't that just discord.js tho -> just one really baddddd cache db

white anvil
#

i keep meaning to implement redis but my lazy ass is too lazy

river vapor
#

lazy guy's lazy cant blame him

white anvil
#

detritus comes with pretty nice cache solution so i use that for discord bot instead

#

but redis would be ideal

mossy vine
#

i dont know what i would use redis for tbh

#

i can just query my db

white anvil
#

cache all the things

modest maple
#

You don't rlly need it unless shit gets big

white anvil
#

just cache ur entire db on identify

modest maple
#

We use it on one of the 30k/s APIs

mossy vine
#

if i didnt care about cache i would still be letting my bot use 1.7gb ram with d.js

white anvil
#

how many guilds

mossy vine
#

600-700 at the time

white anvil
#

lol 1.7gb for that

#

what a joke

mossy vine
#

fun fact, the bot needs basically no caching to operate

#

sliced down to 50-60mb with custom lib

white anvil
#

my bot would benefit from cache but i sacrifice cpu time for better memory usage

#

i use about 50mb also lol

#

the only thing i cache is messages

#

and that had hard limit of 100 items

earnest phoenix
#

How can I put clickable links in the footer of a embed?

white anvil
#

you cant

mossy vine
#

@earnest phoenix dont think you can in a footer

earnest phoenix
#

i couldve sworn you used to be able to but alright

white anvil
#

you can in description and title etc

#

you cant in footer

modest maple
#

Oof

#

Memory is wayyy cheaper than cpu

viral spade
#

how can i reduce the ram usage / cache size of d.js?

white anvil
#

you cant

#

at least not properly

modest maple
#

You use erid

#

Eris*

#

Lol

mossy vine
#

you can tweak with ClientOptions but it wont help a lot

white anvil
#

also im limited to 2gb ram

#

so its precious

modest maple
#

Oof

snow urchin
mossy vine
#

ask the api

white anvil
#

yea lol

delicate zephyr
#

cyber

white anvil
#

wtf is the api running on :3002

snow urchin
#

the main bot

mossy vine
#

@delicate zephyr what

wise quartz
#

How to make a disable/enable {command} system? (Python: GWcodesPython)

snow urchin
modest maple
#

You add and if statement

#

If command enabled run it

white anvil
#

use a db, store disabled commands in the db, query it to check if disabled, if disabled dont run the command

modest maple
#

Else

#

Dont

#

Ez

wise quartz
#

i did that but

#

i mean is there a better way?

delicate zephyr
#

no

modest maple
#

I mean what else is there

#

U gotta check somehow lol

white anvil
#

hardcode them

viral spade
#

So when switching from discord.js to eris, is there some major things to consider? Whats the biggest differences?

white anvil
#

eris is more low level and has less helper features

mossy vine
#

documentation is a headache

wise quartz
#

the thing works rn but.. well almost works. the disable/enable commands can disable and enable any command even if its not in my bot and adding a check for 58 commands is quite hard so i tried making a list and checking if the command name is in that list but it didn't work. (Python: GWcodesPython)

viral spade
#

can you give example of a helper feature?

white anvil
#

message embed class

mossy vine
#

MessageEmbed

#

collectors

white anvil
#

User.tag

hardy vector
#

how can i host a lavalink music bot on replit
since lavalink requires java

mossy vine
#

you cant

white anvil
#

its mind blowing how many people complain in eris channel in dapi that there is no User.tag

modest maple
#

You cant

#

Don't even try running a music bot on a free host

mossy vine
#

i love the freedom of writing my own library. sure it comes with a lot of headaches but the freedom it gives me with what i want to integrate and in what way is totally worth it

white anvil
#

i wouldnt do it from scratch

#

if i made my own shit i'd use a premade gateway implementation

#

bcuz lazy

mossy vine
#

gateway is easy

#

until you get token reset at 5 am

#

because you yeeted your bot in a reconnect loop

#

the hard part for me was ratelimiting

#

but i stole some code from github and its nice now

white anvil
#

very low level socket

#

doesnt do ratelimiting or anything for you

hardy vector
#

what are websockets

white anvil
#

its just a wrapper over the gateway

#

websocket is a method of establishing a persistent connection between two machines over network

mossy vine
#

@hardy vector sockets over the web

#

isnt a websocket just a fancy tcp socket anyways

viral spade
#

So eris is mostly better because i can disable caches?

white anvil
#

eris still doesnt provide great cache control

#

its better but its not great

#

eris is better for other reasons though

#

it has way less bloat

viral spade
#

so why does discord.js not add this?

white anvil
#

because it sucks

mossy vine
#

i had to work with discord.js earlier today and im pretty sure it decreased my life span by at least 5 years

viral spade
#

haha

mossy vine
#

(await message.reactions.get().users.cache.fetch()).array() just fuck off what is this

viral spade
#

then i should be dead already

fickle arch
white anvil
#

yes

mossy vine
#

yes

fickle arch
#

i don't have clue to do it xd.

white anvil
#

Channel.createMessage({embed: ...myEmbedStuff})

#

read the docs

mossy vine
#

put it in an embed xd

fickle arch
#

ah okay, last time i make embedded profile i screw it up for a while.

white anvil
fickle arch
#

thanks !.

hardy vector
#

do you know how to make it so that when someone votes for my bot they get x coins

steel drum
#

thats an EXTREMELY vague question

mossy vine
#

use webhooks

fickle arch
#

still the same like before or i just still need to understand more xd.

viral spade
#

so we have eris, detritus, is there any other javascript frameworks for big bots to check out?

mossy vine
#

detritus?

white anvil
hardy vector
#

and akairo

#

thats for TS tho

white anvil
#

that’s a framework

#

not a library

hardy vector
#

oh

mossy vine
#

well

#

is there any other javascript frameworks for big bots

white anvil
#

in that case eris and detritus aren’t frameworks

#

they are libraries

mossy vine
#

correct

viral spade
#

so in eris, is caching of everything on by default and i cut it off, or the other way around?

white anvil
#

caching is enabled by default

steel drum
#

@fickle arch try to deconstruct the embed object by doing send.channel.send({embed});

white anvil
#

im not sure how modular it truly is but it’s not very

#

Detritus is best option if you want full control

steel drum
#

what exactly does detritus offer over discord.js?

#

just curious

viral spade
#

how will it affect the way i write the bot when using detritus? (except from not haveing an embed class)?

steel drum
#

oh

white anvil
#

better caching, better api implementation, less bloat, better stock command client

steel drum
#

its a typescript library

fickle arch
#

@steel drum ok gonna tried it.

white anvil
#

@viral spade all libraries are different

steel drum
#

i was considering refactoring my project

mossy vine
#

@steel drum better cache control, less bloat from what i see

steel drum
#

to typescript

white anvil
#

you won’t write any two libraries the same way

steel drum
#

might look into this

white anvil
#

@steel drum detritus can be written with js

steel drum
#

i was considering typescript anyways

white anvil
#

it’s a ts library but you can use js when implementing it

quartz kindle
#

so i just added guild.channels.fetch() to my djs framework, because for some reason djs doesnt have it lmao

fickle arch
#

still the same @steel drum

steel drum
#

¯_(ツ)_/¯

#

try making const into let?

white anvil
#

honestly the callback based command client in detritus is dope

#

very easy to extend

viral spade
#

whats the biggest types of caches that should be considered deactivating, if you dont need them?

white anvil
#

presences

quartz kindle
#

presences can be controlled via intents

#

so technically they can be disabled on any lib