#development

1 messages ยท Page 373 of 1

glossy sand
#

@hushed oyster get out of here if you have nothing productive to offer

earnest phoenix
#

no i dont have a bot dev role @hushed oyster

hushed oyster
#

ok

#

bye

glossy sand
#

so for example suppose I went

trim plinth
#

@earnest phoenix if you want to learn more javascript I suggest trying codecademy, there is a whole lesson on functions if you are having trouble

earnest phoenix
#

can somebody team me

glossy sand
#
let a;
a = function() {
    console.log('Hello, world!');
}
a();
#

that would declare a variable a

earnest phoenix
#

i did code academy but i forget easily

glossy sand
#

then assign a function to it using a function expression

#

then it calls the function stored in a

trim plinth
#

you can also do the => method for functions mmLol

#

instead of function

#

but thats something else

glossy sand
#

I'm gonna go eat dinner brb

trim plinth
#

mk

unique star
#

you can only use arrows on ES6 tho

trim plinth
#

oof

#

true

unique star
#

and its confusing if you dont know what a function is in the first place

trim plinth
#

mmtrue as well

#

for now just try the normal function method of declaring a function

earnest phoenix
#

this is all i learnt from code academy:

 msg.channel.send(`Hello there' + username + ', how are you?');
Output:
Hello there Hello, how are you?```
trim plinth
#

erm you forgot a lot then

earnest phoenix
#

nope thats it

#

is works

#

so im not changeing it

trim plinth
#

mm there is more than that I know for sure zoomeyes

#

but whatever floats your boat

earnest phoenix
#

ik but thats all i remember

uncut slate
#

that's not what the output would be

earnest phoenix
#

thats what it says it it

#

and thats how it runs

uncut slate
#

for one, it'd throw an error because you're opening the first string with a backtick and closing it with an apostrophe

#

and secondly you're missing a space between the first string and the username variable, so it would output Hello thereHello, how are you?

#

let = username = 'Hello' isn't even remotely correct

trim plinth
#

also that let = username = 'Hello'

#

oof

#

beat me to the error

uncut slate
#

"hurr durr that's how it runs" smh

trim plinth
#

the correct way to declare the username variable would be let username = 'Hello';

earnest phoenix
#

ive ran out od storage

#

out

#

i can even save pics

#

cant

glossy sand
#

hey be sure to explain the difference between let = username = "Hello" and let username = "hello"

#

nothing is learned if you don't explain

earnest phoenix
#

can someone teach me js

#

damn

trim plinth
#

oof

glossy sand
#

also coincidentially let = username = "Hello" would probably actually do the same thing albeit only accidentially lol

zealous veldt
#

I learnt by googling

glossy sand
#

anyways food time bye

zealous veldt
#

Bye phanta

#

Enjoy your sustinence

trim plinth
#

@earnest phoenix try looking back on multiple codecademy lessons and try to study it

earnest phoenix
#

ill give you some money xD i clearly dont know how to code

trim plinth
#

yeh no I don't need the money

zealous veldt
#

Use resources like google

#

It's free

zealous veldt
#

Donate the money or do something useful with it

earnest phoenix
#

wat

trim plinth
#

?

zealous veldt
#

You don't need to pay to learn

earnest phoenix
#

honestly

#

ok im done

#

bye

pale light
#

๐Ÿ‘€

trim plinth
#

fuck

zealous veldt
next bluff
#

anyone know why the site interpreting my bot page's css as paragraphs? Every block looks like this:

<p>#menu {
    background: transparent;
}</p>
#

it's in a style tag so I'm a bit confused

elder rapids
#

markdown interfering?

#

My assumption here if you have the style tag properly

next bluff
#

that could be

#

the first css block works fine and then everything else is a p tag

#

I'll try minifying it I guess?

#

wow, that worked

#

thanks for the tip

elder rapids
#

np, even though I didn't really give you anything I just told you what the problem likely was

next bluff
#

sometimes that's enough

earnest phoenix
#

lavalink bahd

white blaze
#

Hello

earnest phoenix
#

hi

austere meadow
#

welcome to the lavalink support group

earnest phoenix
#

okay so connection timeout

austere meadow
#

what a sad day

#

yes

white blaze
austere meadow
#

and victor

white blaze
#

you just swore

austere meadow
#

i can tell that they are both right, because as you'd know my bot does join the channel

white blaze
#

no I typed <# 385837258768515083>

#

๐Ÿ˜‰

#

Can I see your source?

austere meadow
white blaze
#

and it's the client.player.join that is breaking right?

austere meadow
#

"blake your code sucks" yes i know ill fix the console.logs later

#

well

#

thats the part i dont really get

#

in queueMusic

#

it never gets to that final console.log

#

so the promise is just indefinitely stuck

#

timed out

white blaze
#

Where'd you get sandysounds

austere meadow
#

well theres a name for that

#

its called rejected

white blaze
#

Alright

earnest phoenix
#

sanddyyy cheeks

austere meadow
earnest phoenix
#

hmm

#

what lib is ur bot in?

austere meadow
#

discord.js latest master

earnest phoenix
#

oohhhh

austere meadow
#

not v11

#

so that could be related

white blaze
austere meadow
#

yes

earnest phoenix
#

you know how many times ive transfered Lavalink.jar in and out of my vps today?

#

its been torture

austere meadow
#

have you got the latest Lavalink.jar?

#

thats what i downloaded

earnest phoenix
#

yeah i got the latest master

#

still boke

#

like same errs

white blaze
#

hmm

austere meadow
#

if you look at the code for pendingGuilds
can you try to find what its trying to do?

#

like if it doesnt timeout whats it normally supposed to resolve

white blaze
#

It's a JS object

austere meadow
#

i know its an object

white blaze
#

Hmm

austere meadow
#

4JR you use lavalink dont you

white blaze
#

(ohh Keno is advertising on the radio)

#

๐Ÿค”

#

this.pendingGuilds[data.guild_id].timeout is all I see that references it

earnest phoenix
#

hey can you guys link me to where you get lavalink files?

white blaze
#

and ```
clearTimeout(this.pendingGuilds[data.guild_id].timeout);
this.pendingGuilds[data.guild_id].timeout = null;

low rivet
#

what's lavalink

earnest phoenix
#

its like fredboat or something

white blaze
#

Oh wait

#

@austere meadow

white blaze
#

That's a setTimeout()

#

so

austere meadow
#

yeah

white blaze
#

that will definitely happen

earnest phoenix
#

tnx'

white blaze
#

after 10000 ms

austere meadow
#

but within those 10 seconds

white blaze
#
f (this.pendingGuilds[data.guild_id] && this.pendingGuilds[data.guild_id].timeout) {
     clearTimeout(this.pendingGuilds[data.guild_id].timeout);
     this.pendingGuilds[data.guild_id].timeout = null;
}
#

That clears it

austere meadow
#

something is supposed to happen

white blaze
#

voiceServerUpdate is supposed to be called

austere meadow
#

its not definitely supposed to happen, if its resolved within the 10 seconds it will be cleared

white blaze
#

Yes

#

Once voiceServerUpdate is called

austere meadow
#

hmm

#

but how is voiceServerUpdate called?

#

thats strange

earnest phoenix
#

did the application.yml or whatever change

#

?

austere meadow
#

did it?

white blaze
#

Yeah that's what I'm trying to find now

austere meadow
#

im not sure

white blaze
#

I can't see any references to it

#

After doing a search in the repo

#

I can't find any references to voiceServerUpdate

austere meadow
#

yeah its weird

#

im assuming it would be handled by discord maybe but thats weird

white blaze
#

Hmm

#

Is there any documentation for SandySounds?

austere meadow
#

doesn't seem so

white blaze
#

Hmm

#

Are you like supposed to call voiceServerUpdate yourself or something?

austere meadow
#

i dont think so?

#

im not sure though

#

should i try it? it takes a "data" parameter but im not sure what thats for

white blaze
austere meadow
#

thats not the same

white blaze
#

d

austere meadow
#

this is a lavalink data

#

so

earnest phoenix
#

the un application.yml added youtubePlaylistLoadLimit: 600

#

maybe its mandatory?

low rivet
#

what's lavalink @austere meadow

austere meadow
#

its a link thats lava

earnest phoenix
#

lo

austere meadow
#

do you actually not know what it is

white blaze
#

Nah I can't see anything that it uses which isn't given in that payload

low rivet
#

lemme google

white blaze
#

@austere meadow How did you tap into the WebSocket connection?

austere meadow
#

on d.js?

low rivet
#

well, i don't make jda bots

white blaze
#

Yeah

austere meadow
#

@low rivet i thought you used lavaplayer or something similar though

low rivet
#

nope haha

austere meadow
#

huh okay sorry

low rivet
#

never made music

austere meadow
#

its basically like ytdl-core but a lot better

white blaze
#

^

austere meadow
#

it includes more options and its based on Lavaplayer

#

made in java

#

which is faster

earnest phoenix
austere meadow
#

aha vic

#

think you're right

white blaze
#

I'm always right ;)

earnest phoenix
#

wait what

white blaze
#

How did you tap into the WebSocket connection?

earnest phoenix
#

you guys found solution?

white blaze
#

Still trying to figure it out

#

ish

earnest phoenix
#

oh

austere meadow
#

its not certain

#

but it would make sense

white blaze
#

Hmm

austere meadow
#

SandySounds doesn't include an onRaw thing

low rivet
#

cool i might try it out zblake

austere meadow
#

im not sure if theres an equivalent

white blaze
#

How did you tap into the WebSocket connection?

low rivet
#

always wanted to make music but never had the time GWjustinEyesReverse

austere meadow
#

@white blaze what do you mean?

#

so that it joins the voice channel manually?

white blaze
#

Wasn't there like an object where d.js would let you read the raw data it received from the WebSocket?

austere meadow
#

thats client.ws

#

theres also a raw event but thats unrelated really

white blaze
#

Ahh that's not on the docs

austere meadow
#

yeah

white blaze
#

Ok

#

Let me take a look

#

Is it in master only?

austere meadow
#

hey thanks again vic

#

really appreciate it

#

and i dont know

white blaze
#

No problem man :)

earnest phoenix
#

blake you fix it?

austere meadow
#

i dont think so

#

nah not yet

earnest phoenix
#

oof

white blaze
#

Still sort of figuring it out ๐Ÿ˜›

#

Almost there though

#

I can feel it

austere meadow
#

@white blaze should be on stable

#

just try console.logging client.ws or something

earnest phoenix
#

im not stable

austere meadow
#

kek same

white blaze
#

Am I allowed to use am:exec here?

austere meadow
white blaze
#

Alright

#

Actually

#

I think I found the source

earnest phoenix
#

oh ๐Ÿ‘€

austere meadow
#

ah yeah

#

client.ws.send

white blaze
#

You don't want to send

austere meadow
#

what do i want to do then

white blaze
#

Receive

austere meadow
#

oh

white blaze
austere meadow
#

yeah thats the raw event i was talking about

white blaze
#

Alright

austere meadow
#

basically just sends whatever it is thinking at that moment

white blaze
#

I need to figure out what this packet is

#

Can you connect up to the raw event and tell me what you get?

#

I think that's just what you need

austere meadow
#

oh are you talking about the data parameter for voiceServerUpdate?
or the d parameter when sending the packet?

white blaze
#

*receiving

#

Both

austere meadow
#

ok

#

its called d right?

#

op and d

white blaze
#

because you want to pass the d parameter to voiceServerUpdate

austere meadow
#

no i dont

#

this is separate trust me

white blaze
#

Blake

#

Try it

#

Trust me

#

Only send it if t="VOICE_SERVER_UPDATE" though

austere meadow
#

basically there is a lavalink packet that is separate, it looks like this;

{
    "op": "play",
    "guildId": "...",
    "track": "...",
    "startTime": "60000",
    "endTime": "120000"
}

that is different to the discord packet

#

alright ill try it then

#

cant i just hook it up to my voiceStateUpdate event?

white blaze
#

Sorry?

#

No voiceStateUpdate doesn't give enough information

austere meadow
#

ok

white blaze
#

That might be a lavalink packet

#

but

austere meadow
#

i dont really understand still why you need this information

#

you know what its receiving

#

its that packet on the docs

#

thats what it gets

#

isnt it?

white blaze
#

Sorry?

#

Does the lavalink packet have a session_id?

austere meadow
#

yeah

white blaze
#

Ahh ok

#

Hmm

austere meadow
white blaze
#

So maybe lavalink is supposed to send that

austere meadow
#

it would make sense

#

since lavalink does most of the heavy lifting here

white blaze
austere meadow
#

dude

#

you are a mind reader

#

guess whats on my clipboard

#

lmfao

white blaze
#

HEH

earnest phoenix
#

oof

white blaze
#

hmm

austere meadow
#

we are closing in on the issue

white blaze
#

Where's that?

#

in lavalink?

#

or sandy?

austere meadow
#

this is either a fault in SandySounds forgetting to handle the voiceStateUpdate event and passing it to lavalink, or something else

#

no that was in sandysounds

white blaze
#

Oh ok

austere meadow
#

Player.js

white blaze
#

queueEvent?

#

hmmm

austere meadow
#

theres 3 files

white blaze
#

Yeah I can see that

#

Hmmm

#

sendEvent

#

๐Ÿค”

#

Do you need to call that yourself

austere meadow
#

SandySounds.js is the equivalent of lavalink.js's PlayerManager

white blaze
#

๐Ÿค” ๐Ÿค” ๐Ÿค”

austere meadow
#

i wouldn't think so

#

ok

#

this has to be it

#

the issue is that voiceServerUpdate is never called

#

thats the underlying issue

#

because the only way for that timeout to be cleared

#

is through that function

white blaze
#

Yes

austere meadow
#

and without that, we can't pass

#

so essentially, the connection works, but the timeout is never cleared because... ?

#

im not sure why its never called

white blaze
#

And voiceServerUpdate is supposed to be called by lavalink

austere meadow
#

i dont know if we have to manually call it

white blaze
#

but lavalink is never informed of the voice server update

austere meadow
#

yeah

white blaze
#

โˆด it is never called

#

Q. E. D.

austere meadow
#

what

white blaze
#

which is in a node

#

Can you try

austere meadow
#

try what

white blaze
#

Okay

#

So

#

In SandySounds.js there is a nodeCreate event

#

Please connect to that event

#

It takes one argument called node

austere meadow
#

but

white blaze
#

Actually no

#

Ok

#

Don't worry

austere meadow
#

ok

white blaze
#

Tap into the raw event of d.js

austere meadow
#

okay

white blaze
#

and filter out voice server updates

#

and obtain the d object

austere meadow
#

what am i filtering again

#

VOICE_STATE_UPDATE?

white blaze
#

VOICE_SERVER_UPDATE

austere meadow
#

ah okay

white blaze
#

t == "VOICE_SERVER_UPDATE"

earnest phoenix
#

ok

white blaze
#

@austere meadow Got the d object?

austere meadow
#

one sec

earnest phoenix
#

๐Ÿ˜‰

white blaze
#

๐Ÿ˜›

earnest phoenix
#

my vps is at 41 percent now

#

its taking so long

white blaze
#

okay

#

Great

#

So with the letter between s and f on the QWERTY keyboard object

#

(since some people have a strange mind)

austere meadow
#

yes

#

lmao

white blaze
#

For each node in SandySounds

earnest phoenix
#

maybe you put VOICE_STATE_UPDATE in op?

white blaze
#

Send the letter between s and f on the QWERTY keyboard object

#

Oh and also set letter between s and f on the QWERTY keyboard.op = "voiceUpdate"

earnest phoenix
#

oh

white blaze
earnest phoenix
#

ohh

#

oh ๐Ÿ˜ฆ

austere meadow
#

hang on

#

i dont understand

#

i know to do it for each node

#

but

white blaze
#
d.op = "voiceUpdate";
for each node {
    node.send(d);
}
austere meadow
#

pseudocode!!!

white blaze
#

^

#

Yeah not going to do my rant about Standard Pseudocode here ๐Ÿ˜›

austere meadow
#

im assuming i put that in the raw event

white blaze
#

Yes

#

and only if t == "VOICE_SERVER_UPDATE"

#

@austere meadow How are you going

austere meadow
#

i cant filter it for some reason?

white blaze
#

What?

austere meadow
#
async run(data) {
    console.log("t")
    if (data == "VOICE_SERVER_UPDATE") {

t gets run but the if statement never does

white blaze
#
if (packet.t == "VOICE_SERVER_UPDATE") {
    //do stuff
}
austere meadow
#

oh

white blaze
austere meadow
#

thanks

#
if (data.t == "VOICE_SERVER_UPDATE") {
      data.op = "voiceUpdate";
      for (let i in this.client.player.nodes) {
        console.log(this.client.player.nodes[i])
        this.client.player.nodes[i].send(data)
      }
    }

not having great success

#

still getting timed out

#

thats probs wrong tho

#

i feel like you are getting the lavalink packets mixed up with discord ones

white blaze
#

No I'm sending the voice server update to lavalink

#

Blake

#

You want data.d

#

not data

#

data.d.op

austere meadow
#

but you are essentially taking discords packet

#

ok

white blaze
#

send(data.d)

#

data.t == ""

#

Yes Blake, I am taking Discord's packet and sending it to lavalink so it can turn it into a lavalink packet @austere meadow

austere meadow
#

okay

#

hmm

#

oh my for loop isnt doing anything lmfao

earnest phoenix
#

lol

white blaze
#

@austere meadow Did you get it?

austere meadow
#

still trying to loop over this map

#

my goodness

glossy sand
#

trying to loop through a js map?

gritty elk
#

I have created a WIP Bot called BubbleBot.

earnest phoenix
#

ok

glossy sand
#

@austere meadow what you trying to do lol

austere meadow
#

honestly i have no idea lmfao

glossy sand
#

relatable

austere meadow
#

@white blaze client.players.nodes is a map

glossy sand
#

appears to map hosts to Nodes?

austere meadow
#

yeah

gritty elk
#

I'm looking for a good programming language for Chromebooks, but there seems to be none!

earnest phoenix
#

lolwhat

gritty elk
#

Yes, I use a Chromebook.

glossy sand
#

well that's your answer

#

there really are none

#

you can try running a secondary OS using crouton, however

austere meadow
#

@white blaze im gonna have dinner real quick then come back to this
im 99% sure this is a fault in SandySounds because theres just no sign of it passing voiceServerUpdate anywhere which is crucial to prevent that timeout

gritty elk
white blaze
#

@austere meadow Alright

#
let event = data.d;
event.op = "voiceUpdate";
for (let [key, node] of client.players.nodes) {
    node.send(event);
}
#

Try that

earnest phoenix
#

ok

#

oof

umbral pelican
earnest phoenix
#

@white blaze i got cant get guildId of undefined but im also probably doing it very wrong XD

#

no no it says guildId not found

white blaze
#

Hmm

#

Oh right

#

Ok

#

Sorry I overlooked something

#

Let me rewrite that

earnest phoenix
#

ok

white blaze
#

Hmmm

#
let event = {
    op: "voiceUpdate";
    guildId: data.d.guild_id,
    sessionId: something
    event: something
};
for (let [key, node] of client.players.nodes) {
    node.send(event);
}
#

Hmmm

earnest phoenix
#

ok

white blaze
#

Prizes of $0 go to whoever can figure out what sessionId and event is

#

Hmm

#

I'll take a look in a couple hours

#

Bit busy now hahaha

#

Sorry

lethal sun
#

Someone buy me Supporter for 300 Pizza boxes wink

#

@white blaze happy bday mate

white blaze
#

Thanks :)

lethal sun
#

np

earnest phoenix
#
client.on("raw", packet => {
    if(packet.t === "MESSAGE_DELETE") {
        let messageID = packet.d.id;
        let channelID = packet.d.channel_id;
    console.log(packet.d.id);
    }
});```

dats how i made my logs. . . I need help with detecting the person who sent the message and getting the message so i can send a embed to like a [#logs](/guild/264445053596991498/channel/264889891039608874/) channel
earnest phoenix
#

welp i cant get it to work

austere meadow
#

thinking of filing another issue on SandySounds

vague latch
#

Im using this as delete message log @earnest phoenix I like variables so... ```js
module.exports = function({DBM, Actions, Files, Events, tempVars, serverVars, globalVars}, client){
// can put custom stuff that doesn't work properly in run scripts here!

client.on("messageDelete", (message) => {
const content = message.content;
const author = message.author.tag;
const channel = message.channel.name;
const embed = {
"title": "Message from " + author + " removed",
"description": content,
"color": 9902553,
"footer": {
"text": "In: " + channel
}
};
message.guild.channels.find('name', 'bot-log').send({ embed });
});
}

earnest phoenix
#

uh okay?

#

@austere meadow do it, i cant get eris-lavalink to work either ;/

austere meadow
#

well hmm

#

if its happening on both

vague latch
#

Ah lol. I only read that you are looking for a delete message log...

austere meadow
#

this is just so odd because it worked fine for me in lavalink.js (d.js port of eris-lavalink) on lavalink 1.3

earnest phoenix
#

ikr

white blaze
#

@austere meadow Again I think lavalink calls the update function directly

#

But I might be wrong

austere meadow
#

im honestly not sure :/

white blaze
#

:|

earnest phoenix
#

all my friends have it working

#

if i figure it out ill tell you

austere meadow
#

@earnest phoenix do your friends also use SandySounds?

#

or do they use another lib?

earnest phoenix
#

they use what i use @austere meadow

#

should be at least somewhat similar

austere meadow
#

hmm

quasi sandal
neat falcon
#

hmm

glossy junco
#

Hmmmm can anyone help with a deathbattle system (discord.js)

hushed berry
#

@quasi sandal more context pls @quasi sandal

quasi sandal
#

@hushed berry i found the issue, I was putting a new line in a string instead of using \n

hushed berry
#

Oh like the actual character?

quasi sandal
#

no an actual new line

austere meadow
#

@earnest phoenix https://github.com/MrJohnCoder/SandySounds/issues/18
concluding the problem to an issue in SandySounds or lavalink, both yours and my code look correct, ive adapted changes and done everything i can, but it's still failing. im hoping john can give a speedy response to help us solve this

earnest phoenix
#

Is there any possible way. . . to make a timer in discord.js?
Like a countdown command

austere meadow
#

you can use setInterval with a 1000ms delay

#

that'd be the easiest way

#

if you want seconds ofc

earnest phoenix
#

well. . . i was thinking of dat but i ended up figureing out how to execute it

fleet mason
#

exports.run = (client, message, args) => {

  let member = message.mentions.members.first();
  let guild = message.member.guild;
  let Role = guild.roles.find('name', 'Muted');

if(message.member.roles.has(config.botcommanderRole)) {
  member.removeRole(Role);
  message.member.send(`You have been unmuted. If you break a rule again the mute will last longer! Be carefull!`);
  return;

} else {
  message.channel.send(`Only people with \`bot-commander\` role can use this command`);
  return;
}

}```
#

why does it send a message to me and not to the person i mentioned

fossil oxide
#

Hi

languid dragon
#

it allows us to get the Guild information back that the user added our bot to so the web site can save record of our bot having been added to that server

#

I don't understand why you can't do this via a webpanel if the user requests to do so

fossil oxide
#

Me and Ken seem to be a bit confused about your issue seeing as it's quite uncommon.

median dragon
#

@languid dragon We require only the administrator of the server, the one who added the bot, to login to our web site to configure the bot.

languid dragon
#

But why can't you do that using commands?

#

And why can't you make the user Oauth to your website

#

instead of when you add the bot

#

it's easier that way

#

big bots do it like @jolly zephyr is a prime example

median dragon
#

It's very possible using commands - but you're asking for a full rewrite of our application. Our "bot" only exists to show an "Active" indicator in the online list. Everything else is done via the web site and webhooks. We aren't your average bot, because we've built a web interface for configuring rather than a bunch of commands.

languid dragon
#

or does mee6 require a grant code hmmf

#

1 moment

#

could i view your application

median dragon
#

I need to attend to my daughters, be back in a few

restive silo
#

Okay Ben we dont ask you to rewrite your application rather then your bot isn't passing our standarts and you want to submit it here, you can also just let your bot like that and not submit it ๐Ÿ‘€

languid dragon
#

who rejected the bot

#

because this is not a case of some idiot just toggling the grant code option with his application

restive silo
#

uhh i think it was loris

languid dragon
#

1 sec

median dragon
#

It's not my objective to get anyone in trouble or anything of that nature, I'm sure you guys get tons of spam and this is the right call 99% of the time that you see it.

languid dragon
#

@median dragon have you resubmitted your app?

restive silo
#

we just found the site of your bot, did you link that on your bots profile while submitting?

#

๐Ÿ‘€

median dragon
#

Yes. The description CSS is a bit dated, my partner is asleep atm and he has the latest version

#

Yes, we did link it.

languid dragon
#

@median dragon We'll get back to you in a few moments, thank you for your patience!

median dragon
#

No problem, thanks for taking the time to dig into this for me.

earnest phoenix
#

@austere meadow anything worthy yet?

austere meadow
#

did you see the link i mentioned you

#

hold on

#

ive been checking source code and stuff

#

can't find much unfortunately

#

do you know how to get in contact with john?

#

the creator of sandysounds

earnest phoenix
#

no ๐Ÿ˜ญ

austere meadow
#

rip

#

yeah im a bit upset tbh, i was hoping to get it working tonight but no luck at all

#

100% its an issue with sandysounds tho, i have checked top to bottom for issues and came up with nothing

#

so im just waiting to see what john will say

heady zinc
#

inb4 its 100% your fault

austere meadow
#

it probably is
but im open to that

earnest phoenix
#

@fleet mason u use message.member just use member :/

#

can anyone help me? i am trying to detect how many users reacted ๐Ÿ‘ and also counting how much users reacting ๐Ÿ‘Ž and see which one has more

edgy vale
#

I just read the tutorial in #announcements to see if theres something interesting and just read that i shouldnt save data in jsons. I thought json databases are good?

next bluff
#

Not too efficient, especially when it gets large

#

You might be thinking of noSQL

gleaming ocean
#

hello

edgy vale
#

Hi

#

Does noSQL also allow "dicts in dicts"?

#

Or what kind of db is it?

next bluff
#

TBH I only work with SQL so I can't really help you much there

edgy vale
#

I dont know sql nor nosql right now ๐Ÿคท

fossil oxide
#

@edgy vale You might want to look into, MongoDB or rethink DB

edgy vale
#

Cause i need it just for balances and general server settings

scenic crest
#

Bad practice to put function definitions inside a C++ header when working with templates?

earnest phoenix
#

pls someone tell pls how to. . . detect the reactions in js

next bluff
#

I think implementation in headers can cause circular dependencies more easily

scenic crest
#

yeah but doing templating in .cpp files is insanely ugly in my experience

earnest phoenix
#

Hello, I use d.js and I cant get a message delete event going, I want to get it to log to a channel but this code doesnt seem to work

#

hm

#
client.on("messageDelete", msgs => {
  msgs.forEach(msg => {
    msg.guild.channels.find("name","server-logs").send("Message delete test");
    if(msg.channel.name === "daily-advertisement") {
      msg.channel.overwritePermissions(msg.author.id, {"SEND_MESSAGES":true});
    }
  });
});```
#

IVe tried bulk also but

edgy vale
#

@earnest phoenix so in short my bot checks the reactions of the message after a min. message.reactions returns a reactions list in python. Then i go through each reaction and if its an emoji i want, for example a ๐Ÿ‘, i then count the number of reactions it has on the message reaction.count and save that to a variable

earnest phoenix
#

Anyway

tawny lava
#

the messageDelete event gives you a single message, not a collection @earnest phoenix

earnest phoenix
#

huh

#

@tawny lava wasnt the prolem

#

that's not the problem right after the start of the event we do console.log(1) and it doesn't respond in the console

#

Exactly (btw goldensaur is helping me)

#

@edgy vale my question is how do i do it in js :/

edgy vale
#

check the docs on how to get the reactions of a message

#

then check the docs on how to count reactions of a kind on a message

earnest phoenix
#

๐Ÿค” i cant rlly find it

#

Anyway, mention me or goldensaur if you have a fix, thanks!

edgy vale
#
earnest phoenix
#

Hmm

#

Anyway, im here for help

glossy junco
#

On the discord bot list site how do i change the bot avatar?

#

?

earnest phoenix
#

ty i just figure it out

carmine berry
#

If you update your bots avatar It will update on the site I'm pretty sure @glossy junco

glossy junco
#

yeah ik

#

how do u get certified dev?

carmine berry
#

Applying for cert and being approved

glossy junco
#

kk

drowsy falcon
#

how can i make my bot delete the message that the bot sent after 10000ms?

elder rapids
#

async future method

#

I don't know what language so I can't tell you what you can use

#

But basically just assign a method that runs 10 seconds in the future

drowsy falcon
#

d.js

elder rapids
#

uhhh setTimeout? (lol I only know JS with browsers)

drowsy falcon
#

wait

#

lemme try

glossy sand
#

setTimeout works in node too

earnest phoenix
#

So nobody found the solution to my problem

#

Even though

#

there are over 100 developers who know

glossy sand
#

the messageDelete event emits a single message, not an array of them

drowsy falcon
#

does it dedlete the bots message or my message?

#

delete

glossy sand
#

@earnest phoenix

#

@drowsy falcon depends on how you've programmed it

drowsy falcon
#

but im noob, how can i make it delete the bots message lol

elder rapids
#

Store a reference to the message you sent?

#

I assume the library would work similar to what I use

inner jewel
#

myMsg = await channel.send("stuff")
setTimeout(()=>delete myMsg, 10000)

drowsy falcon
#

thanks

glossy sand
#

do note that that's pseudocode and you can't just copy+paste it with the expectation that it will work

earnest phoenix
#

@austere meadow hey i think i figured out the issue

glossy junco
#

Does anyone know how to add {ping so it returns with the ping of the bot? I need help with it in JavaScripts (Discord.js)

carmine berry
#

client.ping or client.pings

glossy junco
#

kk

topaz fjord
#

<client>.ping

rough pelican
#

i would recommend u round the ping

#

so u dont get a number like 15.6666666666666

topaz fjord
#

But why mmLol

sudden rivet
#

hi

frail terrace
glossy junco
#

discord.js ๐Ÿ˜ฆ

austere meadow
#

@earnest phoenix really did you get it going

earnest phoenix
#

yeah

#

@austere meadow working for me

austere meadow
#

holy shit how

earnest phoenix
#

the only thing i had to do is change my client.player.join()/.leave() to client.joinVoiceChannel() / .leaveVoiceChannel()

austere meadow
#

on sandysounds?

earnest phoenix
#

eris-lavalink

winged osprey
#

it looks like sandysounds doesn't handle sending the op 4

earnest phoenix
#

yea

austere meadow
#

but ss doesnt have joinVoiceChannel

#

so :/

winged osprey
#

what lib are u using

austere meadow
#

d.js

restive silo
#

Hey can any C# Botdev recommend an ORM for Postgressql? eyesThink

scenic crest
subtle ferry
#

events.js:143
throw err;
^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Client.emit (events.js:141:19)
at WebSocketConnection.onError (C:\Users\JMasher\Desktop\Discordjs\MashBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:371:17)
at WebSocket.onError (C:\Users\JMasher\Desktop\Discordjs\MashBot\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:160:13)
at WebSocket.finalize (C:\Users\JMasher\Desktop\Discordjs\MashBot\node_modules\ws\lib\websocket.js:190:41)
at TLSSocket.emit (events.js:160:13)
at emitErrorNT (internal/streams/destroy.js:64:8)
at process._tickCallback (internal/process/next_tick.js:152:19)

C:\Users\JMasher\Desktop\Discordjs\MashBot>pause
Press any key to continue . . . here is my error

trim plinth
#

are you using pc or laptop

topaz fjord
#

i dont think that matters lol

trim plinth
#

well, kinda

neat falcon
#

handle errors

topaz fjord
#

not rlly

#

and what derpy said

#

catch your errors

trim plinth
#

if you close your laptop it can shut off your wifi and return that error

topaz fjord
#

i use a desktop anf wifi

#

so

trim plinth
#

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

#

@subtle ferry and also you need to show code, we can't help you with only a vague error

restive silo
#

dude

#

listen to what other people say

#

he should handle the error event of every EventEmitter

#

atleast with a console.log

topaz fjord
#

^

restive silo
#

@scenic crest that library seems to not be fully compatible with .Net Core

#

:/

twin quartz
#

Does anyone know how to automatically add person to a role upon entering a server with a bot?

#

cant find the doc to do so

bright bone
#

What programming do you use?

twin quartz
#

js

bright bone
#

๐Ÿค”

topaz fjord
#

@twin quartz in your member join event use addRole

twin quartz
#

Got it to work.

#

member.addRole(role)
that one right?

topaz fjord
#

yes

twin quartz
#

Thanks

topaz fjord
#

anyone know any good tutorials for jda command handlers

inner jewel
#

jda utils

topaz fjord
#

erma gerd

#

k

twin quartz
#

For some reason I keep getting the

(node:11572) DeprecationWarning: TextChannel#sendMessage: use TextChannel#send instead
error

inner jewel
#

channel.sendMessage("x") -> channel.send("x")

twin quartz
#

I was doing the !ping command with the response "pong".

trim plinth
#

ok

twin quartz
#

Kinda weird how it never showed up until now

floral stone
#

How to reduce memory usage in python

zealous veldt
#

best method: use js use tabs

floral stone
#

Just looking for pointers

#

How does tabs make a difference?

zealous veldt
#

its a joke

floral stone
#

Ah

#

I thought so

burnt shale
#

And By the way I dumped

jagged birch
#

does anyone know if ffmpeg stops ytdl shit from working cause on my test bot my music feature works and on the main it doesn't, I have all the packages updated and are exactly the same as on my test bot, the only difference is that I have ffmpeg installed, so was wondering if that could be what's causing the bot to leave instead of skip to the next song in the queue.. and yes, the code is all correct.. I've triple checked. I do get an error in console.. but it doesn't actually say what's wrong.. it just says: "user" and on another line it says "undefined".

#

I've been trying to fix this for a week... smh.

earnest phoenix
#

can u give me the whole console error?

jagged birch
#

it legit says:

user
undefined

#

that's all.

prime cliff
#

That means one of your user variables is undefined

#

๐Ÿคฆ

#

Find out which one it is

earnest phoenix
#

what is a good file to save data?

#

i know .json is bad

jagged birch
#

yeah but why would I get that error if its working on my test bot? I looked at all my variables and they all seem fine.. @prime cliff

mental willow
#

how do i get a PY bot to Execute code in a specific order

earnest phoenix
#

idk

earnest phoenix
#

how do i make it so if the user reacts to one message then it gives them permissions,

Current Code:
```Shrug.on(messageReactionAdd, (messageReaction, user) => {

    console.log(messageReaction);

    const msguser = messageReaction.users.forEach(user.id);
    msguser.setPermissions({
        SEND_MESSAGES: true,
        READ_MESSAGES: true
    }).catch(console.error);
})```
#

but that doesn't work

restive silo
#

because you can use .setPermissions on a member and you would normally just create a role what is assigned on a GuildMember

earnest phoenix
#

i have a idea sec

uncut slate
#

@earnest phoenix use a database

#

@earnest phoenix user.id isn't a function, passing it into .forEach isn't right

earnest phoenix
#

well fuck

#

ok

#

like wat thou @uncut slate

#

I am blank

#

MySQL?? idk how to use it. . .
rethinkdb i also idk how to use it

uncut slate
#

like whatever you want, Google around the subject and pick something you like.

#

yeah lmao, you're not just going to know how to use a database when you wake up

#

you'll have to learn

#

I wouldn't suggest MySQL personally though

languid dragon
#

rethinkdb is good for learners
mongodb

uncut slate
#

mmmmm

earnest phoenix
#

ok i will google rethinkdb

slim heart
#

oof

#

I was told to use .json files for my censor bot, the file contained all the banned words....

#

but when i did it with the json file it deleted EVERYTHING instead of just the words...

hushed oyster
#

hmm

trim plinth
#

how did you format the json

hushed oyster
#

you might want to delete that

slim heart
trim plinth
#

eh probably better to use an array of blacklisted words?

#

inside the json

slim heart
#

idk how to do that, u crazy

#

wdym

trim plinth
#

do you know how to make a javascript array

slim heart
#

not really.... ๐Ÿ˜ฎ

trim plinth
deep parrot
slim heart
#

i was told that the way i have it now would work tho ๐Ÿ˜ฎ

deep parrot
#

Discord has spelling control now ?!?

trim plinth
#

why does everyone I talk to about arrays end up not knowing what they are..

#

@deep parrot you can turn it off

deep parrot
#

But where tho

trim plinth
#

right click your mispelled word

#

and uncheck spellcheck

slim heart
#

so... how do i do this "array" if the mod who told me to do it how i have it now is wrong

#

wait... i think i messed it up actually

#

nope

#

i did it right

#

it just, doesnt work

#

@trim plinth do you have any suggestion on js array tutorials

#

oh nvm

#

i do know what a js array is xd

slim heart
#

new RegExp(pattern[, gi])

#

what would i have to put in pattern

uncut slate
#

try putting something in it, see the output

slim heart
#

alright

#

i see now i put my regex expression in there

#

alright i got the whole new RegExp(str)...

#

but now, where do i actually put it

glossy sand
#

what are you trying to accomplish anyways

slim heart
#

cause it not working in json file

#

im tryna organize my stuff better

#

I have a censor bot

#

and i want a variable that has all of the words

glossy sand
#

why use a regular expression then

#

if you're just matching against a huge word list, regex is inefficient

slim heart
#

idk any other ways :/

earnest phoenix
#

use. . . something like
exports.list

glossy sand
#

google "fuzzy string search" or something along those lines

slim heart
#

the regex doesnt actually work with a variable in another json file

glossy sand
#

and i would store your word list as an array of words

#

since that's kind of what arrays are for

#

storing... multiple of something

earnest phoenix
#

wait. . . so u are trying to make a bot. . . dat deletes bad words?

slim heart
#

idk how to set that up with refex tho

#

yes speak english pls

#

and it works fine

glossy sand
#

you could just not use regex lol

slim heart
#

but i wanna organize it better

glossy sand
#

what if i say something like "fvck you!"

slim heart
#

then i could add that too the wordlist i guess...

#

it's not really effective

#

but idc really

glossy sand
#

oookay

earnest phoenix
#

my anti-swear systems does this. . .
exports an array of bad words
goes thru the sentence and finds bad words like
fuck. . . because i go thru the sentence not per-word it can detect stuff like fucku
soooooo goooglle for lyfe

glossy sand
#

well if you really insist on doing this regex thing

slim heart
earnest phoenix
#

u could just do it with pure js. . .

slim heart
#

thats what i am doing rn

glossy sand
#

you should store the patterns as strings and deserialize them to regexes when you load the config

slim heart
#

but i have to edit every single part when i find a new word

earnest phoenix
#

wat u mean find a new word?

slim heart
#

like "fvck" for example

earnest phoenix
#

u cant rlly do anything

#

even dyno cant detect f*ck

slim heart
#

yes i can...

#

i just add it to the list...

glossy sand
#

there are an effectively infinite number of variations though

slim heart
#

But the problem is that i have 3 seperate parts. 1: normal message censor 2: edited message censor 3: guildmember nickname censor

glossy sand
#

well if you're having so much fun with regex why not use one pattern for all three subsystems

slim heart
#

that's what i want to do

#

so i can edit a single bit, and it works for all three

earnest phoenix
#

well. . . there is legit infite ways to say fuck. . . like uck fck fuck fuc fuc

slim heart
#

i understand that, but it's just to stop the common person i guess

earnest phoenix
#

anti-swears cant be perfect

slim heart
#

if you bypass you're just muted

#

simple

#

it's just to keep it generally mostly clean

gusty topaz
#

fucAAc

slim heart
#

also, im not talking about bypassing here

gusty topaz
#

bypass done

earnest phoenix
#

memes

slim heart
#

im talking about what ํŒฌํƒ€ with having three different regex's off of one pattern

#

which i dont know how to do, which is why i came here

glossy sand
#

why in the world do you need three regex objects

#

make one and reference it in all your different subsystems

slim heart
#

I'm asking how i make it only 1

#

that's what im asking how to do

glossy sand
#

you do it by... not making three?

earnest phoenix
#

xD

glossy sand
#

i don't honestly know how to make this more clear

earnest phoenix
#

same

slim heart
#

I can't just "not make it three"

#

or else only 1 part would work

#

how would i make a variable or something, that i can just put in each of the regex lines, and it all has the same words

#

...

earnest phoenix
#
  1. ur code isnt efficient because it gets only 1 type of channel. . . u should use .find u find a channel not send it to a channel with a id
  2. check ur dm
slim heart
#

wtf r u on about?

#

I'm not talking about channels

earnest phoenix
#

ik but it isnt efficient to do this bot.channels.get("399688995283533824")

slim heart
#

talk all the shit u want about my logchannel, idgaf

#

that's not what im here to get help with

uncut slate
#

calm

earnest phoenix
#

it is advice

uncut slate
#

He's just trying to help you

glossy sand
#

ok let's think about it like this

#

what you have right now is something like

const words = /* something */;

function subsystemOne() {
    const regex = new Regex(words);
    // do other stuff
}

function subsystemTwo() {
    const regex = new Regex(words);
    // do other stuff
}

function subsystemThree() {
    const regex = new Regex(words);
    // do other stuff
}
#

what you need to do is extract that regex variable to a higher scope so all three subsystems can reference it simultaneously, right?

frail kestrel
#

w0t we do

glossy sand
#

so why not do something like

const words = /* something */;
const regex = new Regex(words);

function subsystemOne() {
    // do stuff with regex
}

function subsystemTwo() {
    // do stuff with regex
}

// ...
frail kestrel
#

can I halp too

earnest phoenix
#

ooh. . . i know wat he means by make it more neat. . he is doin

if (message.content === "fuc") { //stuff}```
slim heart
#

thats not true

frail kestrel
#

what isnโ€™t true

earnest phoenix
#

and message.content.match

slim heart
#

L39

glossy sand
#

wait no wtf

frail kestrel
#

o k

#

Btw hi phanta

glossy sand
#

you're doing require('./words.json') but you don't do anything with it?

#

hi stay out of this channel if you're not helping and don't need help

slim heart
#

ive been trying to do that

#

but it's not been working

#

just ignore that

#

it's not in my actual code

earnest phoenix
#

๐Ÿค”

#

i actualy hv a bot for pure anti-swear

slim heart
#

like i tried to use the words.json (words.words) in the regex line

earnest phoenix
#

but NO SPOON FEEDING

slim heart
#

but it doesnt like it

earnest phoenix
#

i even hv a github repo for it :/

slim heart
#

I dont wanna be spoonfed

earnest phoenix
#

i know. . .

glossy sand
#

that's probably because you don't have a field called "words" in your words.json

slim heart
#

if i wanted to just make a discord bot i would've done it already in java

#

i mean words.bannedwords

glossy sand
#

well you've surrounded your pattern with /.../gi

#

that's only regex literal syntax, right

#

not part of the pattern?

slim heart
#

shit

earnest phoenix
#

Phanta can u check ur dm?

slim heart
#

welp

earnest phoenix
#

and tell me wat u think

glossy sand
#

i'm busy

earnest phoenix
#

๐Ÿ˜ฆ mkay

uncut slate
#

๐Ÿ‘€

slim heart
#

wait can i add /words.bannedwords/ in the regex

glossy sand
#

i'm in class right now actually but I feel like I'm committed to helping this guy with his thing

slim heart
#

or will it just scan for "words.bannedwords"

glossy sand
#

no no no jesus christ

earnest phoenix
#

oh ok

glossy sand
#

ok so when you go /something/gi

uncut slate
#

you can but you really shouldn't

glossy sand
#

it creates a regular expression with the pattern something and the flags gi, right?

slim heart
#

ye

earnest phoenix
#

are u telling me dat u want a file for the bad words?

glossy sand
#

this is a regex literal

#

it's identical to going new Regexp('something', 'gi')

#

where the first parameter is the pattern and the second is the flags

slim heart
#

which is what i did before

glossy sand
#

but that wouldn't work because your something is of the form /abcdef/gi

#

so it's matching for a string delimited by slashes with gi on the end

slim heart
#

i guess ye

glossy sand
#

which is obviously not what you want, right?

slim heart
#

ye

glossy sand
#

so the logical conclusion is...?

slim heart
#

not to do that? idk, what you're really trying to get me to understand

glossy sand
#

do you understand what a literal is

slim heart
#

yes

glossy sand
#

explain

slim heart
#

an exact value?

glossy sand
#

what in the world is that supposed to mean

slim heart
#

like, exactly what it is

#

like, taking something litterally

#

i get that...

glossy sand
#

I contend that you have no idea whatsoever what a literal is

inner jewel
#

a = 1

#

1 is a literal

#

a = "b"

#

"b" is a literal

#

and etc

slim heart
#

b is litterally a

#

?

inner jewel
#

no

slim heart
#

ok

#

so just what something equals in this situation

#

?

uncut slate
#

I recommend you start relearning JS (possibly another language that fits you better) from the base

#

you seem to have issues understing core concepts

slim heart
#

@uncut slate Nvm, i figured out how to do it, one problem is how do i add my flags to the regex statement... if (message.content.match(bannedwords)) {

#

i need flags gi

#

but idk where I'm supposed to put them ๐Ÿ˜ฎ

uncut slate
#

how are you defining bannedwords

slim heart
#

const

uncut slate
#

that's just a string

slim heart
#

and?

#

it works fine

#

i just cant add flags

#

so i cant say fuck, but i can say Fuck

earnest phoenix
#

how do i embed? :(

carmine berry
#

what lang

earnest phoenix
#

jus

carmine berry
#

jus?

earnest phoenix
#

jay ess

quiet bobcat
#

lib?

earnest phoenix
#

js

quiet bobcat
#

d.js or eris?

carmine berry
#

d.io

quiet bobcat
#

@earnest phoenix

earnest phoenix
#

is on msg and the other message? @quiet bobcat

quiet bobcat
#

?

earnest phoenix
#

idk

quiet bobcat
#

What library

earnest phoenix
#

js

quiet bobcat
#

That's not a lib

#

that's a lang

earnest phoenix
#

discord.js

quiet bobcat
#

Ok

carmine berry
#

you can do channel.send({embed:{/* embed obj here*/}})

quiet bobcat
#

Or just look at this tutorial

#

https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/examples/using-embeds-in-messages.html

carmine berry
#

or that :/

quiet bobcat
#

for the objects aswell

earnest phoenix
#

if i put that in my bot it wont work

#

@quiet bobcat

quiet bobcat
#

code?

earnest phoenix
#

no like if i use that

#

it will do nothing

quiet bobcat
#

How are you sure?

#

Getting any errors?

carmine berry
#

you have to replace channel with your channel obj so like message.channel or something like that then you have to add your embed fields. or you can use the djs rich embed builder thing

earnest phoenix
#

i did it before

quiet bobcat
#

reopen

#

that has nothing to do with the code

#

๐Ÿ‘€

earnest phoenix
carmine berry
#

it will

quiet bobcat
#

just try it

#

You forgot the 0x before you hex btw

carmine berry
#

thats not hex

quiet bobcat
#

isn't it?

carmine berry
#

rgb int

quiet bobcat
#

ah

#

mb