#development

1 messages Β· Page 323 of 1

young cradle
#

Just check like a boolean

jagged plume
#

check args length first

young cradle
#

if(fsubject) {}

#

for example

#

If there's no args[2] it won't trigger thst

#

that*

earnest phoenix
#

What about the second one

#

the second set of ifs

young cradle
#

so just do !variable

#

then you use length

#

As you'll be sure those arguments exist

#

As you checked before

earnest phoenix
#

But it goes undefined

#

As I said before

young cradle
#

And as i said before check like a boolean

#

if(!variable) { //warn user}

#

Basic js friend

earnest phoenix
#
if (fmessage >= 1000)
young cradle
#

facepalms

tawny lava
#

.length

young cradle
#

I told you exactly what to do, if you still don't understand

earnest phoenix
#

Ok I won't bother.

young cradle
#

Man, go learn more in depth about programming in general

jagged plume
#

lmao

#

don't you have another "developer"

#

get them to do it

#

((no longer assuming gender and said them instead of him can i get a clap))

earnest phoenix
#

I'm not just going to get something I can figure out my own. Now I rather just not ask for help no more. People seem to get extremely triggered. So I might aswell just not try

jagged plume
#

no ur not listening

#

listen to what we are saying

languid dragon
#

i give genuine replies when i can

#

you could always directly @ me

young cradle
#

I don't see anyone triggered

#

Just people not wanting to lose their time explaining the basics

languid dragon
#

i dont mine explaining basics πŸ‘€

#

mind*

earnest phoenix
#

I didn't even use the internet to learn Javascript. I just did it and figured it out as I went. So I rather not speak here no more. Thanks πŸ™‚

young cradle
#

np

languid dragon
#

ok have fun

karmic parcel
#

what, Duck

#

what

#

just what

jagged plume
#

lol

karmic parcel
#

how tf do you just spontaniously learn JS without looking it up?

tawny lava
#

lol

karmic parcel
#

I wish I was that lucky

#

to just be granted knowledge of things I don't know without using the internet

tawny lava
#

js is for nubs anyways

jagged plume
#

ow

tawny lava
#

swift is where it's at

languid dragon
#

πŸ‘€

#

I learnt most of JS from my webdesign stuff

#

lmfao

earnest phoenix
#

I knew most of it because I know C#. I took what 3 tutorials of how to setup a Discord Bot and a command. That's about it

#

Anyway. I the mailing service working

earnest phoenix
#

Anyone here good with oauth2 discord API?

#

Good job

#

Reset your token

tacit kernel
#

oh shit

earnest phoenix
#

Ez win

#

No worries

#

Lol I had it open when he deleted it and I got a screenie of it lol

#

Still better to reset it. Better not take the chance

#

@tacit kernel The file is .js not .json

tacit kernel
#

it is a js file

#

not JSON

earnest phoenix
#

Then why is it formatted like a .json then

#

Do you even know the difference between .json and .js?

#

Still

#

In .js you can have json

bitter sundial
#

json is js object notation

uncut slate
#

you can export an object in a .js file and have it function as a .json file somewhat, I guess

#

kind of dumb though

earnest phoenix
#

It's still better to name it.json

uncut slate
#

it'd have to be compiled by the process before being read

#

yeah, it is

woven drum
#

json is mainly for data

#

js is for code

tacit kernel
#

bro u know i have been dealing with douchebags all day yesterday pls dont make a beef u aswell

uncut slate
#

hahahahah

#

have fun beefing, but keep it to DMs

woven drum
#

beef me in dms plz

earnest phoenix
#

I was asking a question?

woven drum
#

what was it?

earnest phoenix
#

Look above thonk πŸ˜›

tacit kernel
#

i didnt seem like it

earnest phoenix
#

Not liking a question. Doesn't make me a Douchebag

woven drum
#

cant find it

earnest phoenix
#

Welp

#

It wasn't that far up

tacit kernel
#

why do u want too find it so bad

earnest phoenix
#

Duck is a goose sometimes

tacit kernel
#

bro i was asking why i get a error when i added : but instead u guys asking me the questions

earnest phoenix
#

I'm a goose. thonk

#

So post it again without the token please

#

I was giving you the answer. Make it .json then you replied it's .js in fact the format is better in .json

woven drum
#

@tacit kernel show me code and error

tacit kernel
#

hold on just need to remove token

earnest phoenix
#

No worries

#

Windows 10 Crop ez af. Lol

woven drum
#

lol

tacit kernel
earnest phoenix
#

Because that should be .json like I said before

#

Nope

#

.json is better for Storage

#

.js is better for Code

#

You used a semicolen instead of a comma @tacit kernel

#
{
    "token":"",
    "prefix":"!"
}```
#

It is much better in a json.

#

Look at the config command

#

Nearly half of it is JSON

#

I know. I'm just saying.

#

For small things it is better in JSON. Especially for using a Token

uncut slate
#

you should be using .json files yeah. But if you for some reason want to use a .js file for your config, you need to export the object

#

so

#
module.exports = {
    "token":"",
    "prefix":"!"
}
earnest phoenix
#

@tacit kernel ^^

#

Also why the most common prefix btw

woven drum
#

dont use !

earnest phoenix
#

But make sure to use commas in JSON

woven drum
#

use something creative

#

like c.

earnest phoenix
#

Use !!!!

uncut slate
#

don't ^

earnest phoenix
#

dabBot

#

For some odd reason dabBot wanted to allow you input as many !!! (over 3) and still run help

#

Anyone here good with oauth?

woven drum
#

i do

earnest phoenix
#

We need help

#

He needs help

#

Can you help me quickly?

#

How do I use the access token once I recieve it

#

xD

#

To use in /user/@me

#

Wait what are you doing ACox

#

Things for zero0 XD

#

What sort of things hmm

woven drum
#

@earnest phoenix show me the /user/@me response in dms

uncut slate
#

LUL

tacit kernel
#

node doesnt work in powershell

bitter sundial
#

it does

tacit kernel
#

it dont i just tried

earnest phoenix
#

You're probably something wrong.

uncut slate
#

🀦

tacit kernel
#

i write node bot.js

#

is ps

tawny lava
#

lol

tacit kernel
#

lemme try cmd lmao

earnest phoenix
#

CMD is a good start πŸ˜‰

tawny lava
tacit kernel
#

couldnt find module

earnest phoenix
#

module

tacit kernel
#

yeh

earnest phoenix
#

More info would be nice

tacit kernel
tawny lava
#

install the module then Thonk

#

wait

#

then the file insnt' called app.js

tacit kernel
#

wait not it isnt lmao

earnest phoenix
tawny lava
#

ofc it's not gonna work then wtf

#

maybe try it with the files name?

tacit kernel
#

HAHAHAHAHAHAHAHAHA

uncut slate
#

he's got a space

earnest phoenix
tacit kernel
#

still same error couldnt fine module

earnest phoenix
#

is the package.json correct

uncut slate
#

shouldn't matter

earnest phoenix
#

You never know

uncut slate
#

well

tacit kernel
uncut slate
#

it shouldn't matter

tawny lava
#

omfg

tacit kernel
#

tf is wrong now

earnest phoenix
#

node bot.js?

tawny lava
#

^^^^^^^^^^^^^^^^^^^^^^^^^^

earnest phoenix
tacit kernel
#

tried

#

it

uncut slate
#

show a screenshot

earnest phoenix
#

Soo many thinking emojis

tacit kernel
#

i must been installing node wrong or something

uncut slate
#

no

#

your code is wrong

tawny lava
#

what even is ur main file

tacit kernel
#

fuck this shit

#

i am done

uncut slate
#

sure

tacit kernel
#

lmao who u talking too

uncut slate
#

Hm?

tacit kernel
#

Hm?

#

u guys were very helpful (not)

tawny lava
#

lol

#

inb4 he didn't even put a token there and just wrote "token"

uncut slate
#

@PC_WildWolf#0595 it's very likely just a PEBCAK, and there's nothing we can do about it. We can't know where you fucked up.

#

eh, left

tawny lava
#

rekt

toxic forum
#

Another person who thinks it's easy and not time consuming to code. And then expects us coders to babysit him through the entire projectπŸ˜…

vital lark
#

^

spiral frigate
#

my discord bot restarts alot (which sometimes make it so commands wont work, or lag, when its restarting) due to 1006 websocket closing. anyway you guys know to help fix that?

vital lark
#

its Discord API shitting

earnest phoenix
#

He clearing didn't even setup the

require(`./botsettings.js`).token;
eager vigil
earnest phoenix
#

What

spiral frigate
#

any way to make it shit less? its happening a lot, and i doubt most bots have to deal with that much shitting

elder rapids
#

Trust me

#

Every bot deals with it

#

Even mine does

#

Mine disconnects from the remote party VERY OFTEN

#

I bet you $10 if I look at my logs I will see a reconnect right in from of me

#

or maybe scroll up a bit and see you

spiral frigate
#

ok. well its doing it more often than before... its gotten to the point where sometimes people think my bot is down when really its just restarting and so it missed their command

earnest phoenix
jagged plume
#

kek

#

why guild and author on the embed for everything

earnest phoenix
#

For Errors. If it errors it dms straight to my guild. It was shorter to do it like that

jagged plume
#

how do embed fields on a command response help with error logging

earnest phoenix
#

Β―_(ツ)_/Β―

#

Could I just help lol. I'm not here for that

jagged plume
#

wut

earnest phoenix
#

What's the use then.

jagged plume
#

for what

#

im so confused

earnest phoenix
#

You just started complaining and never actually helped. Who cares how I do my embed. It's not yours

jagged plume
#

i wasnt complaining? And what were you even asking for help with

earnest phoenix
#
why guild and author on the embed for everything

Completely unrelated to my question. I class that as complaining

#
if(duck.sleep){leave(peasant)} - Today at 5:08 PM
Best way to list roles :joy:
jagged plume
#

how is that a question

earnest phoenix
jagged plume
#

"unrelated to my question" how is what you said a question, it's a statement

#

thonk im just gonna stop

earnest phoenix
#

I was asking what the best way to list roles was. The way I had it in the picture was just. role, role,. It looked confusing

jagged plume
#

you just said "best way to list roles" with an emoji and no question mark so i assumed you were just posting an image

#

lol

earnest phoenix
#

k

neon pasture
#

How can I make my prefix non case sensitive?

earnest phoenix
#

.toLowerCase()

neon pasture
#

var prefixCaps = message.content.toLowerCase(prefix);
if (!message.content.startsWith(prefixCaps)) return;

#

What wrong with this?

jagged plume
#

you don't give toLowerCase arguments

#

it's just .toLowerCase()

neon pasture
#

yeah, isn't that good then?

jagged plume
#

what

uncut slate
#

.toLowerCase(prefix)

#

is what you have

neon pasture
#

yeah

jagged plume
#

just put .toLowerCase(), not .toLowerCase(prefix)

uncut slate
#

yes

neon pasture
#

Okay

uncut slate
#

and then make it

#

actually just start over

#
if (!message.content.toLowerCase().startsWith(prefix)) {
    return;
}
earnest phoenix
#
if (message.content.startsWith(stuff) {}```
uncut slate
#

no

earnest phoenix
#

oh yea

#

Forgot that part

jagged plume
#

lol

uncut slate
#

and you didn't even close your parens

earnest phoenix
#

It was an example.

neon pasture
#

But it returns

uncut slate
#

it would

#

that's what you want

neon pasture
#

It's working, thank you

uncut slate
#

np

earnest phoenix
#
if (!message.content.toLowerCase().startsWith(prefix)) {
    return;
}
if (!message.content.toLowerCase().startsWith(prefix)) return;

Would be a shorter way.

uncut slate
#

always using curlies is a good practice

#

single line if clauses are nasty in my opinion

jagged plume
#

i like them

uncut slate
#

mhm

#

up to the owner though

#

this channel isn't for arguing about code style

earnest phoenix
#

It doesn't cause much anyway. Both ways work just as effectively

uncut slate
#

it's code style

#

if someone wants to add something to that clause, they need to add curlies

earnest phoenix
uncut slate
#

it's a common and in my eyes good practice to always use curlies

#

either way

#

like I said

white dome
#

Quick question, how does the bot list detect if a bot is online/offline

umbral pelican
#

luca sees all

white dome
#

.>

#

I ask because my bot shows as offline on the botlist, but it's online

#

So I'm wondering if there's anything specific I need to do to fix that

umbral pelican
#

oh, luca's a bit borked afaik

vital lark
#

Thonkang js 8|Yumi-Web | Error: listen EADDRINUSE :::80 8|Yumi-Web | at Object._errnoException (util.js:1041:11) 8|Yumi-Web | at _exceptionWithHostPort (util.js:1064:20) 8|Yumi-Web | at Server.setupListenHandle [as _listen2] (net.js:1322:14) 8|Yumi-Web | at listenInCluster (net.js:1370:12) 8|Yumi-Web | at Server.listen (net.js:1466:7) 8|Yumi-Web | at Function.listen (/var/www/yumibot.party/node_modules/express/lib/application.js:618:24) 8|Yumi-Web | at Object.<anonymous> (/var/www/yumibot.party/index.js:20:5) 8|Yumi-Web | at Module._compile (module.js:573:30) 8|Yumi-Web | at Object.Module._extensions..js (module.js:584:10) 8|Yumi-Web | at Module.load (module.js:507:32)

#

@karmic parcel halp

karmic parcel
#

seems like you have something else running on port 80

vital lark
#

:o

karmic parcel
#

so it cant do nuffin

vital lark
#

rip

#

owo

earnest phoenix
#
var myarr = ["arg1", "arg2"]

var content = myarr.map(args => `${args}, `)

How would I map it correctly?

vital lark
#

that is blegh

#
var array = new Array();```
boreal ore
#

how tf would i code a custom prefix system in c#, always been confused about that

earnest phoenix
vital lark
#
var array = new Array(['hi', 'hi2']);
#

@boreal ore You need a Database

#

Β―_(ツ)_/Β―

boreal ore
#

cant it just use folders and json files?

earnest phoenix
#

πŸ‘

vital lark
#

@boreal ore JSON db?

#

it will corrupt

earnest phoenix
#

SQLite3?

vital lark
#

If you dont wanna to corrupt, use a Database like Rethonk, MariaDB, PostgreSQL, etc

#

SQLite is for JS and Python

#

I think

earnest phoenix
#

I use SQLite for my custom prefixes

#

Discord.js but yea

umbral pelican
#

them var's are making my cringe glands flare up francis

#
var array = new Array(['arg1', 'arg2']);

and

var array = ["arg1", "arg2"];

do exactly the same thing :|

inner jewel
#

arg1 == hi and arg2 == hi2 confirmed

umbral pelican
#

lol behave

bitter sundial
#

what are you trying to do

vital lark
#

who the fuck knows

earnest phoenix
#

Don't worry. I figured out my problem. I'm making a Game.

#

Is all

vital lark
#

How do I make a person has a permission?

#

Discord.js

earnest phoenix
#

Olace

#

What is ur bot coded in

#
return;```
#

@vital lark

vital lark
#
if (msg.author.id != 'id') return;
earnest phoenix
#

Yea

radiant plover
#

nitpick best to just always use !== and ===

uncut slate
#

@earnest phoenix join

earnest phoenix
#

Join?

#

@uncut slate

uncut slate
#

mhm

earnest phoenix
#

Join what? I don't remember asking anything?

#

@uncut slate

tawny lava
#

He meant the array in guessing

uncut slate
earnest phoenix
#

Yea I got it

#

Yesterday.

#

I found out why what the guy told wasn't working

uncut slate
#

making a new array instance wouldn't have fixed your problem

#

that was just the guy being fussy

earnest phoenix
#

I know

#

Thanks for replying though πŸ™‚

earnest phoenix
#
//content is "15 x 2 + 13"
if (message.content.toLowerCase().split("x").join("*") == 43)

How would I do this correctly? Adding stuff together?

languid dragon
#

its already joined

#

if you had it as an array it would just be .join(" "); note the space and not *

#

also for that you would need to parse everything as a integer

#

and honestly

#

just do eval();

karmic parcel
#

oh, you're trying to actually do the math?

#

rip

languid dragon
#

but that brings about a lot of security problems πŸ‘€

earnest phoenix
#

It's for something I'm working on. It has to = 43.

karmic parcel
#

Array.join is going to just concat the strings together

earnest phoenix
#

hi

languid dragon
#

well what you wanna do is test whether or not the arguments are numbers

#

if they are numbers simple parseInt(string) to convert it to a number

#

you would then need to decided what the other parameters are x / + -

#

with that you would have an if statement determining which one is being displayed and then apply that to the parsed strings

earnest phoenix
#

πŸ†—

languid dragon
#
if(args[0] == /([0-0])/g){
  args[0] = parseInt(args[0]);
}
if(args[1] == "x"){
  return args[0] * args[2];
}
#

something along the lines of that untested

earnest phoenix
#

Alright, I'll try it somewhat like that

languid dragon
#

the alternative is

eval(args.join(" "));

which will skip all that and give you the answer
(of course you would need to replace x with *)

#

of course you could imagine why that's a bad idea πŸ‘€

jagged plume
#

and be serverly insecure

#

basically giving open eval

karmic parcel
#

there is probably a math module or something that would handle that stuff

jagged plume
#

there is

#

cant remember its name

earnest phoenix
#
Math.abs()```
languid dragon
#
#

eyo

jagged plume
#

abs for what

languid dragon
#

my abs

jagged plume
#

your abstract

languid dragon
#

i am very

jagged plume
#

how is that useful

earnest phoenix
#

I just saw it Β―_(ツ)_/Β―

#

Can someone answer something?

languid dragon
#

yes

earnest phoenix
#

YES! Thanks that mathjs module helps

languid dragon
#

thats good

earnest phoenix
languid dragon
#

noice

earnest phoenix
#

For a game I'm working on. This thing has been the most pain in the ass to me

languid dragon
#

lmfao

earnest phoenix
#

Including having to actually work the equation before hand

jagged plume
#

kek

earnest phoenix
#

Could someone tell me the best way of finding out if someone used something that isn't allowed
Example

let equation = ["15", "15", "+"]
//if author used something not in "equation"
languid dragon
#

yes

#
if(!message.content.includes(equation[0]) || !message.content.includes(equation[1] || etc){
    message.reply("Sorry thats an invalid blah blah blah");
}
jagged plume
#

not the best way

languid dragon
#

basically if it doesn't have anything that's in the array, it returns with message.reply

#

never said its the best, but it works πŸ‘€

jagged plume
#

kek

earnest phoenix
#
if(!message.content.toLowerCase().includes(["15", "13", "2", "+", "x"])) return message.channel.send('test')

This works on it's own lol

languid dragon
#

noice

#

even better

earnest phoenix
#

πŸ˜‰

#

@languid dragon Thanks for the idea though πŸ™‚

languid dragon
#

no problemo my dude, ping me anytime if you needa hand

earnest phoenix
#

πŸ‘

earnest phoenix
#
var buttons = ["15", "13", "2", "+", "x"].join(", ")
//stuff
if(!message.content.toLowerCase().includes(buttons.split(", "))) return message.channel.send(`${message.author}, Invalid Button Used!`)

Doesn't seem to work

jagged plume
#

y u joining and splitting

earnest phoenix
#

It was for listing

languid dragon
#

i think because you need to do buttons.toString().join(", ");

earnest phoenix
#

Ok

jagged plume
#

no?

languid dragon
#

toString() turns it into "15, 13, 2, +, x" does it not?

jagged plume
#

buttons.toString() will make "["15", "13", "2", "+", "x"]", then you are trying to run join on a string

#

Just put the array in includes

languid dragon
#

right

jagged plume
#

no need for the splitting and joining

languid dragon
#

i thought the thing you did before already worked @earnest phoenix

earnest phoenix
#

I did try that before. It didn't do anything

prime cliff
#

Tonkku.ToString()

earnest phoenix
#

@languid dragon So I didn't have to copy it over and over

jagged plume
#

[object Tonkku]

earnest phoenix
#

I did try not putting .join() and doing what you said. It still refused to work. I'll just do what I did before that worked

languid dragon
#

yeah Thonk

earnest phoenix
#

Just more time consuming

#
if(!message.content.toLowerCase().includes(["15", "13", "2", "+", "x", "cancel"])) return message.channel.send(`${message.author}, Invalid Button Used!`)

Not working either

uncut slate
#

@earnest phoenix array.includes(msg.content)

earnest phoenix
#

Ok I'll give it a try in a second

#

Array.includes is not a function RIP
What I before was working. It just suddenly stopped

languid dragon
#

buttons.includes πŸ‘€ ?

earnest phoenix
#

I'm not using the var?

languid dragon
#

ok but put the array in the var and call buttons.includes(message.content) like aeth said

#

i assume thats what aeth actually meant by array.includes

earnest phoenix
#

πŸ†— RIP

uncut slate
#

@earnest phoenix show the code you tested

earnest phoenix
#

I just updated it now.

#
if(!["15", "13", "2", "+", "x", "cancel"].includes(message.content.toLowerCase())) return message.channel.send(`${message.author}, Invalid Button Used!`)

Just tested this. Error: Undefined symbol cancel

uncut slate
#

that's not vanilla js I'm pretty sure

vital lark
#
   client
      .on('message', message => process.exit(0));
tawny lava
#

same

uncut slate
#

??

tawny lava
#

why u steal my memes and dreams

uncut slate
vital lark
languid dragon
#

it worked ok for me

earnest phoenix
#
if(!message.content.toLowerCase().includes(["15", "13", "2", "+", "x", "cancel"])) return message.channel.send(`${message.author}, Invalid Button Used!`)

I flipped it around and it return

uncut slate
#

that's not how includes works

earnest phoenix
#

I know but the other way it doesn't "cancel". How would I get that to work?

languid dragon
#

i made it work

earnest phoenix
#

How so?

languid dragon
#
  var buttons = ["15", "13", "2", "+", "x", "cancel"];
  if(!buttons.includes(args.join(" ").toLowerCase()))
  {
    message.channel.send(`${message.author}, Invalid Button Used!`);
  }
uncut slate
#

@earnest phoenix I'm pretty sure something is wrong in your other code

#

that error saying cancel isn't a valid symbol isn't vanillajs

earnest phoenix
languid dragon
#

well that defo works i tested it with my devbot

#

i passed through args which is everything besides //t

#

and of course i join(" ") to make it a single string

earnest phoenix
#

join(" ") not a function.

languid dragon
#

where exactly did you use join(" ")

#

πŸ‘€

tawny lava
#

that means you used join on somethinghtat's not an array

uncut slate
#

@earnest phoenix you don't need to use @languid dragon's code, it does the same thing as what you have and it was an example

earnest phoenix
#

I added .split(" ") infront of it and I'm back to cancel not being a symbol. I don't understand that.

uncut slate
#

It's

#

not

#

vanilla

#

js

languid dragon
#

heck

uncut slate
#

it's your other code, a library that parses it, something we can't help you with

earnest phoenix
#

thonk well I'm back to square one. First time using it with it doing that

languid dragon
#

i must say though, thankyou aeth for that array.includes()
im just sitting here thinking of the many things i could do with that, had no idea i could before if im honest lmfao

uncut slate
#

np

#

@earnest phoenix show the full context

languid dragon
#

that would be agood idea ^

earnest phoenix
#

It's messy but it's just a test

        if (level == 0) {
            game.on('collect', message => {
                if(!["15", "13", "2", "+", "x", "cancel"].includes(message.content.toLowerCase().split(" ").join(" "))) return message.channel.send(`${message.author}, Invalid Button Used!`)
                if (math.eval(message.content.toLowerCase().split("x").join("*")) == 43) {
                    message.channel.send(`${message.author}, Correct!`)
                    //this.client.provider.set("313592723800195073", message.author.id + "calcGame", level + 1)
                    game.stop()
                } else if (message.content.toLowerCase() === "cancel") {
                    message.channel.send(`${message.author}, Game Cancelled`)
                    game.stop()
                } else if (message.content.split(" ").join("").length >= 8) {
                    message.channel.send(`${message.author}, Too many moves! **Format** \`[button1] [button2] [button3]\`etc\nMax: \`7\`\nYour Moves: ${message.content.split(" ").join("").length}`)
                } else {
                    message.channel.send(`${message.author}, Incorrect! **Format** \`[button1] [button2] [button3]\`etc`)
                }
            });  
languid dragon
#

i feel like its way more complicated than it should be

earnest phoenix
#

I'm am going work on making it smaller when I actually get it working

uncut slate
#

so you're using a library to parse math

earnest phoenix
#

And I'm guessing it fucks it

uncut slate
#

that library can't accept cancel as math

#

yes

languid dragon
#

.split(" ").join(" ") Thonk

earnest phoenix
#

join not a function

#

same with your code

uncut slate
#

🀦

#

@earnest phoenix you need to parse cancel yourself

languid dragon
#

im gonna edit this code, brb

#

do you use args?

#

like

#

const args = message.content.slice(_prefix.length).trim().split(/ +/g);

uncut slate
#

why use a regex for .split

earnest phoenix
#

Nope. That's why I removed args when I did it

languid dragon
#

idk i found the code like that lmfao

#

haven't changed it cos it works

uncut slate
#

that's horrible

languid dragon
#

πŸ‘€ how to fix b0ss

earnest phoenix
#

Well if I got rid of mathjs would there be an alternative to what I'm doing. In there

languid dragon
#

if(!["15", "13", "2", "+", "x", "cancel"].includes(message.content.toLowerCase())) return message.channel.send(`${message.author}, Invalid Button Used!`)

#

i feel like that would work untested

#

also ending everything with ; would probably be a good practice

uncut slate
#

@earnest phoenix if you're only doing additions and multiplications/divisions why do you need a math library

#

just parse the input yourself

earnest phoenix
#

I was referred to it

languid dragon
#

hes making a kinda interactive game where you reply to a messagecollector and i suggested the library to avoid using eval()

uncut slate
#

why use eval at all lol

languid dragon
#

thats why i suggested the math lib πŸ‘€

uncut slate
#

you don't need it

#

at all

earnest phoenix
#
if(!["15", "13", "2", "+", "x"].includes(message.content.toLowerCase())) {

It continues to return

languid dragon
#

the math lib atm isn't even the problem lmfao

uncut slate
#

it is

earnest phoenix
#

Not anymore

languid dragon
#

nono because hes getting the error from the .includes()

vital lark
#
let myArray = ["15", "13", "2", "+", "x"];

if (myArray.includes(message.content.toLowerCase()) {
languid dragon
#

im outta ideas tho so im gonna fuq off πŸ‘€

#

missing a bracket on the end of ))

earnest phoenix
#

I tried that. Didn't work

#

It's confusing me too lol and I'm the one dealing with it

if(!["15", "13", "2", "+", "x", "cancel"].includes(message.content.toLowerCase())) return message.channel.send(`${message.author}, Invalid Button Used!`);

Not working

languid dragon
#

.replace("x","*"); πŸ‘€

frozen ruin
#

my bot says it's offline on the website but it's online when i look at it on discord and it responds to commands.

#

what do?

bitter sundial
#

is your bot in this server?

frozen ruin
#

no

#

wait

#

yes

#

'Rubik'

earnest phoenix
#
if(!["15", "13", "2", "+", "x", "cancel"].includes(message.content.toLowerCase())) return message.channel.send(`${message.author}, Invalid Button Used!`);

Doesn't Work. Only works if you input part of the array

languid dragon
#

try google πŸ‘€

uncut slate
#

@earnest phoenix yes, that's how includes works. It'll look for if message.content.toLowerCase() includes any of the array items.

earnest phoenix
#

How would I do it the way I want it?

uncut slate
#

well, how do you want it

earnest phoenix
#

So you can use any amount all in the same message. So say I can do 15 x 2 and it not return, it'll continue the rest of the code. etc

uncut slate
#
msg.content.split(' ').some(symbol => !['15', '2', 'x'].includes(symbol))

This will give you a Boolean telling you if something is wrong

#

Better ways to do it though, like a regex

earnest phoenix
#

ok

#

@uncut slate Thanks ❀

#

I got close before. I think I some of the jumbled when I was researched

#

But I did use some

uncut slate
#

yeah that's one way to find out but ideally you want to build a regex

frozen ruin
#

my bot is online now, thanks if someone fixed it

earnest phoenix
#

Who knows

#

😱

#
math.eval(message.content.toLowerCase().replace("x", "*")) == 43

Easy and Simple version of not using mathjs. I was referred to this please don't ask

earnest phoenix
#

How do i add a cooldown to my discord.js bot?

#

I want to do the same

uncut slate
#

use commando or use a Set

earnest phoenix
#

I dont know how to add cooldowns thats the problem!

#

Tell me if you guys figure it out

uncut slate
#
setTimeout(() => {
  cooldowns.delete(message.author.id);
}, 5000);
client.on('message', message => {
  // Level 0 Memes
  setTimeout(() => {
      cooldowns.delete(message.author.id);
  }, 5000);
  if (message.content == ":calm down:") {
    var cooldowns = new Set();
    if (cooldowns.has(message.author.id)) {
      message.channel.send("cooldown");
    }
    else {
      message.channel.send(new Discord.Attachment('./images/calm.png'));
      cooldowns.add(message.author.id);
    }
  }
#

(courtesy of @neon pasture)

topaz fjord
#

// Checks if they have talked recently
if (talkedRecently.has(<Message>.author.id)) {
  /* 
   You can change the nature of the cool down by changing the return to something else. 
   REMINDER: You may need to add an else statement if you do not have any returns in this scope.
  */
  return;
}
// Adds the user to the set so that they can't talk for 2.5 seconds
talkedRecently.add(<Message>.author.id);
setTimeout(() => {
  // Removes the user from the set after 2.5 seconds
  talkedRecently.delete(<Message>.author.id);
}, 2500);````
earnest phoenix
#

Is that discord.js

uncut slate
#

it is

topaz fjord
#

yeh

earnest phoenix
#

I put that in every command?!

#

LOL

uncut slate
#

no

#

just your message event

topaz fjord
#

probably the bot.js

earnest phoenix
#

My commands code are TINY

uncut slate
#

just your message event, bub

earnest phoenix
#

Where is that on notepad++? xD

#

Kinda.... Feels bad man

uncut slate
#

@earnest phoenix if you don't know what a message event is I can't help you

earnest phoenix
#

Can i not just put it anywhere

uncut slate
#

no

earnest phoenix
#

Hmmmm

#

msg.channel.send (``)

#

Thats js

#

I only know Owner only commands

#

I would have to put that as an interceptor or whatever they're called in komada

#
  if (msg.author.id !== '(ID)')
  return;
 msg.channel.send(`Hello!`)
},```
#

Huh

earnest phoenix
#

@earnest phoenix message event is your thing like

bot.on("message", (msg) => {

});
#

I cant see that in the code... im using notepad ++ where would it be??? @earnest phoenix

#

Where ever you put it.

#

Ummmm

#

Cant i just put
bot.on("message", (msg) => {

});
anywhere???

#

Do i put it on the top? @earnest phoenix

#

@earnest phoenix Where do i put the cooldown code then

dense bone
#

Google it

#

People won't spoon feed you code.

earnest phoenix
#

Im just not gonna add it

dense bone
#

Then your bot will not respond to commands

earnest phoenix
#

It does respond cause me bot dont need cooldowns

dense bone
#

...

#

The message event is how the bot recieves messages

earnest phoenix
#

Well i cant find it

dense bone
#

..

earnest phoenix
#

Cause Notepad++ is shit

dense bone
#

Thats not why

#

You're just bad at code and node.js please go take a node.js course

earnest phoenix
#

;/

dense bone
#

what? @full knoll

earnest phoenix
#

Fail

dense bone
#

Sorry, too many people with same name 😦

earnest phoenix
#

lol

cosmic plover
dense bone
#

oWo

earnest phoenix
#

there is legit 2 people @dense bone

#

How is that to many people

dense bone
#

uh no u?

earnest phoenix
#

?

dense bone
#

nvm, it don't matter.

earnest phoenix
#

@earnest phoenix Don't use Notepad++

#

Use Visual Studio Code

#

It's bae <3

karmic parcel
umbral pelican
#

use vim bloblul

frozen ruin
#

Sublime Text πŸ†

winged monolith
#

anybody know how to add cooldowns in node.js

stone kiln
#
setTimeout()```
@winged monolith ?
inner jewel
#

someone asked that above

torn finch
#

just me?

winged monolith
#

oh

#

sorry

#

i honestly didn't know

torn finch
#

yeah

#

it's ok

#

I was just scrolling through the conversations and saw that 😜

earnest phoenix
#

How do i embed in node.js?

uncut slate
#

what do you mean by "embed"

umbral pelican
#

embed in node.js thonkku

earnest phoenix
#

why not

#

look at the docs

zenith ocean
#

client.user.setGame(settings.game); why this not function in my bot ? LOL

earnest phoenix
#

idk

#

make it a thing

topaz fjord
#

@elder rapids

zenith ocean
#

:((((((((((((((((((((((

cinder pecan
#

aye i forget how to do it but what's the way to send a message with your bot to another server?

#

i used to do it before to the d.js but got bored with it

#

working with js btw

restive silo
#

<Client>.channels.get("id").send("whatever you want in here")

#

sure its js lol

#

d.js WaitWhat

#

if you want get the channel from a guild do it with <Client>.guilds.get("some id").channels.get("some id").send("ayy")

#

also you can use find instead get if you search by property's rather than ids

cinder pecan
#

d.js server lol

restive silo
#

w-what

cinder pecan
#

forgot to put server in lol

restive silo
cinder pecan
#

andd hmm

#

would i be able to do it with the name of the channel?

restive silo
#

yea thats a property

#

use .find() for that instead

cinder pecan
#

mmk sent but rip bot doesn't have unban perms lmfao

restive silo
#

you are banned from d.js sever xD

#

wow

cinder pecan
#

no

#

banned from the fake discord bot list server

restive silo
#

oh

edgy steppe
#

I'm not trying to copy you!

#

Jesus

cinder pecan
restive silo
#

what

cinder pecan
#

like really?

#

?????????????????????????????

restive silo
#

wow

cinder pecan
#

HOW IS THAT NOT COPYING

glass lantern
#

O-O

edgy steppe
#

Inspect Element...

cinder pecan
#

YOU COPIED THE NAME OF THE SERVER AND THE ROLES

edgy steppe
#

"Owner"

cinder pecan
edgy steppe
#

I never said "Website Administrator"

cinder pecan
#

ya because you got caught poser

glass lantern
#

OH DANG

cinder pecan
#

you got caught so you changed the name of the role

#

but too bad the name of the server is STILL "Discord Bot List"

edgy steppe
#

You're making yourself look stupid, and you're using inspect element

#

It was always "Discord Bots"

cinder pecan
#

actually no i'm not poser

edgy steppe
#

It was never "Discord Bot List"

cinder pecan
#

explain that Discord Bot List server with 18 members

#

huh

edgy steppe
#

Explain why Discord Bots is right on top.

cinder pecan
#

and tell me how i'm "inspect elementing" so fast

#

these are pure ss's catching you tryna copy the server

jagged plume
#

lmao why

cinder pecan
#

@uncut slate can this poser be gone?

edgy steppe
cinder pecan
#

because i did my servers command idk how long ago

#

it's 3:04 when i sent that last ss

uncut slate
#

wew lads

cinder pecan
#

did my servers command at 2:34

edgy steppe
#

You're trying to get me out of this server when I am not copying

#

Now leave me the fuck alone

cinder pecan
#

gosh you are not smart lol

uncut slate
#

take your shit to DMs guys

edgy steppe
#

I already blocked her

cinder pecan
#

mmk done with this poser anyways aether

#

"HER"

#

LOL

#

aye aether i'm a girl now wanna go out?

uncut slate
#

LUL

cinder pecan
#

oh well poser server is gonna be a fail anyways

#

mmk that was last comment

#

sorry had to aether lol

uncut slate
#

better be, next one's a mute bub

cinder pecan
#

pls papa no i be a good boi from now on

uncut slate
#

good

cinder pecan
#

my mama told me, my momma said be a good boi

#

gawsh i wanna watch water boy now

radiant plover
#

then go watch it

#

you can do iiiiiiiit

umbral pelican
#

[object Pizza]

cinder pecan
#

too lazy to search for a website to watch it online for free though lol

earnest phoenix
#
let arr = jusn[0] jusn[1] jusn[2] jusn[3] jusn[4]

I'm struggling on adding shit together. I'm trying to add these together BUT jusn[1] and jusn[3] are the symbols
15 * 2 + 13

earnest phoenix
#

@earnest phoenix let arr = eval(jusn.join(" "));

#

is this what you are looking for?

#

Isn't eval dangerous. Especially if it's for a game that anyone can use

#

oml true

#

I didn't realize that until now

jagged plume
#

πŸ‘€

earnest phoenix
#

I thought jusn was statically set, not user input

#
let jusn = JSON.parse(JSON.stringify(message.content.toLowerCase().replace("x", "*").split(" ")))

I had do this just get what I had working. Working

jagged plume
#

y are you stringifiying an array

#

then parsing it

#

wait what

earnest phoenix
#

Don't ask me. I was up to 2am yesterday trying to. Doing what I was asking before

#

Β―_(ツ)_/Β―

#

and still haven't gotten answer. So RIP

full knoll
#

@earnest phoenixping

earnest phoenix
full knoll
#

oops sorry

earnest phoenix
#
                let con = message.content.toLowerCase().replace("x", "*").toString()
                message.channel.send(eval(con))

Easy alternative to Eval. lol

jagged plume
#

you are still evaling

earnest phoenix
#

No

#

I running a test

#

Through a command only I can use

#

Of ways I could go around adding shit together

earnest phoenix
#
                for(let i of check) {
                    if(!["15", "13", "2", "+", "*", "cancel"].includes(i)) return message.channel.send(`${message.author}, Invalid Button Used!`);
                }
                if (eval(con) == 43) {

This was the fix FYI

earnest phoenix
#

What would someone recommend for making commands for Music? Like module wise

shrewd field
#

hey I am wondering why do I have to make in this code
"$ {code in here} " (no quotes) and what is the use of the dollar sign??

.setGame(`on ${client.guilds.size} servers`); ```
restive silo
#

${} is indicating a Template literals

earnest phoenix
#

Is the same as doing

.setGame("on " + client.guilds.size + " servers")
shrewd field
#

what is a template literal

earnest phoenix
#

`
That

shrewd field
#

ok

#

thanks

uncut slate
#

mdn, duh

restive silo
#

ikr

uncut slate
#

my bot's fully open sourced, you can take a look for yourself

earnest phoenix
#

S P I C Y

uncut slate
#

no

#

just port 80

#

or whatever you want

#

no

#

just port 80

#

as a number

#

not a string

#

mhm

tawny lava
#

Lol

uncut slate
#

show me your whole file

#

hm?

#

hastebin or pastebin it

#

try declaring promisify before os

#

you can figure that one out yourself

earnest phoenix
#

What is your client defined as?

#

That'll be what goes there

#

It's case sensitive

uncut slate
#

maybe

earnest phoenix
#

yes

uncut slate
#

3000 is in use

#

you might be running two instances of the file

earnest phoenix
#

Meaning. You have 2 command prompts open and they're both running the same file

#

I just assumed

#

Click the X that closes them

#

Or just try other ports

#

Β―_(ツ)_/Β―

#

I guess

uncut slate
#

@earnest phoenix @earnest phoenix closing your PuTTY instance wouldn't have done jack shit if you use a process manager

earnest phoenix
#

Don't ask me. I don't know what's going on here

uncut slate
#

I'm not, I'm correcting you

#

what

#

figure it out by yourself

woven drum
#

dont pinge him

#

he said to go figure it out yourself

uncut slate
#

@earnest phoenix yeah, that's what happens when you copy paste code without changing or adapting it

woven drum
#

πŸ˜‰

#

ill check it

#

show meh the code

#

dont ping me

uncut slate
#

@earnest phoenix of course I know how to fix it

#

but you're never gonna get anywhere if you can't even wipe your own ass

woven drum
#

we will not spoonfeed

tawny lava
#

agreed

woven drum
#

learn to feed yourself

uncut slate
#

point being?

#

correct

#

still doesn't mean we're gonna spoonfeed you every little thing

tawny lava
#

you're not gonna learn properly if people just tell you what to do and you do it without knowing what it means

uncut slate
#

the errors are caused by the coding

woven drum
#

I know probably more than the avarage bot programmer

tawny lava
#

all of the errors you showed were written in plain english lol

woven drum
#
function promisifyAll (obj) {
    const ret = obj;
    for (const key in obj) {
        if (!obj.hasOwnProperty(key)) {
            continue;
        }
        const val = obj[key];
        if (typeof val === 'object' && !Array.isArray(val)) {
            ret[key] = promisifyAll(val);
        }
        if (typeof val !== 'function') {
            continue;
        }
        ret[`${key}Async`] = promisify(osutilsWrapper(val));
    }
    return ret;
}```
#

problem is here i think

#

also why use express for web post/get

uncut slate
#

it's not there

#

lol

woven drum
#

lol

#

the code is shit bad

uncut slate
#

LUL

woven drum
#

lol

#

we are not feeding you learn to feed yourself

#

the way to learn to code good is to learn from your mistakes

earnest phoenix
#

i can feed you but not with help only fooood

woven drum
#

and find the bugs yourself

tawny lava
#

if you look at the error is should display what line the error is at

woven drum
#

its a promise error lizard

earnest phoenix
#
What is an error```
woven drum
#

lol

earnest phoenix
#

xD

woven drum
uncut slate
#

@woven drum you clearly have no idea what's going on

#

it's not relevant to my promisifer

woven drum
#

hmm

uncut slate
#

cannot read property guilds of undefined

woven drum
#

ah

uncut slate
#

yes

#

I use Bot.client, you use Bot

woven drum
#

@earnest phoenix now you know why it does not work next time

#

and you probably will not do that the next time

#

thats how to learn coding

earnest phoenix
#

Learn from your mistakes and to never make those mistakes again

woven drum
#

...

#

ill dm u @earnest phoenix

earnest phoenix
#

Savage

uncut slate
#

@earnest phoenix bruh, it's correct

#

it's not broken

#

it's displaying the amount of free RAM on the server

earnest phoenix
uncut slate
#

what's incorrect about it

#

it might be fucked on windows but I am 100% sure it is correct on my website and on linux

#

Fix what

#

Dude

#

It's not fucking broken

#

It's working perfectly

#

You keep saying it's broken. Tell me what part of it is broken.

inner jewel
#

free memory might be free memory in the process' heap

#

so the value makes sense

uncut slate
#

this guy

#

It's rounded

inner jewel
#

it's not impossible

#

my bot, even with music, uses ~0.1% of cpu while at 15 connections

uncut slate
#

Also, it's perfectly possible for Node to use ~0.0n% CPU, at least it is on my $5 Xeon. Open your process manager and look at it.

#

It should show 0 because it IS 0.

inner jewel
#

htop

#

run that

#

in the terminal

uncut slate
#

@earnest phoenix so what's so wrong about the RAM

#

Where does it show 1 of 1MB

inner jewel
#

also 1 MB is not 1 million bytes

#

it's 1024*1024 bytes

uncut slate
#

@earnest phoenix I'd love to hear why you think my values are wrong though

#

You keep saying they are but you have no idea why yourself

#

That calculation would do something completely different than what I am doing

#

well

#

you're trying to fix something that isn't broken

#

and

#

that snippet wouldn't calculate the usage of your bot

#

"work" doesn't mean it was correct

#

that value is not the amount of memory your bot is using

#

that value is the amount of memory your system as a whole is using

inner jewel
#

it's system usage

uncut slate
#

yes

#

now

#

my values that are "wrong" according to you

inner jewel
uncut slate
#
319MB/1.0GB (31.85%) => amount of memory bot is using out of the memory on the system
226MB free on server => amount of memory free on system (so system usage)
inner jewel
#

used + "/" + total + format(" %.02f%%", used/total)

uncut slate
#

What do you mean by currentmemorybeingused? Used on the whole system or used by the bot?

#

That doesn't answer my question

inner jewel
#

🀦

uncut slate
#

Well

#

as much as I'd love to tell you..

#
The Random Gamer

Your bot has definetilly reported the wrong RAM amount
I'll try to fix that
https://we.is-a.party/5b56be8.png
But I won't share the code with you, because I'm not going to spoonfeed you

#

I'm not going to spoonfeed you. ;)

inner jewel
#

kek

#

getting os used/free mem is so easy on node

#

i need 2 or 3 different hacks to get it on java

uncut slate
#

It is

#

oof

#

you could make this alot easier

#

if you got rid of the cpu

inner jewel
uncut slate
#

LUL

inner jewel
#

sun.* classes aka internal proprietary api that shouldn't be used but dozens of libs use

#

:^)

earnest phoenix
#

Hi

inner jewel
#

com.sun being a gray zone

uncut slate
#

mm

#

Well, you can, but you don't know how to

#

no, I am saying you are incapable of doing so

#

Hey, hey, hey

#

We've been over that

#

you were gonna fix it yourself, but not give me your "fix"

#

remember

#

No, not really

#

Just make sure you're working with ints where you can

#

Listen, kid

#

You are trying to fix something that is not broken

#

For yourself

#

I'm not looking into getting full sys values for you

#

Sure

#

Doesn't mean I'm doing it for you

#

Especially after you wanted to give me sass about doing it yourself and not telling me about your oh-so-amazing "fix" mmLol

#

Like I said

#

your life could be alot easier if you get rid of CPU

opaque bison
#

Anyone here familiar with Materialize CSS and JQuery?

uncut slate
#

I'd suggest asking your question, anyone who knows would answer @opaque bison

#

because my code is a mess because of it

opaque bison
#

good idea

uncut slate
#

if I didn't want CPU, I could have it way easier

inner jewel
#

@uncut slate who needs computer anyways

#

way simpler to do math mentally

opaque bison
#

Okay so my question is: I am using Materialize and JQuery right, on the Index page which doesn't have any heavy JQuery code, the Side Nav works but on pages where I am using excessive JQuery the Side Nav doesn't open. I can't find an error in the Chrome Developers Console either so I am not sure what is casuing this problem.

#

And this is happening on another page as well

keen anvil
#

@earnest phoenix Are you gonna add your music bot here?

inner jewel
#

@earnest phoenix he already said he won' spoonfeed you :^)

uncut slate
#

@earnest phoenix no, because I want CPU

inner jewel
#

inb4 jmusicbot

uncut slate
#

@opaque bison so the button is completely unresponsive?

opaque bison
#

ALU FTW

#

yes @uncut slate

inner jewel
#

alu? arithmetic logic unit?

uncut slate
#

Is it hosted anywhere right now?

opaque bison
#

yeah

#

Well I am just about to put it on my web server so in a few moments I can DM you πŸ˜‰

uncut slate
#

mk

#

well

#

it's not like I would know alot about webdev/JQuery and I've never even heard of materialize

#

but it's always fun to poke around

keen anvil
#

Nice template

tawny lava
#

lol

#

same tbh

keen anvil
#

Oh, good to know

prime cliff
#

I thought Melmsie was always retarded πŸ€”

tawny lava
keen anvil
#

I'm just now finding out

inner jewel
#

melmsie's suoer retarded, yeah

#

that's why he always asks for spoonfeeding

#

totally unlike you

#

:^)

tawny lava
#

thatt's why he needed aetheryx help

keen anvil
#

:/ yup rip me amirite

inner jewel
#

hey someone make a himebot clone

#

clone of clone

prime cliff
#

RhinoBot v2

inner jewel
#

kek

tawny lava
#

same

keen anvil
#

htop vs pm2?

uncut slate
#

they kinda do completely different things, don't they?

prime cliff
#

htop show the system info/stats and pm2 does something diffrent

inner pebble
#

okay, so, say i wanted to create my own bot to use in my own server with about 10 or so human people. what would i have to get/learn in order to make a bot for Discord?

prime cliff
#

Depends on what language and library you want to develop it on

inner pebble
#

okay, what if i were to use Python3? (since thats the language im currently learning and have decided to dedicate myself to ACTUALLY learn it)

prime cliff
#

And do you have a library?

inner pebble
#

NOPE

#

i just kinda wanted to learn the process as i learn more about Python3. when i deem myself at an acceptable level of experience with Python, then i was going to consider making a bot with what i had learned

prime cliff
inner pebble
#

okay

frozen ruin
#

@tribal jetty#2831 What kind of bot were you thinking of making?

prime cliff
#

Nice mention πŸ˜„

abstract mango
#

@inner pebble learn python before learning how to make a bot (although you said you were going to do that)
for discord.py, consider going for the rewrite branch... it's more up to date and better docs are there

#

fuck

#

WHYY

earnest phoenix
#

he left

#

durp

umbral pelican
#

nah, just invis

#

durp

earnest phoenix
#

nah, he left

#

durp

earnest phoenix
#

h;magic Luca

#

@olive crescent

#

h;magic Luca

#

wot

#

oh my god