#development

1 messages · Page 810 of 1

crimson vapor
#

I never saw that as a problem

#

but I see why it could be

quartz kindle
#

although its mostly safe because the logging in process will likely take longer than the loading process

white anvil
#

my command loader is async also

#

but it’s esm

#

so I kinda need to use await

quartz kindle
#

if you have a gazillion commands, there could be issues, but it will probably never happen

#

on the other hand, loading commands while logging in also makes your bot login faster lul

white anvil
#

I can probably load about 500 commands in time it takes for bot to login

#

I have 25 atm

neat ingot
#

lol

summer torrent
#

anyone can help me for cheerio?

crimson vapor
#

alright, I am suck again, so far I have added the command to a map, and called it using find, but I am unable to get the command.run

#

it is undefined

earnest phoenix
#

what is this?
Error: 400 Bad Request

at IncomingMessage.<anonymous> (/rbd/pnpm-volume/a72fbbf6-7091-4e79-bbd8-073e4d4468bb/node_modules/.registry.npmjs.org/dblapi.js/2.3.1/node_modules/dblapi.js/src/index.js:118:25)

at IncomingMessage.emit (events.js:201:15)

at endReadableNT (_stream_readable.js:1130:12)

at processTicksAndRejections (internal/process/task_queues.js:83:17) {

raw: '{"error":"Required parameter server_count or shards missing"}',

body: { error: 'Required parameter server_count or shards missing' },

status: 400,

#

i use glitch hosting

summer torrent
#

how to fetch discord api response time from website. I want to use cheerio but I cant

quartz kindle
#

@earnest phoenix dblapi was not yet updated to work with discord.js v12

#

in the mean time, you can use .postStats instead, and remove client from the constructor

summer torrent
#

you mean this?
@quartz kindle yes

quartz kindle
#

do you really need cheerio for that?

crimson vapor
#

Im so confused on what I am doing wrong

#

all I can get from a require is the name for some reason

summer torrent
#

do you really need cheerio for that?
@quartz kindle do you have any better idea

earnest phoenix
#

@quartz kindle from your screen this is the same response with client.ping no...?

crimson vapor
#
    const test = require('../../commands/test');
    test.run(client);```
and ```js
module.exports = class test extends Command {
    constructor() {
        super({
            name: 'test'
        });
        this.testtest = 'testerer';
    }
    async run(client, message, args) {
        console.log(message);
    }
};```
#
 TypeError: test.run is not a function```
#

the async run was just a test, it will be changed, but even then it doesn't load

quartz kindle
steel heath
#

ohh

quartz kindle
#

@earnest phoenix i dont thing so

earnest phoenix
#

Oh...

#

Yeah the url change tim

#

Before the day.json

summer torrent
#

ty Tim and EGGSY

quartz kindle
#

if the part before day.json changes, you can get the updated one from the status page source code

amber fractal
#

@crimson vapor You didnt make a new instance of the class

#

You have to make an instance to use non-static methods

#

i.e. let x = new test() x.run(args)

#

given it requires correctly

crimson vapor
#

ohh

#

lets see if it works

quartz kindle
#

thats another thing to learn about classes

#

static and non-static stuff

crimson vapor
#

oh

#

I will research that later tonight

quartz kindle
#

lets say a class is a blueprint for a car

#

when you do new Car()

#

it becomes a car

#

a normal method only works on the car, not on the blueprint

#

a static method only works on the blueprint, not on the car

crimson vapor
#

ohhh

amber fractal
#

Tim do you know if you can override methods with js? I know you cant overload constructors (which is a shame) but I've never really went into sub classing

quartz kindle
#

yes you can override methods

crimson vapor
#

it worked yay

#

thank you for explaining that, now that I know it makes sense

quartz kindle
#

you cant override constructors, but you can work around them

#

ie: modify data before calling super() and then edit data after

crimson vapor
#

okay, I updated the command loader and now it actually works

#

thanks so much for helping me learn about classes

#

ill probably be asking more questions tomorrow when I work on other class stuff

#

if you think im asking too much please tell me

earnest phoenix
#

Procuro alguem q saiba hospedar bot na heroku

shy turret
#

I don't even understand this at all:

#
          console.log(actualargs)
          if (actualargs !== "") {
            exports.loopnum = parseFloat(lineargs);
          }
#

It sends hi in my console (what actualargs is defined to)

#

but then if (actualargs !== "") doesn't seem to pass

trail axle
#

I need help mentioning a user

shy turret
#

discordjs?

trail axle
#

Yes!

shy turret
#

message.mentions.users.first()

#

for example

#

if you make a command called !mention

trail axle
#

do you know how to make the bot DM?

shy turret
#
if (!message.mentions.users.size) {
// no mentions
} else {
mentioneduser = message.mentions.users.first() //stores first mentioned user
// is a mention
}
#

message.author.send

#

or

#

in this case

#
if (!message.mentions.users.size) {
// no mentions
} else {
mentioneduser = message.mentions.users.first() //stores first mentioned user
mentioneduser.send("something")
// is a mention
}
trail axle
#

Do you know ho to DM an embed?

shy turret
#

stable or master?

trail axle
#

?

shy turret
#

stable = RichEmbed

#

master = MessageEmbed

trail axle
#

Rich embed

#

stable

shy turret
#

so first make the embed var

#

example:

#
    let embed = new Discord.RichEmbed()
      .setAuthor('title')
      .setColor("RANDOM")
      .addField('test', false)
earnest phoenix
#

v12 is stable now lol

shy turret
#

then mentioneduser.send(embed)

earnest phoenix
#

"Stable"

shy turret
#

oof

#

@trail axle you might want to update your discord bot to the new stable version

trail axle
#

it is

shy turret
#

but that also means you will need to change all richembeds to messageembeds

trail axle
#

how do you set version or servers in status?

shy turret
#

RichEmbed doesn't work in the new version

trail axle
#

oh ok

shy turret
#

you simply update your discordjs version using the same npm cmd

#

The only difference for the new stable/master is instead of embed = new Discord.RichEmbed() you use embed = new Discord.MessageEmbed()

trail axle
#

What bot have you developed?

shy turret
#

the only one I released is a terrible rpg bot, but i've made other stuff too

#

yes i have made a better version of my rpg bot, but never released and might never will

#

making a new one rn

earnest phoenix
#

imagine calling your self two ytho

shy turret
#

y not

#

completely no sense, js is messed up

trail axle
#

Two I did the embed part what next?

earnest phoenix
#

V11.x.x = Discord.RichEmbed()
V12.x.x = Discord.MessageEmbed()
wat

trail axle
#

I added that message

shy turret
#

so who do you want it to dm?

earnest phoenix
#

V12 is really bad...

shy turret
#

message executor/author, mentioned user, or user with a specific id

quartz kindle
#

@shy turret wdym doesnt pass? did you try console.log after the condition?

shy turret
#

yes, i tried to add a } else { console.log("No") } and it said "No"

topaz fjord
#

@earnest phoenix no?

#

v12 is great

#

just breaks a lot of shit from v11

shy turret
#

it wont work after the condition because it says the condition is false when it isnt false

earnest phoenix
#

@shy turret mentioneduser => i think he want mentioned user

#

@topaz fjord like what ?

#

All is différent this isn't good for upgrade 🤷‍♂️

shy turret
#
if (!message.mentions.users.size) {
// no mentions
} else {
mentioneduser = message.mentions.users.first() //stores first mentioned user
let embed = new Discord.RichEmbed()
.setAuthor('title')
.setColor("RANDOM")
.addField('test', false)
mentioneduser.send(embed)
// is a mention
} 
```@trail axle
topaz fjord
#

that's why most people recommend updating while it's still in beta

#

since you have time to change

shy turret
#

technically you can still downgrade

earnest phoenix
#

I prefear v11 :(

#

Yeah

#

You can

shy turret
#

it is like some extra parameters in the console

earnest phoenix
#

I have been

11.5.1 => 11.6.1

shy turret
#

npm i discord.js@11.6.1 to downgrade

earnest phoenix
#

I know

#

...

shy turret
#

when js makes no sense

quartz kindle
#

@shy turret is actualargs hardcoded? that makes no sense

shy turret
#

my code makes no sense im not even joking

quartz kindle
#

can you show more code?

shy turret
#

it's complicated

#

then I would need to show my whole bot..

quartz kindle
#

lul

shy turret
#

hope no one hates me for making this bot

#

i wonder if i do hardcode actualargs

copper cradle
#

why won't you show your code lol

shy turret
#

it's very complicated

#

You won't understand

quartz kindle
#

why? does it contain statistical analysis and calculus?

shy turret
#

no

copper cradle
#

pretty sure I'll understand lmao

shy turret
#

lets just say

#

it uses 2 js files and 1 something else file

#

not json or those stuff

quartz kindle
#

and?

shy turret
#

idk, im just trying to make something orginial

#

in simple words

quartz kindle
#

ok, but i dont need to know what it does to look at a piece of code and see whats wrong with it

shy turret
#

let me post it on github

quartz kindle
#

unless your actualargs gets defined somewhere and then passed around by a gazillion functions

shy turret
#

i mean it is but it isnt

empty owl
#

hey yo

#
    let color = await prompt(message, "Do you want to apply a color?\nRespond with a hex value or `none`.")
  if (color !== "none" && !color.startsWith("#")) return message.channel.send("Please send a valid hex.")
    if (color !== "none" && color.length != 7) return message.channel.send("Please send a valid hex.")
  if (color === "none") color = "#03fcf8"
  color.slice(1)
  color = "0x" + color
  
  embed.setColor(color)```
returns the error embed.setColor is not a function
#

discord.js

#

would like some help

quartz kindle
#

show where you define embed lol

empty owl
#

ah

#

let embed = custom(message, title, content)

quartz kindle
#

what is custom?

empty owl
#

and that is

shy turret
#

...

empty owl
#
  let embed = new Discord.RichEmbed()
    .setTitle(content)
    .setDescription(desc)
    .setColor(0x00e9f5)
    return embed```
quartz kindle
#

console.log(embed) after the custom line

empty owl
#

okay

shy turret
#

3 way file

#

Tim ^ (idk if I should ping or not)

empty owl
#
  RichEmbed {
  title: 'a',
  description: 'a',
  url: undefined,
  color: 59893,
  author: undefined,
  timestamp: undefined,
  fields: [],
  thumbnail: undefined,
  image: undefined,
  footer: undefined,
  file: undefined,
  files: [] } }```'
#

ahhh

shy turret
#

...

empty owl
#

color isnt wokring

#

lmao

shy turret
#

add a # on front of it

#

well

#

i mean

#

embed.color("#59893")

empty owl
#

bro u have to do it in 0x form

lyric mountain
#

Also your color is wrong

empty owl
#

i havent tried with hex codes

#

color isnt wokring
@empty owl

lyric mountain
#

It's 6 characters

empty owl
#

i realize that

lyric mountain
#

Not 5

#

Or 8 if you consider alpha

empty owl
#

the color is supposed to be 03fcf8

earnest phoenix
#

If u want you can

lyric mountain
#

So 0xff03fcf8

earnest phoenix
#

0x + color
0x59893

#

Oh

#

Too fast for me...

empty owl
#

@lyric mountain 0x03fcf8

lyric mountain
#

0x requires alpha

empty owl
#

alpha?

lyric mountain
#

Opacity

empty owl
#

ah

lyric mountain
#

It's the first two characters after z

#

X

empty owl
#

what

earnest phoenix
#

Hmmm

#

Just do

lyric mountain
#

0x00000000

earnest phoenix
#

0x + color

lyric mountain
#

Wut

earnest phoenix
#

No

lyric mountain
#

It became a hyperlink

earnest phoenix
#

You can just

#

Use

#

0x + hex color

empty owl
#

no 0x + color without the #

earnest phoenix
#

Yeah

#

Exactly!

empty owl
#

i do that

#

color = "0x" + color

shy turret
#

no

#

let me give you the whole code

empty owl
#

im okay

shy turret
#

embed.color(0x0x03fcf8)

empty owl
#

i dont want to get spoonfed

#

0x0x

earnest phoenix
#

the color is supposed to be 03fcf8
@empty owl 0x03fcf8

#

This work

empty owl
#

ik

earnest phoenix
#

Why 0x0x

shy turret
#

i mean that

earnest phoenix
#

This is bad

empty owl
#

but its a variable

shy turret
#

opps

earnest phoenix
#

Just use

#

0x03fcf8

shy turret
#

i copied it from another msg

#

sry

earnest phoenix
empty owl
#

ITSSSSS A VARRIABLE

shy turret
#

wdym

empty owl
#

like

earnest phoenix
#

Bruh

shy turret
#

0x + string

earnest phoenix
#

Gn

empty owl
#

nvm lemme test again

earnest phoenix
#

@shy turret you can 0x + hex

0x + 03fcf8
0x03fcf8

#

Not

#

0x0x nanana

shy turret
#

ikr

#

i made a mistake

earnest phoenix
#

Oh okay

shy turret
#

while typing cuz i suc

earnest phoenix
#

Gn everyone i'm tired

shy turret
#

i typed 0x then pasted 0x03fcf8 from another msg lol

#

gn cya

earnest phoenix
shy turret
#

👋

empty owl
#

what

earnest phoenix
#

what a name

empty owl
#

setting 0x03fcf8 also doesnt work

earnest phoenix
#

Two

earnest phoenix
#

kmt

empty owl
#

what are tou trying to do

shy turret
#

someone stole my old tag when i lost nitro 👀

earnest phoenix
#

lol

shy turret
#
          console.log(actualargs)
          if (actualargs !== "") {
            exports.loopnum = parseFloat(lineargs);
          }

doesnt work

empty owl
#

that doesnt tell me what you are trying to do

shy turret
#

actualargs is set according to console.log()

#

but it doesnt pass the if statement

#

exports.loopnum = parseFloat(lineargs); does not occur in simple words

#

or is it that it always occurs...

#

let me check

empty owl
#

if actual args does not equal anything

shy turret
#

wait im dumb

#

it always occurs

#

...

empty owl
#

what are you trying to do

shy turret
#

wait but it shouldnt

empty owl
#

are you trying to do exports.loopnum = parseFloat(lineargs) when actualargs doesnt exist

shy turret
#

no

#

it does

#

it's complicated...

#

i think i might've found the problem

quartz kindle
#

@shy turret i looked at yoir code

shy turret
#

is it ugly? ok

quartz kindle
#

Your problem is most likely because youre using global variables in a lot of places

#

very ugly

shy turret
#
            setTimeout(() => {
              loopCommand(client, message, code, loopnum, lines, cmdvar)
            }, 1)
#

i wonder if i add..

#

nope didnt work

quartz kindle
#

I didnt look too deep into what your code is doing, but it looked like a lot of uneeded stuff going on

#

Stop using global variables

#

That would be a good start

shy turret
#

first time i tried using global vars

#

that's like the only way to connect require() with the main process in a simple way

#

the fact that it actually works once confuses me

quartz kindle
#

You should rewrite your entire code lol

shy turret
#

that's what i did today

#

rewrite my whole most of my code

quartz kindle
#

Youre doing a lot of bad practices

earnest phoenix
#

lol

shy turret
#

ikr

quartz kindle
#

But im gonna go sleep now

shy turret
#

i used to use txt files as databases xD

#

ok

earnest phoenix
#

lol

shy turret
#

now i use json cuz im too lazy to sql

earnest phoenix
#

lazy bomboclaat

shy turret
#

and i found out how to fix all the json bugs

earnest phoenix
#

yes two

empty owl
#

lemme try again

shy turret
#

and that took more than a year (some months) (tried to fix somewhere in 2019 and fixed it in 2020)

empty owl
#
let color = await prompt(message, "Do you want to apply a color?\nRespond with a hex value or `none`.")
  if (color !== "none" && !color.startsWith("#")) return message.channel.send("Please send a valid hex.")
    if (color !== "none" && color.length != 7) return message.channel.send("Please send a valid hex.")
  if (color === "none") color = "#03fcf8"
 color = color.slice(1)
  color = "0x" + color
  
let embed = custom(message, title, content)
console.log(color)
  embed.setColor(color)```
this returns embed.setColor is not a function
im trying to find the problem
#

and color returns 0x03fcf8

lyric mountain
#

now i use json cuz im too lazy to sql
@shy turret use sqlite bro

#

Easiest database out there

#

And one of the fastest

shy turret
#
async function configSet(name, response) {
  //let config = require("./config.json");
  try {
    if (config[name] === undefined) {
    } else {
      await delete config[name];
    }
    if (response.toString() === "") {
    } else {
      config[name.toString()] = encodeURIComponent(response.toString());
    }
  } catch(err) {
  }
}

function fileSave() {
  fs.writeFile("config.json", JSON.stringify(config, null, 2), function(err) {
  if (err) throw err;
  });
  setTimeout(() => {
    fileSave();
  }, 1000);
}

beat me i fixed all my problems in json

quartz kindle
#

@empty owl console.log(embed) right before embed.setColor

shy turret
#

oof

empty owl
#

@quartz kindle js Promise { RichEmbed { title: 'a', description: 'a', url: undefined, color: 59893, author: undefined, timestamp: undefined, fields: [], thumbnail: undefined, image: undefined, footer: undefined, file: undefined, files: [] } }

#

wait

shy turret
#

color...

quartz kindle
#

Thats what i thought

shy turret
#

the color is not a valid color i think..................

quartz kindle
#

It has npthong to do with cplors

shy turret
#

you can put files in embeds??

quartz kindle
#

Yoir embed os retirning a promise

#

You changed it intp an async function at some point

shy turret
#

@empty owl you have to send the embed, not get the promise data with console.log

empty owl
#

ah

#

customs js const Discord = require('discord.js') module.exports = async (message, content, desc) => { let embed = new Discord.RichEmbed() .setTitle(content) .setDescription(desc) .setColor(0x00e9f5) return embed }

lyric mountain
#

Geez, is your keyboard having a stroke?

quartz kindle
#

Yes

lyric mountain
#

Omg

shy turret
#

im losing braincells now

quartz kindle
#

Embed = await custpm

empty owl
#

ok ty

shy turret
#

why do you use a whole require() statement for embeds?

quartz kindle
#

Welp im out

shy turret
#

lol ok

empty owl
#

ive never learned another way

#

soo

shy turret
#

there's something called functions

#

this is something i have used in bots i made before

#
async function simpleEmbed(message, author, description) {
  //let config = require("./config.json");
  try {
    const embed = new Discord.RichEmbed()
      .setAuthor(author)
      .setColor("RANDOM")
      .setDescription(description)
    message.channel.send({embed});
  } catch(err) {
    console.log(err)
    try {
      simpleEmbed(message, 'UNKNOWN ERROR', 'An error has occured.');
    } catch(err1) {}
  }
  return;
}
#

and then use simpleEmbed(message, "oof", "lol") in my code

empty owl
#

i do that too

shy turret
#

but you use a completely other file

#

and i use a function kept in the same file

empty owl
#

makes my code cleaner

shy turret
#

ok

#

makes sense

empty owl
#

yea

#

thanks for ur help everyone

shy turret
#

i dont think i really helped..

lyric mountain
#

Normally I make a helper file (class in my case) to store all the commonly used functions

shy turret
#

idk how to do that

lyric mountain
#

Just make a function-only file

#

I think it's better to debug this way

#

Also it's a bit faster

shy turret
#

im assuming it is like eventFile.NAME()

#

unless it is something like eventFile.run(client, message, "console.log('code2run')")

#

which is prob isnt

lyric mountain
#

No, it's really a file to contain all functions used across the project

shy turret
#

wait

#

you can store functions

#

and only use 1 require

#

to make it work in every bot file, if you have the require in it

lyric mountain
#

Yes

#

Although in my case I use a static class for that

shy turret
#

ok i never used classes in js before so rip

#

or idk how lol

lyric mountain
#

Not js lol

#

I use java

shy turret
#

oh

#

oh

lyric mountain
#

But the concept is the same

#

One require, N functions

shy turret
#

ive read a bit of other people's java code before lol

#

a lot of code is self explanatory to me

#

because

#

message.channel.send
gets the message channel and send a message

lyric mountain
#

a lot of code is self explanatory to me
@shy turret it is indeed

shy turret
#

for example

#

people make it readable

lyric mountain
#

You can probably read a java code loud, and you'll understand it like a book

shy turret
lyric mountain
#

Lets go to general chat

shy turret
#

ok

#

Ok in simple words my code:

#

actualargs = message.content.toString().slice(message.content.split(' ')[0].length + 1).toString()

lyric mountain
#

Holy

crimson vapor
#

wait, why message.content.toString()? its already a string right

lyric mountain
#

Split that in 3 variables

shy turret
#

actualargs = "hi"

#

cuz lol

#

then

#
          if (actualargs !== "") {
            exports.loopnum = parseFloat(lineargs);
          }
#

WOAH

#

It doesnt pass

lyric mountain
#

Just....

#

Doesn't js have a string.empty method?

earnest phoenix
#

well since its js

shy turret
#

simple words

#
exports.run = (client, message, args, loopnum, maxlines) => {
  actualargs = message.content.toString().slice(message.content.split(' ')[0].length + 1).toString()
  console.log(actualargs)
  if (actualargs !== "") {
    console.log("NO")
  } else {
    console.log("YES")
  }
#

Console:

hi
NO
earnest phoenix
#

cant you do !str.len() ?

shy turret
#

wdym

earnest phoenix
#

how do you find the length of a string

#

in js

#

str.len()?

shy turret
#

.length

earnest phoenix
#

ok

#

so

shy turret
#

i think i know what u mean

earnest phoenix
#

shouldnt !str.length be true if its empty?

shy turret
#

idk

earnest phoenix
#

2 secs

shy turret
#

str.length can be 0

lyric mountain
#

0 is converted to boolean is js, right?

#

0 and 1

earnest phoenix
#

yep

#

and its actually 0 and not 0

#

not just 0 and 1

lyric mountain
#

Ah

earnest phoenix
#

0 -> false , all other -> true

shy turret
#

@earnest phoenix omg thanks it actually worked

earnest phoenix
#

:3

#

np

#

tbh i'm just proud of me for remembering that

lyric mountain
shy turret
#

instantly makes another bug

earnest phoenix
#

o?

#

whats that

shy turret
#

or it didnt fix

#

i added a extra )

earnest phoenix
#

o

shy turret
#

but fixed

#

but then

#

it doesnt work again

lyric mountain
#

What error?

earnest phoenix
#

Is there a thread on here that I can get help getting SWOP to work? I went through everything, thought I did it all right, but i cant get my computer and phone to communicate

#

show code and expected output

#

@shy turret

lyric mountain
#

@earnest phoenix what's swop?

earnest phoenix
#

^

shy turret
#

if this doesnt work

earnest phoenix
#

two

#

send code xD

#

o

shy turret
#
var:  | length: 
pass (as in no args)
var: hi | length: hi
earnest phoenix
#

huh

lyric mountain
#

What

shy turret
#

wait

earnest phoenix
#

that confuses me

shy turret
#

if it doesnt pass

#

isnt that good?

lyric mountain
#

Dude

earnest phoenix
#

w h a t

shy turret
#

my code confuses me

earnest phoenix
#

thats not a good sign

#

paste the entire code

#

and expected output

shy turret
#

wait..

#

did exports.loopnum even clear

lyric mountain
#

my code confuses me
@shy turret that might be a sign of low memory

#

Download some RAM

earnest phoenix
#

xD

shy turret
#
Memory
5% | 26MB / 512MB
#

it fixed?

#

delete eventFile.loopnum fixed it

sudden geyser
#

Download some RAM
where can I get some ram

shy turret
#

@lyric mountain yah where can i download ram xD

earnest phoenix
#

it is tho

#

i mean

#

amazon is a good plan

#

ugh

shy turret
#

Retrieving all the RAM...

earnest phoenix
#

so my uni

shy turret
#

Almost there...

earnest phoenix
#

just sent out an email saying they wireless is gonna go down ):

lyric mountain
#

Seems like you're having connection issues. Would you like to search in the internet for solutions?

earnest phoenix
#

w h a t

crimson vapor
#

alright I am confused rn, not the classes, just code in general, I have this written js if (_guilds.settings.useEmbeds == true) return message.channel.send(NoPremiumEmbed); return message.channel.send(`This command is a Premium Only command.`);
but _guilds.settings.useEmbeds is undefined even though I have it defined, when I console log the _guilds.settings, I get this, does anyone know why I might be getting an undefined, did I misspell because that would make me look really dumb rn

earnest phoenix
#

You cut off the top line in that ss. What is it?

#

@crimson vapor

crimson vapor
#

ss?

earnest phoenix
#

Screenshot

crimson vapor
#

oh

#

bot token lmao

earnest phoenix
#

O

#

What is _guilds

crimson vapor
#

its the guild data

earnest phoenix
#

Sounds like an array?

crimson vapor
#

its an object but yeah

earnest phoenix
#

What exactly are you printing?

crimson vapor
#

in the ss? the _guilds.settings

earnest phoenix
#

Entire code.?

crimson vapor
#

thats kinda it

#

im sorry if I am not understanding, its a bit late

earnest phoenix
#

Could be a variable scope issue. But I can't tell without seeing the rest

crimson vapor
#
    needsPremium(client, message, command, _users, _guilds, _userGuild) {
        let NoPremiumEmbed = new MessageEmbed()
            .setAuthor(message.author.tag, message.author.avatarURL())
            .setColor('ff0000')
            .setDescription(`This command is a premium command, it cannot be used here\n\n> If this is an error, contact MILLION#1321`)
            .setFooter(command.memberName)
            .setTimestamp();

        console.log(_guilds.settings.useEmbeds);
        if (_guilds.settings.useEmbeds == undefined) return message.channel.send(NoPremiumEmbed);
        return message.channel.send(`This command is a Premium Only command.`);
    }```
#

when I console log _guilds.settings.useEmbeds its undefined but its in _guilds.settings

#

I must be spellling wrong because _guilds.settings.prefix works

earnest phoenix
#

you arent tho

crimson vapor
#

yeah its weird

earnest phoenix
#

log _guilds.settings right before the other log

crimson vapor
#

so js console.log(_guilds.settings); console.log(_guilds.settings.useEmbeds);?

earnest phoenix
#

ye

crimson vapor
#

aight one sec

earnest phoenix
#

also _guilds

#

cuz why not

#

it'd help me see whats going on

crimson vapor
#

alright

#
0|index  | {
0|index  |   levels: {
0|index  |     xpRate: 1,
0|index  |     levelCooldown: 10,
0|index  |     levelSpam: 'off',
0|index  |     roles: { '0': 'N/A' }
0|index  |   },
0|index  |   settings: {
0|index  |     disabledLogs: [],
0|index  |     disabledCommands: [],
0|index  |     prefix: 't!',
0|index  |     logs: 'N/A',
0|index  |     memberRole: 'N/A',
0|index  |     useEmbeds: true,
0|index  |     noPermsMessage: true
0|index  |   },
0|index  |   stats: {
0|index  |     totalMembers: 'N/A',
0|index  |     totalChannels: 'N/A',
0|index  |     voiceChannels: 'N/A',
0|index  |     textChannels: 'N/A',
0|index  |     totalRoles: 'N/A'
0|index  |   },
0|index  |   _id: 5e58330bcb99290b71ae423f,
0|index  |   warns: { mute: [], kick: [], ban: [] },
0|index  |   disabledCommands: { commands: [], error: true, embed: true },
0|index  |   guildId: 611720633050464300,
0|index  |   premium: { active: true, expires: 'N/A' },
0|index  |   custom: { '0': 'N/A' },
0|index  |   __v: 0
0|index  | }
0|index  | {
0|index  |   disabledLogs: [],
0|index  |   disabledCommands: [],
0|index  |   prefix: 't!',
0|index  |   logs: 'N/A',
0|index  |   memberRole: 'N/A',
0|index  |   useEmbeds: true,
0|index  |   noPermsMessage: true
0|index  | }
0|index  | undefined```
#

probably a bit annoying to read with the index | part

earnest phoenix
#

no its fine

#

it's consistent

#

thats...

#

odd..

#

very odd..

#

i barely know any js

#

but

#

that shouldnt be happening

crimson vapor
#

normally I can get errors figured out, but there are none

#

its just undefined

earnest phoenix
#

yea..

#

yea i got nothing

crimson vapor
#

Alright thanks for helping

earnest phoenix
#

np

crimson vapor
#

If anyone can figure it out ping me please

#

I’ll probably be asleep

earnest phoenix
#

ok

#

so

#

what if

#

i had a meme command

#

is that NSFW?

crimson vapor
#

Not necessarily

earnest phoenix
#

only if you make it nsfw

#

it takes memes from the meme subreddit

#

?

#

x.meme

hollow granite
#

Is there any reason why some of my bot's shards are randomly going out?

blissful scaffold
#

It's Discord, expect shards to be unstable

outer niche
#
    await event.player.hook(event)
AttributeError: 'NoneType' object has no attribute 'player' ``` ```@commands.command(name='stop')
    async def do_stop(self, ctx):
        player = self.bot.wavelink.get_player(ctx.guild.id)
        await player.disconnect()
        await ctx.send(f'Disconnecting to {channel.name}')

earnest phoenix
#

finally someone usng cogs

#

also

#

wait no that might be a lib error

outer niche
#

Ummmm ok

earnest phoenix
#

what ide are you using?

#

and paste the entire stack trace if yu can, @outer niche

outer niche
#

Issue was figured out

earnest phoenix
#

oki

charred jetty
#

        if (users[0]) var firstplace = await client.fetchUser(users[0].userid) 
        if (users[1]) var secondplace = await client.fetchUser(users[1].userid) 
        if (users[2]) var thirdplace = await client.fetchUser(users[2].userid) 
        if (users[3]) var fourthplace = await client.fetchUser(users[3].userid) 
        if (users[4]) var fifthplace = await client.fetchUser(users[4].userid) 
      
 let embed = new Discord.RichEmbed()
.setColor("00FFFF")
.setDescription(`1 - ${firstplace && firstplace.tag || 'Nobody Yet'} : ${users[0] && users[0].balance || 'None'}
2 - ${secondplace && secondplace.tag || 'Nobody Yet'} : ${users[1] && users[1].balance || 'None'}
3 - ${thirdplace && thirdplace.tag || 'Nobody Yet'} : ${users[2] && users[2].balance || 'None'}
4 - ${fourthplace && fourthplace.tag || 'Nobody Yet'} : ${users[3] && users[3].balance || 'None'}
5 - ${fifthplace && fifthplace.tag || 'Nobody Yet'} : ${users[4] && users[4].balance || 'None'}`);
 
 message.channel.send(embed);```
#

Is there any mistake?

#

Discord Api error

#

`(node:16569) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body11:05 AM

user_id: Value "5.10796282139509e+17" is not snowflake.`

earnest phoenix
#

yea

#

its not actually in that code afaik

#

its telling you that what should be an id (snowflake) isnt

#

if it is in the code, i'd say the first five lines

#

it looks like js is trying to convert a number to a floating point, hence the e+17

charred jetty
#

Ohk

#

But what will be the solution

earnest phoenix
#

that- im not sure.

pale vessel
#

v12 when?

earnest phoenix
#

idk if djs will take a string as a snowflake

#

you'd have to look in the docs for that

pale vessel
#

sure

charred jetty
#

Then i can use this? .send({embed: {description: here}})

earnest phoenix
#

well no cuz you'd still run into the same problem

pale vessel
#

no

charred jetty
#

Mm

pale vessel
#

that's not how it works

earnest phoenix
#

AFAIK, what's happening is that the users[0].userid is being converted to a float

#

as to why - again cant tell you

charred jetty
#

Hm

earnest phoenix
#

imma just leave this one to @pale vessel since they seem to know djs ;p

charred jetty
earnest phoenix
#

i dont use javascript, and i only really know the basics

charred jetty
#

Ohk

#

Then anyone gere who can gimme a solution

lilac wharf
#

Try catching the error on the fetchUser.

#

Since that might also cause another issue in the future

#

also Invalid form body means that the format of the embed is invalid.

charred jetty
#

Yes

earnest phoenix
#

but its also saying about it not being a snowflake, and the only place in that code where its even passed snowflakes is the first 5 lines

charred jetty
#

I was sending it by .send(`here`)

lilac wharf
#

Would you mind giving me an example of what users[0] or users[1] would be defined as in a command?

charred jetty
#

I am using discord-economy api

earnest phoenix
#

(print users[0])

charred jetty
#

You will find that in npm discord-economy examples

lilac wharf
#

I'm asking you for it and you can console#log(users[0]) and get the output of it

charred jetty
#

Lk

#

Ok

#

user_id: Value "5.10796282139509e+17" is not snowflake.11:27 AM

at /rbd/pnpm-volume/04d2b97d-b6b0-4096-bd33-46a980d362e6/node_modules/.registry.npmjs.org/discord.js/11.6.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:1511:27 AM

at /rbd/pnpm-volume/04d2b97d-b6b0-4096-bd33-46a980d362e6/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:2111:27 AM

at processTicksAndRejections (internal/process/task_queues.js:88:5)11:27 AM

(node:17461) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)11:27 AM

(node:17461) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
lilac wharf
charred jetty
#

Yes

lilac wharf
#

so catch the client#fetchUser

restive furnace
#

aand discord.js and eris has the user ids as a string

earnest phoenix
#

@charred jetty

charred jetty
#

Hm

earnest phoenix
#

aand discord.js and eris has the user ids as a string
@restive furnace

#

that

#

@charred jetty

#

see

#

what @lilac wharf didnt tell you

charred jetty
#

@earnest phoenix it's working

#

client.fetchUser(users[0].userid)

earnest phoenix
#

no errors?

#

and you changed nothing

restive furnace
#

better add .toString()

earnest phoenix
#

^

charred jetty
#

Promise {12:00 PM

User {12:00 PM

id: '510796282139508756',12:00 PM

username: 'My Hero Bot',12:00 PM

discriminator: '4718',12:00 PM

avatar: '4b093ba9b0dc8c41e7ad1fe3e7ffd6dc',12:00 PM

bot: false,12:00 PM

lastMessageID: '685373830990004234',12:00 PM

....

#

Many details

#

About the user

tight plinth
#

Promise 12 pm?

mossy vine
#

timestamp

tight plinth
#

Oh

storm bluff
#
    at timeout.client.setTimeout (/rbd/pnpm-volume/f47eb651-9c16-4ad3-ad8a-ecf9a6d5bbdc/node_modules/.registry.npmjs.org/discord.js/11.6.1/node_modules/discord.js/src/client/ClientManager.js:40:57)
    at Timeout.setTimeout [as _onTimeout] (/rbd/pnpm-volume/f47eb651-9c16-4ad3-ad8a-ecf9a6d5bbdc/node_modules/.registry.npmjs.org/discord.js/11.6.1/node_modules/discord.js/src/client/Client.js:436:7)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
(node:135) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
(node:135) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
help ???
golden condor
#

@storm bluff that's nothing to worry about it just means that discord.js couldn't complete a task, restart your bot

storm bluff
#

@golden condor, Okey thanks -<3

golden condor
#

If that doesn't work, feel free to ping me

storm bluff
#

okey

charred jetty
#

Got the actual problem

#

{ userid: '5.10796282139509e+17', balance: '100' }

#

The userid

#

F

#

I need to reinstall the api

#

F

#

Or

#

Delete database

tight plinth
#

99f

#

Delete db

#

And make a new clean one

finite bough
#

json db?

charred jetty
#

It's api

#

Discord-economy

#

I reinstalled it but nothing changed

#

@finite bough and i think the user is you

#

Or someone

gleaming narwhal
#

@charred jetty you can just convert the user id to string

tight plinth
#

User ID is a string

#

@charred jetty `${user ID}`

gleaming narwhal
#

if it was a string then it would not show that:
{ userid: '5.10796282139509e+17', balance: '100' }

charred jetty
#

Wait

finite bough
#

user I'd cannot have dots or alphabets

gleaming narwhal
#

yeah I know

#

But e+17 is used for long integers

#

you can try it on a calculator

finite bough
#

ik

#

but

#

like a user I'd is not that long

charred jetty
#
 
   const F = someput.map(s => console.log(s) + "|" + s.balance).join("\n")
  message.channel.send(F)```
tight plinth
#

A discours user ID is 17 or 18 numbers long

finite bough
#

18

charred jetty
#

I used it to check what's happening

#

And i got it from Console

if it was a string then it would not show that:
{ userid: '5.10796282139509e+17', balance: '100' }
@gleaming narwhal

gleaming narwhal
#

but some of them exceeds the maximum value of integer, right?

charred jetty
#

Yes

tight plinth
#

No

charred jetty
#

If he become 4rth i think it will work properly

tight plinth
#

Make a new db, and make sure u store userid as `${user ID} `

finite bough
#

@charred jetty is it. json db?

gleaming narwhal
#

or maybe you can convert to string for making it sure

charred jetty
#

@finite bough no

tight plinth
#

Coz with ur current db u can't replace userid with the real is

#

Id

finite bough
#

wait

#

isnt that a json.string format

tight plinth
#

It is

gleaming narwhal
#

it is

finite bough
#

it is

gleaming narwhal
#

but why result doesn't have a quote char around key

finite bough
#

^

#

like "userid" :

gleaming narwhal
#

yep

finite bough
#

imagine saving in txt

gleaming narwhal
modest maple
#

imagine using json or txt as a db anyway

finite bough
#

json dbs r decent

#

but

#

on glitch

#

pls just dont

modest maple
#

its not even that hard to use a sqlite lite db

#

and just use json strings in it

finite bough
modest maple
#

for small bots i litterally have one class that i use for everything that handles adding removing stuff etc..

charred jetty
#

Fixed

#

@modest maple the main problem is glitch can't read sqlite file

#

😑

modest maple
#

pretty sure it supports a .db file

charred jetty
#

Yes

earnest phoenix
#

Lol

modest maple
#

then why not just us .db?

finite bough
#

@charred jetty it can

charred jetty
#

But the api uses .sqlite file

earnest phoenix
#

Glitch can use sqlite

modest maple
#

sqlite works with .db ez

finite bough
#

^

charred jetty
#

Glitch can use it but can't show me the file

finite bough
#

it can

earnest phoenix
#

You just have to install a module for this like sqlite or sqlite3

finite bough
#

u need a sqlite code reader

charred jetty
#

Demo

modest maple
#

i mean its a db file your not supposed to just open in

tight plinth
#

Lol

finite bough
#

u need a sqlite code reader

charred jetty
#

Yes

finite bough
#

some modules on vsc will do it

modest maple
#

DBs are NOT text files

earnest phoenix
#

A sqlite file can't be read like this, this isn't magic

modest maple
#

any db cant be read like that

#

xD

finite bough
#

magic exists

#

I got 90/100 without studying

earnest phoenix
#

Json can, this isn't really for db but....

charred jetty
#

Now everything is ok.. and me gonna offline

tight plinth
#

No it dont exist

finite bough
#

it does

#

want to see it

charred jetty
#

😂 topic changed

finite bough
#

xD

charred jetty
earnest phoenix
#

Don't lie
Magie is a lie.

finite bough
#

no

tight plinth
#

Here we talk about development problems, normt magic

finite bough
#

every boy has magic inside his pants

tight plinth
#

@earnest phoenix don't selfstar

earnest phoenix
#

@tight plinth yes :(

charred jetty
#

Ik only one thing.. idc about magic exist or not but glitch exist

tight plinth
#

Glitch exists

finite bough
#

no

tight plinth
#

And it sucks

finite bough
#

ehh

#

better than heroku

#

:)

tight plinth
#

No

#

Team heroku

earnest phoenix
#

Oof

tight plinth
#

(til I get a real vps)

finite bough
#

Team glitch

earnest phoenix
#

Heroku and glitch are bad buy a vps

cursive dagger
#

lumap ill cover you for a while ig

tight plinth
#

Wdym

cursive dagger
#

ill give you my vps for some time

tight plinth
#

Rly!?

lethal stratus
#

you know those moments where you just go "wow"

cursive dagger
#

yeah

lethal stratus
#

i am having omega wow moment

tight plinth
#

I'm in class, I have to do "the comedy"

cursive dagger
#

oof

lethal stratus
#

i implemented a thingy to my bot

earnest phoenix
#

Hmmm

lethal stratus
#

and it changed literally everything

#

its a gamechanger

#

wow

#

its one of the moments where you get to remove like

#

100 or more lines of code

tight plinth
#

@cursive dagger I promise u one day I'll give u money

#

Just to thanks you

finite bough
#

"one day"

earnest phoenix
#

"Two days"

tight plinth
#

Yes one day

#

I'm only 15, lol

finite bough
#

"same"

tight plinth
#

Eri comes out, let's continue to talk about development

finite bough
tight plinth
#

So

earnest phoenix
#

I'm only 16, lol

flat pelican
#

Glitch is bad ONLY if you don’t use it correctly @earnest phoenix

#

And stay on-topic please

finite bough
#

lumap insulted it not dany :/

lethal stratus
#

i have ascended

tight plinth
#

My bot sometimes randomly crashes without any reason, just see that the bot restarts and the log says the app was sropped

#

Stopped

earnest phoenix
#

@flat pelican no glitch is bad for big bots and not really good :/

flat pelican
#

Correct

earnest phoenix
#

And yes

#

@tight plinth use try catch

gleaming narwhal
#

@tight plinth if you are using a free plan probably it stops the app when it becomes unactive

tight plinth
#

I did

#

@ysfchn#859

#

I'm using heroku

gleaming narwhal
#

heroku does the same too

tight plinth
#

Just says an error occurred, a'd then restart

sinful lotus
#

@tight plinth you are not handling promises

slender thistle
#

glitch is bad for big bots
Why would you use a free host for a big bot

gleaming narwhal
#

if you are using free dyno

tight plinth
#

Not with worker dyno

#

It never stops

gleaming narwhal
#

hmm idk then

earnest phoenix
#

@slender thistle not everyon can paidemoji_162

sinful lotus
#

async functions and not handled promises dont mix well together

slender thistle
#

Shouldn't you have some money by the time your bot gets big

sinful lotus
#

why create a bot if you cant host it

earnest phoenix
#

For the pleasure

cursive dagger
#

Heroku restarts workers every day iirc

sinful lotus
#

creating a bot is an investment of money not a freelo-money

gleaming narwhal
#

maybe to gain experience

tight plinth
#

It crashes every time he hits 12 hour uptime

#

@cursive dagger no

earnest phoenix
#

@gleaming narwhal yes also

flat pelican
#

You can create a bot for fun, experience, to learn something - but if your plans are bigger, then you should spend money

tight plinth
#

I was never able to hit 1 day uptime with glitch, but I can easily hit 1 week uptime with heroku

flat pelican
#

Everything in life isn’t free

gleaming narwhal
#

by making a bot you can practice your coding skills and do something useful for people, double win

earnest phoenix
#

@flat pelican the air is free

finite bough
#

#roasted

earnest phoenix
flat pelican
#

Not if you kill our trees

finite bough
#

imagine killing trees

earnest phoenix
#

But i don't kill and tree

gleaming narwhal
#

you don't

earnest phoenix
#

I'm an example i love trees

gleaming narwhal
#

lol

cursive dagger
#

uh this isnt offtopic dw.

tight plinth
#

Wtf

flat pelican
#

Anyway, yes

finite bough
#

@cursive dagger shh

cursive dagger
#

your convo isnt dev anymore

tight plinth
finite bough
#

its developing our brain cells

earnest phoenix
#

Yeah

flat pelican
#

Contabo is nice for quality and cheap hosts if someone is looking for one

tight plinth
#

And everyone leaves this chan

sinful lotus
#

contabo is getting bad for music bots

#

but for normal ones w/o dealing with youtube

#

its fine

modest maple
#

Tbf that's cuz YT basically decided to just blanket ban IPs now

lethal stratus
#

my bot runs fine on computer but when running on pi it throws error:
Error: ENOENT: no such file or directory, scandir

#

Im currently seeing if rebuilding node helps

#

nope

#

didnt

gleaming narwhal
#

idk about error but make sure you have same modules on pi

lethal stratus
#

i have all the same modules

gleaming narwhal
#

does node version is same too?

lethal stratus
#

yep

gleaming narwhal
#

im not sure then

lethal stratus
#

it mirrors my computer perfectly

#

this also follows the fact that i also cant write to disk with fs

#

on pi

gleaming narwhal
#

idk about node

lethal stratus
#

permission is denied

#

it doesnt make any sense

#

its running as root

#

it literally has all the perms

summer torrent
#

my bot runs fine on computer but when running on pi it throws error:
Error: ENOENT: no such file or directory, scandir
@lethal stratus can you show full error

lethal stratus
#

not much more to see, but sure

Mar 06 20:29:38 raspberrypi node[14719]:     throw err;
Mar 06 20:29:38 raspberrypi node[14719]:     ^
Mar 06 20:29:38 raspberrypi node[14719]: Error: ENOENT: no such file or directory, scandir './cmds/fun'
Mar 06 20:29:38 raspberrypi node[14719]:     at Object.readdirSync (fs.js:786:3)
Mar 06 20:29:38 raspberrypi node[14719]:     at Object.<anonymous> (/home/pi/Desktop/h40/bot.js:21:9)
Mar 06 20:29:38 raspberrypi node[14719]:     at Module._compile (internal/modules/cjs/loader.js:689:30)
Mar 06 20:29:38 raspberrypi node[14719]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Mar 06 20:29:38 raspberrypi node[14719]:     at Module.load (internal/modules/cjs/loader.js:599:32)
Mar 06 20:29:38 raspberrypi node[14719]:     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Mar 06 20:29:38 raspberrypi node[14719]:     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Mar 06 20:29:38 raspberrypi node[14719]:     at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
Mar 06 20:29:38 raspberrypi node[14719]:     at startup (internal/bootstrap/node.js:283:19)
Mar 06 20:29:38 raspberrypi node[14719]:     at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)```
summer torrent
#

yes bot can't find cmds/fun

lethal stratus
#

uh

#

the folder exists

#
auth.json  bot.js  cmds  h40  helps.json  node_modules  package.json  package-lock.json  prefix.json  rebooted.json
pi@raspberrypi:~/Desktop/h40 $ ```
```pi@raspberrypi:~/Desktop/h40/cmds $ ls
fun  owner  useful
pi@raspberrypi:~/Desktop/h40/cmds $ ```
summer torrent
#

it seems to folder path is incorrect

lethal stratus
#

its running from bot.js which is at ~/Desktop/h40

#

inside of h40 (./) is cmds, and cmds/fun

#

however, i will still try doing it from ~

#

see if its having issues with local folders

#
Mar 06 20:36:26 raspberrypi node[15010]:     throw err;
Mar 06 20:36:26 raspberrypi node[15010]:     ^
Mar 06 20:36:26 raspberrypi node[15010]: Error: ENOENT: no such file or directory, scandir '~/Desktop/h40/cmds/fun'
Mar 06 20:36:26 raspberrypi node[15010]:     at Object.readdirSync (fs.js:786:3)
Mar 06 20:36:26 raspberrypi node[15010]:     at Object.<anonymous> (/home/pi/Desktop/h40/bot.js:21:9)
Mar 06 20:36:26 raspberrypi node[15010]:     at Module._compile (internal/modules/cjs/loader.js:689:30)
Mar 06 20:36:26 raspberrypi node[15010]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
Mar 06 20:36:26 raspberrypi node[15010]:     at Module.load (internal/modules/cjs/loader.js:599:32)
Mar 06 20:36:26 raspberrypi node[15010]:     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Mar 06 20:36:26 raspberrypi node[15010]:     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Mar 06 20:36:26 raspberrypi node[15010]:     at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
Mar 06 20:36:26 raspberrypi node[15010]:     at startup (internal/bootstrap/node.js:283:19)
Mar 06 20:36:26 raspberrypi node[15010]:     at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)```
#

didnt change it

#

hell, at this point im gonna try /home/pi/Desktop/h40/cmds

#

FULL PATH!

gleaming narwhal
#

what about entering full path

#

i had same issues about hosting it too

lethal stratus
#

aight, here we go

#

i had same issues about hosting it too
good to have someone in the same boat as me

#

horrah!

#

it just DMed me that it rebooted successfully

summer torrent
#

./cmds/

gleaming narwhal
#

on hosting it heroku i had file accessing issues too

lethal stratus
#

its quite odd

#

but at least we got it done in the end

#

thanks!

gleaming narwhal
#

nice to hear it is working now

lethal stratus
#

:)

earnest phoenix
#
        const owner = await message.guild.fetchMember(message.guild.ownerID)

#

it says invalid or uncached id provided

quartz kindle
#

what discord,js version?

gleaming narwhal
#

I don't use discord.js but you can try message.guild.owner

earnest phoenix
#

@quartz kindle v11

quartz kindle
#

weird

#

can you console.log the ownerID?

gleaming narwhal
#

are you sure about fetchMember requires a user id instead of a user object

summer torrent
#

it says invalid or uncached id provided
@earnest phoenix show result

quartz kindle
#

@gleaming narwhal yes, it accepts ids or any type of object which contains a user id

gleaming narwhal
#

oh ok then

earnest phoenix
#

mhm

#

they said fetchUser first

#

imma try that

quartz kindle
#

huh thats really weird

#

but i dont use v11 so idk

#

when you request a member in the discord api, its user comes with it

earnest phoenix
#

hmm

#
        let usr = await client.fetchUser(message.guild.ownerID, true);
        let owner = await message.guild.fetchMember(usr.id);
#

thats what i used @quartz kindle

finite bough
#

holdon

quartz kindle
#

i dont think you need true there

#

should be true by default

fleet mason
#

@quartz kindle Look at the things to update that discord.js posted

quartz kindle
#

what things to update?

fleet mason
#

So it's members.fetch

quartz kindle
#

thats for v12

#

hes using v11

finite bough
#

@earnest phoenix no need to fletch it

fleet mason
#

Oh I thought you needed help my bad

finite bough
#

just use message.guild.ownerID

quartz kindle
#

he tried that before

#

and it didnt work

finite bough
#

I tried it rn

#

it worked

quartz kindle
#

i know

#

it should work

#

but for some reason it didnt for him

finite bough
#

wait try message.channel.send(message.guild.ownerID)

#

wait

quartz kindle
#

yeah i told him to console.log it as well

finite bough
#

wait

#

wait

#

did I just put that in '

quartz kindle
#

lul

charred jetty
#
    else votings[user_id].voteCount++;
    
    try {
      fs.writeFileSync('./DBLcount.json', JSON.stringify(votings)); 
    } catch(err) {
      console.error(err);
    }```
#

Is there any mistake?

finite bough
charred jetty
#
const votings = require('./DBLcount.json');

app.post("/hook", async (req, res) => {
  if (req.headers.authorization !== config.auth) return res.send({code: "invalid auth"})
  let user_id = req.body.user;
  let usertag = client.users.get(user_id).tag
  let bot = req.body.bot;
  const arg = "sstl_spinning"
    const emojiname = client.emojis.find(emoji => emoji.name === arg).name
    const emojiid = client.emojis.find(emoji => emoji.name === arg).id
    
    
    if (!votings[user_id]) votings[user_id] = { voteCount: 1 };
    else votings[user_id].voteCount++;
    
    try {
      fs.writeFileSync('./DBLcount.json', JSON.stringify(votings)); 
    } catch(err) {
      console.error(err);
    }```
finite bough
#

wait that doesnt look right

quartz kindle
#

what is the problem?

charred jetty
#

Not working

finite bough
#

error?

charred jetty
#

By test button

#

No errors

finite bough
#

save it 1st

quartz kindle
#

did you debug it?

#

ie: put a console.log at the beginning to see if the request is arriving

charred jetty
#

I am sending a message of each votes by this

#

Code

finite bough
#

oh

#

@charred jetty

#

glitch?

charred jetty
#

Yes

finite bough
#

do refresh in the console

charred jetty
#

Ok

quartz kindle
#

put a console.log in there, and check if you are actually receiving the request

finite bough
#

glitch doesnt like when the client edits the files

charred jetty
#

Ol

#

Ok

#

Done

#

Glitch have glitch

#

@finite bough thanks

#

Lul

finite bough
#

@charred jetty if u want to edit that everytime someone votes

#

u have to restart the bot

charred jetty
#

Ohk

finite bough
#

lol

#

u can do

#

require("child_process").exec("refresh"))

quartz kindle
#

why?

finite bough
#

to restart it when something is triggered

quartz kindle
#

why restart everytime he gets a request?

open wagon
#

How to add me bot on site Discord.bots

modest maple
#

That is a bad idea to restart on every vote etcmm

open wagon
#

?

quartz kindle
open wagon
#

How to add me bot on site Discord.bots ?

finite bough
#

the json,js,txt files wont be updated till u restart ur bot

#

@modest maple ik

#

there is no other way to update the json files tho

open wagon
#

What is the full commands

modest maple
#

Then use a db

finite bough
#

it's his choice

#

u cant force him

quartz kindle
#

the limitation that files edited on the backend (i.e. in code or in the console) don’t automatically sync with the editor. If you want to see those changes in the editor you need to run the refresh command

finite bough
#

wait

quartz kindle
#

the file itself should be saved properly, it just doesnt show in the code editor

finite bough
#

well

#

holdon

#

ima screen share to show u that it doesnt update it

#

join general

#

@quartz kindle

quartz kindle
#

?