#development

1 messages · Page 805 of 1

lethal stratus
#

\

true ravine
#

Show any relevant code

#

Otherwise it's hard to help you

grizzled raven
#

wait how do you disable events in v12

lethal stratus
#

nevermind

grizzled raven
#

yeah i saw that

#

just meant to ask how would you, if possible

quartz kindle
#

its possible

lethal stratus
#

apparently it was b'locked on our network because the bot keeps trying to download MULTIPLE GIGS of data in a day

quartz kindle
#

but its one ugly workaround

lethal stratus
#

any ideas how to stop it doing that

#

guys???

grizzled raven
#

which is?

#

i mean like

#

a

earnest phoenix
#

ya dont turn it off

jk

#

if it sends images disable that

quartz kindle
#

@grizzled raven js const PacketHandlers = require(require.resolve("discord.js").replace("index.js","")+"client/websocket/handlers"); const disabledEvents = ["evt1","evt2",...]; for(event of disabledEvents) { delete PacketHandlers[event]; }

#

thats what i came up with lmao

#

if you find a better way let me know

grizzled raven
#

not that bad

#

and i could look into it i guess

lethal stratus
#

can anyone hear me

#

because im jsut being ignored ;-;

grizzled raven
#

unless you do /tts, then no

#

😎

#

OH

#

oh sorry didnt see your messages

lethal stratus
#

i need to find out why my bot is taking gigabytes of data transfer in a single day

grizzled raven
#

yeah idk

lethal stratus
#

and stop it

earnest phoenix
#

I told you how to stop it

hoary elm
quartz kindle
#

EAI_AGAIN is a DNS lookup timed out error, means it is a network connectivity error or proxy related error.

lethal stratus
#

because its destroying my internet

#

and it got blocked because of it

earnest phoenix
#

i told you XD

quartz kindle
#

how big is your bot h3?

#

how many servers

lethal stratus
#

i think the big bot is in 26 servers

earnest phoenix
#

you could also host it on a vps or something 🙂

lethal stratus
#

and there is a small one on 4 servers

#

on same pi

quartz kindle
#

yeah thats not normal

#

do you have any api's or image downloads running in them?

lethal stratus
#

it has a thing that sends images but it never directly handles them

#

it only serves images from a website

#

as a link

quartz kindle
#

are you running on linux

lethal stratus
#

yes

#

debian

quartz kindle
#

can you try running nethogs?

lethal stratus
#

it only shows my ssh connection on it

quartz kindle
#

are both bots broken?

lethal stratus
#

i think its because its still blocked because it was downloading so much data

#

my pi is blocked from accessing the internet

quartz kindle
#

blocked by what?

#

your own network?

lethal stratus
#

yes

quartz kindle
#

does your isp have bandwidth restrictions?

lethal stratus
#

no im talking about a block thats internal

quartz kindle
#

you think your own home network/router is blocking it?

lethal stratus
#

its being done by a proxy

#

im not in control of said proxy

quartz kindle
#

that makes no sense

lethal stratus
#

why

quartz kindle
#

your pi is in your home right?

lethal stratus
#

weve got a PFsense that takes everything to the router

#

everything goes through that

#

and it ccan block stuff and throttle stuff

#

but i am not in control of it

quartz kindle
#

ah so you think pfsense blocked it?

lethal stratus
#

not think, i know

#

because the person who controls it told me

#

after i asked why my pi cannot access internet

quartz kindle
#

then ask him to unblock it?

lethal stratus
#

i did

#

but he wont until i can find why it was doing that

quartz kindle
#

no way to find it without testing

lethal stratus
#

because we have slow internet so he doesnt want it to take all of it even for a while

#

still waiting on nbn

#

got a 1 megabit connection

grizzled raven
#

idk why but i feel like that disabled events thing would be useful for alot of people

quartz kindle
#

well, im gonna tell you one thing

#

discord bots are bandwidth hungry

#

unless you use intents

#

for example

earnest phoenix
#

Id just move it off site tbh

you can get bot hosting for a dollar a month

lethal stratus
#

do they auto download images?

quartz kindle
lethal stratus
#

the bot

quartz kindle
#

its on 2000 guilds

#

but

lethal stratus
#

thing is i have no money for this

quartz kindle
#

out of those 2000 guilds, discord bot list alone accounts for about 1/4th of users

lethal stratus
#

its just a passion project and i had a pi lying around

quartz kindle
#

so its safe to say this guild is responsible for at least 40-50kbps by itself

#

1mbit is 125kbps max

earnest phoenix
#

oh hmm
Im trying to think of solutions

quartz kindle
#

so 2 bots in this guild will use almost 100% of your bandwidth

lethal stratus
#

can you link a place where you can get the supposed 1$ host

grizzled raven
#

if you have unmetered, all those stats dont matter, right?

quartz kindle
#

now, the only solution is to use intents, which is a way to tell discord to send you only what you want

earnest phoenix
#

I would host it for you on my dedicated server but then you wouldnt have access (I cba to setup another ftp account and set perms)

grizzled raven
#

because im hella unorganised

earnest phoenix
#

thats where i hosted my bot before i bought a server

prime cliff
#

$3 a month is probably the least you will find/get for a vps that can run a Discord bot but i might be wrong

quartz kindle
#

for small bots, glitch.com is good enough, and its free

#

a decent vps starts at around $3

grizzled raven
#

if you use it right

lethal stratus
#

really?

earnest phoenix
#

its not a vps

lethal stratus
#

free hosting

#

wow

earnest phoenix
#

and doesnt glitch only allow a certain number of hours?

prime cliff
#

Glitch is free but not suited for Discord bots especially if your bot gets big enough

quartz kindle
#

another option is google/amazon, which both offer free for 12 months deals

earnest phoenix
#

^

lethal stratus
#

but you need to sign for that

quartz kindle
#

yes

prime cliff
#

@earnest phoenix people get around that by constantly pinging the host every hour to keep it running

lethal stratus
#

meaning you pay in the future

quartz kindle
#

no

earnest phoenix
#

oh i see

quartz kindle
#

you dont need need to commit

#

you can cancel it after 12 months

lethal stratus
#

wait whats this 18 bucks

prime cliff
#

128mb/512mb ram is not enough for a bot

lethal stratus
#

never pay again?

quartz kindle
#

lifetime hosting lmao

earnest phoenix
#

you pay 18$ and never again
thats for just a bot host
no vps just a control panel like minecraft hosts

prime cliff
#

Wait lifetime Pog

topaz fjord
#

I'm here to plug galaxygate

earnest phoenix
#

my bot did fine on the 2$ plan with about 10 servers

quartz kindle
#

im on galaxygate as well

topaz fjord
#

low prices™️ very good bandwidth™️

#

amazing support™️

earnest phoenix
#

only used a tenth of the resources
but it depends on your needs

#

music eats resources like crazy

quartz kindle
#

@earnest phoenix is it a node.js bot? does that ram account for the node process?

grizzled raven
#

according to them, a life lasts 18 months

topaz fjord
#

lmao

lethal stratus
#

lol

topaz fjord
#

music doesn't eat resources like crazy

#

transcoding it does

lethal stratus
#

if you are talking a pi tho

#

sending messages

topaz fjord
#

e.g. changing volume, filters, etc.

lethal stratus
#

eats resources

#

XD

#

my bots had to fight over CPU

earnest phoenix
#

Yes it is, and im not sure what you mean but my bot used about 50% of the basic plans ram

lethal stratus
#

100% all the time

earnest phoenix
#

thats why i upgraded then left lol

#

true turtle

lethal stratus
#

i just want to run on my pi :///

quartz kindle
#

because the node process by itself already uses about 50mb ram

#

so 128mb ram is very small for a node.js bot

lethal stratus
#

because my pi means i can SSH to make any changes very quickly

grizzled raven
#

even if its patreon

#

probably

quartz kindle
#

you can ssh on any vps

lethal stratus
#

but is it speedy

earnest phoenix
prime cliff
#

512mb ram for a js bot in this server will be screaming Blob_Sweat c# will work though because it dosen't succ ram

quartz kindle
#

if your internet is good, yes lol

lethal stratus
#

my internet is not good

#

i said this like

#

3 times

earnest phoenix
#

lol

lethal stratus
#

i have 1 megabit

cursive dagger
#

Ouch

lethal stratus
#

125kb/s

quartz kindle
#

my suggestion is

#

if you want to start with something small and simple, give glitch.com a try

lethal stratus
#

im not just starting tho

mystic violet
#

Huh, Changed my lavalink password and keep getting this

2020-03-01 18:33:42.649 ERROR 12648 --- [ XNIO-1 task-13] l.server.io.HandshakeInterceptorImpl     : Authentication failed from /3.84.214.88:52772
2020-03-01 18:33:42.698 ERROR 12648 --- [ XNIO-1 task-14] l.server.io.HandshakeInterceptorImpl     : Authentication failed from /54.152.134.66:54634```
#

Glad I changed it lmao

quartz kindle
#

then if you feel you want a full machine, give google's free plan a try

lethal stratus
#

ive had my bots going since like november last year

#

i have fully functional bots

quartz kindle
#

then i recommend getting an actual vps

lethal stratus
#

i has no money!!!!!

quartz kindle
#

also, your bots will have very high latency in your pi probably

hybrid geode
#

reee

quartz kindle
#

a vps will fix that

hybrid geode
#

get a job
@hybrid geode

quartz kindle
#

try google's 12 month free plan

#

my bot was there for a year

earnest phoenix
#

he may not be able to work

hybrid geode
#

true

lethal stratus
#

@quartz kindle latency on pi is about 100ms

quartz kindle
#

then your internet is not even that bad

lethal stratus
#

it is tho

#

its slow

topaz fjord
#

3 dollar plan on GG is cool

#

ping is also great

lethal stratus
#

i have no 3$ a month to pay

quartz kindle
#

when i started, i used to host my bot in a spare laptop, in a third world 5mbit internet. the bots's latency was anywhere between 1s and 20s randomly

lethal stratus
#

ok

#

but

topaz fjord
#

I started with 1&1

#

but they're shit

lethal stratus
#

your 5mbit is 5x mine

#

@quartz kindle

quartz kindle
#

h3, do you have access to a credit card, or can borrow one?

lethal stratus
#

no

quartz kindle
#

@lethal stratus and latency was 20x worse than yours

lethal stratus
#

not untill like next year can i legally get a job either

topaz fjord
#

I just use my parents

#

$10/month and a domain for $10 a year

lethal stratus
#

nor are parents concerned about paying for a thing for me that has no real purpose to them

topaz fjord
#

but the domain is useless and im gonna replace it for something I'll actually use

quartz kindle
#

then your only option is glitch/heroku, both of which are free with some bypassable restrictions, but they are not full machines, only app instances

topaz fjord
#

cause my bot is gonna be no more

lethal stratus
#

parents will not pay for my stuff

#

i just wanna keep using my pi ;-;

#

maybe gotta hold out a few months for NBN

earnest phoenix
#

then youll have the bandwidth issue

lethal stratus
#

then internet will be able to support my pi being online

quartz kindle
#

i can help you debug your pi, but you need it to be unblocked first

lethal stratus
#

well

#

my other option

#

is to run the bot on my unblocked comp

#

to debug

earnest phoenix
#

maybe move it to google till you get the better internet?
Or move it and have tim help

topaz fjord
#

also holy shit you cant do anything with 2GB storage and 128MB ram

earnest phoenix
#

or that

topaz fjord
#

on sparked

lethal stratus
#

@topaz fjord you can host a Tekkit 3 server

earnest phoenix
#

you can turtle XD
I did it while i made the first version of my bot

topaz fjord
#

also

#

they say FFMPEG doesn't work

lethal stratus
#

so im gonna go ahead and copy the files for bot over to comp

#

brb

topaz fjord
#

I should start up my bot for a bit

earnest phoenix
#

indeed

topaz fjord
#

but that's not gonna happen

earnest phoenix
#

why not?

#

lol

topaz fjord
#

probs gonna shut it down and open source

#

not interested in it anymore

earnest phoenix
#

oof

#

tbf my bot was an open source bot but i redid almost all of it now im starting from scratch so it can truly be mine

Only like 2 of the original commands are the same

quartz kindle
#

btw

topaz fjord
#

?

quartz kindle
#

this is how much intents matter

lethal stratus
#

aight scp'd files over

quartz kindle
#

first one is my bot without intents

#

third one is the same bot, with intents

lethal stratus
#

what is intents

topaz fjord
#

how do you use them @quartz kindle

lethal stratus
#

is that

#

about what kinds of data they care about?

#

to parse

#

and download

quartz kindle
#

intents are a discord option, where you can select what kind of stuff you want them to send to you, instead of simply sending everything

topaz fjord
#

you can disable certain events with intents

lethal stratus
#

ah

#

i will look into

topaz fjord
#

how do i use it timmy boy

lethal stratus
#

stuff like ignoring images

#

that will be a huge help

topaz fjord
#

images are part of message events

#

so

lethal stratus
#

then i may have a good argument to unblock bot

topaz fjord
#

probably not

lethal stratus
#

??

quartz kindle
topaz fjord
#

images are part of message events

#

if you disable images

#

you disable messages as well afaik

quartz kindle
#

in discord.js you can use them with the ws client options

topaz fjord
#

yeah they aren't seperate

quartz kindle
#
new Client({
  ws: {
    intents: bitmask
  }
})```
topaz fjord
#

i need to see if JDA has something for this

lethal stratus
#

how do i tell it not to download the images

quartz kindle
#

the problem is not images

lethal stratus
#

or is it not already

#

what is the issue

quartz kindle
#

90% of the bandwidth is presence updates

lethal stratus
#

aight i am running my bot

quartz kindle
#

try adding this to your bot: js client.on("raw",r => { console.log(r.t) })

#

and you will see

lethal stratus
#

it is immediatly maxing out my connection

topaz fjord
#

I can probably get rid of ```
DIRECT_MESSAGE_TYPING,
GUILD_MESSAGE_TYPING,
DIRECT_MESSAGE_REACTIONS,
GUILD_PRESENCES,
GUILD_INVITES,
GUILD_WEBHOOKS,
GUILD_INTEGRATIONS,
GUILD_EMOJIS,
GUILD_BANS,
GUILD_MEMBERS

quartz kindle
#

also, can i see your code?

topaz fjord
#

god damn that's a lot

lethal stratus
#

it says

quartz kindle
#

@topaz fjord the most problematic part of intents is that disabling GUILD_MEMBERS also disables guildMemberAdd, guildMemberRemove and guildMemberUpdate

#

other than that its fine

lethal stratus
#
READY
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
GUILD_CREATE
null
null```
topaz fjord
#

I don't use any of those afaik

#

it's mainly music

#

for my bot

quartz kindle
#

yeah, but if you use any kind of user count tracking, it wont be updated

topaz fjord
#

idk if guildMemberUpdate will fuck up voice though

#

oh

#

so like guid join events?

quartz kindle
#

yup

topaz fjord
#

fuck

quartz kindle
#

@lethal stratus thats all? nothing more?

lethal stratus
#

ok now im REALLY confused

#

the incoming traffic for my bot is

#

143 bytes/s

#

now

#

what if i boot up the other bot

#

thats in discord bot list

quartz kindle
#

ah so that one is not in the list?

lethal stratus
#

yes

quartz kindle
#

alright, now try the one in the list lul

#

you'll see what 80k members do to your bot

earnest phoenix
#

👀

lethal stratus
#

kk

topaz fjord
#

oh well

#

jda doesn't support it yet

lethal stratus
#

let the copying begin

#

so many js files from discord.js lib

topaz fjord
#

wut

lethal stratus
#

aight it done

#

ugh

topaz fjord
#

tim you wanna code my image server for me

#

in rust

lethal stratus
#

my old bot thats on bot list

#

its so badly written

#

the code burns to look at

#

its booting

#

holy crap

#

thats a LOT of GUILD_CREATE

quartz kindle
#

how many guilds are you in?

lethal stratus
#

26

quartz kindle
#

ah thats not much

lethal stratus
#

thats like

#

also

quartz kindle
#

imagine 2000

lethal stratus
#

there

#

OMG

#

"PRESENCE_UPDATE" x 1000000000000000000000

topaz fjord
lethal stratus
#

whats with all the presense_update

#

there is so mmuch

quartz kindle
#

exactly

lethal stratus
#

like wat

quartz kindle
#

thats what discord does to you

topaz fjord
#

discord api is good software™️

lethal stratus
#

what the heck is it doing

#

seriously

quartz kindle
#

people coming online and going offline

lethal stratus
#

wtf is it doing

#

oh

quartz kindle
#

thats what it is

lethal stratus
#

oh wow

#

thats

quartz kindle
#

look at this

topaz fjord
#

I wanna make a new bot but im bored af

lethal stratus
#

im secondthinking ever putting my bot on the list

quartz kindle
#

look at the timestamps

lethal stratus
#

i think i should delete the application to put my new bot on the ist

#

*list

quartz kindle
#

thats like 30 updates in 50 milliseconds

topaz fjord
#

tim im taking that as a yes

quartz kindle
#

a yes to what

#

lmao

topaz fjord
#

writing my image server

#

in rust

#

while I finish the application that goes with it

#

in obj-c

lethal stratus
#

do you think i should get my bot removed from the list so i can actually have a functional bot

quartz kindle
#

i dont rust

#

lul

topaz fjord
#

you're gonna rust now

lethal stratus
#

guys?

quartz kindle
#

im stainless steel

#

i cant rust

topaz fjord
#

lmao

lethal stratus
#

aight im gonna remove it from the list

#

goodbye bot dev role, and goodbye h37 from this server

#

F

quartz kindle
#

@lethal stratus what does your bot do? depending on your needs, you can use intents

grizzled raven
#

what about message events

topaz fjord
#

you don't have to leave

lethal stratus
#

what do intents dooooooooooooooooo

topaz fjord
#

@grizzled raven what about them

quartz kindle
#

i told you

#

and even sent the link

grizzled raven
#

nothing

lethal stratus
#

@topaz fjord if its stopping me from having a bot at all, yes i do

quartz kindle
#

i already told you want intents do, they tell discord to only send you XYZ instead of sending you EVERYTHING

topaz fjord
#

ok fuck obj-c

#

no annotations support

quartz kindle
#

but intents have certain restrictions, so depending on what your bot does, you might not be able to use them without developing workarounds

topaz fjord
#

ahhhhhhhhhhhhhh

amber fractal
#

It will actually be really helpful to save memory usage so you dont get events for stuff you dont use

lethal stratus
#

well my bot only really does random stuff with messages

quartz kindle
#

alternatively, you can try using my library, which takes care of all that crap for you

amber fractal
#

It's just privileged intents are garbage

quartz kindle
#

^true

amber fractal
#

Intents will be not optional in a future version though

#

idk when, however

quartz kindle
#

when gateway v7 gets released

lethal stratus
#

intents can only do so much

#

the issue is just having the bot in such a massive server

#

as such

#

it makes sense for me to remove it from the list

quartz kindle
#

thats not an issue

lethal stratus
#

and keep it as a thing in just a few servers as something for fun

topaz fjord
#

it only becomes an issues if the hosting decides to die

quartz kindle
#

@lethal stratus try doing this: js client = new Client({ ws: { intents: 1+512 } })

topaz fjord
#

optimizations are also a thing

#

bitshift fool

#

fuck math

quartz kindle
#

that will enable only guilds and messages intents

lethal stratus
#

ah

quartz kindle
#

everything else will be disabled

#

see if your bot breaks

lethal stratus
#

k

quartz kindle
#

and see the difference it makes

#

with bandwidth and cpu

lethal stratus
#

time to find out

#

-=ping

#

oop

quartz kindle
#

lul

lethal stratus
#

ah

#

yes

#

no perms

#

looking at console

#

things look good

#

its only getting MESSAGE_CREATE

#

which is actually all it needs!

#

thanks!

quartz kindle
#

now you need to care for certain things

#

for example

#

with the intents i gave you, there is no roles, no permissions, no emojis, no dms, etc

lethal stratus
#

ah

quartz kindle
#

also no message reactions

#

and no member join/leave

#

and no ban/kick

lethal stratus
#

it doesnt need anything but messages lol

topaz fjord
#

tim

#

commas exist

lethal stratus
#

my other bot however

quartz kindle
#

i type faster than i think

topaz fjord
#

i can tell

quartz kindle
#

:^)

lethal stratus
#

needs to know who has what roles, needs reactions, dms, and messages.

quartz kindle
#

you can enable the roles, reactions and dms intents

lethal stratus
#

k

quartz kindle
#

check this

#

for example, 1 is guilds, and it includes all these

lethal stratus
#

welp

#

im amazed whats been achived

quartz kindle
lethal stratus
#

my bot has gone from eating all resources

#

and maxing bandwidth

#

to requiring a similar level of network as my other

quartz kindle
#

you're welcome

lethal stratus
#

imagine how little that one would need

#

@quartz kindle thanks a lot

mystic violet
#

Anyone know how I would setup a lavalink node on heroku

earnest phoenix
#

is there a link on a step to step guide on a music bot?

mystic violet
#

Yeah

#

As easy as google

lethal stratus
#

lol

mystic violet
#

I mean, I googled my question, wish it was easier

earnest phoenix
#

where do I put the touch commands?

topaz fjord
#

the documentation is the best guide available

earnest phoenix
quartz kindle
#

why do you need that?

#

touch is for linux/mac, not for windows

earnest phoenix
#

so do I just nmp i index.js?

#

in cmd prompt?

quartz kindle
rapid dawn
#

Is it a problem that my bots mostly only reacts to the guild owner?

earnest phoenix
#

it shouldnt be a problem

#

unless you set it up that way

#

for getting on dbl i believe so (see modlogs) but maybe that was the intent?

#

if it was let them know 🙂

rapid dawn
#

I did, I intend to have it like that

#

I tell me mods?

#

might change it to admin idk

earnest phoenix
#

I think having it in the site description would be okay. but tbh idk

#

ive never heard of this

mystic violet
#
2020-03-02T00:50:30.460013+00:00 app[web.1]: Error: Unable to access jarfile target/Lavalink.jar```
#

This is on heroku btw

#

Im not sure how to make it work

#

@earnest phoenix cause you need to be in a voice channel for it to join it

earnest phoenix
#

I am

#

I am in general

mystic violet
#

What version of discord.js?

#

try

if(message.member.voice.channel) { ....

#

if you're in V12

earnest phoenix
#

how do I check version?

mystic violet
#

so

if(!message.member.voice.channel) return message.channel.send("Must be in a voice channel...");

#

Oh

#

require('discord.js').version

#

Theres an npm command just forget what it is

earnest phoenix
mystic violet
#

do a console.log(Discord.version)

#

after const Discord

#

and tell me what it shows

topaz fjord
#

Why do you have 2 message events

mystic violet
#

Also, I dont recommend using ytdl-core, I recommend lavalink lmao

earnest phoenix
#

its a broken code

topaz fjord
#

There's no need for 2 message events

earnest phoenix
mystic violet
#

console.log

#

not const.log

earnest phoenix
#

oops

mystic violet
#

lmao

#

rip

#

its ok

earnest phoenix
#

its 12.0.1

mystic violet
#

turtle I was the same way when I started coding lmao

#

Okay so try the if command I sent you

#

instead of Member.voiceChannel

#

its <member>.voice.channel

earnest phoenix
#

send me the whole code

amber fractal
#

Spoonfeeding isn't allowed

mystic violet
#

oops

#

almost did it lmao

earnest phoenix
#

:/

#

so where do I put this code at?

#

(!message.member.voice.channel) return;

#

he told you

#

instead of Member.voiceChannel its <member>.voice.channel

#

just replace it 🙂

#

where do you see member.voicechannel?

#

lol

mystic violet
#

var { VoiceChannel } = message.member

#

message.member is the <member>

earnest phoenix
mystic violet
#

Yep

earnest phoenix
#

Thats why i dont like the new update XD so much has changed

but ig its meant to be easier /shrug
and yes

mystic violet
#

and the if command below it

earnest phoenix
#

oof beat me to it

#

so replace the whole thing with <member>.voice.channel?

mystic violet
#

replace the if command

#

if(!member.voice.channel) {
do stuff
}

#

member is your member object, so message.member

#

message.member.voice.channel

earnest phoenix
#

this?

mystic violet
#

the if command below that line

earnest phoenix
#

what line?

#

in that screenshot?

mystic violet
#

yeah

earnest phoenix
#

so 1,2,3 or 4?

#
var memberchan = message.member.voiceChannel
memberchan.join()```
#

This work

#

:)

mystic violet
#

it doesn't though @earnest phoenix he's using V12

#

its different now 😂

earnest phoenix
#

Oh

#

Yeah

#

Sorry i use 11.5.1 and 11.6.1

mystic violet
#

well V12 just came out so

earnest phoenix
#

I know

mystic violet
#

lavalink still hasnt updated

#

so Im on V11 too

earnest phoenix
#
#
message.member.voice.channel.join();```
#

how do I change my discord.js version?

grizzled raven
#

@quartz kindle hey about your disabled events thing,

const PacketHandlers = require(require.resolve("discord.js").replace("index.js","")+"client/websocket/handlers");
const disabledEvents = ["evt1","evt2",...];
for(event of disabledEvents) {
    delete PacketHandlers[event];
}  ```
couldnt you change the `.replace("index.js", "")` to `.replace("index.js", "client/websocket/handlers")`?
mystic violet
#

is it really that complicated lmao

earnest phoenix
#

@earnest phoenix what version you want?

quartz kindle
#

yeah lmao

earnest phoenix
mystic violet
grizzled raven
earnest phoenix
#

voiceChannel isn't for v12

#

Just delete the var

#

that one worked tho...

#

Or

grizzled raven
#

also

#

you could just manually delete the files yourself LUL

earnest phoenix
#
var memberchan = message.member.voice.channel.join();
memberchan.join()```
grizzled raven
#

not recommended but still doable

earnest phoenix
quartz kindle
#

lmao

#

well, i want my library to hack discord.js programatically

#

without touching any original files

#

:^)

earnest phoenix
quartz kindle
#

its a pain though having to redeclare an entire function just to change 1 line

earnest phoenix
#

Hmmmm

#

when I type my sb!play command the bot joins but when I provide a link it doesnt play anything any fix?

quartz kindle
#

the fix is learning programming, so you can understand what your code it doing, and be able to fix it yourself

earnest phoenix
#

Nice

mystic violet
#

😂

grizzled raven
#

wait

#

is this about the packet piece of code?

#

or dany

#

nevermind

#

btw

earnest phoenix
#

This regex for the prefix isn't really needed @earnest phoenix

mystic violet
#
2020-03-02T00:50:30.538728+00:00 heroku[web.1]: State changed from starting to crashed
2020-03-02T00:50:30.520009+00:00 heroku[web.1]: Process exited with status 1
2020-03-02T00:50:30.455447+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2020-03-02T00:50:30.460013+00:00 app[web.1]: Error: Unable to access jarfile target/Lavalink.jar``` my heroku bein bad
earnest phoenix
#

@grizzled raven this is a screenshot by yeet

grizzled raven
#

for (event of x) should be for (const/let event of x) because event isnt defined mmLol

#

xdd

earnest phoenix
#

Whi love lavalink for real?

quartz kindle
#

it doesnt really matter, although yes, its good practice

earnest phoenix
#

Oh okay

quartz kindle
#

its the same as for(i = 0; i < something; i++)

#

it wont throw i is undefined, it will treat it like a var

earnest phoenix
#

ok so how do I make the bot play music because the joining part is done

mystic violet
#

Get the connection

#

var connection = message.member.voice.channel.join()

#

instead of { voiceChannel }

earnest phoenix
mystic violet
#

I just told you to replace the if statement

#

everything else was fine

earnest phoenix
#

so do I put it in { connection }

quartz kindle
#

that code is so wrong

earnest phoenix
#

Why tf do you need that 3rd line

quartz kindle
#

trying to join twice, trying to destructure voiceChannel from a pomise

earnest phoenix
#

Also checking if the command was sent in a text channel....

grizzled raven
#

oh really?

mystic violet
#

😂

grizzled raven
#

oh ok nevermind then

quartz kindle
#

checking if its a text channel is good practice tho

grizzled raven
#

thought you had to define the iterator lol

earnest phoenix
#

But. It's a command.

#

Where tf else would you send it?

#

Voice?

quartz kindle
#

you do, but javascript treats anything followed by a = as a variable

earnest phoenix
#

No I'm saying a message handler would never trigger for a voice xhannnel

#

Channel *

#

So why bother checking

quartz kindle
#

to check for dms

earnest phoenix
#

Eh. True.

quartz kindle
#

!== "text" is the reverse === "dm"

earnest phoenix
#

I'm just used to dpy doing that all

mystic violet
#

@earnest phoenix remove the var, and the if statement, replace it with js if(!message.member.voice.channel) { return message.reply("Please join a voice channel first"); }

#

Then replace voiceChannel.join()

#

with message.member.voice.channel.join()

#

I mean, not the most organized but should work?

#

¯_(ツ)_/¯

earnest phoenix
mystic violet
#

Yep should work?

#

unless channel needs to be lowercase

quartz kindle
#

it does

earnest phoenix
#

it didnt work

#

joins channel but no music

#

"could not find an opus module"

mystic violet
#

run npm i opusscript node-opus

#

in console

quartz kindle
#

did you read the discord.js installation guide?

#

node-opus is deprecated, dont use it. and no need to install both, only one of them

mystic violet
#

lavalink

earnest phoenix
#

still no music

mystic violet
#

whats the error

quartz kindle
#

The preferred audio engine is @discordjs/opus, as it performs significantly better than opusscript. When both are available, discord.js will automatically choose @discordjs/opus. Using opusscript is only recommended for development environments where @discordjs/opus is tough to get working. For production bots, using @discordjs/opus should be considered a necessity, especially if they're going to be running on multiple servers.

earnest phoenix
mystic violet
#

learn internet

#

😂 idk what that error is

earnest phoenix
#

no erros

#

its not a error

quartz kindle
#

it is an error lol

earnest phoenix
#

it just doesnt play music

mystic violet
#

Tim, you take this. idk discord.js LMAO

#

I recommend using lavalink @earnest phoenix instead of ytdl-core

quartz kindle
#

i dont use voice

#

but try adding a catch statement to join

#
message.member.voice.channel.join().then(connection => {
  // do your stuff here
}).catch(console.log) // add this```
slender thistle
#

I throw errors instead of using if-statements

quartz kindle
#

throw an error to catch it later

#

its true that its kinda easier to throw errors into a global error handler :^)

slender thistle
#

:^)

#

Fuck your memory

quartz kindle
#

microoptimizations

slender thistle
quartz kindle
#

when you're 5 levels deep into nested code, its either throw or having to handle a return 5 times

slender thistle
#

oof

#

Yeah I can see that

broken shale
#

d.js updated again .-.

#

But now v12 is now officially stable

earnest phoenix
#

v13 master gang

#

I’ll pry stay on v11 till v3 of my bot

visual sandal
#

I’m on v400

#

*on my bot

#

Now I have to redo the entire thing for v12

copper cradle
#

its not a error
@earnest phoenix are you dumb? it's an error, it fucking says error, learn to read, then learn to code

earnest phoenix
#

That’s why I am waiting. I’ve already started redoing my entire bot don’t wanna restart the revamp

#

isnt

#

voice.channel.join()

#

lowercase C ?

#

and if (message.channel.type !== "text") return;

#

why a filter just let ppl in a txt ch to use it

#

@copper cradle who tf was talking to you

#

@earnest phoenix this is lowercase

#

isnt it

#

connection.play(stream)

#

voice.channel.join() is correct

#

In v12

#

v11 =

#

voiceChannel

topaz fjord
#

i don't understand why people think v12 is an easy upgrade from v11

#

v12 breaks a lot of shit

earnest phoenix
#

who the hell even requested them to change from "Attachment" class name to "MessageAttachment"

#

Lol

#

v12 had too much changes

#

Don't go to v12 directly

#

"Removed Attachment in favour of MessageAttachment"

slate oyster
#

V12 of, um, d.js?
my lib is only on v3 lol

earnest phoenix
#

Yeah of d.js

#

Lol v3 upgrade no?

hushed berry
#

what is this "d.js"

earnest phoenix
#

discord.js

broken shale
#

@earnest phoenix well if you do npm i discord.js now its all v12

earnest phoenix
#

Yeah

#

:c

#

I know

#

But we can

#

npm i discord.js@version

#

npm i discord.js@11.5.1
npm i discord.js@11.6
npm i discord.js@11.6.1
etc...

broken shale
#

I honestly stopped updating my bot because of the changes and commits that were flowing in constantly

#

No more updates for v11

earnest phoenix
#

I just haave leave 11.5.1

#

For use

#

11.6.1

#

This isn't a huge update

broken shale
#

It is?

earnest phoenix
#

But this is a good choice i think

slate oyster
#

I'ma switch from PageKite to WebhookRelay for my projects I think
Because I have no credit card

#

Though I have to check if the free plan will be suitable

#

Oof
their create account page gives a 404 error

#

I logged in with GitHub already anyways though

copper cradle
#

@earnest phoenix this channel is for asking dev questions, anybody can answer to u regardless of how rude they are, if you don't like it then you can leave

pine bear
#

Ok, I ran this in glitch ```js
const config = require('../config.json');
let prefix = config.prefix;

module.exports = (client, message) => {

if (message.author.bot) return;

if (message.content.indexOf(prefix) !== 0) return;

client.message = message;

const args = message.content.slice(prefix.length).trim().split(/ +/g);

//console.log(args);

const command = args.shift().toLowerCase();

//console.log(command);

const cmd = client.commands.get(command);

//console.log(cmd);

if (!cmd) return;

//console.log(cmd);

cmd.run(client, message, args);

};
and it saysjs
cmd.run

earnest phoenix
#

you're exporting the function the wrong way

#

@copper cradle you legit called me dumb but what ever

copper cradle
#

Yeah I know

#

as I said

#

"regardless of how rude they are"

earnest phoenix
#

you're trying to do cmd.run
but you didn't export the run function

copper cradle
#

which proves my point on the first message

earnest phoenix
#

@pine bear

pine bear
#

Mmm

earnest phoenix
#

also eww glitch

#

and yes i'm a hypocrite

#

@copper cradle You legit have down syndrome and your retarded dog profile pic is ugly that trend is dead

#

chill lmao

sinful lotus
#

or dont fight in development before I mute you both

pine bear
#

^

earnest phoenix
#

"regardless of how rude they are"

sinful lotus
#

are you "not stopping"?

pine bear
#

I'm trying to make an event handler but then it says this. ```js
emitter[once ? 'once' : 'on'](event, (...args) => eventFunction.run(...args));

lament meteor
#

hmm

#

that means...

sinful lotus
#

what is event function

lament meteor
#

eventFunction is a read

sinful lotus
#

log that

lament meteor
#

^

modest crescent
#

Mmh guys I get an error when supplying client on the DBL constructor (bad request), is it relative to the new d.js@12 update and DBL api not updated for that purpose ? (a .cache to add ?)
Note that it happens only after updating the library (and reinstalling all of them at the same time).

(node:18762) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
    at IncomingMessage.res.on (/home/cata/Dev/Discord/./node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:198:15)
    at endReadableNT (_stream_readable.js:1139:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)```
sinful lotus
#

most likely dbl api is still not updated for v12

#

you can just post the request your own

#

on dblapi js

modest crescent
#

yess

sinful lotus
#

do that instead

lament meteor
#

a raw post should also work right

pine bear
#

ok here is the event handler is was able to come up with. ```js
fs.readdir('./events/', (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const eventFunction = require(./events/${file});
if (eventFunction.disabled) return;

    const event = eventFunction.event || file.split('.')[0]; 
    const emitter = (typeof eventFunction.emitter === 'string' ? client[eventFunction.emitter] : eventFunction.emitter) || client; 
    const once = eventFunction.once; 

    
    try {
        emitter[once ? 'once' : 'on'](event, (...args) => eventFunction.run(...args)); 
    } catch (error) {
        console.error(error.stack); 
    }
});

});

astral yoke
#

So i'm a bit confused on how I would do this. This is my ban code as an exmaple.

const mysql = require("mysql");
const fs = require("fs");



module.exports = {
    config: {
        name: "ban",
        description: "Bans a user from the guild!",
        usage: "!ban",
        category: "moderation",
        accessableby: "Administrators",
        aliases: ["b", "banish", "remove"]
    },
    run: async (bot, message, args) => {

   if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("You do not have permission to perform this command!")

   let banMember = message.mentions.members.first() || message.guild.members.get(args[0]) 
   if(!banMember) return message.channel.send("Please provide a user to ban!")

   let reason = args.slice(1).join(" ");
   if(!reason) reason = "No reason given!"

   if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("I dont have permission to perform this command")

   banMember.send(`Hello, you have been banned from ${message.guild.name} for: ${reason}`).then(() =>
   message.guild.ban(banMember, { days: 1, reason: reason})).catch(err => console.log(err))

   message.channel.send(`**${banMember.user.tag}** has been banned`).then(m => m.delete(5000))

    let embed = new RichEmbed()
    .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL)
    .addField("Moderation:", "ban")
    .addField("Mutee:", banMember.user.username)
    .addField("Moderator:", message.author.username)
    .addField("Reason:", reason)
    .addField("Date:", message.createdAt.toLocaleString())
    
        let sChannel = message.guild.channels.find(c => c.name === "modlogs")
        sChannel.send(embed)
    }
}

#

It has a modlogs feature where it would put the log into that channel, how would I make a seperate command so that when someone does like !modlogschannel #mod-logs, it would save and put logs into that on there server? Would I need a database to do that?

neat ingot
#

adding basic analytics to my bot was well worthwhile

#

im able to see where people are getting confused with my commands and such 🙂

#

thinking of just making it a bit more fleshed out and releasing it for other discord js users 🙂

#

could easily dockerize it as its own little app/database

#

wondering if yall think it might be a good idea?

stray wasp
#

is that in a json file?

#

@neat ingot

neat ingot
#

no its just being displayed as json at the url im using to access it, its not even being stored anywhere except memory atm, but i can easily add it to a database

stray wasp
#

ah ok

earnest phoenix
#

@astral yoke is that checking for ban and admin or ban or admin

#

Permissions

charred jetty
#
(node:4344) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions11:34 AM

at item.request.gen.end (/rbd/pnpm-volume/04d2b97d-b6b0-4096-bd33-46a980d362e6/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)11:34 AM

at then (/rbd/pnpm-volume/04d2b97d-b6b0-4096-bd33-46a980d362e6/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)11:34 AM

at process._tickCallback (internal/process/next_tick.js:68:7)11:34 AM

(node:4344) 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)11:34 AM

(node:4344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.11:34 AM```
#

What should i do?

earnest phoenix
#

Give the bot the perms it needs?

charred jetty
#

idk

earnest phoenix
#

No like. That's what you do

#

It says it's missing perms

#

Looks to be at line 215

charred jetty
#

i did only ping

earnest phoenix
#

As per 3 rd. Section

#

Then see if your bot has write perms

#

Or, if [he bot deletes the original command, it needs manage messages

charred jetty
#

i removed a file save event and it fixed

#

wtf

vagrant tree
#

hi, can you change text color in an embed?

hoary elm
#

Yes you just need the hex code

#

For the color

#

I believe that's what it's called.

earnest phoenix
#

wait what

#

really?

#

since when

#

i know you can change the bar on the left side of an embed

hoary elm
#

Oh

modest maple
#

uses a hex code

hoary elm
#

Whoops

#

I missed the text part of color

#

Lol

earnest phoenix
#

:p

hoary elm
#

😂😂

#

That I don't think so 🤔

modest maple
#

closest thing to changing text colour would be using code blocks and their types

hoary elm
#

I've tried that it doesn't always work

#

Some do some don't

modest maple
#
This Is ProLog
['hello']
1, 2, 3```
vagrant tree
#

?info

cursive dagger
earnest phoenix
#

guys need help regarding hosting

cursive dagger
#

what do you need help with

earnest phoenix
#

i want a free host which can host my bot 24/7 except repl.it n heroku

hoary elm
#

Glitch?

#

Can be kept online using a CronJob 👌

cursive dagger
#

or uptimerobot or your own script

hoary elm
#

Yup

cursive dagger
#

will also recommend gcloud

#

free for 12 months

#

no uptime problems

hoary elm
#

🤔 interesting never heard of them, they good?

cursive dagger
#

yeah

earnest phoenix
#

its

#

not

#

free

#

ffs

#

ppl need to stop saying google cloud is free for 12 months

hoary elm
#

Lol

earnest phoenix
#

you get $300 in credits for a year

hoary elm
#

Yeah

restive furnace
#

so its free for 12 months?? lol

hoary elm
#

NO

restive furnace
#

yes

earnest phoenix
#

jfc

#

no

hoary elm
#

You can use your credits to pay for it yes but not for the full 12 months

earnest phoenix
#

i lasted 5 months running a mc server off it

restive furnace
#

if u make vps what costs smh 30$/mo, then its freeee

#

(for 10 moths)

#

months

earnest phoenix
#

or

#

you can like

#

do 300/12

#

and get $300/yr = $25/mo

#

but yea, it can be free, or certainly not free

#

it all depends on what you do with it

#

google cloud also has an always free tier

#

1 vCPU and 512MB of RAM IIRC

#

and access to a lot of apis, tho its quota-ed

earnest phoenix
#

anyone know how to get a user's connections thru d.py? i'm assuming you'd have to go thru oauth

cursive dagger
#

yeah or .profile().connected_acccounts

#

but that can only be run by selfbots

earnest phoenix
#

well

#

yes and no

#

you can access that with bearer tokens too

#

aka oauth

#

so

#

my best bet would be to read up on how oauth works?

#

cuz rn, a bot that keeps track of connections without actually verifying them isnt very useful

#

@earnest phoenix bearer token = user i think

This isn't possible to view connected accounts with bot????

cursive dagger
#

yeah it isnt

earnest phoenix
#

it isn't
and it isn't

#

uset tokens are user tokens

#

Oh

#

bearer tokens are temporary access tokens from oauth

cursive dagger
#

bearer are from OAuth and user tokens are permenant

earnest phoenix
#

You want to sais oauth autorised ??

#

Like dashboard autorisation ?

cursive dagger
#

yes

earnest phoenix
#

so basically. i could make a command in my bot to send the user an oauth link and grab their connections?

cursive dagger
#

yeah

earnest phoenix
#

How can we make this for get connected accounts ?

cursive dagger
#

that would be the only currently known way

earnest phoenix
#

thats ok

#

thats all i need

#

But

cursive dagger
#

that is okay with tos

earnest phoenix
#

Only if the user click he can say his connected accounts or he can autorise for view another also??

#

you need a webserver for oauth, keep that in mind

#

Yeah cry

#

why tho?

cursive dagger
#

redirect urls

earnest phoenix
#

and down the rabbit hole i go

#

im reading it rn

#

Ty i go on my pc

#

but this is a tad over my head

#

so

#

why doesnt something like this work?

#

(that is a valid url - just dont click accept xD)

#

So logically in that way we can do everything only selfbot can do but temporarily?

#

doesnt it give the bot access as soon as you click the button?

#

&scope=connections

#

Oh okay this is really precise

#

@earnest phoenix

#

so im guessing the "code" is the bearer token?

#

well

#

no

#

you need to exchange that code for the token

#

oh.

#

How?

#

which is why you need a webserver to get the code and exchange it

#

ye

#

ik

#

ok

#

Ty cry you're helpful

#

^

#

wait

#

but

#

so this server would have to be the same one the bot is running on, wouldnt it?

#

nope

#

@earnest phoenix and why you don't have the developer roles where are your bots KarmaEyesKarmaEyes

#

unless you just stored the token temporarily and grabbed it with your bot?

#

well if you want to easily access the properties with d.py then yes

#

yeah

#

that

#

@earnest phoenix i think you just have to grant the access and this work for 1 request per 1 request

#

1 baerer token = 1 time get connected accounts

#

No?

#

so, set up a thing on heroku to do oauth and get token, and grab token w/ my discord bot, and that canbe used normally?

#

@earnest phoenix i used to have a bot but i quit public bot deving and i dont publish bots on top.gg cause they take ad revenue from your bot page

#

@earnest phoenix ?

#

@earnest phoenix oof bad thing i don't see that i have an ads blocker

#

yeah same but some people dont

#

@earnest phoenix yeah

#

if you can, use a vps instead of free hosting

#

yea

#

ik

#

i'd just use it as a test ground

bitter sundial
#

if you don't have a backend server there is an implicit auth flow which sends the token instead of a code

earnest phoenix
#

really?

#

that'd be great

#

is it in the docs?

bitter sundial
earnest phoenix
#

ty

#

but wait this still doesnt solve the problem of getting the token to my bot

bitter sundial
#

with that you can use your client id and client secret to get an access token for your account

earnest phoenix
#

as long as i pass client_id and client_secret as environment vars

#

= bearer token

#

right

#

ohh

#

thats only for ours xD nvm

#

i misread that

#

so then i'd have to use a backend anyway

bitter sundial
#

yes

earnest phoenix
#

oki

#

ok so

#

new thought

#

what exactly does this give

#

like - i see user access token, for the user that invited the bot

#

that it?

bitter sundial
#

you can have other scopes while inviting the bot

#

you get these details if you exchange the resulting code to an access token

earnest phoenix
#

for the member who did the inviting only tho right?

#
    @commands.command()
    async def role(self, ctx: discord.ext.commands.Context, r: discord.Role):
        e = discord.Embed()
        e.title = "Role: " + r.name
        e.colour = r.colour
        e.add_field(name="Members", value=" ".join([
            m.mention for m in r.members
        ]))
        await ctx.send(embed=e)

    @role.error
    async def role_error(self, ctx: discord.ext.commands.Context, error: Exception):
        if isinstance(error, discord.ext.commands.ConversionError):
            await ctx.send("Oops. I can't seem to find that role. Double-check capitalization and spaces.")
#

my error handler isnt working ):

#

it just doesnt even trigger

quiet zinc
#

How can I create a voting link instead of ID making it the name of the robot؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟

#

I mean, how do I make it in the name of the bot

quartz kindle
quiet zinc
#

YEP

quartz kindle
#

your bot needs to be certified

quiet zinc
#

How

quartz kindle
quiet zinc
#

THX

violet nimbus
vernal yoke
#

Rip