#development

1 messages ยท Page 359 of 1

uncut slate
#

you would've noticed he's comparing to variables and not strings

fleet epoch
#

someone told me they are not needed so i stopped using them and it has still worked

uncut slate
#

jesus fucking christ

umbral eagle
#

Oh lol i did miss rhat

#

The biggest error i see is that he doesnr know how to do config stuff

fleet epoch
#

thats were its nerrowed down

uncut slate
#

I'm done, if you can't help yourself I can't help you

fleet epoch
#

of course not

#

cause thats def, the deffinition of helping

#

if you cant help yourself then you cant be helped

uncut slate
#

if you aren't willing to help yourself, you can't be helped

#

that's correct

umbral eagle
#

Aeth

uncut slate
#

mhm

fleet epoch
#

xD

umbral eagle
#

Why not just leave

fleet epoch
#

god

uncut slate
#

I am, already have

umbral eagle
#

K

#

@fleet epoch show me your code for your bot

fleet epoch
#

hang on, tweaking it real quick

#

editor desided to mess up and deleted some bits

#
const config = require("../config.json");
module.exports.run = (client, message, args) => {
    if (config.ping == on) {
    message.reply("**Pong!**")
   } else if (config.ping == off) {
 message.reply("this message is set to off")  
   }       
}

module.exports.help = {
    name: "ping"```
#

my ping command

umbral pelican
raven hawk
#

The on in the config.json is inside "", right?

fleet epoch
#

yes

raven hawk
#

That means it is a string

fleet epoch
#

oh

raven hawk
#

so it should be a string when you are comparing them

fleet epoch
#

oh!

#

god

#

wait

raven hawk
#

Also, the () are optional, but you should use them because it makes your code easier to read

fleet epoch
#

ok

uncut slate
#

that's a lie...

fleet epoch
#

wait so in my json, they will not be a string?

tawny lava
#

No they're not

uncut slate
#

they're not optional.

fleet epoch
#

yes they are

#

i can show the code that works and they dont use parrenthisis

fleet epoch
#

weird, my code works normally both ways

uncut slate
#

It doesn't. Your code was just lying dormant in a file, un-used.

fleet epoch
#

ive tested both ways before

uncut slate
#

You haven't.

fleet epoch
#

yes i have xD

raven hawk
#

Seems like sometimes it does, sometimes it doesnt.

#

You should use them just to be safe

uncut slate
#

Okay, listen. I will literally give both of you $100 paypal if you can prove that parentheses around if conditions are optional in JavaScript.

fleet epoch
#

ok, doing it rn

uncut slate
#

Oh, and if you can't prove it, you're getting banned :^)

elder rapids
#

Can I prove it for the lulz?

umbral eagle
#

Aeth hold on there

elder rapids
#

Let me write my own JS interpretter

uncut slate
#

that's not JS anymore

elder rapids
#

Still JS to me ๐Ÿ˜‰

umbral eagle
#

Considering I have WORKING JS CODE

#

With no parenthesis

uncut slate
#

@umbral eagle You're in too

umbral eagle
#

Or wait hm

fleet epoch
#

my code rn

uncut slate
#

I'll paypal you $100 if you can send me working code that has an if condition without parentheses, interpreted by Node.js v9.3.0

tawny lava
#

Mmm I can already smell the bans

fleet epoch
#
const config = require("../config.json");
module.exports.run = (client, message, args) => {
 let bob = "test";
 if bob == "test" {
     console.log("works")
}

module.exports.help = {
    name: "ping"
}```
umbral eagle
#

I wouldnt take the money

fleet epoch
#

for testing

#

lets try this

uncut slate
#

Banned.

fleet epoch
#

testing this rn

#

cause this always works for me

uncut slate
#

It never has. But, keep talking.

umbral eagle
#

I c

#

I was confusing

fleet epoch
#

it always has, this is strange lol

umbral eagle
#

No parenthesis

#

For no brackets

quasi sandal
#
if(true)
    console.log("this does work :)");```
fleet epoch
#

I SEE IT

#

omg i see this

uncut slate
#

Come on lads! $100 paypal, right now, for what you said you could prove!

fleet epoch
#

ready

umbral eagle
#

Im wrong, but i wouldnt have taken your money anyway

uncut slate
#

Good, but I will gladly keep up my end of the bargain and ban all of you

umbral eagle
#

I admit i was wrong i misremembered

#

My b

fleet epoch
#

oh wait, i shouldent run this withen a bot lo

#

im nto admiting cause ive done it before and it has worked

uncut slate
#

@umbral eagle Now, if you could please, for gods sake, convince those other 2 dumb shits that parentheses have ALWAYS been a requirement in JS.. that would be great.

fleet epoch
#

was this updated or something lol

uncut slate
#

Nope.

umbral eagle
#

K

fleet epoch
#

hmm

umbral eagle
#

@fleet epoch you're weong

fleet epoch
#

imma talk to a friend that knows alot about js

umbral eagle
#

No

#

Dont

#

Not needed

raven hawk
#

doesnt work on jsfiddle

elder rapids
#

Aeth, I think they're too used to programming Lua they forgot how JavaScript works

uncut slate
#

Please do. Please have him tell you that it works and then split the $100 paypal @fleet epoch

quasi sandal
#

@fleet epoch believe us, never worked

fleet epoch
#

ok i have 2 friends talking to me rn about this

umbral eagle
#

Dont die on a hill highfive

#

Take the l

fleet epoch
#

no imma keep fighting till i can proove myself wrong

umbral eagle
#

I did

uncut slate
#

Actually no, @fleet epoch I will give each one of your friends $100 individually (so $300 for the lot of you) if any of you can prove to me that parens in if conditions are optional.

umbral eagle
#

Inb4 typescript lol

fleet epoch
#

oo he msged back

#

lets see what he says

umbral eagle
#

Thats not how typescript works i know

uncut slate
#

JS interpreted by v9.3 I said, btw

#

no transpiling, no funny business, vanilla JS

fleet epoch
#

oh he asked what language lol

#

ok waiting for response

umbral eagle
#

Hm

umbral pelican
#

this probably isn't the best place to get help on very basic js deni mmLol

tawny lava
#

Lul

uncut slate
#

unb you're not gonna believe this shit, I am so fucking close to offing myself

#

jesus fuck

umbral pelican
umbral eagle
#

I dont understand why people volunteer for this

fleet epoch
#

wait WTF

#

i code without parenthisis but i look in my old code and there are parenthisis

#

like this is magic

uncut slate
#

You don't.

fleet epoch
#

someone haxed me

uncut slate
#

omfg so done

umbral pelican
#

have you been doing weed

umbral eagle
uncut slate
#

so fucking done omfg

#

jesus fuck

fleet epoch
#

this is soooo weird lol

umbral eagle
#

TAKE THE L

inner jewel
tawny lava
#

Probably more than that tbh @umbral pelican

umbral pelican
#

lul

uncut slate
#

@inner jewel absolutely not

inner jewel
#

okay

quasi sandal
#

I'm gonna hurl

inner jewel
#

done

fleet epoch
#

and all of my friends are saying yes its needed, ok i take the L nu banz plz

inner jewel
#

i'm writing it rn

uncut slate
#

@inner jewel You're not a valid entry, but I'd love to see what you're cooking up

tawny lava
#

Ban ULTRALUL

umbral eagle
#

Look i admit when i fuck up

#

Just take the L

fleet epoch
#

i thought i had something going, i guess not

uncut slate
#

also, remember, if statement to be taken literally, as in if <condition, with or without parens>

fleet epoch
#

gg @uncut slate

uncut slate
#

Where's the other one?

#

@raven hawk fam

inner jewel
#
let functions = [()=>console.log("true"), ()=>console.log("false")];
let cond = 1 + 1 == 2;

functions[cond && 0 || 1]();```
uncut slate
#

that's not an if statement

umbral eagle
#

Banne

fleet epoch
#

lol

umbral pelican
#

-bots punchinglikes

gilded plankBOT
#
punchinglikes#4228
Bots

@hollow zephyr

uncut slate
#

where did the other dude go though

fleet epoch
#

what other dude

uncut slate
#

ah here he is

#

ajgeiss or whatever

fleet epoch
#

oh

raven hawk
#

Iโ€™m at school rn

uncut slate
#

I'll give you $1k

umbral eagle
#

What did aj do

uncut slate
#

he was one of the mouthbreathers who said parens were optional

#

@raven hawk $1000 dollars if you can prove that they are right now

umbral eagle
#

No that was me I think

uncut slate
#

nah, he was in on it too

raven hawk
#

I read that on some stack overflow question

raven hawk
#

And I said it in here ONCE

umbral eagle
#

Oh i c

tawny lava
#

Holy hell aeth just boosting up the prize higher everytime

uncut slate
#

so you're admitting you're wrong

tawny lava
#

Kek

raven hawk
#

Yes

uncut slate
#

@tawny lava literally doesn't matter because they can't prove me otherwise

tawny lava
#

Ye ik

raven hawk
#

I tried it in jsfiddle earlier and said in this chat that it didnโ€™t work

umbral pelican
#

the curly ones are optional

umbral eagle
#

I will code you a discord library in brainfuck if you can make an entire js file without a semicolon

fleet epoch
#

oo ok

#

xDDDD

#

idk brainfuck tbh

tawny lava
#

You don't need to add semicolons in js xdddd

inner jewel
#

+[>+] best brainfuck script

#

@umbral eagle file.js: js console.log("henlo")

glossy sand
#

turing completeness check

inner jewel
#

now give me my brainfuck discord lib

umbral eagle
#

But dont you need a semicolon

glossy sand
#

not in js

inner jewel
#

no

umbral eagle
#

For console specifically?

#

Or just if you run it as a single line file

glossy sand
#

js semicolons are always optional

tawny lava
#

For anything, you do not need to add a semicolon

umbral eagle
#

Well fuck you too Sololearn

raven hawk
#

lol

glossy sand
#

well it's convention to always use semicolons

inner jewel
#

i'll make an assembly discord lib if someone gives me a compilable .java file which prints "Hello World" without semicolons and only subclassing Object, no interfaces

#

:^)

umbral eagle
#

No

#

Not worth

#

Java bad

tawny lava
#

System.out.println("Hello World"); ULTRALUL

umbral eagle
#

Ill give someone a dollar if they can code a discord bot using Alice

inner jewel
#

forgot the last part oops

fleet epoch
#

ok

#

so now that this argument bet is done

umbral pelican
fleet epoch
#

is that all that would need to be fixed in my code?

#

probilly not

#

i learned js a year ago

umbral pelican
raven hawk
#

looked like () and ""

umbral eagle
#

Relearn js

#

Like i learned python once

glossy sand
#
public class Main {
  public static void main(String[] args) {
    try (java.io.BufferedWriter out = new java.io.BufferedWriter(System.out)) {
      out.write("Hello, world!\n".getBytes());
      out.flush();
    } catch (Exception e) {
      System.err.println("Hello, world!");
    }
  }
}
umbral eagle
#

I cant go instantly code a python bot

inner jewel
#

wait

#

even better

fleet epoch
#

ok back to the being jerks, i need to cooldown cya

inner jewel
#

10$ for whoever can give me a valid java class that can be loaded at runtime which doesn't subclass Object or call the parent constructor

#

:^)

glossy sand
#

hm

fleet epoch
#

lol, just fixed my code

#

turned out, i am a fucking idiot

#

and it fucking worked

#

after all of this, it worked by adding 2 simple ""

#

my life

tawny lava
#

Not ur fault someone haxed u

fleet epoch
#

tru

#

uhh

#

trump

#

???

#

tru

#

yes my bot workes now

#

i forgot

#

the fucking strings lol

raven hawk
#

that was a lot harder than it should have been lol

fleet epoch
#

ikr lol

#

wait

#

@uncut slate

#

maybe i can proove this now xD

uncut slate
#

..

#

pls no

fleet epoch
#

xD

uncut slate
#

why are you still trying

fleet epoch
#

nah jk

#

probilyl wont work

uncut slate
#

not at all

#

wanna bet for a 72h mute

fleet epoch
#

everyone is saying it wont so i trust it

uncut slate
#

vs $500

fleet epoch
#

i have to get off my computer rn sadly or else i would

uncut slate
#

excuses

fleet epoch
#

i will be on in an hour

#

i have a brother and he gets an hour, then i get another hour for the day

uncut slate
#

excusseesssssssss

fleet epoch
#

nope

#

i can show proof

umbral eagle
#

Aeth if hes 9

fleet epoch
#

im 13

umbral eagle
#

Sure

fleet epoch
#

so still a kid lol

#

ok ill be on my phone talking still, but cya

umbral eagle
#

K so

#

You need learning, kid

fleet epoch
#

thx for all the help guys not being sarcastic

#

no i just had a brainfuck moment

#

i should of known that it needed to be a string

raven hawk
#

brainfuck turned into $1k or ban

inner jewel
#
function ifTrue() {console.log("a")}
function ifFalse() {console.log("b")}

const condition = 1 == 2 - 1
const p = ["(", ")"]

eval(`if${p[0]}${condition}${p[1]}{ifTrue()}else{ifFalse()}`)```
umbral eagle
#

You need parenthesis in that

uncut slate
#

the evaled string still ends up to have parens

umbral eagle
#

Now

uncut slate
#
[~]ฮป node f.js                                                                                                                     
if(true){ifTrue()}else{ifFalse()}
umbral eagle
#

If you set variables

inner jewel
#

condition && ifTrue() || ifFalse()

uncut slate
#

that's not an if statement

#

a literal if <cond> statement

inner jewel
#

it ends up as an if

#

when you run it

#

:^)

uncut slate
#

I'm not asking what it ends up as ๐Ÿ‘€

#

stop trying to squeeze me ๐Ÿ‘€

fleet epoch
#

Thx for sparing me (on phone now BTW doing dishes)

umbral eagle
#

I think you both win

fleet epoch
#

How, I lost horribly

umbral eagle
#

I meant the mods

raven hawk
#

@fleet epoch KEEP SCRUBBING (joking)

fleet epoch
#

Lol

#

Ahh k

shrewd yacht
#

hi

#

im trying to change my username

#

in the discord bot list website

#

so the bot is searched under diff name

#

will this work? for the discord js library?

rich kiln
#

you can use the discord applications panel

inner jewel
#

no

#

changing the name of the application doesn't change the username of the bot

shrewd yacht
#

ya

#

it doesnt

#

thats why im trying to change username

fleet epoch
#

Try setUsername

#

As shown In stackflow

inner jewel
#

you need to update the username via the REST api

#

using a lib/manually doing the http request

shrewd yacht
#

ya i just tried it in dev-bot

#

and the dev-bot username updated

#

in discord dev control panel

fleet epoch
#

:)

shrewd yacht
#

but i duno if that will update the botlist site

fleet epoch
#

It should

shrewd yacht
#

i guess ill find out when i deploy the production version

#

is the change instantaneous? do u know?

fleet epoch
#

Not sure

shrewd yacht
#

ok

#

well

#

ill find out soon

#

thx all

undone plover
#

are all user ids the same lenght? Please tag me with the answer

young cradle
#

@undone plover 17-19

undone plover
#

darn it

#

thank you

uncut slate
#

I would not put that in your code

#

Not future proof, at some point the ID length will increase (again)

languid dragon
#

I can't for the life of me, figure out what I'm doing wrong:

    let NewHelp = global.HelpPages
    let AlreadyListed = []
    global.COMMANDS.forEach((CMD) => {
      if (!AlreadyListed.includes(CMD.D.ID)) {
        AlreadyListed.push(CMD.D.ID)
        if (NewHelp[CMD.D.group] === undefined) return
        let addedDesc = false

"global.HelpPages" is set when all the commands are loaded
i put it in a variable called "NewHelp" and add the commands dynamically to the pages with "NewHelp"

NewHelp[CMD.D.group].embed.description += `*${CMD.D.s_desc}*\n`; addedDesc = true

Yet for some reason I always end up changing the "global.HelpPages" ?????
And every time I execute the help command, the pages double in size and the commands are each added all over again.
http://nuttysu.cc/4e01โ€”1867?!?!?!
It's almost like "NewHelp" is turned global when I do this?
Am I missing something stupidly simple?

neon pasture
#

just check the mentions in a message?

glossy sand
#

@languid dragon uhhhh javascript variables are passed by reference

#

so when you do let NewHelp = global.HelpPages then NewHelp becomes a reference to the same object global.HelpPages is a reference to

languid dragon
#

How would I get a new instance of global.HelpPages?

glossy sand
#

do a deep copy

#

or actually let NewHelp = [...global.HelpPages]

#

a shallow copy should work just fine for what you're doing

languid dragon
#

so that will copy it into the new var?

#

wew i am n00b

#

thanks for your help my dude

glossy sand
#

anything to distract from this terrible hw

languid dragon
#

ur a legend hart

#

CRIES

#

@glossy sand ive appeared once more to distract u from ur terrible hw

glossy sand
#

henlo yes

#

that means HelpPages is not iterable

#

I can't really help you much more without some context

languid dragon
#

JSON.parse(JSON.stringify(json_original));

#

what if i did that

#

LOL

glossy sand
#

what is WRONG with you

languid dragon
#

LOOOL

#

PLS

#

oh

#

lemme try something

glossy sand
#

is helppages not an array?

languid dragon
#

no its object

#

u need to do {...thing}

#

right?

glossy sand
#

ya

languid dragon
#

i just googled it and saw that

#

GG

glossy sand
#

i just assumed it was an array lol

languid dragon
#

klets try this now

#

it still duplicates cryyyyy

glossy sand
#

check the code you're using to generate the help pages lol

languid dragon
#

well heres the thing

#

my command handler does this when the bot is started

#

        global.HelpPages[CommandDirs[x]] = null
        global.HelpPages[CommandDirs[x]] = {embed: {
          color: 0x8D2151,
          image: {
            url: `http://nuttysu.cc/${CommandDirs[x]}-banner.png`
          },
          description: ''
        }}
#

so every directory becomes a "HelpPages"

#

so like

#

HelpPages['dev']

#

would be a page etc

#

and then in the help command

#

it basically just adds to the description

glossy sand
#

oh

#

well there's your problem

#

you do need a deep copy

languid dragon
#

how do that

#

couldn't find anything online aaaa

glossy sand
#

you can probably just find an algo on npm because deep copy is annoying to implement

#

it's like

languid dragon
#

omg its insane

#

i found a js example imma try

earnest phoenix
#

Insane

glossy sand
#
function deepCopy(o) {
    if (Array.isArray(o)) {
        return o.map(e => deepCopy(e));
    } else if (typeof o === 'object') {
        const r = {};
        for (const key of Object.keys(o)) r[key] = deepCopy(o[key]);
        return r;
    }
    return o;
}
#

that should probably work

#

I can think of a few edge cases where it wouldn't but you probably don't care about those

languid dragon
#

okay so

#

i found this example

#

that worked for me

#

also apparently Object.assign() does it now

#

but it didnt when i tried

glossy sand
#

that guy that suggested stringify then parse

#

I hate them

languid dragon
#

apparently

var x = {myProp: "value"};
var y = Object.assign({}, x); 

should work, but doesn't

#

HONESTLY LOL

#

well this works and im happy

#

and thanku for teaching me about these things

#

i had no idea you needed to do this holy shit

glossy sand
#

assume all properties are references and are passed by-reference

#

except numbers, strings, and booleans because fuck you

languid dragon
#

it probably seems like such an un-needed thing because of like the effort but
but i need it for the dynamic-ness of everything
because if the bot doesn't have appropriate permissions it does this

glossy sand
#

Object.assign doesn't work for you because it only creates a shallow copy

#

you need a deep copy

#

Object.create also doesn't create a deep copy

languid dragon
#

ahhhh i see

glossy sand
#

everyone is suggesting stringify then parse

#

what is wrong with people

languid dragon
#

people = trash

uncut slate
#

if you don't need a deep copy and you're on the latest node

#

you can use the spread op

languid dragon
#

wat dat

#

if it'll remove this huge ugly function

#

yes please

uncut slate
#
const sourceObject = { hi: 'bye' };
const copy = { ...sourceObject };
glossy sand
#

no we do need a deep copy

languid dragon
#

o wait i need a deep copy tho

#

yeah

uncut slate
#

ohh alright

#

yeah that's a shallow

languid dragon
#

;[ thank u tho

glossy sand
#

I bet the big ugly function can be onelined

#

I'm just too lazy

languid dragon
#

i somewhat compressed it

languid dragon
#
{
    'thing1': 'dis meme1',
    'thing2': 'dis meme2',
    'thing3': 'dis meme3',
    'thing4': 'dis meme4'
}

can i iterate this like an array

bitter sundial
#

yes

#

deep copy Thonk

languid dragon
#

yes

bitter sundial
#

what do you need it for

languid dragon
#

to deep copy

bitter sundial
#

why do you need to deep copy

languid dragon
#

did u read chat history

bitter sundial
#

not alot

languid dragon
#

well

#

i have an object that is global

#

and i need a new instance of it because commands are shown dynamically

#

if the user doesn't have permissions it shows "you need blah blah to use this command" instead of showing the desc

bitter sundial
#

also stringify and parse best hack hate me phanta

languid dragon
#

so in that case its generate each time the command is used

earnest phoenix
#

@glossy sand JSON stringify and parse is the fastest way, as it's implemented natively.

inner jewel
#

v8 (and consequently node) does runtime compilation of javascript code to machine code

#

so that deepcopy function is faster

#

might even be faster uncompiled for large objects

#

since it doesn't need to make an enormous string

#

and has less pressure on the GC

glossy sand
#

jit compilation op

quiet bobcat
#

Are there any alternatives to the Forever node module? I want a node module that just starts the js file whenever it crashes but I also want to see a log like I would with a regular startup without any node modules.

wispy schooner
#
      const { text } = await snek.get(`http://gettwitterid.com/?user_name=${args[0]}&submit=GET+USER+ID`);
      const dom = new domParser().parseFromString(text);
      console.log(dom.getElementsByClassName("profile_info"));

@gusty topaz that returns [ Node { namespace: null, text: undefined, _selfCloseTag: false } ]

earnest phoenix
#

wth is this...

wispy schooner
#

ur mum

earnest phoenix
#

no u

#

LUL

gusty topaz
#

ok I went to the page

#

hold on

#

the thing is

#

on the page

#

wait

#

dom.getElementsByClassName("blah")[0]

#

try that

wispy schooner
#

trying...

#

Node { namespace: null, text: undefined, _selfCloseTag: false }

gusty topaz
#

dom.getElementsByClassName("blah")[0].innerHTML

wispy schooner
#

trying...

languid dragon
#

is this frontend stuff

gusty topaz
#

nah

#

parsing DOM in node

wispy schooner
#

There we go, that worked, time to regex that bitch

gusty topaz
wispy schooner
#

lol

#

okay, so an xml parser now?

gusty topaz
#

nah

#

its kinda a joke

#

just go with regex

#

im guilty of that as well

wispy schooner
#

well, according to my regex, it can't find it

gusty topaz
#

find <td><p>*</p></td>

wispy schooner
#

got it

languid dragon
#

related to @proven cloud's colour theme

wispy schooner
#

Yes

languid dragon
#

ty

abstract mango
#

is that a WEB DASHBOARD?

languid dragon
#

no its an app dashboard

abstract mango
#

oh

earnest phoenix
#

Hello

#

I have a question

#

Can my bot use custom emojis from my server in other server?

quiet bobcat
#

Yes you can

earnest phoenix
#

@quiet bobcat

#

xD

quiet bobcat
#

xd

earnest phoenix
#

I want bettt

#

!!

quiet bobcat
earnest phoenix
#

@quiet bobcat I cant use them in embeds wetf

inner jewel
#

you can

earnest phoenix
#

I using them in fields xD

inner jewel
#

but it's not :name:

#

it's <:name:id>

earnest phoenix
#

wht

#

Wowwww

#

tnxxx

inner jewel
#

use a \ before

earnest phoenix
#

I didn't know about it

inner jewel
#

to get the id

earnest phoenix
#

Wow

#

Tnx

earnest phoenix
#

I love this serverrrrrrr

sinful oyster
#

Can someone help me please, YTDL how to make it so you can search for a song without using link? (Discord.js)

glossy sand
#

YTDL doesn't offer a way to do that

#

you'll have to poll youtube yourself

sinful oyster
#

is there anything i can use which will work will YTDL?

#

i've checked YT there is nothing.

narrow flare
#

Hey! I need some help please ๐Ÿ˜ฆ

glossy sand
sinful oyster
#

How will this help?

glossy sand
#

they must offer some api for searching videos

sinful oyster
#

But how would i use it?

glossy sand
#

well, that's for you to find out

#

I haven't used it myself

sinful oyster
#

-_-

abstract mango
#

I know someone who just scrapes the page

glossy sand
#

yeah I wrote a music bot that just scrapes the search page

#

but that's a hacky solution

narrow flare
#

My bot stopped working since yesterday and I dont know why, it keeps reconnecting and not responding to commands or responding 10 mins later (if it does not restart first).. I did not make any changes in code.... Im working on Discord.py -- Anyone could help me please ;-; ???

glossy sand
#

@narrow flare I would run a profiler

sinful oyster
#

how would i use this in my play command?

glossy sand
#

it sounds like a memory leak

#

@sinful oyster uhhhh poll it for search data then use the results to retrieve a video?

sinful oyster
#

??
sorry im stupid.

narrow flare
#

@glossy sand My pc does not seems to be working NOTHING xD.. I will try to open the bot as a new one..

glossy sand
#

@sinful oyster do you have any idea what a restful api is

sinful oyster
narrow flare
#

and it has only 16 svs xD

glossy sand
#

oh of course there's a node package for it

#

I honestly didn't even think to check

sinful oyster
#

kk its fine.

elder rapids
#

When you wish you could search google.com itself but Google fucks your ass if you try and scrape and their API is only 100 queries per day

#

Speaking of that I read a comment once where Google fucks you if you try and scrape data without accepting ToS/asking permission (not using API basically). But does Google scrape your website still when you put in a ToS that says they can't or even asked permission to scrape your site?

gusty topaz
#

well

#

robots.txt

elder rapids
#

ik

#

But leik

#

๐Ÿ‘€

uncut panther
#

im having an issue with the bit

#

bot

#

for some reason theres a money cap on this one member in a server

#

and its not letting him deposit the money

#

does anyone know how to fix this???

raven hawk
#

What are you using to store the money?

uncut panther
#

just a bank?

#

its not letting him deposit the money

raven hawk
#

Like are you using json files or a db?

uncut panther
#

im not entirely sure

#

im pretty new to this bot

raven hawk
#

Are you saving everyone's balance to a file?

uncut panther
#

yes

raven hawk
#

ok

#

are you using JSON.encode?

#

or a different language's equivalent?

uncut panther
#

uhhhh hold on lemme see

crimson raft
#

I need help

#

Creating a pussy bot

raven hawk
#

cats or nsfw?

bright spear
#

lmao

uncut panther
#

wait i think we fixed it

raven hawk
#

ok good

uncut panther
#

ill lyk if it didnt work

#

thanks tho

crimson raft
#

Ummm

#

Cats yea

raven hawk
fleet epoch
#

How can I make a eco system using a JSON

raven hawk
#

in js its easy

fleet epoch
#

Using ja

#

Js*

crimson raft
#

Nah

raven hawk
#

just put all of the players balance in an array

fleet epoch
#

Making it automatic

crimson raft
#

Make a Cats nsfw bot

raven hawk
#

lol

fleet epoch
#

Lol

raven hawk
#

then just do JSON.stringify(balances)

#

the write that to a file

#

and when you go to get the money, read the file and do JSON.parse(data)

earnest phoenix
#

Does anyone know if there is a way to have someone host a bot 24/7?

raven hawk
#

Im currently using aws free tier, but thats only for a year

bright spear
#

(its free)

crimson raft
#

@bright spear should i trust it

bright spear
#

its made by the company that made Trello

crimson raft
#

Oj

topaz fjord
#

anyone know why this wont work?

#
function play(guild, song) {
  const serverQueue = queue.get(guild.id)
  console.log(serverQueue.songs)
  
  bot.player.join(guild.id, message.member.voiceChannel.id).then(async player => {
    message.channel.send(song.title, { code: "json" });
    await player.play(song.track, { region: message.guild.region });
    
    player.on("end", async (data) => {
        if(data.reason && data.reason === 'REPLACED') return;
        serverQueue.songs.shift();
        console.log(serverQueue.songs)
          play(message.guild, serverQueue.songs[0]);
    });
  }).catch(console.log);
  }
}
#

it shifts the song but doesnt play it

#

btw im using lavalink.js

jagged birch
#

I tried to get help with this code before, I updated my libs and checked it plays before leaving, but every now and then when you use one of my soundboard commands the bot joins and leaves instantly. Here is an example of my code:

    // Voice only works in guilds, if the message does not come from a guild,
    // we ignore it
    if (!message.guild) return;
    var voiceChannel = message.member.voiceChannel;
    if (message.content === (prefix + ' reee')) {
      // Only try to join the sender's voice channel if they are in one themselves
      if (voiceChannel) {
        voiceChannel.join()
          .then(connection => { // Connection is an instance of VoiceConnection
            const dispatcher = connection.playFile('./sound/reee.mp3');
            dispatcher.on('end', () => {
                voiceChannel.leave()
              });
          })
          .catch(console.log);
      } else {
        message.reply('REEEee y0u n33d t0 b3 1n a v0ice ch4nnel f1rst!1!!11 :alien:');
      }
    }
  });```
I have no clue why its doing this ;/
analog breach
nova atlas
#

my DiscordBotsLists api works now but i get this

#
2018-01-18T05:41:00.588238+00:00 app[worker.1]: Unclosed connection
2018-01-18T05:41:00.588246+00:00 app[worker.1]: client_connection: Connection<('discordbots.org', 443, True)>
2018-01-18T05:41:00.588511+00:00 app[worker.1]: Unclosed response
2018-01-18T05:41:00.588514+00:00 app[worker.1]: client_response: <ClientResponse(https://discordbots.org/api/bots/396464677032427530/stats) [200 OK]>
2018-01-18T05:41:00.588525+00:00 app[worker.1]: <CIMultiDictProxy('Date': 'Thu, 18 Jan 2018 05:39:59 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '2', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=d293441a3c0d6867beabeea5e3cf571531516253998; expires=Fri, 18-Jan-19 05:39:58 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure', 'X-Powered-By': 'Express', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Authorization', 'Etag': 'W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"', 'X-Varnish': '114952669', 'Age': '0', 'Via': '1.1 varnish-v4', 'Accept-Ranges': 'bytes', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'Expect-Ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'Cf-Ray': '3def37854c785711-IAD')>
#

tell me if you want to see code

frail kestrel
#

H E R O K U

nova atlas
#

lol WIX

bitter sundial
#

thats not even an error

buoyant veldt
#

My bot pms users the help documents, how can I send the help to the channel the command is run in if the users pms are closed? (using discord.js)

inner zinc
#

msg.author.send(help).catch(e=>msg.channel.send(help))

buoyant veldt
#

thanks

shrewd field
#

What is this?

#

And I don't think that's code so if you want to chat go to #general.

#

Yes

languid dragon
shrewd field
#

Ok.

crimson raft
#

I speak mortal and cat

earnest phoenix
#

hey guys, where can i get list of all the id of the emojis

inner zinc
#

what emojis? ๐Ÿ‘€

earnest phoenix
#

โœ… โŽ

languid dragon
earnest phoenix
#

\โœ…

languid dragon
#

tried <- this has an id

earnest phoenix
#

i want to check whenever someone react with them

languid dragon
#
if (reaction.emoji.id === "391613511022936067") // do something
if (reaction.emoji.name === "![tried](https://cdn.discordapp.com/emojis/391613511022936067.webp?size=128 "tried")") // do something
if (reaction.emoji.name === "โœ…") // do something

Assuming you use D.js

earnest phoenix
#

ok thanks

earnest phoenix
#
if (reaction.emoji.name === "โœ…")

doesn't work

languid dragon
#

error?

earnest phoenix
#

no error

#

just doesn't work

#

cause it doesn't reply

inner zinc
#

if (reaction.emoji == "\โœ…")

earnest phoenix
#
client.on("messageReactionAdd", (msgReaction,user)=>{
  if(msgReaction.message.author.id===client.user.id) {
    sql.get(`SELECT * FROM users WHERE userId ="${user.id}"`).then(row => {
      if (!row) sql.run("INSERT INTO users (userId, level, exp, commands) VALUES (?, ?, ?, ?)", [user.id, 1, 0, "on"]);
    }).catch(() => {
      console.error;
      sql.run("CREATE TABLE IF NOT EXISTS users (userId TEXT, level INTEGER, exp INTEGER, commands TEXT)").then(() => {
        sql.run("INSERT INTO users (userId, level, exp, commands) VALUES (?, ?, ?, ?)", [user.id, 1, 0, "on"]);
      });
    });
    if(msgReaction.emoji==="โœ…") {
      sql.get(`SELECT * FROM users WHERE userId ="${user.id}"`).then(row => {
        if(row.commands==="off"){
          row.commands = "on";
          msg.reply("you've enabled to use commands to disable them use :negative_squared_cross_mark:");
        }
      });
    } else if(msgReaction.emoji==="โŽ") {
      sql.get(`SELECT * FROM users WHERE userId ="${user.id}"`).then(row => {
        if(row.commands==="on"){
          row.commands = "off";
          msg.reply("you've disabled to use commands to ensable them use :white_check_mark:");
        }
      });
    }
  }
});```
#

this is the code, nothing i tried worked

uncut slate
#

define "didn't work"

#

also, use prepared statements

#

also, you need to actually write the entry again

#

also, just console.error; doesn't do anything

earnest phoenix
#

i mean whenever i react with โœ…orโŽ it doesn't reply or changes the row.commands

uncut slate
#

you can't just reassign the variable, that doesn't do anything

#

you need to resave entry

earnest phoenix
#

?

uncut slate
#

?

languid dragon
#

?

earnest phoenix
#

what do you mean resave entry?

uncut slate
#

you need to UPDATE the entry

#

you can't just change the variable

earnest phoenix
#

oh oops now i see

#

still doesn't work

earnest phoenix
#

โœ…

#

โœ…

#

wut

#

โœ…

umbral pelican
#

you okay hun blobthinkeyes

frigid juniper
#

โœ…

earnest phoenix
#

Nope, am broken, pls fix

gusty topaz
#

Heh?
JDA utilities is not working for me
I copied the example bot to build off of it but all I get is this

Exception in thread "main" java.lang.NoSuchMethodError: net.dv8tion.jda.core.entities.Game.playing(Ljava/lang/String;)Lnet/dv8tion/jda/core/entities/Game;
    at com.jagrosh.jdautilities.commandclient.CommandClientBuilder.<init>(CommandClientBuilder.java:40)
    at super.secret.project.Main.main(Main.java:36)
inner jewel
#

update jda

gusty topaz
#

I have the latest

#

dependencies {
    compile 'net.dv8tion:JDA:3.1.1_212'
    compile 'com.sedmelluq:lavaplayer:1.2.42'
    compile 'com.jagrosh:JDA-Utilities:1.9'
}
#

from my build.gradle

inner jewel
#

that's not the latest

#

we're on 3.5

#

you're on 3.1

gusty topaz
#

oh

inner jewel
#

3.5.0_328

gusty topaz
#

hold on

#

ill let gradle do its thing

#

now its crying about this

#

I removed the line

#

now it does tihs on runtime

#
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NoSuchMethodError: net.dv8tion.jda.core.entities.Game.of(Ljava/lang/String;)Lnet/dv8tion/jda/core/entities/Game;
    at com.jagrosh.jdautilities.commandclient.CommandClientBuilder.useDefaultGame(CommandClientBuilder.java:335)
    at super.secret.bot.Main.main(Main.java:39)
earnest phoenix
#

Game.playing

gusty topaz
#

ok

#

removed a few more lines

#

it now boots

earnest phoenix
#

.setGame(Game.playing("loading..."));

gusty topaz
#

ye

#

I fixed it

earnest phoenix
#

ok

scenic crest
#

might help you

#

might not

glossy sand
#

nah

#

haven't actually worked with rhino or nashorn in over a year

upper ember
#

UnhandledPromiseRejectionWarning
when I am trying to post the server count

#

any ideas?

glossy sand
#

you should also get a second error that bubbled into the promise rejection

#

that's what's important

crimson raft
#

Ok

upper ember
#

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Too Many Requests

#

@glossy sand

glossy sand
#

request slower

#

you're hitting our ratelimit

elder rapids
#

Ratelimit 10/10

#

Are you updating on every guild/join

upper ember
#

what do you mean ratelimit?

#

yes I am updating on every guild join/leave

elder rapids
#

no no no no

#

Bad

#

Don't ever do that

upper ember
#

why tho?

inner zinc
#

too many requests~

elder rapids
#

Because it's an unstable system that can spike high event throughput

#

Which can coincidentally

#

Hit a ratelimit

crimson raft
#

?

upper ember
#

what is the ratelimit?

elder rapids
#

10 requests per minute

upper ember
#

well

#

ok

elder rapids
#

Use a background async loop to update your stuff

upper ember
#

I will think about something else for make it slower

#

thanks for the help

elder rapids
#

imo I update every 15 minutes in the background.

#

I like to think of it as a third-party service that just has information regarding the bot and doesn't need the most absolute up to date info

#

Even the profile picture is cached on the website which means it's not always up to date

upper ember
#

wait, I waited over 20minutes

#

And still the same error

#

I had problem that the bot updated it every 0.001 seconds lol but it was just for 30 minutes

#

which is a lot of requests

#

but when I will be able to post my server count again?

elder rapids
#

1 hour ban if you ratelimit

upper ember
#

1 hour ban, alright

#

wait, ban.. is that like serious thing?

#

ok it's more like cooldown

elder rapids
#

It's a ban

#

I guess you could call it a cooldown

#

But it's a straight up ban that all your requests are dropped until the timeout

upper ember
#

ok

#

good for me I guess

#

actually not, but still alright

#

thanks for the help

elder rapids
#

mhm

crimson raft
#

I need help with pm2

potent lily
#

How to close client from discord.py ( client.close() and client.logout() doesn't work at all ) i know i can exit() but that's not clean at all x)

crimson raft
#

I need help to keep my bot online

fleet epoch
#

I can help

#

Is it on a server?

#

And m, you can do exit(1),makes it clean

potent lily
#

Nice thank you ๐Ÿ˜‰

fleet epoch
#

Means exit was successful

gusty topaz
#

I think he wants to destroy the client instance

#

like in discord.js you have client.destroy()

#

which logs ya out

fleet epoch
#

Oh, I thought he wanted to turn off the bot

crimson raft
#

I wanted to keep my bot online

potent lily
#

i have "delete_server()" but i don't think so ๐Ÿค”

crimson raft
#

Not offline

fleet epoch
#

do you have a server

crimson raft
#

No

fleet epoch
#

That's why

potent lily
#

i want to stop the executable file

crimson raft
#

Should i create one

potent lily
#

Cause i run it as subprocess

fleet epoch
#

You have to keep your computer open with the console open to keep it running

potent lily
#

he is on a server

fleet epoch
#

pm2 stop filename.exe

#

To stop a exe fils

#

File*

#

If using pm2

potent lily
#

i want him to close it clean

fleet epoch
#

Yea

#

Using pm2, use the stop command

potent lily
#

i run himself a subprocess to kill him ?

fleet epoch
#

Maybe

potent lily
#

if i use SIGTERM he will not turn off

#

and i don't want to use SIGKILL

#

That's all the point x)

#

i try exit(1) maybe exit make the errors and skip exit coroutine

#

Note if someone have the same problem : Doesn't work i will post the solution here when i get it

crimson raft
#

Ok

raven hawk
#

My bot randomly keeps crashing with the following error, even when no one is using it.

      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 104.24.120.234:433
    at Object._errnoException (util.js:1003:13)
    at _exceptionWithHostPort (util.js:1024:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1194:14)```
scenic crest
#

try/catch the statement that causes it

#

looks like it's your internet tho

torn nebula
#

how can i add reactions for next page?

raven hawk
#

I dont know which statement causes it though

#

it just randomly comes up and crashes the bot every 5 mins

scenic crest
#

what lib?

raven hawk
#

discordie

scenic crest
#

ahh yea

inner jewel
#

connect ETIMEDOUT 104.24.120.234:433

scenic crest
#

discordie is severely outdated

inner jewel
#

failed to connect to discord

raven hawk
#

ah ok

inner jewel
#

but that's purely your internet

scenic crest
#

just switch to another lib

#

I recommend eris

inner jewel
#

or cloudflare being stupid

raven hawk
#

its not a HUGE deal since i have it on a restart thing

#

but a little annoying

inner jewel
#

when bots crash just because of a timeout

crimson raft
#

What program is going to help me with my problem?

scenic crest
#

I mean it's an outdated lib

crimson raft
#

?

scenic crest
#

what problem

crimson raft
#

Keeping my bot online

scenic crest
#

so it becomes online and dies?

crimson raft
#

No

#

Like, I'm trying to keep it online 24/7

scenic crest
#

so it doesn't come online at all?

crimson raft
#

No

raven hawk
#

Does it just stops after a couple of hours? Or do you need somewhere to host it?

scenic crest
#

the code needs to run 24/7

crimson raft
#

What

inner zinc
#

you've already been told that this is just a connection problem

crimson raft
#

Yes

#

But what program should i use to code my bot, that's what i am asking.

inner jewel
#

any IDE for the language you use

#

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

crimson raft
#

Strings

#

Idk

scenic crest
#

A string is not an IDE

#

if you're using JS I recommend Visual Studio Code or Atom

crimson raft
#

Ok

#

Tf why is Visual Studio code cost 799.00

glossy sand
#

i don't think it does

#

i'm running it now for the low, low price of $0

scenic crest
#

Visual Studio Code

crimson raft
#

Oh

mighty barn
#

Visual Studio has a lot of programs/add-ons that have a high price though VS Code is free

crimson raft
#

Found it

weak parrot
#

Visual Studio doesn't cost a thing Thonk

#

Only the premium versions cost you

crimson raft
#

Ik now

fleet epoch
#

Just got tor, time to visit the deep web

crimson raft
#

No

fleet epoch
#

Yes

zealous veldt
#

No

pale light
#

no

left fractal
#

i need help with the owner format

crimson raft
#

?

prime cliff
#

owner format??

left fractal
#

idk

#

i just need help

#

idk what im doing trying to add it

buoyant veldt
#

what even is that lmao

#

@left fractal

left fractal
#

bruh nvm i got it

buoyant veldt
#

ok

#

i'd still like to know what that is xD

raven hawk
#

me too

left fractal
#

nah im good just need to make commands

buoyant veldt
#

why won't you just say what it is .-.

left fractal
#

i goofed

buoyant veldt
#

..

left fractal
#

idk were i made commands i fell dumb rn

buoyant veldt
#

i'm gonna leave this because maybe you don't even unerstand english ยฏ_(ใƒ„)_/ยฏ

left fractal
#

yep under 15 years old

earnest phoenix
#

๐Ÿ‘€

crimson raft
left fractal
#

lol

south finch
#

how old are you ?

left fractal
#

hm?

south finch
#

.. how old are you?

crimson raft
#

4.47 billion years old

south finch
#

@left fractal

left fractal
#

under age of 20

south finch
#

dude

#

ur under 15, we already established that.

#

so how old are you?

languid dragon
#

a real age pls

#

id also like to know

crimson raft
#

Me too

#

We are all curious

languid dragon
#

@left fractal ^

left fractal
#

13

glossy sand
#

tf are y'all doing

left fractal
#

:/

glossy sand
#

don't pressure people into revealing personal info

crimson raft
#

Licking

left fractal
#

ik

glossy sand
left fractal
#

this why im not sayin the trueth

crimson raft
#

I'm not 13 tbh

#

But, let the internet decide

glossy sand
buoyant veldt
#

hey guys, gonna use the twitch api for my bot, when i come to make an app to get a client id what do i do here?

#

bit confusing

elder rapids
#

Enter a redirect uri

buoyant veldt
#

can i put my bots website?

frail kestrel
#

w0t

#

I think that might be

#

ur bot's oauth invite

uncut slate
#

no

earnest phoenix
#

OAuth Redirect URI has nothing to do with OAuth Invite or bot website.

#

Google "oauth simplified" to learn more about OAuth 2.0.

wise nexus
#

GET /api/bots/33165156313/votes will return a array ? or no

austere meadow
#

yes, it'll return an array of objects

wise nexus
buoyant veldt
#

ok

fervent goblet
#

Ok

#

Eris

umbral eagle
#

SOMEBODY SAID ERIS

fervent goblet
#

How do I make it so every file in /commands gets registered

umbral eagle
#

Wdym

fervent goblet
#

/commands/test.js

#

Would be registered

#

Automatically

glossy sand
#

you can use fs to list files in the /commands directory then require them

copper crest
#

Get all files in /commands, require them or read/Eval them

#

Ninja'd

buoyant veldt
#

is there a way to "auto shrink" text? like from an api i'm using it gives me this block of text, but it won't add to an embeds desc since its too large. is it possible to do something to make it end with ... if it hits say, 112 chars

#

so it'd be [text until 112 chars]... or something

#

(using discord.js)

inner zinc
#

if(string.length>112) string = string.subtr(112) + "..."

#

sumthing like this

buoyant veldt
#

thanks

earnest phoenix
#

here @shrewd field

#

or discord.js support server

scenic crest
#

"An idiot's guide" is a good place to start

earnest phoenix
#

^^^^

languid dragon
#

is a good place to start

#

with ideas

glossy sand
#

your library should have some provision for retrieving a user by id

languid dragon
#

dude

#

Deni

#

look at the Documentation

#

im sick of directing you to the D.js docs every 5 seconds

#

its not hard

fervent goblet
#

lmao ken

topaz fjord
#

@languid dragon fix ur shit image domain

#

it should be succmy.nut

south finch
#

LOL

earnest phoenix
#

How do i make it send a message of what they said but take of the prefix in a DM

  'dm': (msg) => {
    msg.author.send(``);```
quasi marsh
#

I don't know Javascript that well but I assume it has a string replace function

earnest phoenix
#

string.replace(old, new)

crimson raft
#

@scenic crest what is it called again,virtual arts studio?

scenic crest
#

Visual Studio Code

crimson raft
#

Ok

#

Nah i will use Atom

#

@shrewd field chat here for code

wispy jolt
#

f

earnest phoenix
#

not f

wispy jolt
#

oh hi

radiant basin
#

Development.

abstract mango
#

yes

#

development.

craggy cave
#

Development

raven hawk
#

development

bright spear
#

development

raven hawk
#

agreed

scenic crest
#

code thing

pale light
#

please have some meaningful discussions going on here bloblul

bright spear
#

hmm, I added the code pinned in #312614469819826177 to the ready event, but it didn't seem to work, it didnt log updated stats or something went wrong

#

d.js 12

jagged plume
#

show code

#

hide auth token though owo

bright spear
#

Thonk its the same thing thats pinned there

pale light
#

hm

bright spear
#

and something after that code did run

jagged plume
#

did you add your bot auth token

bright spear
#

yes

jagged plume
#

not your user auth token

bright spear
#

yeah

jagged plume
#

are there any errors

bright spear
#

nope

pale light
#

"https://discordbots.org/api/bots/" + bot.user.id + "/stats"

#

should be like that

#

its missing the bot id part I think

jagged plume
#

i didnt think the bot id needed

#

yeah

bright spear
#

oh, it didnt say that

pale light
#

So just put your bot id between /bots/ and /stats

#

yeah

#

its missing

bright spear
#

it says js snekfetch.post(`https://discordbots.org/api/bots/stats`)

#

k

jagged plume
#

i dont think the bot id is needed

pale light
#

Hmm

#

I've never really tested it

bright spear
#

let me try with the id

inner jewel
#

checklist:

  • POST
  • https://discordbots.org/api/bots/stats
  • not using your user token, use the per-bot tokens which you can get on the edit bot/api docs page
  • posting valid json
  • token in the Authorization header
jagged plume
#

pin

bright spear
#

still didnt seem to work

pale light