#development

1 messages · Page 1708 of 1

fierce ether
#

theres no run feature atm

lyric mountain
#

not "the" command file, I mean Command file (capital C)

fierce ether
#

ok the base

lyric mountain
#

is it internal or you have the file?

fierce ether
#
/**
 * Abstract class for classes that represent a module
 * @abstract Command
 */ 
 module.exports = class Command extends Base {
  constructor() {
    super();
    if (new.target === Command) throw new TypeError('Cannot construct Command instances directly.');

    this._cooldowns = new Map();
  }```
lyric mountain
#

you cant new Command()

#

it's abstract

#

you need to new AddRole()

cinder patio
#

Is this commando or are you implementing your own

fierce ether
#
          async loadMainCommands(directory = this._config.paths.commands) {
              const files = await Utils.readdirRecursive(directory)

              for (const file of files) {
                  this.registerCommand(requireReload(file))
              }
          }

          /**
           * Register commands to client
           * @param {Command} Command command class to add to client
           * no async/await for performance
           */
          registerCommand(Command) {
              let command = new Command(this._config, this.beta)```
cinder patio
#

That's just a comment

lyric mountain
fierce ether
#

what then?

cinder patio
#

The error is different though

lyric mountain
#

abstract classes cant be instantiated

fierce ether
#

for every command?

lyric mountain
#

pass it as argument

#

then use the argument instead

cinder patio
#

Is that your own command handler or is this commando or something

fierce ether
#

its a wrapper to pass the commands to the client?

#

command handler

lyric mountain
#
registerCommand(command) {
  //let command = new Command(this._config, this.beta)
  ...
}
fierce ether
lyric mountain
#

then use command

cinder patio
#

So you made it and don't know how it works?

fierce ether
#

no i made it, its used to work, now it just stopped

lyric mountain
#

I bet that never worked

cinder patio
#

sus

lyric mountain
#

that's a fundamental error which would never ever allow the program to run

fierce ether
# lyric mountain I bet that never worked
        register(Command) {
            console.log(this.client.commands)
            let command = new Command(this._config, this.client);

            command.ensureInterface()

            if (command.aliases && command.aliases.length) {
                for (let alias of command.aliases) {
                    this.set(alias, command);
                }
            }
        }``` it works on the main bot?
lyric mountain
#

abstract classes are called like that because they can't exist as objects

cinder patio
#

technically there are no abstract classes in JS

#

but ye

median rain
#

is there a sample about vote reward command?

cinder patio
#

I highly doubt you wrote that code Astrah

lyric mountain
#

"sample" yes
"copy-paste code" no

median rain
#

I just need understanding

fierce ether
lyric mountain
median rain
lyric mountain
#

obviously there'll be no EXACT example of vote rewards

#

@fierce ether ```js
registerCommand(command) {
//let command = new Command(this._config, this.beta) | Pass the command as parameter

command.ensureInterface()

if(command.aliases && command.aliases.length) {
    for (let alias of command.aliases) {
        this.registerCommand(alias, command)
    }
}

}

median rain
#

well I'm kinda confused

bleak glade
#

oh

lyric mountain
fierce ether
lyric mountain
#

that link has examples on how to retrieve wheter the user voted or no

#

the rest is up to you

lyric mountain
#

read the comment after the second line

median rain
#
        await self._ensure_bot_user()
        data = await self.http.get_user_vote(self.bot_id, user_id)
        return bool(data['voted'])

'get_user_vote' basically detects if the user voted or not?

fierce ether
#

this.registerCommand(requireReload(file)) this returns a constructor, so what your trying to use is incorrect?

#

this.registerCommand(requireReload(file)) acc this should return a constructor but its return the first aliases

lyric mountain
#

well, you can't instantiate a new object from Command class

#

you need to figure a way of calling the subclass constructor instead of the super's

#

what you could do, is not use a constructor

#

but a function that builds the object and return as result

fierce ether
#

or just skip commands that arent a constructor?

lyric mountain
#

if you do that you'll ignore commands

fierce ether
#

fixed it

lyric mountain
#

like (example)```js
class AddRole extends Command {
constructor(...args) {
...
}

function getInstance(...args) {
return new AddRole(...args);
}
}

fierce ether
#
          registerCommand(Command) {
              let command = new Command(this._config, this.beta)

              command.ensureInterface()

              if(command.aliases && command.aliases.length) {
                  for (let alias of command.aliases) {
                      this.registerCommand(alias, command)
                  }
              }``` i was trying to register each alias as a command instead of using `this.set`
lyric mountain
#

then call <class>.getInstance(this._config, this.client)

onyx hare
#

question does <@roleID> still work?

fierce ether
#

yh

lyric mountain
quartz kindle
#

its @&roleid

onyx hare
#

ty

earnest phoenix
#

im getting the same sending after closing is not allowed error on my weebsocket that i smh fixed a few days ago

lyric mountain
#

you cant send to a closed websocket

earnest phoenix
earnest phoenix
lyric mountain
#

idk where to look at

earnest phoenix
#

found the error

#

heartbeatInterval is undefined

#

but hold up

#

data.d.heartbeat_interval should be defined tho

#

thanks linter for making me rename that to camel case

lyric mountain
#

why don't you come to intellij?

#

the only non-dumb IDE

pale vessel
#

Based

cinder patio
#

false

lament rock
#

vsc good and free. Linter rules exist for a reason

cinder patio
#

indeed

plain holly
#

bruh reddit safesearch isn't good enough in the api

opal plank
#

linters are for the weak

plain holly
#

apparently u can change the channel to pictures of shit in the meme channel

opal plank
plain holly
#

thats what my friends did lol

onyx hare
#

im confused:
message.delete({timeout: 10000}) is 10 seconds right? when i run the command its on it deletes after .5 seconds

astral zenith
#

then write 20k and see if its 10 sec

ornate yoke
#

sa

proper bronze
#

as

sacred juniper
#

Hello

#

I was have a nitro

#

I changed my label

umbral zealot
sacred juniper
#

And my nitro finished 2 days ago

quartz kindle
sacred juniper
#

My label was 4023

umbral zealot
#

oh it's gd

sacred juniper
#

I changed it

umbral zealot
sacred juniper
#

And when my nitro finished its 9573

umbral zealot
sacred juniper
#

Ok

umbral zealot
#

ask them for help, we cannot help you

lyric mountain
#

you can't recover your old discrim

#

don't even bother asking discord

sacred juniper
#

Would the same thing happen if I didn't change it

lyric mountain
#

no, if you didn't touch your discrim it'd have stayed the same

sacred juniper
#

Ok thanks

fierce ether
#

if (!this.isReady || (message.author && message.author.bot) || !message.channel.guild) return false; always returns false idk why?

quartz kindle
#

whats this.isReady

fierce ether
#

jus a boolean to make sure everything is loaded, it returns true

quartz kindle
#

are you sure its set to true?

#

console.log all 3 conditions

fierce ether
#

true false false

cinder patio
#

Looks like this.isReady is always false

fierce ether
#

its set to true?

#

this.isReady = true

cinder patio
#

maybe you change the value somewhere?

umbral zealot
#

needs more context. show more code ^_^

quartz kindle
#

moar cod

fierce ether
#
       async setup() {
        const fetchAllLoaders = Object.values(Loaders).map(L => new L(this))
        const [ preLoad, normal ] = fetchAllLoaders.reduce(([ pl, n ], l) => (l.preLoad ? [[...pl, l], n] : [pl, [...n, l]]), [[], []])

          
              for(let l of preLoad) { await this.initializeLoader(l) }

              for(let l of normal) { await this.initializeLoader(l) }

              this.isReady = true

        await this.login()
        }``` setup is run when the bot starts, message event wont work until isReady is true
quartz kindle
#

when you said true false false

fierce ether
#

if (!this.isReady || (message.author && message.author.bot) || !message.channel.guild) return false;

#

that in order

quartz kindle
#

did you log this.isReady or !this.isReady?

fierce ether
#

this.isReady

quartz kindle
#

then it should not be returning false

#

show more code

#

the message event

fierce ether
#
'use strict';

const { Event, CommandContext } = require('../');

    class MessageEvent extends Event {
        constructor(client) {
            super({ events: ['message'] }, client)
            
        }


        async onMessage(message) {
            if (!this.isReady || (message.author && message.author.bot) || !message.channel.guild) return false;```
quartz kindle
#

and how do you know its returning there?

fierce ether
#

because i console.log(1+1) above and below

#

and it only logs above not below

quartz kindle
#

console.log all 3 conditions above and below

umbral zealot
#

it'd be funny if that wasn't a message object, right Tim?

#

Like, say it was a client var

quartz kindle
#

console.log(!this.isReady, (message.author && message.author.bot), !message.channel.guild)

umbral zealot
#

also 'use strict'; wth

fierce ether
#

message.content returns content

quartz kindle
#

i use "use strict" too

#

eslint yells at me otherwise :^)

fierce ether
#

console.log(this.isReady, message.author.bot, message.channel.guild) log like this or same order?

quartz kindle
#

with !

fierce ether
#

on all?

quartz kindle
#

no

fierce ether
#

jus ready?

quartz kindle
#

exactly like i said

fierce ether
#

oh i see

umbral zealot
#

So they're ALL false.

fierce ether
#

yes?

umbral zealot
#

And that means, it's not going to return

quartz kindle
#

so it should never return

umbral zealot
#

and you're debugging the wrong thing

fierce ether
#

i logged underneath aswell?

#
            console.log(!this.isReady, (message.author && message.author.bot), !message.channel.guild)
            if (!this.isReady || (message.author && message.author.bot) || !message.channel.guild) return false;
            console.log(!this.isReady, (message.author && message.author.bot), !message.channel.guild)```
lavish bramble
#

How can I show the avatar of bot in embed?

quartz kindle
#

{ return false; }

fierce ether
#

yeh worked but now fetch dosent work either

quartz kindle
#

this is why i never use ifs without brackets

fierce ether
#

i never rlly see the point tbh

quartz kindle
#

you just saw the point right now lol

fierce ether
#

lmao true

earnest phoenix
#

@quartz kindle

quartz kindle
#

what is client defined as?

#

show more code

lavish bramble
#

How can I do
Whenever anyone vote my bot then my dm automatically that user?

quartz kindle
earnest phoenix
opal plank
#

is that an attempt at slash commands?

earnest phoenix
#

:D

opal plank
#

what is that?

quartz kindle
#

whats your discord.js version?

opal plank
#

why not do a request via rest instead?

#

this easy

#

would have to use d.js tho

quartz kindle
#

client.api is the rest manager

earnest phoenix
#

v11.6.4

opal plank
#

then there you have it

quartz kindle
#

thats very old

opal plank
#

v11 deprecated

umbral zealot
#

djs v11 no longer works

#

Use v12

opal plank
#

or use detritus.js instead

quartz kindle
#

ads

lavish bramble
quartz kindle
#

your bot needs to be verified

earnest phoenix
opal plank
#

look

#

tis a better lib okay?

#

in every sense of the word

quartz kindle
#

then install again

earnest phoenix
#

okey 1m

opal plank
#

OR

#

npm i discord.js@12

#

that should work

earnest phoenix
#

oh yes

#

and this

quartz kindle
#

your bot doesnt have access to something

#

catch the request to get more information

opal plank
#

wait

#

a second

earnest phoenix
#

my bot is in 1 server

opal plank
#

you getting applications via guildid?

#

not userId?

#

im fairly certain you need to use userId for applications

#

but before that

#

what are you EVEN trying to do?

earnest phoenix
#

im trying slash commands

opal plank
#

then why not use what i suggested above?

earnest phoenix
#

where

opal plank
#

literally 10 messges above

#

right here

#

this is NOT d.js btw

#

just gotta find the counterpart

#

as tim said, use

#

erm

quartz kindle
#

hes doing the counterpart already

opal plank
#

something soemwhere

quartz kindle
#

hes doing exactly the same thing

opal plank
#

d.js has applications like that?

#

wot?

quartz kindle
#

hes doing /applications/:userid/guilds/:guildid/commands

opal plank
#

thats confusing af but okay

quartz kindle
#

discord.js's rest handler is a proxy object

#

.applications("abc") turns into /applications/abc

opal plank
#

detritus has handlers too, its just the raw thats like i sent above

#

.rest
.rest.raw => post/get/put/patch

#

confusing

#

i'll let you handle this tim

quartz kindle
#

client.api.applications("abc").guilds("xyz").get()

get("/applications/abc/guilds/xyz")

opal plank
#

confusing

#

and requires updating the lib

#

to add new methods

quartz kindle
#

it doesnt

opal plank
#

reee

#

how so?

quartz kindle
#

its a proxy object

opal plank
#

if a new endpoint gets added you'd need to update it no?

quartz kindle
#

the methods are converted to strings

#

if you do client.api.huehuehue("xyz").get()

#

it will do get(/huehuehue/xyz)

opal plank
#

intellisence goes brrr

#

how do you even do that

quartz kindle
#

proxy object

earnest phoenix
#

what should I do ?

opal plank
#

what tim's saying

#

i've played with slash commands for a bit now

#

but not in d.js

quartz kindle
#

i've never used slash commands

opal plank
#

so i'd be telling you how to do it with raw requests

quartz kindle
#

does /applications/userid/guilds/guildid/commands exist?

grizzled dove
#

How to add Bolt bot into my server help pls

opal plank
#

dont think so tim

quartz kindle
#

than thats the issue

#

what does exist?

opal plank
#
    await message.client.rest.raw
      .post({
        body: {
          name: 'cat',
          description: 'Send a random animal photo',
          options: [
            {
              name: 'lel',
              description: 'The type of animal',
              type: 3,
              required: true,
              choices: [
                {
                  name: 'Dog',
                  value: 'animal_dog',
                },
                {
                  name: 'Cat',
                  value: 'animal_cat',
                },
                {
                  name: 'Penguin',
                  value: 'animal_penguin',
                },
              ],
            },
            {
              name: 'only_smol',
              description: 'Whether to show only baby animals',
              type: 5,
              required: true,
            },
          ],
        },
        route: {
          path: '/applications/:applicationId/commands',
          params: {
            applicationId: message.client.userId,
          },
        },
      })
      .catch(console.log);```
this is the example they give in the discord docs, i just put it in there to test it out
#

and then you just listen to this event

#

as simple as that

quartz kindle
#

it does exists

opal plank
#

i could've sworn the guild:id was after the commands/

#

nvm

#

nothing happened

earnest phoenix
#

my problem is solved thank you @opal plank @quartz kindle

opal plank
#

np

#

imagine doing code right and then say it wrong

#

couldnt be me

#

@earnest phoenix i dont accept random friend requests

earnest phoenix
#

okey :(

elfin cave
#

how to log a message to the console

umbral zealot
#

console.log(message.content)

elfin cave
#

bro

#

that's not real

#

that didn't work

#

not pog 😡

umbral zealot
#

that's literally how you log the message content to the console

#

Assuming you're in a message event and your variable name is message. Also assuming javascript because you failed to actually provide any useful information so I had to assume a whole lot.

opal plank
#

the profile pic alone is enough for me to take a wild guess and assume they dont know coding, at all

earnest phoenix
umbral zealot
#

I... ... Erwin that sounds... uhm... probably racist?

elfin cave
#

okay i did that but now i get "message.content is not cached ", is this normal? @umbral zealot

#

can you please help me

umbral zealot
#

I've literally never seen that error message in my entire life

#

show what you're doing? show your code.

opal plank
vocal trellis
#

bro

umbral zealot
#

I have no idea and honestly don't care to profile people based on their name or avatar

vocal trellis
#

erwin

#

Why you are acting racist

opal plank
#

whatever

vocal trellis
#

Didn't expect this from you bro

elfin cave
#

Erwin is a racist

umbral zealot
#

Ignore that, and please show your code

elfin cave
#

I don't leak my codes

#

it's a big pog bot

umbral zealot
#

Well we can't help you then .

quartz kindle
#

Lol

umbral zealot
#

cuz I can't leak my codes to you either.

quartz kindle
#

this guy is trolling

vocal trellis
#

he isn't gonna sponfeed you evi.codes use your own codes

elfin cave
#

so I don't want people to pog with my bot

#

yes

#

evie wants to steal my codes

umbral zealot
#

Can't share my code either, so good luck!

quartz kindle
#

lmao

elfin cave
#

Thanks!

vocal trellis
#

i think

quartz kindle
#

stop trolling Jort

elfin cave
#

this is not normal

quartz kindle
#

lmfao

elfin cave
#

Tim nice haircut

quartz kindle
#

its 100% normal to show code when asking for help

vocal trellis
quartz kindle
#

if you dont want help when to elsewhere lol

elfin cave
#

I think i'm gonna report you also

quartz kindle
#

lmfao

elfin cave
#

you are a thief

quartz kindle
#

troll

vocal trellis
#

dmca claim maybe?

opal plank
#

@umbral zealot now you get it?

elfin cave
#

don't pog with my codes

opal plank
quartz kindle
#

if you're gonna troll go elsewhere

#

this channel is for people who need help

elfin cave
#

I'm don't trolling

vocal trellis
#

yeah @elfin cave this is only serious dev talk

#

you don't even now what a partial is

elfin cave
#

sorry Tibo

vocal trellis
#

np

elfin cave
#

bye

vocal trellis
#

please go away now

elfin cave
#

pog

vocal trellis
#

@quartz kindle that is fixed 😂

quartz kindle
#

lmao

vocal trellis
#

tim i heard you telling that 50% is gonna quit when discord.js is gonna update to node.js 15

quartz kindle
#

wat

elfin cave
#

I'm gonna quit to I think

#

btw

opal plank
#

go to detritus.js

elfin cave
#

what is node.js

vocal trellis
opal plank
#

much better lib

elfin cave
vocal trellis
opal plank
#

detritus.js is another discor dlibrary for js

#

and 30000x better than d.js

vocal trellis
#

why is it better?

#

never heard about it

opal plank
#

let me

#

erm

#

1 sec

#

read past that

vocal trellis
#

is it for ts?

opal plank
#

you can use it for js too, but preferrably you would be using ts for it

marble juniper
#

Anyone know why the mongodb container doesn't save any data when I use it in docker

#

when I restart the docker compose the data just removes itself again

opal plank
#

missing access perhaps?

marble juniper
#
version: '3'

services:

  api:
    links:
      - mongo
      - bot
    ports:
      - "6969:9001"
    restart: unless-stopped
    build: ./src/api/

  bot:
    tty: true
    links:
      - mongo
    restart: unless-stopped
    build: .

  mongo:
    image: 'mongo'
    volumes:
      - mongo_data:/opt/anti-nsfw_data
    ports:
      - '27017'

volumes:
  mongo_data: {}

networks:
  default:
    external:
      name: antinsfw_network
#

compose file

opal plank
#

dunno whats ur setup, but the user the docker is using would need access

marble juniper
#

it runs on my pc rn

opal plank
#

linux?

marble juniper
#

my pc is windows

#

lol

vocal trellis
#

xd

opal plank
#

hmmm not sure how to work with that on windows

marble juniper
#

the vm's run linux

opal plank
marble juniper
#

lol

#

idk it may just be

#

a volumes thing

vocal trellis
#

did you @marble juniper your database?

#

😂

marble juniper
#

y e s

vocal trellis
#

xxd

crimson vapor
ember wedge
#

@marble juniper it does seem like that's a volumes thing because by default docker compose up should retain volume information unless you pass a specific flag

marble juniper
#

hmm

#

weird

#

maybe just a way I restart the compose then?

ember wedge
#

might need to check if you aren't passing -V somewhere

#

how do you restart?

marble juniper
#

I just do right click on the compose file in vscode

#

it doesn't use any -v flags

#

lol

ember wedge
#

lol i'd hope not 😄

#

i dunno bout windows

marble juniper
#

the restart butoooonnn

ember wedge
marble juniper
ember wedge
#

ify ou check the last paragraph it mentions something about on a windows machine

#

so i dunno

marble juniper
#

I mean

#

its only a thing for when I test it on my pc

#

its not gonna lose its data when on the server

#

lol

#

but yeah

#

kinda bugged me

#

whatever

#

time to deploy the rewrite of the bot

ember wedge
#

hmm

#

building the images shouldn't destroy the data volumes

#

good luck on the deploy 😄

marble juniper
#

probably just a windows thing

marble juniper
ember wedge
#

feels more like a docker thing :p docker is a pain like that sometimes

marble juniper
#

as I have a webhook setup for my github repo

#

if I push code it just deploys that

#

lol

ember wedge
#

poggersrow github piplines is great

marble juniper
#

deploys it to a server

#

yes

#

no ssh

ember wedge
#

we still use jenkins 😢

marble juniper
#

no keeping code the same

#

just

#

push

#

done

ember wedge
#

🥳

marble juniper
#

deploying takes like 6 seconds

ember wedge
#

lol that's pretty fast

marble juniper
#

if there are no new packages

#

lol

ember wedge
#

don't you run any linting/tests?

marble juniper
#

its that fast because docker caches node modules

marble juniper
#

lol

ember wedge
#

hahaha

marble juniper
#

it was a pain in the ass

ember wedge
#

ez way to fix long build times i suppose

marble juniper
#

so yeah

#

I mean im the only one working on this bot

#

so

#

its fine

#

if I don't use a linter

ember wedge
#

exactly

marble juniper
#

or have tests

#

Ik how my own project works

#

lol

#

im pretty sure I wont mess stuff up

ember wedge
#

i'd hope not lol

opal plank
marble juniper
#

all commands it has

#

not a lot

#

the set-logs and show-files commands are the only ones that even use the database

#

lol

opal plank
#

is that an open eval?

marble juniper
#

no

opal plank
marble juniper
#

its not

#

lol

opal plank
#

okay good

marble juniper
#

it only shows owner commands to me

ember wedge
#

looks pretty cool 😄

marble juniper
#

for others the eval command

#

wont be in there

#

its a dynamic help command ofc

#

lol

ember wedge
#

all i have is a web interface soundboard bot :p

marble juniper
#
if (message.author.id !== client.owner) commands = commands.filter((command) => !command.ownerOnly)
#

I have this in my help command anyways

#

so if they don't have the id as me they wont see it

#

even if they tried to do eval

#

it would just

#

do nothing

#

it wouldn't even respond lol

#

it will just pretend like the command doesn't exist

ember wedge
#

i need to work on this interface 😦

#

and i need to start uploading and converting soundbytes

#

but i haven't had the heart to start modelling it

#

anyone have experience in database related stuff in .netcore? 😄

vivid fulcrum
#

definitely check out efcore

earnest phoenix
#

hi, my bot is suddenly spending much more ram than normal, it usually uses about 50-80MB and suddenly it is using even 200MB

#

I think the problem is because I made a level system

#

And well, that makes the bot have to always be doing something every message that is sent

#

And the ram memory of my bot is limited to 512MB so I need some advice to improve the performance or I will directly remove the tiering system

quartz kindle
#

if you're using discord.js the problem is likely discord.js itself

#

how many guilds are you on?

earnest phoenix
#

28

quartz kindle
#

how many members?

#

do you use fetchAllMembers?

earnest phoenix
#

Let me see

quartz kindle
#

what is your bot doing on every message?

earnest phoenix
#

client.on("message", (msg) => {
if (msg.author.bot) return;
if (msg.channel.type === "dm") return;
niveles.create(${msg.guild.id}.${msg.author.id}, {
experiencia: 0,
nivel: 1
});
let user = niveles.get(${msg.guild.id}.${msg.author.id})
user.experiencia += (Math.random() * 10) + 1; // Se sube la experiencia del usuario entre 1 y 10
if (user.experiencia >= (5 * (user.nivel ^ 2) + 50 * user.nivel + 100)) { // Si tiene la experiencia necesaria para el siguiente nivel
user.nivel += 1; // Se sube de nivel
msg.reply("has subido de nivel! Nuevo nivel: " + user.nivel); // Y le notifica al usuario con tal hecho
}
user.save();
});

#

I'm spanish so niveles is like level

quartz kindle
#

what database are you using?

delicate zephyr
#

mongo by the looks of it

#

could be wrong

earnest phoenix
#

MeowDB

#

const MeowDB = require("meowdb");

const niveles = new MeowDB({
dir: __dirname,
name: "nivelesUsuarios"
});

quartz kindle
#

its a json database

#

and by the looks of it, it keeps a copy of the entire database in memory

#

no it doesnt

#

but even worse

#

lmao

#

on every single get, it reads the full file again

earnest phoenix
#

Ok, thanks

quartz kindle
#

i dont know if this is the cause of the high memory usage

#

but i dont think this is a good database

earnest phoenix
#

me neither

thick nexus
#

can you use aiohttp to get stuff from reddit

quartz kindle
#

yes

thick nexus
#

ok

quartz kindle
#

@crimson vapor i think even your jasondb is better than this meowdb

crimson vapor
#

no

#

no where near as good as that

pale vessel
#

lmao

trim lava
#

rfszu

thick nexus
earnest phoenix
vivid fulcrum
#

depending on what you want to get

#

you use different endpoints

thick nexus
#

o

#

ok

vivid fulcrum
#

??

#

context please

#

okay then

fierce ether
#

can someone explain what the difference between sending a embed and a webhook?

quartz kindle
#

they are completely different things

#

webhooks are messages

#

both messages and webhooks have embeds

fierce ether
#

yh i meant the difference

quartz kindle
#

so if anything you have to compare sending a message to sending a webhook

#

a webhook can be sent from anywhere

#

without needing a bot program

#

nor a bot token

#

but webhooks need to be allowed in a channel

#

messages dont need to be allowed, but need a bot token

fierce ether
#

say for instance dyno, sends webhooks for logs instead of messages, why is that?

quartz kindle
#

webhooks can also send multiple embeds and change the displayed username and profile

#

since webhooks dont use a bot token, their rate limits do not affect a bot

#

possibly why big bots prefer them

steep drum
#

You use web hooks if you don't want to create a full on bot to interact with user input

#

If you just want to send data to a channel due to an outside event and for informational purposes, just use a web hook

quick willow
quick willow
#

@long crow why are you reacting to all of them?

long crow
#

Choose what you comfort with?

quick willow
#

ty

sudden geyser
#

But that's just my choice. Yours will probably be different

solemn leaf
#

Can you filter roles and channels by their reason tag

quick willow
sudden geyser
#

serenity

vivid fulcrum
odd stratus
vivid fulcrum
#

why thou fuck are you importing padding for an encryption method

tacit sequoia
#

Me just realizing d.js is in typescript

quartz kindle
#

djs is not typescript

delicate zephyr
#

but yea, current stable isnt

quartz kindle
#

djs-next is

delicate zephyr
#

Yea, but iirc they're rewriting the main branch to ts too are they not?

quartz kindle
#

nope

#

not afaik

tacit sequoia
#

Npm tells me it is

#

🥴

earnest phoenix
#

that's for type declarations

tacit sequoia
#

Oop

queen timber
#

Hi

earnest phoenix
#

is there a on_member_nickname_change event on discord.py

#

on_member_update, check the 'before' and 'after' nickname

#

alr

#

ty

latent quiver
#

Can someone tell me how can I add the Auth for top.gg webhooks for flask

old cliff
#

@earnest phoenix will the process.on('Uncaugh....') work only in main file or will it also work from a required file?

marble juniper
#

should work in any

#

I think

#

maybe not if its a required one

earnest phoenix
old cliff
#

ok

marble juniper
#

k

#

now explain what primodrial objects are

#

k thanks

#

xd

earnest phoenix
#

primordials are the objects defined globally pre_context rather, such as the process object

marble juniper
#

oh ok

marble juniper
#

sorry don't use flask

#

lol

latent quiver
#

aah then what should I use?

earnest phoenix
#

I think he meant he doesn't use it

latent quiver
#

the docs of api provided by top.gg is too hard to understand

latent quiver
earnest phoenix
#

Which part are you confused about?

latent quiver
#

I think the webhooks one though

latent quiver
#

In the python docs

runic ledge
#

can someone teach me how to get the fake vouches?

#

?

earnest phoenix
#

What do you mean by "fake vouches"

old cliff
#

Generating fake nitro codes.... ew

slender thistle
#

And the latest version on pypi is v0.4

earnest phoenix
#

So that version is not published yet?

oak nymph
#

can someone help me with a news command that I wanna add to my bot? (discord.py)

obtuse shore
#

hols

latent quiver
#

How to use this class?
discord.abc.User
With the snowflake id?

slender thistle
#

It's not advised to be used if the user doesn't know what the fuck they're doing

marble juniper
#

do I need to have roles of a server cached in discord.js in order to be able to check a members permissions

cinder patio
#

yes

marble juniper
#

also do I need to have guilds cached for it to fire the guildCreate and guildDelete events

cinder patio
#

How do you remove the caching behaviour? djs-light?

marble juniper
#

yeah

#

lol

#

djs-light

#

I only have caching roles enabled rn

#

idk if caching guilds is enabled by default

cinder patio
#

Generally, you should have at least all guilds cached - I dunno how you're caching roles if you're not caching guilds, too.

marble juniper
#

idk

#

lol

#

also

#

guess what I wake up to

#

lol

#

guess I can't give anyone access to my private untill then

cinder patio
#

bump the version

marble juniper
#

nah

cinder patio
#

0.4.0

marble juniper
#

it has a conflict

#

with other dependencies

#

for whatever reason

#

but someone already created an issue for that package that uses jpeg-js

#

just have to wait until they release a new version

#

which fixes that vulnerability

#

I mean no casual user will attempt it anyways

#

lol

earnest phoenix
#

please help me

vagrant grove
#

Ok

#

"TOKEN": "you token"

#

@earnest phoenix

earnest phoenix
#

I have a little problem with my VPS, when I try to connect to SSH or SFTP, it puts me Connection closed with error: end of file. The connection information is correct.
The VPS is not offline because my site is working! What do you think this is the origin of?
Of course, I have already contacted the support service and I am waiting for an answer. I also launched a rescue mode under Debian 9 Live and of course it works but I don’t have my bot files…

earnest phoenix
vagrant grove
#

@earnest phoenix
Index: const { token } = require("./config.json")

Client.login(token)

Config.json:
{
"token": "you bot token"
}

earnest phoenix
vagrant grove
#

const Client = new Discord.Client()

#

@earnest phoenix

earnest phoenix
copper cradle
#

I'm not even gonna bother

#

have a good night yall

vagrant grove
#

@earnest phoenix edit:
const client = new Discord.client()
and delete
const client = new client()

summer acorn
#

how would I execute code once the shard is ready without using the ready event in djs

cinder patio
#

Why not use the ready event?

placid meadow
#

and Feud strikes again 😛

paper pilot
#

how to make my bot send message on specific time?

placid meadow
#

what lang u do ?

#

@paper pilot

paper pilot
#

js

placid meadow
#

ok

paper pilot
lusty quest
# earnest phoenix I have a little problem with my VPS, when I try to connect to SSH or SFTP, it pu...
DigitalOcean

Hi, I was be able to connect my server via filezilla till today. I installed lamp and configured dns server after that I'm unable to access to my server via sftp. It say's Received unexpected end-of-file from SFTP server

placid meadow
#

only thing i can find

lusty quest
#

if you want to run messages at certain times use cronjobs or timeouts

placid meadow
#

im suprised js doesnt have a nice date features

paper pilot
placid meadow
#

what system is this bot running on ?

tacit sequoia
feral aspen
#

Hi.

#

What's the difference between webhook and webhook client?

eternal osprey
#

hey,

var test = args
if (subcommand === 'join') {
    const banned = require("./banned.json")
    const manga = banned.userids
    if (manga.includes(message.author.id)) {
      message.channel.send("``Sorry, but you have been blacklisted! You cannot join!``")
      return;
    }
    if (queueMessageId === 0) {
      message.channel.send('A queue does not currently exist Arena-Boss '+ "<@" + message.author.id + ">");
      
    } else {
      message.channel.messages.fetch(queueMessageId).then(queueMessage => {
        if (addUserToQueue(message.member.displayName, message.member.id, test)) {
          console.log(test)
          fs.appendFileSync("./levels.txt", message.member.id + " " + test[1] + "\n"); 
          assembleQueueMessage();
          const userQueueDuration = timeInQueue(message.member.id);
          queueMessageText += ' ' + message.content.slice(Config.prefix.length).replace(/ *join/, '').trim()
          
          if (Config.useEmbeds) {
           
            queueMessage.edit(embedQueue.setDescription(queueMessageText));
          } else {
            queueMessage.edit(queueMessageText);
          }
        } else {
          message.channel.send(`${message.author} already entered the Arena-queue!`);
        }
      })
        .catch(console.error);
    }
  }

``` so the embed is indeed adding levels behind someones name, but why does it disappear once someone else joins?
eternal osprey
#

if anyone knows the answer, please ping me,

exotic flame
#

m

slender wagon
#

why have u defined test as args when u could just use args?

last tapir
#

server died

#

oof

summer torrent
#

hmm?

old cliff
#

Hi

#

How can I check if parseInt() something is not an integer?

#

because NaN == NaN is false

#

how?????

#

how can I check if something is NaN

#

uh got it

#

isNan()

last tapir
#
const webhooks = await sendChannel.fetchWebhooks();
let webhook = webhooks.first();

if (!webhook) {
    webhook = sendChannel.createWebhook('Attitude', {
        avatar: 'https://cdn.discordapp.com/attachments/735940794107822081/832575026791841792/Attitude_White_Logo.png',
    });
};
                
await webhook.send({
    username: 'Attitude',
    avatarURL: 'https://cdn.discordapp.com/attachments/735940794107822081/832575026791841792/Attitude_White_Logo.png',
    embeds: [embed],
});

im trying to do this but it says webhook.send({... is not a function

#

welp

old cliff
#

isNaN

umbral zealot
#

try to log what it is maybe

nocturne grove
#

just wanted to search it for you

umbral zealot
#

like console.log(webhook)

last tapir
umbral zealot
#

you seem to have it fine, your await is at the right place

old cliff
#

but why tf NaN != NaN

umbral zealot
#

but if there's no webhook.send it might be that it's not a webhook object for some godawful reason

old cliff
#

just why?

umbral zealot
#

just log it and check

quartz kindle
#

its not a number

#

but doesnt know what it is

#

so it cannot know if its equal or not

old cliff
feral aspen
umbral zealot
#

... are you Chill ?

feral aspen
#

No, but if it's not working, then it is supposed to be <pending>

last tapir
#

yes same

umbral zealot
fierce ether
#

this.utils.hexToInt((color ? color : '#748bd4').rgb(true)) how would i use ??= to make this simpler?

umbral zealot
#

If it says pending it means it didn't await correctly

#

sounds like you didn't actually save the code

umbral zealot
#
if (!webhook) {
    webhook = sendChannel.createWebhook('Attitude', {
        avatar: 'https://cdn.discordapp.com/attachments/735940794107822081/832575026791841792/Attitude_White_Logo.png',
    });
};

Not here you didn't

#

createWebhook also returns a promise

last tapir
#

what can i do tho

umbral zealot
#

await it

old cliff
#

just do that

last tapir
#

let me try

old cliff
#

it takes time to make a webhook -_-

swift cape
#

Got a problem with $sum

fierce ether
old cliff
#

idk abt ??=

fierce ether
#

its baso this a === undefined || a === null ? b : a

last tapir
#

it works :)

#

thanks

swift cape
#

Anyone help me ._.

old cliff
#

this.utils.hexToInt((color ?? '#748bd4').rgb(true))

#

@fierce ether

#

or just this.utils.hexToInt((color || '#748bd4').rgb(true))

swift cape
#

On my economy cmnd after using it for a lot of time it won't change , it always shows problem with $sum

old cliff
#

send code @swift cape

swift cape
#

Ok

#

$nomention
$title[Balance]
$description[ moneybag Money $onlyIf[$mentioned[1]==; ]
$getUserVar[money]۞

credit_card Bank $onlyIf[$mentioned[1]==; ]
$getUserVar[Bank]۞

receipt Total
$sum[$getUserVar[Bank];$getUserVar[money]]۞]
$footer[$username balance]
$addTimestamp
$thumbnail[$authorAvatar]
$color[#17FF00]

old cliff
#

which language is that? can't be php

vivid fulcrum
#

go complain to the developer of the app

quartz kindle
#

its bdfd lol

swift cape
#

Bdfd

old cliff
#

get out

quartz kindle
#

nobody here uses bdfd, we cant help you

swift cape
#

Lol

fierce ether
#

console.log(color ?? '#748bd4') this while always select color tho because color always returns Color { _rgba: [ 0, 0, 0, 1 ] }

pale vessel
#

what are you trying to do

old cliff
#

Should I make the code public for my magic wrapper which makes editing gifs super ez in js?

latent heron
#

I code in php

#

Not bdfd

old cliff
#

just 4 lines

fierce ether
latent heron
#

Also

#

Daily reminder that I can't wait for PHP 8.1 release

old cliff
latent heron
#

Built in enums are gonna slap

fierce ether
#

color always returns Color { _rgba: [ 0, 0, 0, 1 ] } so color.rgb(true) returns #fff000

pale vessel
#

why not check if an argument is provided beforehand

fierce ether
#

but i cant use color === '#fff000' then use #748bd4

#

bc i check for the argument in the constructor

old cliff
#

use some validating regex

pale vessel
#

you don't need regex

old cliff
#
        return typeof hex === 'string'
            && hex.length === 6
            && !isNaN(Number('0x' + hex));
    }```
fierce ether
#
{ type: 'string', full: false, missingError: 'admin:addRole.failures.noStringParameter' }, 
{ type: 'color', required: false }, 
{ type: 'boolean', required: false }]```
fierce ether
#
    /**
     * Convert hex color to integer
     * @param  {String} color Hex value of color
     * @returns {Number} Hex color as an integer
     */
     hexToInt(color) {
       return color.startsWith('#') ? parseInt(color.replace('#', ''), 16) : parseInt(color, 16);
        }```
old cliff
#

I wish I could share my secret Color utility code

pale vessel
fierce ether
#

i do already, but it isnt checking if their is a color entered

pale vessel
#

what's your code

#

can't you do Color(isNaN(hexToInt(color)) ? "default color" : color)

old cliff
#

code to check if a hex is valid

isHex (hex) {
  return typeof hex === 'string'
  && hex.length === 6
  && !isNaN(Number('0x' + hex));
}```
fierce ether
#

i done this var hexCode = this.utils.hexToInt(color.rgb(true)) hexCode === 0 ? hexCode = '#748bd4' : hexCode

pale vessel
#

that's not valid js

fierce ether
#

it works?

#

there not on same line

pale vessel
#

oh

#

if it's invalid it would be NaN

fierce ether
#
var hexCode = this.utils.hexToInt(color.rgb(true))

try {
  var createdRole = await guild.roles.create({ data: { name, color: hexCode === 0 ? hexCode = '#748bd4' : hexCode, hoist: hoist }})```
#

it returns 0 if no input

pale vessel
#

but if the output is invalid, it returns NaN

fierce ether
#

hexCode wont run if they enter a invalid color

pale vessel
#

hexToInt always return NaN if the color is invalid, I just tried

fierce ether
#

it checks the input and uses regex to check its a valid color

pale vessel
fierce ether
pale vessel
#

I c

fierce ether
#

i use all this in the constructor so i dont have to use if(!param) return message.channel.send("no param")

old cliff
#

eh

#

why?

fierce ether
#

bc it saves me alot of time and likes for instance a string type: 'string', full: false, missingError: 'admin:addRole.failures.noStringParameter' if no string is entered or the input isnt a string it translates missingError into the guild language and sends a embed

lament rock
#

couldn't you just create a template Object so that you aren't creating a new instance in memory and clogging the old space

short cargo
#

I updated my bot's biography, but when I threw f5, the article I updated does not appear.

green ferry
#

Hello I need help

vivid fulcrum
#

biography

green ferry
vivid fulcrum
#

wait

#

all you can do is wait

lament rock
#

what library are you using and are you sharding

vivid fulcrum
#

to check up on the ratelimit you can manually make a request and see the headers

green ferry
#

how to check if sharding

lament rock
#

If you don't know what sharding is or if you are then you aren't

green ferry
lament rock
#

just trust me on that one

#

you aren't sharding

green ferry
#

okay

#

so what do I do

quartz kindle
#

nothing?

lament rock
#

don't do an action so many times within a short timespan. Only do what you actually need to do

green ferry
lament rock
#

Your lib should be handling that for you

green ferry
#

It doesn't really slow down on requests

lament rock
#

so, if you send a message 10 times, it always sends them as fast as it can and doesn't stop briefly after 5?

green ferry
#

Not that I am aware of. The command that caused the rate limit is a command called 8ball. It's just like a mini game where someone types -8ball questionhere and it randomizes and answer. It's been working fine for the past 2 days, ppl could use it whenever

#

and then out of nowhere it just said "you're being rate limited"

lament rock
#

what's the code for it

green ferry
# lament rock what's the code for it
@client.command(aliases=['8ball', 'test'])
async def _8ball(ctx, *, question):
    responses = [
        'It is certain.', "it is decidedly so.", 'Without a doubt',
        'Yes - definitely.', 'You may rely on it', 'As I see it, yes.',
        'Reply hazy, try again.', 'Ask again later',
        'Better not tell you now.', 'Cannot predict now',
        'Concentrate and ask again', "Don't count on it", 'My reply is no.',
        'My sources say no.', 'Outlook not so good.', 'Very doubtful.'
    ]
    await ctx.reply(
        f'Question: {question}\n:white_check_mark:Answer: {random.choice(responses)}'
    )
earnest phoenix
#

implement cooldown lol

green ferry
lament rock
#

I doubt that's what's causing issues unless people are spamming it

lament rock
#

So, then you should look into how to add user cooldowns

earnest phoenix
#

also why make 8ball an alias, I'd make it be the name instead mmulu

green ferry
#

so I had to alias it

earnest phoenix
#

I'm not talking about your function name, rather the command name

pale vessel
#

name="8ball" isn't it?

earnest phoenix
#

^

green ferry
#

uh

earnest phoenix
#

Command name: _8ball
Aliases: 8ball, test
looks weird, at least to me lol

raw pawn
#

Guys i need help

#

Ok sorry if im breaking rules

#

help

quartz kindle
#

literally read

#

lol

raw pawn
#

Lol ik but like why doe

quartz kindle
#

why what

raw pawn
#

why is it like that

quartz kindle
#

because its better?

#

why not?

raw pawn
#

Uh i think i need that for my bot?

#

im not sure doe

quartz kindle
#

dude

#

read whats written

lament rock
#

The env var side bar creates a .env at runtime

raw pawn
#

idk where that is ;-;

quartz kindle
#

the env system was removed and replaced with an option in the sidebar

#

you dont know whats a sidebar?

raw pawn
#

nop

quartz kindle
#

this is the sidebar

raw pawn
#

thats just my 2nd time making a bot

raw pawn
#

thx

green ferry
#

so do I just have to wait for my bot to stop being rate limited?

#

or do I have to do something for it to stop being rate limited. Obviously besides later putting in a cooldown. But like I can't even start my bot now

quartz kindle
#

if you got temp banned you have to wait 1 hour

earnest phoenix
#

guys can someone help me

lament rock
#

A payload you sent to Discord is too chomk

#

Most commonly a MessageAttachment

earnest phoenix
#

its a message attachement

#

wait

lament rock
#

they can only be <= 5MB

earnest phoenix
#

oh

#
  if(command === "download"){
    ytdl('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
    .pipe(fs.createWriteStream('song.mp3'))


    await delay(10000)
    const buffer = fs.readFileSync('./song.mp3')
    const attachment = new discord.MessageAttachment(buffer, 'song.mp3')
    message.channel.send(`${message.author}, here's your song!`, attachment)
  }
#

ig thats why

#

ok ty

lament rock
#

Yup. That'll do it

#

Also, that's illegal

#

but so is ytdl but whatever

earnest phoenix
lament rock
#

distributing illegally downloading songs

earnest phoenix
#

oh

raw pawn
#

Uh

#

where do you put the token of your bot?

lament rock
#

YT only has licenses to stream through their official clients unless the user is a premium user

earnest phoenix
raw pawn
#

In the Key or Value?

lament rock
#

value

earnest phoenix
raw pawn
#

Ok

lament rock
#

key is what you use to access the token

#

in this case, it might be TOKEN

#

so, process.env.TOKEN

raw pawn
#

Ohh okay

#

Do i still have to do the " client.login("____")?

lament rock
#

client.login(process.env.TOKEN) or whatever you put as the key

raw pawn
#

Okay ty

#

Uh it said this, what do I do?

pale vessel
#

scroll up

raw pawn
#

In the black area?

umbral zealot
#

yes so we can see the actual error

raw pawn
#

okay

#

So it says token invalid

pale vessel
#

are you sure you set the proper key and value for the env

umbral zealot
#

yeah so you didn't put your bot token in the .env file

pale vessel
#

not the file, the section on the sidebar

umbral zealot
#

TOKEN=yourtokenhere in a file called exactly .env

raw pawn
#

I actually did

pale vessel
#

no, not the file paincom

raw pawn
#

Im sorry i new to making bots TwT

quartz kindle
#

@raw pawn what did you put in key and value?

raw pawn
#

I put "TOKEN" in key then i put my bots token in Value

quartz kindle
#

then it should work

#

what does it show in the terminal if you do console.log(process.env)

calm elbow
#

Im getting this Extermely long error while trying to install discordjs/opus using npm on Linux. Can anyone help me?

raw pawn
#

Okay ill try it again

earnest phoenix
#

guys

#

wtf

lament rock
#

the error is self explanatory. You might want to remove the .mp3 at the end of the URL

lament rock
quartz kindle
#

you may want to actually give your file a name

#

you're trying to write an mp3 file with the youtube url as the file name

eternal osprey
#

hey

#

how do i search for someones id if i have his name?

#

For example Awsome. How would i find that user and get his id?>

pale vessel
#

names aren't unique so you won't be guaranteed to get the actual user

eternal osprey
#

yeah i am aware of that

#

it's allrighty

calm elbow
#

Now when i try to start my bot and play some music on it, then this error appears and forces the bot to quit my channel. On Windows it works just fine. And no the embed description is not at all over 2048 caracters. Just maybe like 100

eternal osprey
#

how would i do it tho?

pale vessel
#

you need to cache users

#

if you do, try to find the user in the cache

sterile lantern
#

whats a good api without watermarks that make your a blue/bright/triggered/wasted etc

pale vessel
#

canvas api xd

#

once you get the hang of it, using canvas isn't hard at all

eternal osprey
#

tried*

#
 let finalreverse = reverse.map((x) => x[0]);
      console.log(finalreverse)
      let id = client.users.cache.get('name', `${finalreverse}`).id;```
#

(node:2960) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined

pale vessel
#

.get() is only for keys

#

and keys are IDs

#

you want to find users by name so use find() and provide a function

#

and you might need to use a loop

#

you can't provide an array for collection.find()

pale vessel
eternal osprey
#

aha omkay

plain holly
#

how do i use the script to see the request thats being made

#

becuz i used requestbin and it works properly but my own script doesn't work

lyric mountain
#

remember guys, hashmap is unordered KEKW

quartz kindle
#

wat am i looking at