#development

1 messages ยท Page 518 of 1

boreal acorn
#

:/

earnest phoenix
#

10k

topaz fjord
#

imo using lavalink is easier than using ffmpeg for music

west raptor
#

^

topaz fjord
#

and the queue system isnt that hard

sick cloud
#

i found lavalink harder

inner jewel
#

LL is less resource intensive than ffmpeg

topaz fjord
#

I ported over my queue system from ytdl to LL

west raptor
#

only issue i had with LL was multiple end events firing at once

#

other than that a lot easier

topaz fjord
#

I fixed my mem leak finally

boreal acorn
#

what os works best with ffmpeg?

west raptor
#

it doesnt really matter

#

afaik

#

aslong as its a stable os it should handle it

#

and ubuntu is pretty stable so

boreal acorn
#

yah just do not know why its not working i tried reinstalling it 3 times to see if it was the os

sick cloud
#

read the error ๐Ÿ‘

west raptor
#

also when you said it should be in /usr/local/share its not in there so thats might be outdated

#

where you got that info from might be outdated*

boreal acorn
#

ffmpeg forms

west raptor
#

yea i know

boreal acorn
#

:c

west raptor
#

how long ago was the post

boreal acorn
#

no idea

#

i left page

inner jewel
west raptor
inner jewel
#

not just you

west raptor
#

could that be @boreal acorn issue also

#

or

#

what

boreal acorn
#

no cuz i just tried on my pc and it worked

#

but on my vps no work :c

earnest phoenix
#

So update: 8k now, and still posting shards. I've changed it so it posts the amount of guilds each shard has

#

IT's supposed to be displaying 3k, instead it's 8k

sick cloud
#

canvas hates me

earnest phoenix
#

lmao wtf

west raptor
#

lol

sick cloud
#
await ctx.send(`Aww.. **${user1.username}** and **${user2.username}** are perfect together!!`, { buffer: c, name: 'ship.png' });

okay why does Eris throw this error

    at actualCall (/home/tony/Bots/Kyri/node_modules/eris/lib/rest/RequestHandler.js:120:35)
    at SequentialBucket.check (/home/tony/Bots/Kyri/node_modules/eris/lib/util/SequentialBucket.js:69:28)
    at SequentialBucket.queue (/home/tony/Bots/Kyri/node_modules/eris/lib/util/SequentialBucket.js:36:14)
    at Promise (/home/tony/Bots/Kyri/node_modules/eris/lib/rest/RequestHandler.js:333:40)
    at new Promise (<anonymous>)
    at RequestHandler.request (/home/tony/Bots/Kyri/node_modules/eris/lib/rest/RequestHandler.js:71:16)
    at Kyri.createMessage (/home/tony/Bots/Kyri/node_modules/eris/lib/Client.js:1016:36)
    at TextChannel.createMessage (/home/tony/Bots/Kyri/node_modules/eris/lib/structures/TextChannel.js:156:72)
    at ShipCommand.run (/home/tony/Bots/Kyri/dir/commands/Fun/ship.js:50:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)```
i'm sure i haven't done anything wrong lol
keen drift
#

wots c

knotty steeple
#

so i am trying to use this bit of code

    let rowe;
    pool.query(`SELECT * FROM profiles WHERE userID = "${msg.author.id}"`, (err, row) => {
        if(err) throw err;
        rowe = row[0]
        return;
    })
``` but i always get `TypeError: Cannot read property '0' of undefined` anyone know why
#

pool is mysql.createPool()

earnest phoenix
#

row is undefined

knotty steeple
#

how

topaz fjord
#

log row u duck

knotty steeple
#

ur the duck

#

its undefined

#

also im getting Error: connect ECONNREFUSED 127.0.0.1:3306

keen drift
#

lmao

#

Maybe you should ensure the pool has one connection available before querying

knotty steeple
#

its been a while ok

brittle nova
#

how can I see if a member has a specific permission just from a permissions int? [nodejs]

ruby dust
#

you don't necessarily have to do that with permissions int, you can just check if the user has a specific permission or not

brittle nova
#

nonono

#

I'm making a dashboard and I don't want to get things from the main process when I don't need to

quartz kindle
#

convert it to binary

vestal cradle
#

I have a question

#

oh wait nvm

quartz kindle
#

example:

create invite + administrator = 9
(9).toString(2) = 1001

1 create invite = true
0 kick members = false
0 ban members = false
1 adminstrator = true
brittle nova
#

if(permissionsInt & permissionIntInQuestion)

quartz kindle
#
let perms = permissionInt.toString(2);
if(perms[indexofpermissioninquestion])```
empty owl
#

How would one do multiple commands under one client.on

topaz fjord
#

if statements

empty owl
#

like how where do i put it?

topaz fjord
#

in your message event

empty owl
#

ok

west raptor
#

else if, if or switch

empty owl
#

o

#
Client.on("message", async message => {
    if(!message.content.startsWith(prefix)) return
    if (message.channel.type === "dm") return;

        if(message.content.startsWith(prefix + "pings")){
        let role = message.guild.roles.find("name", "Important stuff ping");
        if (message.member.roles.some(r => ["Important stuff ping"].includes(r.name))) {
            let member = message.member;
            member.removeRole(role).catch(console.error);
            message.channel.send("Removed ping role")
        } else {
            let member = message.member;
            member.addRole(role).catch(console.error);
            message.channel.send("Gave ping role")
        }
    } else {
     if(message.content.startsWith(prefix + "ping")){
        message.channel.send(`Pong!(${Client.ping}ms)`);
    }
  
  }

});```
#

like that?

topaz fjord
#
Client.on("message", async message => {
    if(!message.content.startsWith(prefix)) return
    if (message.channel.type === "dm") return;

        if(message.content.startsWith(prefix + "pings")){
        let role = message.guild.roles.find("name", "Important stuff ping");
        if (message.member.roles.some(r => ["Important stuff ping"].includes(r.name))) {
            let member = message.member;
            member.removeRole(role).catch(console.error);
            message.channel.send("Removed ping role")
        } else {
            let member = message.member;
            member.addRole(role).catch(console.error);
            message.channel.send("Gave ping role")
        }
    }

     if(message.content.startsWith(prefix + "ping")){
        message.channel.send(`Pong!(${Client.ping}ms)`);
    }
});
empty owl
#

o

topaz fjord
#

you can do if statements after each other

empty owl
#

ok

topaz fjord
#

as long as the previous if statement is closed

empty owl
#

ok

knotty steeple
#

you shouldnt do this btw

topaz fjord
#

sam

#

shut

empty owl
#

why?

knotty steeple
#

no one wants 76 commands in 1 file

topaz fjord
#

^

#

usually people do a command handler

empty owl
#

ok

knotty steeple
#

or a framework but only use the command handler feature from it mmLol

#

tbh

#

just store commands in a map

empty owl
#

?

knotty steeple
#

store ur commands in this mmLol

#

or a discord.js collection

#

a collection is just an extended map

empty owl
#

ok

rapid citrus
#

> no one wants 76 commands in 1 file
I actually do a different style of separating commands definition, I split them into Command and Command Function.
Command class only contains the command name, description, conditional parameters and a command function object that has execute method.
Command Function contains the discord/bot function.

#

an example:

export const help = new BotCommand(
  "help",
  "Show all my command list.",
  false,
  false,
  Response.ChannelReply,
  10,
  helpFunction
);
west raptor
#

isnt export thing thing .. only in ts?

#

or am i just dumb

rapid citrus
#

yeah

topaz fjord
#

actually

#

no

west raptor
#

what

topaz fjord
#

it can be used in js

#

es7 tho

west raptor
#

hm

topaz fjord
#

or es6

#

idk

#

but you'll have to use babel to make it work

rapid citrus
#

es6

#

but just use typescript. its totally better than js

west raptor
#

no errors from vscode

rapid citrus
#

do you have eslint?

west raptor
#

uh nope

topaz fjord
#

when I try to run a file with node that has that it dont work

knotty steeple
#

ts is literally just compiled js

west raptor
#

havent had time to setup yet

topaz fjord
#

but im moving from js anyways

knotty steeple
#

and when you compile it

#

it turns to js

west raptor
#

we know @knotty steeple

rapid citrus
#

I know it samurai

knotty steeple
#

so stop using it

rapid citrus
#

and the correct term is Superset .

knotty steeple
#

ts is shit

rapid citrus
#

then why did google choose it for their angular framework?

west raptor
#

runtime error

rapid citrus
#

that's why start using typescript now.

west raptor
#

i do

#

lol

rapid citrus
#

in javascript it is very hard to work with types

#

like everything is typed as any, wtf?

west raptor
#

i actually havent installed typescript yet

#

let me do that now

#

while i think about it

topaz fjord
#

I like typed based assignment

rapid citrus
#

^

west raptor
#

i see a lot of people here at DBL hate ts

#

dont really understand why though

rapid citrus
#

in js you are not sure if this property exists in this object, because it is any

earnest phoenix
#

@knotty steeple lol. Typescript not not "compiled javascript"

topaz fjord
#

typescript is transpiled into js

earnest phoenix
#

javascript is interpreted at all levels

#

client and server

#

Turtle is correct.

#

And es6 modules are experimental in Node.js

knotty steeple
#

no lies

#

ts = compiled js kthxbye

earnest phoenix
#

You can enable them if you want to on node 10.11

#

I just said its not

#

wdym

#

javascript isn't compiled

knotty steeple
#

i just said it is

earnest phoenix
#

Well you're wrong

west raptor
#

samurai r u big dumb

#

listen to ur logic

#

typescript = compiled js

#

when

#

typescripts compiles to js

knotty steeple
#

how to tell when someone is joking

earnest phoenix
#

You can't because its a text channel

topaz fjord
#

wait

#

texl

#

how do you enable them

knotty steeple
#

well

#

emotes exist

empty owl
#

@neat grove

knotty steeple
#

i did use an mmlol

earnest phoenix
#
node filename.js --experimental-modules```
#

Though at this point, I don't really see a point for this ^

rapid citrus
#

I wonder why people loves any type.

earnest phoenix
#

Javascript is just a dynamic language. we live for the any type

rapid citrus
#

that's the reason why I use typescript.

earnest phoenix
#

Same here

#

I've switching my whole bot

rapid citrus
#

nice

earnest phoenix
#

Staring with the commands, then the api, then the website

rapid citrus
#

lol.

#

do you use angular?

earnest phoenix
#

angular? no...

topaz fjord
#

texl uses vue i think

earnest phoenix
#

Server side rendered Nuxt.js

#

so vue on the server

topaz fjord
#

I'm leaving js

earnest phoenix
#

On the server?

#

I assume

topaz fjord
#

am moving my bot to golang

earnest phoenix
#

Leaving JS on the client isn't an option

rapid citrus
#

leaving js is good, no matter where you will go next

topaz fjord
#

and them im gonna use react for my website

earnest phoenix
#

Golang doesn't run in chrome ๐Ÿ˜ƒ

topaz fjord
#

my bot will be in golang
my website will be made with react

earnest phoenix
#

Next.js? hopefully

topaz fjord
#

probs

rapid citrus
#

react typescript?

#

discord ui is made with react

topaz fjord
#

it is

#

so is hulu

earnest phoenix
#

Discord surprisingly is client side rendered

rapid citrus
#

react is faster than angular but I still love angular.

earnest phoenix
#

I guess for a big company like them, it doesn't make a difference

#

@rapid citrus Yes because react is simply a library. angular is a full on framework

west raptor
#

kkkk

#

oops

coral trellis
#
    sharder.broadcastEval(`(() => {
        const client = require('./../index.js');
        const Discord = require('discord.js');    
        const user = this.users.get('${userId}');
        if (user) {
            const embed = new Discord.MessageEmbed()
            .setTimestamp(new Date().getTime())
            .setAuthor("Shiro", client.user.displayAvatarURL())
            .setDescription("Thanks for voting")
            .setColor("#16a085")
            .setFooter(user.tag)
            user.send(embed)
        }
    })()`);
});
topaz fjord
#

yes

coral trellis
#

'displayAvatarURL' of undefined

#

Big yeet

earnest phoenix
#
  const client = require('./../index.js');```
#

What the heck..

#

Why

coral trellis
zealous veldt
#

lol

earnest phoenix
#

That's why

rapid citrus
#

please use ts

zealous veldt
#

ew

topaz fjord
#

displayAvatarURL isnt a method

empty owl
#

its get

topaz fjord
#

its a property

west raptor
#

@topaz fjord it is in master

empty owl
#

docs

coral trellis
#

Yes I am using Master

topaz fjord
#

oh

earnest phoenix
#

Still doesn't change the fact that he is referring to an undefined

#

either way

#

and why are you requiring the client from a file anyways...

#

You have the client bound tothis

coral trellis
#

Fax

#

I am an actual idiot

#

@earnest phoenix Thanks

#

I missed that part lmao

#

:(

earnest phoenix
#

Also, a broadcasteval isn't needed here

#

You can using client.users.fetch

#

call send on the returned user

coral trellis
#

Ah alright

earnest phoenix
#

catch a rejection if it fails

#

time to move to C++

empty owl
#

HEAllLPPPPPAPPAPAP

earnest phoenix
#

what

empty owl
#

is there a way to get daily memes like pls meme

#

discord.js

earnest phoenix
#

use the reddit api

empty owl
#

yeah thats really complicated lol

earnest phoenix
#

with something like random puppy or whatever its called

empty owl
#

ok

earnest phoenix
#

wait

topaz fjord
#

ew

earnest phoenix
#

its an option

#

idk

#

i don't actually use it

rapid citrus
#

why not make your own?

earnest phoenix
#

thats also an option

#

a much better option tbh

rapid citrus
#

I only make my own solutions if I can't find a suiting lib for it.

sinful lotus
#

or just make everything your own

#

my solution

zealous veldt
#

That isn't always the best idea

#

especially when it comes to security

empty owl
#
    if(!message.content.startsWith(prefix)) return 
    if(message.content.startsWith(prefix + "meme")){
    if (message.channel.type === "dm") return;
      message.channel.send.randomPuppy('memes')```
#

this doesnt work ๐Ÿ˜ฆ

#

can some help me

earnest phoenix
#
  message.channel.send.randomPuppy('memes')```
zealous veldt
#

yeah, randomPuppy probably isn't a property of send

earnest phoenix
#

That is why.

#

No, don't use that

#

That's what is wrong

zealous veldt
#
<Message>.channel.send(randomPuppy('memes'));```
empty owl
#

ooof

#

ok

earnest phoenix
#

In .js is there a way to set the embed to something after its been identified

empty owl
#

idk

#

I need to do like ```js
randomPuppy('memes')
.then(url => {
const embed = new Discord.RichEmbed
message.channel.send(url);
})
}

});``` then set the title as the title of the reddit post

earnest phoenix
#

well for me im trying to do a rock paper scissors game but with an embed but the winner isnt declared untill after the embed is declared.

empty owl
#

lmao

#

im doing memes

earnest phoenix
#

lol

empty owl
#

HEALLLLp
SAd

#

a

zealous veldt
#

@earnest phoenix Yes, that's easy

#

embed.setTitle('Yeet');

earnest phoenix
#

oh, ok thanks

zealous veldt
#

No problem

earnest phoenix
#

is it possible for it to only change one field instead of all, for instance I have 3 fields and i only want to change the last one.

zealous veldt
#

Yes

#

oh

#

are you talking about editing the embed after you've sent it?

keen drift
#

Yeah

earnest phoenix
#

no, i put a const embed. and i want to change it before it sends

#

like im doing a rock paper scissors game and i want to update who won before the embed gets sent

zealous veldt
#

just don't declare that field yet

earnest phoenix
#

ok

fervent delta
#
  dbots.postStats(client.guilds.size)
      setInterval(() => {
        console.log('DBots guild count updated.');
        }, 1800000);```
#

does this code send stats to dbots every x mins?

#

or do i need to shift the poststats inside setInterval?

bright spear
#

That will only send once

fervent delta
#

should i shift the post statement inside?

bright spear
#

You don't need to use post stats if you include the client in the new DBL

fervent delta
#

i got this:

#

const DBL = require('dblapi.js')
const dbots = new DBL(process.env.DBL, {webhookServer: server }, client);

#

and server is the one in PINS

bright spear
#

You don't even need to use post stats

#

It will auto post every 30 mins since you are including the client

#

Also the pins don't mention a webhook server, that's for if you already are using an Express or other node server and you want to use webhooks to handle votes

fervent delta
#

yep an express

#

server

bright spear
#

Well just delete the poststats code and the setinterval

fervent delta
#

oh ok

lethal sun
#

Can someone help me with this? The embed doesent want to send, but it logs "sent." in the console.

rows.forEach(function (row) { 
							 const embed = new Discord.RichEmbed()
								.setTitle(msg.author.username + "'s wallet")
								.setAuthor(msg.author.tag, msg.author.avatar)
								.setColor(7506394)
								.setFooter(msg.author.tag, msg.author.avatar)
								.setImage(msg.author.avatar)
								.addField("Balance:", row.money, true)
								.addField("Bank:", row.bank, true)
								.addBlankField(true)
								.addField("Daily", row.daily, true);
							msg.channel.send({embed});
						})
						console.log('sent.')```
knotty steeple
#

wtf is that indenting

lethal sun
#

i just copied it from my code

rapid citrus
#

try logging the sent in then(()=>{}) method.

#
msg.channel.send(embed).then(()=>{
    console.log('sent.');
});
knotty steeple
#

or

jagged plume
#

thats not achieving anything, if the message isnt sending then the promise wont resolve

lethal sun
#

yeah

jagged plume
#

rows might be empty.

knotty steeple
#

tho im evaling it and it wont send either

lethal sun
#

really?

knotty steeple
lethal sun
#

maybe its the api?

jagged plume
#

try it without the blank field

#

might be broken

knotty steeple
#

i removed it still doesnt work for me

jagged plume
#

also you might wanna use .avatarURL iirc

#

.avatar is the ID, not the full url

#

afaik

lethal sun
#

hm

knotty steeple
#

maybe thats it

#

yep

lethal sun
#

@knotty steeple can you eval it?

knotty steeple
#

i did

#

use avatarURL instead of avatar

rapid citrus
#

^

jagged plume
#

guess it doesnt send if its an invalid url

rapid citrus
#

but wouldn't it log an error?

jagged plume
#

it might have been rejecting the promise but it wasnt being caught

rapid citrus
#

yeah, uncaught promise rejection must be on the console.

lethal sun
#

eh. thanks anyways

rapid citrus
#

its fixed?

lethal sun
#

doesent want to send

#

even with one field

rapid citrus
#
msg.author.avatarUrl

how about using this.

lethal sun
#

its .avatarURL

#

i logged it in the console

rapid citrus
#

it doesn't have any errors?

lethal sun
#

nope

rapid citrus
#

how about the row value? does it really have value? try logging it to console.

jagged plume
#

yeah I was gonna say that it could be empty

rapid citrus
#

and maybe you are being rate limited because the send code is inside a foreach block.

hushed berry
mossy vine
#

how did this even happen

west raptor
#

uh

#

what terminal

#

is that

#

@hushed berry

#

it might be the terminal

west raptor
#

Ok dont answer me then

queen sentinel
#

@hushed berry come here and answer Dream this minute

west raptor
#

Literally

#

Still hadn't answered me

#

Hasnt*

queen sentinel
#

Actual disrespect

earnest phoenix
#

Does anyone one know of any good js packages for adding filters to images

tight heath
#

imagemagick would be possible if you know how to work with it

#

and for basic image manipulation canvas ft. canvas-constructor

#

though js isn't really built for image manipulation stuff

sonic glade
#

Can I use a require in discord.js to make me run a discord.py file?

#

2 API bot ..

tight heath
#

no?

sonic glade
#

idk

tight heath
#

require works with node-modules, .js files, and .json configs.

sonic glade
#

an import?

tight heath
#

import = require but fancier

sonic glade
#

hmm

#

Then I would have to do a .py code to .js?

quartz kindle
#

either recode from py to js, or call the py program from your js

dreamy goblet
#

I didn't realize but i've sent stats to dbl with my dev bot. Do you think dbl staff will punish me for that ? ๐Ÿ˜’

quartz kindle
#

nah

#

unless you sent stupid numbers like 9376465983795

dreamy goblet
#

No, i sent 2 instead of my bot server count xD

quartz kindle
#

xD

dreamy goblet
#

I was like, Uh, how is this possible, why my bot is only on two servers. My heartrate goes very high at this moment x)

quartz kindle
#

taste the fear

dreamy goblet
#

Wait. if i instantiate the DBL object, does my bot send automatically stats ? (Javascript)

earnest phoenix
#

How i can make my bot send a message when its added

#

to the server it was added?

quartz kindle
#

idk ron

#

and jesus, use the guildcreate event

earnest phoenix
#

i do

quartz kindle
#

then you should know what to do, or are you having trouble with it?

earnest phoenix
#

For some reason I executed chmod 0775 -R * and after that everything messed up and now I can't access anything on server nor connect to it
I can login through VNC, Any suggestions on how to revert back the changes and fix the stuff?

hushed berry
#

reinstall the os? ๐Ÿคท

earnest phoenix
#

Do you even understand what you did?

split dune
#

@hushed berry your os* is bugged xd

hushed berry
#

@split dune what

#

what system

split dune
#

oh sorry os

knotty steeple
earnest phoenix
#

how to show code pls th

topaz fjord
#

When using regex

#

How can I make it ignore spaces

knotty steeple
#

oh looks like i fixed my issue

#

just remove .trim()

#

wew

earnest phoenix
#

anyone know why emojis won't work in embeds

#

they used to work

#

that happens now

#

are you using .toString?

#

hmm?

#

uh

#

what language is it

#

js

#

code?

knotty steeple
#

are they animated

earnest phoenix
#

no

#

ye use

knotty steeple
#

dont escape it

earnest phoenix
#

.toString()

#

if I don't escape it

#

then

#

send the full line here

#

kk

#

that line

#
.addField(`Emojis [${context.message.guild.emojis.size}]`, context.message.guild.emojis.map((emoji: Emoji) => `<\\:${emoji.name}\\:${emoji.id}>`).join(" ").substr(0, 1024))
knotty steeple
#

it only happens with emojis same name as discord ones

earnest phoenix
#

it happens for all

#

for me

#

lol

#

I mean true but

#

what IF they have the same name

#

are you using discord.js?

#

yea

#

stable or master

#

1s

#

stable I believe

#

wait try this code

knotty steeple
#

that aint stable

#

stable is 11.4.2

earnest phoenix
#

let me try updating

#

it should update automatically

#

still

#

maybe they don't work as field values?

quartz kindle
#

that is stable

#

just outdated

earnest phoenix
#

ye

knotty steeple
#

how would i remake .tag in eris

#

but js user = new (require("../src/index").FurryUser)(msg.author, bot) msg.author.createMessage(user.tag) this isnt good how do i add it to msg.author and other user stuff

#

xd

earnest phoenix
#

I've no close what you are asking.

knotty steeple
#

ok thats nice

#

read what i asked first

west raptor
#

You can't afaik if FurryUser extends user and in eris user has the tag property, possibly reassign it?

topaz fjord
#

The reason your bot won't work is because furries are bad

brittle nova
west raptor
#

what

knotty steeple
#

lmao

brittle nova
#

you want tag, no?

knotty steeple
#

yes

#

but i dont want to have to use a module just for a tag

#

@topaz fjord GWqlabsThinkBan

brittle nova
#

do it yourself then lol

knotty steeple
#

well im asking how

#

wtf

west raptor
#

@knotty steeple assuming you want it to be custom just reassign it by i guess this.thing = thing

sick cloud
#

i did this before

#

no

west raptor
#

ok

sick cloud
#

you need a getter

west raptor
sick cloud
#

yukine explained this to me lol

knotty steeple
#
    get tag() {
        return `${this.username}#${this.discriminator}`
    }
sick cloud
#

yeah

#

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

this is how i do mine

#

adds tags to all users

knotty steeple
#

finna gonna do that

sick cloud
#

ok

knotty steeple
#

ok that works

#

thank

sick cloud
#

np

steady egret
#

Someone can send how i do is show me what my ping on discord !ping (python)

west raptor
#

You can't show your discord ping but you can show your bot's ping

steady egret
#

Ho ok you can send me how if you can?

visual zenith
#

how to make bot dm someone using their id?

west raptor
#

@visual zenith lib?

knotty steeple
#

get the user

visual zenith
#

lib?

west raptor
#

yes

knotty steeple
#

then send a message

visual zenith
#

discord.js

west raptor
#

like

knotty steeple
#

library

west raptor
#

ok

knotty steeple
#

discord.js

west raptor
#

hold on

visual zenith
#

discord.js

knotty steeple
#

eris

#

ok

visual zenith
#

not eris lmao

#

just discord.js

knotty steeple
#

you know how to get a user

visual zenith
#

whats the difference between discord.js and eris?

knotty steeple
#

check pins

west raptor
visual zenith
#

oh

#

how to convert discord.js code to eris ??

west raptor
#

you dont

visual zenith
#

rip i gotta remake it then

west raptor
#

why

quartz kindle
#

discord.js and eris are two different libraries, like chrome and firefox

#

chose one

#

you dont need both

visual zenith
#

ig ima use discord.js becuz i already know how to use it

quartz kindle
#

good

#

also, if you're sending their own user id, not someone else's user id, you dont need to .get it

#

just get it from the message object

visual zenith
#

๐Ÿค”

west raptor
#

like

knotty steeple
#

msg.author

west raptor
#

lets say you want to send to the message author

sick cloud
#
       const user1 = client.u.parse(client, ctx.args[0]);
        let user2 = ctx.args[1] ? client.u.parse(client, ctx.args[1]) : ctx.author;

        if (!user1 || !user2) return ctx.send(locale.no_users_found); 

        if (user1 == user2 || user2 == user1) return ctx.send(locale.cant_ship_self);

        const m = await ctx.send(locale.shipping.replace('{{user1}}', user1.username).replace('{{user2}}', user2.username));
#

its supposed to set user2 as the msg author

visual zenith
#
```???
#

wait what lib is it? @sick cloud

sick cloud
#

eris

visual zenith
#

dont listen to me lmao

#

wait for another person

sick cloud
#

ok

quartz kindle
#

well ctx.author is undefined, is ctx your msg?

sick cloud
#

i worked it out, turns out i forgot ctx.author was an object with user/member

#

lol

#

i customly made ctx to benefit myself since eris is a pain

empty owl
#

how do u do a cool down discord.js

west raptor
#

wait

#

no

#

hold on

inner jewel
#

with a rate limiter

#

and limit of 1

west raptor
#

wait

#

yes

#

ok

empty owl
#

ok

empty owl
#

HEAlllp

#

this is killing me

#

(node:3458) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message

at item.request.gen.end (/rbd/pnpm-volume/0bf93457-01e6-4b5a-ab05-cd0ed5739e31/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)

at then (/rbd/pnpm-volume/0bf93457-01e6-4b5a-ab05-cd0ed5739e31/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

at <anonymous>

at process._tickCallback (internal/process/next_tick.js:189:7)

(node:3458) 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: 4)

#

oops forgot the js thing

bright spear
#

You're trying to send an empty message as it says

empty owl
#

yeah but I only send ({embed})

#
           if (command === 'botinfo'){
          const embed = new Discord.RichEmbed()
            .setAuthor("Bot created by: bobthemoose#2065")
            .setTitle("Bot Information")
            .setDescription('Bot created on `11/9/18`')
            .addField(':ping_pong:Ping', `${Client.ping}`, true)
            .addField(':shield:Guilds', `${Client.guilds.size}`, true)
            .addBlankField(true)
            .addField('Updates', 'This bot has recently been updated! Do `usagi updates` to check it out!')
          message.channel.send({embed});
           }```
#

thats my code

west raptor
#

message.channel.send(embed);?

#

idk

empty owl
#

How do u vote lock a command

rapid citrus
#

lol, what is vote lock? I have no idea on what it is.

empty owl
#

when u have to vote in order to gain access to a comman

#

d

rapid citrus
#

oh.

#

are using the DBL api?

#

I think you need to use a webhook.

topaz fjord
#

you use the api to check if the person has voted
if they havent tell them they have to vote to use the command

#

I use a webhook and store the user in the db

rapid citrus
#

^

topaz fjord
#

if they are in the db, I update their doc

rapid citrus
#

what is doc?

#

document?

topaz fjord
#

yes

rapid citrus
#

mongodb?

#

or firebase?

topaz fjord
#

mongo

rapid citrus
#

same

#

mlab?

#

or atlas?

topaz fjord
#

self

rapid citrus
#

oh I was about to type or self? , lol

empty owl
#

how does one access mongodb cluster node.js

#

^ping me

topaz fjord
#

wdym

empty owl
#

like store info and stuff

topaz fjord
#

you can either download mongodb and run it on your side or use a cloud stored on

empty owl
#

What

#

I npm installed Moho

#

mongo

#

And got a cluster

topaz fjord
#

you need to install the database as well

empty owl
#

How?

empty owl
#

Thanks

rapid citrus
#

also, note that: mongodb is not the only option. @empty owl .

topaz fjord
#

^

rapid citrus
#

but I prefer it based on experience.

topaz fjord
#

sql is nice

#

its just I like the way mdb stores docs

rapid citrus
#

yep, but I hate queries, like : insert into shits, delete from shits where shitId=999

empty owl
#

what about json

rapid citrus
#

kek

slender thistle
#

mongodb > *

rapid citrus
#

I use json for response and request but not as a storage.

jagged minnow
#

me 2

topaz fjord
#

no shit

#

we can see that

#

thanks captain obvious

#

lmao

#

@coral trellis weeb

#

it took you that long to type stupid bloblul

coral trellis
#

Thanks

topaz fjord
keen drift
#

Discord is always broken

sonic badge
#

Hey, could someone help me real quick? I just updated my bot's HTML section on its page and added buttons that manage simple collapsible fields, everything worked in the "preview" interface, but after I submitted my edits, the buttons' OnClick events no longer work, I'm not sure what to do, now.

rapid citrus
#

onClick
I think javascript is only supported for Certified Bots.

noble lily
#

oops its down

sonic badge
#

oh...

#

well, alright then

#

no javascript, it is, then

#

ty

visual zenith
#

How to make a rpg discord bot using discord.js???

#

I cant find a tutorial to do so

earnest phoenix
#

step 1: think of a rpg theme
step 2: make a bunch of message events for each rpg command
step 3: beta test with 10 people
step 4: add bot to dbl

rapid citrus
#

you don't need a tutorial for everything.

#

tutorials are just a starting point

earnest phoenix
#

no but in al seriousness just get a theme

#

and code a bunch of commands related with the theme

visual zenith
#

what type of theme?

earnest phoenix
#

that depends on you

rapid citrus
#

> beta test with 10 people
10 is not enough.

earnest phoenix
#

you're right
beta test with 11 people

rapid citrus
#

^

#

you are the 11th

earnest phoenix
#

tbh the only tutorial you'd need is how to make commands if you're beginning

#

otherwise tutorials do nothing

visual zenith
#

xD ok ig

earnest phoenix
#
    hasVoted(user) {
        let snekfetch = require("snekfetch");
        let a = snekfetch()
            .get(`https://discordbots.org/api/bots/${this.bot.user.id}/check`, {
                userID: user,
            })
            .set("Authorization", this.getSecrets().dblToken);
        return a;
    },```
#

am i doing this right

jagged plume
#

snekfetch is deperecated

#

but yes that looks correct

rapid citrus
#

use request or request promise.

jagged plume
#

or node-fetch, or superagent

earnest phoenix
#

ok

rapid citrus
#

I haven't use node-fetch, I need to try it,

jagged plume
#

oh wait

#

it's userId not userID afaik

#

and theres no req body

rapid citrus
#

userId

jagged plume
#

its just ?userId=id

visual zenith
#

question. How come @earnest phoenix has the Muted role?

sinful lotus
#
function stuff() {
  promise1().then(() => promise2().then(() => console.log));
}
async function stuff() {
  await promise1();
  const q = await promise2();
  console.log(q);
}

@crisp lodge here

crisp lodge
#

@sinful lotus โค

languid dragon
#

Promise.all([array, of, promises]).then(allTheResults => {}).catch(anyError => {})

not related but useful

empty owl
#

@visual zenith Your bot has an error. Maybe it responds to other bots. Go to #mod-logs and ctrl f ur bot username. You have to fix it then tell a mod that u fixed.

visual zenith
#

I fixed it like a long time ago lmao

#

which mod?

jagged plume
#

you'll need to contact a different mod

knotty steeple
#
    require("request").get("https://sheri.fun/api/v2/boop", {form: {"key": bot.config.sheriToken}}, (err, res) => {
        if(err) {
            msg.channel.send(`An error has occurred! Try again later, and report this error to ${bot.users.get("439373663905513473").tag}.`)
            new (require("cat-loggr"))().error(err)
            return;
        }

        msg.channel.createMessage({embed: {
            color: 0x0,
            description: bot.response("boop", msg.author.username, mention[0].username),
            image: {
                url: JSON.parse(res.body).url
            }
        }}) 
    })
``` whenever i run this command there is no image..?
sinful lotus
#

console.log res.body and see if it returns something

#

if it isnt then the request maybe failing

knotty steeple
#

it says im unauthorized?

crisp lodge
#

A little help here. lirikTHUMP

#

Why doesn't this work..? (I use discord.js)

knotty steeple
#

learn how classes work

crisp lodge
#

I don't think my program works.. I did correct the first time.. But gives me this "error". 'types' can only be used in a .ts file.

topaz fjord
#

are you in a .TS file

crisp lodge
#

It's wrong code

topaz fjord
#

and like the error says, you can do type based definition without being in a typescript file

crisp lodge
#

I really don't know how classes works in js. tableflip

topaz fjord
#

well if you show code we can help

quartz kindle
#

just remove the type definitions

topaz fjord
#

and that error has nothing to do with classes

quartz kindle
#

you're trying to code typescript in a javascript file

crisp lodge
#

`class Nutty {

var a;

constructor(test){
    a = test;
}

}`

topaz fjord
#

what's the error

crisp lodge
#

Unexpected token. A constructor, method, accessor, or property was expected.

#

Stupid.. Language. AHHH ๐Ÿ˜ก

jagged plume
#

isnt it just this.a = something

topaz fjord
#

^

jagged plume
#

never forget this. mmLol

topaz fjord
#

also you don't need to define a outside of the constructor

#

just use this.a and it will define it for you

crisp lodge
#

Ugh. this dot. Forgot that thing, still the same error though.

#

The error is on var a;

jagged plume
#

remove it

topaz fjord
jagged plume
#

dont need to var a; outside the constructor

topaz fjord
#

^

crisp lodge
#

What is this fucked up language tableflip

jagged plume
#

this.a, this.b, etc all declare them for you

topaz fjord
#

this.a will make a variable called a and bring it to this

crisp lodge
#

Thanks for the help guys. ๐Ÿ˜

topaz fjord
#

it's not the language that's fucked, it's your understanding of it

crisp lodge
#

True.. It's so dynamic. It's disgusting.

jagged plume
#

so dont use it

#

lol

topaz fjord
#

what language are you coming from

crisp lodge
#

C#

topaz fjord
#

why switch ๐Ÿ‘€

#

I'm trying to get away from js rn

crisp lodge
#

And no, i don't want to pay for a cloud computing service.

topaz fjord
#

wut

crisp lodge
#

There's free services like heroku for js.

topaz fjord
#

no

crisp lodge
#

While there's only cloud cumputing for C# bots to be 24/7 available.

topaz fjord
#

Free hosting !== good hosting

quartz kindle
#

there's google's gce

crisp lodge
#

C# cannot be run on a "cloud", it has to be run on a machine running on a cloud.

topaz fjord
#

Google gce is nice I just haven't claimed mine

#

I could claim azure for 12 months free

crisp lodge
quartz kindle
#

i've been on gce for like 10 months now. its a full vps with ssh, root, etc..

#

havent paid a cent yet

crisp lodge
#

Does ports open automatically?

quartz kindle
#

no

crisp lodge
#

Or are they locked at all times

topaz fjord
#

I'm scared on going on gce bc of how discord kills it

quartz kindle
#

you have to open them

#

google compute engine

topaz fjord
#

well wouldn't it be gcp?

crisp lodge
#

I've heard digitalocean's good.

topaz fjord
#

Galaxy Gate is good ๐Ÿ‘Œ I think their cheapest plan is $3 dollars

inner jewel
#

DO sells vpses

#

so yes

topaz fjord
#

Gadget says people complain about the price bc they don't know how expensive unlimited bandwidth is

quartz kindle
#

discord.js by itself costs 8gb/month in data

topaz fjord
#

I think I've pushed 100 gigs

#

in like 3 months

quartz kindle
#

google doesnt offer unlimited bandwidth

topaz fjord
#

But rthym on GG uses 0.5PB

#

fuck I spelled it wrong

#

rythm

crisp lodge
#

Does Amazon AWS offer unlimited bandwidth?

knotty steeple
#

turns out i was using the wrong header

#

even though when you get a key it says use the key header GWqlabsNotLikeNoot

crisp lodge
topaz fjord
#

Why not Google if aws has unlimited bandwidth

crisp lodge
#

Because they're google, AKA greedy bastards.

west raptor
#

what

inner jewel
#

iirc aws has unlimited inbound

#

but outbound is paid

topaz fjord
#

Google greedy bastards

#

I think you're confusing apple with google

inner jewel
#

also unlimited bandwidth is expensive

crisp lodge
#

$3.5 / month ๐Ÿ‘€

#

Not expensive at all!

topaz fjord
#

$3 a month for GG mmLol

crisp lodge
#

AWS Free Tier includes 750 hours of Linux and Windows t2.micro instances each month for one year. To stay within the Free Tier, use only EC2 Micro instances. zoomeyes

#

wait, Netflix is a customer? thonkku

inner jewel
#

yes

#

the biggest

crisp lodge
#

oooo

#

Instantly subscribes

inner jewel
#

aws isn't very cheap tho

crisp lodge
#

Didn't read the price. ๐Ÿ‘€

#

Do i even dare?

topaz fjord
#

Is it aws with the flexible price or is that gcp

#

for the "pay for what you use"

crisp lodge
#

Yeah, i.. think it is pay for what you use

quartz kindle
#

everything in google is pay for what you use

crisp lodge
#

I mean AWS

amber junco
#

Can you make bots react to messages?

#

If you can, how do you

quartz kindle
#

which lib?

amber junco
#

whats lib?

knotty steeple
#

library

amber junco
#

oh

#

js

knotty steeple
#

thats a language

amber junco
#

ik

#

oh

#

wait

#

Can you give an exaple

#

Like node.js?

quartz kindle
knotty steeple
#

get out

amber junco
#

oh

#

ok

knotty steeple
#

deprecated af

amber junco
#

:sad:

zenith moss
amber junco
#

k

#

thanks @zenith moss

#

lmao

steady egret
#

What The Commnad i need to do for music bot

#

?

earnest phoenix
#

?

#

what language? what library?

#

and it's not just a "command" you need.

#

You need a sophisticated set of functions to stream music from a music source, whether that be youtube, spotify, etc

fervent delta
#

i was wondering if there is a timeout for commando commands like afteer say 10 seconds its execution will stop

inner jewel
#

there's no good way of implementing that type of thing

#

depending on lang/runtime it's either impossible or too dangerous

quartz kindle
#

it has to be function/command-specific and implemented at that level

earnest phoenix
sharp stag
#

@steady egrethi

#

any girl here??๐Ÿ˜Š ๐Ÿ˜Š

steady egret
#

Lol xD

languid dragon
#

@steady egret @sharp stag #development is not for relationship developments, please use another server or keep this in your DM's

steady egret
#

I dont want is say me

#

I dont know him

sharp stag
#

me too๐Ÿค๐Ÿค

forest heath
#

why @coarse carbon in my server offline ?

topaz fjord
#

If it's down in your server it's down for everyone

#

there's nothing you can do besides alert the dev

inner jewel
#

how are you creating your embed?

mossy vine
#

Probably because testvar is not a string

#

Write testvar.toString()

#

No

#

Message.author is an object containing many values

#

<@message.author.id> i assume thats what you want

#

Wait no

#

Im dumb

#

Hold up

#

<@${message.author.id}>

#

Argh

#

Hust put the entire thing in a `

#

So surround it with ``` characters

#

Argh

#

Just one

waxen quest
#

I think that the Embed format is the problem

#

One sec

smoky spire
#

you have to replace the quotes with the backticks

earnest phoenix
#

help

mossy vine
#

A variable youre using is not defined

earnest phoenix
#

I am assuming this means i have a very slow connection,right?

topaz fjord
#

what does

earnest phoenix
#

the error.

knotty steeple
#

no

#

he tried to use blanke but did not say what it is

earnest phoenix
#
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
(node:6832) 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: 2)
(node:6832) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.```
knotty steeple
#

slow connection would make it timeout

#

therefore exiting

earnest phoenix
#

now i got this,and there is no blanke in my code unless you are reffering to something else

knotty steeple
#

you didnt specify what error how am i supposed to know

earnest phoenix
#

and now it says ready

#

That is all i get when i do node myfile.js

quartz kindle
#

that means its working

earnest phoenix
#

w e l l

#
  1. how do i prevent it from happening in future?
#
  1. is it a serious error
mossy vine
#

do what the error tells you, add the .catch() to the line its referring to

#

and no i dont think so

quartz kindle
#

in the future, uncaught errors will terminate the program

mossy vine
#

"future"

quartz kindle
#

that means you need to have code to handle errors

mossy vine
#

people say "the future is now" but unhandled promise rejections still dont terminate the program

earnest phoenix
#

excuse me but i do not plan to die anytime soon

quartz kindle
#

you have been terminated

earnest phoenix
#

depends on how you define it

#

what should this error code contain?

mossy vine
#

we all saw that, and so did logs

#

but

#

i told you what you need to do

earnest phoenix
#

Ill look for help somewhere else...

mossy vine
#

dude

#

i told you what to do

earnest phoenix
#

you told me what the error says

#

i am not blind.

mossy vine
earnest phoenix
#

and?

#

w h a t is the line it is reffering to?

mossy vine
#
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)```
#

i dunno

#

maybe line 111 of internal/stream_base_commons.js

earnest phoenix
#

i do not think messing with node`s files is a good idea

mossy vine
#

im confused (โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

#

maybe maybe its something on line 6?

#

with the underlining

earnest phoenix
#

oh that

#

it says its not used anywhere,i do use it in config tho

mossy vine
#

ah nvm then

tight heath
#

The error

#

Is just a network blip

mossy vine
#

wait for someone smarter than me to respond

tight heath
#

Nothing code related

earnest phoenix
#

i thought so

#

it says errconect at some point so i thought it might be just that.

tight heath
#

If it keeps happening it might

latent willow
#

client.once ?

tight heath
#

But since it doesn't give any context

earnest phoenix
#

client.on

tight heath
#

@latent willow same as client.on, but runs only once

earnest phoenix
#

oh wait

latent willow
#

ahh gotya rave thanks didnt knew that

tight heath
#

Discord.js Client is an EventEmitter

earnest phoenix
#

I`ll look into it

tight heath
#

I`ll -> I'll?

#

Because that's a single quotation mark; or apostrophe

#

Looks better

earnest phoenix
#

yes. cannot find a proper keyboard,i switch through them a lot

tight heath
#

Oof

earnest phoenix
#

with the lang bar shortcut

tight heath
#

Well mine has it on shift+#

earnest phoenix
#

in my case it is ctrl + shift

#

is English United States (US)

tight heath
earnest phoenix
#

and there is same one but international

tight heath
#

okay

#

Well I obviously use my country's keyboard layout

earnest phoenix
#

but they both give # when shift + 3

tight heath
#

Because that's what I learned in kindergarten (!)

#

We had a PC there; anyways this is off topic

earnest phoenix
#

oH

#

whoops

tight heath
#

My bad.

earnest phoenix
#

help

#

(again)

#

my file has 171 lines

#

not 172

#

and i cant find

#

the error

queen sentinel
earnest phoenix
#

help

#

oh well

#

it was not that

queen sentinel
#

unless you have a different problem

earnest phoenix
#

is diferent

latent willow
#

looks like a missing closing bracket

earnest phoenix
#

but it saysd 172

#

when theres no code in that line

#

i cant find the bracket to

latent willow
earnest phoenix
#

but why 172

#

wlellp

#

ima find that brack

#

what does the entire error say

#

dis

topaz fjord
#

unexpected end of input means the code has a parenthesis or curly brace not closed

earnest phoenix
#

client.login(config.token);

#

is where the error is

topaz fjord
#

no

earnest phoenix
#

well compiler says that

topaz fjord
#

look around your code and make sure you closed every curly brace or parenthesis

#

compiler says that since its the end of the code, that doesn't necessarily mean the error is right there

earnest phoenix
#

the error aparently is here

#
  if(message.author.bot) return;
  if(message.content.indexOf(config.prefix) !== 0) return;
  const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
  const command = args.shift().toLowerCase();```
warm marsh
#

Nothing is wrong there.

earnest phoenix
#

ohw ell

#

i fixed it

#

i maked a {

#

and i didnt closed it

#

x2

warm marsh
#

Ah lol

earnest phoenix
#

@here some one can help me?

warm marsh
#

With?

earnest phoenix
#

ping

#

ok, so

@bot.command()
async def ping(ctx):
    return await ctx.send(bot.latency)

i want to edit this message and it will writen like this Pong! 22ms

warm marsh
#

ok

earnest phoenix
warm marsh
#
@bot.command()
async def ping(ctx):
    return await ctx.send("\`"+ bot.latency +"\`");```
#

Should work

earnest phoenix
#

ok 1 min

#

gb!ams

#

gb!ams

warm marsh
#

bots can't send in this chat

earnest phoenix
#

@warm marsh

#

oh

#

okj

warm marsh
#

Ah

#

I actually dont know any python so...

earnest phoenix
#

lol

warm marsh
#

But it looks like the error is something to do with data types

earnest phoenix
#

ok ty

#

If some can help with discord.py , so DM's me please.

#

@here

warm marsh
#

@ here doesnt work

earnest phoenix
#

@everyone

#

lol

knotty steeple
#

what

#

i python

earnest phoenix
#

oh

#

1 sec

#

ok, so

@bot.command()
async def ping(ctx):
    return await ctx.send(bot.latency)

i want to edit this message and it will writen like this Pong! 22ms