#development

1 messages · Page 453 of 1

sick cloud
#

no

#

use client.emit

knotty steeple
#

also use canvas-constructor

#

its nice 😩

sick cloud
#

<client>.emit('guildMemberAdd', msg.member);

knotty steeple
#

oh yea

#

that is a thing

uncut slate
#

${__dirname}/../assets/welcome.jpg also works

earnest phoenix
#

@sick cloud it still doesn't work and ive used both samaurai and aetheryx's solutions to test it:

knotty steeple
#

maybe dont use client.emit

#

lets see what happens

sick cloud
#

client.emit is the same as the event going off normally

earnest phoenix
#

either way it still gives me the same error

#

whoops it ghot through that part

#

thgeres another section giving an error

#

@earnest phoenix use canvas-constructor

#

its faster xd

#

what is canvas-constructor?

#

google

#

nrn

earnest phoenix
#

It's a library made to interact with canvas

earnest phoenix
#

<

#

can someone please help me

eager spoke
#

also sqlite by opening the database it create automatically the file/db if it doesn't exist

earnest phoenix
#

Yea

#

but

#

Wait @eager spoke wdym?

eager spoke
#

for example in the command line, if you type sqlite file.db then file.db will be created (and know you have to CREATE TABLE)

stray wasp
#

Hel did you get your name from the German movie btw?

earnest phoenix
#

I have a Database with Mysql

eager spoke
#

I have that name since 2005-7 xD

earnest phoenix
#

but the create tbale thing

#

i can't figure out

#

CREATE TABLE reportdev();

#

that no work

eager spoke
earnest phoenix
#

Wait

#

no

#

my problem is

#

idk what to put in the ()

knotty steeple
#

what are you making the table for

eager spoke
#

ohhhh, you don't know how to design your database? x)

earnest phoenix
#

CREATE TABLE reportdev(whathere);

#

Yea

#

I have the Db file

eager spoke
#

also what's in your report?

earnest phoenix
#

I am

#

making a bug, issure,improvement and other thing report command

#

and I need a database

#

so the command can fetch from the database

#

and send the report to a channel in the support server

eager spoke
#

would put something like id integer primary key, user_id integer not null, label text not null, issue text not null, resolved integer default 0

earnest phoenix
#

thats command

eager spoke
#

wait

earnest phoenix
#

hm?

eager spoke
#

would put something likesql CREATE TABLE report IF NOT EXISTS (id integer primary key autoincrement, user_id integer not null, label text not null, issue text not null, timestamp integer not null, resolved integer default 0);
maybe that

#

where id => issue id (autoincremented)
user_id => the discord id of the user that make the report
label => issue, bug, etc
issue => the second question, also the detailled
timestamp => for calculating the time of the issue
resolved (boolean if you have already inspect and/or resolve the issue (also you could make a code like 0 => nothing, 1 => read, 2 => resolved, 3 => declined, etc)
@earnest phoenix

earnest phoenix
#

Whats that for

eager spoke
#

you could extend your feature by letting you respond through the bot to the user in private message, for searching not resolved issue (with SELECT statement)

#

make statistic etc

earnest phoenix
#

sooo

#

wait

#

i dont get it

eager spoke
#

what you don't get it?

earnest phoenix
#

Everything

#

about that

#

last one

#

do I put that

#

in the create table thing?

#

this

eager spoke
#

ok wait make an error

earnest phoenix
#

huh?

#

you want me to mess up

#

what you told me to put

eager spoke
#
CREATE TABLE IF NOT EXISTS report(id integer primary key autoincrement, 
user_id integer not null,
label text not null, 
issue text not null,
timestamp integer not null,
resolved integer default 0);```
earnest phoenix
#

that is literally

#

what it was before

eager spoke
#

nah make an error i wrote CREATE TABLE table_name IF NOT EXISTS instead of CREATE TABLE IF NOT EXISTS table_name

#

sorry it's something late for me x)

earnest phoenix
#

same

#

8pm

#

o.O

#

i stayed up from

#

2am to 8pm already

eager spoke
#

it's 5am x)

#

also, did it work? 👀

earnest phoenix
#

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'autoi
ncrement,user_id integer not null, lable text not null, issue text not null' at
line 1
mysql>

eager spoke
#

show what you wrote

earnest phoenix
#

mysql> CREATE TABLE IF NOT EXISTS report(id integer primary key autoincrement,us
er_id integer not null, lable text not null, issue text not null, timestamp inte
ger not null, resolved integer default 0);

eager spoke
#

also with sqlite3 it works on my side

#

oh, you're using mysql

earnest phoenix
#

Yes

eager spoke
#

mysql is a little bit different xd

earnest phoenix
#

Yea

#

Do you know how to use it?

eager spoke
#

yeah

earnest phoenix
#

Ok thank god xD

#

I been looking for almost 3 hours now

#

<

eager spoke
#
CREATE TABLE IF NOT EXISTS report(
id INT AUTO_INCREMENT, 
user_id INT NOT NULL,
label VARCHAR(255) NOT NULL,
issue TEXT NOT NULL,
timestamp LONG NOT NULL DEFAULT CURRENT_TIMESTAMP,
resolved BOOL DEFAULT FALSE
PRIMARY KEY(id));
#

that should be good @earnest phoenix

#

also i'm going to bed, if you have other question, ping me or dm me
good night

turbid tiger
#

I'm using discord.js. When I use message.member.setNickname('myNicknameGoesHere') to change someone's nickname, I get UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions as an error. I think the bot is missing permissions, but it has the higest role with all permissions granted.

bright spear
#

@turbid tiger so the bot has the Manage Nicknames pemissions, it has the highest role, and the person is not the owner?

turbid tiger
#

Hmm

#

I am the owner of the server, so no to the last question.

#

How do you delete ownership?

bright spear
#

you'll have to transfer it to someone else in server settings -> members

turbid tiger
#

Alrighty, let's see if this works then.

#

Now it's saying that it's not a function. Geez message.author.setNickname is not a function

bright spear
#

its member not author

turbid tiger
#

Stupid question: how about changing it for a different player? Say const player = message.mentions.users.first();, how could I change player's nickname?

earnest phoenix
#

Hey all! I was wondering would anyone have any recommendations for good vps (affordable too)?

#

As much as I like to stay on free, i think it’s time for me to move to a paid vps

uncut slate
#

GalaxyGate is pretty good rn

earnest phoenix
#

@uncut slate hows the ping to discord?

uncut slate
#

15-30ms

earnest phoenix
#

that's not bad..

#

for a 100 server, would $8 be enough?

uncut slate
#

more than enough

#

I run 6 bots on my $10 droplet with plenty of room to spare

#

about 90% CPU and 50% RAM free

earnest phoenix
#

Oh wow six bots? D: that’s a lot...

#

May I please have a link to your bot on dbl?

heady zinc
#

yee my bot has 3k servers and still runs on a 10$ VPS

#

and quite not the cheapest one out there

#

bots don't need much

earnest phoenix
#

Do you guys ask for donations and such?

#

to pay for the vps and all

ebon bolt
#

My VPS is $5/month. No need to ask for donations I’ll just cut back on a coffee per month.

sick cloud
#

I don't. then again I don't pay for my VPS

earnest phoenix
#

I don’t feel good about asking for donations tbh

#

May I ask where do you host it on?

ebon bolt
#

digital ocean

earnest phoenix
#

Oh yeah!! I heard a lot of good things about them

ebon bolt
#

Yeah, they’re really great.

heady zinc
#

i pay my vps entirely with donations personally

chrome meteor
#

DO is nice because if you're a student and haven't used DO before you can get $50 worth of credit there

#

through the github student pack

sick cloud
#

Why isn't this working?

const m = await msg.channel.messages.filter(m=>m.id==='471944000576684035');
heady zinc
#

why do you await it

#

msg.channel.messages is a collection right

#

using filter won't return a promise

#

though it should still work ZoomEyes

#

also what are you trying to do, find a specific message?

#

( @sick cloud ) hi

sick cloud
#

edit an embed in a bots message @heady zinc

#

i made a mistake on an embed so i'm trying to edit it

heady zinc
#

?

#

so you are trying to find a specific message

sick cloud
#

yeah and then edit it

heady zinc
#

remember that filter doesn't return the message in question

sick cloud
#

oh

heady zinc
#

it returns an array of messages that matched the filter

sick cloud
#

so use .first()?

heady zinc
#

you'd prefer using messages.find()

sick cloud
#

oh

heady zinc
#

or even .get() actually

sick cloud
#

get failed

heady zinc
#

because messages are mapped by their id

cinder patio
#
         message.edit(stuff)```
heady zinc
#

if get failed that mean the message isn't in the cache

cinder patio
#

that should work

heady zinc
#

so you'd have to fetch the message

sick cloud
#

oh

#

how do i fetch it

heady zinc
#

there should be a <channel>.fetchMessage() method

#

i can't look at the docs right now but iirc that's its name

cinder patio
#

You can also do

sick cloud
#

doesn't seem to be a fetchMessage there

cinder patio
#
       sentM.edit("Edited")
});```
sick cloud
#

no

#

the message is already sent

heady zinc
#

m

#

use the search feature

#

might be bound to the guild or the client

sick cloud
#

search?

heady zinc
#

search bar on the docs

cinder patio
sick cloud
#

nope

#

no fetchMessage

heady zinc
#

are you using v12

sick cloud
#

master, yeah

heady zinc
#

oh

#

that changes stuff

cinder patio
#

you're saying that now? lol

sick cloud
#

i mean

#

i thought people could guess

#

since v11 doesn't have a usable MessageEmbed

heady zinc
#

well i assume everyone uses the stable build

cinder patio
#

^

heady zinc
#

because that's best practice

sick cloud
#

master way better tho

#

but kek

heady zinc
#

wtf

#

where are the methods to fetch messages

#

oh wait

#

i see

#

indeed that's how it works in v12 i forgot

#

msg.channel.messages.fetch() @sick cloud

#

returns a promise

sick cloud
#

so await that?

heady zinc
#

ye

sick cloud
#

ayy that worked

#

thanks <3

heady zinc
#

honestly ablobsweats

#

v12 is so different from v11

#

devs on v11 will have a hard time updating

sick cloud
#

yeah

austere meadow
#

v11 devs are silly tbh

#

but a lot of it will just be find+replacing stuff

#

find: message.channel.fetchMessage
replace: message.channel.messages.fetch

heady zinc
#

i mean

#

the silly ones are d.js devs

#

they just don't have any clue of when to release something

austere meadow
#

check pins

#

E

heady zinc
#

one fucking year

austere meadow
#

why does it matter when v12 is released

#

it's already pretty stable on master

#

i would consider it to already be released, it's just a matter of fixing bugs

#

like a beta version i suppose

heady zinc
#

"pretty stable" is not acceptable for production in big bots

austere meadow
#

i used v12 for the longest time and i had no issues with it

#

the only real issue i had was recently but that was due to an issue with snekfetch

#

honestly paradox

#

what is wrong with d.js

heady zinc
#

nothing

#

it's an honorable lib

austere meadow
#

yes

heady zinc
#

with the biggest community over all discord libs

#

the whole one year to release v12 is fucked tho

austere meadow
#

i would agree

#

i dont know what they're doing

#

not like it matters to me anymore mmLol

#

however i would consider v12 to almost be a rewrite

#

not a full on rewrite but it changes a lot of stuff backend

#

for the better

heady zinc
#

i mean ye it is rewrite

#

wouldn't increment semver major otherwise

austere meadow
#

i mean

#

major doesn't always have to be a rewrite

heady zinc
#

in most cases

austere meadow
#

in an ideal world you wouldn't need to rewrite your software that often

heady zinc
#

i mean

#

that much rewrites is the proof of an ever-improving lib

#

or just hydra being a meme

austere meadow
#

i would lean towards the latter JUSTLOL

#

i suppose development has shifted heavily since v9

heady zinc
#

v12 looks like the ultimate form of what d.js tried to achieve until now

austere meadow
#

yeah

heady zinc
#

you just have to understand how to read the docs

#

and there you go

#

d.js pretty much does everything for you

#

it's not really a wrapper for discord's api anymore

austere meadow
#

the docs are incredible for d.js

heady zinc
#

ye

#

d.js is incredible too

austere meadow
#

wym its not a wrapper for discords api

#

i would disagree

heady zinc
#

it's more of a wrapper for the entire bot development process

#

it does so much things not directly related to the api

austere meadow
#

i guess

#

d.js music will never be good

heady zinc
#

i mean just have to use lavalink

#

not that much bothersome

#

¯_(ツ)_/¯

austere meadow
#

tbh lavalink was big pain for me to set up the first time i used it

heady zinc
#

same

#

i failed first time

#

but now im enjoying it happy

austere meadow
#

its also very memory heavy for some reason

#

like

#

it would use more than my bot

heady zinc
#

well ofc

#

it is music after all

austere meadow
#

not acceptable

sick cloud
#

why is lavalink better

austere meadow
#

i want 1kb music!!!!!

heady zinc
#

my first lavalink node takes half of the ram my bot use

austere meadow
#

@sick cloud better quality and it's java based

heady zinc
#

well

austere meadow
#

well yourself paradox

#

we all know you're well

heady zinc
#

the main thing is that it does most of the job for you

austere meadow
#

the only reason i got it is because the quality is 10 times better and it's less prone to errors

heady zinc
#

you don't have to go through the pain of figuring out how to download youtube, soundcloud or twitch livestreams and stream them

#

lavalink does it for you

sick cloud
#

ew java

#

but ohk

heady zinc
#

but yeah the thing is lavalink will at least on my side still use ~250mb of ram even without streaming anything

#

the upside of that is that the ram usage won't grow much with a lot of streams

austere meadow
#

true

#

what a genius

sick cloud
#

250mb of ram is nothing Thonk

austere meadow
#

What

#

i mean

sick cloud
#

especially when you got 40gb to use
its pretty small

heady zinc
#

it's noticeable on small-scale bots

austere meadow
#

iDEALLY you'd like it to not use that much

earnest phoenix
#

..

sick cloud
#

my giveaway bot uses 200mb to just idle :V

austere meadow
#

i'd even say its noticeable on medium sized bots

sick cloud
#

true

austere meadow
#

then again what counts as medium

earnest phoenix
#

rip

austere meadow
#

what about it isn't working

heady zinc
#

medium is the thing before big

#

and after smol

austere meadow
#

i would say medium is like

#

2 or more shards maybe

#

¯_(ツ)_/¯

#

thats biased

heady zinc
#

eh

#

that'd fit my bot size

sick cloud
#

so 400 servers would be considered small

#

right?

austere meadow
#

i would say so

heady zinc
#

ye

#

imo i would consider anything from 0 to 10000 small

austere meadow
#

lmfao

heady zinc
#

10000-80000 medium

austere meadow
#

every bot is small mmLol

heady zinc
#

and the rest big fat asses

austere meadow
#

do you know how many have 10000+

#

i don't think it's that high

sick cloud
#

ok

heady zinc
#

ofc

#

it's not that easy to have a popular bot actually

austere meadow
#

only with the right advertising kek

sick cloud
#

i gtg so bye you weebs peoples waves

#

and ty for the help before

austere meadow
#

bye

#

i think the problem with bots these days is its like a job application

#

people just look at your resume (your description) and if it's not good enough, you're out

#

they'll also consider server size and shit

#

since they don't have the time to look at the whole full description for every bot

#

they just look at the front cover

heady zinc
#

well

austere meadow
#

STOP WELLING

heady zinc
#

the problem is that there's too much bots

#

obviously

austere meadow
#

yes

#

too many

heady zinc
#

that's the thing i don't like with d.js

#

it's too easy

#

and then it just overflows the market with bad boats

austere meadow
#

yes

#

isn't pokecord still in d.js?

#

that's impressive

heady zinc
#

ye

#

miles is about to finish eris rewrite though

austere meadow
#

good

heady zinc
#

he's annoyed by the ridiculous ram usage of d.js lul

austere meadow
#

good guy miles

#

i dont blame him lmfao

#

128+gb of ram would fuck me off too

heady zinc
#

ye when you see dank memer only using 30gb

bitter sundial
#

if the module is easy to use its a good module isnt it

heady zinc
#

it is

#

there's downsides to everything

#

doesn't mean d.js is bad

spring ember
#

it is just not scalable

earnest phoenix
#

sigh my bot is never gonna get commands into it r.i.p

#

bot

heady zinc
#

well

#

d.js does its job

#

its mainly meant to be easy to use and introduce you into the world of bots

#

though it was supposed to be scalable at first

#

at least that's what i assume from the shards spawned as child processes

bitter sundial
#

but how can you hate the module for what makes it good 🤔

heady zinc
#

i don't hate the module

#

i never said that

bitter sundial
#

well

#

"not like"

heady zinc
#

i said that was a side i didn't liked

#

or well

#

not quite accurate

#

i don't like the consequences of it

#

but eh can't do anything about that

unique nimbus
tardy viper
#

Plz help me

#

i want to be create a rank how to create that

restive silo
#

canvas (if you use js)

tardy viper
#

yes

#

i use js

wild tide
#

Honestly, discord.js shouldn't become a meme, or recognised as what newb devs use to make useless bots. discord.js is definitely the easiest, and is the perfect starter point for new developers. But if you put effort into learning JavaScript fully, discord.js is as capable as any other API wrapper. Not every bot that new developers make are bad every time, though most tend to be small bots that only solve a small area of Discord usability, or are just useless completely. The outcome of the bot shows with how much effort you decide to put in. Crap bots only take >1 hour approx. to make. Putting in effort for a good bot, and setting up proper updating and supporting systems will take 1 week or more. I use discord.js since I find JavaScript the most universal language, and you have access to things like npm, which are really helpful with running on VPS and installing modules easier, as well as there being a larger range.

Thats my opinion on discord.js. Honestly, whatever discord.js can do, pretty much all of the others can too.

restive silo
#

w-why did you need to post that

earnest phoenix
#

Unless you use Bot Maker you're good to go

heady zinc
#

w-why indeed

spring ember
#

Wow that is long, woah

wild tide
#

because people were talking about d.js and their opinions on it

restive silo
#

you dont need to put that much effort into jesus its only peoples opinions

patent tinsel
#

so what's a shard?

#

apparently my bot has shards

#

apparently bots can have shards*

restive silo
#

Sharding is something you need to look into when your bot reaches 2.5k guilds ( you should look into it with 1.5k)

patent tinsel
#

yeah i have 11 so i think i'm a bit off

restive silo
#

ye

slender thistle
#

Shards basically split the bot's performance into several processes for better performance.

#

Something like that.

patent tinsel
#

ooh

restive silo
#

nah

#

thats kinda incorrect

slender thistle
#

Is it? My bad then.

austere meadow
#

@wild tide if you check pins there's an unbiased description of both eris and d.js

restive silo
#

Sharding is required from Discord to split the load in the main Websocket connection up into multiple connections, single threaded languages like js often use something like that to also loadbalance the bot and split it into multiple processes since thats the only way to use more than 1 CPU core

slender thistle
#

Oh.

#

I was getting it wrong.

#

Thanks.

restive silo
#

if your bot reaches 2.5k guilds you need to have atleast 2 websocket connections where each Shard has his own websocket connection and handles an amount of the total guilds from your bot

#

so each own WS connection is a Shard

slender thistle
#

Got it.

#

Thanks.

restive silo
#

you dont need to worry about that before ~1.5k guilds

slender thistle
#

I am far from that, either way. :^)

restive silo
#

with 2.5k you are forced to shard or you can't connect to the Discord API

slender thistle
#

Oh.

earnest phoenix
#

@eager spoke Hello

#

It did not work 😦

#

RIP

patent tinsel
#

hey, stupid question

#

what's the benefit of workspaces?

#

i just edit raw JS files rn, i have a few separate for a few different things, but it's raw JS with no workspace

#

and i see people with VS code working in workspaces and i imagine there's efficiency with doing so

austere meadow
#

i'd also like to know the answer
it can be helpful when working on different projects but i don't think it's really that important

#

i'd presume it'd be for those people who are really proactive about their productivity and organization

earnest phoenix
#

id also like to know

fluid basin
#

thonk well generally

patent tinsel
#

literally my workspace is just a couple of JS files plus a folder called 'test' where i do dev before copying over to main

#

i dont use git or anything fancy

earnest phoenix
#

never reaally done much with vscode

fluid basin
#

Kinda allows you to work on multiple projects at once I guess?

patent tinsel
#

ooh

fluid basin
#

Like I usually open one for frontend and one for backend when I'm going fullstack

earnest phoenix
#

ye

patent tinsel
#

ooh

earnest phoenix
#

ánd then open discord ofc

#

da fuck is wrong with dat a

eager spoke
#

Hej

fluid basin
#

Hey

earnest phoenix
eager spoke
#

@earnest phoenix error message?

earnest phoenix
#

It

fluid basin
#

Lol chill @earnest phoenix

earnest phoenix
#
corresponds to your MySQL server version for the right syntax to use near '(id))
' at line 1```
eager spoke
#

🤔

earnest phoenix
#

@fluid basin i'm just a little pissed after responding like this and getting this:

#

maybe id outside of the ()

#

?

eager spoke
#

No missed a , xd

earnest phoenix
#

lool

#

Oh

fluid basin
#

Well yeah too much is bad

#

Anyways

eager spoke
#
CREATE TABLE IF NOT EXISTS report(
id INT AUTO_INCREMENT, 
user_id INT NOT NULL,
label VARCHAR(255) NOT NULL,
issue TEXT NOT NULL,
timestamp LONG NOT NULL DEFAULT CURRENT_TIMESTAMP,
resolved BOOL DEFAULT FALSE,
PRIMARY KEY(id));
patent tinsel
fluid basin
#

Another reason is that I usually switch from project to project

#

So I sometimes do want to come to working on one after some while, and which I keep it open as another workspace

earnest phoenix
#

is there ANY other way than snekfetch for loading an image to Canvas from an URL? anyone got a solution?

#

ERROR 1067 (42000): Invalid default value for 'timestamp'

fluid basin
#

You'll need the image itself

eager spoke
#

🤔🤔🤔🤔

fluid basin
#

So you would have to retrieve it in some way

#

Bte snekfetch is no longer maintained I assumr

earnest phoenix
#

maybe not CURRENT_TIMESTAMP and just have it as CURRENT TIMESTAMP ?

#

@fluid basin how, all i can get is a buffer

eager spoke
#
CREATE TABLE IF NOT EXISTS report(
  id INT AUTO_INCREMENT,
  user_id INT NOT NULL,
  label VARCHAR(255) NOT NULL,
  issue TEXT NOT NULL,
  timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  resolved BOOL DEFAULT FALSE,
  PRIMARY KEY(id)
);

Syntax checker say its correct

#

@earnest phoenix

earnest phoenix
#

funny need syntax checker for sql lool

eager spoke
#

funny need syntax checker at all lool

#

No one is Ada Lovelace

fluid basin
#

Oh I see

earnest phoenix
#
    -> id INT AUTO_INCREMENT,
    -> user_id INT NOT NULL,
    -> lable VARCHAR(255) NOT NULL,
    -> issue TEXT NOT NULL,
    -> timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    -> resolved BOOL DEFAULT FALSE,
    -> PRIMARY KEY(id)
    -> );
Query OK, 0 rows affected (2.09 sec)```
#

idk if this is right Hel

#

xD

#

did i do it right

tardy viper
#

Can you without asking a system for activating and disabling control in a certain server?

#

plz

quartz kindle
#

without asking?

tardy viper
#

I am not english i have difficulty to use this language

quartz kindle
#

try using google translate

tardy viper
#

Yes 😂

#

no for all message juste for the message our cant translate

quartz kindle
#

ok

tardy viper
#

So can you help me ?

eager spoke
#

Query OK -> everything nice 😄 @earnest phoenix

earnest phoenix
#

so

#

i did it right?

eager spoke
#

yes

earnest phoenix
#

Ok

#

Now Idk what to do xD

#

I need to be able to access it for my command

#

If so I will just ask my friend

#

he can help me with that

earnest phoenix
#

@eager spoke Where can I find the database file i just made?

#

i need help

#

any vc

#

wont join any vc

neat falcon
#

send code

fluid basin
#

Is your server/pc blocking udp connections?

knotty steeple
#

iirc thats glitch 👀

earnest phoenix
#

No, It used to join vc's earlier but suddenly it wont

eager spoke
#

@earnest phoenix you should really read documentation/tutorial about mysql/database

earnest phoenix
#

Oh ok

eager spoke
#

mysql work as a server, sqlite use files as database

earnest phoenix
#

How would I make a bot automatically discern between channels to pick

gilded blaze
#

Get the guilds channels.

earnest phoenix
#

Like, for instance, I have a certain type of message that normally gets sent to #general, but not all servers have #general

gilded blaze
#

And loop through

earnest phoenix
#

Can't I do like guild.channels.some?

gilded blaze
#

Never heard of that method.

#

Nvm

earnest phoenix
#

There's message.member.roles.some

gilded blaze
#

Well the some method only checks if the channel will meet a criteria.

#

It will return a boolean.

#

You probably want to get the channel which would mean using a method like forEach

earnest phoenix
#

That might work. I just need a channel to send welcome messages to

#

And it's not the same for everyone

gilded blaze
#

You could also take user input.

earnest phoenix
#

Ye but database

#

Ick

gilded blaze
#

So to enable welcome messages they have to mention a channel

#

or something like that.

earnest phoenix
#

Hmm. Smart

#

I probably need a setup command

knotty steeple
#

Im trying to play some sound files with my bot but im getting Error: FFMPEG not found

#

tho i already installed ffmpeg

earnest phoenix
#

Try running npm install ffmpeg-binaries

knotty steeple
#

i did

#

thats why i said i installed ffmpeg already

gilded blaze
earnest phoenix
#

Install ffmpeg binaries from npm

#

npm i ffmpeg-binaries

deft summit
#
  if (message.content.startsWith(prefix + "byeee")){
    client.guilds.forEach(guild=> {
      const defaultChannel = guild.channels.find(c => c.name.toLowerCase().includes('general') && c.type === "text")
      if (!defaultChannel) return;
      defaultChannel.send("lol");
      defaultChannel.send("lol");
      console.log('sent')
    })
  }```

that should work right
earnest phoenix
#

Why are you sending two messages

deft summit
#

regardless of that

#

that code should work right

earnest phoenix
#

Which library

deft summit
#

discord.js

earnest phoenix
#

I don't see why it wouldn't work

#

Have you tried it

deft summit
#

yeah

earnest phoenix
#

so?

deft summit
#

doesn't output anything

earnest phoenix
#

Doesn't log?

deft summit
#

doesn't log

earnest phoenix
#

Remove the if statement for the default channel return

#

Or just comment it out and try again

gilded blaze
#

Why do you use the includes method

deft summit
#

then what would i do

#

im just trying to mass message all guilds

#

yes that may be api bannable and im totally fine with it right now

earnest phoenix
#

Oof not sure if that works

#

Pretty sure there's an api limit for sending messages

#

You can't send tons of messages at the same time I believe

gilded blaze
#

c.name.toLowerCase() === "general"

deft summit
#

aha it worked

gilded blaze
#

includes is for arrays and other lists

#

I think

earnest phoenix
#

It is

#

You use it to check if a value exists in an array

gilded blaze
#

It can also be used to check if something is in a string.

deft summit
#

how'd i go about sending a message to all guilds where the bot has access to send a message to?

earnest phoenix
#

Is it even possible to do that

#

Idk if api allows that

tardy viper
#

Can you help me

#

i have an problem

#

db.updateText is not a function what wrote ?

knotty steeple
#

code?

tardy viper
#

module.exports.run = (bot, message, args) => {
if (!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("This command requires the ADMINISTRATOR permission")
if (!message.mentions.channels.first() && args.join(" ").toUpperCase() !== 'NONE') return message.channel.send(Usage: g!joinleave #channel)

let newChannel;
if (args.join(" ").toUpperCase() === 'NONE') newChannel = '';
else newChannel = message.mentions.channels.first().id;

** db.updateText(welcomeChannel_${message.guild.id}, newChannel).then(i => {**
message.channel.send(Successfully updated welcome channel to **${message.mentions.channels.first()}**)
})
}

knotty steeple
#

is updateText a function?

tardy viper
#

I dont no that function

#

i have placed fetch

#

that work

earnest phoenix
#

Does anyone know how to make it so when a person goes offline it gives them a role and when they come online it takes the role away?

#

for discord.js btw

ruby dust
#

track member update events

earnest phoenix
#

How would I do that?

ruby dust
#

its in d.js docs

earnest phoenix
#
bot.on("guildMemberUpdate", (oldMember, newMember) => {}
       ```
#

like that?

tardy viper
#

I have an problem

#

await is only valid in async function

#

i have tested

knotty steeple
#

remove the await

tardy viper
#

bot.on('guildMemberAdd', async member => {

#

no no

#

the await was a problem wen no present

#

its canvas

#

wen no await that eror (node:16903) UnhandledPromiseRejectionWarning: TypeError: Image or Canvas expected

earnest phoenix
#
  bot.on("presenceUpdate", (oldMember, newMember) => {
    offline = await member.guild.createRole({name: "offline",
    color: "#ff0000",
    permissions: []
    })
    await newMember.addRole(offline.id);
  });
#

this is my code so far

#

I don't know how to make it check when someone goes offline

#

or goes online

tulip snow
#

Can somone show me how to write text on a image using JavaScript? I tryed canvas and Jimp and cant figure it out

gilded blaze
#

@earnest phoenix compare the old member to the new. Get the presence property and act according to that

earnest phoenix
#

ummm

#

ok

split lantern
#

btw people can just set their status to invisible and get the offline role

earnest phoenix
#

Ik

#

But oh well

#

how do you grab emojis from other servers to use?

#

isn't it

#

emoji: "emojiname:emojiID"

#

?

tardy viper
#

Plz can you help me

#

i have create a system to activate desactivate command so the problem is the command disabled on all server

karmic prism
#

w.h

#

$help

uncut slate
obtuse wind
#

How would I lock a command to myself only?

earnest phoenix
#

hey

#

how do i use skyslik

#

just logged in

#

can anyone help me

topaz fjord
#

@obtuse wind check if the user ID of the person trying to execute the command matches yours

obtuse wind
#

I mean many people ran the command

#

already

#

so I'm trying to lock the command for myself only

topaz fjord
#

Do u use js

obtuse wind
#

Only people with the administrator permission should be able to use it, and yes I do

earnest phoenix
#

yea i do

obtuse wind
#

I use discord.js and node.js

earnest phoenix
#

rip not talking to me

#

XD

#

can anyone help me use skyslik i jsut signed in

topaz fjord
#

discord.js has a property to check if users have a certain permission

obtuse wind
#

would it be (!msg.author.hasPermission((etc)))

topaz fjord
obtuse wind
#

oh thanks

topaz fjord
#

np

obtuse wind
#

So would it be ".hasPermission(checkOwner)"

earnest phoenix
obtuse wind
#

mkay

earnest phoenix
#

does anyone here know anything about skyslik cloud?

ruby dust
#

its free

obtuse wind
#

Rip I got (node:9156) 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)

earnest phoenix
#

or if u want a better code u have just to use this :
const credentials = require('./urconfig.json');

if(credentials.ownerID.includes(message.author.id)) {
return message.channel.send('ur error message');
}

#

@ruby dust i got it

#

how do i use it?

#

to run my bot?

ruby dust
#

just like any other vps

earnest phoenix
#

but it doesnt have VM like the windows interface and i dont know how to use it

#

google is ur best friend

#

XD

ruby dust
#

well you asked about skysilk specifically, so the question "how to use a vps" would be more relevant in this case

earnest phoenix
#

mm.m

#

i dont think skyslik has VM XD

ruby dust
#

you create a container and choose OS you want for your VM

earnest phoenix
#

like CentOS 7

#

?

ruby dust
#

I'm using Ubuntu 16.04

earnest phoenix
#

ok ill use that too

ruby dust
#

oh I think I get what you are asking about

#

the VMs aren't graphical

earnest phoenix
#

yea

#

ah

ruby dust
#

nearly any OS you'll choose will be interactable by a terminal

earnest phoenix
#

how do i add files then?

#

and add all the stuff?

ruby dust
#

you use something for transfering files

#

I use FileZilla Client

earnest phoenix
#

ahhh

#

do i have to add a ssh key?

ruby dust
#

iirc ssh key is only used to access root

earnest phoenix
#

will i need root?

ruby dust
#

but you do have to create a private key with putty's key generator

earnest phoenix
#

yesi do

ruby dust
#

root is like admin access on windows

earnest phoenix
#

nvm

#

i have a public one

#

XD

#

@ruby dust what does the root do?

#

like download npm if needed?

ruby dust
#

read my previous message

earnest phoenix
#

thats all?

#

how would i download npm?

ruby dust
#

initially you won't have any users registered on your machine

#

so you'll need root to create some

earnest phoenix
#

in terminal nvm i know

#

XD

ruby dust
#

unless you want to run programs on root

#

which I doubt it's a good option

earnest phoenix
#

XD

#

is the host

#

the name

#

?

ruby dust
#

it's basically running programs with admin access, which you then generally trust the program to not mess up with your machine's system files

#

¯_(ツ)_/¯

earnest phoenix
#

waht would be the host name?

ruby dust
#

any name you want

#

your machine name, I guess

earnest phoenix
#

ok let me test

#

it cant connect to the server XD

#

on filezilla

ruby dust
#

do you have a private key?

earnest phoenix
#

i have a ssh key from putty key gen

#

the type is RSA

ruby dust
#

make sure you make it look something like that

earnest phoenix
#

is that on putty keygen?

ruby dust
#

that's on filezilla 🤔

earnest phoenix
#

what would be the host tho?

ruby dust
#

the key file should be a path to your ssh key

#

your server's ip

earnest phoenix
#

and the password is the password i made

ruby dust
#

there is no password

#

I mean, the password is the one you made for your key

earnest phoenix
#

ahhh

#

it cant connect XD

#

im so confused XD

ruby dust
#

well, google might help you then ¯_(ツ)_/¯

earnest phoenix
#

ok

#

one morequestion

#

was will the port be

#

If I use snekfetch to get a response like this, how can I get memes[0].url

{ "success": true, "data": { "memes": [ { "id": "61579", "name": "One Does Not Simply", "url": "http://i.imgflip.com/1bij.jpg", "width": 568, "height": 335 }, { "id": "101470", "name": "Ancient Aliens", "url": "http://i.imgflip.com/26am.jpg", "width": 500, "height": 437 } // probably a lot more memes here.. ] } }
#

finally got in

#

@ruby dust it gave me a warning that it might not be my computer

#

like the vps

#

do i ignorethat

ruby dust
#

I never got that Thonk

#

screenshot?

earnest phoenix
#

i already done it

#

it says if you want to trust the host

ruby dust
#

oh wait, I think I do remember

#

if you first time log into the server it'd ask if you trust the host

#

yeah that's normal

earnest phoenix
#

ok

#

thank god

tardy viper
#

how to create max length message

earnest phoenix
#

@ruby dust so i jsut drag the folder in

ruby dust
#

yes

earnest phoenix
#

after that question how do i run the bot?

ruby dust
#

for that you need something that acts as a terminal

#

I use PuTTY

earnest phoenix
#

ok

#

how do i put the password in putty?

#

@ruby dust

#

wait

#

nvm

#

i got it

#

how do you install npm on putty

#

and node

slender thistle
#

google.com

#

And that's more like "installing npm on <Your VPS OS>"

#

Because PuTTY is not the OS itself

unique nimbus
#

Correct

#

Whatever OS you are on download it on that terminal

#

idk if there isnte

#

i dont have one

#

its on my raspberry pi

earnest phoenix
#

i use skyslik

slender thistle
#

SkySilk is not the OS, either

eager spoke
#

Which OS do you have on your vps?

earnest phoenix
#

there isnt a VM interface like window

eager spoke
#

Oo

#

Ahh yeah

#

Of course

slender thistle
#

Tf do you have as an OS? Linux?

eager spoke
#

Its cli only servers

earnest phoenix
#

so now you know XD

#

yes

slender thistle
#

Ubuntu? CentOS? Debian?

earnest phoenix
#

but its like not google cloud or aws

#

Ubuntu

slender thistle
#

Shouldn't it be apt-get install node

#

Or whatever

#

Use Google for those stuff

earnest phoenix
#

trying

eager spoke
#

apt install npm

#

apt-get is outdated and shouldnt be used anymore

slender thistle
#

Blame my Ubuntu 16.04 then :p

earnest phoenix
#

its apt install npm

#

It was apt-get

#

but when i try it it says failed

#

Distro and version

eager spoke
#

apt update

#

First that

sullen path
#

Don’t forget sudo

eager spoke
#

Isnt he root?

slender thistle
#

Is sudo required on root

sullen path
#

No

earnest phoenix
#

When you add a repo you have to sudo apt update

sullen path
#

Only for non-root users

slender thistle
#

And he is on root, afaik

eager spoke
#

Substitute do

earnest phoenix
#

yes

#

root

slender thistle
#

I feel like there's too many people trying to help so I am off. Cya people and gl

earnest phoenix
#

XD

#

want me to update my putty

eager spoke
#

Putty is a tunnel to your vps

slender thistle
#

You don't fckin update PuTTY

earnest phoenix
#

XD

#

i dont know ok

#

XD

eager spoke
#

Try a linux tutorial

unique nimbus
#

oof

eager spoke
#

It would be more useful than anything

earnest phoenix
#

Ya trying to install node or smth

unique nimbus
#

i ❤ linux

#

what you using

earnest phoenix
#

im tryin to download npm

#

i hate mac

#

i have node already

eager spoke
#

arch for me

#

on a macbook pro xd

earnest phoenix
#

Node installs npm automatically thonkku

unique nimbus
#

here

#

this might help

#

@earnest phoenix

earnest phoenix
#

ok

unique nimbus
#

this is for debain terminal tho

#

If i remember correctly

#

wait no

#

its for everything

earnest phoenix
#

it says npm is not installed

#

but node is install

#

i did apt install node-legacy

#

is that correct?

#

Can someone help me pull memes from Reddit?

#

In JavaScript. I googled like 20 different things and everything came up with JavaScript memes on r/programmerhumor

uncut slate
#

appending .json to a subreddit url gives you the page in JSON

#

query param docs you can find here https://www.reddit.com/dev/api/

unique nimbus
#

Hello, i am using discord.py and may i ask how to make certain commands work only in NSFW channels

slender thistle
#

Rewrite or async?

eager spoke
#

Check if the channel has the nsfw option

earnest phoenix
#

Thx @uncut slate

slender thistle
unique nimbus
#

Async

#

oh fuck

slender thistle
#

Yep, you can't

#

Move to rewrite :^)

unique nimbus
#

oof idfk how to

#

bot just got denied for it

slender thistle
#

Join discord.py server Google can help ya and use ?tag install rw in #testing there

#

But well, if you don't wanna migrate to rewrite, you can't check if the channel is marked as NSFW

#

Rewrite has breaking changes sometimes and all that stuff, so it's up to you whether or not to move your bot to rewrite

unique nimbus
#

i have to

#

but long process

#

oof

slender thistle
#

F

unique nimbus
#

tutorials why

slender thistle
#

Hm?

unique nimbus
#

I am new to coding so i used tutorials

#

rewrite tutorials

#

oof

slender thistle
#

Oh

unique nimbus
#

RIP

earnest phoenix
#

apparently my node version is 4. 2.6

#

?

#

why

#

i did apt install nodejs-legacy

vital lark
#

@earnest phoenix You need to install Node.js, not the legacy

earnest phoenix
#

how?

earnest phoenix
#

wait

#

i did nodejs-legacy

vital lark
#

yes

earnest phoenix
#

im usering a vps

#

on putty

#

tho

#

which section is that?

#

is it this

#

pacman -S nodejs npm

#

nvm

earnest phoenix
uncut slate
#

use a json parser lol

sick cloud
#

Firefox Developers Edition has one built in. mmLol

sullen path
#

I write my json parser on a case to case basis because Java json parsers are bad mmLol

earnest phoenix
#

anyone know this error

#

module.js:549
throw err;
^

Error: Cannot find module '/root/index.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

#

ahhh

#

nvm

#

nvm

eager spoke
#

Also pacman is archlinux packet manager

earnest phoenix
#

why is this

#

Error: Cannot find module './config.json'

#

is ./config.json correct?

sick cloud
#

Well, is the config.json file in the same directory as the file that's trying to use it?

#

./ = your cwd. If your trying to get it from /files/, you'd need to use ./../config.json as an example.

earnest phoenix
#

yes

sick cloud
#

How are you trying to require it then?

earnest phoenix
#

did that

#

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

sick cloud
#

So you have /<file>.js and /config.json in the same folder?

earnest phoenix
#

yes they are

#

ill show you

sick cloud
#

👀

#

Try config.json alone?

#

Or put your config in a .js file and use require('./config'); mmLol

earnest phoenix
#

ok

#

nvm

#

fixed

#

ty

#

it wasnt that

#

there was config.ytapi

#

XD

#

in np.js

sick cloud
#

kek

earnest phoenix
#

How to tell when a user updates his/her avatar?

#
const Discord = require("discord.js")

module.exports.run = async (bot, message, args) => {
  message.channel.send("Griffin....").then(Message => {
    bot.setInterval((fn, delay, ...args) => { Message.edit("I am sorry..."); }, 5000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("I never meant to hurt you..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("I just wanted to make you happy..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("I guess I failed at that..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("Seems how we are no longer friends..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("I am sorry for what I did..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("You mean a lot too me and I was foolish..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("I lost you and I lost a little bit of me too..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("Please forgive me..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("Let's be friends like we used to before all that happened..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("Even if we can't..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("I still care about you..."); }, 8000);
    bot.setInterval((fn, delay, ...args) => { Message.edit("Always will :heart:"); }, 8000);
  });
}

module.exports.help = {
  name: "sorry"
}
#

can someone please help me

#

after a certain point

#

it speeds up

#

and doesn't wait

knotty steeple
#

that code looks so messy

#

also @earnest phoenix ratelimit

#

its trying to edit the message at the exact interval

earnest phoenix
#

ratelimit?

#

How can I fix it

knotty steeple
#

yea

earnest phoenix
#

I want it to do it

#

after waiting

#

8 seconds

knotty steeple
#

all of them cant be 8 seconds

earnest phoenix
#

Oh

#

yea

#

that would be

#

smart to change huh

knotty steeple
#

yes

#

also your doing setInterval

#

and not setTimeout

earnest phoenix
#

Oh yea

#

I should change that too ><

#
const Discord = require("discord.js")

module.exports.run = async (bot, message, args) => {
  message.channel.send("Griffin....").then(Message => {
    bot.setTimeout(() => { Message.edit("I am sorry..."); }, 3000);
    bot.setTimeout(() => { Message.edit("I never meant to hurt you..."); }, 5000);
    bot.setTimeout(() => { Message.edit("I just wanted to make you happy..."); }, 6000);
    bot.setTimeout(() => { Message.edit("I guess I failed at that..."); }, 4000);
    bot.setTimeout(() => { Message.edit("Seems how we are no longer friends..."); }, 6000);
    bot.setTimeout(() => { Message.edit("I am sorry for what I did..."); }, 4000);
    bot.setTimeout(() => { Message.edit("You mean a lot too me and I was foolish..."); }, 6000);
    bot.setTimeout(() => { Message.edit("I lost you and I lost a little bit of me too..."); }, 7000);
    bot.setTimeout(() => { Message.edit("Please forgive me..."); }, 4000);
    bot.setTimeout(() => { Message.edit("Let's be friends like we used to before all that happened..."); }, 8000);
    bot.setTimeout(() => { Message.edit("Even if we can't..."); }, 4000);
    bot.setTimeout(() => { Message.edit("I still care about you..."); }, 5000);
    bot.setTimeout(() => { Message.edit("Always will :heart:"); }, 4000);
  });
}

module.exports.help = {
  name: "sorry"
}
#

Like that?

quartz kindle
#

why are you trying to edit many times at the same time?

earnest phoenix
#

huh....

quartz kindle
#

like

#

settimeout will not wait until one has finished

earnest phoenix
#

Why

quartz kindle
#

all timeouts will be executed immediatelly

#

and place a timer

earnest phoenix
#

are people telling me different shit everythime :/

quartz kindle
#

so all timeouts that you have with 4000, will all run at the same time after 4 seconds

earnest phoenix
#

:/

knotty steeple
#

@earnest phoenix if you did setinterval once you run the command the bot will always try to edit the message

earnest phoenix
#

I just want to fix this ugh

knotty steeple
#

until you stop it

earnest phoenix
#

This is getting so complicated ><

#

SO many people

#

have told me something different

quartz kindle
#
timeout 500;
timeout 500

// all 3 time outs will go at the same time after 500ms

timeout 500;
timeout 600;
timeout 700;

// one will go after 500ms, the next one after 600ms, the next one after 700ms. a waiting time of 100ms bewteen each one```
#

the timer for all timeouts is set immediatelly

earnest phoenix
#

So wait

quartz kindle
#

in js there is no such thing as waiting for a function to finish

#

only promises and async functions can "wait"

earnest phoenix
#

Oh ok

#

Also

#

do I just take out

#
bot.setTimeout(() =>
#

?

#

that

quartz kindle
#

you can do 2 things

#

either timeout 3000; timeout 8000; //3000+5000 timeout 14000; //3000+5000+6000 etc... or timeout(timeout(timeout(6000), 5000), 3000) etc...

earnest phoenix
#

ummmmmm

#

idk

#

How would I even use that?

#

Would i have to put it at the end

#

of each message edit?

quartz kindle
#

it doesnt matter how you do it as long as you understand the concept

earnest phoenix
#

yea

quartz kindle
#

if you want to wait for a timeout to finish before you do the next timeout, you have to put the timout one inside each other

earnest phoenix
#

it is supposed to delay right?

quartz kindle
#

or you make all timeouts at once, but have their timers work in the sequence you want

earnest phoenix
#

<

quartz kindle
#

for example if you want to wait 5 seconds, you do the first at 5000, and the second one at 10000

#

so there is a 5 second delay between them

earnest phoenix
#

Oh ok

#

so wait

#
    Message.edit("I lost you and I lost a little bit of me too...")
    timeout 5000;
#

like that?

quartz kindle
#

no...

earnest phoenix
#

oh...

quartz kindle
#

i just did it to show you