#development

1 messages Β· Page 1258 of 1

warm portal
#

Hm

#

I was about to learn coding and the next morning my laptop display died

#

:(

earnest phoenix
#

@warm portal get it fix is the best solution, coding on mobile is not recommended

warm portal
#

It can't be 😭😭😭 I have to buy a new one

earnest phoenix
#

Rip

earnest phoenix
#

Alright, sell-out

#

@earnest phoenix no one will buy the trash but I can sell its parts maybe will get 5k rs
@warm portal Dont ask me, ask China

#

Guys

#

Stop

#

Its getting off topic

warm portal
ionic shard
#

is there any node package which do like
starting time
time it is at
ending time
|0:00|===|1:20|=====|2:23|

#

like in music bot
showing how much of the song has passed?

earnest phoenix
#

@ionic shard theres none BUT

#

You can make one

tight plinth
#

there is some

#

wziy

#

lemme find the one I made

ionic shard
#

thanks imma try

#

50,100

#

whats that

tight plinth
#

50 elapsed

#

100 total time

torn ravine
#

@tight plinth shameless plug

tight plinth
#

I should do more thinge

ionic shard
#

@tight plinth shameless plug
@torn ravine not really when its on topic

torn ravine
#

You kinda right

ionic shard
#

100 seconds im guessing?

tight plinth
#

wait a sec

#

shouldn't matter

ionic shard
#

well im getting my time in this format
timestamps: { start: 2020-09-21T05:55:14.534Z, end: 2020-09-21T05:58:19.149Z },

tight plinth
#

hm

#

you should be able to convert that into numbers ig

#

but idk

ionic shard
#

no shit im sorry i have a class

#

ill check later

#

afk

tight plinth
#

same lol

delicate shore
opal plank
#

cache

earnest phoenix
#

@delicate shore syntax changed

#

When will you remember?

delicate shore
#

no

#

i am dumb

#

msg.guild.cache.channels

opal plank
#

other way around

delicate shore
#

doesn't work either

opal plank
#

it do

#

guild.channels.cache

delicate shore
#

oh

opal plank
#

you should really read this

delicate shore
#

it returns undefined

opal plank
#

i assume you arent -10iq'ing this and simply copying what im posting

delicate shore
#

no

#

heck no

opal plank
#

what is undefined then?

delicate shore
#
    let muteRole = msg.guild.roles.cache.find(role => role.name === "MODMAIL");

    msg.guild.channels.cache.forEach(async (channel, id) => {
          await channel.overwritePermissions(muteRole, {
            SEND_MESSAGES: false,
            ADD_REACTIONS: false
          });
        });```
opal plank
#

dude

#

yall copying this shit from where

#

legit

delicate shore
#

wot

#

I have been using it for ages

#

and it worked

#

always

opal plank
#

you legit fucking with every single channel override rather than assigning a role that doesnt have SEND_MESSAGES or ADD_REACTIONS perm

#

why the heck would you do 20+ api calls on every channel to set its override

#

rather than just assigning a role?

delicate shore
#

I need to do

opal plank
#

thats such a idiotic format you doing

delicate shore
#

for muted command

opal plank
#

thats a mute role no?

delicate shore
#

Yes

#

ignore MODMAIL

#

name

opal plank
#

meaning it should be muted on all channels

delicate shore
#

yes

opal plank
#

so why not DENY SEND_MESSAGES and REACTIONS on the ROLE and then DONT FUCK with the channels overrides?

delicate shore
#

but they have over writes

#

in each channel

opal plank
#

your role inherits

#

if your role has DENY on SEND MESSAGES it means they wont be able to send ANY messages on ANY channels UNLESS someone SPECIFICALLY allowed that role to do so

#

rather than 1 call with role assignment you spamming the api with channels overrides

#

thats stupid

delicate shore
#

YES THAT"S THE CASE

#

IT HAS THE TICK NEXT TO SEND MESSAGES

#

IN ALMOST EVERY CHANNEL

opal plank
#

Create role => give role to user
thats it

delicate shore
#

ok

opal plank
#

no need to fuck with any overrides whatsoever

delicate shore
#

also

#

how can i over write for a role

#
guild.roles.create({ data: { name: 'Mod', permissions: ['SEND_MESSAGES': false] } });
opal plank
#

why would you overwrite a role?

delicate shore
#

I meant

#

create a role

#

with deny permissions

carmine summit
#

how do i get howmany channels are there in a caegory?

opal plank
carmine summit
#

like client.channels.cache.get('categoryid').length

#

???

cinder patio
#

no

carmine summit
#

i know its not a thing

#

its just an example

#

also, how do i create a regex with a variable

cinder patio
#

If you have the category's ID, then you have to find all channels that have the parentID property set as that ID you have

carmine summit
#

If you have the category's ID, then you have to find all channels that have the parentID property set as that ID you have
@cinder patio sounds like pain to me

ionic shard
#

thats the best way wdym

cinder patio
#

Use guild.channels.cache.filter

carmine summit
#

Use guild.channels.cache.filter
@cinder patio I want to learn more

cinder patio
#

Ok well... the most I can do for you is link you the docs

#

Oh and you can create regex with a variable with the RegExp class

carmine summit
#

sure

#

i like to read the docs

cinder patio
vale garden
#

hi i have a question

carmine summit
#
var replace = /[M][M]/;
var re = new RegExp(replace, i);
//searches MM1 - MM30??? correct me if theres an error
}```
vale garden
#

are bots which send random messages at fixed times allowed

cinder patio
#

replace is already a regex

vale garden
#

are bots which send random messages at fixed times allowed

carmine summit
#

@vale garden Yes I think, just don't make it less than 10minutes

#

replace is already a regex
@cinder patio What must I do?

cinder patio
#

You can use replace, no need to create another

carmine summit
#

hm?

sand saffron
#

guys when i do commands for my bot it send 2 messages

carmine summit
#

guys when i do commands for my bot it send 2 messages
@sand saffron uh, maybe you have 2 message.channel.send()???

sand saffron
#

hm

#

let me check

carmine summit
#

or there is another instance of your bot running

#

lol

sand saffron
#

i dont have 2 message.channel.send

carmine summit
#

or there is another instance of your bot running

#

What I mean is, Same bot running on different hosting platform

#

lol

ionic shard
#

vs code terminal ? @sand saffron

sand saffron
#

.

carmine summit
#

@cinder patio

ionic shard
sand saffron
#

i only have 1 instance

#

ok

#

i just have 1

ionic shard
#

stop ur current one

sand saffron
#

but it doesnt say powershell

ionic shard
#

and try the command

#

may say node

#

ig

sand saffron
#

ok

earnest phoenix
#

@sand saffron Are you using visual studio?

sand saffron
#

yes

cinder patio
#

what?

earnest phoenix
#

Close visual studio and reopen it

carmine summit
#
var replace = /[M][M]/;
var re = new RegExp(replace, i);
//searches MM1 - MM30??? correct me if theres an error
}```
#

wat do you mean

#

by

#

replace

#

something

#

You can use replace, no need to create another

earnest phoenix
#

You can put the regexp inside the new Regexp

carmine summit
#

il try that

earnest phoenix
#

Also

#

(MM)

#

Learn regexp syntax

carmine summit
#

why no work

earnest phoenix
#

@cinder patio please teach thia guy ty

carmine summit
#

why logs nothing?!

#

im an idiot

#

i forgot cache

#

but still

#

no work

#
var re = new RegExp(/(MM)/, i);
console.log(client.channels.cache.find(channel => channel.name === re))
}```
cinder patio
#

That's not how you check if a string matches a regex

carmine summit
#

?!

cinder patio
carmine summit
#

y my for loop no work?

#
console.log(`MM${i}`)
}```
#

nvm im an idiot^2

earnest phoenix
#

This guy

#

Clearly

#

Doesnt know how to use regex

carmine summit
#

yes

earnest phoenix
#

Good night.

I'm trying to create a bot, but I'm having this error that I can't solve, can you help me?

`PS D:\Documents\satania_bot> node index.js
internal/modules/cjs/loader.js:968
throw err;
^

Error: Cannot find module 'D:\Documents\satania_bot\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js1747 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}`

carmine summit
#

rename your bot.js to index.js

#

rename your satania_bot to index.js

earnest phoenix
#

E_044 Ok

#

@carmine summit Please

#

Srtop

#

Yoir clearly dont know anythinf

#

@earnest phoenix first of all

#

Dont do that

#

Dont do what cwickks said

carmine summit
#

??

earnest phoenix
#

The error told you that youre require a module that doesnt exist

misty sigil
#

That’s not right

#

not at all

earnest phoenix
#

Which is th moudle name D:

misty sigil
#

you don’t rename the

earnest phoenix
misty sigil
#

folder

carmine summit
#

lol wtf

earnest phoenix
#

@earnest phoenix could your give me your index.js?

#

@carmine summit You

#

Are

#

Fucking dumb

#

Pelase stop

misty sigil
#

Cwickks please, just stop

carmine summit
#

ok

earnest phoenix
#

Youre not fucking helping

misty sigil
#

@earnest phoenix what is the file called where your code is

earnest phoenix
#

@misty sigil matthre

misty sigil
#

matthre

earnest phoenix
#

Matthew

#

Ht requirw a non exist module

misty sigil
#

No.

earnest phoenix
#

Nvm

misty sigil
#

that happens when you start a nonexistent file too

earnest phoenix
#

I changed the folder to index.js, but nothing changed

misty sigil
#

Ok, @earnest phoenix you are in the wrong folder

earnest phoenix
#

@carmine summit thanks so much, you fucked this man folder

misty sigil
#

nice job cwickks

earnest phoenix
misty sigil
#

rename the folder back

earnest phoenix
#

ok

#

satania_bot.js

#

?

misty sigil
#

no

#

no .js for folders

earnest phoenix
#

ok

carmine summit
#

just trying to help

earnest phoenix
#

and now?

misty sigil
#

type dir

carmine summit
#

do npm i discord.js --save

earnest phoenix
#

@carmine summit STOP

misty sigil
#

no.

#

please, stop.

earnest phoenix
#

YOU ARE CLEARLY NOT HELPING

#

YOU ARE FUCKING THINGS UP

#

SO PLEASE SHUT

misty sigil
earnest phoenix
#

kkkkkkkkkkk

#

type dir
@misty sigil I did not understand

misty sigil
#

in the power shell

earnest phoenix
#

@earnest phoenix hey matsu

#

ok

#

Wheres the project folder located?

#

try typing node index.js

#

Se eif that errored out for you

#

yes

#

type dir

#

And show what responded

#

try

#

C:\

#

then

#

Wait

#

Wait

#

@earnest phoenix hey

#

Type C:\

#

oi

#

ok

#

Press enter

#

Next step dont press enter until i said so

#

Damn

#

try

#

cd C:\

#

work?

#

why?

#

I thin kyour bot file is on C:\

#

Which located on document in your users file

#

But rn your in D:\documents

carmine summit
#

Can you show me where is your index.js file???

earnest phoenix
#

@carmine summit shut

#

Up

#

@earnest phoenix so you have tp cd to C:\

#

ok

#

so
cd C:\Users\YOUR USERNAME\Documents\satania_bot\

carmine summit
#

How do I find a voice channel that its name starts with "MM"

earnest phoenix
#

If it doesnt errored out, then youre good to go.

#

ok

#

Did it error?

opal plank
#

@earnest phoenix is that Hue hue language?

shy crown
#

@carmine summit Lang

#

?

carmine summit
#

Can someone help me

#

js

earnest phoenix
#

pt-Br

warm portal
#

@carmine summit you use discord.js ?

opal plank
#

so it is indeed hue hue language

earnest phoenix
#

FUCK IT

carmine summit
#

yes

earnest phoenix
#

I QUIT

#

I AM DONE

warm portal
#

Ok will dm you in a sec

obtuse cargo
#

Fuck

opal plank
#

fyi i understand hue hue br if you need some translation @earnest phoenix

earnest phoenix
#

entende?

opal plank
#

yeah, but only english here

earnest phoenix
opal plank
#

#general-int you can speak other languages, so if you get stuck i might be able to assist there

carmine summit
#

How do I find a voice channel that its name starts with "MM"

#

using regex?

pale vessel
#

don't use regex for that, use string.startsWith()

carmine summit
#

?

pale vessel
carmine summit
#

don't use regex for that, use string.startsWith()
@pale vessel how do i use that to do a search?

pale vessel
#

what method are you using to check the name?

carmine summit
#

client.channels.cache.find(channel => channel.name === /^[M][M]/)

fickle sapphire
#

message.channel.name.startsWith()

carmine summit
#

no?

pale vessel
#

startsWith() returns a boolean you can do find(channel => channel.name.startsWith("MM"))

#

that will get the first channel it can find that starts with MM

carmine summit
#

how do I get a string's character by position

pale vessel
#

use string.indexOf()

#
"hello world".indexOf("h"); // 0
"hello world".indexOf("e"); // 1
"hello world".indexOf("z"); // -1```
obtuse jolt
#

while True:
print("hi")

carmine summit
#

ok

#
if (channel.name.length < 3) return
let mm = channel.name.indexOf(3)
channel.setName('MM'+mm)```
So, If a channel's name starts with MM, then if it has less than 3 characters, return. then get the number of the MM, then finally rename it to MM+number
#

think its safe to run

crystal depot
#

a

pale vessel
#

@carmine summit string.indexOf returns the index of a character/word in a particular string

signal otter
#

.

silver lintel
#
module.exports = {
  name: 'work',
  aliases: ['job'],
  cooldown: 3600,
  description: "Work every hour and earn credits",
    usage: '<job>',
  type: 'fun',
  execute: async function(message, args) {
    if (!args[0]) {
      let workListEmbed = new $()
      .setColor(config.color)
      .setTitle("Avaliable Jobs")
      .setDescription("Here is the work list for Void bot. Different jobs have different salaries. Higher salary jobs generally have harder tasks to complete. You can work every hour. Type `-work <job>` to work")
      .addField("Fast Food Worker", "Salary: **300 credits**")
      .addField("YouTuber", "Salary: **400 credits**")
      .addField("Teacher", "Salary: **500 credits**")
      .addField("Developer", "Salary: **800 credits**")
      .addField("Scientist", "Salary: **1000 credits**")
      return message.channel.send(workListEmbed);
    }
  }
}
``` i want there to be no cooldown if there isnt args, but an hour cooldown if there is. l
carmine summit
#

@carmine summit string.indexOf returns the index of a character/word in a particular string
@pale vessel is indexOf(3, 4) a thing?

pale vessel
#

don't think so

carmine summit
#

olright

pale vessel
#

it is

carmine summit
#

hm?

pale vessel
#

but it's only for specifying which index it should start first

#

the way you're using it is incorrect, i'm not sure what you're trying to grab from the channel name

#

is it the value after MM?

carmine summit
#

yes

#

and its a 2 digit

pale vessel
#

only one character or the rest?

carmine summit
#

so..

pale vessel
#

so two digit after MM?

carmine summit
#

yes

pale vessel
#

you should use slice for that, ```js
"MM1234".slice(2, 4); // 12

carmine summit
#

hm

#

ok

pale vessel
#

it gets from index 2, which is after MM and until 4, which is until two characters after MM

carmine summit
#

alright

#

thanks

pale vessel
opal plank
#

HAHAHHAHAHA

#

my code is faster than moobots and nightbot

#

god bless my library caching

#

faster 10/10 times than the other two

pale vessel
#

lmao is that elon

carmine summit
#

@pale vessel some digits are only on first place.

#

1-9

pale vessel
#

can you show me what the names can look like?

carmine summit
#

MM1, MM2 - MM30

opal plank
#

@pale vessel indeed it is

pale vessel
#

oh, no foreign characters after those numbers?

#

e.g. MM12abc

carmine summit
#

nah

#

those sucks

pale vessel
#

you can use "MM12".slice(2) then

#

that would be 12 or 1, depending on the digit

carmine summit
#

so this happened...

#

@pale vessel

pale vessel
#

what am i looking at

#

oh

carmine summit
#

yes indeed

pale vessel
#

what's your code?

carmine summit
#
        console.log(i)
        let channel = client.channels.cache.find(channel => channel.name.startsWith("MM" + i))
        console.log(channel.name)
        if (channel.name.length > 4) {
            if (channel.members.size == 0) {
                let mm = channel.name.slice(2).slice(':')
                channel.setName('MM' + mm)
                console.log('ehhhhhhh' + 'MM' + mm)
            }
        }
    }```
pale vessel
#

slice(":")? slice only accepts indexes

carmine summit
#

?

pale vessel
#

you can't put a string for slice

carmine summit
#

ok

pale vessel
#

in fact, you don't need that last .slice()

carmine summit
#

i need i

#

t

pale vessel
#

slice(2) would do just fine, if i understand correctly

carmine summit
#

im making a public command ?code which they can put their 6-digit code in after the MM

pale vessel
#

and i don't think channel names can have :

carmine summit
#

MM4: ABCDEF

#

for example

pale vessel
#

so it's a command?

carmine summit
#

and yes it does

#

as a voice channel

pale vessel
#

oh

#

voice channels and categories are exceptions

silver lintel
#

.addField(Roles [${roles.length - 1}], roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None')
this working in other servers, only my one. it says utils is undefined

pale vessel
#

you must mean split(":")

#

for instance "hey".split("e") would return ["h", "y"]

#

you can use "MM12: hello".slice(2).split(":")[0] to get 12

carmine summit
#

yes split

#

YES YES YES

pale vessel
#

"MM12: hello".slice(2).split(":") would return ["12", " hello"] and you need the first element, so you need to add [0]

carmine summit
#

yes

#

totaly forgot .split tbh

#

sorry .split

pale vessel
#

can you show the code?

carmine summit
#
for (i = 1; i < 31; i++) {
        console.log(i)
        let channel = client.channels.cache.find(channel => channel.name.startsWith("MM" + i))
        console.log(channel.name)
        if (channel.name.length > 4) {
            if (channel.members.size == 0) {
                let mm = channel.name.slice(2).split(":")[0]
                channel.setName('MM' + mm)
                console.log('ehhhhhhh' + 'MM' + mm)
            }
        }
    }
pale vessel
#

can you add console.log(channel.name) after defining it?

#

oh

carmine summit
#

defining it?

pale vessel
#

LMAO you did

#

can you show me what showed in the console?

carmine summit
pale vessel
#

can't see ehhhhhhh

carmine summit
#

uh

#

tht only happens when

#

ok wait

#

MM9 has members in it

#

while MM8 doen't have any

#

if (channel.members.size == 0) this no work

pale vessel
#

well

#

you only defined the correct name there

#

so anything that isn't mm would be wrong

carmine summit
#

huh?

pale vessel
carmine summit
#

yes

pale vessel
#

the name isn't correct since the channel doesn't have any members in it

#

oof it overlapped

#

so basically use mm and in order to use that, you have to define it outside the block, maybe after let channel

carmine summit
#

hm?????????

pale vessel
#

uwotm8

#

the correct name is mm, that's what you defined it as

#

of course the values in the console isn't right, you're outputting channel.name, which is the raw name

#

mm is the formatted name

carmine summit
#

yeah right

pale vessel
#

and you only log mm if there's no members

sand saffron
#

i fixed my bot lol

pale vessel
#

you need to define mm outside the if (channel.members.size == 0) block and use that (mm) instead of channel.name

carmine summit
#

WHAT?

pale vessel
#

what are you trying to do

carmine summit
#

if there is no members inside the vc channel, and if its .length is more than 4, delete the 5charcacter to the last

#

also, i think i should use 2 for loops to make this happen

#

and rename the 0-9 to 00-09

#

yes, seems like it

#

@pale vessel

#

it works

#

but skips 2 and 3

#
      for (j = 1; j < 10; j++) {```
#

01 - 30??

delicate shore
#

My bot crashes saying ```1|index | RangeError: Source is too large

green kestrel
#

no, that last one stops at 9

carmine summit
#

how do i make a string into a number?

#

im going to make it so that +1

green kestrel
#

parseInt()?

carmine summit
#

parseint?

#

how do i use that?

green kestrel
carmine summit
#

thx

green kestrel
#

careful, because it can be very 'forgiving'

#

sometimes you dont want it to be

carmine summit
#

uh

#

why is there html

#

uhhhhhhh

green kestrel
#

because it works in browsers too

#

that was just the first example i found πŸ™‚

#

im assuming youre using node.js and discord.js or eris or such?

#
let somenum = parseInt("666"); /* somenum = 666 */
carmine summit
#

uh

#

the I and j adds up

green kestrel
#

hmm ignore that example

#

its over the top

#

its just showing all the different strings that will get accepted to convert to int

carmine summit
#

uh

#

03 is a string

#

i want to add 1 to 03

#

but it returns 4

#

using pareint

lament rock
#

That makes sense. 03 + 1 = 4

carmine summit
#
for (i = 0; i < 3; i++) {
      for (j = 0; j < 10; j++) {
        let rawNumber = `${i}${j}`
        console.log(rawNumber)
        //returns 01
        let number = parseInt(rawNumber) + 1
        console.log(number)
        //returns 4
}}
#

That makes sense. 03 + 1 = 4
@lament rock please no

#

i want to keep the 0

cinder patio
#

Then don't turn rawNumber to a number

#

keep it as a string

lament rock
#

?
What do you not understand?
JS removes extra 0s from Numbers. Discriminators from Discord's API are strings because of this

carmine summit
#

i need it to count from 01 to 30

pale vessel
#

use padStart()

cinder patio
#

If the number is lower than 10, add a 0 at the beginning

pale vessel
#
"9".padStart(2, "0"); // "09"```
#

my god

carmine summit
#

padStart aint function

pale vessel
#

use number.toString().padStart()

lament rock
#

padStart is a String prototype function. Not a standalone

carmine summit
#

omg

#

works as a charm

#

thanks

silver lintel
#
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.member;
const roles = member.roles.cache
            .sort((a, b) => b.position - a.position)
            .map(role => role.toString())
            .slice(0, -1);


//code stuff....

.addField("member", `${roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None'}`,)

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'utils' of undefined

lament rock
#

show the error stack

#

oh nvm

#

this.client is undefined

#

If you're using a class based command handler, try logging the value of this just to make sure this is referring to the command instance. Inside other functions, it may refer to the function it is inside

silver lintel
#

oh

#

ok

gentle lynx
#

so im using a command handler in discord.js, does anybody have any idea of how a help command should work? each file has name, description and category

pale vessel
#

long time no see glassy

gentle lynx
#

yes!

pale vessel
#

what happened?

#

anyway, i'm assuming you have a collection of command somewhere in your client as a property

gentle lynx
#

i lost my old acc bc i set my age as 12 while viewing an NSFW channel

#

yup I do

pale vessel
#

do you store the command category in the command's module.exports?

gentle lynx
#

yes.

pale vessel
#

if so, you can use cosnt data = client.commands.get(userInput) and use data.category for example

#

you can grab other properties too

gentle lynx
#

what's the userInput?

#

a command name?

pale vessel
#

user's input, args

#

so something like commands.get(args[0])

#

that would get you the command

gentle lynx
#

by the way, i have an array that contains all the commands

pale vessel
#

you hardcode them?

gentle lynx
#

maybe i can get every command and organize them into categories?

pale vessel
#

sure

#

is it command.category?

gentle lynx
pale vessel
#

ah, you can use if (client.commands.has(command)), no need for hardcoding

gentle lynx
#

right

#

it worked

pale vessel
#

you can sort commands as category like:```js
const formatted = {};
client.commands.map(command => formatted[command.category] ? formatted[command.category].push(command.name) : formatted[command.category] = [command.name]);

formatted; // { "General": ["ping", "help"], "Moderation": ["kick", "ban"] }```again, depends on how you name your property, this is just an example

gentle lynx
#

i have 1 question

#

how can i get the description of the command 'help'

pale vessel
#

did you set it first?

gentle lynx
#

yes

pale vessel
#

i guess client.commands.get("help").description

gentle lynx
#

thanks

#

how do i access the commands collection from another file in the commands folder

pale vessel
#

it's under client

#

since you don't pass client through your handler, you can use message.client

#

so message.client.commands

gentle lynx
#

doesn't show

silk chasm
#
 Constants
 Primitive Types 
 Dynamic Typing 
 Objects
 Arrays
 Functions
 Types of Functions ```
**ARE THESE THE BASCIS OF JAVASCRIPT**
#

hmm...seems like everybody got corona...

earnest phoenix
#

Hello world

#
 Constants
 Primitive Types 
 Dynamic Typing 
 Objects
 Arrays
 Functions
 Types of Functions ```
**ARE THESE THE BASCIS OF JAVASCRIPT**

@silk chasm NO THEY'RE THE BASICS OF JAVASCRIPT NOT BASCIS

carmine summit
#

can someone help me with voiceStateUpdate

#

i cannot understand the docs

#

so i am here

#

i want to run a code if someone left the voice channel

earnest phoenix
#

check if the channel of the state before is defined and the channel of the state after undefined

carmine summit
#

i also want to fetch the voice.channel the user left

earnest phoenix
#

there is an event for that

carmine summit
#
client.on('voiceStateUpdate', (oldMember, newMember) => {
if (!newMember.member.voice.channel) return console.log('left')
})
earnest phoenix
#

one sec

umbral zealot
#

If the oldmember has a channel and the newmember doesn't, the user has left a voice channel

#

if the oldmember doesn't have a channel but the newmemberdoes, they've connected to a voice channel

carmine summit
#

if (!newMember.member.voice.channel) return console.log('left')??

#

???

#

correct?

umbral zealot
#

Try it and see!

earnest phoenix
#

it's not supposed to be oldMember

carmine summit
#

ok wait

#
client.on('voiceStateUpdate', (oldState, newState) => {
if (!newState.member.voice.channel) return console.log('left')
})
earnest phoenix
#

it isn't a GuildMember it's a VoiceState

#

one sec waut

umbral zealot
earnest phoenix
carmine summit
#
client.on('voiceStateUpdate', (oldState, newState) => {
if (!newState.voice.channel) return console.log('left')
})
umbral zealot
#

Ok now try it

silver lintel
#
let bal = db.get(`${message.author.id}.bal`)

    if (bal === undefined) {
      db.set(message.author.id, { bal: 0 })
    }
    
    message.channel.send(`:credit_card: | **${message.author.username}** you have a balance of **:dollar: ${bal} credits**!`);
#

quick.db, says bal is null

carmine summit
#
client.on('voiceStateUpdate', (oldState, newState) => {
if (!newState.channel) return console.log('left')
})
#

???

#

?????

umbral zealot
#

dude just fucking try it

carmine summit
#

im here to learn bruh

umbral zealot
#

yeah trial and error are part of learning

carmine summit
#

i need to know why removing voice corrects it

umbral zealot
#

because voicestate does not have a voice property

#

@silver lintel null and undefined are two different things, so try just if(!bal). Also, if you do have an undefined bal and you set it, bal is still undefined, since you didn't get it again.

earnest phoenix
#

voiceStateUpdate

#

brain exercises

#

use common sense

carmine summit
#

BrUh

#

why did that took me 3 days to figure that out

silver lintel
#

@silver lintel null and undefined are two different things, so try just if(!bal). Also, if you do have an undefined bal and you set it, bal is still undefined, since you didn't get it again.
@umbral zealot i console.loged, and it passed through both of those

pale vessel
#

maybe because you didn't read docs

silver lintel
#

wait

#

:0

umbral zealot
#

Ok so again, the variable called bal is still not what you want.

carmine summit
#

i read docs multiple times

umbral zealot
#

It's still undefined

#

So you need to get () twice, or you need to figure out if there's a way to check if the key exists first

silver lintel
#

then do i asign another variable to db.get(${message.author.id}.bal)?

carmine summit
#

is discord.js officially made by discord, or some random guy who likes to code?

olive rune
#

the latter

umbral zealot
#

Well discord.js is an entire team of developers not just one guy.

carmine summit
#

so some random guys who like to code?

umbral zealot
#

A team of professional developers that have been working on it for the better part of a decade.

olive rune
#

how have they been working on it for that long if discord was founded in 2015/2016

carmine summit
#

2015

umbral zealot
#

It feels like it's been 20 years. alright fine. For the better part of 5 years.

olive rune
#

lmao

umbral zealot
silver lintel
#

Oh no, I completely forgot about .has(), ty

drifting wedge
#

how do i make args not required in d.py?

#

ping me plez

pale vessel
#

@drifting wedge

#

SORRY

#

i didn't read

earnest phoenix
#

Is there a way to add localizations into a bot easily without needing to rewrite everything?

umbral zealot
#

nope

earnest phoenix
#

k thx

umbral zealot
#

You have to add localization support to every single string you want to localize

earnest phoenix
#

guess i need to change like 200 files now

hazy sparrow
#

Ok this is not really support but can someome give me a name for my website for my bot? (Bot name is bow bot)

tight plinth
hazy sparrow
#

.

#

I guess that works

#

now time to code the website wish me luck

arctic cape
#

Discord.js => Can we make it so that if there is a permission error anywhere in code it gives the code in console log in orderly fashion rather than restarting or shutting down the bot ? Or do i have to check in each feature individually ?🧐

peak osprey
#
if (command === 'kiss') {
    var mentioned = message.mentions.members.first() || message.author;
    var autho = message.author.id;
    var say = "You kissed " + mentioned.member + "!"
    if (mentioned === message.author) {
      message.channel.send(":warning: You need to mention someone :warning:");
    } else {
        if (mentioned.id === message.author) {
          message.channel.send("You cant kiss youself :");
        }
        else {
            var avatar = message.author.avatarURL();
            console.log(avatar);
            var img = `kiss`[Math.floor(Math.random() * `kiss.length`)];
            const kissembed = new Discord.MessageEmbed()
                .setColor('#0099ff')
                .setAuthor(say, avatar, img)
                .setImage(img)
            message.channel.send(kissembed);
        }
    }
}```
#

why does it say undefinied

earnest phoenix
#

mentioned is already a member

#

look at your code

peak osprey
#

ahhhhhhh

#

ok

#

now its showing there id

arctic cape
#

If you're using author which i think you are you cant use mentions in that @peak osprey

#

like the id ones

#

You should use description i think that would be better and do icon of embed as avurl

peak osprey
#

ok

arctic cape
#

come dm and explain me better i will tell the solution

peak osprey
#

ok

carmine summit
#
        if (!message.member.voice.channel) return message.channel.send('You are not in a MM voice channel.')
        if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
        let defaultName = message.member.voice.channel.name
        let defaultPosition = message.member.voice.channel.position
        let replaceName = defaultName.replace(/MM../, '[IN LOBBY]')
        message.member.voice.channel.setName(replaceName)
        message.member.voice.channel.setPosition(0)
        setTimeout(() => {
            message.member.voice.channel.setPosition(defaultPosition)
            message.member.voice.channel.setName(defaultName)

        }, 60000)
    }```code goes buggy when used 2 times in a minute
summer acorn
#

I am trying to make a webhook for handling votes from all bot lists, but I can't figure out if this will work or not.

app.listen(9123);
app.post('/vote', (req, res) => {
    if (req.body.user && client.users.cache.get(req.body.user)) {
        require('./voted.js')(client, req.body.user);
    } else {
        console.log(`no user`);
    }
});

I've tried testing it using cURL, but it doesn't seem to do anything, although I don't know the cURL syntaxes

elfin adder
#

Well finding the music I need command to get the bot into the audio room
But the application of the bot:bot desinger for discord

carmine summit
summer acorn
#

it's not dbl related, so no

carmine summit
#

oh

#

ok

summer acorn
umbral zealot
#

@carmine summit define "goes buggy"

#

You need to be precise, we can't guess what that means.

summer acorn
#

I can guess it

#

he's using a 60 second time out

carmine summit
#

uh

#

they dont go back to the default

#

something

summer acorn
#

and also, you should specify the channels to change

#

or else people can change vcs like general vc

carmine summit
#

if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')

earnest phoenix
#

setTimeout returns a timeout object

summer acorn
#

@carmine summit that wont help it

earnest phoenix
#

use clearTimeout to cancel the timeout

summer acorn
#

if they run the command inside of the music vc, and then they go to general

earnest phoenix
#

IDs are strings bruh

summer acorn
#

once the timeout ends it will change general

#

try it

carmine summit
#

IDs are strings bruh
@earnest phoenix thats why i use !=

earnest phoenix
#

that won't matter

summer acorn
#

since you're not specifying variables

earnest phoenix
#

you're still using a number to represent a snowflake which will overflow and wrap incorrectly

#

Yea, because JavaScript doesn't have support of Big Ints, that's why ID needs to be an string

carmine summit
#

im well confused

sudden geyser
#

Well there's that BigInt type

earnest phoenix
#

what are you confused about

carmine summit
#

about why the channels wont return to their defaults when the timer ends, when command is executed 2 times in a minute

earnest phoenix
#

you create two timeouts

carmine summit
#

how?

earnest phoenix
#

lol

#

what do you actually want to do

silver lintel
#

How to remove something from an array? Like ["one", "two", "three"] how do I remove 2 from the array?

carmine summit
#

if the command is run once in a minute, the code works perfectly

summer acorn
#

.splice() .slice() .shift() and .pop() @silver lintel

leaden rover
#

Is there a good GitHub code file for changing the bot's language in a guild in discord.py?

carmine summit
#

but when the code is executed twice in a minute, the bot redefines the variable to the new channel

#

causing the old channel to not return

#

to the default

summer acorn
#

you're not using any variables

#

you're checking the member's channel

carmine summit
#

let?

earnest phoenix
#

i asked you what do you actually want to do, because this is an xyproblem and you wrapped your head around the wrong solution

summer acorn
#

which by the time the second timeout is up

earnest phoenix
#

and you're asking why the wrong solution doesn't work

summer acorn
#

the member has swapped channels

#

and your "variable" has changed

carmine summit
#

yes

summer acorn
#
if (command == 'l') {
        if (!message.member.voice.channel) return message.channel.send('You are not in a MM voice channel.')
        if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
        var chan = message.member.voice.channel;
        let defaultName = message.member.voice.channel.name
        let defaultPosition = message.member.voice.channel.position
        let replaceName = defaultName.replace(/MM../, '[IN LOBBY]')
        message.member.voice.channel.setName(replaceName)
        message.member.voice.channel.setPosition(0)
        setTimeout(() => {
            chan.setPosition(defaultPosition)
            chan.setName(defaultName)

        }, 60000)
    }
#

a simple variable can fix everything

carmine summit
#

??

summer acorn
#

look at the difference

#

you're using

if (command == 'l') {
        if (!message.member.voice.channel) return message.channel.send('You are not in a MM voice channel.')
        if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
        let defaultName = message.member.voice.channel.name
        let defaultPosition = message.member.voice.channel.position
        let replaceName = defaultName.replace(/MM../, '[IN LOBBY]')
        message.member.voice.channel.setName(replaceName)
        message.member.voice.channel.setPosition(0)
        setTimeout(() => {
            message.member.voice.channel.setPosition(defaultPosition)
            message.member.voice.channel.setName(defaultName)

        }, 60000)
    }
#

message.member.voice.channel is subject to change in that minute

carmine summit
#

YES

summer acorn
#

and inside a timeout, the code is like a new function

#

unless you specify the variables outside of it

#

it only takes for account what you're telling it to change, is when the code executes

#

unless you use variables

#

you're never specifying a variable for the channel

leaden rover
#

Is there a good GitHub code file for changing the bot's language in a guild in discord.py?

summer acorn
#

making the channel subject to change

#

which means if they switch to general vc during that minute

#

general go byebye

carmine summit
#

lol

#

its still buggy

#

do setPosition() have a ratelimit???

silver lintel
#

How to make a user's avatar inverse colors?

earnest phoenix
#

do setPosition() have a ratelimit???
@carmine summit all endpoints have a ratelimit

#

you probably aren't getting ratelimited by setPosition but rather by setName

carmine summit
#

ok i quit the code is too buggy

#

setTimeout is never a good idea

prisma ember
#

Hello

#

May I ask how to keep track of how many servers my bot is in?

#

Im using discord js

earnest phoenix
silver lintel
#

Ok thnaks

faint prism
#

How to make a user's avatar inverse colors?
@silver lintel use an API for that, or a library to do it for you

earnest phoenix
#

How can I make my bot (made by DBM) 24/7 online? I cant understand it

#

Tag me while answering Tnx

umbral zealot
#

In order for a bot to be online 24/7 it must be on a computer or server that runs 24/7.

earnest phoenix
#

Yeah I know but I can't do it

umbral zealot
#

can't do what

earnest phoenix
#

cant find video that shows me

#

the bot made by DBM

umbral zealot
#

how the bot is made is irrelevant. You're just hosting a nodejs application.

faint prism
#

by someone else
oof

#

you're assuming it's nodejs

earnest phoenix
#

Do you have a video of this?@umbral zealot

umbral zealot
#

I mean I can google for you

earnest phoenix
#

I tried

umbral zealot
#

@faint prism I'm not assuming anything, DBM is discord bot maker, it's based on discord.js

faint prism
#

ah

#

that one program on steam

faint prism
#

lmgtfy

earnest phoenix
#

OK Tnx Im gonna try it

peak osprey
#

how do i make it so that when people do ".meme" it sends a random meme

#

im using JS

#

is there docs or something

earnest phoenix
#

I don't have paying profile I can do it without paying profile?

umbral zealot
#

There are some free hosts but they all have limitations.

lament rock
#

If you have a source for where you're gonna get the memes from, you would check the api docs for the source. I think DankMemer picks it's memes from some select Reddits. Other options are just hosting your own memes and then making an API to return a random one

earnest phoenix
#

There are some free hosts but they all have limitations.
@umbral zealot Ok where can I find them?

faint prism
#

you'd need to consider NSFW censoring as well @peak osprey

peak osprey
#

true

#

so is there a doc or something

umbral zealot
#

Take a look at repl.it and heroku for 2 of the current top contenders for "bot hosting that doesn't actually suck that bad"

earnest phoenix
#

KK tnx?

faint prism
#

reddit API docs is a good place to start for retrieving the meme. discord.js docs is where to start for setting up a simple bot @peak osprey

eternal osprey
#

hey how do i make an add money command?

faint prism
#

by picking a prefix and implementing the behavior?

hazy sparrow
eternal osprey
#

ok

#

why is this server so fucking toxic

hazy sparrow
#

You have to explain what the add money command will do

umbral zealot
#

Well the thing is, when you constantly require handholding and spoonfeeding and seem to have trouble thinking on your own, it's really hard to respect you as a dev, y'know?

eternal osprey
#

i haven't asked for spoonfeeding

umbral zealot
#

Mostly you always ask for direct answers or code instead of actual programming problems.

eternal osprey
#

i literally just want an example in rough lines

faint prism
#

I mean, what are you asking? How to design it? well, then what are your requirements for that user story?

earnest phoenix
#

Hello world

umbral zealot
#

uhhh rough lines: ```
if command is give money
db.givemoney(theuser, amount)

hazy sparrow
earnest phoenix
hazy sparrow
#

Which db @eternal osprey

eternal osprey
#

okay so i have to make an if statement

umbral zealot
#

Well you have to write a command, just like every other command you have

hazy sparrow
#

^

umbral zealot
#

How that command is made depends entirely on how your bot is written

slender wagon
#
        if(user.presence.status === ("dnd")) {
          ctx.drawImage(dnd, 20, 20, 35, 35);
        }``` 
would this work if i put it in the middle of the canvas?
eternal osprey
#

i am using ls

peak osprey
#

sorry its to big

eternal osprey
#

hastebin

hazy sparrow
#

Is?

umbral zealot
#

Then you have to add the money to their account, and how you do that depends entirely on how your currency system is built.

faint prism
#

that's one way ig. you still haven't described your requirements

eternal osprey
#

ls is a database

#

okay i will try!

peak osprey
eternal osprey
#

this is what i get when i win in a dice game:

#

ls.set(message.author.id + "profile", Number(ls.get(message.author.id + "profile")) + amount);

peak osprey
#

Debugger attached.
Waiting for the debugger to disconnect...
c:\Users\linds\Downloads\MyBot\MyBot.js:31
name: 'meme',
^

ReferenceError: description is not defined
at Client.<anonymous> (c:\Users\linds\Downloads\MyBot\MyBot.js:31:11)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (c:\Users\linds\Downloads\MyBot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (c:\Users\linds\Downloads\MyBot\node_modules\ws\lib\websocket.js:797:20)
Process exited with code 1
Uncaught ReferenceError: description is not defined

eternal osprey
#

i bet i can use that too

hazy sparrow
#

I forgot why i came to this channel

#

Oh yea

#

Hw do i change the little image beside the website title in HTML?

umbral zealot
#

favicon.ico is how you do it

hazy sparrow
#

@peak osprey define description

#

favicon.ico is how you do it
@umbral zealot you telling to me?

umbral zealot
#

yes

hazy sparrow
#

Okay

#

Thanks

slender wagon
#
<link rel="icon" href="http://example.com/favicon.png">```
umbral zealot
hazy sparrow
#

Kk

slender wagon
#

i would recommed to learn some html first then starting over with your project

umbral zealot
#

I feel like that's exactly what they're doing πŸ˜›

hazy sparrow
#

No i had forgot it thats why i was asking

slender wagon
#

okay

hazy sparrow
#

I had forgot how to bold text this morning GWtloMarioFP

earnest phoenix
#

I had forgot how to bold text this morning :GWtloMarioFP:
@hazy sparrow that's not HTML that's CSS KEK

faint prism
#

sorry its to big
@peak osprey rich embeds are v11 use v12

slender wagon
#

@earnest phoenix u can bold text in html

hybrid roost
#

Hello, I have filenames array. I have to learn about files. fs.stat don't work..

earnest phoenix
#

Hello, I have filenames array. I have to learn about files. fs.stat don't work..
@hybrid roost please explain your problem better

heavy anchor
#

<b>Bold text here</b>

hybrid roost
#

Okay. I have array of strings. It is filenames. I have to learn, is this files exists. And if it isn't, I need to create this files.

vernal rivet
#

There is a method called exists() that checks if the path exists or not

earnest phoenix
#

Okay. I have array of strings. It is filenames. I have to learn, is this files exists. And if it isn't, I need to create this files.
@hybrid roost so basically for every file in the array you check if the file exists and if it isn't it creates the file?

hybrid roost
#

it is JS question*

#

@hybrid roost so basically for every file in the array you check if the file exists and if it isn't it creates the file?
@earnest phoenix yep

earnest phoenix
#

fs.exists() to check the file

#

it takes a callback function

#

the callback will only be run if the file exists

hybrid roost
#

There is a method called exists() that checks if the path exists or not
@vernal rivet it is too slowly. forEach, or for alredy end checking, but this methods no. Because if this, I can learn about 1 file

peak osprey
#

or not

sonic lodge
#

yes it is

peak osprey
#

ok

sonic lodge
#

"updated 1 package..."

lament rock
#

it said + node-fetch
That means it added that specific package

peak osprey
#

i am trying to install

#

node-fetch

lament rock
#

It is installed

umbral zealot
#

if you want to really confirm that it's added, package.json should show it, and there should be a node-fetch folder in your node_modules

peak osprey
#

ok

#
if (command === 'meme') {
  const bot = new Discord.Client();
  const fetch = require('node-fetch');
  
  const subsreddits =[
      'memes',
      'DeepFriedMemes',
      'dankmemes',
      'funny',
      'wallstreetbets'
  ];
  
  module.exports = {
      name: 'meme',
      description: 'Sends Memes',
      async execute(bot,message,args){
          const data = await fetch(`https://imgur.com/r/${subsreddits[Math.floor(Math.random() * subsreddits.length)]}/hot.json`)
          .then (response => response.json())
          .then(body => body.data);
          const selected = data[Math.floor(Math.random() * data.length)];
          return message.channel.send(new Discord.MessageEmbed().setColor(0xff00).setTitle(`HERE IS YOUR MEME`).setFooter("Requested by "+message.author.tag, message.author.displayAvatarURL({ dynamic: true })+"?size=512").setImage(`https://imgur.com/${selected.hash}${selected.ext.replace(/\?.*/,'')}`))
  
      }}```
#

so why wont this command work

sudden geyser
#

oh god

peak osprey
#

what?

earnest phoenix
#

@peak osprey SUBSREDDITS WHAT THE FUCK

umbral zealot
#

const bot = new Discord.Client(); <--- remove this line, first of all. you should only have ONE of those lines in your entire application.

sudden geyser
#

if the command is equal to meme, you're creating a new client instance and for some reason you're exporting an object

umbral zealot
#

Also, you now have a module.exports inside of a command, which cannot work, as exports only work when they're at the top level of a js file

earnest phoenix
#

you can't just give us a glob of code and ask "wHY DonT WORK??????"
find out what exactly doesn't work and we can diagnose and fix it from there

umbral zealot
#

It seems like you're just copy/pasting random code from the internet with little understanding of how it works, which is also called "shoveling code". That isn't going to work: you need to understand code that you want to use, and adapt it to your own structure.

sick fable
#

So guys basically, I didn't even created the command called ;help for my bot but whenever I type ;help it shows the weird shit in the server in which the bot is added. Discord.py. if you guys know Py then help

earnest phoenix
#

So guys basically, I didn't even created the command called ;help for my bot but whenever I type ;help it shows the weird shit in the server in which the bot is added. Discord.py. if you guys know Py then help
@sick fable wow we can definitely help without seeing your code

umbral zealot
#

No need for the sarcasm, though.

earnest phoenix
sick fable
#

Lol wait

#

There ain't a code named ;help it still shows some weird ass shit

#

πŸ˜‚πŸ˜‚πŸ˜‚

earnest phoenix
#

see the doc link i sent you

umbral zealot
#

It's built into the library.

sick fable
#

Yeah

#

So how can we make help command by our own

#

I don't need the code

umbral zealot
sick fable
#

Hmm .k thanks

hybrid roost
#

fs.exists() to check the file
@earnest phoenix so..

earnest phoenix
#

yeah

hybrid roost
#
fs.exists('./GuildConfigs/guilds/' + key + ".json", (ex)=>{
            if(!ex)
            {
                fs.writeFileSync('./GuildConfigs/guilds/' + keys + ".json", JSON.stringify(new guildClass(key, '!', 'en')));

            }
        });
umbral zealot
#

oh god, DBL on a mobile pphone

elfin adder
#

Well, yes.

umbral zealot
elfin adder
#

However, i'm not going to be

earnest phoenix
#

for bot makers go complain to the developer of the app

#

no one gives support for it here because you don't have direct control over the code

umbral zealot
#

@elfin adder DBM has a support server, you should join it instead. they'll be better equiped to help you.

hybrid roost
#

it created one long-named file..
@hybrid roost okay

#

ahahaha

#

it is working

#

i just...

umbral zealot
#

"working", perhaps, but if you read what I sent, you'll understand why you shouldn't do this.

hybrid roost
#

I just mixed up key and keys variables

umbral zealot
#

It's harder to use json directly than to use a simple database wrapper like enmap, nedb or quick.db

earnest phoenix
#

to use it properly*

umbral zealot
#

Actually, that's even more difficult.

#

because if you start dealing with atomic writes and write queues, you're in for quite a treat.

#

which is exactly why things like enmap, nedb and quick.db exist

earnest phoenix
#

i was about to also mention being thread unsafe but then i remembered that threading in node is almost non existent

sick fable
#

Don't go on the name

earnest phoenix
#

You guys can see my another doubt by seeing this out😭
@sick fable BRUH it's ${} not {}

sick fable
#

@sick fable BRUH it's ${} not {}
@earnest phoenix discord.py

earnest phoenix
#

oh

charred kindle
#

@sick fable use f"string"

sick fable
#

πŸ˜‚πŸ˜‚

#

@sick fable use f"string"
@charred kindle k bro

#

So it should be

charred kindle
#

just put f right brefore your string

sick fable
#

description = f'Blah blah blah'?

charred kindle
#

yes

sick fable
#

@charred kindle thanks :)

charred kindle
#

np

sick fable
hazy sparrow
#

@hazy sparrow that's not HTML that's CSS :KEK:
@earnest phoenix nitro flexer smh

digital ibex
#

does anyone know why im getting this error? ```js
MongoError: not authorized on lost-bot to execute command { find: "guilds", filter: { id: "446067825673633794" }, projection: {}, limit: 1, singleBatch: true, batchSize: 1, returnKey: false, showRecordId: false, lsid: { id: UUID("ab15804b-774b-4ef0-b616-a9be75e6a230") }, $db: "lost-bot"

#

i cant think of a reason for it to be unauthorised since the db users r the same

#

works on localhost, when i move it to the vm it errors

misty sigil
#

weird

#

try it with an admin account ig?

digital ibex
#

i don't believe thats a thing

misty sigil
#

well an account with admin perms

digital ibex
#

i wouldn't have perms for that since its a shared vm

dusky lagoon
#
or operable program. Check the spelling of the name, or if a path was included, verify that   
the path is correct and try again.
At line:1 char:1
+ index .
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (index:String) [], CommandNotFoundException     
    + FullyQualifiedErrorId : CommandNotFoundException
 ``` got this as a error can someone help me what it means
umbral zealot
#

it means you're trying to run something called index

#

but it's not executable

digital ibex
#

"CommandNotFoundException"

dusky lagoon
#

Hu

umbral zealot
#

are you sure you didn't mean to run node index

dusky lagoon
#

Well i just did node .

#

and it worked fine couple months ago

umbral zealot
#

you clearly changed something

#

make sure your package.json looks like this ```
"main": "index.js",
"scripts": {
"start": "node index.js"
},

#

and that you do have a file called index.js in our folder

pale vessel
#

node . checks the package.json iirc

umbral zealot
#

yep.

pale vessel
#

yep cock

dusky lagoon
#

json is checkt its fine

#
Logger = require('./helpers/logger')
const Discord = require('discord.js')
const client = new Discord.Client()
const { token, prefix } = require("./config") // Load the config file
const path = require("path")

const fs = require('fs')
client.commands = new Discord.Collection()

// Load for all commands
fs.readdir("./commands/", (err, directories) => {
    Logger.log(`Loading a total of ${directories.length} categorie(s).`, "log")
    directories.forEach(dir => {
        fs.readdir("./commands/" + dir + "/", (err, commands) => {
            commands.forEach(cmd => {
                if (cmd.endsWith('.js')) {
                    try {
                        let command = require(`${"./commands/" + dir}${path.sep}${cmd}`)
                        Logger.log(`Loading Command: ${command.name}.`,"ready")
                        client.commands.set(command.name, command);
                    } catch (e) {
                        Logger.log(`Unable to load command ${commands}: ${e}`,"error")
                    }
                }
            })
        })
    })
})
// Load for all events
fs.readdir("./events/", (err, eventFiles) => {
    Logger.log(`Loading a total of ${eventFiles.length} event(s).`,"log")
    eventFiles.forEach((dir) => {
        let eventName = dir.split(".")[0]
        Logger.log(`Loading Event: ${eventName}`,"log")
        let event = new (require(`./events/${dir}`))(client)
        client.on(eventName, (...args) => event.run(...args))
        delete require.cache[require.resolve(`./events/${dir}`)]
    })
})

client.login(token);```
#

It looks just like this

umbral zealot
#

ok and is this file called index.js ?

#

also package.json is not the same thing as index.js

#

they're 2 different files.

#

also hey, that looks like my code πŸ˜‚

dusky lagoon
#

I know its not my first time working with java

#

HAHA

honest perch
#

Lmao

#

Java

dusky lagoon
#

javascript

#

Sorry

umbral zealot
#

if your package.json has the correct main and scripts config, and doing node . doesn't work, then something else is wrong in your nodejs setup

umbral zealot
#

oh I know

#

I know exactly what you did

dusky lagoon
#

Oui

umbral zealot
#

oh well the first time, you wrote index . not node .

opal plank
#

Logger is global variable

umbral zealot
#

and now, you simply do not have nodejs installed on this machine.

opal plank
dusky lagoon
#

Correct i tranferd it on my new laptop

umbral zealot
#

So go install nodejs

dusky lagoon
#

But i did if i go to command prompt and check node -v it works

umbral zealot
#

was vscode opened when you installed node?

dusky lagoon
#

maybe i should restart my pc maybe that refreshes it'

umbral zealot
#

just closing and re-opening vscode should work

opal plank
#

i could be wrong but im fairly certain the returned elements are reversed

sick fable
#

Guys is I make the bot. So how should I advertise it in top.gg?

opal plank
#

usually it returns the file and then the error

forest drift
#

does anyone remember that one pokemon bot called smt like poke`cord? i last saw it 2 years ago and now i cant find it and im wondering if it still exists

sick fable
#

Are we still getting bot developer badge tho?

pale vessel
#

error usually comes first for callbacks actually

opal plank
#

no sloth

#

does it actually flaz?

sick fable
#

no sloth
@opal plank rip

pale vessel
#

yeah

opal plank
#

huh weird

sick fable
#

Btw why can't we get it?

#

Earn**

opal plank
dusky lagoon
#

ok node works again

opal plank
#

ask discord staff @sick fable

#

Β―_(ツ)_/Β―

#

they removed it

sick fable
#

Damn

opal plank
#

people were likely abusing it and overpopulating discord with even shittier bad bots

sick fable
#

Send the discord developer's server invite in my dm's

#

people were likely abusing it and overpopulating discord with even shittier bad bots
@opal plank oh

opal plank
opal plank
#

feel free to go there screech at mason or night

#

Β―_(ツ)_/Β―

#

oh yeah u right

#

error comes first

#

thats so odd though

pale vessel
#

always has been πŸ”«

opal plank
#

fuck