#development

1 messages · Page 829 of 1

late hill
#

Your findOne will return the first result in that collection

lyric mountain
#

I guess

crimson vapor
#
       const _guilds = await guildModel.findOne({ guildId: message.guild.id });``` this is my code for getting data
late hill
#

Which I doubt is your intended behaviour

#

you'd want to do something like the code above^^

#

which in your example looks like it should be findOne({ID: guild.id})

#

If that gives you a result, it means it's in your collection of bans

#

So you'd leave that guild, you also don't have to grab the guild object a second time

#

because you already have it

#

simply guild.leave()

pine aspen
#

Hey.

#

How could i do to send a message as webhook?

#
      message.channel.createWebhook('Say')
        .then(async (webhook) => {
        webhook.send({
        username: message.author.username,
        avatarURL: message.author.displayAvatarURL,
        content: args.join(' ')
      })
      await webhook.delete();
late hill
#

You're awaiting the deletion but not the send

#

Which means it's very likely to get deleted before sending

pine aspen
#

Ok.

#

I'm getting an error saying message can't be empty though.

#
(node:502) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
    at item.request.gen.end (/app/data/DiscordBot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
    at then (/app/data/DiscordBot/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
late hill
#

are there actual arguments

#

is args an array with strings

pine aspen
#

Yes.

#

I could type anthing in the discord chat

#

pm!say look at these nice args

#

would still give me the error.

late hill
#

oh

#

the webhook send method

#

is content, options

#

as parameters

pine aspen
#

oh

mystic violet
#
(node:7516) UnhandledPromiseRejectionWarning: TypeError: serverQueue.connection.player.end is not a function```
#

connection = connection.dispatcher.streams.ffmpeg

sudden geyser
#

where did you define it?

copper cradle
#

@mystic violet console.log connection and see what u get

sudden geyser
#

you gotta tell me

mystic violet
#

@copper cradle

acoustic citrus
#

Af

#

Like thanks for telling me so I can report you

lyric mountain
#

I want him to try tricking me first

#

it's so fun to play along

acoustic citrus
#

He started with “I know your token”

#

I asked him what it was

#

And he just rambled lmao

#

Then near the end I used my command that sends a fake token

#

And he thought it was real lmao

lyric mountain
#

lol

crimson vapor
#

I would love to annoy him

warm marsh
#

Does running mongodb in a container void the data when restarting container?

peak venture
#

how would i find all userids in a specific guild in the client.on('ready', () { event

#

i assume running the client.guilds.get(guild_id).fetchMembers() ?

lyric mountain
#

yes

peak venture
#

and how would i see the result of that?

#

or do an action on it?

quartz kindle
#

fetchmembers is a promise

#

you can await it or use .then()

#

do you need to go through ALL members in the guild?

peak venture
#

just wanna add a specific role the the exsiting users

#

so.. yea

earnest phoenix
#

data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioandvideo'})); Should I change the filter because when bot joins and plays the music the musics lags and stuff

quartz kindle
#

then yeah do that

earnest phoenix
#

Idk if it's because of the filter

quartz kindle
#

well, video is useless for discord

peak venture
#

Tim, .then(guild => { guild.users }) ?

quartz kindle
#

fetchMembers returns a collection of members

peak venture
#

not just that though; xD

#

its a collection of the entire server

#

and emoji

#

so emoji, users, roles, channels etc

quartz kindle
#

ah true. fetchMember returns a member, fetchMembers returns the guild itself

#

so it would be .then(guild => guild.members.forEach(member => ))

summer torrent
warm marsh
#

Nothing there.

#

It's line above.

summer torrent
#

i found it ty

tight plinth
#

maybe

#

oh

valid frigate
#

also standard coding convention is to write currentdata like currentData

#

known as camel case

summer torrent
#

@tight plinth no

tight plinth
#

ik

dusky marsh
#

thats standard for javascript, not for coding in general

#

the camelCasing

earnest phoenix
#

hi please help me Stopped bot error code js /home/dc/node_modules/opusscript/build/opusscript_native_wasm.js:8 var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Mo abort(TypeError: Cannot read property 'welcome' of undefined). Build with -s ASSERTIONS=1 for more info.

valid frigate
#

has to do with opusscript? no idea lol

earnest phoenix
#

I knew that too

sudden geyser
#

It's almost like a new language.

amber fractal
#

that is formatted so horribly.

golden condor
#

Keep getting errors from this code in lavalink js const url = args.join(" ") if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { const playlist = await youtube.getPlaylist(url); const videos = await playlist.getVideos(); msg.channel.send("Processing...").then(async m => { const embed = new RichEmbed() .setTitle("Playlist Added") .setDescription(`${playlist.title} has been added to the queue`) m.edit(embed) for (const video of Object.values(videos)) { const song = await getSongs(`ytsearch: ${video.id}`); // eslint-disable-line no-await-in-loop await handleVideo(msg, msg.member.voiceChannel, song[0], playlist); // eslint-disable-line no-await-in-loop } }).catch(e => console.log(e)) }

#
Lavalink music is online

(node:9474) UnhandledPromiseRejectionWarning: #<Object>

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

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

I need help. I dont get an error but the command wont work.
https://pastebin.com/DugEJBxP
so its a leveling system but i want it so that i can turn the command on and off by typing -toggle leveling. But it wont work, it literally does nothing. this is the original leveling command that i put into the toggle >>>> https://pastebin.com/70BvR5Sz


So i wanted this script(https://pastebin.com/70BvR5Sz) to be able to turn on and off with a command

twilit rapids
#

Does anyone have an idea of what could be causing this error, it happens at random, it sometimes takes hour to occur and sometimes happens only minutes after boot.

6|index    | MessageError: Failed to process message during connection, calling disconnect: Unknown type received: 67 [UnknownType]
6|index    |     at Object.makeError (/home/timo/ChipProject/Chip/node_modules/veza/dist/lib/Structures/MessageError.js:33:16)
6|index    |     at ServerSocket._onData (/home/timo/ChipProject/Chip/node_modules/veza/dist/lib/ServerSocket.js:93:62)
6|index    |     at Socket.emit (events.js:311:20)
6|index    |     at addChunk (_stream_readable.js:294:12)
6|index    |     at readableAddChunk (_stream_readable.js:275:11)
6|index    |     at Socket.Readable.push (_stream_readable.js:209:10)
6|index    |     at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
6|index    |   kind: 'UnknownType'
6|index    | }
#

That error is what crashes the process

#

Whatever it is

quartz kindle
#

maybe open an issue in their github? i cant find anything online either

twilit rapids
#

Prolly has something to do with an exposed port

quartz kindle
#

this is the relevant part from their source code

twilit rapids
#

Hm

quartz kindle
#

it got a message without id and without being connected

twilit rapids
#

Setup a firewall now, might solve stuff /shrug

marble juniper
#

how can I check if a message contains a custom emoji

#

(discord.js v12)

dark aspen
#

im trying to set up a welcome channel for each server but the variable keeps getting reset afterwards

#

when i printed welcomeChannel[message.guild.id] after in a seperate command it printed undefined anyone know how to fix this

sudden geyser
#

You must use a database to have a proper settings command.

dark aspen
#

nvm i figured it out lol

#

i had to make it a const

#

i used let which caused it to reset

sudden geyser
quartz kindle
#

you will need to use a database or some storage system, otherwise your bot will forget everything every time it restarts

mystic violet
#
(node:15552) UnhandledPromiseRejectionWarning: http status: 502
(node:15552) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:15552) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

any idea why? im using yt-search

#

and ytdl-core

twin fulcrum
#

where do you host your bots? thinking of gcp free tier or digitalocean or linode

prime cliff
#

do is a little expensive also you can check the pins to see a list of vps prices

twin fulcrum
#

nice thanks

blissful scaffold
#

If you have a stable internet at home then you could also host it on a spare computer or something like a raspberry pi

twin fulcrum
#

hmm that's an option as well

#

I'm thinking of setting up a website and some other stuff as well, so that's why I'm considering a vps

#

I've never managed servers though so I have a bit of learning to do

grizzled raven
hidden spindle
#

Aight any regex masters here?

#

Any reason why this wouldnt match será?

'sera'.match(/\b(\w*sera*\w)\b|\b(\w*será*\w)\b/g); // one match
'será'.match(/\b(\w*sera*\w)\b|\b(\w*será*\w)\b/g); // no matches

while this works?

'work'.match(/\b(\w*work*\w)\b|\b(\w*wórk*\w)\b/g); // matches
'wórk'.match(/\b(\w*work*\w)\b|\b(\w*wórk*\w)\b/g); // also matches

And how would i make será match?

warm marsh
#

You know you could use it like

string.match(/\b\w*(work|wórk)*\w\b/g);
#

Saves rep in typing.

copper cradle
#

do it that way

#

maybe having that weird char near the * breaks it

#

I don't really know

amber fractal
#

pretty sure those were examples

warm marsh
#

Yeah but just change work with sera

sudden geyser
#

you could even:

string.match(/\b(\w*w(?:o|ó)rk*\w)\b/g);```
warm marsh
#

Although pretty sure \b isn't even needed.

hidden spindle
#

doesnt work with será tho

#

i need \b as it defines a word bondary

#

else it would match working

summer torrent
hidden spindle
#

im using 101

#

and the regex works for any character except accentuated

#

thats the question i guess

#

how do i make it work with á

earnest phoenix
#

/([á])\w+/g

hidden spindle
#

prolly some funkyness on the group i created

#

ended up doing it like this /((sera)|(será))(?!\w)/g

calm shore
hoary elm
#

@calm shore so you want to make it so that users or server admins can enable or disable it?

#

Should be pretty simple set it up in a JSON (smaller bot) or a database (more reliable) as a guild setting that's off by default. Create a command to set it as enabled or disabled in the database and then set up something to check if it's enabled ieif (levelSystem.enabled === true) etc.

copper cradle
#

never recommend json databases

#

just go for the normal database

#

use a db, and store a boolean in it

#

then when you get a message check for that server

#

if the value in the db is true then you can add xp

#

if not then just ignore it

hoary elm
#

never recommend json databases
Some people prefer it due to the fact that it's sometimes easier to set up or 🤷🏻‍♂️ but yes I would strongly Recommend a proper Database.

#

better-sqlite3 and mongo DB are both fairly simple to set up

copper cradle
#

yes

undone sedge
#

if (levelSystem.enabled === true)

spice pier
#

why === true?

grizzled raven
#

still gets the work done

spice pier
#

that's totally redundant

copper cradle
#

yes that's redundant

pallid vector
#

what's the biggest problem when a bot grows bigger?

#

like what issues do you face

copper cradle
#

mostly performance issues

pallid vector
#

like speed?

copper cradle
#

kinda

#

depending on your lib you'll start to eat more ram

pallid vector
#

will server size help with that?

#

I mean if you host with VPS

#

and get more expensive options

pale glen
#

anyone here know why i've recently started getting:

Error: Something took too long to do.
#

its happened for the past week, takes multiple restarts for it to actually login, but now it just wont login at all

#

(discord.js)

lofty moat
#

weather command

#

const Discord = module.require("discord.js")
const weather = require("weather-js")

module.exports.run = async (bot, message, args) => {

weather.find({search: args.join(" "), degreeType: "C"}, function(err, result) {
    if(err) message.channel.send(err)

    //If the place entered is invalid
    if(result.length === 0) {
        message.channel.send("**please enter a valid location**")
        return;
    }

    //Variables
    var current = result[0].current //Variable for the current part of the JSON Output
    var location = result[0].location //This is a variable for the location part of the JSON Output

    //Sends weather log in embed
    let embed = new Discord.RichEmbed()
       .setDescription(`**${current.skytext}**`) //How the sky looks like
       .setAuthor(`Weather for ${current.observationpoint}`) //Shows the current location of the weater
       .setThumbnail(current.imageUrl) //Sets thumbnail of the embed
       .setColor(0x00AE86) //Sets the color of the embed
       .addField("Timezone", `UTC${location.timezone}`, true) //Shows the timezone
       .addField("Degree Type", location.degreetype, true) //Shows the degrees in Celcius
       .addField("Temperature", `${current.temperature}`, true)
       .addField("Feels like", `${current.feelslike} Degrees`, true)
       .addField("Winds", current.winddisplay, true)
       .addField("Humidity", ` ${current.humidity}%`, true)
       .addField("Day", `${current.day}`, true)
       .addField("Date", `${current.date}`, true)
       
       //Display when it's called
       message.channel.sendEmbed(embed)

});

message.delete();

}

module.exports.help = {
name: "weather"
}

#

not working for me

#

const Discord = module.require("discord.js")
const weather = require("weather-js"). the package weather-js not working

wide ridge
#

anyone here know why i've recently started getting:

Error: Something took too long to do.

@pale glen Same here. Usually I have to restart my VPS or turn off the server for some time and re-run it for it to work. It's kind of annoying 😭

#

will server size help with that?
@pallid vector I'm not sure but I've seen some bigger bots "clear their cache" whenever the ram goes over a certain point. My bot's currently growing as well, so I'm looking into ways on improving this too. My main problem right now though is figuring out sharding

pale glen
#

this shit is getting obnoxious it just took me like 3-4 hours of nonstop restarts and updates to npm / node

pallid vector
#

ahh hmm I see

wide ridge
#

oh??

pallid vector
#

that makes sense

wide ridge
#

how many servers is your bot in shakyra?

pale glen
#

1700

wide ridge
#

ohhh damn

#

it took me a couple of mins, mine is in 1070

pallid vector
#

What do you need for sharding? or what to do

wide ridge
#

I'm scared now LOL

pale glen
#

there's no pattern

pallid vector
#

I have 0 clue, besides putting autoshardedbot

pale glen
#

you can get lucky and it will login successfully

pallid vector
#

LMAO

pale glen
#

after a few mins

#

or you can get fucked over and it won't login for hours

#

that shit started happening recently

wide ridge
#

yeah it's strange

#

discord's API issues, people are saying it could be because of the Go Live increase

#

for sharding I'm honestly not sure how to go about it, maybe just use ShardManager for Discordjs 11.5

pallid vector
wide ridge
#

problem I keep running into is my bot responds multiple times when I issue 1 command

pallid vector
#

😔

#

oh why does that happen with server increase?

wide ridge
#

and I need to figure out stuff with cross-shard emoji reactions

pallid vector
#

my bot still small af so idk what to expect when it grows ig

#

big

wide ridge
#

gotta look into sharding for sure

#

it's a must basically

#

once you hit like 1k-2.5k servers

lofty moat
#

hey guys look

#

lol

#

I found some dm me this link

pallid vector
#

how would I work on sharding though?

marble juniper
#

this may be a wierd question but
is it possible to use a custom domain for express in node.js

tight plinth
pale vessel
#

yes

twilit rapids
#

Project not found

marble juniper
#

he posted an invite link
for the glitch project here which caused many people to be able to edit his project so it got deleted

#

I thonk

quartz kindle
#

Lol

zenith terrace
#

I am finally adding a set logs channel

#

I feel happy

grizzled raven
zenith terrace
#

Uh idk

sudden geyser
#

I used to have them in v11 when I destroyed the client, but I don't know what magic I did for it to throw a socket hang up.

#

Where does the stacktrace originate?

#

@grizzled raven

earnest phoenix
#

Help!!

mossy vine
#

random is not defined

earnest phoenix
#

Yes

mossy vine
#

so define it

summer torrent
#

so

#

coding from phone is bad idea

crimson vapor
#

just add let random;

earnest phoenix
#

Hmm ik

#

K

mossy vine
#

@summer torrent irrelevant but yes

summer torrent
#

what is the best method for creating array in the loop?

#

empty array and .push() ?

next mica
crimson vapor
#

@next mica what did you define client as?

restive light
#

Im trying to upload a local file with bot but i dont know whats wrong with this code.

Like !upload D:/test.mp3

next mica
#

const client = new discord.Client();

#

im new to java script and that what it said to define it as in the tutorial i watched

crimson vapor
#

where is this in your code? is it before you login?

mossy vine
#

@next mica 1. put that code in your ready event
2. arr++ is not a thing

restive light
next mica
summer torrent
#

@next mica remove await

#

Im trying to upload a local file with bot but i dont know whats wrong with this code.

Like !upload D:/test.mp3
@restive light show code

mossy vine
#

@summer torrent do you know what youre talking about bro

next mica
#

so remove arr plus

mossy vine
#

put that code in your ready event

next mica
#

remov await

restive light
next mica
#

put in readt event

mossy vine
#

also that

crimson vapor
#

ok

#

@restive light you are using an exact case

next mica
#

so remove await arr++ and pu tin ready

#

event

mossy vine
#

oh boy there is so much wrong with that code north

crimson vapor
#

you need to change it to js if(msg.content.startsWith('<prefix>upload')

restive light
#

I dont use prefix

mossy vine
#

also that command can be abused in so many ways

crimson vapor
#

you need to

mossy vine
#

anyone can upload any file from your computer

restive light
#

I will add limitor to the bot if i solve uploading problem

crimson vapor
#

you still need to change a lot

mossy vine
#

yeah that code is completely broken

#

learn some basic javascript first before jumping into bot development

next mica
#

with the thigns yall told me to do (node:14392) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied name is not a string.

#

thats the new error

mossy vine
#

@next mica show code and what line you are getting it on

next mica
earnest phoenix
#

well yes

#

you're passing arr, which as you can see, is an array

next mica
#

not telling me a line

earnest phoenix
#

while the method is asking for a string, not an array

#

index your array

storm bluff
#

how can i get all aduiltlog types
example

next mica
#

im new to js

#

i dont know what that means

earnest phoenix
#

learn

crimson vapor
#
if(msg.content.startsWith('upload')) {
  let fs = require('fs')
  let myString = msg.content.split(' ').slice(1).join(' ')
  if(!fs.existsSync(`${myString}`)) return msg.channel.send('File doesn\'t exist')
  msg.channel.send(new Discord.Attachment(`${myString}`))
}```
#

that would work better but still shouldnt be a command

storm bluff
#

``` if(!fs.existsSync(${myString})) return msg.channel.send(File doesn't exist)

crimson vapor
#

shhh

storm bluff
#

hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

crimson vapor
#

oh so you want audit log types?

storm bluff
#

yes

crimson vapor
#

what do you mean

storm bluff
#

logs command

crimson vapor
#

like const entry = await channel.guild.fetchAuditLogs({ type: 'CHANNEL_CREATE' }).then(audit => audit.entries.first());?

storm bluff
#
    if (
      guilds.get(channel.guild.id).log.status == "off" || !guilds.get(channel.guild.id)) return;

    channel.guild.fetchAuditLogs().then(logs => {
      
      var userID = logs.entries.first().executor.id;
      const embed = new Discord.MessageEmbed()
      
        .setColor(emcolor)
        .setAuthor(channel.guild.name, channel.guild.iconURL())
        .setThumbnail(logs.entries.first().executor.displayAvatarURL({ format: 'png', dynamic: true, size: 1024 }))
        .setTitle("> **Channel Created**")
        .addField("**• Channel Name**", channel.name)
        .addField("**• Channel ID**", channel.id)
        .addField("**• Created By**", `<@${userID}>`);

      logC(channel.guild).send(embed);
    });
  });```
i know
#

i want all types

crimson vapor
#

oh

#

gotcha

storm bluff
#

?

crimson vapor
#

ok

#

you want all of them, right

storm bluff
#

yes

next mica
#

i still dont understand how to index the array

crimson vapor
#

I dont know what you mean

#

you made a channelCreate event

storm bluff
#

offf

crimson vapor
#

soooo

#

only one would be passed through

#

so you would be just finding the latest channel creation log

storm bluff
#

Listen

#

i want all types of log like
roleCreate
roleDelete
channelCreate
channelDelete
and more

mossy vine
#

add listeners for those

crimson vapor
#

yeah

#

you just created the channelCreate

#

so create more

storm bluff
#

oke

earnest phoenix
#

keep in mind you'll only receive those events if your bot has perms to see audit logs

copper cradle
#

creates 10 instances of guildCreate
why b0t n0t working

crimson vapor
#

How do you add a role to a member in d.js v12, is it the same?

#

nvm I got it

copper cradle
#

docs exist for one reason

storm bluff
#

how can i get reason in ban log

pale vessel
#

fetchBans()

earnest phoenix
#

that doesn't give you the reason does it

pale vessel
#

it does

earnest phoenix
#

oh

#

nice

pale vessel
#

only on v12 though

#

so it doesn't return a user, but an object that has a user

storm bluff
#

ya iam in 12.2

pale vessel
#

ok good read docs

#

can a mod make a pinned message that tells users to read the docs first and then ask if they still can't fix the problem?

#

(not like people read them)

slender thistle
#

Would be pointless

crimson vapor
#

I think the problem is that many people don't know how to use the docs

pale vessel
#

yet they call themselves as a "developer"

crimson vapor
#

yeah

pale vessel
#

well that was a bit too much

#

sorry

crimson vapor
#

no

#

just enough I think

storm bluff
crimson vapor
#

im sorry wut

pale vessel
#

"doesn't work"

storm bluff
#

lol

pale vessel
#

please. please. please. elaborate.

#

i've had enough

crimson vapor
#

hey guys, is there any way to get the time that the message was received by the bot? using the message.createdTimestamp is the time that it was sent on the user's side so it has more delay

#

other than passing thorough a timestamp through the command handler

earnest phoenix
#

in js? just use Date.now() in your message received event

crimson vapor
#

but I need it available in a different file

earnest phoenix
#

so?

pale vessel
#

it's a js function lmao

crimson vapor
#

not what I mean

#

if I use date.now, I need to use it after I define the data, which takes a while because its from mongo

#

and then it would be unrealistic

pale vessel
#

no?

crimson vapor
#

what do you mean?

pale vessel
#

use it after you define the data

crimson vapor
#

well that would defeat the purpose, I want to track how much time it takes

#

thanks for your help though

pale vessel
#

oh i read your thing wrong

crimson vapor
#

its all good

pale vessel
#

i said the same thing oof

crimson vapor
#

tbh, I didnt explain what I wanted enough

twin kestrel
#

Hi everyone!
I am having some trouble trying to mass delete roles within a server.

My code is:

  message.guild.roles.cache.forEach(role => {

    if(role && role.managed === false && role.id !== message.guild.id) role.delete({timeout: 1000})

  })```

This deletes 1 role and when you are going to delete the next it gives an error (Unknown role). Seeing the logs I see that the ID of the role you tried to delete never existed on the server, but there is also no evidence that it existed on the map (That is, when evaluating message.guild.roles.cache the ID of the supposed role does not appear you want to delete).

Any idea how to fix it?
pale vessel
#

@crimson vapor you can try calculating the time difference before and after the data is defined

crimson vapor
#

I just tried that

#

its about 150ms

#

and the delay for the command is 1ms

#

I need to use a different DB

#

@twin kestrel try using if(role && role.managed === false && role.id !== message.guild.id && role.deleted == false) role.delete({timeout: 1000})

twin kestrel
#

Same error

crimson vapor
#
if(role && role.managed == false && role.id !== message.guild.id && role.deleted == false) role.delete({timeout: 1000})```maybe this?
pale vessel
#

await?

crimson vapor
#

what DB do you use?

pale vessel
#

mysql remote database

#

i don't need much, just custom prefix

twin kestrel
#
if(role && role.managed == false && role.id !== message.guild.id && role.deleted == false) role.delete({timeout: 1000})```maybe this?

Same error

crimson vapor
#

ah

#

I dont know, sorry

twin kestrel
#

The thing is that in the v11 version of discord.js this does not happen to me with the code, instead in v12 yes

pale vessel
#

the error is just "Unknown Error"?

twin kestrel
#

Unknown role

pale vessel
#

hmm

#

why would there be a role that has guild id?

crimson vapor
#

first, without getting data

#

second, with getting data

#

I dont know why the client ping is so high

twin kestrel
#

The @everyone role

crimson vapor
#

alright

pale vessel
#

oh

crimson vapor
#

that wouldnt work would it?

#

try

if(role && role.managed == false && role !== message.guild.roles.everyone && role.deleted == false) role.delete({timeout: 1000})```
#

that might not work for v12 im not sure

#

it wont

twin kestrel
#

Another error
DiscordAPIError: Invalid Role

pale vessel
#

no

crimson vapor
#

fixed it

#

try it

pale vessel
#

message.guild.defaultRole

crimson vapor
#

no

#

I did role !== message.guild.roles.everyone

twin kestrel
#

Unknown role
same

crimson vapor
#

hmm

#

im not sure

#

sorry

pale vessel
#

message.guild.defaultRole
this doesn't work?

#

or role.id !== message.guild.defaultRole.id

crimson vapor
#

removed in 11

pale vessel
#

omg

#

i'm in 11.5.1 docs

#

from earlier

crimson vapor
#

lol

dark oak
#

Heelllo. Who usesu MongoDB here?

crimson vapor
#

I do

dark oak
#

Language?

crimson vapor
#

discord.js

dark oak
#

How fast is it?

crimson vapor
#

like delay?

#

unlesss you have a huge data amount, its barely noticable

#

I just did a test

dark oak
#

Ok.

crimson vapor
#

140ms is minimal

dark oak
#

Ok.

crimson vapor
#

what DB do you use atm?

summer torrent
sudden geyser
#

ew

#

There are many ways one loop can be faster than another.

quartz kindle
#

array.forEach is considerably slower than for loops

#

because doing array.forEach() is roughly the same (but not as bad) as doing ```js
for(item of array) {
(function(){
// do something with item
})(item)
}

next mica
#

is there a way to make it where only one person can run a command and it go through but if other people try to use the command it says you cant do this.

rustic axle
#

Hey does anyone know of a library, or a way, that I can create a readable stream from a spotify song? There are several libraries in python and stuff but its been a while and I no longer feel comfortable in python

#

All of the Node.js libraries are outdated (like Node 4.x) or just don't work

earnest phoenix
#

s!help

rustic axle
crimson vapor
#

What DBs do you guys use or suggest?

quartz kindle
#

@next mica check if the ID of the message author matches the id of the person you want to allow

#

ie: if(message.author.id !== "ID") return

#

@crimson vapor for a small project, sqlite is probably the best option, if you like relational databases

next mica
#

like this

pale vessel
#

change the id xd

crimson vapor
#

Okay, do you know anything about latency because I am trying to lower the time it takes a command to execute and as of now getting data takes about 150ms

next mica
#

i knwo

#

just amekign sure the layouts right first

pale vessel
#

yes, i know, which is why I wrote xd

#

it's correct

next mica
#

and how do i make it if they are no that id it say you cant run this command

pale vessel
#

return message.reply("you can't do this shit");

#

instead of just return

next mica
#

where do i put it in ther

pale vessel
#

i said it

next mica
#

ok

#

sorey i offed

#

oofed

pale vessel
#

add that after return

next mica
#

that spams the chat

pale vessel
#

it shouldn't

next mica
#

it did

pale vessel
#

i'm stupid

#

you need to put it inside the command

#

inside.

#

outside would react to all messages

tight plinth
#

did u check ownerId for every MESSAGE?

pale vessel
#

yes

tight plinth
#

if yes, ur stoopid

next mica
tight plinth
#

learn js plz

pale vessel
#

yes true

next mica
#

that right flaz

pale vessel
#

no

#

inside the block

tight plinth
#
if (message.content === 'command'){
if (message.author.id !== 'ur ID') {
//code
}
//command
}```
#

would be shtm like this

next mica
#

client.on('message' , function(message){
if(message.author.id !== "160161965325418496")
return message.reply("you can't do this shit");
if(message.content === '[p]wack'){
message.channel.send( message.author.username + ' used WACK it was super effective');
}

});

#

thats what i have

tight plinth
#

no

next mica
#

im new to js

#

i didnt change it

tight plinth
#

thats not right

#

take the code I just sent as an example

pale vessel
#

iq below 100

tight plinth
#

(put the code in the message function)

pale vessel
#

these type of people would understand only when you spoonfeed them

tight plinth
#

ye

#

spoonfeeded, but not too much

#

still has to use his brain

pale vessel
#

yeah

#

that's fine ig

#

just need to tell him to use the same concept for other related things

tight plinth
#

ye

next mica
#

like this

tight plinth
#

@next mica no

#

i'll give more code

next mica
#

what do i need to move

sudden geyser
#

oh god

pale vessel
#

he botched the code

#

I just want to cry looking at the code

tight plinth
#
client.on('message', async message => {
  if (message.content === 'command name') { //FIRST check for the command name
    if (message.author.id !== 'id') { //SECOND check for user ID
      return message.reply('u cant do that')
    }
  return message.reply('some text')
  }
});```
copper cradle
#

lol yes

next mica
#

even when the person whos id is not beind used

#

it said both messages

warm marsh
#

You might also want to use return inside the if(author !== id) to stop it saying the reply.

tight plinth
#

invert the message.reply & the message.channel.send

warm marsh
#
client.on('message', async message => {
  if (message.content === 'command name') {          if (message.author.id !== 'id') {
      message.reply('text');
      return;
    }
  message.reply('some text');
  }
});```
#

Yikes, Discord indents.

next mica
#

still says both of the lumap

pale vessel
#

we can't trust you tbh

#

what's your current code?

next mica
finite bough
#

prop

#

do u know what does !== mean?

next mica
#

nope

copper cradle
#

it means not equal to

pale vessel
#

learn js first and then create a bot

next mica
#

ok so remove !

pale vessel
#

like cry would say

copper cradle
#

and add another =

tight plinth
#

learn js first and then create a bot
@pale vessel everyone should dot hat

copper cradle
#

yes

#

YES

pale vessel
#

well he didn't

next mica
#

ok

tight plinth
#

oof

copper cradle
#

I mean

#

everyone should learn the basics of any language before starting any project

finite bough
#

guys pls ask new people if they know the thing they r doing before helping them

tight plinth
#

we should force white names to pass a js/py exam before takling in this chat

next mica
#

wow

copper cradle
#

yes

tight plinth
#

pass, not take

#

pass

finite bough
#

it will help them more than just providing the answer

copper cradle
#

I know it sounds rude, propogo

#

but if you only knew the things that we've encountered here

finite bough
#

tbh i learned by reading docs

copper cradle
#

lots of abominations

finite bough
#

i never asked anyone

next mica
#

oh i thought you ment real life white names

modest maple
#

We've gone through some shit here at DBL watches #development

copper cradle
#

That's why docs exist

finite bough
#

LMFAOOOOOOOOOOOOOOOOOO

tight plinth
#

I first learned the first month of bot coding without knowing the existencence of this server lol

pale vessel
#

same

finite bough
#

i check 50 docs, 50 errors before asking anything

tight plinth
#

(it was in september 2019)

#

me too

finite bough
#

i started d.js in 2018

#

lel

tight plinth
#

except if its a very specific error

#

like...

#

[insert example]

finite bough
#

Lumap is undefined

next mica
#

the person who is now usign it they get both messages

#

the people who are not valid only get the you cna not use this

pale vessel
#

you probably messed the code again

#

double check

tight plinth
#

use js return before every message.channel.send/message.reply

#

like

pale vessel
#

not every

tight plinth
#
return message.channel.send```
copper cradle
#

not every ^

tight plinth
#

not every, but most of them

valid frigate
#

what you don't need return on the same line

#

it returns Promise<void> iirc

#

oh wait you can nvm lmao

#

:monkaw:

tight plinth
#

js memes goes to off topic

finite bough
#

xD

valid frigate
#

looking for legit help

#

?

finite bough
#

nah

valid frigate
#

aight

tight plinth
#

or try to define message.author.isGay

finite bough
#

actually

next mica
#

ok it works now thank yall so much

tight plinth
#

finally

finite bough
#

ok let me ask a question

#

is it safe to make the type of channel.id type: Number

tight plinth
#

no

#

if [something] detects a too big number it can do like 6.448634163+e17

#

which is a scenario u dont want to happend

#

(is my english good?)

finite bough
tight plinth
#

same thing

finite bough
tight plinth
#

maybe one day they will

earnest phoenix
#

how i can delete an file in javascript?

tight plinth
#
var fs = require('fs');
var filePath = 'C:/path/to/file'; 
fs.unlinkSync(filePath);```@earnest phoenix
earnest phoenix
#

ok thx

tight plinth
#

I literally type how to delete files js in duckduckgo and found this lol

#

not even sure it works

finite bough
#

@earnest phoenix using console?

earnest phoenix
#

i will try @tight plinth

#

@finite bough no

#

@tight plinth ```js

UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, unlink '../profs.json'```

tight plinth
#

file not found

earnest phoenix
#

wait

tight plinth
#

file exists?

earnest phoenix
#

yes

tight plinth
#

hm

earnest phoenix
#

ok i fix it @tight plinth

copper cradle
#

well

#

first white name that fixed it by themselves

#

🎉

dusky marsh
lyric mountain
#

first white name that fixed it by themselves
@copper cradle it's a signal that the world is ending

finite bough
#

wait

#

when i was a white name

#

i used to help people

#

so 🤔

lyric mountain
#

hm

warm epoch
#

The version of discord.js I've been using is 11.4.2, but the problem persisted even on 11.5.1

lyric mountain
#

what problem?

sudden geyser
warm epoch
#

@lyric mountain, see #topgg-api, I've mistakenly described it there

#

@sudden geyser, it returns code 200, as it should

#

As I've said, the bot is back right now, but the problem persisted for almost an hour, it seems (I didn't catch it immediately)

#

But yeah, I don't think it's the host, because I tried to run it locally as well.

quartz kindle
finite bough
#

tim is finally here

#

lel

warm epoch
#

Hmm, very interesting. My google-fu failed me, I didn't find this thread. Guess I should've searched for recent ones, but I didn't figure that it was a recent issue.

#

Thanks!

finite bough
#

it says its not inside an async function

sudden geyser
#

Yeah well... is it?

#

and where is the error/stacktrace

finite bough
crimson vapor
#

bruh

zenith terrace
#

@finite bough do you have an async

crimson vapor
#

you only sent 80 lines

#

I see

#

I gotchu

finite bough
#

hm?

crimson vapor
#

alright

#

you can change a bit of code to make it more efficient

zenith terrace
#

Someone ask wtf is wrong with me

pale vessel
#

nah

finite bough
#

how can i @crimson vapor

crimson vapor
#

Yeet v12 is best

#

ok

#

so instead of using one big .then, make it an await

zenith terrace
#

@pale vessel why not >:(

#

Thanks Million

#

😂

crimson vapor
#

I dont know Yeet bot

#

but im sure Yeet 12 is best

finite bough
#

wdym

zenith terrace
#

Im have a v12 Yeet since the original Yeet is on v11

#

So in testing v12 on the Yeet v12

crimson vapor
#

delete a }) and change the main function let res = await prefixes.findOne({ serverID: message.guild.id }, (err, res) => { });

#

or just copy paste this

pale vessel
#

async (err, res)

crimson vapor
#

or that

#

im just lazy

#

alright ima delete the message now

#

too big

finite bough
#

wait

#

fixed it nvm

pale vessel
#

ok

finite bough
#

and

#

i did it with flaz's method

crimson vapor
#

yeah that is easier

finite bough
#

it came in my small brain

#

sooo

#

xD

earnest phoenix
#

is it possible to make it so that when someone does a command that does not exist it sends a unknow command message?

#

@earnest phoenix this isn't good..

crimson vapor
#

yes

#

if you use a command handler, if(!command) return //what you want to do

#

otherwise, no

#

its also frowned upon because it just causes spam if 2 bots have the same prefix

earnest phoenix
#

oh alright then let's just throw it in the garbage

crimson vapor
#

Anyone know of a way to cache the mongoDB storage so I don't have to get it from mongo every time?

lyric mountain
#

Anyone know of a way to cache the mongoDB storage so I don't have to get it from mongo every time?
@crimson vapor sqlite?

crimson vapor
#

yeah I looked into it and I dont know if I will move

mossy vine
#

???

#

so instead of answering the question you suggest something completely different

#

thats 200 iq right there

#

anyways

crimson vapor
#

big brain

mossy vine
#

you can cache everything with collection().find()

#

but you might run into troubles when updating the database

#

and caching your entire database may not be a good idea while were at it

crimson vapor
#

yeah thats what I though

#

how do you do strikethough?

mossy vine
#

~~text~~

crimson vapor
#

gotcha

#

does it anyway

mossy vine
#

wdym

crimson vapor
#

I was trying to joke

#

it wouldnt be a good idea to cache the entire thing

#

so if I did it wouldnt work

#

so thats why the does it anyway is strikethrough

rose warren
#

It's been taking way more than two weeks for them to decline/approve my discord bot. What is happening?

finite bough
#

@crimson vapor whats the problem in getting to from mongo tho

crimson vapor
#

I want to lower latency

finite bough
#

@rose warren they probably have a lot of stuff to deal with and cant check it sooner

#

well

#

maybe store it in a json file

rose warren
#

Oh. Okay.

crimson vapor
#

json's get corrupted

finite bough
#

well

#

it depends upon what r u saving

mossy vine
#

was last sunday really 2 weeks ago

late hill
#

mongo uses indexes to execute queries faster

#

use them if you're not doing so already

#

If you're hosting it on the same machine and using optimized queries, the latency should be very minimal

#

Maybe you can post more about what exactly you're doing

#

There may not be a need for it to be cached at all

finite bough
#

tbh

#

they are not that slow

#

how fast do u want the code to be

crimson vapor
#

well, I do not host it on my machine, and although it is pretty speedy, I would like to lower the time it takes to get the data

late hill
#

Is the bot hosted on the same machine

#

is what matters

crimson vapor
#

no

finite bough
#

on a vps

#

I believe

late hill
#

Would it be possible for you to change that

crimson vapor
#

tbh, I do not know how

late hill
#

Because that would be very beneficial

crimson vapor
#

How would I do that?

late hill
#

If you're using one of the more common operating systems/distro's it should be pretty simple

crimson vapor
#

thank you for showing me this

late hill
#

You're using atlas now?

#

Or something like that?

crimson vapor
#

yeah atlas

late hill
#

yeah

#

It's very simple to use like that but latency will be a lot higher

crimson vapor
#

higher for atlas right

late hill
#

yes

crimson vapor
#

thats what I thought because you said that earlier and it just makes so much more sense

late hill
#

because you know, data has to go from their server to yours

crimson vapor
#

yeah

late hill
#

It might take a while setting it up the first time, but once you got it, you're good

#

Any issues you run into, you'll probably find an answer for on google

crimson vapor
#

I never thought of hosting it myself, I didnt even know I could

next mica
finite bough
#

@next mica make an array

earnest phoenix
#
var allow = ["id1","id2","id3","id4"];
if(allow.includes(message.author.id)){
return message.channel.send("Bran4Real....");
}
message.reply("Blablabla");```
#

@next mica

#

If u want u can store all in a json file or sqlite, mongodb etc...

finite bough
earnest phoenix
next mica
#

how would i do that dany

hushed berry
#

they literally wrote the code for you

earnest phoenix
#

What u want to use?

surreal elbow
#

so i have watched this vid: https://m.youtube.com/watch?v=BPvg9bndP1U but i am stuck at 8:55, git init command in cmd wont work.. now, i have installed git, but it still dont work. what to do?

How to host your discord bot for free using heroku. This tutorial shows you how to host your python bot for free using heroku services. We simply need to setup a few things to heroku, upload our code and turn the bot on!

Text-Based Tutorial: http://techwithtim.net/tutorials/...

▶ Play video
modest maple
#

dont use YT tutorials

surreal elbow
#

can you help me then?

next mica
#

the json file thing

crimson vapor
#

I do not hate YT tutorials I just think they should be watched to learn, and not to follow

surreal elbow
#

Okay, but anyway, i want to upload my bot written in python to Heroku.

earnest phoenix
#

@next mica use fs

surreal elbow
#

and i dont know how.

#

so if somoeone know, can help me then?

earnest phoenix
#
surreal elbow
#

@crimson vapor you know?

crimson vapor
#

I use ubuntu for git commands so I dont know

next mica
#

ok thanks

mossy vine
#

fs is not a package

#

its builtin

#

just require('fs')

surreal elbow
#

what is that?

#

at least can help me please?

mossy vine
#

not talking to you

#

what do you mean by not working

#

any errors?

surreal elbow
#

me?

mossy vine
#

you

surreal elbow
#

oh, yea

#

DNS server does not act as authority for zone.

mossy vine
#

what the fuck

#

nope i have no idea sorry

surreal elbow
#

oh

#

😦

next mica
#

ok so now how do i use this fs

surreal elbow
#

lol it worked now

#

it was just bad tutorial

#

dude forgot to say the bot has to be in the map where python is located

#

...

next mica
#

@earnest phoenix how do i do the fs thign now

wide ridge
#

hey guys

#

how do I wait for all my shards to load?

#

before letting users enter commands

#

I want to wait for all shards to go up before people can run commands because I need to get an emoji from a specific guild in my shards

earnest phoenix
#

wait until all shards emit the ready event

surreal elbow
#

@mossy vine i got stuck somewhere else now, when i did: heroku git:remote -a pythondiscordbottest i got:
» Error: You do not have access to the app pythondiscordbottest.
»
» Error ID: forbidden

next mica
#

when ever i run my bot

#

this spams chat

#

how do i fix

prime cliff
#

Look at your brackets and what you are trying to do

#

You're spamming the bottom message every time the bot gets any message.....

next mica
#

so what do i need to change

#

would it look something like this

dusky marsh
#

why are you comparing an array to a string

prime cliff
#

That too....

next mica
#

i dont know

prime cliff
#

Please learn the basics of your language first

next mica
#

i dont know how to fix this

#

im just using what people have been telling me so far

dusky marsh
#

learn the language so you can understand what you are doing wrong

#

spoonfeeding is Bad with a capital B

regal saddle
copper cradle
#

so, u installed git but it won't work when u run git init

#

what do u get in the console

crimson vapor
#

@next mica some advise, you can go to VSC settings and enable the format on save function and it will format your code for you

heavy marsh
#
try {
member.sendMessage(text);
} catch (error) {
message.channel.send(`⚠️ **Message cannot be sent to the user!**`);
return;
}

message.channel.send(`📩 **Message Send!**`);

Discord.js version 11.4.2

#

It doesnt work well

quartz kindle
#

you cant catch promises like that unless you await them

#

also, use message.author.send instead

#

or user.send

heavy marsh
#
if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send(":octagonal_sign: **Your Missing `MANAGE_GUILD` permission to run the command!**");
  
const member = message.mentions.members.first() || message.guild.members.get(args[0]);
if(!member) return message.channel.send(":no_entry_sign: **Mention the user you what the message to be sent to!**");
  
let text = args.slice(1).join(" ");
if(!text) return message.channel.send(":no_entry_sign: **Send a text to be sent to a user!**");

try {
member.sendMessage(text);
} catch (error) {
message.channel.send(`⚠️ **Message cannot be sent to the user!**`);
return;
}

message.channel.send(`📩 **Message Send!**`);
#
try {
await member.sendMessage(text);
} catch (error) {
message.channel.send(`⚠️ **Message cannot be sent to the user!**`);
return;
}
#

Like this?

#

Works 🙂

#

Thank you!

quartz kindle
#
try {
  await member.user.send()
} catch(error) {
  await message.channel.send()
}``` would be better
heavy marsh
#

Thanks!

grizzled raven
#

ok so

#

promises

#

can you await somrthing but also catch it?

#

like await promise().catch()

crimson vapor
#

why would you want to?

sudden geyser
#

You can.

#

The return value will be whatever the return value you got from the .catch method.

amber geyser
#

In v12, how can I get the person containing the role x ID to do something? when updating I didn't see any of that

zealous veldt
#

What do you mean by "do something?"

amber geyser
#

That I return and send a message

crimson vapor
#

so like message.guild.roles.cache.find(r => r.id == 'id')
and then do something with all of the members

grizzled raven
#

cache.get(id)

zenith terrace
#

bloody .cache is gonna annoy me

dusky marsh
#

Im gonna leave my bot in v11 for that reason, besides not really deving it too much now, i dont wanna have to go through and add .cache everywhere haha

crimson vapor
#

honestly, it wasnt too bad changing all the commands

#

really annoying

#

but only took a few hours

earnest phoenix
#

yall are aware that a lot of editors allow you to replace text based on regex, right?

#

which means you could've been smart and done hours of work within 30 seconds automatically

crimson vapor
#

well, I was rewriting a few things when I updated to 12 so it kinda fit in well

#

what do you guys use to monitor your vps remotely

pallid vector
#

whenever I close the bot, it always gives this message

#

probably something to do with the TopGG cog, but not sure what

earnest phoenix
#

Hey my music bot is not playing music after generating a new key

#

hewwwo

#

so

#

i just recently moved ansura to a vps

#

and i ran my startup script without sudo

#

cuz i didnt like putting my password in every time i restarted it

#

and for some rreaon

#

pip doesnt seem to be installing the stuff

#

thats the startup script

#

i always used to do sudo pip3 install -r requirements.txt

#

this always used to work when i ran ansura on my laptop

#

(@ me)

languid dragon
charred jetty
#

How to get it?

items: [
{ S1: { 
i1:
i2:
},
S2: something,
}]```
#

How to get the i2

pale vessel
#

oof

#

ok[0].S1.i2

charred jetty
#

Ok

#

Ok means items ?

pale vessel
#

ye

#

it was a placeholder

charred jetty
#

items[0].S1.i2

#

Ok

copper cradle
#

wtf is |>

#

ok so it's just syntactic sugar

spice pier
#

bit manipulation iirc

copper cradle
#

no

#

it's called the pipeline operator

#

the bit manipulation one is just |

#

and &

spice pier
#

and << >>?

copper cradle
#

yes I think

#
const double = (n) => n * 2;
const increment = (n) => n + 1;

// without pipeline operator
double(increment(double(double(5)))); // 42

// with pipeline operator
5 |> double |> double |> increment |> double; // 42
#

I prefer this pipeline operator tho

earnest phoenix
#

How do I fix Internal Error 500 on a node based website running CentOS with CPanel and WHM?

wintry sonnet
#

I think I made this loop command wrong

    let fetched = ops.active.get(message.guild.id);
    
    if(!fetched)
        return message.channel.send("There isn't any music playing in this guild!");
            
    if(!message.member.voiceChannel)
        return message.channel.send("You are not in a voice channel");        
        
    fetched.dispatcher.loop();    
    
    message.channel.send(`Successfully loop the track **${fetched.queue[0].songTitle}**`);    
}
exports.help = {
    name: "loop",
    aliases: ["repeat"]
}```


It says in the console that fetched.dispatcher.loop is not a function. How do I loop?
earnest phoenix
#

What’s ops.active?

#

@wintry sonnet

wintry sonnet
#
    ownerID: ownerID,
    active: active
  }```
earnest phoenix
#

i mean what’s active

wintry sonnet
#

Oh

#

const active = new Map();

earnest phoenix
#

i mean like what’s inside that map?

wintry sonnet
#

This active thing creates a queue system

earnest phoenix
#

I dont even know if dispatcher is a thing in the map

#

ik

#

what are its properties?

wintry sonnet
earnest phoenix
#

wait did you a followed a tutorial from youtube for this?

#

because it seems quite famillar

wintry sonnet
#

Yes I did. I'm an amateur at coding. It's very similar to Plexi Development's code

earnest phoenix
#

thats what i thought XD

#

i used to follow his tutorials too

#

Me too lmao... We all start from somewhere...

wintry sonnet
#

So, how do I fix my error?

earnest phoenix
#

also no, loop is not a function

#

the function loop does not exist

wintry sonnet
#

I figured that out. What should I replace it with?

earnest phoenix
#

maybe add it to queue one after another?

#

that might loop it

#

@wintry sonnet are you using discord.js?

wintry sonnet
#

Yes

earnest phoenix
#

Hmm

#

im not that experienced in playing with voiceConnection, I only used it to make voice levelling

wintry sonnet
#

Whatever that is :p

earnest phoenix
#

plexi development’s videos are mostly outdated btw

#

i suggest you go through the documentation instead of following a tutorial

#
#

that way you can learn more and in a more “updated” way

wintry sonnet
#

Well, I did ask TrueXPixels for him to update the series, but he said it will take a while

earnest phoenix
#

ok i think i know a way to loop

#

simply push the current song into the queue when the song ended

#

@earnest phoenix well as you tell him to find it through discord.js documents page...
It will be impossible for him to find it or may take way too long... Because the code in discord.js documents might be different than his code and would be difficult to figure out...

#

i used the documentation anyways

#

I think he should follow an updated tutorial on YouTube or something tho...

#

updated tutorials are good for starters

#

Yup

#

but if you need to make a more complex command, you might need to use the documentation

#

But now updated tutorials are going missing... When i started to make a bot i followed tutorials which were old and some of the codes were renamed or moved to a new category... So it confused me...
Updated tutorials aren't such a thing anymore... Rip

pale vessel
#

the docs should be enough to be used as a tutorial

#

as long as you know how to use it

earnest phoenix
#

Ik but like making a music bot or something like that which discord.js documents doesn't show how to actually do it... So... Anyways...

#

the documentation does show it

#

but its seperated

#

you just need to piece them together like a puzzle game

#

But if you Know how to do it... I mean it doesn't help for the very beginners...

#

thats true

#

And that's what I'm trying to explain...

marble juniper
#

I mean

#

I could make a guide on making a music bot for v12

#

maybe

finite bough
marble juniper
#

I have my own domain so

finite bough
#

where will u host the guide tho

#

github?

marble juniper
#

where else

#

I'd say github

#

would need to make some design and layout first

finite bough
#

stackflow maybe

marble juniper
#

but yeah

pale vessel
#

gitbook is okay too

marble juniper
#

hosting the website itself is not a problem

#

I have everything I need

#

well im off Imma be working on making the guide today

earnest phoenix
#

Hey anyone can help me why after generating new youtube api key also my music bot is not working

marble juniper
#

Do I really need to answer that

#

You made a new key but did you also update the key you are using in your music bot to the new key?
@earnest phoenix

earnest phoenix
#

how to do that

marble juniper
#

Oh god

earnest phoenix
#

I didn't get any option like that

marble juniper
#

no im out of here

#

I can't take this anymore

#

just Update your code with the new key

#

is that hard

earnest phoenix
#

not if you explain me

marble juniper
#

just

#

go

#

into your code

#

and then

pale vessel
#

do that

marble juniper
#

search for your key where you are using it

#

and replace the old key with the new one

earnest phoenix
#

Yeah I did that

pale vessel
#

is this one of those github-forked bot

earnest phoenix
#

nope

pale vessel
#

where you don't know anything about the bot

marble juniper
#

bet

#

BeT