#development

1 messages · Page 1806 of 1

earnest phoenix
#

So what exactly are you trying to do here, send your error here or your bot's errors to a specific channel?

rapid wharf
#

and trackback

earnest phoenix
#

By trackback do you mean the stacktrace?

rapid wharf
earnest phoenix
#

What exactly do you mean by "trackback"

wide wharf
#

but where in my code and how?

earnest phoenix
rapid wharf
#

@earnest phoenix uhh i m sorry its Traceback

#
Traceback (most recent call last):
  File "e.py", line 7, in <module>
    raise TypeError("Again !?!")
TypeError: Again !?!
earnest phoenix
slender thistle
#

discord.py has on_command_error event that passes context and the raised exception for commands extension

earnest phoenix
rapid wharf
#

@earnest phoenix so is this correct??

@client.event
async def on_command_error(ctx, error):
    try:
       ch = .......
       ch.send(error) # is  this correct??
    except:
       # what to do here???
       pass
wide wharf
# earnest phoenix Look at the stacktrace of your error, in `index.js`, line `124`, column `204`
client.on('message', async message => {
    if (message.content.startsWith('!help')) {
        message.channel.send('https://discord.gg/NqQ8mqW')}
    if (!message.guild) return; // No DM Messages Allowed!
    if(message.channel.id === "851716854471852042") return; // Avoid duplicate logs
    if(message.channel.id === "668445747611435008") return; // Avoid secret channel logs
    client.channels.cache.get('851716854471852042').send('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: @' + message.member.user.tag + ' \nMessage: ' + message.content);
});
``` 118-125
earnest phoenix
#

Remember to await the promises/coroutines

rapid wharf
slender thistle
#

on_command_error is emitted when an error actually occurs

#

error is the exception, ctx is the context object for your command

earnest phoenix
slender thistle
#

Well, more or less it's correct

#

Actually I'm blind

wide wharf
rapid wharf
earnest phoenix
signal estuary
#

msg.channel.send(error.stack)

slender thistle
#

Eh nothing apart from probably doing something helpful when an error occurs when sending a message in the event itself

earnest phoenix
rapid wharf
#

oohh

signal estuary
rapid wharf
#

yes its py

signal estuary
tribal siren
#

ok hi lol, im once again stuck with the slash commands, this time it won't let me updateOverwrite the voice channel seriously it says no error but it just doesn't do any changes.

else if(command === 'update_role'){
  const role = args.role;
  const voice = bot.guilds.cache.get(interaction.guild_id).channels.cache.get(db.get(`voice_${interaction.channel_id}`))
  const permission = args.new_permission;
  const state = {
    2: true,
    1: null,
    0: false
  }
  voice.updateOverwrite(role, {
    permission: state[args.state]
  })
  bot.api.interactions(interaction.id, interaction.token).callback.post({
    data: {
      type: 4,
      data: {
        content: 'Done!'
      }
    }
  })
}```
#

let me send the needed media

humble rock
tribal siren
#

so this is me using the command and it's successful

humble rock
#

why

tribal siren
#

this is the succesfull code take

lyric mountain
#

that's why it's called const

rapid wharf
tribal siren
#

and this is what was supposed to be a true

#

so what am i doing wrong?

humble rock
#

it's the first time im using js

lyric mountain
#

that's a js thing not djs

slender thistle
#

and you're good

tribal siren
#

oof

jovial elk
#

discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000

Anyone has an idea of what causes this error? It happens once in a while

viral spade
#

Please, explain this to me...
discord.js, voiceStateUpdate.js

tribal siren
#

what do you want to get explained

viral spade
#

When i print this Object i cannot find a certain property in the list. When i access the property it is there.

tribal siren
#

show the console

sudden geyser
#

That's because members is defined as a getter rather than a property @viral spade

wide wharf
#

"Bot has started, with 6 users, in 3301 channels of 124 guilds."

Can't be 6 users lmao

#

Why doesn't it work correctly?

opal plank
#

CAN

#

not cant

#

it means u dont use the MEMBERS_INTENT

#

so it caches them as they send messages

lyric mountain
#

and by no means all users will be cached at all times

opal plank
#

you need the intent to load all members

wide wharf
opal plank
opal plank
lyric mountain
wide wharf
#
console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`); 
opal plank
wide wharf
lyric mountain
#

lul

opal plank
#

in the intents u put on ur code

#

djs has an intents array u pass

#

when u initiate ur client

viral spade
wide wharf
opal plank
lament rock
#

@opal plank you need the presence intent to have all guild members sent on guild create. members intent does allow for fetching all members but not until the client reaches a post ready state

opal plank
#

tell that to them tho

#

not me

lament rock
#

May have just misconstrued your words then. My mistake sadthumbsup

opal plank
#

my lib makes it easy to do that instead

lament rock
opal plank
lament rock
#

you dont need guild members for message create member caching

#

the member object is always on the message if sent in a guild

opal plank
#

but i never said that

#

he was asking how to get all members cuz it seemed off having only 6

latent heron
#

so apparently in PHP there's an ability to use indents for if statement calls

#

inherited Java/C++ logic

opal plank
#

so i explained those 6 comes frmo passively caching them

lament rock
#

And that's why I may have misconstrued your words

latent heron
opal plank
#

i see

lament rock
#

kinda looks like scuffed java

latent heron
#

don't disrespect java like that 😔

lament rock
#

java make memory usage go brr

latent heron
#

it's actually not that bad on JVM

#

compiling is when it becomes dogshit

sudden geyser
#

No, it's still pretty bad during runtime.

lament rock
#

Run time is still pretty meh. LavaLink advertised itself as having a low memory footprint when it takes 1GB in prod with < 5 active players

latent heron
#

not if you use it right

sudden geyser
#

Ah yes, you're using it wrong

latent heron
#

yeees

rapid wharf
#
@client.event
async def on_command_error(ctx, error):
    ch = client.get_channel(id=862010583783178273)
    await ch.send(error)
``` This code only gives me the error msg, how to send the traceback
latent heron
#

you use traceback module

rapid wharf
lament rock
#

suggesting

rapid wharf
#

how to use that??

latent heron
#

you import it

rapid wharf
#

oooo

rapid wharf
#

?rtfm traceback

#

no Danny bot

lament rock
#

use google

rapid wharf
#

yeah

lyric mountain
#

unless raw java is slower ofc

#

but who uses raw java nowadays?

latent heron
#

that's what i'm thinking right

modest maple
#

Idk you might go back to raw java depending on how oracle continue to play their licensing game lol

#

oh noe

lyric mountain
#

oracle is shit, I doubt anyone will go back to it

#

openjdk ftw

modest maple
#

thats what i mean

earnest phoenix
#

What status code should i return when a user reached a limit of items? Like too much autoroles.

modest maple
#

you mean like on an api?

#

or?

earnest phoenix
#

yes an api

digital ibex
#

400 means bad req so maybe thats most suitable 🤷

lyric mountain
#

maybe?

#

but yeah, that status code u want is too specific

sacred aurora
#

Or just 429

lyric mountain
#

429 is ratelimit

sacred aurora
#

Too many request

#

Not just rate limit

earnest phoenix
sacred aurora
#

Yeah but maybe 413 is perfect for it

earnest phoenix
#

yea i think so

wide wharf
rapid wharf
#

@latent heron i wanted to send the whole thing from terminal to a channel but how to??

#

whole traceback and the error

lyric mountain
#

you probably don't want to do that

rapid wharf
lyric mountain
#

char limit says you don't

rapid wharf
#

its 2000 characters na??

lyric mountain
#

ye

rapid wharf
#

so it can come

lyric mountain
#

complete tracebacks/stacktraces are reeeeeally long

#

unless you send it as a file, you won't be able to

lament rock
#

Stream the file data in chunks instead of accepting it all in one go

rapid wharf
quaint siren
#

The bot tag whould fit my name

#

How do u get the bot tag

lyric mountain
#

bot tag?

rapid wharf
#

@lyric mountain ```py
@client.event
async def on_command_error(ctx, error):
ch = client.get_channel(id=862010583783178273)
await ch.send(error)

earnest phoenix
#

Or if you want to see all the hidden getters/setters/non-enumerable properties or other stuff, set the showHidden option to true

#

Example:

// ---
// You can get the inspect method in both ways, just use the one declared in your module specifications

// CommonJS require util
const { inspect } = require('util');
// ES6 import util
import { inspect } from 'util';
// ---

// An object with a getter
const obj = {
  get test() {
    return this.valueOf();
  }
};

// Inspect the object
const inspected = inspect(obj, {
  showHidden: true
});

// Log the inspected object
console.log(inspected);
// Output: { test: [Getter] }
signal estuary
#

How can I get all permission listed for a role?

let perms = Checkrole?.permissions?.joinToString("\n")

does not work

earnest phoenix
heavy marsh
#

in d.js - v12.5.3

    var type = [ "audio/mpeg", "audio/vorbis", "audio/aac" ]

    let Stream = args[0];
    let RStream = await fetch(Stream);
    let StreamCT = RStream.headers._headers['content-type'];

I am trying check if StreamCT [content-type] doesnt have a type one of these types

#

Any way to do this without causing errors

earnest phoenix
#

so Rstream is sometimes malformed or without content?

heavy marsh
#

no

#

without a contect in the type

var type = [ "audio/mpeg", "audio/vorbis", "audio/aac" ]```
#

basically I am checking if its not a audio

earnest phoenix
#

any which error do you get?

heavy marsh
#

I dont get errors it doesnt work

#

It might be wrong

#
if(!type.some(verify => StreamCT.includes(verify)))
stuck dawn
#

Hey, why is giving me this error?

quartz kindle
#

if you're using the latest dev versions, thats no longer supported

#

the correct way is ```js
message.channel.send({
embeds:[e]
});

sudden geyser
#

I think it's just embed: e

quartz kindle
#

not in the dev version

sudden geyser
#

Ah, it is like that

orchid vortex
#

hi

#

its me again

sudden geyser
#

[HTML] Is there any difference between using and omitting a p tag?

<body>Yeah</body>
<!-- vs. -->
<body>
  <p>Yeah</p>
</body>
vivid fulcrum
#

well... yeah

#

your text won't be in a paragraph

quaint wasp
#

uhhh

#

Why doesnt it reply?

vivid fulcrum
#

what is it

quaint wasp
#
            if(args[0] === 'become') {


                if(!args) {
                    message.channel.send(becomeE)
                }
                
                if(args[0] === 'server') {
                    message.channel.send(serverE)
                }

                if(args[0] === 'bots') {
                    message.channel.send(botsE)
                }

                if(args[0] === 'website') {
                    message.channel.send(websiteE)
                }
            }
vivid fulcrum
#

because that code is never going to execute

quaint wasp
#

why

vivid fulcrum
#

if args[0] is already become and it passed that statement

#

then args[0] cannot be something else

#

cmon

#

brain exercises

quaint wasp
#

oh

#

lol

#

than others should be args[1, 2, 3, 4?]

vivid fulcrum
quaint wasp
#

like args[2]

vivid fulcrum
#

it's your code

quaint wasp
#

ok

vivid fulcrum
#

i don't know what you want to do with it

quaint wasp
#

Be smart lol

orchid vortex
#
Array.prototype.uniqueCombinations = function () {
  let r = [],
    l = this.length;
  for (let i = 0; i < l; i++) {
    let t = this[i];
    for (let j = 0; j < l; j++)
      if (j != i) r = [...r, (t += this[j]), [...t].reverse().join("")];
  }
  return r;
};

let all = "abc".split("").uniqueCombinations();
console.log(all);
/*
[
 'ab',  'ba',  'abc',
  'cba', 'ba',  'ab',
  'bac', 'cab', 'ca',
  'ac',  'cab', 'bac'
]

not good!
*/

im trying to make a prototype method to let me list all unique combinations of every array element up to its length, but this isnt doing the trick, any idea how to improve it while maintaining the simplicity and compatibility with 10+ elements?

woeful pike
#

might wanna look up example algorithms using that word first

quaint wasp
#

and replys all if you do all commands

#

ping in reply if going to reply 😅

heavy marsh
#

Does anyone known a good + affordable host for music bots?

novel jetty
#

Does someone know how to fix this?

heavy marsh
#

message.buttons is not a funtion

novel jetty
#

Yea but how do i fix this?

heavy marsh
#

d.js right?

novel jetty
#

Yes

heavy marsh
#

Version?

novel jetty
#

12

#

12.5.3

heavy marsh
#
#

Messages doesnt have buttons

novel jetty
#

Thanks

heavy marsh
#

not really a help - No worries but

open flicker
lyric mountain
#

deduce?

#

you mean list all?

open flicker
#

about all user reasons from the database

lyric mountain
#

yeah but, you want to list all reasons at once in that embed?

open flicker
#

in embed i can't list all the reasons am i right?)

lyric mountain
#

you can

#

I'm trying to understand what you want

open flicker
#

yes, I want to list all the user's reasons in embed, but if this is possible

lyric mountain
#

or use fields

#

just note fields are limited by 25/embed

open flicker
#

okey

viral spade
#

How can i fetch a single member in discord.js?

await msg.guild.members.fetch(targetUserId);
this gives me the list with all members

sudden geyser
#

probably won't work

#

nevermind, can't read

quaint wasp
#

wat do you mean probably lol

viral spade
#

suddenly i cant log into the bot anymore "SHARDING_READY_TIMEOUT". Have i been rate limited? if so, how long until i can log in again? discord.js

lyric mountain
#

normally it says right next to the error the timeout

viral spade
lyric mountain
#

doesn't look like a ratelimit error, more like a failed attempt to login

viral spade
#

like wrong credentials?

viral spade
#

i just saw, my token has changed too. but even with the new token, i cannot login... please help

steel pine
#

hi someone know about js please i have a problem

earnest phoenix
#

sure

#

i'll try my best

eternal osprey
#
setTimeout(() => {
wb.Props = {
    Title: "Test",
    Subject: "Test2",
    Author: "Test3",
    CreatedDate: Date.now()
};

wb.SheetNames.push("Names");
wb.SheetNames.push("Emails");
wb.SheetNames.push("Linkedins");
const ws_data1 = [[`${naming}\n`]]; 
const ws1 = xlsx.utils.aoa_to_sheet(ws_data1);
const ws_data2 = [[`${email}\n`]]; 
const ws2 = xlsx.utils.aoa_to_sheet(ws_data2);
const ws_data3 = [[`${urlsys}\n`]]; 
const ws3 = xlsx.utils.aoa_to_sheet(ws_data3);
wb.Sheets["Names"] = ws1
wb.Sheets["Emails"] = ws2
wb.Sheets["Linkedins"] = ws3
xlsx.writeFileSync(wb, 'results.xlsx');
console.log("Check the output folder, the migration and scraping is successful.")
}, 5000)``` hey, why is my excel data only writing to rows instead of columns? I am using xlsx package for this.
#

i am already stuck on this little hiccup for days

opal plank
#

someone is actually using google sheets as a db

plain talon
copper cradle
#

Lmfao

stuck dawn
#

how i can filter the user author only?

eternal osprey
#

I just want to export some data

#

why are you making assumptions so fast lmao

#

take ya chill

opal plank
#

and thats why i made those assumptions

sudden geyser
stuck dawn
#

Yep

#

Using typescript

#

Too

narrow fractal
#

not again

#

why do i see that message everywhere

earnest phoenix
#

How to stop your bot on restarting

lyric mountain
#

discord has micro restarts

quiet pawn
#

how do i make my bot send a message before it restarts with pm2?

#

like into a chat

opal plank
#

Do a funcion on process exit event

#

@quiet pawn

#

Listen to the process event emitter

#

Id use webhooks for that

quiet pawn
#

so instead of making the bot send it make it send through a webhook?

#

is that whatcha mean

opal plank
#

correct

#

the bot is going down anyway

#

no need to hang the lib

#

just use any http service to send it

quiet pawn
#

so when its about to go offline send a thing to webhook to tell it that correct? then get the webhoook to send a message

#

just making sure i fully understand

opal plank
#

well yeah, how are you going to send a message if the bot is closing?

#

which can also work for when ur bot have disconnected from discord

quiet pawn
#

o oki yea makese sense thank you

earnest phoenix
#

hi

#

Who is alive?

plain talon
#

hello

earnest phoenix
plain talon
#

👻

clever agate
#

I'm trying to register my website but it doesn't work.

#

I tried in several ways

quiet pawn
#

@clever agate freenom is broken

#

dont use it

#

they will take your domain for no reason

clever agate
#

so there is another site that registers without needing a credit card?

#

@quiet pawn

quiet pawn
#

like free domain?

clever agate
#

yep

quiet pawn
#

you can get free domain on there

#

idk about vredit card tho

#

i personal have paid domains i never used free ones

clever agate
quiet pawn
#

weird

#

idk what to say then, even if you do get a free domain you can technically lose it anyday

#

thats why its free

clever agate
#

lol

#

tysm

plain talon
#

namecheap give u domains like .pw for like 88 cents

quiet pawn
#

well yea

#

ye ik

#

weird doe

#

or a like acess to certain places maybe

#

even tho that would make no sense

plain talon
#

ok you can get a .xyz on namecheap for 88 cents

quiet pawn
#

yea i got mine for 99 cents

#

and my 2 .space domains for 99 cents also

plain talon
#

.pw used to be on the 88cent offer

lyric mountain
quiet pawn
#

i use that for domains

#

and cloud flare for dns ofcourse

#

i have 3 domains for my image hoster

fair axle
#

What is the advantages of using schemas for mongodb. Do I have to use it?

dense flame
#

You have to use it if you're using mongoDB as a database. It defines the content of documents in a collection.

earnest phoenix
long crow
#

Should I separate module or it is ok under 1 hood, I mean the module anime seem going growing larger now.

#

Talking about this

sudden geyser
#

Could you provide more detials?

sudden geyser
#

I don't see anything wrong with keeping it in the same file/class.

long crow
#

It is just 1 part of the discord bot though, so kinda make it seperate package

#

or just leave it be

dense flame
#

better to leave it be

sudden geyser
#

It's fine if your modules are large.

#

What matters is the functionality and its purpose.

long crow
#

any good reasoning behind it? 🤔

sudden geyser
#

The majority of the file is your Anime class, and trying to split up a class is weird. Though, there are other ways to solve this. For example, you could think simpler and not use a class in general.

#

Also, why are you using jikan? Why not use MyAnimeList's official API?

long crow
#

Yea, it is all related to anime referring to jikan api

#

I dont really understand the url redirect part

#

basically, i dont even have domain to begin with

sudden geyser
#

You should be able to set your application type as web

long crow
#

as of Class it mainly for me practice using/learning Class/Constructor

#

I think I can use module.exports as well, but that beat the purpose for me learning

sudden geyser
#

Ah, okay

long crow
#

I think I can separate constant into another file, as I'm going to make Manga class soonish

lyric mountain
sudden geyser
#

Yeah

lyric mountain
#

When and where?

sudden geyser
#

It's limited, but it's here

#

Like a year ago maybe

lyric mountain
#

Ah, that's why then

#

I've been using anilist since the start

sudden geyser
#

Keep using it

#

Much better

lyric mountain
#

Meh

lyric mountain
#

First being setting fields by name for those objects since you're using the exact same naming as the returned payload

long crow
#

Can comment on my repo if you willing to

lyric mountain
#

Nah, already buzy with my lib

west spoke
#

quick question

#

ping me with answer

#

what's the limit on the ID of a button

#

ie how many characters can it have

lyric mountain
#

100 chars

west spoke
#

Ah, alright

earnest phoenix
#

help^me ?

prime mist
#

In other words, you cannot read the property length of undefined.

earnest phoenix
#

and how i can fix this ?

wheat mesa
#

By not reading length of undefined

opal plank
earnest phoenix
#

is cjs or es6 better for a command handler

#

since es6 is async

lyric mountain
#

Cjs?

opal plank
#

what?

lyric mountain
#

Es6 for command handler?

opal plank
#

es6 is async?

#

we had async since es4

#

since 2017 actually

earnest phoenix
#

ill have to await the imports if i use dynamic es6 imports

#

commonjs is synchronous tho

lyric mountain
#

Js is mono-thread

opal plank
#

no?

#

if u using import(), then yeah

#

that async

#

but why would that matter?

#

you can just require() it

#

just gotta use require().default if u using default exports

#

thats the only real difference

earnest phoenix
# opal plank no?

this is synchronous:

import anime from "erwin";

this is not:

for (let cmd of fs.readdirSync("./commands")) {
const data = import(`./commands/${cmd}`);
}
#

what if someone runs the command before it's registered cuz async

lyric mountain
#

Why don't u just cache the commands?

opal plank
#

cuz they are different things

#

like i said

#

if someone wants to run a command you make it async[

#

and let them handle it

#

or require() like i said

earnest phoenix
#

and also because es6 looks awesome

opal plank
#

or run that only once the bot has emitted a ready state

lyric mountain
#

Just purge the cache

#

Tbf, there's a myriad of ways you could make that work

opal plank
#

OR, better yet, only run your bot ONCE that has been fullfilled

earnest phoenix
#

Yeah

opal plank
#

make sure the bot is ready before running it

earnest phoenix
#

I'll emit a custom event when the commands are done

opal plank
#

you dont need to

#

just dont wait for it

earnest phoenix
#

ok

opal plank
#

a command isnt loaded, so what?

#

its not gonna error

#

its just not gonna output anything

#

and regardless, this is a one time thing in the startup

#

at best you looking at one or two poorly timed users doing that

earnest phoenix
#

ight

opal plank
#

we gave u plenty of options, just pick one

lyric mountain
#

Or just make a "Loading command..." message

#

And execute it once ready

#

That way you don't even need to hang the bot while loading commands

opal plank
#

or queue log ur messages

#

and then run them once the commands have been loaded

earnest phoenix
#

or
ignore the poorly timed users

opal plank
#

exaaactly

#

less work for u

earnest phoenix
#

@opal plank this lookin good?

import { CommandoClient } from "discordjs/commando";
lyric mountain
#

Comando...

opal plank
earnest phoenix
#

alright

opal plank
#

i mean, if u need your daily dose of "discordjs and commando are shit", im more than happy to advertise detritus

earnest phoenix
#

import Detritus from "discord.js";

#

renamed exports bois

opal plank
#

welcome to the civilized world

#

now use detritus instead of that shit

wheat mesa
#

I agree

opal plank
#

commando is as good as my ccode(shit)

earnest phoenix
#

one import only, take it or leave it

wheat mesa
#

Started using detritus a few days ago

#

Already love it

opal plank
#

see?

earnest phoenix
#

still waiting for that deno port
you know you can just run a script to change all internal node api imports to https://deno.land/std/theapi/index.ts
then it will work in deno

opal plank
#

then just do it

earnest phoenix
#

not interested

drifting wedge
#

how do i make a slash command with dpy?

earnest phoenix
#

Hello! I can't figure out how to install node and nodejs latest version on Ubuntu 20.04. I tried a list of things, such as installing them with apt (this didn't install the latest version) and installing nvm to install it this way (which only installed node, not nodejs).

Any help is welcomed!

pale vessel
#

"It installed node, not nodejs"? What do you mean by that?

earnest phoenix
opal plank
#

if node -v is showing, that means nodejs is installed my dude

#

its not 2 things

pale vessel
#

It's always been node

opal plank
#

command node = nodejs

#

its not nodejs -v

#

you already have it

earnest phoenix
#

Well, it says that I only have the earlier version or don't have it at all

#

I've never been more confused in my life tbh lol

opal plank
#

like i said, node -v will give u ur nodejs version

#

the node command refers to nodejs

#

the fact that u can use node means u have nodejs installed

earnest phoenix
#
Error: The module '/home/ubuntu/beycord/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing```
opal plank
#

likely cuz u installed it twice

#

also it doesnt say it twice

#

it says it once

#

use a newer node version

#

uninstall and get a newer one

earnest phoenix
#

I've been trying

opal plank
#

u have 16

#

thats basically latest

earnest phoenix
#

it won't let me for some reason

opal plank
#

try the other commands it suggests

#

rebuild and install

earnest phoenix
#

what the

lament rock
#

@earnest phoenix I don't think anyone here actually cares enough, but if you have password auth set up, I'd probably consider changing your ssh port and setting up sha-256 public key login for your server or else people would be able to brute force your ssh password and gain access to your vm

#

after you verify pub key based login works, disable password auth

woeful pike
#

ssh keys really aren't about security, if you have a good enough password it's as good as an ssh key

#

only difference is password auth might get your machine flagged by port scanners and people might try to brute force (unsuccessfully) and that might be annoying

#

only difference for me is ssh keys are convenient

quiet pawn
#

how long ya'll think a 1vcore cpu and 2gb ram should last me

earnest phoenix
#

i say 400 servers

earnest phoenix
# errant flax whats deno

another js runtime made by the guy who made node
it's built on rust and can run typescript and needs no npm

earnest phoenix
quiet pawn
#

damnn

earnest phoenix
#

idk man

#

2gb is a lot because i'm broke

quiet pawn
#

im at 400 and only using 500mb

earnest phoenix
#

so i'm probably getting all this wrong

quiet pawn
#

yea i think so

#

i heard 2gb would get me to 1k and a bit over

#

depending

earnest phoenix
#

i haven't used my rpi for hosting yet lol

quiet pawn
#

i use a galaxygate vps

earnest phoenix
#

solely because of laziness

quiet pawn
#

lol

earnest phoenix
#

like

#

who would want to work on cringe discord bot

quiet pawn
#

me

earnest phoenix
#

that eats your money away like nothing

#

im getting an rpi for my birthday
what should i host on it

#

no clue

#

i'm personally using ubuntu server

#

bland

quiet pawn
#

whats a rpi

earnest phoenix
#

no desktop

earnest phoenix
earnest phoenix
#

lmao

#

since my linux installation broke imma do my linux stuff on it

#

kinda like a persistent trial ubuntu

#

bro

#

i can use my rpi for using linux images

#

with my 32 sd cards

#

but no

#

i choose to use a vm

low river
lusty quest
earnest phoenix
#

i had to allocate 512mb to node

lusty quest
#

i know people here run 2k guilds on 1GB ram

earnest phoenix
#

when i thought it was the entire gigabyte

#

i did the entire thing wrong, lol

lusty quest
#

rip

lusty quest
earnest phoenix
#

i managed to somehow allocate 512mb instead of 1024mb

quiet pawn
lusty quest
#

well

lusty quest
#

or switch to detritus.

quiet pawn
#

it killed my bot las ttime

#

hardcore

lusty quest
#

well then

quiet pawn
#

made everything higher usuage

lusty quest
#

then you did something wrong

quiet pawn
#

i was using 600mb at 200 servers

quiet pawn
lusty quest
#

lol

quiet pawn
#

no errors

#

no nothing

#

nothing was wrong

lusty quest
#

ive had like 95mb with 270 Guilds

quiet pawn
#

as soon as i changed back to djs

#

i was at 90mb

#

i think its because of the apis

#

idk

#

i use alot

#

of stuff

#

plus code is a mess

lusty quest
#

ok

#

it where just a suggestion in saving some money in the end

quiet pawn
lusty quest
#

why tf did you want to use xml?

quiet pawn
lusty quest
quiet pawn
#

o

#

its in a nsfw command

#

im pretty sure

#

i forget

#

i've been using it for awhile

lusty quest
#

xml2js should format xml to a json object iirc

quiet pawn
#

i havent updated that inawhile

#

its old

#

the package list

#

hald those i dont use anymore

#

i might remove it

#

only thing upto date on there is code

cinder patio
#

With d.js light I had a 500 server bot use 70mb of RAM

#

And thar bot also had an express server running as well in the samw process

opal plank
quiet pawn
#

i just stick to djs

#

i run 2 bots on same vps

opal plank
#

i pointed this out last time

quiet pawn
#

so that could be why it says 1gb ram usuage

opal plank
#

but check this

quiet pawn
opal plank
#

in the benchmark test, detritus managed to cache MORE users than djs and still come out as a lot less ram

#

300 more users and 80 mb less than djs

#

```Best Cache Gathering`

Detritus is the best library in terms of which library can cache the most amount of data coming in from the same events. During the entire benchmark, it was consistently obvious that Detritus was increasing much more rapidly in cached users which goes to show that their handling of events and caching is better than everyone. At certain minutes you could easily see Detritus having gained several hundreds more users as opposed to the other libraries.```

quiet pawn
#

damn

opal plank
#

its absurdly worth moving to detritus

quiet pawn
#

i have never heaed of Detritus

opal plank
#

as much as i meme about it

quiet pawn
#

is it js?

opal plank
#

thats the best part

#

js AND ts

quiet pawn
#

both my main langos

#

lol

opal plank
#

its made purely in ts, but will work absolutely fine in js, you just wont get the benefit from the intellisense we ts users get if u chose to use it in js

#

i have a demo repo if u want to just spin it up

quiet pawn
#

umm

#

i dont mind

#

idk if i will move for a bit

opal plank
quiet pawn
#

but why not

opal plank
#

everything is commented, along with a debugger attached to help in development

quiet pawn
#

well i stared it for now

#

ill probably try it out tomorow

#

when i wake up or something

opal plank
#

sankyu

quiet pawn
opal plank
#

its good as a basic framework. just dump your commands in src/commands and event handlers onto /srv/events/...

#

thats about it

quiet pawn
#

swag

solemn jolt
#
client.on('messageReactionAdd', async (reaction, user)=>{
  const { message, emoji } = reaction,
  {channel, guild} = message ;
  if (message.partial) {
    try {
      await message.fetch();
    } catch (err) {
      console.error('Error fetching message', err);
      return;
    }
  }
  if (channel.id === "862010594601336903") {
    if (message.id === "862211028464042035") {
      let role = guild.roles.cache.find(role => role.name === emoji.name)
      try {
        user.roles.add(role);
      } catch (err){
        console.error(err)
      }
    } else {
       console.warn("no message id")
     }
  } else {
    console.warn("no channe id")
  }
});```
Why when i run the bot this is work just for a new message don't work for old message
errant flax
#

bc the event only works for cached messages

#

u can add a "REACTION" and "MESSAGE" partial to work

#

but u wont get any useful information with partials hmm

#

ud have to fetch them urself

#

@solemn jolt ^

solemn jolt
#

My question is i send a message yesterday

errant flax
#

wait i think u just use message partial instead

lament rock
#

you shouldn't have to store user or count data on reactions unless you're doing a giveaway fn

solemn jolt
#

And this code don't work on the old message

lament rock
#

raw gateway reaction_* events are enough

solemn jolt
#

No i just want add this

#

By reaction

#

For role color

lament rock
#

Then you can add reaction partials safely or listen for REACTION_* events on client raw event

solemn jolt
#

Bro i add this

#

For old reaction this event don't work

#

But dor new reaction work

#

How i can fix this

lament rock
#

In Discord.js messages have to be cached (aka, they have to be sent after your bot comes online) in order for message reaction events to be emitted. Partials for reactions enables the event to be emitted on all messages regardless of if it's cached or not, but not all data will be there including all users who have reacted to it and the count of specific reactions per emoji

errant flax
#

yes

#

u can do that if the message is a partial

lament rock
#

No

errant flax
#

wait wut isee

solemn jolt
#

Why

lament rock
#

Well. You can fetch the message if you know the ID, but if you want to be generic, then you can't unless you store the IDs of messages you intend to keep

solemn jolt
#

Just

#

I do this

errant flax
#

u dont need the msg id?

solemn jolt
#
client.on("ready", ready=>{
let guild = client.guilds.cache.get(id guild)
let channel = guild.channels.cache.get(id channel)
channel.messages.fetch()
})
lament rock
#

You need an instance of the message to fetch which isn't available unless it's cached which old message pre boot are not cached. You can fetch messages by ID in ChannelMessageManager

errant flax
#

oh i meant a partial message

lament rock
#

channel messages fetch only fetches the last 100 messages in a channel

solemn jolt
#

Ok 👌

errant flax
#

oh it does 322_eth_flushed

#

i thought it could fetch if u input the id of the message

lament rock
#

It accepts a wide range of options to fetch messages

#

you can get by IDs

errant flax
solemn jolt
#

Like fetch(id message)?

lament rock
#

Yes

solemn jolt
#

Ok than you all

lament rock
#

if you don't supply a message ID, it fetches the last 100

solemn jolt
#

🤟

errant flax
#

wait lemme check

solemn jolt
lament rock
#

yes

#

if you pass a message ID, it doesn't matter how old it is or where it sits in relation to message count

#

it will fetch (granted you have permissions to fetch)

solemn jolt
#

Ok 👌

errant flax
#

oh yeah u can
TextChannel.messages.fetch({limit:100})

solemn jolt
#

Ow thank you 😊

#

Now I'll coding goodbye 👋🏻

long crow
lament rock
errant flax
feral aspen
#

embed: is now embeds:

#

.. NICEEEE. 👏 👏 👏 👏 👏

dense flame
lusty quest
#

cant wait for the wave of Pull Stack devs complaining that the 1 year old Repo they borrowed from Github doesnt work anymore

long crow
long crow
lament rock
#

Uh. Yes. One moment to open source the repo. One thing to note is that op filters and op seek doesn't work

#

Need to add that at some point, but I'd have to fuck around with ffmpeg

feral aspen
#

Any website to check the changes in V13?

#

Can't seem to find any.

feral aspen
#

interaction.reply({ content: 'Hello!', ephemeral: true });

#

What is ephemeral?

lament rock
feral aspen
#

No

#

No

#

NOOO

#

TF is ownerId

long crow
#

^something like this is ephemeral

feral aspen
feral aspen
#

Bro.. channelID not channelId.

#

Keep it.

#

A lot of changes are literally so unnecessary.

long crow
#

Don't ask me, not my lib

#

btw, bookmarked the github link, will try out over the weekend

feral aspen
#

You guys rewriting your bots for this?

long crow
#

I have less related code related to guild related or something related to id specific

#

so not a big issue

feral aspen
#

I never used serverID before except for MongoDB models. 🤷‍♂️ 😂

pale vessel
#

drake_nope serverID
drake_dope guildID

lament rock
#

high level libs be like

#

Might make a public instance of my LavaLink rewrite to stress test

#

unironically host it on heroku

cinder patio
pale vessel
#

what if I'm next to the person and I can see their screen

feral aspen
#

Some updates are really stupid/not necessary.

cinder patio
#

good point

copper cradle
#

Smort

feral aspen
#

😉 😂

earnest phoenix
#

a

cinder patio
#

a?

earnest phoenix
#

a.

copper cradle
#

ª

earnest phoenix
#

watt

pale vessel
#

kilowatt

opal plank
#

megawatt

sick agate
#

Gigachan

errant flax
#
console.log(tyepof data.questions)

why is it logging an object? when its an array

pale vessel
#

Arrays are object

errant flax
#

wait wut

pale vessel
#

use Array.isArray(data.questions)

errant flax
#

and also when i console log the questions its shows like a json string?

pale vessel
#

Think of arrays like this { 0: "value", 1: "value" }

errant flax
#

oh

#

that makes sense now

sick agate
#

Its dict?

errant flax
sick agate
#

Nvm me i am used to use python words

lament rock
#

Poggers

#

it works

long crow
#

Why hellroku though

lament rock
#

If anyone wants to test my public lavalink rewrite instance, feel free to add

host volcano-test.herokuapp.com
port 80
pass "youshallnotpass"

I would like to stress test it.
no op filter or op seek support. HTTP file getting is not enabled.

#

just for the memes. Idle memory usage is 13MB

earnest phoenix
#

Cuz free exdee, it's a test env after all

#

Das pog doe

lament rock
#

I doubt it'll hit 500MB

earnest phoenix
lament rock
long crow
#

400mb is how long song can go on

restive furnace
#

tho why not make it in C++ mmLol, more efficient

lament rock
#

Bc idk c++ and I'm good at memory management in node as is

runic depot
#

and c++ is cringe for discord usage

restive furnace
#

actually, more speed = less code

#

more instructions == slower code

earnest phoenix
lament rock
#

:)

#

please save me the trouble of dealing with ffmpeg

#

filters is gonna fucking kill me

runic depot
runic depot
restive furnace
#

though, it's not really old, there's just a lotta backwards compability

restive furnace
runic depot
#

for ex. you can use compiler for python to get nodejs speed

restive furnace
#

compiled python is illegal

runic depot
#

no not compiled

#

compiler

#

it's totally different

restive furnace
#

compiler compiles

runic depot
#

compiled python is .pyc and it has no effect on speed

#

but using compiler to run code, has effect on speed

restive furnace
#

if you use compiler to run code, it's called intepreting

runic depot
#

faster compilers are those one who, first translate code to like cpp or ... and then run it

lament rock
#

interpreters are compiled

restive furnace
#

via automated way

runic depot
#

but slower ones are those who just translate and immediately run

runic depot
lament rock
#

I believe you misunderstand.

restive furnace
#

it's intepreting it via v8

runic depot
#

yes

restive furnace
#

and v8 is compiled

runic depot
#

chrome's engine

restive furnace
#

but it doesn't compile your code, it inteprets it

runic depot
#

hmmm

#

lemme search, i think i don't know...

restive furnace
#

search compiling vs intepreting

runic depot
#

ok

lament rock
#

The JIT "compiler" does create bytecode, but that's different than compiling it to another language

restive furnace
#

yeah, it'll go rougly like this: lexer runs to parse the code -> generate bytecode -> run the bytecode

#

or so

#

and thar happens everytime you restart your app

#

vs compiling into native application: ONCE: compiler parses the code -> does optimization -> generates machine code
WHEN you run your program: CPU executes instructions in the machine code

lament rock
#

You kinda can't compile JS to machine code since it's loosely typed

#

which kinda sucks

#

but eh

sick agate
#

Is v8 joke?

#

V8 is the thing that does the job

lament rock
#

Depends on what you're after. There is a bit of overhead with V8 or it's derivatives, but it can still be very good at speed. If you really want to profile it vs a clang, the difference could be negligible depending on how well the dev optimizes on both ends

restive furnace
lament rock
#

yeah ik

restive furnace
lament rock
#

key word might

#

millisecond delays are barely noticable in end user applications depending on scale

restive furnace
#

if you run single-threaded game server for roughly 10 000 daily users

lament rock
#

good thing js can multithread

#

because no one is sane if they try to scale a single threaded application

#

writing my lavalink rewrite kinda helped me realize how multithreading can be difficult. There are plenty more areas where things can go wrong if you don't properly structure your thread messages, although the same can be said for IPC.

#

was painful ;w;

restive furnace
#

and so can C and C++

lament rock
#

webJS and node can multithread

#

which is pretty much most applications

novel jetty
#

Can someone help me with this please?

pale vessel
#

There is no message

#

Member has the guild property so use that

#

guildMemberRemove has nothing to do with message

errant flax
#

idk why they thought the event has msg params lookaround

pale vessel
quiet pawn
pale vessel
#

If you use those mimu emojis unironically I don't know what to tell ya

errant flax
#

mimu emoji gang

#

anyways not development related

novel jetty
earnest phoenix
#

I love how react DEV tools is warning me about using the dev build of react

earnest phoenix
#

If you use a event handler the provided code is incorrect

novel jetty
earnest phoenix
#

create a file named by the event

#
module.exports = (client,member)=>{

}
novel jetty
earnest phoenix
#

named by the event so guildMemberRemove.js

novel jetty
#

I have that

#

And its messageDelete

#

@earnest phoenix

errant flax
smoky kelp
#

oh, sorry

#

thanks @errant flax

earnest phoenix
#

<Member>.guild.id

signal estuary
#

How can you get a text channel by mentioning it?
I only know how to get a channel by name:

msg.guild.channels.cache.find(channel => channel.id === newChannel)

But how can I get a channel by mentioning it. So instead of "djs-help" -> "#djs-help"

errant flax
lyric mountain
#

it's the same thing

#

just instead of getting <channel>.name you get <channel>.id

errant flax
#

anyways what do u guys do for fun when ur coding hmm

lyric mountain
#

i code

errant flax
#

wow i wish i could do that/j KEKA

lyric mountain
#

I mean, I find quite entertaining to code

signal estuary
lyric mountain
#

yes

errant flax
#

ye and that returns a collection of channels that got mentioned

errant flax
#

even when i rage if i dont fix the error FLOOSHED

earnest phoenix
#

Mostly errors can get fixed by debugging. Instead of searching years for the bug. with console.log or converting types ...

errant flax
#

ye logging is my best friend for debugging bonk

opal plank
errant flax
#

wym

opal plank
#

use breakpoints and ACTUAL debugging

#

you'll never use console.log for debugging

#

conditional breakpoints and normal breakpoints is what you actually use for debugging

#

and if u want to reduce the amount of bugs even further, use typescript

errant flax
#

discord aint loading wtf

opal plank
#

basically it stops the code execution whenever it hits that line

#

so you can see real time variables and values

#

say, for example, client.on('message', (message) =>

#

@solemn latch

#

anyway

solemn latch
#

rip bot dev 😦

opal plank
#

whenever you hover at (message) you'll see its actual value

#

real time

opal plank
#

prob hacked tbh

solemn latch
#

yeah

lyric mountain
opal plank
#

never tried it, but holy shit vsc has some powerful shit

#

the conditional breakpoints alone makes it worth imo

#

never again have to change code to "debug" something

errant flax
#

most of my errors is me mispelling lmaoCry

opal plank
#

use typescript, you'll love it

errant flax
#

too lazy ill have to transfer all of my files FLOOSHED
or whatev to use ts

lyric mountain
#

ts is js with flavor

errant flax
#

i might consider it tho

opal plank
#

imagine until they realise ts is js

errant flax
#

just too laxy

#

lazy*

lyric mountain
#

dynamic typed -> less verbose/hell to debug
static typed -> more verbose/feels good man

opal plank
#

well, good luck restarting 40 times until ur bot works

#

ts screeches at u real time while you type it down

errant flax
#

aight u convinced me enough

#

im gonna do it tmr KEKA

opal plank
#

bet

errant flax
#

its 10pm

lyric mountain
#

also static typed langs have the advantage of not letting you even compile without fixing syntax/major logical errors

opal plank
#

which is great cuz that saves u from bugs later down the line

#

rather than just encountering that bug weeks later whenever a user accidently steps on it, ts tells you right away when you try to run it

lyric mountain
#

tbf that's what made me love java instead of javascript

opal plank
#

i like the flexibility of js

#

apart from rendering and apps, its greatyl malleable for everything

#

browser AND rest

#

apis, servers, bots, websites, controllers

#

typescript is just what it needed, which is more type safety

quiet pawn
#

anyone know how to do more then 1 row with buttons?

lyric mountain
#

you can just add a new actionrow

quiet pawn
#

i did

#

nothing changes

opal plank
#

in the components field

#

add another whole new object

quiet pawn
opal plank
#

did u switch to detritus or still on djs?

quiet pawn
#

still js

#

i prob wont switch for awhile

#

i needa make more rows because of that

opal plank
#

this is the format it should follow

lyric mountain
#

components[5] is the cause

#

you cant have more than 5 buttons per row

opal plank
#

it cant have more than 5

#

yeah

quiet pawn
#

...

#

ik

lyric mountain
#

[5] implies 6th element

opal plank
#

split it

quiet pawn
#

thats why im saying i need mroe rows

opal plank
#

i just sent u an example

quiet pawn
#

but idk how

opal plank
#

look at it

#

components is an array

lyric mountain
opal plank
#

pass in another

quiet pawn
opal plank
#

its the same

#

ur constructor brings the same thing

quiet pawn
#

you sure?

opal plank
#

console.log() it

#

its the api format my dude

#

it HAS to be the same

quiet pawn
#

thats all mine is

opal plank
#

if a lib doesnt follow the api's format it'll error

quiet pawn
#

mine looks nothing like yours

opal plank
#

notices how the first components[] has 2 objects

#

thats what u should do

#

console.log(row)

quiet pawn
#

so i wanna console log each row?

opal plank
#

also, like i said, this is detritus not djs

#

no, im trying to tell your stubborn self that they are the same thing

#

your constructor returns that array

#

but you have 6 buttons in one row

quiet pawn
#

im listening

opal plank
#

so make 2 rows

quiet pawn
#

i have 2 rows

opal plank
#

message.components = [actionRow1, actionRow2]

quiet pawn
#

o

opal plank
#

this should make it more obvious for u to see it