#development

1 messages · Page 600 of 1

dull bobcat
#

It is

broken elm
#

i dont have anything open but vscode

#

i know its the problem

#

but i dont have two things open is what im saying

mossy vine
#

Vscode has a builtin terminal

broken elm
#

ill restart later : p

#

yeah

mossy vine
#

It could be running your bot

broken elm
#

thats what i use most of the time

mossy vine
#

Check if it is

dull bobcat
#

Well thats the only thing that can cause your problem

#

That you run node twice

#

Just regenerate a new token ffs if you dont wanna listen to us

broken elm
#

i did

#

no need to be rude lol

dull bobcat
#

Then the problem is solved

broken elm
#

i dont feel like restarting

dull bobcat
#

K sad for you

broken elm
#

and the problem is still happening

#

insert shrug here

dull bobcat
#

Ok, you will handle this by yourself since you know better than us, we told you the problem though

broken elm
#

i literally never said anything

#

i dont feel like restarting

dull bobcat
#

You dont feel like restarting

broken elm
#

and i never said i know better than you

dull bobcat
#

Exactly

#

Ether exit one of your node process or restart your pc

#

Either*

broken elm
#

ok

mossy vine
#

We gave you a solution. If you aint gonna try it, then dont complain

broken elm
#

i stopped complaining a while ago

#

i dont understand why im still getting shit for it

dull bobcat
#

Because you still saying you have the same problem when you dont wanna try the solutions we provided

#

Sorry if i were rude @broken elm

#

Just woke up

lusty dew
#
Queue [
  { track:
     'QAAAbQIACE5GIC0gV0hZAAtORnJlYWxtdXNpYwAAAAAAAu4AAAt6dUpWLURBdl93RQABACtodHRwczovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PXp1SlYtREF2X3dFAAd5b3V0dWJlAAAAAAAAAAA=',
    info: [Object] },
  { track:
     'QAAAmAIAMUJpbGxpZSBFaWxpc2ggLSBPY2VhbiBFeWVzIChPZmZpY2lhbCBNdXNpYyBWaWRlbykADUJpbGxpZSBFaWxpc2gAAAAAAAMRKAALdmlpbWZRaV9wVXcAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj12aWltZlFpX3BVdwAHeW91dHViZQAAAAAAAAAA',
    info: [Object] },
  { track:
     'QAAAgAIAGUJpbGxpZSBFaWxpc2ggLSBCZWxseWFjaGUADUJpbGxpZSBFaWxpc2gAAAAAAAM4OAALZ0JSaTZhWkpHajQAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1nQlJpNmFaSkdqNAAHeW91dHViZQAAAAAAAAAA',
    info: [Object] },
  player: Player {
    _events: [Object],
    _eventsCount: 1,
    _maxListeners: undefined,
    status: 2,
    node: [Node],
    guildID: '561588141761495045',
    currentSong: [Object] },
  onEvent: [Function: bound onEvent] ]

How could I get what is inside info object?

lament meteor
#

Queue[0].info ?

silver lintel
#

if i have got a string which is an id of a user, how can i get the name of the user?

#

im using discord.js 11.4.2

lusty dew
#

But I am trying to get all the tracks

#

in the queue

#

and add up the duration

#

sorry I just spilled ketchup on my pc, I was wiping it off

silver lintel
#

lol

lusty dew
#

@silver lintel iirc you can use

#

Fetch user with that person's ID

silver lintel
#

???

#

how to do that

#

fetchUser

lusty dew
#

then get their username from the user object

#

I can't remember

#

I use master

#

not stable

#

brb

silver lintel
#

ok ill just search it up

#

oh ok

lusty dew
#

I think

#

it is just

#

client.fetchUser(userIDHere).username

#

I can't remember though

lusty dew
#

How could I use reduce

dull bobcat
#

What?

lusty dew
#

to add up the lengths in every single track

#

there

#

legnth is under info

#

so I will also need to get into the info object to get length

sinful lotus
#
queue.reduce((a, b) => a + b.info.length, 0)

@lusty dew

idle basalt
#

no

sinful lotus
#

yes

idle basalt
#

a.info.length is undefined

#

a is a number

#

its just a + b.info.length

lusty dew
#

We will determine that rn

sinful lotus
#

let me just read it up in mdn real quick

lusty dew
#

Bt I am pretty sure Weeb is right

#

but*

sinful lotus
#

I can be wrong

idle basalt
#

you set a to 0 with the default value

sinful lotus
#

:heh:

#

a + b.info.length should work

#

just read up on mdn

idle basalt
#

a is the accumulator and b is what you add on top

#

so a will be a number

sinful lotus
#

my jiggly knowledge forgot that

idle basalt
#

and b will store what youre adding

#

no problem 👌

#

reduce is a helluva drug

sinful lotus
#

reduce is the function I dont use often

idle basalt
#

its sweet as hell when you get the hang of it

#

its semi-niche but its so clean when theres a good use case

sinful lotus
#

the name doesnt make any sense to me thats why I dont use it often but meh

idle basalt
#

it makes sense

#

it takes your array and reduces it into a single value

sinful lotus
#

thats what I was lacking, when I was searching I cant find anything that gives a good info on why its called reduce

idle basalt
#

glad i could help blobthumbsup

lusty dew
#

👌

#

Thanks to the both of you

#

I got what I needed I think

#

👀

#

I think

#

I honesly don't even know if I got what I needed

#

I don't thing the length of the songs

#

update as the song progresses

#

so it literally says the length it was when it just starts

idle basalt
#

im not sure what you were doing i was just fixing the reduce lol

lusty dew
#

I am trying to add all the lengths (duration) of the songs in the queue

#

then subtract it from the current song

#

to get the estimated time of when the next song will play

#

but since lengths don't update as the song progresses the length stays the same as when the song starts

idle basalt
#

start a timer yourself i guess

lusty dew
#

Yea

#

Kinda sucks it doesn't update xD

#

Lavalink is weird like that ig

idle basalt
#

sorry i dont know anything about lavalink so i cant really help you :(

#

but if it doesnt update the time the only option is to set up a timer yourself

sinful lotus
#

you can just update the length of song

#

per song skip

idle basalt
#

it shouldnt be that hard though - esp if you already have a db connected

lusty dew
#

Why would I want to do it per song skip?

#

I am trying to get estimated time until the next song starts

idle basalt
#

when the song starts, start incrementing in your db every second. then tally the queue and subtract the current incremented value. when a song ends or is skipped, remove it from the tally and start again on the new song

sinful lotus
#

for example

let counter = 0
let started = false
function play() {
    if (!started) {
        started = true
        counter = queue.reduce((a, i) => a + i.info.length, 0)
    }
    lavalink.play()
        .once('end', () => {
              queue.shift()
              counter = queue.reduce((a, i) => a + i.info.length, 0)
              play()
        })
}
#

thats just an idea

lusty dew
#

👀

#

Mk

sinful lotus
#

counter will always be the calculated songs length

lusty dew
#

Yea

sinful lotus
#

and it will update every song end

lusty dew
#

Every song end?

sinful lotus
#

yes since if you didnt update that, that will remain static

#

unless you are doing some interval

idle basalt
#

i thought he wanted to get the elapsed time in a song

#

not update on end

lusty dew
#

How does that help determine an estimate of when the next song will happen while the current song is still playing

sinful lotus
#

oh you want a estimated time before the current song ends?

lusty dew
#

Yea

#

I managed to get 448000

#

after a lot of evaling xd

#

but that just gives the full time

sinful lotus
#

a sec

#

lemme remodel the code earlier

lusty dew
#

Mk

#

tbh surprised I am even awake still

idle basalt
#

same lol i have to be up soon and im still dicking around >:(

lusty dew
#

It i 12:45am I usually pass out by now

idle basalt
#

gl with the provlem guys im out

lusty dew
#

Kk cya

sinful lotus
#
let playing = 0
function play() {
    if (playing) clearInterval(playing) 
    playing = 0
    const player = lavalink.play()
    setInterval(() => playing++, 1000)
    setInterval(() => console.log(queue.info.length - (playing * 1000)), 5000)
    player.once('end', () => {
        queue.shift()
        play()
    })
}
idle basalt
#

aye same time 👌 west coast baby

lusty dew
#

Lel

sinful lotus
#

that will log the time left per 5 seconds

#

dont forget the () due to Javascript Precestuff whatever spell it iis

lusty dew
#

Hm

#

Thanks Saya

#

you change your nickname so much btw

sinful lotus
#

but the weeb keyword is there

lusty dew
#

xD

sinful lotus
#

you instantly know its me

lusty dew
#

Yea

#

True

#

Well thanks Saya!

sinful lotus
#

no problems

lusty dew
#

:3

lapis hazel
#

i can't see my bot in API do I need to wait for the bot to be approved before I can obtain my API key?

zealous veldt
#

Yeah, it has to be approved in order to gain API access

lapis hazel
#

thank you

earnest phoenix
#

24 hour in ms = ?

#

i need help

#

I think its 3,6m x 24

#

Idk

late hill
#

24 * 60 * 60 * 1000

plush jacinth
#

Yeah

late hill
#

You can just put that in your code

earnest phoenix
#

Oh thx

late hill
#

Usually makes it more readable than just a random number

earnest phoenix
#

I put 60 x 60 x 24000

#

Its the same?

late hill
#

Yes

plush jacinth
#

Hi join

earnest phoenix
#
    const prole = pguild.roles.find(role => role.id === "534081989758812182");

if(message.member.roles.has(prole)) {
  console.log(message.author.id)
}```
#

What is wrong with this

#

it doesn't send id

#

because the if statement is never true

#

?

#

i have the role on the server

amber fractal
#

You should always use get if you have the id no point in finding the id if they're mapped by id

vivid mortar
#

why does it look like this?

#

isnt it supposed to be html and not just display that as text

velvet cliff
#

why is my bot in the server but the commands dont work here but they do in other servers?
wrong script?

late hill
#

What bot

#

Maybe it's muted?

velvet cliff
#

@normal thorn

mossy vine
#

its muted

#

s my h

earnest phoenix
#

hello , who have control panel for bots such mee6?

velvet cliff
#

and uhh how do I get it umuted @mossy vine?

mossy vine
#

writing one is quite diffucult and cant just be copied @earnest phoenix

earnest phoenix
#

any source codes on github ? @mossy vine

late hill
#

Check #mod-logs to see why it's muted @velvet cliff

#

Fix the issue and DM a mod

mossy vine
#

@earnest phoenix you can try looking, but i doubt you will be able to make much use of it

velvet cliff
#

why is that a thing?

#

Who uploads the bot is the moderator duh

#

@mossy vine what do I need to do now?

mossy vine
#

it will tell you the decline reason

velvet cliff
#

Omg for real only cause there a few commands with prefix??? well danggg

#

so every command needs to have a prefix?

mossy vine
#

yeah, otherwise it will be muted here

#

might wanna read the bot rules

velvet cliff
#

..... just ..... nothing to say on that ngl

mossy vine
#

if you want the bot to tell you its prefix you might want it to respond to @yourbot prefix

velvet cliff
#

okay so messages like help without prefix are not allowed... why exactly?

mossy vine
#

if you run <commonprefix>help (which you shouldnt do unless you want a mute), about 100-400 bots will respond. imagine what would happen if they responded to just help

velvet cliff
#

makes sense Ig is it allowed to add reactions to messages like a think emote on a what/uhh message?

mossy vine
#

no

#

unprefixed responses are not allowed here

#

read the bot rules, they clearly state it

velvet cliff
#

so no messages no reactions no nothing

mossy vine
#

just dont have unprefixed things

#

or at least disable them for this server

late hill
#

If you just make it reply to mentions it'll be fine

#

Anyone with a decently functioning brain will try to mention it

#

Rather than just typing "help"

velvet cliff
#

ill try (im not that great with coding yet lol)

late hill
#

Mentions are just <@id>

#

Or <@!id> if it has a nickname

velvet cliff
#

ik (i will try to make commands able to be turned of by admin role tommorow)

#

nvm ive done it today, I get it now lol

earnest phoenix
#

who have control panel for bots such mee6?

mossy vine
#

i would tell you to write your own, but since you are just asking for one i assume you dont even have the necessary skills

velvet cliff
mossy vine
#

ew glitch on mobile

velvet cliff
#

lol like I said a begginer

earnest phoenix
#

Doesn't matter

#

You should code on PC

mossy vine
#

hErE iS a GrEaT gUiDe -

late hill
#

gamer moment

velvet cliff
#

btw atleast I code and dont use discord bot maker (I normally am on pc but I only have phone atm lol)

late hill
#

make a colors.json

velvet cliff
#

why?

late hill
#

because

#

looks better

gleaming tulip
#

doesn't have a valid argument so just spits some discord bot maker shit here

#

smh

velvet cliff
#

how about
im just doing this for a really short time like you could do everything in a few weeks just no

late hill
#

On pc

#

I can add a file with those colours

#

within 1 minute

#

😱

#

It would look better if you had them all together

#

Also why fetch your logs everytime a message comes in mmLol

velvet cliff
#

yeah but could you do that when you were only coding for a week or less?

late hill
#

Maybe

#

But don't compare yourself to others

#

I'm guessing you want to get better and better

#

I'm telling you that you're doing some things

#

Which you could improve

#

It's not an attack, it's just advice

#

Good luck with your bot

velvet cliff
#

dude this is my 4th day
but whatever im going back to scripting/learning

velvet cliff
#

alright all commands have a prefix so... how does my botI get unmuted now?

late hill
#

DM a mod

velvet cliff
#

Who?

serene cobalt
#

a mod

#

any of them

velvet cliff
#

@inner jewel hey ive putted a prefix for every command now

mossy vine
#

proceeds to tag the only moderator who doesnt deal with bots lmao

idle basalt
#

at least he chose one thats online /shrug

vagrant bison
#

will someone recommend a nice page to endpoints? [JSON]

idle basalt
#

that api has a wrapper in just about every language i think

vagrant bison
#

are you writing to me? xD

idle basalt
#

yes

vagrant bison
#

I do not understand you...

viral surge
#

Is it possible to make a gacha Stim with Only "Case/Break" and "Math Random" on Java?

marble needle
#

Don’t use nekoslife lol

viral surge
#

?

marble needle
#

Full of „quentionable content“ if you get what I mean

#

Talking about the person above you

viral surge
#

Ok

wanton walrus
#

Just compile a json file of images yourself

#

save some bandwidth

viral surge
#

Is it possible to make a gacha Stim with Only "Case/Break" and "Math Random" on Java?

lavish abyss
#

Hey everybody

wanton walrus
#

Howdy

earnest phoenix
#

dont repost your question if its like a few messages above and i dont know is it just me but that question made no sense @viral surge

dusky marsh
#

What the hell even is a "gatcha stim" @viral surge

earnest phoenix
#
    const nrole = nguild.roles.find(r => r.id === "534081989758812182")
if(message.member.roles.has(nrole)) {
  console.log(message.author.id);
} ```
#

it doesn't work

#

idk why

#

no error

#

it doesn't say anything in the console

#

And when i put ! Before the if statement, the bot send my id in the console

#

i told you because the if statement returns false

#

you should probably compare ids and not straight entities

dull bobcat
#

just add an else statement to your if

idle basalt
#

its because the member doesnt hsve the role

#

are you sure you have the right role?

#

also, message.member.roles.has(roleid) is enough. you dont need the find and all

fading mason
#

Hi i need help about "glitch"

#

I can't turn on my bot

#

(sry for english)

wanton walrus
#

don't use glitch

dusky marsh
#

^

earnest phoenix
#

@idle basalt oh thx its worked

idle basalt
unique nimbus
#

Lots of bots have s- prefix

#

if I remember correctly

bright spear
#

only @earnest phoenix

unique nimbus
#

yes

#

I think all the rest was muted

amber fractal
#

in d.js?

#

Cant help you on that one mmLol

zinc marten
#

how i can make more prefixes?

#

on js

#

🤔

amber fractal
#

Thinking I'm an expert mmLol

earnest phoenix
#

@zinc marten Easy

zinc marten
#

🤔

#

Say it pls.

earnest phoenix
#

let prefix = "!" || "/" || "?"

zinc marten
#

ah okay thx

amber fractal
earnest phoenix
amber fractal
#

Lmao

zinc marten
amber fractal
#

I'd have to work out the regex

#

it's definitely possible

earnest phoenix
#

so i can touch you in here raid?

bitter dome
#

@amber fractal regex would be /(!|\/|\?)(\S+)/g if you also want it to get the command

scarlet bane
#

list all servers and ids

#

one moment let me read docs

#

Async or rewrite?

#

That should be all you need

#

you should be able to figure the rest out

buoyant wagon
#

i know that to make a link you do Link Name, but how do you make when you hover over it it doesn't say [Link Name]?

spring ember
#

I am not sure if that's possible

buoyant wagon
#

it is

#

i saw other bots do it

#

for example

#

dank memer

idle basalt
#

add a title

#

its markdown

late hill
#

^But you shouldn't use it for important information as mobile users can't see it

idle basalt
#

yes

buoyant wagon
#

ok

earnest phoenix
#

user.joinedAt are broken ?

idle basalt
#

cache

earnest phoenix
#

i delete cache

idle basalt
#

at least... i think that was the issue

#

i forget what caused joinedAt to show incorrect values

earnest phoenix
#

commandscompleted = await bot.pool.fetch("SELECT comcompl FROM cc WHERE userid = $1", member.id)

im trying to make it where when someone completes a command, it puts it in the db, then i retrive it for a command, it is not returning, can someone tell me what i did wrong?

lusty dew
#
let regex = /^(?:https?://)?(?:[\w]+\.)(?:\.?[\w]{2,})+$/i.test(input)
if(regex){
client.music.players.load(input)
}else {
client.music.players.load(`ytsearch: ${input} `)
}
#

is there any way

#

I can do .then(r => {})

#

just once

#

instead of for each

#

client.music.players.load

#

I don't want to have to duplicate the code

scarlet bane
#

well, yes. but no

#

@lusty dew just set them both to the same variable and do .then(... on that variable

#

so like, let l = ... in both of the blocks

#

and then l.then(...)

#

:^)

#

@earnest phoenix what happens if the user has never used your bot before? Your update searches for an id that isn't there, and your select does the same.

earnest phoenix
#

Well i do a bot command before, but it always returns as []

#

ohhhhhhhhh

#

nevermind

lusty dew
#

@scarlet bane I just did await client.music.players.load(regex ? input : `ytsearch: ${input}`).then(...)

#

but now I get a new error

#

(node:3756) UnhandledPromiseRejectionWarning: TypeError: client.music.players.load is not a function

scarlet bane
#

i have no clue

earnest phoenix
#

I'm trying to make it where it checks if a user is in the database and if not it returns, how would i do that?

scarlet bane
#

@earnest phoenix SQL has an "insert or update" instruction, which inserts if there isnt any entry or updates existing entries

lusty dew
#
(node:3756) UnhandledPromiseRejectionWarning: TypeError: client.music.players.load is not a function
#

and error again

west raptor
#

read the docs

scarlet bane
#

jesus christ this is indented so badly 😩

lusty dew
#

It is the way it went into the hastebin

#

It looks fine from vs code

#

and April what docs?

west raptor
#

d.js-lavalink?

lusty dew
#

I am not using d.js-lavalink

west raptor
#

then

#

what are you using

#

that's obviously lavalink

lusty dew
#

lavalink

west raptor
#

can you like link me the github repo..

lusty dew
#

You know d.js-lavalink isn't the only npm package for lavalink right?

west raptor
#

yeah but it's the most used one

#

can you atleast tell me

#

what

#

library u r using

lusty dew
#

If you give me a damn second

scarlet bane
#

He didnt say it was the only one

west raptor
#

it's not hard

scarlet bane
#

Shut

lusty dew
#

Give me a damn second god

#

so fucking pushy

scarlet bane
#

take your time

lusty dew
#

I was linking it rn

scarlet bane
#

nobody's being pushy

lusty dew
earnest phoenix
#

So, if everytime they run the command, it has ```await bot.pool.execute("INSERT INTO econ VALUES ($1, $2, $3)", 50, ctx.author.id, ctx.guild.id)

scarlet bane
#

if it's not, it'll do it multiple times

#

You need some sort of unique key to prevent it from repeating

earnest phoenix
#

i have it by guild

west raptor
#

not load()

scarlet bane
#

So you have something like Unique Key('guildId','userid')?

lusty dew
#

What

scarlet bane
#

@earnest phoenix

west raptor
#

wait

lusty dew
#

What Lmao

scarlet bane
#

@west raptor u thicc

earnest phoenix
#

ok ill try that, thx

scarlet bane
#

@lusty dew i think ur problem is that ur awaiting a promise but also using .then on it

lusty dew
#

Hm.

scarlet bane
#

idk js async that well but thats the only thing that stands out to me

lusty dew
#

How am I to get the tracks then?

west raptor
#

wait im confusion

scarlet bane
#

Await will return them for you, will it not?

west raptor
#

what the fuck

scarlet bane
#

like, rn ur doing await client.music.players.load(regex ? input : \`ytsearch: ${input}\`).then(...)

#

gdi

#

you can just

#

remove the .then

#

and set like.. var = await

lusty dew
#

Mk

#

Just curious why it worked before I put in the regex GWqlabsThonkery

west raptor
#

what's client.music.players?

scarlet bane
#

you didnt have the await before

lusty dew
#

I did...?

#

I always had the await

scarlet bane
#

where

lusty dew
#

I added it in after

scarlet bane
#

idk man

#

await (promise).then() doesnt seem like a good combo to me

lusty dew
#

cause client.music.players.load needs to be awaited

#

it didn't work without the await

scarlet bane
#

?????

lusty dew
#

¯_(ツ)_/¯

west raptor
#

not if you are using .then(...)

scarlet bane
#

if you use .then you do it during the event loop rather than waiting for it

west raptor
#

also what's client.music.players? seems like you would need to do client.music.players.get('guild id').load(...)

lusty dew
scarlet bane
#

monka

lusty dew
#

and it works perfectly fine with await and then

scarlet bane
#

idk then

lusty dew
#

That is why it is confusing me 👀

west raptor
#

ok im obviously being ignored

#

ill go then

lusty dew
#

or I didn't read your message till after

west raptor
#

i literally

#

sent

#

several messages asking

scarlet bane
#

april, if ur going to get overly frustrated and emotional for no reason

#

while he's talking to someone else

lusty dew
#

and I literally didn't read it till after

scarlet bane
#

then...

lusty dew
#

Sorry that you don't get enough attention

#

Thanks Raid

scarlet bane
#

i tried xd

lusty dew
#

I will try out what you said

scarlet bane
#

seems super odd to me to see await and .then at the same time

#

Cus usually that's only done when you're modifying the result with a lambda and doing something with it later

west raptor
#

alright.. and if that doesn't work can you please answer me?

scarlet bane
#

not when you're doing things in the then and never using the result again

west raptor
lusty dew
#

it is voice.players

#

I just put

#

voice into the client

#

client.music = voice

west raptor
#

yeah so you need to .get() the player

lusty dew
#

I know

#

I have done that

#

LOL

west raptor
#

alright but like the code you provided didnt

#

so

lusty dew
#

Yes it did

west raptor
#

sure

lusty dew
#

That is cause you looking in the wrong place

#

:p

west raptor
#

???

scarlet bane
#

i really dont get why this is being discussed

lusty dew
#

Nor do I

#

But if it makes them feel better

scarlet bane
#

What does telling him that he didn't do something which he clearly did, as he said his other snippet worked

#

achieve

#

at all

lusty dew
#

and know that they are getting the attention

#

Here is code from vs code

#

of me getting the player

#

:p

west raptor
#

jesus christ im trying to help but the latest hastebin link you provided isnt .get-ting the player so i assumed it's not there

lusty dew
#

Oh look here it is again

scarlet bane
#

April

lusty dew
#

It was there

#

you are looking in the wrong place

scarlet bane
#

at this point

#

even if you're 10000% right

#

you're approaching this like an impatient child, rather than someone who wants to help

west raptor
#

alright then im going to tell them the line if they dont listen to me so be it

#

it's line 23

#

you're not get-ting the player

lusty dew
#

LMAO

#

Ok

#

Go to sleep or something

scarlet bane
#

@lusty dew april is saying that line 23 should be player.load rather than client.music.players

lusty dew
#

you are obviously tired

scarlet bane
#

which i agree with

#

but they're being way too rude about it for you to realize

lusty dew
#

I realized

#

Lol

#

I just want it like that

wanton walrus
#

what

scarlet bane
#

You sure it works like that?

lusty dew
#

Yea

#

I am sure

scarlet bane
#

cus the docs also say player.load is the right way to go, not playermanager.load

wanton walrus
#

yall are really going overboard here lol, breathe

west raptor
#

the error you gave earlier though.. ```js
(node:3756) UnhandledPromiseRejectionWarning: TypeError: client.music.players.load is not a function

lusty dew
#

I used this same code on my vps

#

only thing different is I am adding in a regex

#

Here

scarlet bane
#

odd

lusty dew
#

I will test out what Raid said

#

if it errors I will admit I was wrong

#

and do it your way

#

Does that make you happy?

west raptor
#

i was already irritated before i came here so i should probably stop and cool down

lusty dew
#

I just gotta turn on my mongodb server again it goes off randomly mmLol

#
player.load is not a function
#

I tried it my way

#

then your way

#

Same error

west raptor
#

what's player?

lusty dew
#

.

#

Seriously

#

Have you not been listening?

west raptor
#

i didn't tell you to put player.load but ok

scarlet bane
#

april

#

at this point

#

go sleep

#

const player = client.music.players.get(message.guild.id);

west raptor
#

i dont want to sleep i still have more to do

scarlet bane
#

this is literally the first line of his code

#

lmao

lusty dew
#

Yea

#

Lol

scarlet bane
#

man i really wish hastebin didn't rape your indents

lusty dew
#

Exactly

scarlet bane
#

oh my god its because you're mixing tabs and spaces 😩

lusty dew
#

eyes

#

I am not xD

scarlet bane
lusty dew
#

I use tab whenever it in properly indents

scarlet bane
lusty dew
#

Wtf

scarlet bane
#

😩

lusty dew
#

I never used spaces

scarlet bane
#

.-.

#

thats the opposite of correct

#

always use spaces

#

tabs are dead

lusty dew
#

xD

scarlet bane
#

What editor do you use

lusty dew
#

Vs code

#

But I love notepad ++

#

;3

scarlet bane
#

vscode lets you autoconvert tabs to spaces

#

somewhere

west raptor
#

ctrl+k + crtl+f iirc

#

or is it ctrl+k + f

#

i forgot

lusty dew
#

Mk, but can we worry about my spaces later?

#

👀

west raptor
#

seems like the readme is wrong i dont rlly know

#

¯_(ツ)_/¯

#

can you try logging player and see what it gives

scarlet bane
#

inb4 ur player is null

lusty dew
#
Player {
  _events: [Object: null prototype] { event: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  status: 0,
  node:
   Node {
     _events: [Object: null prototype] { playerUpdate: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     players:
      PlayerStore [Map] { '561588141761495045' => [Circular], node: [Circular] },
     voiceStates:
      Map { '561588141761495045' => 'bfdaf01da2c8ad498cfbe4252bc1771a' },
     voiceServers: Map { '561588141761495045' => [Object] },
     _expectingConnection: Set {},
     password: 'mine',
     userID: '564115455044878367',
     shardCount: undefined,
     http:
      Http {
        node: [Circular],
        input: 'http://localhost:2333',
        base: undefined },
     connection:
      Connection {
        reconnectTimeout: 100,
        _listeners: [Object],
        _queue: [],
        node: [Circular],
        url: 'ws://localhost:2333',
        options: {},
        _backoff: [Backoff],
        _send: [Function: bound _send],
        ws: [WebSocket],
        resumeKey: '0.vvxuw8llf2h' },
     send: [Function: send],
     queues: Map {} },
  guildID: '561588141761495045' }
scarlet bane
#

log player.load

#

or client.music.players.load or whatever

lusty dew
#

Not a function

scarlet bane
#

cus player loks fine

#

Hmph

#

odd...

lusty dew
#

Yea

#

Idk

scarlet bane
#

Yeah i have no clue, never seen anything like this before

west raptor
#

huh odd looking at the code in the repo the load function i found was on Node

scarlet bane
#

right but he doesnt even have that

#

he only has send on node

west raptor
#

hmm

scarlet bane
#

is it possible that LL is down?

#

or would that error...?

lusty dew
#

It would error

#

on startup

#

Whenever I start my bot it would have an error

scarlet bane
#

hm

#

yeah i dont know

lusty dew
#
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:2333
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14)
Emitted 'error' event at:
    at WebSocket.error (C:\Users\Aj\Desktop\Clap Bot\node_modules\lavalink\dist\src\core\Connection.js:37:27)
    at WebSocket.emit (events.js:182:13)
    at ClientRequest.req.on (C:\Users\Aj\Desktop\Clap Bot\node_modules\ws\lib\websocket.js:568:15)
    at ClientRequest.emit (events.js:182:13)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
#

Like this

#

but I think it is different when using stable

#

idk

#

on stable I had dirs going to lavalink files

#

Oh wait notices the dir to lavalink

#

But yea it errors on start up

scarlet bane
#

zero clue

#

i tried everything i know

#

idk why its not working

#

hopefully someone else can help

west raptor
#

same

#

maybe try updating packages/libraries?

#

cause the code in the repo is saying something entirely different

lusty dew
#

Wdym updating?

scarlet bane
#

like, npm install lavalink again

#

maybe ur lib is fucked

west raptor
#

npm i

lusty dew
#

Worth a shot

west raptor
#

then i would try logging player again and see if it's different

lusty dew
#

Still no oof

#

npm i didn't work

west raptor
#

hmm

#

did player change at all?

lusty dew
#

No

west raptor
#

oof

earnest phoenix
#

@scarlet bane I tried that and after i run the command once, it says the user is already in the db

scarlet bane
#

@earnest phoenix so just insert ignore

#

it'll try to insert but it wont error if it cant

earnest phoenix
#

so, await bot.pool.execute("INSERT INTO econ VALUES ($1, $2, $3 ) ON DUPLICATE KEY INSERT IGNORE", 50, ctx.author.id, ctx.guild.id)

scarlet bane
#

no

earnest phoenix
#

sad

scarlet bane
#

insert into econ values blah blah blah on duplicate key (your update statement from above)

#

im not comfortable giving you the full statement but i've definitely given you enough help for you to figure it out 😗

earnest phoenix
#

Yea, and thank you

scarlet bane
#

ofcourse, any time 😃

lusty dew
#

I figured it out

#

it should have been

#

client.music.load

#

not client.music.players.load

#

👀

lament current
#

Hello! I'm Rabbitearsblog and I'm having a bit of a problem trying to incorporate bots into my servers. My servers are Animation Bliss and Rabbitearsblog's Patron Community and every time I try to add in a bot, it would say which server I would like to put the bot in. But unfortunately, neither of my servers would show up in the drop down box. How do I add my servers to the Discord server list?

idle basalt
#

you need to have manage guild perms in the server

#

if youre the owner, you should have these permissions

lament current
#

Okay. I'll check those out.

lament current
earnest phoenix
#

wrong site

#

thats the server list

lament current
#

Which website do I need to go to?

earnest phoenix
lusty dew
#

Question

#

I am trying to do

#

-ql 1

#

it is a queue list cmd

#

and I am paginating it

#

and I am trying to put 5 songs on each page

#

and when they do -ql [pagenum]

#

it will list the songs on that page

#

My question is

#

I know I have to use slice (since my queue is an array)

#

but how would I get it to list 5 songs on each page

buoyant wagon
#

modulo

#

ok that wouldnt work

#

repeated slicing 5?

lusty dew
#

Yea

#

so on each page

#

there is 5 songs

buoyant wagon
#

what lang

lusty dew
#

D.js

buoyant wagon
#
for (var i = 0; i < Math.round(q.length / 5 - 0.5); i++) {
    //add q.slice(0,5) to the page
    q.shift();
    q.shift();
    q.shift();
    q.shift();
    q.shift();
}```
#

i think that should work

lusty dew
#

Wait

#

just a question

#

why shift 5 times?

buoyant wagon
#

for 5 thingies

lusty dew
#

5 thingies

#

Ok

hushed berry
buoyant wagon
#

if it shifted once then the same thing would appear on two pages four times

lusty dew
#

Really?

#

I am not too sure how shift works this is why I am asking

buoyant wagon
#

wait lemme update it...

#

shift removes the first item

hushed berry
#

that doesnt seem like a good approach

#

isnt this supposed to be a read operation?

lusty dew
#

Read operation?

#

you mean

#

oh

#

you wasnt talking to me

#

xD

#

or were you?

hushed berry
#

You guys dont need to make it so hard

buoyant wagon
#
for (var i = 0; i < Math.round(queue.length / 5 + 0.5); i++) {
    //add queue.slice(0,5) to the page
    queue.splice(0,5);
}```
hushed berry
#

let page = queue.slice(pageNum * 5 - 1, (pageNum + 1) * 5));

#

no?

lusty dew
#

Hm probably idk tbh

hushed berry
#

well

lusty dew
#

If that is meant for embed and react pagination then no

hushed berry
#

I mean

#

it works for both

#

lol

lusty dew
#

Really?

hushed berry
#

As long as you keep track of the page number

lusty dew
#

i am umb tbh

buoyant wagon
#

umb

lusty dew
#

dumb*

hushed berry
#

i may be a bit off on my math

#

let me get it right 👍

lusty dew
#

Kk

#

Wouldn't pageNme = 0

#

num*

hushed berry
#
queue.slice(pageNum * pageSize, (pageNum + 1) * pageSize);```
works just fine ![blobthumbsup](https://cdn.discordapp.com/emojis/494901804476137482.webp?size=128 "blobthumbsup")
#

and ye, its zero based

#

🤔

lusty dew
#

pageSize?

#

what does that represent?

hushed berry
#

.....................

#

take a wild guess my dude

lusty dew
#

the size of the page

#

Lol

#

I was joking lol

hushed berry
#

yeah right

#

smh

lusty dew
#

it literall sas

#

pageSize

#

I am not that dumb

#

I am dumb but not that dumb

#

says*

floral bloom
#

How would I check if a member has a role? I've done it before but I forget. I also can't find it in the docs (it probably is though). I'm using D.js

#

Please ping with response

#

Never mind, found it on Google

velvet cliff
#

@earnest phoenix @earnest phoenix yes I get that,
but my bot was muted for not having a prefix and now it has

velvet cliff
#

uhh so... my bot is muted AGAIN
with no reason at all

zealous veldt
#

]]mutedbot

covert turtleBOT
#

Your bot was likely muted because it broke one of the "bot rules" listed in #rules-and-info.

To find out why your bot was muted and by who, use the search feature in #mod-logs:

velvet cliff
#

]]mutedbot

#

wut

#

my bot isnt muted id online is working but not here

zealous veldt
#

Then don't say your bot is muted

#

It's not our problem if your bot doesn't work

earnest phoenix
#

so, got Canvas to work but can't rlly find much info for Canvas Node.js/Discord.js

just ping me, not in a hurry

lament meteor
late mauve
#

Guys I have a question
Imagine I have 2 information for a same column in mysql (for example 2 data for serverid)
I want to delete the older one which is at bottom (mysql adds new data on top)
How can I do that?

vivid mortar
#

if(!message.channel.nsfw)

#

does that check if its an nsfw channel?

bright spear
#

that will be true if it is not an nsfw channel

#

the ! reverses it

vivid mortar
#

because when i tested it it responded in the nsfw channel with what was after the return

#

and didnt in a non nsfw channel

west skiff
#

idk read the docs I guess

vivid mortar
#

i fixed it

#

changed it to

#

if(message.channel.nsfw === false)

bright spear
#

thats the same

west skiff
#
!x``` and ```x == false``` are the same thing
vivid mortar
#

idk

#

that is what i got

west skiff
#

fuck me I cant type

vivid mortar
#

also

#

when bots are under testing what server do they join?

#

this?

west skiff
#

No don't add your testing bot to here unless you intent for it to be added to people's servers

vivid mortar
#

no thats not what i meant

#

i meant when the bots are being tested do they add them here

#

or in another server

mossy vine
#

In another testing server

vivid mortar
#

oh ok

west skiff
#

ok so you were planning on just enabling the nsfw check for this server

#

interesting

#

maybe let the user decide but default it to on

slim heart
#

Is there a way to make og values dependent on hashes or query?

inner jewel
#

yes

#

add the tags to html on the server

#

based on the url

distant galleon
#

does the bot have repeat everyday on fixed time reminder ?

unique nimbus
#

wdym repeat

trim saddle
#

@neat falcon yo how do you send files in js?

unique nimbus
#

wdym

neat falcon
#

Wdym

trim saddle
#

msg.channel.send(howtosendfiles)

neat falcon
#

read the docs

unique nimbus
neat falcon
trim saddle
#

smh you're a cert

#

you can help me

unique nimbus
#

You are welcome big smelly

neat falcon
#

i'm in school

#

my coding resources are at home

unique nimbus
#

Skullette we better team up and make a retarded bot in js

wanton walrus
#

@trim saddle send has json parameters

neat falcon
#

call it yardim botum and make it in dbm + host on glitch

trim saddle
#

js and jsons smh.

wanton walrus
#

if it's a file I believe it's send(file:

#

that's for 11.4.2

neat falcon
#
  • send({file: });
wanton walrus
#

I'm on the phone

#

pls

#

you get the point

neat falcon
#

wtf stop fucking ur phone

trim saddle
#

and it can be an array of files it seems

wanton walrus
#

yes

trim saddle
#

i wish there was a proper randomizer

#

oh well.

#

what if i wanted to upload from a link?

slim heart
#

@inner jewel what does that mean? Can I get an article or something maybe?

#

And I mean like dynamically through purely html I know I can do it with php but I wanna know if it can be done with purely html

inner jewel
#

no

#

you need server side code

slim heart
#

Hh ok

neat falcon
#

php PMonkaTrash

unique nimbus
#

coding GWjojoKingCrimsonAngry

winter zinc
#

Im not receiving update notifications of games

unique nimbus
#

wdym

velvet cliff
#

anyone here knows how to make a timer? /cooldown but it can only effect one command

unique nimbus
#

what language @velvet cliff

#

on python its asyncio.sleep(time)

#

yes

#

time = the cooldown in seconds

velvet cliff
#

js though

#

I want to set a cool down on -boxie cause it will give xp soon ik how to do that
but I cant make a working timer...
@unique nimbus

unique nimbus
#

See if that helps I don't use js myself

velvet cliff
#

oh I did python but my friend convinced me to do js

unique nimbus
#

wdym

#

Are you moving your code to js

earnest phoenix
#

how to make embeds on discord.js?

unique nimbus
mossy vine
#

@velvet cliff you can use setTimeout()

velvet cliff
#

@unique nimbus nope I started over

#

with js

unique nimbus
#

o

#

I mean I could go to js

#

but lazy

velvet cliff
#

@unique nimbus no I want to set a cooldown for all users but not for all commands

unique nimbus
#

that is for all users

#

so lets say I did that command

#

and then someone done it also

#

we both will have different seperate cooldowns for that command

#

yes

mossy vine
#

you can still use setTimeout

unique nimbus
#

yes

velvet cliff
#

oh lol i thought it was nvm thanks

unique nimbus
#

np

#

gl

velvet cliff
#

okay my last question for now,
how do you give users items? like
the items -boxie show but then also show the items in your inventory and add the items you earn from -boxie every time

unique nimbus
#

minus item from your shit and add 1 item to their shit

#

yes

velvet cliff
#

but how do you add items?

mossy vine
#

add them to your database

#

duh

velvet cliff
#

I mean the script for adding items duh

#

(js)

mossy vine
#

we have no idea how you handle your users items

#

add them to your database

velvet cliff
#

isnt there a line of code to do it?
like a line everyone can use?

mossy vine
#

no thats not how programming works

#

you cant copy paste everything your whole life

velvet cliff
#

im just guessing but something like
{addi @user.item :itemid: *5 };

mossy vine
#

we dont know how you set up your database or what you even use

velvet cliff
#

js

mossy vine
#

that is very helpful information

#

just saying js doesnt help at all

#

for all we know you could be using anything as a database. using a json file, sql, mongodb

#

do we just guess or what?

velvet cliff
#

but the basiclines are the same for everyone discord.js on glitch
like the bassicline for a message is always message.channel.send
so you can ask me not to copy paste but the basiclines are always the same

mossy vine
#

so just to make this simpler, how are you storing your users items?

velvet cliff
#

thats exactly what im asking...
how do you do that...
like thats what I want to know all this time

mossy vine
#

i suggest you use something like mysql

velvet cliff
#

ok thanks ig now ive to figure out what that Is but whatever

scarlet phoenix
#

I would also suggest using a database like mysql or mongo (if using js)

mossy vine
#

yes i just said that

scarlet phoenix
#

I prefer relational databases as oppossed to nosql solutions though

#

He's on js as far as I am aware, so I wanted to mention mongo as well

velvet cliff
#

you know im just starting so can you explain what mongo is?

late hill
#

Pretty sure mongo isn't just for js

#

But yes mongo very epic

#

It's a database @velvet cliff

mossy vine
#

yeah i was about to say

late hill
#

Google it

velvet cliff
#

oki

mossy vine
scarlet phoenix
#

Its not, but its part of the classic JS -> mongo pair

#

that i adamantly despise but accept it is popular.

late hill
#

They can host it for you

#

They have a 500mb free sandbox u can use

velvet cliff
#

wait your data base needs to be hosted?

late hill
#

You can run a mongo instance on whatever you're using to host your bot

#

But idk how much space you have

#

And if you want to go through installing and setting up all of it

#

It's not hard imo but it would probably be faster to just get one hosted for you

#

As you can then easily connect using what they call a connection string

idle basalt
#
db.get(`pokemon${message.author.id}${pokemonid}`) // get the whole entry```from here, it depends on how youre storing the information (i would recommend an array of objects) and then you can use normal javascript operations to get it done
#

if you store as an array of objects, array.map is your best friend

#

it loops over your array and returns a new array

#

so if you have an array of objects, you can do something like this: arr.map(e => e.id) and it will return an array of all the ids.

earnest phoenix
#

How do I store things in users account like when you do a command you get gold and the gold gets stored in user account?

idle basalt
#

you can use .join()

#

you need a database diruo

earnest phoenix
#

oh

idle basalt
#

join combines all the elements of an array with a joiner character that you specify

#

so to newline everything, you set up the array how you like with map and then call .join('\n')

#

um.. of what

#

i gave an example of map above ^^

#

sure. try it :)

#

e can be whatever you want -- its a function param

#

this line will only print the ids but figure out how you want it formatted and set it up however you like inside the map

#

the first param to the map callback represents each element of the array. which is why this is easiest if you have an array of objects

#

because the param will be each object and you can do object.prop on all of them

#
const arr = [{ prop1: 123, prop2: 456 }, { prop1: 789, prop2: 195 }];
arr.map(e => /* e is each individual object per iteration. so on the first run, e is { prop1: 123, prop2: 456 } */ e.prop1);
// => [123, 789]```
flint lion
#

mine all

idle basalt
#

yea thats good

#

dont overwrite, push into the array

earnest phoenix
#

hello, can any help me here with discord py 👀

hushed berry
#

just ask the question 👀

earnest phoenix
#

i like to list all permission of a tagged user. but i doesnt works really 👀

hushed berry
#

what part are you stuck on?

#

getting the member?

#

getting the permissions?

#

@earnest phoenix

earnest phoenix
#

on the output. wait a second i want to send a example ^^

hushed berry
#

Also, do you want it to be contexutalized? ie, show all perms for that member in a channel? or in that guild, ignoring channel overrides

earnest phoenix
#

Role permissions:
[('add_reactions', True), ('administrator', False), ('attach_files', False), ('ban_members', False), ('change_nickname', True), ('connect', True), ('create_instant_invite', True), ('deafen_members', False), ('embed_links', False), ('external_emojis', True), ('kick_members', False), ('manage_channels', False), ('manage_emojis', False), ('manage_messages', True), ('manage_nicknames', False), ('manage_roles', False), ('manage_server', False), ('manage_webhooks', False), ('mention_everyone', False), ('move_members', True), ('mute_members', False), ('read_message_history', True), ('read_messages', True), ('send_messages', True), ('send_tts_messages', False), ('speak', True), ('use_voice_activation', False), ('view_audit_logs', False)]

hushed berry
#

oh my gob

earnest phoenix
#

thats my actuell output. want to make it better in the output. but don´t know how 😮

#

the code is
perm = list(role.permissions)

#

can you help me with this please? 😊

hushed berry
#

@uneven laurel do it together. first map the element to the string you want per line and then join them

#

ie like

#

pokemons.map(e => e.level + ' ' + e.iv).join('\n')

#

yeah

#

use the techinque i said lol

#

i dont want to spoonfeed

earnest phoenix
#

I have a question that anyone could kindly answer.

neat falcon
#

Yes

hushed berry
#

just ask wearybread

neat falcon
#

that's a weary bread

earnest phoenix
#

Okay so basically you know how hytale is going to be like a roleplay sort of thing

neat falcon
#

we don't know that yet

slender thistle
#

@earnest phoenix Iterate through the elements inside the list

quiet topaz
#

I have a question, where I can learn good how to develppe and program?

neat falcon
earnest phoenix
#

how 😮 can you help me please with this @slender thistle

#

that was very helpful

mossy vine
#

you have the balls to put "bot coding" in your profile pic, but cant iterate through the elements of the list. respect

slender thistle
#
  1. Iterate through the list
  2. Each element is a tuple, which contains its first element as the name of the permission and the second one as its value
  3. name, perm = list_element
  4. Or whatever = list_element[your_index]
earnest phoenix
#

ohhhh 🤦🏼 why i have check it not earlier. thank very much for the brainwash

hushed berry
#

😂

#

there are quite a lot of bots that do that

#

no?

mossy vine
#

yes

#

many

neat falcon
hushed berry
#

not sure of any specifics

#

lmao

neat falcon
#

cyber why is there a kirbe with a 🔪

#

what

mossy vine
#

what

#

you want to gamble

#

in a game

hushed berry
mossy vine
#

that doesnt exist

earnest phoenix
#

nvm