#development

1 messages ยท Page 1088 of 1

silver dust
#

i was making a logger bot

#

but then it gave this error:

#

UnhandledPromiseRejectionWarning: TypeError: client.channels.get is not a function

#

this is the error

opal plank
#

cache

solemn latch
#

djs 12 uses channel managers

opal plank
#

use cache to use get()

silver dust
#

oh alright

opal plank
#

can VSC do multiple workspaces in the same window?

nocturne grove
#

Okay I have a weird issue and I hope one of you can solve it. I think the problem gets clear when I explain it.
First situation:
bot: js const role = guild.roles.cache.get('id'); role.d = 'hi';
console.log(role); => role.d returns 'hi'
eval: guild.roles.cache.get('id').d => undefined

Second situation: (after restart)
eval: guild.roles.cache.get('id').d = 'hi';
eval: guild.roles.cache.get('id').d; => returns 'hi'

Why does it work if I add the property through eval and it doesn't work when the bot does it?
can anyone help me with this one? I get it's a weird thing though.

silver dust
#

UnhandledPromiseRejectionWarning: ReferenceError: message is not defined

#

now it gave this error

#

im a beginner

solemn latch
#

message can only be used in the scope it was defined

#

if you havent defined it, it wont be defined

opal plank
#

^^

#

role D?

#

not role ID?

nocturne grove
#

just to check things out

crimson vapor
#

is role.d a property?

nocturne grove
#

I want to make <role>.new_members which is an array, but I've simplified the solution (and also tested the simplified solution)

opal plank
#

?

#

i dont see d as a property from roleManager

crimson vapor
#

.cache.get() returns a role

#

not a role manager

nocturne grove
#

no it's a property I'm adding myself

crimson vapor
#

that will not work

opal plank
solemn latch
#

youd want to extend roles

#

to have d

crimson vapor
#

Erwin, its guild.roles.cache.get() not guild.roles.get()

solemn latch
#

i still dont understand extensions completely, but thats the right way to do it right?

nocturne grove
#

that will not work
@crimson vapor apparently not, but it should work. Also doing that with channels

crimson vapor
#

no

#

it is only stored as cache

#

so when your bot restarts

nocturne grove
#

I know

opal plank
#

now im confused

#

guild roles

#

returns role manager

crimson vapor
#

yes

opal plank
#

then?

crimson vapor
#

roleManager.cache.get()

#

as of d.js v12

opal plank
#

yeah cache is a collection

#

which then gets role again

crimson vapor
#

yes

opal plank
#

which doesnt have d in it

crimson vapor
#

Role does not mean roleManager

#

yes

#

he is adding .d himself

nocturne grove
#

yes I'm adding a property myself, which is possible

opal plank
#

extending?

crimson vapor
#

no

#

just adding

nocturne grove
#

Tim said it should work too

opal plank
#

i see

celest schooner
#

tim knows like every answer asked here

opal plank
#

no it's a property I'm adding myself

#

i missed this

#

derp

crimson vapor
#

why do you need a .d property that resets every time the bot restarts?

misty sigil
#

let filter = m => m.content === should work for getting collecting just the specified content right? (awaitMessages)

crimson vapor
#

I always used message collectors

opal plank
solemn latch
#

that would filter for content === something
are you trying to map?

crimson vapor
#

yes

misty sigil
#

no i just wanna filter by content

nocturne grove
#

well for my problem I don't need to answer the question, but I'm adding newly added members of a role there. Same for <role>.old_members

solemn latch
#

yeah thats how you filter, iirc

crimson vapor
nocturne grove
#

and if I can finally manage to add those properties properly, I can add some more

opal plank
#

@crimson vapor different workspaces

crimson vapor
#

oh

#

hmm

nocturne grove
#

and after restart, the new_members aren't needed anymore

opal plank
crimson vapor
#

yes it works

#

just drag it

#

to the other tab

opal plank
#

wont that move the files?

#

i assume you mean drag the explorer part

crimson vapor
#

not if you drag it to the windows part

cerulean venture
#

So I'm curious how would I let my bot play spotify stuff without ads?

#

is there some sort of spotify api?

opal plank
#

hmmm dragging that ACTUAL window?

crimson vapor
solemn latch
#

iirc spotify doesnt allow music playing

crimson vapor
#

im sure its possible

opal plank
#

well that'd still need the other VSC instance to be opened

cerulean venture
#

hmm okay

opal plank
#

open file in second window, drag over

crimson vapor
#

no the windows does not need to be open

opal plank
#

cant get it to work

crimson vapor
#

you know how you would open 2 files side by side on vsc in the same workplace?

pure lion
#

What's going on here

crimson vapor
#

do the same but with different windows

pure lion
#

Isn't there a button to split the workspace

opal plank
#

right here

#

but thats for the same workspace

crimson vapor
#

I did it with 2 different workspaces

#

also you can press Ctrl + B

opal plank
#

ctrl b toggles explorer

crimson vapor
#

yes

opal plank
crimson vapor
#

so you can drag the windows to look like they are the same

#

kinda

#

ish

opal plank
#

wot

#

im not going for visuals lmao, just trying to only have 1 instance on 2 workspaces

crimson vapor
#

ah

opal plank
#

thats what i got here

#

2 side by side

#

but they are 2 different VSC instances

crimson vapor
#

hmm

#

sorry I dont know how to explain better

opal plank
#

all good

#

its fine the way it is, just annoying to have to open 3 instances of VSC

strange trout
#

Are they different projects?@opal plank

opal plank
#

@strange trout technically yeah, 2 different workspaces

#

3 folders in total

strange trout
#

Can't you just add them all to the same workspace

opal plank
#

kinda

#

problem is the tsconfig loading

#

its 2 different langs

#

2 are Ts and 2 are Js

#

the debuggers would probably run fine since they each have their own targets, but not sure VSC linter and all that jazz would work fine

strange trout
#

Ah gotcha. Dunno then

#

But might as well rewrite that last JS to TS lol

opal plank
#

uuuuuughhh

#

that might be a bit troublesome

#

doable, but a lot of time required for it

earnest phoenix
#
                const newMoney = new Money({
                    userId: message.author.id,
                    money: "0",
                    bank: { max: 1000, current: 0 }
                })
#
newMoney.bank.current = undefiened
#

wtf ? help

amber fractal
#

what does the Money class look like

lusty quest
#

your model?

earnest phoenix
#
const mongoose = require("mongoose");

const moneySchema = mongoose.Schema({
    userId: String,
    money: Number,
    bank: Number,
    inventory: Object
})

module.exports = mongoose.model("Money", moneySchema);
#

oh no

opal plank
#

bank is a number

earnest phoenix
#

Number

#

ye

restive furnace
#

and money is number too, not a string

#

if you want bank to be an object mark it as Object.

finite bough
#

"0" = string
0 = number

pure lion
#

You can use isNaN or parseInt

digital ibex
#

sir

pure lion
#

mayam

#

LmAo imagine using the object constructor X))))

lusty quest
#

also mongoose will fail to create the dataset if the types are miss matched

earnest phoenix
#

o no

restive furnace
#

did he just take the snippet or smth BlobThinkingFast

digital ibex
#

what it looks like you're doing is creating a schema for each module or whatever u wanna call it, this is really annoying and a stupid thing to do, here r the pros and cons of doing this:
cons:

  1. harder to maintain
  2. harder to upgrade
  3. uses A LOT more storage
  4. slows down the serialisation
  5. queries will be impacted
    pros:
    none im aware of
lusty quest
#

i use maybe 3 schemas. for each of my bots

digital ibex
#

i use 2

earnest phoenix
#
money.money = money.money - number;
money.bank.current = money.bank.current + number;
message.channel.send(`Deposited ${number}$ to your bank.`);
#

why money.bank.current is not adding money

digital ibex
#

moyai

earnest phoenix
#

i did money.save()

crimson vapor
#

does mongodb send all data and let the lib deal with it or does mongodb do the searches?

earnest phoenix
#

@crimson vapor nope

lusty quest
#

wait no 1 bot uses 3 bcs one of them is not attached to the other 2 in a way

summer torrent
#

@earnest phoenix do money.save()

lusty quest
#

the others use 2 1 for the guild and 1 for users

earnest phoenix
#

i did

#

but nothing

summer torrent
#

where weirdsip

#

also use updateOne()

digital ibex
#

it decompresses the data, adorabal number

lusty quest
#

then is a type missmatched

earnest phoenix
#

only money.money is losing money

digital ibex
#

use await Promise.all :p

earnest phoenix
#

money.bank.current is not adding money

digital ibex
#

you're already been told why

crimson vapor
#

yes but lets say you can only download 5kbps, is it better to have more docs and stress the cpu or have one doc and stress then network?

lusty quest
#

i have promise all attached globally so i dont need to call it

digital ibex
#

bank is a number

summer torrent
#

@earnest phoenix show your data schema

earnest phoenix
#

._. ok wait

digital ibex
#

wdym?

earnest phoenix
#
const mongoose = require("mongoose");

const moneySchema = mongoose.Schema({
    userId: String,
    money: Number,
    bank: Object,
    inventory: Object
})

module.exports = mongoose.model("Money", moneySchema);
digital ibex
#

\๐Ÿ—ฟ

earnest phoenix
#

ye idk why i have show it

#

cuz it has no error

digital ibex
#

shouldnt inventory be an array?

summer torrent
#

replace Object with {current: 0}

crimson vapor
#

not if he wants an object

#

but an array probably would be more efficient

earnest phoenix
#

ye but better array

#
                    bank: { max: 1000, current: 0 }
#

this is my bank

digital ibex
#

just like do, type: [ { ur data here } ]

summer torrent
#

bank: { current: 0 }

crimson vapor
#

wait what is even the problem with his schema now?

earnest phoenix
#

ye idk

#

dude

summer torrent
#

or js bank: { current: { type: Number, default: 0 } }

earnest phoenix
#

but the shema makes no problem

#
                    let number = parseInt(args[0]);
                    if(number <= 0) return message.channel.send("You can't deposite a number less then 1");
                    if((money.bank.current + args[0]) > money.bank.max) return message.channel.send("The maximum of moneys that you can deposite is " + (money.bank.max - money.bank.current));
                    if(number > money.money) return message.channel.send("You don't have so much moneys.");
                    money.money = money.money - number;
                    money.bank.current = money.bank.current + number;
                    message.channel.send(`Deposited ${number}$ to your bank.`);
digital ibex
#

@earnest phoenix this is what ur doing:
i assigned bobs name to a string, and im setting the default of bobs name, if he wants to change it, to a number

earnest phoenix
#

here is the problem

digital ibex
#

both are meant to be strings in mr bobs case

earnest phoenix
#

Well

#

And

crimson vapor
#

im so confused as well

earnest phoenix
#

me 2

digital ibex
#

maybe i didnt explain it good

earnest phoenix
#

How i put a welcome picture

digital ibex
#

its okay

earnest phoenix
#

?

digital ibex
#

heres another example

#
let bob: string = 'bob';
bob = 10;
``` ?
#

does this make more sense lul

#

?

earnest phoenix
#

i just wanted to ask why the money.bank.current is not working

lusty quest
#

the thing with mongoose is for some reason it doesnt throw errors if the types on a query are miss matched (atleast what i get in the past)

digital ibex
#

you've been told many times

earnest phoenix
#
let bob: string = 'bob';
bob = 10;
``` ?

@digital ibex I fixed it

crimson vapor
#

because bank.current is not a thing

digital ibex
#

you can still do that with mongoose

earnest phoenix
#

because bank.current is not a thing
@crimson vapor bank: {max: 1000, current: 0} ._.

digital ibex
#

thats not the issue

#

well, just show what you've got now

crimson vapor
#

can I see a picture of your doc in the db?

digital ibex
#

the schema and doc

lusty quest
#

it doesnt send a doc bcs it cant send one bcs the query fails

crimson vapor
#

I want a picture of mongodb compas

earnest phoenix
crimson vapor
#

ty

lusty quest
#

hmm

#

then its not the schema i guess

earnest phoenix
#

bank.current = bank.current + number

digital ibex
#

are you awaiting it?

earnest phoenix
#

is not working

#

are you awaiting it?
@digital ibex yes

digital ibex
#

you need to await

#

send ur code

honest perch
earnest phoenix
#
async function action() {
                if(!args[0]) return message.channel.send("Please supply a number of moneys that you want to deposite.");
                if(isNaN(args[0]) && args[0].toLowerCase() != "max") return message.channel.send("Invalid number !");
                if(args[0].toLowerCase() == "max") {
                    if((money.money + money.bank.current) < money.bank.max) {
                        money.money = 0;
                        money.bank.current = money.bank.current + money.money;
                        message.channel.send(`Deposited ${money.money}$ to your bank.`);
                    }
                    if(money.money > money.bank.max) {
                        let number = money.bank.max - money.bank.current;
                        money.money = money.money - number;
                        money.bank.current = money.bank.current + number;
                        message.channel.send(`Deposited ${number}$ to your bank.`);
                    }
                }
                else {
                    let number = parseInt(args[0]);
                    if(number <= 0) return message.channel.send("You can't deposite a number less then 1");
                    if((money.bank.current + args[0]) > money.bank.max) return message.channel.send("The maximum of moneys that you can deposite is " + (money.bank.max - money.bank.current));
                    if(number > money.money) return message.channel.send("You don't have so much moneys.");
                    money.money = money.money - number;
                    money.bank.current = money.bank.current + number;
                    message.channel.send(`Deposited ${number}$ to your bank.`);
                }
                await money.save();
            }
lusty quest
#

console.log your bank object

earnest phoenix
#

this is my function

#

@lusty quest no bank is working pretty well but the math is something wrong

lusty quest
#

so is the undefined error gone?

earnest phoenix
#

nope

#

nothing

#

only the bank.current = bank.current + number is not working

crimson vapor
#

change js if(isNaN(args[0]) && args[0].toLowerCase() != "max") return message.channel.send("Invalid number !"); to js if(isNaN(args[0]) && args[0].toLowerCase() !== "max") return message.channel.send("Invalid number !");

lusty quest
#

this could be an issue due to the sync behavior of node

earnest phoenix
#

._.

#

so how i can fix it

crimson vapor
#

what was the error again?

earnest phoenix
#

only the bank.current = bank.current + number is not working
this

crimson vapor
#

can I see what the error is?

earnest phoenix
#

Bank.current is not ADDING MONEY

#

THAT IS THE PROBLEM

crimson vapor
#

oh so no error

#

oh gotcha

earnest phoenix
#

YES

crimson vapor
#

my bad

lusty quest
#

is the number a number?

earnest phoenix
#
                    let number = parseInt(args[0]);
#

._.

finite bough
#

if number was not a number he would have goten an error

lusty quest
#

not really

earnest phoenix
#

or maybe i have to parseInt() the bank.current ?

lusty quest
#

node can add numbers to strings

crimson vapor
#

yea

lusty quest
#

if you store bank.current as a number it should return as a number

finite bough
#

yea but like if he did that atleast the thing would not reamin the same

earnest phoenix
#
    bank: { max: Number, current: Number },
finite bough
#

add

lusty quest
#

it will not change bcs mongoose just dont query it bcs the field types are missmatched

earnest phoenix
#

maybe i have to fix the Shema

finite bough
#

money.save().catch(err => console.log(err))

#

to check if there is something wrong with the saving

earnest phoenix
#

OMFG

#

it works

#

i need to fix the Shema

#
    bank: { max: Number, current: Number },
finite bough
#

thats a rare case but still try it

#

lol

earnest phoenix
#

@earnest phoenix message.guild.roles ?

lusty quest
#

an error?

crimson vapor
#

guild is not defined

earnest phoenix
#

wait i need to check my code

finite bough
#

@earnest phoenix define guild

earnest phoenix
#

message.guild

crimson vapor
#

also, no need to create a role for your bot

lusty quest
#

its a ready event @earnest phoenix

earnest phoenix
#

:0

#

but u dont have to create role for ur bot

crimson vapor
#

there is no message on a ready event

lusty quest
#

either use a loop to do it for every guild or get the guildid of the guild where you want it

earnest phoenix
crimson vapor
#

you need to fetch or grab the role from the cache

lusty quest
#

i guess he has no idea about javascript and just throw a frankenstein bot from 5 different YT tutorials together

crimson vapor
#

client.guilds.cache.get("GUILDID").roles.create()

lime pumice
#

im having a error install quick.db

lusty quest
#

more precise?

solemn latch
#

quickdb has a support discord

crimson vapor
#

no you need to add the guild's ID

solemn latch
#

๐Ÿค”

honest perch
#

...

earnest phoenix
#

........

marble juniper
#

dotpostum

lime pumice
#

quick.db ppl arent helpin me out

#

can someone of u do?

solemn latch
#

the vast majority of people here ive noticed dont use quickdb

lime pumice
#

oh

#

do u use?

solemn latch
#

I use mysql

digital ibex
#

i remember when everyone here used to use it lul

crimson vapor
#

I use mongodb

solemn latch
#

I remember lots of people having issues with quickdb

digital ibex
#

same

#

quickkk quesiton

lusty quest
#

funny is if someone got issues with Databases its usually either MongoDB or quickdb

digital ibex
#

i installed nodejs v14.6, and im getting this error: SyntaxError: await is only valid in async function the code:

let connectSocket;
try {
    connectSocket = await ws.createWebSocketStream(constants.GATEWAY);
    console.log('mother trucker!!!');
} catch (e) {
    console.error(e);
}```
lusty quest
#

like in the past 5 Months. i saw like 30 people here having issues with quickdb and 5 with MongoDB

crimson vapor
#

nice error

digital ibex
#

thank m8

crimson vapor
#

try using an async function

lusty quest
#

@digital ibex is your function async?

digital ibex
#

no

lusty quest
#

make is async

digital ibex
#

with v14.6, theres a top level await

#

u can use await outside an async function

pure lion
#

Wait

#

Omg

pure lion
#

That's so sexy

digital ibex
#

its not

pure lion
#

I love that so much

digital ibex
#

its really annoying

crimson vapor
#

do node -v

digital ibex
#

i done that

#

v14.6

pure lion
#

:v

#

Just type node

#

It's not that hard

digital ibex
#

wot

crimson vapor
#

are you using .mjs?

pure lion
#

Welcome to node {version}

digital ibex
#

but the ctrl + c twice ๐Ÿ˜ฉ

#

no, js

pure lion
#

๐Ÿ˜ ๐Ÿ˜”

#

๐Ÿณ๏ธโ€๐ŸŒˆ:rainbow_flag:

crimson vapor
#

yeah

pure lion
#

Oh it actually joins them

crimson vapor
#

on the article it says module.mjs when they show code

#

so try using mjs

pure lion
#

What is the difference between mjs and js?

crimson vapor
#

idk

pure lion
#

e

digital ibex
#

mjs is just like source code.. of es6 kinda i think

#

im not familiar with it or ever used it in a production environment

earnest phoenix
#

@lusty quest hey u there ?

#
Money.sort(['money'])
lusty quest
#

ye

earnest phoenix
#

this not correct

#

how i can fix it :))

lusty quest
#

ยฏ_(ใƒ„)_/ยฏ

crimson vapor
#

Money.sort( a.money - b.money)

digital ibex
#

you do realise

#

thats not how sort works?

earnest phoenix
#
(node:7577) UnhandledPromiseRejectionWarning: TypeError: money.sort is not a function
lime pumice
#

Does someone has a fix for quick.db

digital ibex
#

๐Ÿ—ฟ

crimson vapor
#

ah yes forrgot

#

what the FUCK does moyaing mean

digital ibex
#

haha lmfao @solemn latch

crimson vapor
#

explain

digital ibex
#

its basically

#

my version of saying bruh

solemn latch
#

ah

crimson vapor
#

its stupid tbh

digital ibex
#

ok

crimson vapor
#

iirc mongodb uses different sort

digital ibex
#

what sort?

crimson vapor
#

one sec

digital ibex
#

its stupid tbh

#

never heard of it, but if it is a thing, sounds useless

crimson vapor
solemn latch
#

your database sorting?

digital ibex
#

i thought meant an array.sort but for mongo

solemn latch
#

429 errors typically mean ratelimit

#

very likely

#

most music bots rotate ip's

jovial nexus
#

someone know how to detect when someone is online?

#

i menan, if someone is online, the bot says "@someone is online"

opal plank
#

status presence

#

im assuming its d.js

#

author has presence property in it

solemn latch
#

client.guilds would be the guildManager

#

client.guilds.cache would be all the cached guilds

#

and size would give you the size of that

#

client.guilds.cache would be the actual guilds

#

spoonfeeding

bright quartz
#

Does anyone know how to add a music command to play music on the bot? It should connect to the voice channel itself

#

Ok

#

Thanks

solemn latch
#

depends on your language and lib

#

๐Ÿค”

bright quartz
#

I use discord.js

#

With MongoDB and Heroku

solemn latch
#

the link he gave you is java

bright quartz
#

Oh

solemn latch
#

heroku doesnt like music bots

bright quartz
#

Why

#

Server Load?

solid falcon
#

Is Guild changed to Server on discord.py latest version?

solemn latch
#

in that example, the console log would log 3

bright quartz
#

Yes i think

solemn latch
#

because map has a size of 3

bright quartz
#

Heroku likes bots wth

solemn latch
#

size gets the size of something

bright quartz
#

They earn $$$ from our bot hosting

solemn latch
#

well, heroku likes to host websites, not bots

bright quartz
#

It can host nice enough

solemn latch
#

something being your guilds @earnest phoenix

bright quartz
solemn latch
#

sure, but music bots require multiple ip's

#

heroku doesnt offer that

bright quartz
#

Ohhhhhh

#

Does Glitch allow me to do that

solemn latch
#

glitch doesnt let bots run 24/7 unless you pay for their 24/7 product

#

which is overpriced

bright quartz
#

Oh

#

Can't I use both

#

Lol

solemn latch
#

at the end of the day, pretty sure youll be spending money to have a music bot

bright quartz
#

Oh

#

Can't I use my computer

#

To host and stuff

solemn latch
#

self hosting isnt a great idea either.
if you use youtube for music bots, youll get your whole home network banned from youtube

bright quartz
#

Oh

#

I will use a Vpn then

solemn latch
#

nearly everyone ive seen use heroku and music bots end up getting banned

bright quartz
#

Lol

#

Why

solemn latch
#

or paying for better services

bright quartz
#

Why they get ban

solemn latch
#

its not really what its made for

bright quartz
#

Ohhhhhh

#

I see

#

What's your opinion

solemn latch
#

proper vps hosting

bright quartz
#

?

#

Wth is dat

solemn latch
#

virtual private server

lusty quest
#

iirc heroku doesnt offer enought power for music bots

lusty quest
#

many users here tryed it but came here bcs of out of memory errors

bright quartz
#

virtual private server
@solemn latch how do I do that

solemn latch
#

the link i just posted is a handful of suggested providers

#

i use galaxygate personally to host my websites and bots.
but any of them work really

bright quartz
#

Oh, I used Digital Ocean

lusty quest
#

i can also recomend Digital ocean

bright quartz
#

It gives 100$ when u add a payment method

solemn latch
#

i dont think they do that promotion anymore

lusty quest
#

will last for me maybe 4 Months

bright quartz
#

No

#

They still have it

earnest phoenix
#

i use GCP

#

Google cloud

bright quartz
#

Firebase?

earnest phoenix
#

and it gives me 300$

#

and i can use it for 1 years

sonic lodge
#

that bonus $ shouldn't be a selling point

bright quartz
#

Lol

#

You is correct

lusty quest
#

Digital ocean is solid. i have currently 5 VPS there and they just work without any issue

bright quartz
#

Ok

earnest phoenix
#

i recommend this

bright quartz
#

So, I can host my bot there

lusty quest
#

ovh is shit

quaint hound
#

vultr is really good as well

earnest phoenix
#

why ?

lusty quest
#

they have a solid firewall

#

but it blocks Discord

earnest phoenix
#

wtf is that

#

LoL

#

so why DJS recommen

#

it

lusty quest
#

it works

solemn latch
#

paid promotion?

lusty quest
#

but can be annoying

bright quartz
#

Lol

lusty quest
#

some users reported that they have issues with bots there

earnest phoenix
#

hmmmm

#

sad

bright quartz
lusty quest
#

i had a Root server from OVH but it was Meh. so many issues with hosting gameservers

earnest phoenix
#

or maybe this

bright quartz
#

Nah

earnest phoenix
#

2GB ram

#

it is good

golden condor
#

check pins

quaint hound
#

i personally use vultr because of price and also ease of use

bright quartz
#

Digital Ocean sounds good

earnest phoenix
#

wait we need CPU

#

not RAM ?

lusty quest
#

if you want something reliable go to a Hoster with good rep

golden condor
quaint hound
lusty quest
#

contabo is ok but nah

earnest phoenix
#

but we need good cpu not ram

bright quartz
#

What does a VPS do?

lusty quest
#

you need Ram CPU not really

earnest phoenix
#

Makes ur bot 24/7

quaint hound
#

its just like your own server

solemn latch
#

its a small portion of a larger server

quaint hound
#

so you can run the bot all the time without having to keep your home computer on all the time

bright quartz
#

So what

solemn latch
#

other people are on the server with their own section of the server

bright quartz
#

Heroku does that too

quaint hound
#

thats not important woo

earnest phoenix
#

if ur bot is smal

solemn latch
#

he asked what a vps is

earnest phoenix
#

u can use Heroku

solemn latch
#

๐Ÿค”

#

lol

lusty quest
#

you can but its annoying af

quaint hound
#

i think he just meant what do i do with it

bright quartz
lusty quest
#

and paid VPS offer you more power and are more stable

#

with no forced restarts

bright quartz
#

Oh

quaint hound
#

for all simple intents and purposes its the same as a dedicated server

earnest phoenix
#

If ur bot is in 20servers or less u can use Heroku

ashen shard
#

hello everyone, i need my bot to write a text and end the message with a custom emoji

#

what can i do?

bright quartz
#

UWotMateLolLmao Should I buy one

ashen shard
#

i use javascript

earnest phoenix
#

@ashen shard Read docs

#
quaint hound
#

your bot can use emojis just by typing out the emoji string

#

and discord will make it into the correct emoji

earnest phoenix
#

@ashen shard u need to add emoji and then send it

quaint hound
#

just look at docs to see the proper format

earnest phoenix
#

ye

#

for example

bright quartz
#

I have a Moderation bot

earnest phoenix
#

:x:

#

is diffrent of

#

\:x:

#

โŒ

#

\โŒ

bright quartz
#

I have a partnership with Heroku

earnest phoenix
#

wtf

#

wdym

torn ravine
#

?

#

how

bright quartz
#

My bot iz online for Lifetime

earnest phoenix
#

me 2

#

everyone has it

ashen shard
#

\๐Ÿฆž

bright quartz
#

U know DashCruft?

ashen shard
#

๐Ÿฆž

#

yeah

bright quartz
#

He got Partnership with Heroku

ashen shard
#

but does the same apply for custom emojis

torn ravine
#

yes

#

\

quaint hound
#

i dont personally understand why people trust hosting sites like glitch and heroku with their public bot

torn ravine
ashen shard
#

so i have this emoji, :crycool:

bright quartz
#

So I paid with him 250$ to make app on his Heroku

#

Now it is lifetime

#

He coded the bot and more

#

It has so many features now

#

He setup MongoDB too!

#

Ez

#

Why is everyone so silent

quaint hound
#

cool lol

#

can we all agree glitch hosted bots are the worst idea

bright quartz
#

Yup

ashen shard
#

if i write message.channel.sendMessage(<:'crycool:423199537482432522>') will it send me an emoji

#

@torn ravine

lusty quest
#

sure if you pay you get a Decent host. But free suck

solemn latch
#

sendMessage?

quaint hound
#

if you're using discord.js then dont use sendMessage

#

just send

earnest phoenix
#

@bright quartz Ur so dumb

#

why u paid him

#

wtf

bright quartz
#

Lol

lusty quest
#

its a good deal?

earnest phoenix
#

nO

ashen shard
#

i'm using the classic index.js

bright quartz
#

He coded the bot

earnest phoenix
#

:0

quaint hound
#

i hope you dont mean pay him out of pocket

lusty quest
#

250$ for a lifetime?

solemn latch
#

index.js best lib

earnest phoenix
#

that is another thing

solemn latch
bright quartz
#

Yes

#

Lifetime

ashen shard
#

lol im a newbie

quaint hound
#

i thought he meant with partnership money

earnest phoenix
#

@bright quartz so u didn't coded ur bot

ashen shard
#

so im patching yt vids with discord servers to get some knowledge

bright quartz
#

I did wtf

#

He removed bugs

earnest phoenix
#

then why YOU PAID HIM

solemn latch
#

$250 to remove bugs

quaint hound
#

dude you kinda got ripped off

solemn latch
#

pog

earnest phoenix
#

LMAO

bright quartz
#

To Host my boy

#

Bot

quaint hound
#

$250 is hella expensive

earnest phoenix
#

@bright quartz ur so rich

torn ravine
#

@ashen shard that would be it

solemn latch
#

heroku is free

earnest phoenix
#

yes

#

it is free

ashen shard
#

thanks, will return after i do it.

bright quartz
#

It has a downtime

earnest phoenix
#

NO

#

it doesnt

bright quartz
#

520 hours for a month

quaint hound
#

lets say hosting fees are $5 (theyre free but for the sake of argument)

bright quartz
#

U don't know wtf

lusty quest
#

@quaint hound pay a VPS for 5 years how much did you spent?

earnest phoenix
#

free version gives u 28 days

#

so 3 days offline

bright quartz
#

ikr

earnest phoenix
#

what is the problem

quaint hound
#

$300 for 5 years

earnest phoenix
#

3 days for 250$ ?

bright quartz
#

3 Days

earnest phoenix
#

xD

lusty quest
#

so he payd 250$ for a lifetime this is way more than 5 years

earnest phoenix
#

rip 250$

bright quartz
#

No wth

solemn latch
#

how much is the extra 3 days anyway

digital ibex
#

hahha lmfao

solemn latch
#

๐Ÿค”

earnest phoenix
#

with ?

quaint hound
#

yeah but most people dont even keep their bot online for 3 years

bright quartz
#

I paid 250, he returned 50$ idk why

earnest phoenix
#

maybe he feel guilty

bright quartz
#

Now he has 200$

quaint hound
#

a one time investment wasnt smart

bright quartz
#

Bro whatever, he worked so hard

lusty quest
#

ive got a Minecraft Server with a Lifetime of uptime. payed 150$ on a Black Friday sale

quaint hound
#

if you want to get your money's worth, learn to do it yourself

solemn latch
#

pog

digital ibex
#

yes

bright quartz
#

Minecraft Server lol

outer niche
#

Don't you have to have some type of code in for your invites to jump up by two

digital ibex
#

make a server urself

#

sure

earnest phoenix
#

nah he just debug ur code and give u a hosting which is free for 250$

#

that is not good prise

quaint hound
#

^

#

idc if he "worked hard", i bet he did for that much of a steal

cinder patio
#

so in other words, you got scammed

quaint hound
#

not scammed

earnest phoenix
#

i think NighMaster is crying in a corner ?

quaint hound
#

just made a bad buying decision

earnest phoenix
#

he is not typing anymore

#

||SCAMMMM||

quaint hound
#

btw random question

earnest phoenix
#

huh ?

quaint hound
#

how many of you use one-file bots and how many use module exports

cinder patio
#

Nah that's definitely a scam. I doubt the other guy actually got the lifetime plan for 200$, probably put his bot on the free one and kept the coins

solemn latch
#

exports

earnest phoenix
#

how many of you use one-file bots and how many use module exports
@quaint hound wdym

solemn latch
#

command handler

quaint hound
#

is all or most of your bots code in one file

solemn latch
#

or no command handler

quaint hound
#

youll have a command handler either way

earnest phoenix
#

if there is command handler

opal plank
#

handler 100%

earnest phoenix
#

ur index will be 5000lines +

opal plank
#

after 10 commands you simply CANT not have it

quaint hound
#

thats not the question lmao

#

i have 2k lines in my file, it works just fine

opal plank
#

if its a bot with simple shit, sure why not, but after a while it gets too cluttered

earnest phoenix
#

@quaint hound but slow

quaint hound
#

not any slower than modules

earnest phoenix
#
const { Client, Collection } = require("discord.js");
const bot = new Client();
require('dotenv').config();
const mongoose = require("mongoose");

["aliases", "commands"].forEach(x => bot[x] = new Collection());
["snipes"].forEach(x => bot[x] = new Map());
["command", "event"].forEach(x => require(`./handlers/${x}`)(bot));

mongoose.connect(process.env.mongourl, {
    useNewUrlParser: true,
    useUnifiedTopology: true
}).then(console.log("Mongo is ready.")).catch(e => console.log(e));

bot.login(process.env.token);
#

this is my index

opal plank
#

use ES6+ syntax

cinder patio
#

performance won't matter, but it will be so much harder to modify

opal plank
#

import/export

solemn latch
#

all my commands are exported, and have 440 lines in my index

#

๐Ÿคทโ€โ™‚๏ธ

cinder patio
#

it's the same thing

ashen shard
#

It worked, thank you @torn ravine

cinder patio
#

require and import/export are the same thing

quaint hound
#

i mean i feel like both work just fine

opal plank
solemn latch
#

ones just more proper

quaint hound
#

i never had issues with too many lines cause you can just collapse in code editor

opal plank
#

thats on the twitch

quaint hound
#

plus ctrl + f works with one file and not multiple

earnest phoenix
#

imagine u use command /eval process.env.token

solemn latch
#

you can search all files

#

๐Ÿค”

quaint hound
#

yeah but thats an extra step

opal plank
#

that on youtube

earnest phoenix
#

why ;

#

remove it

opal plank
#

so, 150 on main, 140 on twitch, 400 on youtube

solemn latch
#

why is it an extra step

earnest phoenix
#

wdym ?

quaint hound
#

if i was making a framework i would 1000% use module exports

solemn latch
#

control + f pulls up my search all bar

quaint hound
#

not for me lmao

opal plank
#

jesus

#

somany db calls

earnest phoenix
#

for me it search only in one files

quaint hound
#

but idk why they put module exports in beginner tutorials because thats one of the most common beginner errors

earnest phoenix
#

when i use ctrl + f

opal plank
#

use es6 syntax

#

Export/import (default)

quaint hound
#

always use es6

solemn latch
#

exports is something your kinda expected to understand

#

before bot development

quaint hound
#

really isnt lmao

opal plank
#

you already use module export, might aswell switch to export directly

solemn latch
#

๐Ÿค”

opal plank
#

lmao i always point that out

quaint hound
#

module exports arent basic tho

solemn latch
#

yes they are

quaint hound
#

its not complicated

solemn latch
#

its like week one of js

quaint hound
#

but its not bare bones basic

#

uh no?

solemn latch
#

you should have a fairly decent grasp of JavaScript itself.

earnest phoenix
#

wtf

solemn latch
#

fairly decent grasp

restive furnace
#

exports default const example = "is this right es6 syntax?";

earnest phoenix
#

not working

quaint hound
#

they say "should"

solemn latch
#

yeah

#

its expected

opal plank
#

export default {
module
}

earnest phoenix
#

anyone use jest module ?

quaint hound
#

but i just think it adds another level of unnecessary complexity to a tutorial meant to be for beginners

earnest phoenix
#

for testing their bot

opal plank
#

here's example

#

es6

solemn latch
#

the tutorial is meant for beginners of bots, not javascript

restive furnace
#

ah okay

opal plank
#

es11 technically

#

but its using e6 stuff

quaint hound
#

ehhhh kinda

#

my point is why add a feature if its not necessary and doesnt clean up the code within the scope of the tutorial

earnest phoenix
#

im done

opal plank
#

its not necessary to use switch cases too

#

you can nest 50 IF's

#

doesnt make it right tho

#

works? yeah. its it the worst thing you can do? also yes

quaint hound
#

afaik switch and if statements are considered equally good

opal plank
#

module exports do have a feature

#

being able to delete cache and re-request

quaint hound
#

both have advantages and disadvantages

solemn latch
#

there are right times to use switch cases and if statements

#

there are right times to use exports, and not use exports

opal plank
#
if (args[0] === something) //do something;
if (args[0] === something) //do something;
if (args[0] === something) //do something;
if (args[0] === something) //do something;
//and 68 other commands```
#

ive seen this

#

quite a few times actually

quaint hound
#

that's actually faster than a switch i'm pretty sure

#

switch is just more readable

restive furnace
#

ive seen few times too js switch(msg.content) { case "help": //do something // etc. }

solemn latch
#

switch cases are build for that are they not?

opal plank
#

indeed

quaint hound
#

yeah whats the issue with that switch

solemn latch
#

thats the exact purpose for them

quaint hound
#

wait

#

no prefix

#

lmao

opal plank
#

thats just matching content

earnest phoenix
#

how to console.log()

*
**
***
****
*****
cinder patio
#

Actually switch is faster, as it basically acts as a Map, while if statements get checked one by one

solemn latch
#

^

restive furnace
#

^^

opal plank
#

you should use the proper stuff

quaint hound
#

ik switch is faster for some things and slower for others

solemn latch
#

its their purpose to do that

earnest phoenix
#
console.log("*")
.
.
.
console.log("*****")
opal plank
#

its not cuz 'it works' that makes it ok to use

solemn latch
#

^^

quaint hound
#

i though faster for numbers and slower for strings, but i might have gotten mixed up

solemn latch
#

nah

opal plank
#

you could do 30 message event listeners and enable more than 11 listeners on node too if you the type of person who is okay with anything

solemn latch
#

i have two ready events

#

๐Ÿค”

quaint hound
#

i'm not saying its right just cause it works

solemn latch
#

a once and an on

restive furnace
#

why

opal plank
#

after 5 or 6 commands you definetly should move them into different folders

quaint hound
#

but there's usually a tradeoff between ease of use/readability, performance, and how "correct" it's considered

opal plank
#

theres no reaosn not to

solemn latch
#

the bot can be ready more than once

quaint hound
#

my reason is "i didnt feel like it"

restive furnace
#

why u then have on too? i use once only.

opal plank
#

lazyness ASakashrug

quaint hound
#

it's not hurting anybody lmao

solemn latch
#

i need some things to run on every ready event

opal plank
#

so are 33 message events

solemn latch
#

some only once

quaint hound
#

what no lmao

opal plank
#

yes

#

they both work

#

theya rent hurting anybody

#

as you said

quaint hound
#

i just meant separating commands

#

if it was my bot then maybe i would do that

opal plank
#

yeah, same for events

#

it works with multiple events

#

just ignore the memory leak warnings

#

ยฏ_(ใƒ„)_/ยฏ

solemn latch
#

i dont see you sending anything

quaint hound
#

obv that causes memory issues

opal plank
#

send it

#

you just declaring it

#

now you worry about performance?

#

its okay to not split files to make stuff better both visually and performance speaking but not 10 listeners?

#

you really on the fence with that

quaint hound
#

its not better visually to me

solemn latch
#

I do a lot not properly water, but i will never pretend that its okay

#

๐Ÿค”

opal plank
#

having an index with 5k lines is?

quaint hound
#

yeah i prefer one file just cause i dont want to switch around tabs a lot

#

sue me

opal plank
restive furnace
#

my index.js is, and will stay at 30 lines hehe

solemn latch
#

how often do you edit random files

#

finish a command, then work on the next

sudden geyser
#

my index file is 236 lines long

quaint hound
#

not too often

#

everything is pretty much set at this point

cinder patio
#

if you find it better then keep everything in one file, why is this discussion still going on? It's up to personal preference.

solemn latch
#

your probs spending more time searching for things than if you seperated everything

opal plank
#

my indexes are 150 on main, 140 on twitch, 400 on youtube and 150 on beta branch

quaint hound
#

nah I'm not

#

i know where everything is

#

i wrote it lmao

shy turret
#

I decided to try to make a little coding language but only the last line of code is working.
For some reason, line 52 is messed up and I can't find the problem. Can anyone help me?
(ping me back)

Parser Code: https://github.com/real2two/custom-scripts/blob/master/index.js (line 51-53)
send Code: https://github.com/real2two/custom-scripts/blob/master/events/send%2520%2522%2520to%2520message%2520channel.js
Read Code: https://github.com/real2two/custom-scripts/blob/master/scripts/736608210932334593.txt
Output:

quaint hound
#

and collapsing shit helps

opal plank
#

i really dont get you dawg

quaint hound
#

if you couldn't tell i'm 100% self taught

solemn latch
#

so am i

#

๐Ÿค”

digital ibex
#

same

opal plank
#

take a look

#

'self taught'

quaint hound
#

and one of the reasons people hate learning programming IME is because some things are just convention and are just considered correct

#

there's a lot of "that's not correct" just cause

opal plank
#

yeah, if you work people will tell you to standartize your code

solemn latch
#

theres a reason those correct things are correct

quaint hound
#

ever been on stack exchange

cinder patio
#

You should push your changes more often ๐Ÿ™‚

quaint hound
#

sometimes there is

opal plank
#

@cinder patio you are indeed correct

quaint hound
#

if i was actually working with people i would stick to the standard

opal plank
#

im only pushing changes on the main branch wich is privated

#

'i rather walk with my hands, untill i need to go outside, then i walk with my legs'

solemn latch
#

you never know when projects will become worked on by a team

opal plank
#

why not make a good habit?

quaint hound
#

but people like to pretend that there's only one way just because its the way most people do it

opal plank
#

the moment you need to switch you'll struggle with it cuz you always been doing it the wrong way

quaint hound
#

if there's a good enough reason ofc i would

opal plank
solemn latch
#

your saying things about this about things with actual reasons to do it properly tho.

quaint hound
#

i dont even like calling nested ifs wrong because it's not wrong

cinder patio
#

I mean, the most accepted way is probably also the best one, no? In general, if a ton of people are using it, then there's a reason why

quaint hound
#

just less efficient

#

usually there is

opal plank
#

30 message listeners also 'just work'

quaint hound
#

they're not "wrong"

#

just inefficient

opal plank
#

you're just chosing a different evil

#

why not just use the proper stuff?

sudden geyser
#

preference?

opal plank
#

lazyness

sudden geyser
#

nah

quaint hound
#

if it works, it's not wrong, and then that gets people into a weird mentality about "my way is right"

quaint hound
#

some things only have advantages in certain scenarios

opal plank
#

its not 'my way', its the standard way

#

neither of us came up with it

quaint hound
#

true

opal plank
#

we were told by who knows better than us as a fact and we followed it

quaint hound
#

not everyone who knows better than you is always right

opal plank
#

same apply for teachers

quaint hound
#

my main issue is not even giving less efficient options the time of day

opal plank
#

they have far more experience, unless you can prove otherwise, its wise to listen to it

solemn latch
#

stacking if statements is less efficent than switch cases

quaint hound
#

for example, option A is better most of the time, and everyone learns option A because its "right"

solemn latch
#

but A is better here

quaint hound
#

then people cant use option B when they need to because its "wrong"

#

true

opal plank
#

why use B when you know A is better?

quaint hound
#

its not that i take issue with

opal plank
#

thats just being stuborn

slender thistle
#

list comprehensions are more efficient in Python but fuck nested ones, I'd rather do nested for loops

quaint hound
#

i mean when B is better people cant use it because its "wrong"

solemn latch
#

yes

opal plank
#

you tell them a is better

#

so they learn frmo it

cinder patio
#

I can only consider using one file if my bot is going to have only a few commands

opal plank
#

stubbornness and laziness are killers

solemn latch
#

didnt you say your index is thousands of lines?

quaint hound
#

mine?

opal plank
#

indeed

quaint hound
#

1800

opal plank
#

i think from all of us here i was the one with most lines

#

150

#

you get the difference?

cinder patio
#

My main file is 18 lines

opal plank
#

my youtube has 400 but that could be fixed rather easily by sending the dispatcher somewhere else

solemn latch
#

^ 440 is my index, and its because lazieness

quaint hound
#

but what about having 400 lines is inherently bad

opal plank
#

mine is 400 cuz there isnt any lib on it, i had to write it all down

quaint hound
#

or even 50,000 if you can collapse it when you need to

solemn latch
#

in my case, doing things out of place.
if it was in its own file i could find it easier

quaint hound
#

there's nothing inherently wrong with that

solemn latch
#

๐Ÿค”

opal plank
#

i could just execute dispatcher with a callback function, sure, that'd cut my index to 280 ish

solemn latch
#

its so much easier to find things

quaint hound
#

this stuff comes with tradeoffs, and calling one thing "right" doesnt give the full story

solemn latch
#

two clicks to find anything

#

saving time

#

is one

quaint hound
#

easier is an opinion in a lot of cases

opal plank
#

how many things do you collpase?

solemn latch
#

i or anyone can find my api in two clicks

#

no scrolling

opal plank
#

cuz the way we telling you is 2 clicks

solemn latch
#

no searching

#

no telling where it is

opal plank
#

if you rather click on 50 collapses , good luck

quaint hound
#

depends on mood

opal plank
#

theres no mood

solemn latch
#

one is objectively faster here, even if i never told you a thing

quaint hound
#

i mean when i'm the one working on it i collapse however many I feel like

opal plank
#

how many clicks does that take you?

quaint hound
#

idk how you could have issues finding things when you wrote the code

solemn latch
#

some of my individual commands are as large as your index

#

๐Ÿค”

opal plank
#

stubbornness and laziness are killers

quaint hound
#

agreed they can be

opal plank
#

you're being both

quaint hound
#

maybe so

#

who's loss is it?

solemn latch
#

your own

quaint hound
#

and who's preference, irrational as you may consider it, matters in that case

solemn latch
#

no ones

#

your doing things wrong, for the sake of being wrong

#

really

quaint hound
#

again if I was working with someone else and it affected them too i would care a whole lot more about what was considered correct

solemn latch
#

why do it wrong, when its only taking more work to do it wrong

#

going out of your way to be wrong makes no sense to me

quaint hound
#

in my experience it doesnt feel like more work

opal plank
quaint hound
#

it feels like more work going through 18 exports to get where I need than just scrolling to where I know I put my code

solemn latch
#

you go to the one export

#

why would you go to the balance export, when you want the eval export

quaint hound
#

ok i meant file locations and such

opal plank
#

its all going to be in one folder