#development

1 messages · Page 405 of 1

royal plover
#

Where can I test

#

ah ok

#

Anyone knows why would msg.guild.owner.id be undefined whereas msg.guild.ownerID is not with discordjs

#

And only in this server

halcyon abyss
#

is msg.guild.owner undefined ?

earnest phoenix
#

hi

#

${msg.guild.owner.id}

#

So no one can help me??

austere meadow
#

msg.guild.owner is null if the owner is not cached

#

you can do msg.guild.fetchMember(msg.guild.ownerID) if you need to fetch the owner

royal plover
#

hm ok, I guess that explains it

earnest phoenix
#

I already checked the token.

#

It is fine.

heady zinc
#

it obviously isn't fine ZoomEyes

earnest phoenix
#

So you are saying the token is wrong???????

heady zinc
#

or the way you gave it to d.js is wrong

earnest phoenix
#

Probably.

#

@earnest phoenix if you want the owner id just do msg.guild.ownerID lol

#

??

#

It wasn't me that needed it.

#

And I needed something else not that.

halcyon abyss
#

did you install an set up dotenv ?

earnest phoenix
#

Yes.

#

I did npm i dotenv

#

Erm my bot.

#

IT DIED!!

toxic oracle
#

same

lament meteor
#

wat are you using to host ur bot?

#

also i think you just need to do
process.env.GOOGLE_API

lament meteor
#

tbh my npm module is actually pretty gud

fluid basin
#

@lament meteor maybe you should just add the other packages required for you module as dependencies so they don't need to install them one by one xD

lament meteor
#

@fluid basin gud idea i will

fluid basin
#

And maybe use a class for you index.js

lament meteor
#

also sorry but i ran out of ideas on the msgs

#

as my bot uses the default msgs

#

aka @rough quest

fluid basin
#

moosages?

lament meteor
#

you can customize the addsong msg, play and loop

#

and it still needs fixing

#

if the queue is too long it wont fit the embed and error

fluid basin
#

¯_(ツ)_/¯

#

Tbh maybe I could make a modbot module

#

Just thinking

shy flicker
#

google it.

fluid basin
earnest phoenix
#

how do i make the dbl webhook for voting send a message to a channel saying Thanks for voting {vote.user}!

fluid basin
#

what library @earnest phoenix

earnest phoenix
#

discord.js

fluid basin
#

well

#

if you are using dblapi js it should be pretty easy

earnest phoenix
#

dbl.webhook.on('vote', vote => {
bot.channels.get('440847560190722058').send(Thanks ${vote.user}! just voted for jensbot!);
}); i tried this but it didnt do anything

fluid basin
#

for the webhooks

earnest phoenix
#

it didnt send the message to the channel

fluid basin
#

Hmm

#

Then that means you probably didn't setup the webhook properly

earnest phoenix
#

dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});

#

it did log that message ^

fluid basin
#

No I'm talking about the webhook connection

#

Like from DBL to you

earnest phoenix
#

??

fluid basin
#

Check if you set the link correctly over at DBL

earnest phoenix
#

where

fluid basin
#

Under your bot page at DBL and then click edit

#

then scroll down you'll see webhooks

earnest phoenix
#

oh shit i didnt even set a webhook

fluid basin
#

Yeah so for the url you put in the address of your server and the link from the console

#

And authorisation is the password you'll need to put in your DBL function

#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });

#

Then once its done you can test it out using the "Test" button on the bot page

earnest phoenix
#

i did the password

#

but why cant i change avatar icon on a webhook

fluid basin
#

?

earnest phoenix
#

its closing the picture choosing part but doesnt change the icon..

fluid basin
#

Are you referring to discord webhooks or DBL webhook??

earnest phoenix
#

ok finally i got the discord webhook to change icon

#

so what do i do for doing the webhook now

floral stone
#

@earnest phoenix no u

earnest phoenix
#

@fluid basin

fluid basin
#

? wot

earnest phoenix
#

i got the webhook url..

#

what do i do now

fluid basin
#

Its supposed to be the link in the console

#

...

earnest phoenix
#

um

#

ok

#

Webhook running at http://********/dblwebhook

#

so this link

fluid basin
#

Make sure also you have port forwarded the port

earnest phoenix
#

port forwarded? why..

fluid basin
#

should be <something>:<port>

earnest phoenix
#

im not gonna port forward my raspberry pi ;c

fluid basin
#

Cuz it doesn't work if it ain't port forwarded

#

¯_(ツ)_/¯

earnest phoenix
#

stupid api..

fluid basin
#

It is how webhooks work... unavoidable unless you don't use webhooks

#

Users vote for bot -> DBL sends a request to your server(webhook) -> you receive the webhook -> process vote

#

Like basically when you start the bot it gives you an url, yeah basically DBL will access that url and pass you vote information when someone has voted

karmic parcel
#

I thought about adding support for my webhook service but it would probably get too much traffic

fluid basin
karmic parcel
#

It'd probably get more traffic than I'm willing to pay out of pocket to support

fluid basin
#

Thonk why though

karmic parcel
#

You mean why would it get too much traffic?

fluid basin
#

unless you're getting more than hundred votes a day

karmic parcel
#

My webhook service

#

as meaning allowing DBL webhooks to go through my service, so anyone can set it up. So sure, it'd handle smaller bots, but let's say I use it for Dank Memer, and some bigger bots that get a lot of votes

#

and then more bots

#

not worth for me to support imo

fluid basin
#

rip

#

time to get unlimited bandwidth

karmic parcel
#

bandwidth wouldn't be an issue I don't thinkt

#

the webhooks aren't large

prime cliff
#

Yea but DBL webhooks like to be funky sometimes

fluid basin
#

¯_(ツ)_/¯

mental solstice
#

@earnest phoenix do u have a website?

earnest phoenix
#

no

mental solstice
#

what do u need the webhook to say?

earnest phoenix
#

Thanks {the voted user} for voting!

mental solstice
#

the webhook only passes userid.. botid.. type.. and query

#

i can set you up, so the webhook sends just the userid to a private room, then your bot can get the message.content and send it to a user

fluid basin
#

yeah which is why you need to setup the webhook server

#

or use some other method

mental solstice
#

i tried a few different ways, couldnt get it to work, so i just used the php method

earnest phoenix
#

My bot dead help me out.

mental solstice
#

tragic mainframe pileup?

earnest phoenix
#

tragic

mental solstice
#

yes careful traveling the interweb at highspeed, wouldnt want to crash the bus

#

nah jk.. what happened

earnest phoenix
#

ok so i cleared 49/50 open ports on my router

#

all were not valid

#

so how do i do the vote

#

thing

#

the dbl.webhook.on('vote'

#

@fluid basin

#

i putted in the http://****/dblwebhook

#

into my bot's edit

#

didnt do anythng

#

@mental solstice

mental solstice
#

I couldnt get it to work for me. So i used the php method, had the userid sent to a channel, and had my bot grab the id and message the user

earnest phoenix
#

but i cant get it to send a message on the vote event

#

;-;

#

dbl.webhook.on('vote', vote => {
this thing

#

doesnt

#

do

#

shit

#

i want it to send a hook like

lament meteor
#

wat u mean

earnest phoenix
#

"Thanks A guy named Jens#9759 (in id) for voting!"

lament meteor
#

u have to use the webhook

earnest phoenix
#

i did

lament meteor
#

the one on ur bot page

earnest phoenix
#
const dbl = new DBL(key, { webhookPort: 5000, webhookAuth: **** }, bot);
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
    bot.channels.get('440847560190722058').send(`User with ID ${vote.user} just voted!`);
});```
#

i did this

#

as said on the site

lament meteor
#

do you have.... the link in ur bot page?

earnest phoenix
#

the logged link at dbl ready event?

#

yes

#

@lament meteor

lament meteor
#

the webhook link

earnest phoenix
#

of the discord channel yes

lament meteor
#

discord channel?

earnest phoenix
#

i also tried that "webhook running at" link

lament meteor
#

not a discord webhook 🤦

earnest phoenix
#

didnt work for both

#

@lament meteor

lament meteor
#

did you put a link for a discord webhook?

#

or ur own site

mental solstice
#

No.. discord webhook is not used for this

earnest phoenix
#

own site?

#

???

#

this link

#

over here

#

it logged

mental solstice
#

Webhook goes directly to your bot server

earnest phoenix
#

0|jb | Webhook running at http://*****:500/dblwebhook

#

wierd

#

link glitches

#

but k

karmic parcel
#

goes to whatever the webhook URL is

earnest phoenix
#

??

karmic parcel
#

not necessarily the bot server

earnest phoenix
#

i did the link it logged

#

doesnt do SHIT

karmic parcel
#

when you set up a webhook, it sends a POST request to the webhook URL

#

wherever that is

lament meteor
#

can you stop a for loop in js?

earnest phoenix
#

??????????

#

i never used webhooks..

lament meteor
#

cause ik you can stop a setInterval

earnest phoenix
#

break

mental solstice
#

Js equivalent of break?

#

Ob

earnest phoenix
#
const dbl = new DBL(key, { webhookPort: 5000, webhookAuth: ******** }, bot);
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
    bot.channels.get('440847560190722058').send(`User with ID ${vote.user} just voted!`);
});```
karmic parcel
#

Uh you'd have to set a condition for it to stop, you might be able to use break on it

earnest phoenix
#

i did this code

#

and

#

that vote event doesnt do anything

lament meteor
#

ah ok

earnest phoenix
#

i want that to do the webhook to my channel

karmic parcel
#

where is your bot hosted?

earnest phoenix
#

on my raspberry pi

karmic parcel
#

in your house?

earnest phoenix
#

yes, its forwarded

#

yes

karmic parcel
#

that's your issue

#

o

elder rapids
#

for loops use return to break .. i think?

earnest phoenix
#

i just forwarded it to port 5000 as the code did

mental solstice
#

Return will exit the current method

#

Function*

earnest phoenix
#

you can still break within a normal for loop

#

its just the foreach loops you cant break from

#

so what then @karmic parcel

elder rapids
#

Return won't exit the current method/function

#

I'm pretty sure I've used return to stop a for loop plenty times

uncut slate
#

which lang are you talking about

elder rapids
#

Unless I did use break Thonk

#

You know what I have no idea

#

I should probably go look at my code again to be sure

uncut slate
#

return puts an end to the current function, and if it's in a loop, that loop would end right there [in JS]

elder rapids
#

So return does end the for loop

#

k

uncut slate
#

yeah

elder rapids
#

I was right then

uncut slate
earnest phoenix
#

@karmic parcel ??

karmic parcel
#

what if it's not in afunction eyers

#

and uh, does the test thing work at all, Jens?

elder rapids
#

lol that out of context

earnest phoenix
#

nope

elder rapids
#

Totally don't confuse that

earnest phoenix
#

it says testing complete it could take a few seconds

uncut slate
#

ah, I didn't see @elder rapids

earnest phoenix
#

nothing goes to the channel

karmic parcel
#

do you get a vote event at all?

earnest phoenix
#

idk

karmic parcel
#

console.log the vote before you send it

earnest phoenix
#

do i need to get someone to vote my bot rn?

karmic parcel
#

no

elder rapids
#

testing works fine

karmic parcel
#

you can use the test function

#

that's the main reason why I suggested it lmao

earnest phoenix
#

nope

#

nothing

mental solstice
#

Jens dm me if u dont figure it out, ill host a php file that will send the users id to your discord webhook.

earnest phoenix
#

0.0.0.0:5000 is the url tho

karmic parcel
#

that's interesting

earnest phoenix
#

thats what it logs..'

elder rapids
#

Wait are you using 0.0.0.0 on DBL?

earnest phoenix
#

no

#

my pi logged that

elder rapids
#

ok just making sure 😂

earnest phoenix
#

¯_(ツ)_/¯

karmic parcel
#

does the lib not allow you to change? riperoni

earnest phoenix
#

idk?

elder rapids
#

0.0.0.0 is a bind all

karmic parcel
#

yeah

elder rapids
#

Shouldn't really matter

earnest phoenix
#

soooo

karmic parcel
#

but why not just use localhost?

earnest phoenix
#

it doesnt do anything on the "test"

#

button

karmic parcel
#

what's your bot?

earnest phoenix
#

jensbot

karmic parcel
#

make sure your thing is up

#

I'll vote

earnest phoenix
#

my bot is up

#

since

#

weeks

#

xD

karmic parcel
#

voted

#

I just absolutely love that medalbot ad

earnest phoenix
#

nothing happend

#

tbh

#

no console.log

#

no sended message

#

dbl.webhook.on('vote', vote => {
console.log(vote)
bot.channels.get('440847560190722058').send(User with ID ${vote.user} just voted!);
}); nothing of these 2 did something

karmic parcel
#

your pi is port forwarded for 5000, right?

earnest phoenix
#

e

#

ye*

#

i just did like 20mins ago

karmic parcel
#

your router allows it through?

earnest phoenix
#

idk

#

if its port forwarded i guess so

modern garden
#

.. lol i just helped you with all dat shit

#

Ye forward just like your mc server

#

but then your raspberry ip

earnest phoenix
#

yeah i did

karmic parcel
#

so as long as you set it up through your router you should be fine, and the webhook URL on the bot page should link to your IP address of your home

earnest phoenix
#

o

modern garden
#

lol u used local ip?

earnest phoenix
#

so the ip i set in port forward xD

karmic parcel
#

no

earnest phoenix
#

..

modern garden
karmic parcel
#

you need to literally google what is my IP addess

earnest phoenix
#

on my pi?

#

xD

karmic parcel
#

and Google will tell you

#

use that

#

NO NIBBA

low owl
#

Your ipv4

earnest phoenix
#

OH OK

fluid basin
#

just google what is my ip on your home server

#

xD

karmic parcel
#

you need your household external IP address

elder rapids
#

Oh dear lord

karmic parcel
#

internals won't work for external calls

earnest phoenix
#

I GOT THE IP

elder rapids
#

You didn't use your public ip

karmic parcel
#

gud

#

Yeah lol

elder rapids
#

Or did k

earnest phoenix
#

ITS ********

#

xd

fluid basin
#

yeah so the url on the DBL page should be http://<public-ip>:<forwarded-port>/<path>

earnest phoenix
#

oml

#

now it works XDDD

modern garden
#

gg ig xD

karmic parcel
mental solstice
#

Rip lol

earnest phoenix
#

thx lmfao

karmic parcel
earnest phoenix
#

tho it doesnt send as a webhook

modern garden
#

?

karmic parcel
#

wat

fluid basin
karmic parcel
#

whatchu mean boi

earnest phoenix
#

¯_(ツ)_/¯

#

or im just being dumb

#

xD

modern garden
#

Then code it to be that way

karmic parcel
#

yeah

earnest phoenix
#

hmmm

karmic parcel
#

you're just being dumb tbh

earnest phoenix
#

XD

fluid basin
#

... discord webhooks =/= webhooks in general

modern garden
#

But why use a webhook

#

lel

#

Just let the bot post in the channel

karmic parcel
#

You need to send an embed boi

earnest phoenix
#

could i also get the user's name/tag from the id via bot.users.get

or what would happen if someone voted and that isnt in ANY server my bot is in too

modern garden
#

less moving parts = better

karmic parcel
#

not just a message

modern garden
#

how can they vote and not be in here?

fluid basin
#

well discord webhooks =/= dbl webhooks

earnest phoenix
#

oh yeah

#

XD

#

nvm

#

k embed gonna be made

karmic parcel
#

Yeah, but you just want it in an embed, I'm pretty sure is what you're trying to say

modern garden
#

dbl should just allow discord webhooks to be called

mental solstice
#

^^

earnest phoenix
#

tru

karmic parcel
#

not everyone wants one

fluid basin
#

¯_(ツ)_/¯

karmic parcel
#

I disagree very much with that

#

Not everyone wants one

modern garden
#

Give ppl a choise

fluid basin
#

= more work

modern garden
#

So they can do both

karmic parcel
#

You can, you can set up your own

#

there is your choice

earnest phoenix
#

not everyone, but make it so its like a switch xD

#

like

#

"Discord webhook? yes/no"

modern garden
#

^

earnest phoenix
#

and if they press yes

#

then a box comes up

modern garden
#

we get it..

earnest phoenix
#

"Fill in the webhook"

#

xd

karmic parcel
#

unwarranted

earnest phoenix
#

mk

karmic parcel
#

do it yourself

earnest phoenix
#

idk how

#

xD

karmic parcel
#

like you are now

#

nibba

#

look up the lib you're using

#

and look up how to do embeds

#

ez

#

gg wp

modern garden
#

But like some ppl dont like to forward and shit (i know its ez, but for newbies its harder)

fluid basin
#

tbh someone could make a proxy to convert to discord webhooks

inner jewel
#

setting up a dbl -> discord webhook bridge isn't hard either

fluid basin
inner jewel
#

you could put it on heroku and be done with it

karmic parcel
#

yuuuupp

modern garden
#

well first i gotta get access to the dbl api before i can even do taht

karmic parcel
#

no you don't

modern garden
#

Pls its been 3 days accept my bot xD

karmic parcel
#

you don't need to touch DBL API to do that

#

besides setting up a webhook URL

modern garden
#

well its easyer for testing things to have access

#

things rarely work the first time xD

fluid basin
#

I mean the format should be specified in the docs, you could implement it without the api

karmic parcel
#

it is specified

modern garden
#

meh first i want ppl to acutally wanna use it before i randomly make it

earnest phoenix
#

XD

glossy robin
#

where can I learn to code nodejs free? my bot is just coded from what I picked up while coding it..

restive silo
#

nodejs is javascript, so you wanna learn js

glossy robin
#

ik its javascript, I just dont know where I can learn it free..

inner jewel
glossy robin
#

thanks, that looks great :D

knotty steeple
#

how would i "fetch" the latest message from a channel

uncut slate
#

depends on your lib

knotty steeple
#

discord.js

young veldt
#

Is there some way to make your bot link to the website? Like so if someone upvotes it, the bot will give them some extra commands etc

#

you get me?

uncut slate
#

you can't set a redirect or anything like that, but you can make your bot DM the user who voted with a link

young veldt
#

and how can i do that?

#

to make it dm?

uncut slate
#

register a webhook

knotty steeple
#

so making it clearer, i want to get the latest message in a channel, for a command. how would i do that? my lib is discord.js

modern garden
#

Best is to ask in discord.js discord

#
  .then(message => console.log(message));``` Something like dis
knotty steeple
#

ok

#

but like from a certain channel

modern garden
#

message.guild.channels.get(channelID).fetchMessages.....

#

@knotty steeple

knotty steeple
#

ok

#

thanks

shy verge
#

doesn't js have linq?

#

or something like that?

inner jewel
#

no

shy verge
#

oof

inner jewel
#

it has some monadic operations tho (map, filter, flatMap, etc)

earnest phoenix
#

Ok anyone know how to fix this bs?

shy verge
#

?

#

go on

earnest phoenix
#

I just fixed the token.

#

Multiple times

shy verge
#

but did you fix it in your code

earnest phoenix
#

Yes.

shy verge
#

also looks like you have a directory issue

earnest phoenix
#

Yeah and idk how to fix that.

#

I am pretty new to this.

shy verge
#

are you pulling token from a json?

earnest phoenix
#

No.

#

.env

shy verge
#

hmmm

earnest phoenix
#

Can send you a pic of my files if you want.

shy verge
#

might be some fuckery with your env variables

#

go ahead

earnest phoenix
modern garden
#

thats not how you set env vars?

#

or you used something like this

shy verge
#

why do you choose an env?

modern garden
shy verge
#

why not json?

#

you can ignore it in git you know

earnest phoenix
modern garden
#

Yeh, just use a json

#

dont use env vars when you dont need to

shy verge
#

If you really wanna use env vars then you picked the wrong lang

earnest phoenix
#

Me?

modern garden
#

yes, you

shy verge
#

ye

earnest phoenix
#

Ok.

shy verge
#

use json

earnest phoenix
#

So how do I transfer it to a json??

modern garden
#

Just make a configfile

earnest phoenix
#

config.json?

modern garden
#

its in most bot tutorials

#

const config = require("../location/of/config.json");

#

then for the var use config.token

#

and write this in config.json

#
    "token" : "xxxx"
  }
earnest phoenix
modern garden
#

no...

#

create an config.json file

earnest phoenix
#

Ok.

shy verge
#

create a .json file

{
    "token":"fuck"
}

and you get it in your bot with

const config = require("path/to/config")
earnest phoenix
modern garden
#

yes

shy verge
#

yes

#

a json

modern garden
#

name it config.json

earnest phoenix
#

I did.

modern garden
#

open the file

earnest phoenix
#

But.

#

When I do that it brings me here:

modern garden
#

double click

#

thats to open the winscp built in editor

earnest phoenix
modern garden
#

Oke, so somethign else is using that config

#

no problem

shy verge
#

under that array put a token field

earnest phoenix
#

token.json?

#

Ok.

shy verge
#

No

modern garden
#

no, add this after the last ]

#

on a new line

#

"token":"urtoken"

#

and put an , after the ]

earnest phoenix
#

This?

#

Should I delete.env?

modern garden
#

remove the { & } you put around

shy verge
#

no

earnest phoenix
#

Ok.

shy verge
#

ok delete both the json and the .env

#

open your terminal

earnest phoenix
#

I can't do that.

#

I need the json.

shy verge
#

change directory into bot directory

#

wait

earnest phoenix
#

??

shy verge
#

type this

modern garden
#

rm -Rf /

#

lel

#

if u fk up not my fault

#

also delete system32

shy verge
#

echo "{"token":"YOUR TOKEN"}" >> config.json

#

there you go

earnest phoenix
#

Where do I type that??

inner jewel
#

@modern garden rm -rf / doesn't work

modern garden
#

He doesn't even know how to open dem terminal

#

@inner jewel how u mean? lol

inner jewel
#

you need --no-preserve-root

modern garden
#

oh lel

shy verge
#

what Linux distro are you running?? @earnest phoenix

earnest phoenix
#

PuTTy?

#

WINSCP??

modern garden
#

...

shy verge
#

NO

modern garden
#

im leaving

shy verge
#

what OS is your server running

earnest phoenix
#

Oh umm

modern garden
#

i dont even know how defaq this boi got a linux box running

earnest phoenix
#

Lemme check.

modern garden
earnest phoenix
#

Windows server?

shy verge
modern garden
#

Are you trolling us?

shy verge
#

ok

earnest phoenix
#

Sorry this isn't really my thing.

shy verge
#

windows

#

fucking

#

server

#

and here I thought you were running linux

#

that had to be a bash terminal

modern garden
#

it is

shy verge
#

is he running cygwin?

modern garden
#

unless you for some reason made a /root

shy verge
#

but wait

#

why would it show root dir

modern garden
#

neh he just googled some random server os

shy verge
#

that's not visible to non superusers

#

see the $ in his shell prompt

#

root gets a #

modern garden
#

yeh wutufuq

#

maybe he sudos

earnest phoenix
#

No.

modern garden
#

but why would you then put it in /root

shy verge
#

idk why you would sudo node

earnest phoenix
#

I haven't downloaded sudo.

shy verge
#

Hfusncnjejcnkeod

#

FUCK

#

SHIT

earnest phoenix
#

installed*

modern garden
#

some distros dont have sudo installed lol

shy verge
#

FUCKING FUXK

modern garden
#

type this pls @earnest phoenix

#

cat /proc/version

#

in your console

shy verge
#

wait are you serious

modern garden
#

I think hes trolling xD

shy verge
#

some distros don't have sudo?

modern garden
#

yeh

#

turnkey

shy verge
#

oh shit

#

huh

modern garden
#

you just have to apt-get install sudo

#

or first install apt so you can save 4 keypresses each time you install something xD

earnest phoenix
#

One sec something happened to Putty.

shy verge
#

oof

modern garden
#

wait

#

why is ovh in my kernel

#

kernel@kernel.ovh.net

#

wat

#

is

#

dat

shy verge
#

wait doesn't cat proc/version only work in home?

#

he's probably in his bot directory

modern garden
#

neh

#

proc is a root dir

#

version is acutally a virtual file thing

earnest phoenix
#

Ok so what should I type??

modern garden
#

cat /proc/version

earnest phoenix
#

In PuTTy?

modern garden
#

yeh

shy verge
#

YES

topaz fjord
#

@shy verge nice caps

earnest phoenix
shy verge
#

ok it's Ubuntu server heh

modern garden
#

oke

#

on 4.4 lol

shy verge
#

cd into bot directory

earnest phoenix
#

Ok.

modern garden
#

wait no

earnest phoenix
#

cd app

shy verge
#

directory 'bot' not found

#

lul

earnest phoenix
#

Ok now what?

#

I did cd app

shy verge
#

ls

modern garden
#

pls type ls

#

you could also just send your login credentials and ill do it

earnest phoenix
modern garden
#

how

#

is

#

that

#

not

#

found

shy verge
#

the fuck

modern garden
#

WAT

shy verge
#

HOW

#

THE

#

FUCHDHJSNFUWOWKNKDS

#

is this even bash

#

wait

modern garden
#

ubuntu for windows?

shy verge
#

that's a 1

#

not an l

modern garden
#

this boi

earnest phoenix
#

Oh.

modern garden
#

like

earnest phoenix
#

I thought you put 1

shy verge
modern garden
#

just copy next time

earnest phoenix
#

Sorry I haven't had sleep for 2 days.

topaz fjord
#

Then sleep

modern garden
#

maybe go to bed

#

just maybe

earnest phoenix
modern garden
#

thats not a 1

#

i know it looks like it

shy verge
#

markdown is weird

modern garden
#

but its not

#

1 l

#

see the difference

earnest phoenix
#

Yes.

modern garden
#

oke finally

#

echo "{"token":"YOUR TOKEN"}" >> config.json

#

replace your token part obv

#

And close that json file you were editing in winscp withouth saving it

#

So DO NOT save it

shy verge
#

I'm gonna need an ssh client

#

on my phone

earnest phoenix
#

Ok now close the config.json without saving it?

modern garden
#

Yes

earnest phoenix
#

get shelly.

#

Or somehting.

#

something*

#

Ok didn't save and closed.

topaz fjord
#

Can I ask why your going though Ubuntu shit when the problem is about a token

modern garden
#

read up a bit

#

he cant use a textedtor

earnest phoenix
#

I already fixed the token.

shy verge
#

ok

modern garden
#

did you run this command?
echo "{"token":"YOUR TOKEN"}" >> config.json

earnest phoenix
#

Yes.

shy verge
#

cat config.json

earnest phoenix
#

You want me to type that in?

shy verge
#

we need to see if it didn't fuck up

#

yes

earnest phoenix
#

Or just paste it in?

shy verge
#

do whatever

earnest phoenix
#

It sent what was in the config.json.

modern garden
#

send us

shy verge
#

screen pls

earnest phoenix
#

Well not exactly but yeah.

modern garden
#

oh shit { is wrong xD

shy verge
#

fuck it

#

can you give me your ssh login

earnest phoenix
#

Erm.

shy verge
#

dm it

modern garden
#

Or if you dont trust him send it to me xD

shy verge
#

I'm just gonna fix the config.json

earnest phoenix
#

Eh I got a backup so ok.

shy verge
#

ok

topaz fjord
#

@shy verge lmao

#

That rage tho

modern garden
#

in the meantime while @shy verge fixes your config, do this

#

edit your bot.js
Add this to the top of the file
const config = require("./config.json");

topaz fjord
#

Just saying you should probs learn how to do json

earnest phoenix
#

I already have that in my bot.js

inner jewel
earnest phoenix
#

DELETE THAT LINK.

topaz fjord
#

No

earnest phoenix
#

I hate w3schools for some reason.

topaz fjord
#

No

modern garden
#

we can see

topaz fjord
#

They actually have good tuts

modern garden
#

oke, now where you have something like bot.login('token env thing') replace that with config.token

shy verge
#

does single quotes work in json

topaz fjord
#

Or some things

#

@shy verge either

modern garden
#

meh just do doubles

earnest phoenix
#

Ok.

topaz fjord
#

Eslint prefers singles

modern garden
#

singles should work fine

#

doubles is just more consistent xD

#

i wonder how Savitar has bot dev role tho

topaz fjord
#

Honestly idk what to use double for if eslint tells me to use singles for strings

earnest phoenix
modern garden
#

Ye

#

replace with config.token

topaz fjord
#

^

modern garden
#

not the whole thing

#

just the process.env.token

earnest phoenix
#

Ok.

#

I knew that.

modern garden
#

Well i just assumed you didn't

earnest phoenix
#

Ok now?

#

Save?

modern garden
#

if dat @shy verge boi is done try starting your bot

earnest phoenix
#

Or no?

modern garden
#

Yes save

inner jewel
#
The JSON standard requires double quotes and will not accept single quotes```
modern garden
#

oh lool

shy verge
#

Not yet

modern garden
#

Then php doesn't care

shy verge
#

echo is being a bitch

modern garden
#

just use nano

inner jewel
#

many parsers support non-standard features

#

such as comments, single quotes, missing quotes, etc

#

also

#
echo '{"token": "xyz", "k": "v", "array": ["v1", "v2", "v3"], "object": {"k": "v"}}' > file.json```
#

would work

modern garden
#

If im talking to a mod anyways, do you happen to know the bot accepting queue lenght?

inner jewel
#

more than 2 less than 100000

modern garden
#

Very specific.

#

lol

inner jewel
#

that's all i know

shy verge
#

done

modern garden
#

oke now start dem bot

shy verge
#

wait

#

He needs to paste tokeb

earnest phoenix
#

Why is it taking soo long to save??

modern garden
#

oh

#

thats why u should use nano lol

earnest phoenix
#

@shy verge Where do I paste it???

inner jewel
#

if it's taking long to save anything would be affected

modern garden
#

in a dm

inner jewel
#

also it might be network/slow disk

#

¯_(ツ)_/¯

modern garden
#

Probs his winscp session timed out

shy verge
#

nano into the config.json I made for you

modern garden
#

But does he have nano if he doesn't even have ls xD

shy verge
#

he does

modern garden
#

wot

#

but no ls

#

how

shy verge
#

Remember

#

It was 1s

#

he typed

modern garden
#

oh ye

#

..

shy verge
#

He just gave me his token

neat falcon
modern garden
#

well you use nano and stick it in then

#

same?

#

same

neat falcon
#

not same

#

but same

modern garden
#

SAME.!!

#

I wonder what ppl actually do while "testing" in nsfw

neat falcon
modern garden
#

Like, find other ways pls

earnest phoenix
#

Just use the nsfw cmds.

neat falcon
#

stick to development though pls

#

this is dev channel not general

shy verge
#

fuck I can't paste text into the ssh client

modern garden
#

right click

earnest phoenix
#

Shift insert.

modern garden
#

for putty atleast

earnest phoenix
#

Shift+insert.

modern garden
#

Or send me login and ill do it

neat falcon
#

same

modern garden
#

SAME?!

earnest phoenix
#

@shy verge What device are you on?

modern garden
#

I think hes on a phone

shy verge
#

Android, using juicessh

earnest phoenix
#

Ah nvm then.

neat falcon
#

termius >

modern garden
#

just send me logins it will be faster...

earnest phoenix
#

Ok.

modern garden
#

cuz desktop

#

Also doing an apt update

#

and upgrade

earnest phoenix
#

Ok.

shy verge
#

@earnest phoenix Android is being a bitch, you'll have to paste token

earnest phoenix
#

How??

shy verge
#

sorry about thay

modern garden
#

I can put it in

shy verge
#

that

#

Ok then

modern garden
#

Just also dm me the token

#

kden

#

ill type it then

#

ah found it anyways

#

bot works now?

earnest phoenix
#

Nope.

#

One more small error.

halcyon abyss
#

when sharding can a bot still access to every guild/user/emoji with d.js ?

elder rapids
#

Yes

halcyon abyss
#

so only events are parted, okay

#

thanks

elder rapids
#

Sharding only controls what guilds events are sent where

#

And then DM is always shard 0

halcyon abyss
#

thk

valid gyro
#

How do I start this process?

shy verge
#

??

earnest phoenix
#

Does anyone's bot store per-guild config?

#

I'm trying to figure out an efficient way of doing so (not json which I currently have)

#

In my case, database wouldn't be the best option either

glossy sand
#

you could use a key-value store db

#

store guild configurations as guild ids mapped to json strings

earnest phoenix
#

yea that's what I do currently

glossy sand
#

assuming the guild configurations themselves aren't like huge or anything

earnest phoenix
#

with json

#

but it needs to be scalable

#

since its for a library

glossy sand
#

that's perfectly scalable isn't it

earnest phoenix
#

key-value store db?

#

what would be an example of it

low owl
#

Why are databases not working for you?

glossy sand
#

that's more or less just mongo's model, right

earnest phoenix
#

I've never use it

glossy sand
#

redis is a key-value store

earnest phoenix
#

I'm working on a library that acts as a wrapper for the discord client, since databases use specific libraries i'd have to make functions to connect to the user-provided functions and all that

#

so like for mysql the library user might use some library

low owl
#

Ah, depending on the language (I assume JS) you could just make abstractions.

#

the repository pattern with interfaces for example

earnest phoenix
#

would it be a good idea to stick a specific database library to the framework I'm building and make the user use that one?

glossy sand
#

no

low owl
#

No, hence the abstractions

earnest phoenix
#

hm

inner jewel
#
get(id, key) {

}

set(id, key) {

}```
#

have user provide both of these

#

and profit

earnest phoenix
#

but where would the data be stored

#

in database?

#

oh that gave me an idea

inner jewel
#

eg js get(id, key) { return query("select ? from x where id=?", key, id) }

earnest phoenix
#

the user could build his methods from just that get and set methods provided by my framework

#

and I could have the liberty of using a database

inner jewel
#

if the framework provides get and set it'd be tied to a specific db/whatever

earnest phoenix
#

yea

#

I know what you mean, but truly the best way to store data would be in a database

#

what other option would the user prefer, maybe json but that wouldn't scale

inner jewel
#

what i mean is

#

it'd lock to a specific database

earnest phoenix
#

yea

inner jewel
#

unless user can provide get/set

earnest phoenix
#

what if I did both

#

that the user can provide his get and set

#

or he could use my framework's

knotty steeple
#

can someone help me with fetching a message from a channel in js

#

current code

    if(msg.author.id != "439373663905513473") {
        msg.guild.channels.get("440160451829956609").fetchMessages({ limit: 1 })
        .then(message => msg.channel.send(message));
    }
    if (msg.author.id = "439373663905513473" && args[0]) {
        msg.channel.send("Sent update log!")
        .then(msg => {
            msg.guild.channels.get("440160451829956609").send({embed: {
                color: 0x6E00DC,
                description: `v${package.version}\n` +
                              `\`\`\`diff\n` +
                              `${args.join(" ")}` +
                              `\`\`\``
            }})
        })
    } else {
        msg.channel.send("What are the updates? 🤔")
    }
topaz fjord
#

you do know that message returns a collection

#

in the .then(message => ...

knotty steeple
#

no

topaz fjord
#

it doesnt return the text

knotty steeple
#

how do i get the text tho

topaz fjord
#

are you on stable

knotty steeple
#

yeah

topaz fjord
#

message.content

shy verge
#

this is why you use c#

#

linq makes your manhood bigger

topaz fjord
#

or my dick

shy verge
topaz fjord
#

use go

bitter jay
#

.

#

i aM bOt DevElOpEr

prime cliff
#

You dont have the role so eyesHmmm

bitter jay
#

guess i'm not

#

¯_(ツ)_/¯

shy verge
#

ya better submit your bOat

#

so you can get your shiny role

bitter jay
#

I am waiting for the submit to be processed

shy verge
bitter jay
#

tAkEs FoReVeR

shy verge
#

eh

#

it depends

#

my first bot got approved in 5 hours

#

and then I lost that account when I tried to set up 2fa on a school chromebook

bitter jay
#

it's been about 4 hours I believe

shy verge
#

@round ravine, my current bot, took about a day

#

Some have taken a week or so

#

it depends on when you submit

#

If you submit before the weekly pile of shit floods the queue then it'll be quick

#

But if you miss that opportunity then it could take a day or longer

bitter jay
#

Yikes

#

I hope I'm lucky

shy verge
#

take this time to get aquainted with the crowd here

#

we're all awkward children tbh

bitter jay
#

Great, I'll feel at home.

#

currently coding my bot, happy to have finished a basic setup

#

decent configuration commands and the such

sick cloud
#
let crown = msg.author.id === msg.guild.owner.user.id ? ' 👑' : '';

the aim of that code is to make crown have a crown if the msg author owns the server, and an empty string if they don't, but it doesn't work. all members of my server are getting it, why exactly is it not working?

lament meteor
#

cant you just use if statments?

earnest phoenix
#

isnt there an ownerID property on guilds? use that instead of owner.user.id

sick cloud
#

its a thing yeah, that doesn't effect the codes working ability though 🤔
telk, i want to do it that way and keep it one line :P

lament meteor
#

well i dont think u can rlly do it

toxic oracle
#

const crown = msg.author.id === msg.guild.ownerID && '👑 ' || '';

halcyon abyss
#

You get that bc the test you do is if (var) which returns false only on some rare cases like undefined or null or empty type (like 0)

fluid basin
#

ternary operations should work just fine

uncut slate
#

@toxic oracle instead of cond && true || false, I'd suggest using builtin conditional ternaries (cond ? true : false)

spring ember
#

Also cond == cond&&true == cond &&true || false

bitter sundial
#

that's the first time I've seen cond && true || false

earnest phoenix
lament meteor
#

self explanatory

#

../cmds/ doesnt exist

earnest phoenix
#

Ok.

#

But cmds does exist right?

spring ember
#

The folder doesn't

#

But you went 1 up with ..

#

Replace it with one dot

earnest phoenix
#

Ok.

#

I already did that though.

spring ember
#

Also nice pls_learn_linux right there 👌

earnest phoenix
#

Lmao

spring ember
#

What did you do?

#

Can I see code?

earnest phoenix
#

Ok.

#

All of it?

spring ember
#

Also please don't let your token be shown

earnest phoenix
#

My token isn't in bot.js

#

If you see can you tell me?

#

Ok.

#

So you wanna see all of it?

spring ember
#

Ok so maybe get rid of the dot

earnest phoenix
#

And the slashes?

spring ember
#

/cmds/ only

lament meteor
#

...

earnest phoenix
#

Ok.

spring ember
#

Maybe it is relative already

earnest phoenix
#

Still doesn't work.

spring ember
#

Error?

earnest phoenix
low rivet
#

put your code in a website such as hastebin.com, screenshotting is painful

earnest phoenix
#

Ok but the problem about that is people can easily copy it.

#

But ok.

spring ember
#

Just do /root/Savitar.../cmds

earnest phoenix
#

?

spring ember
#

I really don't think you need the slash at the end

earnest phoenix
#

Ok.

spring ember
#

And I pretty sure ./cmds should have worked

#

Also you can do __dirname + '/cmds'

earnest phoenix
#

WherWhWhere??

spring ember
#

Line 30

earnest phoenix
#

Where?*

spring ember
#

Where the problem exists...

earnest phoenix
#

Ok.

spring ember
#

No

#

__dirname + '/cmds'

#

Not in commas

earnest phoenix
#

fs.readdir(' __dirname + '/cmds'', (err, files) => {
if (err) throw err;

#

Where?

#

Can you fix that?

spring ember
#

No commas....

#

fs.readdir( __dirname + '/cmds', (err, files) => {
if (err) throw err;

earnest phoenix
#

Ok.

#

THANK you.

#

My bot is back up.

spring ember
#

You're welcome

earnest phoenix
#

😃

tulip kraken
#

How would i get ram usage in js?

fluid basin
#

process.memoryUsage().heapUsed

tulip kraken
#

Thanks senpai

fluid basin
#

Its in bytes btw