#development

1 messages · Page 517 of 1

knotty steeple
#

no

slim heart
#

because i'm doing the same thing no?

knotty steeple
#

so?

#

if its the same you dont have to copy anything

quartz kindle
#

do you have result = "" before the function?

#

oh wait

#

lmao

#

ready to facepalm yourself?

slim heart
#

undefinedass

quartz kindle
slim heart
#

look

#

it still screws up

tight heath
#

first of all

#

can you fix that indentation

quartz kindle
#

undefined ass

slim heart
#

yes

quartz kindle
#

because

#
var result; //undefined
var result = ""; //empty string```
slim heart
#

hh

#

well thank you

rapid citrus
#

I'm confused with js's null and undefined shits, so I just always double check.

quartz kindle
#

xd

topaz fjord
#

that is why js is bad Lang mmLol

quartz kindle
#

all languages are bad

#

specially C :^)

topaz fjord
#

byte code

#

is amazing

slender thistle
#

Whitespace

quartz kindle
#

(P™TM™)™

#

best language

rigid belfry
#

rust is best lang

#

praised be rust

knotty steeple
#

@rapid citrus null is nothing

#

undefined doesnt exist

rapid citrus
#

I am confused to some methods of the libraries that I'm using if they return null or undefined, that's why I just double check

#

but for my own methods, I always return null.

knotty steeple
#

like uh

#

bot.channel.wew

#

thats gonna be undefined

rapid citrus
#

still, I'm going to double check.

knotty steeple
#

wew

rapid citrus
#

you can't stop me.

knotty steeple
#

im not?

rapid citrus
#

welp, I have this simple class to simplify the task.

#
export class NullCheck {
  public static Fine(obj: any) {
    if (obj !== null && obj !== undefined) {
      return true;
    } else {
      return false;
    }
  }
}
earnest phoenix
#

@rapid citrus I actually recommend you return undefined

rapid citrus
#

no I'm fine, everything is doing great.

earnest phoenix
#

the value undefined means a variable that has been declared but has no value

#

hence the typeof undefined is of course undefined

#

null is just the absence of an object

#

that's why the typeof null is object

rapid citrus
#

if it is null or undefined, I can just always check them with that method above, so I think there is no problem with that.

earnest phoenix
#

Hmm....why not just use the logical NOT operator

#

That will work for falsy values

rapid citrus
#

I'm used to what I'm doing right now.

earnest phoenix
#

It's as simple as doing

const value = undefined;
!value; // true
#

No class needed

rapid citrus
#

it works on null also?

earnest phoenix
#

yep

#

since null is falsy

rapid citrus
#

oh thanks, man!

earnest phoenix
#

any one here knows how to do this:
⚪───────────────────────────────────────────
using ytdl-core

topaz fjord
#

wut

earnest phoenix
#

yes

#

🔘 find duration of song
🔘 do math
🔘 profit

topaz fjord
#

lavalink >>> *

earnest phoenix
#

i dont use lavalink

topaz fjord
#

yes

#

but lavalink is best

earnest phoenix
#

why exactly is lavalink so good

#

like what makes it great

cloud peak
#

My bot crashed because of a guild setup error on the server with the id 264445053596991498. And that is this server. Does somebody know what that error means?

tight heath
#

kubelink > lavalink

#

changemymind

topaz fjord
#

go > *

#

change my mind

tight heath
#

slices

lethal sun
#

Can someone help me with this?

node.js and sqlite3

So, I want to replace "Awaiting" to "Approved" in the Status field in the submit table. How can I do that?

"UPDATE submit SET Status=? WHERE ID=?"```
inner jewel
#

@earnest phoenix lavalink allows music with low resource usage for non jvm bots

#

and scalability for huge ones

torpid trail
#

I‘ve heard that discord.go is better than discord.js because of the good performance of go, is this true?

#

What is the best language to write a bot?

earnest phoenix
#

Discord.js

west raptor
#

Discord.js isnt a language

#

@torpid trail it's up to preference tbh

earnest phoenix
#

Its a library

west raptor
#

Yeah no shit

torpid trail
#

Ehm yeah sorry I ment js

west raptor
#

I wasn't talking to you

drowsy lily
#

good performance

Define "good". Also explain how this metric even matters for bots that aren't large.

zealous veldt
#

I'm making a module that sends logs off to another server using a websocket

#

and I want users to be able to do something easy like ```js
myModule.hook(console);
// or
console.log = myModule.log;

inner jewel
#
for(const k in console) {
    if(console.hasOwnProperty(k)) {
        const old = console[k];
        console[k] = (...args) => {
            old(...args);
            if(c[k]) c[k](...args);
        }
    }
}```
zealous veldt
#

And where would I put my custom methods in there?

inner jewel
#

that'd hook all methods in console

zenith moss
#

What is better to use for hosting? VPS SSD, VPS CLOUD, VPS CLOUD RAM

inner jewel
#

to call c[k] if c[k] exists

earnest phoenix
#

@zenith moss depends on your use and the specific specs/price

inner jewel
#

with that code

zealous veldt
#

ok

inner jewel
#

also you can provide multiple arguments to console.log/warn/error/etc

#

which your code doesn't handle

zealous veldt
#

yeah ik

#

but where would I put my code that sends the input to the ws server?

zealous veldt
#

ok

#

thanks

zenith moss
#

My bot doesn’t have any commands that use much cpu, any ideas on what kind of VPS I need?

#

VPS SSD, VPS CLOUD, VPS CLOUD RAM

zealous veldt
#

Awesome, it works. Thanks a ton @inner jewel 😃

earnest phoenix
#

haxlive it's hard to tell without the specs

zenith moss
#

I’m looking at ovh

earnest phoenix
#

ah ok

#

lowest tier for each or what?

zenith moss
#

Yeah

earnest phoenix
#

ok ill see

#

any ideas on how much you want to spend or how much ram your bot uses

zenith moss
#

That this point it doesn’t use hardly any, just getting a reference for the future

earnest phoenix
#

do you have/plan to have a big db in the future

zenith moss
#

No really

earnest phoenix
#

then honestly i would just go with vps ssd

zenith moss
#

Alright

earnest phoenix
#

the vps cloud doesn't have any super substantial improvements, and the vps cloud ram isn't a great deal

lethal sun
#

How can I update data using sqlite3 in node.js?

quartz kindle
#

what have you tried?

lethal sun
#
db.run("UPDATE submit SET Status=? WHERE ID=?", [Status, ID],
			function(err,rows){
				 console.log("Done.")
			});```
quartz kindle
#

looks correct

#

any error?

lethal sun
#

It logs Done. in the console, but doesn't edit anything.

jagged plume
#

log the err

quartz kindle
#

do console.log(err,rows)

lethal sun
#

sure.

zealous veldt
quartz kindle
#

also, i think you have to put value assignments in parenthesis

#

SET status = (?) WHERE id = (?)

lethal sun
#

it says null undefined now.

#

@zealous veldt thank you, will read that.

zealous veldt
#

No problem :)

gilded blaze
#

No need for parenthesis

lethal sun
#

yeah

quartz kindle
#

ah

lethal sun
#

but wait, where do I put the new value?

quartz kindle
#

they have parenthesis on their github examples

#

so i just looked it up

gilded blaze
#

Well is ID actually an id in the database?

lethal sun
#

yes

#

ID is a field

gilded blaze
#

then it should work...

sick cloud
#

currently extending the eris client, snd i've hit an issue when making the class. so, i'm defining a function then trying to use it, but it says it isn't a function, can someone help?

C:\Users\ThatTonybo\Desktop\Kyri\src\base\Client.js:15
        this.bindSelfEvents();
             ^

TypeError: this.bindSelfEvents is not a function

code is at https://github.com/kyridiscord/Kyri/blob/master/src/base/Client.js if needed

restive silo
#

@sick cloud i dont really know if thats the problem but you extend a function since eris exports a function returning a new Client by default, you maybe wanna do ```js
const { Client } = require('eris');
module.exports = class MyClient extends Client {

}

#

that would be my best guess

sick cloud
#

ohhh

#

okay, i'll give that a go

restive silo
#

i dont know if it fixes that issue tho

sick cloud
#

that worked

restive silo
#

pog

#

i dont really know why eris does that but yea

#

abalware™

sick cloud
#

lol

#

thanks yukine

restive silo
knotty steeple
#

but the client is Eris isnt it
const Eris = require("eris")

restive silo
#

no

knotty steeple
#

oh

sick cloud
#

also is it possible to like

restive silo
sick cloud
#

extend every user

knotty steeple
#

ok

sick cloud
#

and add a tag property?

knotty steeple
#

thats nice

restive silo
#

its exporting a function what returns a new Client instance

#

@sick cloud overwrite prototype

sick cloud
#

okay

#

never used that but alright

knotty steeple
#

thats what i used with map

sick cloud
#

what prototype would i be overwriting to add tag to users?

restive silo
#

the User class

knotty steeple
#

user mmLol

restive silo
#

Eris exports that

#

aswell

#

you can destructure it

sick cloud
#

so i add it next to the Client thing?

restive silo
#

ye

#

you should probaly abstract that into an own file at some point

sick cloud
#

okay

#

alright so i got that

#

is it something like User.prototype.overwrite or something?

restive silo
#

User.prototype.whateverPropertyYouWant = something

zenith moss
restive silo
sick cloud
#

alright

restive silo
#

you can make it a getter as example

zenith moss
#

I tried sharding with glitch and.. yeah

restive silo
#

doing what you showed above

sick cloud
#

wew, that so worked

restive silo
#

yea dont use glitch for sharded bots

sick cloud
#

undefined#undefined

restive silo
zenith moss
#

I don’t need to shard just wanted to see what happens

restive silo
sick cloud
#

i think it failed miserably

zenith moss
#

Yup

sick cloud
#
User.prototype.tag = `${User.username}#${User.discriminator}`;``` i guess this is wrong?
restive silo
#

yes thats very wrong

#

you tried to access properties static form a class

#

make it a getter like i said

sick cloud
#

a getter? 👀

restive silo
#

you can use Object.defineProperty() for that

sick cloud
#

umm, how? i've literally never extended anything really

restive silo
#
Object.defineProperty(User, 'somecoolproperty', {
    get: function() { return this.username }
})

this should be enough as an example

sick cloud
#

can i replace function() with es6 arrow functions? makes sense tho

quartz kindle
#

whats the difference between that and this? js User.prototype.tag = function() { return this.username; }

restive silo
#

^ this will make it a function not a getter

quartz kindle
#

idk what getters are either xd

sick cloud
#

oh

quartz kindle
#

researches

sick cloud
#
        Object.defineProperty(User, 'tag', {
            get: function() { return `${this.username}#${this.discriminator}` }
        });

so would this work out?

restive silo
#

yea you can actually shorten it to ```js
Object.defineProperty(User, 'tag', {
get() { return ${this.username}#${this.discriminator} }
});

#

thats a cool ES6 feature

sick cloud
#

and will this effect stuff like the Client user

#

or not

restive silo
#

if the ClientUser class extends the User class it should thinkEyes

#

but i know eris internally well enough to know its probaly not for no good reason

quartz kindle
#

ah i get it now

sick cloud
#

class ExtendedUser extends User {

quartz kindle
#

with getter you can call it as User.tag, with a method you have to use User.tag()

restive silo
#

ye

sick cloud
#

welp, would i have to extend the extendeduser as well?

restive silo
#

normally not thinkEyes it should inherent it i think

#

not quite sure

#

try it on a normal user

sick cloud
#

well it isn't i dont think

#

oh

#

guess i'll quickly implement message events then lol

restive silo
#

oh wait

#

change User to User.prototype

sick cloud
#

oh

#

that did it

restive silo
#

pog

#

yea for not instanciated classes you need to provide the prototype

sick cloud
#

lol

#

thanks tho

topaz fjord
#

yukine knows how to read spaghetti code

restive silo
#

tru

quartz kindle
#

is extending geared towards modifying existing code?

#

like building a library on top of another one

keen drift
#

Hey @hushed berry , any chance you also put your db on k8s too?

hushed berry
#

no

#

i deploy my k8s on-prem so its a pain in the ass to manage persistent storage

topaz fjord
#

dude I fucking hate go modules

#

im just tryna code

keen drift
#

wat

topaz fjord
#

and its bugging me

keen drift
#

i love them PepeRain

hushed berry
#

@keen drift i dont remmeber if i aksed or if you told me

topaz fjord
#

I just want to install something and it keep telling me cant find main module

hushed berry
#

but what do you host your cluster on

topaz fjord
#

(╯°□°)╯︵ ┻━┻

keen drift
#

@hushed berry hetzner

#

I think I told you

hushed berry
#

ahh right

#

yeah

topaz fjord
#

help fishy

#

how 2 fix

keen drift
#

@topaz fjord gimme err0r

hushed berry
#

do they have their own k8s system

keen drift
#

nah

hushed berry
#

or do you have to manually install it

keen drift
#

manual

topaz fjord
keen drift
#

what are you running

topaz fjord
#

go get github.com/andersfylling/disgord

keen drift
topaz fjord
#

ah ha

#

i think I fix

#

I enabled vgo support in goland

keen drift
#

what go version do you even have

topaz fjord
#

1.11.2

keen drift
#

@hushed berry is each pod like a whole vm?

visual zenith
topaz fjord
#

one

#

don't do that

#

two

#

not all guilds have the general channel

knotty steeple
#

also for is faster

topaz fjord
#

but don't do it

knotty steeple
#

hey

#

faster ratelimit mmLol

topaz fjord
#

discord API is a person to

hushed berry
#

@keen drift what

keen drift
#

@hushed berry are each pods their own linux os

#

i'm assuming yes

#

but I gotta confirm

earnest phoenix
#

Hey

hushed berry
#

No

keen drift
#

no Thonkang

earnest phoenix
#

Anyone know how to get into bot development?

keen drift
#

aren't they virtualized

earnest phoenix
#

If so, @ me

hushed berry
#

Yeah, docker kek

keen drift
#

yeah alright

knotty steeple
#

@earnest phoenix learn a programming language

#

very important step

earnest phoenix
#

I know JavaScript and html

#

Python?

keen drift
#

lol

knotty steeple
#

ok you can use js

#

node.js

#

discord.js

earnest phoenix
#

Kk

knotty steeple
#
visual zenith
#

@topaz fjord how to return if a guild doesnt have a general channel?

#

also the bot is in 75 servers

#

not a lot

zealous veldt
#

@visual zenith A channel named "general" or a default channel?

sick cloud
#

sending 75 messages at once

#

is api spam

zealous veldt
#

Yes

visual zenith
#

🤔

#

-_-

sick cloud
#

whats your reason to send a message to every guild anyways

#

trying to annoy them?

visual zenith
#

nope xD

#

i wish

sick cloud
#

lose servers fast?

zealous veldt
#

Tony going full roast here

visual zenith
#

since my official server is ded... I need to send updates about the bot xD

zealous veldt
#
...
if(!guild.defaultChannel) return;
...```
visual zenith
#

so people will know whats up

inner jewel
#

don't broadcast update messages

earnest phoenix
#

then how about make it so they opt-in instead

inner jewel
#

that can get you in a lot of trouble

visual zenith
#

also thats DEPRECATED

inner jewel
#

from an ip ban to an account ban

coral trellis
#

It's API abuse as well

zealous veldt
#

yeah

#

Just don't do it

#

If you need to send a message to a specific channel, use the channel's ID

coral trellis
#

The best way to do it is add a section on the help message at the bottom saying what updates you've made

inner jewel
#

^

zealous veldt
#

Or put something in the bot's status

earnest phoenix
#

or make people join your support server and ping everyone

zealous veldt
#

but for the love of all that is properly formatted, don't broadcast messages like that

topaz fjord
#

@zealous veldt default channel doesn't exist anymore

zealous veldt
#

ik

keen drift
#

ye, what I do is I look for a channel called general

#

or find the first channel the bot has perm to send in

#

it sends a doc link upon join

empty owl
#

So

#

How do u find out how many guilds a bot is in

#

discord.js

sick cloud
#

guilds.size

empty owl
#

o

sick cloud
#

on your client

empty owl
#

thanks

empty owl
#

How do you find the ping of a bot

west raptor
#

client.ping

#

read the docs pls

sick cloud
#

#rtfd

zealous veldt
#

it's rtfm tony

#

pls

slender thistle
#

Both work pls

loud salmon
#

@zealous veldt Read The Fucking Manual / Docs mmLol

zealous veldt
hasty ginkgo
#

Any help for this?

sick cloud
#

get more ram

zealous veldt
#

download more ram*

keen drift
#

delete more ram****

sinful lotus
#

dont host a music bot on glitch™

lethal sun
#

ew glitch

#

How can I update data with sqlite3 in node.js?

sick cloud
#

step one use an actual db

lethal sun
#

.-.

earnest phoenix
#

Can a bot clear 1 message exactly?

lethal sun
#

What language?

earnest phoenix
#

Node.js

lethal sun
#

and the library is discord.js?

earnest phoenix
#

Yes

lethal sun
#

you can use message.delete() to delete the latest message as I remember.

earnest phoenix
#

Okay thanks.

lethal sun
sick cloud
#

what does eris have in terms of attachment handling?

sick cloud
#

alright, scratch that but, my new command isn't responding at all. codes https://hastebin.com/momekediwi.js - but i mean it literally doesnt reply at all. no errors, no msgs, no logs, nothing

#

if anyone could help it'd be nice

lethal sun
#

Can someone help me with this?

It says undefined. Name is a field in my submit table.

rows.forEach(function (row) { 
					msg.reply("`" + `${row.Name}` + "` has been approved!")
				}); ```
median sandal
#

You can

msg.reply(`\`${row.Name} \`has been approved!`);```
lethal sun
#

Yeah, but how will that fix my issue? @median sandal

median sandal
#

try typing in the console and checking whether the row has Name

console.log(row);```
lethal sun
#

Fixed it. Thank you @median sandal

knotty steeple
#

why are you using string concatenation when you have a template literal

rapid citrus
#

you mean string interpolation?

knotty steeple
#

no

#

its called a template literal mmLol

amber junco
#

thats a example

west raptor
#

Canvas or smth

amber junco
#

?

quartz kindle
#

there are many image manipulation methods

#

depends on the language

#

javascript has canvas for example

#

you can also use external libraries and software such as imagemagick

lethal sun
#

JavaScript also has Jimp as I remember. it's easier to use and is easy to install tbh

quartz kindle
#

yeah thats also an external library

lethal sun
#

yeah

#

I used Jimp a long time ago. it was pretty good.

quartz kindle
#

its pretty slow tho xd

lethal sun
#

yeah

#

REALLY slow

quartz kindle
#

lmao

#

i never used it, how many ms would it take to generate an image?

lethal sun
#

I remember when I needed to make a timeout to send it

#

hm. 1500-2000ms. something like that

quartz kindle
#

jesus

lethal sun
#

1000ms is 1 second right?

quartz kindle
#

but thats with disk operations right? reading images from disk every time

#

and yeah

lethal sun
#

yeah

quartz kindle
#

that might have been the reason

lethal sun
#

but they have a buffer option though

#

never used it

quartz kindle
#

my bot uses canvas

#

everything is generated, there isnt any background image or image file or anything

#

it takes 50-100ms to generate

lethal sun
#

I don't like canvas because it takes time to install

#

woah

#

that's quick

quartz kindle
#

and its pretty complex

#

trigonometry and shit

lethal sun
#

yeah. I know that

quartz kindle
#

it can be even faster

#

since its low level code, you can always squeeze in more performance

lethal sun
#

o

#

didn't know that either

quartz kindle
#

on a website i managed to get it down to 7ms

#

in one of my iterations

lethal sun
#

7ms!?

#

damn

quartz kindle
#

the problem is that canvas is highly sensitive to resolution

#

so 7ms for a 600x600 image

#

100ms for like 2000x2000

lethal sun
#

well, its still under a second, so...

rapid citrus
#

that speed doesn't bother me, unless it reaches 1 minute, lol.

lethal sun
#

lol

#

I don't feel comfortable to wait 1 minute for an image to generate

#

that's a no no for me

quartz kindle
#

canvas is used for games, so it can handle 60fps animations (16ms/frame),

lethal sun
#

that makes sense

static matrix
quartz kindle
#

css gradients

west raptor
#

Css

lethal sun
#

css

rapid citrus
#

my eyes are now dead.

quartz kindle
#

(what an ugly gradient)

#

lmao

rapid citrus
#

I'm dead serious. I can't see anymore

static matrix
#

how can i add css

lethal sun
#

yeah

static matrix
#

Link

quartz kindle
#

google css style tags

#

and use them in your bot's long description

lethal sun
#

yeah

west raptor
static matrix
#

Oh thanks tim.

knotty steeple
#

nothing matches in that bot page

quartz kindle
#

the owner's IQ does

#

jk

lethal sun
#

lol

amber junco
#

Do we have to download canvas?

rapid citrus
#

you have to install it, I recommend the pre-built one.

#

oh wait are you using nodejs?

lethal sun
#

@amber junco about the Minecraft achievement got image generator, most bots create it with a website and use snekfetch to send the image.

amber junco
#

whats a snekfetch

quartz kindle
#

a library

#

what programming language do you use?

amber junco
#

oh

#

js

quartz kindle
#

snekfetch is a node.js library

#

you can get it from npm

amber junco
#

oh

quartz kindle
#

but i dont recommend it, since its outdated

amber junco
#

So what do you recommend?

quartz kindle
#

the snekfetch authors recommend node-fetch

#

i prefer using node's own http/https

#

which doesnt require any library

amber junco
#

oh

#

Installing snekfetch rn @quartz kindle

quartz kindle
#

@_@

amber junco
#

lmao

heady zinc
#

i wouldn't recommend using directly node's http/https built-in modules

#

as they suck REALLY hard

quartz kindle
#

regardless, there are literally dozens of http packages out there, chose whatever you want

#

why do they suck?

topaz fjord
#

axios 👌

heady zinc
#
const https = require('https');

https.get('https://google.com', (resp) => {
  let data = '';

  // A chunk of data has been received.
  resp.on('data', (chunk) => {
    data += chunk;
  });

  // The whole response has been received. Print out the result.
  resp.on('end', () => {
    console.log(JSON.parse(data).explanation);
  });

}).on("error", (err) => {
  console.log("Error: " + err.message);
});``` because that's how you use it
#

while all the wrappers out there are literally one-liners axios.get('https://google.com').then(r => r.data);

topaz fjord
#
axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

^ that's axios

heady zinc
#

i'd personally recommend axios/got as the most feature-full/maintained packages

topaz fjord
#

got Thonk

heady zinc
#

not snekfetch as its deprecated and bad

#

not node-fetch as gusware is bad

topaz fjord
#

what about jaczfetch

quartz kindle
#

so your only reason for saying node's http sucks its that is a little more lower level?

heady zinc
#

it sucks because it's usage is overcomplicated yes, that's the reason why there's so much wrappers for it out there

#

now don't get me wrong, it is the fastest over all packages, but the most painful to use as well

#

not to mention it also lacks features

quartz kindle
#

exactly, so you cant really say it sucks, just that you dont like it

#

else it would be the same as saying canvas sucks, and jimp is much better lmao

heady zinc
#

not really

#

canvas's usage is not overcomplicated

#

it's actually fairly easy

quartz kindle
#

for people who know how to use it

heady zinc
#

nah it's intuitive asf

quartz kindle
#

any beginner would prefer anything else over canvas

#

based on ease of use

topaz fjord
#

there is canvas-constructor

heady zinc
#

yeah i meant with canvas-constructor

#

using canvas without it is a nogo

quartz kindle
#

i dont use canvas constructor

topaz fjord
#

I use regular canvas mmLol

quartz kindle
#

again you're saying things suck just because they're harder to use lmao

heady zinc
#

because that's how it works

#

the more the package has bad points, the more it "sucks"

#

so to get back to my initial point

quartz kindle
#

thats not how programming works lol

heady zinc
#

the only good point with using http/https is that it's fast

#

and that's all

quartz kindle
#

the more lower level you go, the more complex, powerful and performant it is

#

you cant say low level sucks just because its harder to use

uncut delta
#

If you don't know perfectly about a thing then it sucks imao

heady zinc
#

you've got it totally wrong

#

it unnecesarily harder to use

uncut delta
#

Then learn it and make it easy!

quartz kindle
#

but that doesnt mean it sucks

#

like

#

if you say xyz sucks, people will misinterpret and think the technology behind it sucks

#

which is untrue

heady zinc
#

the design sucks

quartz kindle
#

its not the design, its the fact that is lower level

heady zinc
#

you can't say the technology behind it sucks as anyway as i said any other package is just a wrapper around the http/https module

quartz kindle
#

exactly

#

the tech doesnt suck, the tech is amazing, and the purer it is, the more amazing it is, just harder to use

#

now throw abstraction layers on top, and it makes it easier to use, but doesnt make it "better", not by power and performance metrics

heady zinc
#

you're missing the point

#

it does make it better, not by performance indeed, but there's much more than performance when you judge the quality of a module

#

performance is uncontestably the most important one, but how intuitive, feature-full and documented it is are also important points

quartz kindle
#

well, i measure quality by how fast it is, not by how beautiful its code looks. because in the end, thats what the end-user cares about

#

and my point is that saying something "sucks" might be misinterpreted, as i said before

heady zinc
#

well, i see your point, fair

#

it would be more accurate to say that it isn't beginner-friendly, as a general standpoint

quartz kindle
#

👍

#

i g2g pick someone up

brittle nova
#

My main process (bot) and its child process (dashboard) send messages. How can I make the child process wait for a response and get that response after sending a message? I want a function like:

async function test() {
    process.send({
        op: "TEST",
        id: 1
    });
    let response = await waitFor("TEST", 1);
    return response;
}
topaz fjord
#

You can use ipc if you want them to send message to each other

brittle nova
#

that's what I'm doing

#

but idk how to get the response

languid dragon
#

it gets complicated

brittle nova
#

hmm

languid dragon
#

1 sec

#
// just a handy unique ID thingy
function uuidv4() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        let r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
}

const sendToProcess = msgToSend => new Promise((resolve, reject) => {
    const fingerprint = uuidv4();

    let timeout;

    const listener = (msg) => {
        if (msg.fingerprint === fingerprint) {
            process.removeListener("message", listener);
            clearTimeout(timeout);
            resolve(msg);
        }
    };

    process.send({ ...msgToSend, fingerprint });
    process.on('message', listener);

    timeout = setTimeout(() => {
        // takes 5 seconds to time out, generally shouldn't happen as long as your thing responds
        process.removeListener("message", listener);
        reject('Took too long to respond.');
    }, 5000);
});

sendToProcess({yes: true}).then(results => {

}).catch(err => {

});
#

@brittle nova

#

that should be about it

brittle nova
#

👀

#

thanks

topaz fjord
#

there is a uuid generator

brittle nova
#

don't need a uuid generator anyways, I'll be using functions for guilds and users

languid dragon
#

i mean what if something sends at the same time

empty owl
#

HELP

#

HELP I NEED HELP

#

what does this mean?

mossy vine
#

sounds like a good song

empty owl
#
(node:79) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
    at IncomingMessage.res.on (/home/runner/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1106:12)
    at process._tickCallback (internal/process/next_tick.js:178:19)
(node:79) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:79) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
earnest phoenix
#

means you dont have the right token for something

#

in this case the dbl api

languid dragon
#

means ur unauthorized

empty owl
#

o

#

How do i get the token

earnest phoenix
#

well

#

go to your bot page or something

#

idk and idrc

empty owl
#

....

earnest phoenix
#

not about your problems in particular, just like everything

empty owl
#

oh but how do u get the token

earnest phoenix
quartz kindle
#

your dbl token is in your bot's edit page

empty owl
#

ok

empty owl
#

How do u make a bot post different daily reddits like memes

idle mountain
#

Reddit has an open API, request the info from them (this part is easy) then parse the JSON, then select what you need, then post it

tight heath
#

okay so boys

#

for http clients

idle mountain
tight heath
#

native is bae

#

if you're a nerd

#

and if you're not, use heckin superagent

#

tyvm

knotty steeple
#

request >>

tight heath
#

no

#

request is super spammed

knotty steeple
#

no request is cool

tight heath
#

takes like 6 times the request time

#

no not at all

#

it has an inferior syntax and takes longer

#

how is that cool

empty owl
#

@idle mountain how do u request the infp

idle mountain
#

request the same thing, except add .json on the end, so like:
https://reddit.com/r/facepalm.json
gets the json for /r/facepalm

empty owl
#

ok

idle mountain
#

then just get the page, it'll get the json

empty owl
#

ok

idle mountain
#

not sure exactly how to do that (i'm guessing you're using js), then parse the json, and then you'll have to manually look through it to find what you're looking for (it's a bit confusing but becomes more obvious after a while)

topaz fjord
#

Actually

#

Axios is bae

tight heath
#

Actually why

#

I mean it's half the speed of superagent

empty owl
#

Is there a way to use google sheets or excel for a bot database?

tight heath
#

yes, but it's slow as heck.

#

and overcomplicated

empty owl
#

what about access?

tight heath
#

= sql

#

that's okay

empty owl
#

is there any more?

tight heath
#

there is a lot of possible databases

#

I personally prefer mongodb or rethinkdb

topaz fjord
#

nosql mmLol

empty owl
#

ok

tight heath
#

but I see a lot of people using sql

#

so

#

¯_(ツ)_/¯

topaz fjord
#

mongodb is gud

tight heath
#

depends on what the purpose is

#

basically

empty owl
#

currency?

topaz fjord
#

Mongo is good for big data

empty owl
#

what about for currency

tight heath
#

depends on how large your bot is

languid dragon
#

]]ev -sql SELECT coins FROM users WHERE id = 286166184402092042

river compassBOT
#
Result ~
[ RowDataPacket { coins: 1421 } ]
tight heath
#

mangomongo seems good

empty owl
#

ok

tight heath
#

mongodb

#

is the name

languid dragon
#

]]ev -sql UPDATE users SET coins = 42000 WHERE id = 286166184402092042

river compassBOT
#
Result ~
OkPacket {
  fieldCount: 0,
  affectedRows: 1,
  insertId: 0,
  serverStatus: 34,
  warningCount: 0,
  message: '(Rows matched: 1  Changed: 1  Warnings: 0',
  protocol41: true,
  changedRows: 1 }
languid dragon
#

mysql best sql

tight heath
#

I think it's an NPM module?

empty owl
#

so whats the npm?

tight heath
#

just search it smh

topaz fjord
#

mongoose is a nice module for mongodb

tight heath
#

yes mysql best sql

#

but

#

why sql

topaz fjord
#

postgres Thonk

languid dragon
#

because mysql has a place in my heart from my early development years, also i studied it in many courses lmao

tight heath
#

hmm I heard postgres is hard to setup

topaz fjord
#

I like Mongo's gridfs

knotty steeple
#

it really is @tight heath

tight heath
#

also I've only been using nosql my entire life lmao

#

json
rethink
mongo

topaz fjord
#

I use gridfs since I store my images in it

tight heath
#

lmao

knotty steeple
#

json

#

get out

tight heath
#

yes

#

I started small okay

languid dragon
#

shiro is going to be mysql btw

knotty steeple
#

you dont start with json mmLol

topaz fjord
#

I've actually started with MySQL and left for mongodb

tight heath
#

I switched to rethink after less than a month so chill

#

json was just easiest for me tbh

languid dragon
#

i would highly recommend rethink for node.js beginners

tight heath
#

just use JSON and fs

#

yeah

knotty steeple
#

fs

tight heath
#

rethink is cool

knotty steeple
#

hell no

tight heath
#

fsn actually

knotty steeple
#

shit crash

tight heath
#

owo

knotty steeple
#

man ur data fucked

languid dragon
#

database.ini

knotty steeple
#

i use ini for talkr

tight heath
#

man I didn't give a shit

#

okay

empty owl
#

fd?

knotty steeple
#

which is a thing i made

tight heath
#

I'm now happily @mongo

knotty steeple
#

its in autohotkey

tight heath
#

and for old projects rethink

#

¯_(ツ)_/¯

knotty steeple
#

i really like autohotkey actually

languid dragon
#

mongo is like the more developed and older sister of rethink

tight heath
#

lmao

iron ember
#

hello, I need some help.
I'm making a discord bot that can play music, and I'm trying to make a progress bar for the currently playing song, but I can't figure out how to get the current time of the song. I'd appreciate any help
I'm using node.js with ytdl-core

languid dragon
#

discord.js?

iron ember
#

ye

languid dragon
#

have you looked at the docs

iron ember
#

i have

#

i cant find anything

empty owl
#

dont start with a music bot man

knotty steeple
#

there is a get info function in ytdl-core right

iron ember
#

i dont think it gets the current time tho

empty owl
#

if ur a noob like me dont start with a music bot

knotty steeple
#

it doesnt

iron ember
#

im not starting lol

empty owl
#

lol

iron ember
#

not my first bot

tight heath
empty owl
#

ok

tight heath
#

?

knotty steeple
#

you can store how long the song has been playing urself

#

or that

#

lmao

tight heath
#

.play() returns a StreamDispatcher

#

so

#

that.streamTime

empty owl
#

How does mongo work?

iron ember
#

what if i pause the playback

#

it resets

tight heath
#

no?

#

pause !== stop

#

it just updates state to paused

iron ember
#

i think it only counts the time the bot is speaking

tight heath
#

but streamTime will remain same

#

MATE

iron ember
#

o

languid dragon
iron ember
#

been looking htere too

tight heath
#

IT COUNTS THE TIME YOU'RE PLAYING SOMETHING VIA .play()

#

gosh

#

but anyways

languid dragon
#

you could always make your own timers

#

that pause when the user pauses

tight heath
#

you can also use a workaround using yt-dl

iron ember
#

yeah, i've been thinking about that

tight heath
#

actually d.js timers appropiately pause

#

and start running a pausedTime

empty owl
#

@tight heath is the npm mongodb

tight heath
#

I mean that's what I use, but I heard of mongoose or sthg like that

empty owl
#

ok

tight heath
#

have a look.

empty owl
#

k

iron ember
#

well, thanks guys I'll try making my own timers

tight heath
#

okay gl

knotty steeple
#

ez Date.now()

earnest phoenix
#

Is there any way I can create a cooldown for multiple commands so that if the cooldown is triggered for one command he can’t use that one and another

#

So I want my bot to hack the fib, is their a module for that?

#

I have this is far:

#

hack.fbi()

#

@earnest phoenix u gotta import hacks

#

Ok sorry.

#
hack.fbi()```
#

Good?

#

@earnest phoenix

#

Yes

#

Cool let me run it.

empty owl
#

WHat does this mean


(node:4831) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit```
earnest phoenix
#

Click block and ur good

#

Cool.

empty owl
#

hey un

#

what does this mena

#

(node:4831) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit```
earnest phoenix
#

It means your code is bad.

#

U got hacked

empty owl
#

no actually

earnest phoenix
#

It tells you how to fix it lmao

empty owl
#

dont know where to put that in

earnest phoenix
#

Close the listeners after your done.

empty owl
#

??

earnest phoenix
#

Sigh...

empty owl
#

well ur really helpful

earnest phoenix
#

Learn JS...

#

It tells you how to fix it.

topaz fjord
#

it means you added too many listeners

earnest phoenix
#

Anyone here know python?

#

I do

topaz fjord
#
thing.on('fiusjk', (suij) => { ... })
earnest phoenix
#

Pls come dm’s

topaz fjord
#

too many of these things ^

empty owl
#

uh so how do i get rid of them

west raptor
#

@earnest phoenix dont shitpost here kthx

empty owl
#

^^^^^^

topaz fjord
#

nice mini mod

empty owl
#

uh

#

^^^

#

@topaz fjord how do i get rid of them

topaz fjord
#

either you could get rid of the old one before you make a new one

empty owl
#

o

#

what about increasing the max?

topaz fjord
#

im p sure increasing the max could increase the amount of mem usage

empty owl
#

but how would i increase the max

topaz fjord
#

thing.setMaxListeners(0) for no limit

empty owl
#

ok what is thing

#

Client?

topaz fjord
#

whatever you're using .on on

empty owl
#

ok

#

thanks

fresh kernel
#

I'm using discord.js-commando and I'm trying to send a message to a specific channel that was created just moments before (see included code). I can't figure out why I'm constantly getting the following error; TypeError: Cannot read property 'send' of null

Here's my code

var roleName = `cc${msg.author.username}`;
            msg.guild.createRole({
                name: roleName,
                color: 'DARK_GREEN',
                hoist: false
            }, `private channel for ${msg.author.tag}`);
            msg.guild.createChannel(roleName, 'text').then((channel) => {
                channel.overwritePermissions(msg.guild.roles.find('name', roleName), {
                    'SEND_MESSAGES': true
                });
                channel.overwritePermissions(msg.guild.roles.find('name', '@everyone'), {
                    'SEND_MESSAGES': false
                })
            });
            msg.say(`Private channel created!`);
            msg.guild.channels.get('name', roleName).send('it worked.');
earnest phoenix
#
async function updateStats(){
  let a = await client.shard.broadcastEval('this.guilds.size');
  let b = a.reduce((prev, val) => prev + val, 0);

  snekfetch.post(`https://discordbots.org/api/bots/${client.user.id}/stats`)
  .set('Authorization', 'yes')
  .send({
    shard_id: client.shard.id,
        shard_count: client.shard.count,
        server_count: b,
  })
  .then(() => console.log('Updated discordbots.org stats.'))
  .catch(err => console.error(`Whoops something went wrong: ${err.body}`));
}```
west raptor
topaz fjord
#

ok

#

so

#

the thing is

#

@earnest phoenix

#

when you post shards

#

you only need to post that shards guild count

#
async function updateStats(){
  snekfetch.post(`https://discordbots.org/api/bots/${client.user.id}/stats`)
  .set('Authorization', 'yes')
  .send({
    shard_id: client.shard.id,
        shard_count: client.shard.count,
        server_count: client.guilds.size,
  })
  .then(() => console.log('Updated discordbots.org stats.'))
  .catch(err => console.error(`Whoops something went wrong: ${err.body}`));
}
earnest phoenix
#

oh

topaz fjord
#

it will auto add for you

earnest phoenix
#

oh

#

that's why

#

ok

#

ok

#

Anyone here know python and can help me?

topaz fjord
#

if you ask your question someone can

earnest phoenix
#

Alright

#
@bot.command(pass_context=True)
@commands.has_role("Premium") 
@commands.cooldown(20, 86400, commands.BucketType.user)
async def spotify(ctx):
    with open('spotify.txt', 'r+') as f:
        f_contents = f.readline()
        print(f_contents, end='')
        await bot.send_message(author, f_contents)
        d = f.readlines()
        f.seek(0)
        for i in d:
            if i != "f_contents":
                    f.write(i)
        f.truncate()
    
@bot.command(pass_context=True)
@commands.has_role("Premium") 
@commands.cooldown(20, 86400, commands.BucketType.user)
async def nordvpn(ctx):
    with open('nordvpn.txt', 'r+') as f:
        f_contents = f.readline()
        print(f_contents, end='')
        await bot.send_message(author, f_contents)
        d = f.readlines()
        f.seek(0)
        for i in d:
            if i != "f_contents":
                    f.write(i)
        f.truncate() ```
#

How do I make it so if the first cooldown is triggered users can’t use the second command either

#

correct me if im wrong but arent you just putting seperate cooldowns for each command

empty owl
#

how does one do categories

#

like usagi play smash 10

#

html

earnest phoenix
#

?

empty owl
#

discord.js

earnest phoenix
#

categories?

empty owl
#

I want to set a var to what they put in

#

like ban @mention 10d sssss

latent willow
#

Hi, maybe one of you has a idea (using discord.js on master branch):
so i try to show all server emotes in a embed description with:
.setDescription(message.guild.emojis.map(e => e.toString()).join(" "))
and most of the server it works perfectly (also here) and in one server i just get the emoji text surrounded by : - and i am running out of ideas why that could be FeelsThinkingMan

thank you for advice

earnest phoenix
#

you mean arguments?

empty owl
#

yeah

earnest phoenix
#

uh

empty owl
#

nvm

#

do I have to do listeners for each one>

earnest phoenix
#

having event listeners for every command is stupid

#

@brittle nova

brittle nova
#

haha

earnest phoenix
#

Does anyone know how to get a .js bot to send yt notifications like not a webhook sending it but the bot itself

inner jewel
#

@latent willow does the bot have permission to use external emotes?

latent willow
#

the role has admin + external emote permission yes
it actually has more permissions than in my own server (where the embed shows correctly) - just in his server there are only the emote names

earnest phoenix
#

yt notifs?

#

Yea

latent willow
#

at nathan : oh with a eval on my server on the bot answer (message.content) i get the format <:name:id> and on his only :name: it confuses me

inner jewel
#

any animated emojis?

latent willow
#

yes some but here aswell and it works perfectly FeelsThinkingMan

empty owl
#

@inner jewel But they have to get the id

inner jewel
#

what

empty owl
#

the bot

latent willow
#

for example here in this server i get <:name:id>
and in his just :name:

inner jewel
#

any managed emote?

latent willow
#

what do you mean by that ? (bot has the manage emoji perm on his server yes)

inner jewel
#

no

#

managed emojis

#

check the managed property

latent willow
#

i think i am dumb but i dont get it (theres no managed property on emojis on master)

boreal acorn
#

I got an error saying ffmpeg was not installed so i did sudo apt-get install ffmpeg and restart the bot and it removed the errror but its still not playing anything.

can someone help please??

im using ubuntu 18.04 and discord.js

and i did ffmpeg in console and it works, why will the bot not play

and if i have the bot on my windows pc it works 100% :/
tag me if you can

west raptor
#

oh that reminds me i need to install ffmpeg also ill help in a sec

earnest phoenix
#

@west raptor no u

boreal acorn
#

ok ty @west raptor

west raptor
#

Ok so, what's your code atm?

topaz fjord
#

solution: don't use ffmpeg

west raptor
#

shut turtle

topaz fjord
#

I'm not lying

earnest phoenix
#

alright so it's still at 10k

west raptor
#

i know

earnest phoenix
#

:[

boreal acorn
#

my music code 100% works on my pc with ffmpeg but on my vps ffmpeg it does not

topaz fjord
#

LL is pretty easy

#

to set up

west raptor
#

@boreal acorn Code please

#

Like how are you playing the video etc

#

Or audio

boreal acorn
topaz fjord
#

ffmpeg doesn't work on a raspberry pi

#

it's something with the cpu

boreal acorn
#

its at the end i believe dream

inner jewel
#

well

#

neither does LL

topaz fjord
#

it doesn't?

inner jewel
#

unless you're using an old build, no

topaz fjord
#

does the cpu not support it or smth

#

or is it software

inner jewel
#

no arm binaries for jda-nas

topaz fjord
#

I see

#

Natan

inner jewel
#

no one bothered compiling it for arm

west raptor
#

@boreal acorn Was this working before?

topaz fjord
#

Am thinking of getting a standalone server for my Lavalink

boreal acorn
#

yes it works when my bot is running on my pc

topaz fjord
#

what tier on galaxygate do you think would work

inner jewel
#

i'll just write my own thing tm

#

because i don't like LL's api

#

kinda annoying that it requires the ws connection

topaz fjord
#

so are you gonna make it all http?

inner jewel
#

probably mixed

topaz fjord
#

or all websocket

#

making it all websocket could be cool

inner jewel
#

LL is all websocket

#

only loadtracks isn't

topaz fjord
#

ok

#

so any idea on what tier should be able to keep LL alive

inner jewel
#

¯_(ツ)_/¯

#

depends on load

boreal acorn
#

ik its the vps and ffmpeg @west raptor i just do not know how to fix it

west raptor
boreal acorn
#

it gives no errors nothing just does not play

west raptor
#

Making sure your audio isn't muted

boreal acorn
#

its not and i had others join it they cant here anything but as i said it works 100% fully when i run my bot on my pc with ffmpeg

#

@west raptor any ideas?

west raptor
#

🤷

#

make sure you have ffmpeg installed

boreal acorn
#

is there a way to make it without ffmpeg?

west raptor
#

No

#

Unless u use lavalink

boreal acorn
#

hmm is there anything i need to enable in the ffmpeg?

west raptor
#

Not that I know of

boreal acorn
#

are you on ubuntu?

west raptor
#

Nope, I'm on arch right now

boreal acorn
#

:/ is where anything you need to install with ffmpeg?

west raptor
#

I'm pretty sure apt-get gets all libs and packages it needs

boreal acorn
#

:/

#

i just looked it up and i think ffmpeg was ment to install into /usr/local/share/ and /usr/bin/ but i only found it in /usr/bin/

west raptor
#

not in /usr/local/share for me either

boreal acorn
#

:/

#

i think i found something on the ffmpeg forms im trying it now

#

would you need to restart the vps after installing it?

west raptor
#

No it should work out of the box I dont know why it isnt working thonk1

boreal acorn
west raptor
#

I guess you could try restarting I doubt you would need to though

boreal acorn
#

shrugkitty doing it rn

topaz fjord
#

I think yt is dying

boreal acorn
#

@west raptor no work

#

and para its just you

west raptor
topaz fjord
#

I mean

#

lavalink is dying

west raptor
#

oh lol

boreal acorn
#

ffmpeg works with ubuntu 18.04 correct?

west raptor
#

yes

#

it should

#

also

#

your regex for playlist is a bit out of date

#

let me see if i can find the new

boreal acorn
#

ik once i get ffmpeg working il remake it shrugkitty

west raptor
#

/^.*(youtu.be\/|list=)([^#\&\?]*).*/ here ya go

topaz fjord
#

/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/

west raptor
#

or that

boreal acorn
#

ye ik

topaz fjord
boreal acorn
#

i just want ffmpeg to work it works fine on my pc but not on my ubuntu vps :/

west raptor
#

@topaz fjord also i dont really know regex but wouldnt that not work if its list=

topaz fjord
#

thats where | comes in

west raptor
#

what

#

where

boreal acorn
#

dream is your os like ubuntu?

#

and is it on ovh?

topaz fjord
#

/^https?:\/\/(www.youtube.com|youtube.com)\/(playlist|list)(.*)$/

#

thats what I mean dream

west raptor
#

this is on my personal computer lol @boreal acorn

#

ah ok

boreal acorn
#

xD

west raptor
#

also im on arch and thats pretty different from ubuntu afaik

#

most commands will be the same though

boreal acorn
#

:/

#

is there anything else besides ffmpeg and lavalink?

inner jewel
#

no

#

technically yes but not actively maintained

boreal acorn
#

if i wanted to move to lavalink what would i need to change, update

west raptor
#

what you need to know is there

#

you will have to make a queue system yourself though