#development

1 messages · Page 524 of 1

earnest phoenix
#

2 shards?

#

100 on one and 50 on other?

knotty steeple
#

you could do that

#

but try to divide it equally

earnest phoenix
#

Yeah

#

So. I'm guessing there actually are no major disadvantages of sharding early?

knotty steeple
#

yes and no

earnest phoenix
#

Mostly more usage?

#

or other things

knotty steeple
#

yes

earnest phoenix
#

Such as?

#

😂

knotty steeple
#

memory usage mmLol

earnest phoenix
#

Just that?

knotty steeple
#

probably

#

anything else idk

earnest phoenix
#

You got a sharded bot?

knotty steeple
#

no

earnest phoenix
#

OOF

#

So, I'm guessing a lot of my code has to be changed now?

knotty steeple
#

@steel heath hello there

steel heath
#

Hai

knotty steeple
#

if you have a stats command you have to change it to get total guilds

steel heath
#

Uh?

earnest phoenix
#

What about getting info from another guild in a dif shard? broadcastEval?

knotty steeple
#

yes

vernal rivet
#

yet

knotty steeple
#

@steel heath help someone wants to shard

vernal rivet
#

yeet*

earnest phoenix
#

😄

#

I just need to know some things before I actually do it

vernal rivet
#

thats good to do

earnest phoenix
#

I have been a real nerd and creating a .txt document full of notes about sharding before doing it 😂

vernal rivet
#

is your bot in more than 100 servers?

steel heath
#

Hai, my DMs are always open smh

earnest phoenix
#

No but whatever

#

Idc if its below recommended sharding amount

vernal rivet
#

its best to wait till your bot is over 100 servers to start sharding

earnest phoenix
#

My bot has 155 Servers but I don't mind about memory as I have plenty

vernal rivet
#

ok

knotty steeple
vernal rivet
#

check your spelling

knotty steeple
#

huh

vernal rivet
#

check your import file names

knotty steeple
#

where

vernal rivet
#

in your bot code

knotty steeple
#

what

#

thats nginx

vernal rivet
#

wait, this is a service

#

check the folder for nginx, to make sure it has the .service files in it

knotty steeple
#

and where is this folder?

vernal rivet
#

fishy will know more than me, i just understand the error message. i would assume it would be in your program files folder

west raptor
#

/etc/nginx/ it looks like just by googling it

vernal rivet
#

are you using linuxs?

knotty steeple
#

ubuntu

vernal rivet
#

ahhhh

knotty steeple
#

no directory found

west raptor
knotty steeple
#

it isnt installed

#

h u h

west raptor
vernal rivet
#

try cd lib

knotty steeple
#

i installed it

#

but it was installed like 3 weeks ago

west raptor
#

huh

#

uh

zealous veldt
#

wew so I'm special and forgot, but how would I have a module's exports be a function but also have other properties
allowing something like this

const thing = require('thing');

thing();
console.log(thing.ping);```
vernal rivet
#

it should be in the a folder called lib\etc\nginx

west raptor
#

/lib/etc doesnt exit

#

tho

#

exist*

vernal rivet
#

module.exports.run = async (client, message, args, tools) =>{

earnest phoenix
#

@zealous veldt Just export a function and some properties

zealous veldt
#

Thanks, got an answer from another server

vernal rivet
#

ok

west raptor
#

@knotty steeple what version of ubuntu u on

knotty steeple
#

how do i check

west raptor
#

uh

knotty steeple
#

but im sure 16.06

west raptor
#

try running

knotty steeple
west raptor
#
    sudo apt update

then

    sudo apt install nginx
#

just to make sure its installed

knotty steeple
#

its installed

west raptor
#

nani

#

stackoverflow says service nginx configtest

#

so i guess

#

i try that?

#

idk

knotty steeple
#

fail

#

does that mean my config is bad

west raptor
#

maybe

#

whats the error

knotty steeple
#

it only says fail

west raptor
knotty steeple
#

`samuraistacks@ajhasavps:~$ service nginx configtest

  • Testing nginx configuration [fail]
    `
#

and

west raptor
#

tf

earnest phoenix
#

tf

#

7MS

#

BRO

valid frigate
#

u good?

tight heath
#

so?

#

that ping varies a lot lmao

#

I mean check mine

#

¯_(ツ)_/¯

west raptor
#

domain

tight heath
#

what

west raptor
#

idk

tight heath
#

oh okay

#

lmao

west raptor
#

yes lmao

tight heath
#

have you ever hosted a server on port 1337

#

well it's about time

dreamy breach
modern sable
#

sure

#

@trail kite

dreamy breach
#

Thanks 😃

#

vernal rivet
#

Lol

steel heath
#

@earnest phoenix can I store it if I use util.inspect()? So like;

const a = new Schema({ msgObj: Object });
const b = new a({ msgObj: util.inspect(msg) });
b.save();
// Mongoose...```
earnest phoenix
#

anyone know how to make bot dm all server owners in python

#

What do you mean "all server owners"?

#

Like owners of servers who have the bot, or just in general all server owners on discord?

#

Because the second one would be against ToS.

#

the owners that have the bot in their server

bright spear
#

dude dont

earnest phoenix
#

You can't have more than one

#

Unless you mean Co-Owner

#

Then you dm the role

#

@steel heath How about...just saving the message content

#

Save yourself the trouble

tight heath
#

both is against API ToS so

#

¯_(ツ)_/¯

#

don't mass-dm.

steel heath
#

@earnest phoenix well yeah but I'm going to need that for something else in the future

earnest phoenix
#

why??

steel heath
#

For caching guilds to DB and not use Discord API for dashboard

earnest phoenix
#

Uhm

#

why??

#

That doesn't sound very smart

steel heath
#

ive a sharded bot and it's pain in the ass to fetch information from shards, i use the api but there are limits, and on every page refresh, site makes like 3 api requests

earnest phoenix
#

Its really not

#

I do it, lots of other bots do it

steel heath
#

What about the 1000/hr request limit?

#

And it's really slow that I'm getting some information from bot and from API, mixed together to run everything correct

earnest phoenix
#

Why are you constantly requesting the api anyway

steel heath
#

Channels and roles

earnest phoenix
#

Don't you do that through your library?

steel heath
#

Can't get a good result with broadcastEval from other shards

earnest phoenix
#

Uhm.

steel heath
#

No role and channel objects

earnest phoenix
#

I do it, lots of other bots do it.

#

I don't see how you are an execption 🤷

steel heath
#

Hmh, okay then

#

Thanks

earnest phoenix
#

If you need help, feel free to ask

#

but actually think before you do something. lol

steel heath
#

This was the suggestion of some other people in here, in this channel when I first started coding the dashboard. meh

earnest phoenix
#

Shifting blame bloblul

steel heath
#

Nah, it sounds not that stupid tbh

earnest phoenix
#

It doesnt take a genius to understand that this idea is a bad one

steel heath
#

Not sure, never did something like this before

earnest phoenix
#

For one, you're storing more data which takes up more space
Two, storing objects with variables such as guild name, icon, etc are prone to change

steel heath
#

All I know is it's just working slow because of broadcasteval takes long

earnest phoenix
#

You'll end up fetching new info anyways

#

Only save constants to your database.

#

Things that wont change such as snowflakes.

steel heath
#

Mhm

desert slate
#

Because I'm a ditz, I forgot how to put links into Embeds, allowing text to be clicked to open said link. How do I do that again?

west raptor
desert slate
#

Tyvm~

west raptor
#

np

desert slate
earnest phoenix
#

no

#

person has dms disabled for your bot

desert slate
#

OH

earnest phoenix
#

so a block, not in the same server, no dms, etc

desert slate
#

GG self.

zealous veldt
desert slate
#

When you don't realize you fuck code up and mention the wrong user

sick cloud
#

good job

desert slate
#

I know right

earnest phoenix
#

what a friendly companion

desert slate
#

I facepalm myself because I just closed VS thinking "okay that's good"

earnest phoenix
#

Is it possible to get an invite to guild my bot is vc connected to?

bright spear
#

yes

quartz kindle
#

if your bot has permissions for it

earnest phoenix
#

How

bright spear
#

what lib

earnest phoenix
#

D.js

bright spear
#

bots can be connected to voice on multiple servers btw

earnest phoenix
#

My bot has admin in 80% of guilds

#

Ik

#

Like a random one

bright spear
#

what d.js version

#

stable?

earnest phoenix
#

Recommend one

#

Yeah

#

10.13.0

bright spear
#

wait what

#

thats really old

earnest phoenix
bright spear
#

...

earnest phoenix
#

It was just recommended

bright spear
#

thats node.js

#

not discord.js

earnest phoenix
#

Idk

#

Wait hold on

quartz kindle
#

lmao

bright spear
#

at least this time they know what lib they're using unlike last time

earnest phoenix
#

Idk I don’t host the bot

#

And eval is broken

bright spear
#

oook well i'll assume you're using 11.4.2

shadow barn
#

npm i discordjs/discord.js

bright spear
topaz fjord
#

@shadow barn that will install master

bright spear
#

then yu can use voiceConnection.channel to get the channel object

#

then do channel.createInvite()

shadow barn
#

which version is the absolute latest dev version of djs?

bright spear
#

master/12 @shadow barn

shadow barn
#

How you do i install it?

topaz fjord
#

You install like you just wrote the command

shadow barn
#

Ah ok

topaz fjord
#

but be careful

#

It's a big change

shadow barn
#

it's the one i'm already using on my bot

earnest phoenix
#

But you're asking how to install it

quartz kindle
#

is the internal sharding thing already merged to master?

earnest phoenix
#

🤔

bright spear
#

yeah @quartz kindle

#

i still use #internal-sharding on my sharded bot tho

quartz kindle
#

so you could just install master and not care about shards at all?

bright spear
#

i'll probably switch back to master eventually

#

well

#

you'll need to set shardCount: auto

topaz fjord
#

I don't like internal sharding

earnest phoenix
#

I agree

#

Internal sharding just makes the issue of JS being single threaded more apparent

quartz kindle
#

well, it wont make much of a difference if your vps only has 1 cpu xd

inner jewel
#

as long as your code doesn't block a single thread can do quite a lot of stuff

#

i've seen bots with 30+ shards being shared over two cores

earnest phoenix
#

I see lots of people here using node.js, ignoring async methods and using sync ones.

#

Thats really painful, as they dont understand the difference

inner jewel
#

run each shard in one isolate

earnest phoenix
#

bot.voiceChannels.channel.createInvite()

knotty steeple
#

you cant

#

create an invite

#

for a voice channels

earnest phoenix
#

parse error: Expected another key-value pair at line 12, column 3
7:12 AM

#

I’ve made invites for vcs

knotty steeple
#

help error: expected code or what is causing the error at message 514594079565283349

earnest phoenix
#

I’m trying to get an invite to a random server my bot is voice connected to

sick cloud
knotty steeple
#

you cant make invites for voice channels

sick cloud
#

get the guild from the channel and make an invite

gilded blaze
#

You can make invites for voice channels.

coral trellis
knotty steeple
#

ok

#

say how

#

wait wtf

#

ok thats weird

#

tbh

quartz kindle
#

@sick cloud does your guide handle pagination by "unreacting"?

#

idk if v11 ever fixed that, but you can fix it by changing a couple files in v11 by their v12 versions

earnest phoenix
#

const guildNames = bot.voiceConnections.map(vc => vc.createInvite).join("\n")
msg.channel.send(guildNames)

#

Is says can’t send an empty message

#

May I ask why I can’t get the server owner of this server? I think my codes are correct and this is the only server that my bot can’t get the tag and name

#

They can’t be correct I can get the owner

west raptor
#

@earnest phoenix Well

#

If you read the docs you would know

sick cloud
#

@quartz kindle if the bot has permission it'll remove the users reaction, if thats what you mean

west raptor
#

voiceConnections

#

returns VoiceConnection

earnest phoenix
#

I did and it didn’t help at all

keen drift
#

@sick cloud credit me

#

:^)

quartz kindle
#

@sick cloud yeah that was my problem, but i figured out a way to make "unreacting" also work, that way you dont need to remove the reaction after the user clicks it

west raptor
quartz kindle
#

basically just backport 2 files from v12 into v11

sick cloud
#

ah

west raptor
#

oops

sick cloud
#

throw me them in DMs if you want, i'll try implement it

quartz kindle
#

sure

sick cloud
#

@keen drift hecno

keen drift
#

hecyes

earnest phoenix
#

@earnest phoenix are you using discord.js?

west raptor
#

I already gave them what they needed

earnest phoenix
#

Yeah and now I’m going to sleep being really annoyed because I can’t code lul

#

This is what I wrote and it works on all servers except for this one

#

it would be very much appreciated if anyone can help 🙏🏽 i only have a problem with this server owner

sick cloud
#

owner isnt cached

#

use ownerID and get directly

earnest phoenix
#
if(cmd === `${prefix}say`){
    
    let said = args.join(" ").slice(22)
    if(said.length !>=2{
       return message.channel.send()
  }
    let sayEmbed = new discord.RichEmbed()
    .setColor(sColor)
    .setDescription(`${message.author} said: ${said}`)

    message.channel.send(sayEmbed)
  }

Trying to make a said command, returning "Unexpected token !"

sick cloud
#

can you read

#

! is invalid

quartz kindle
#

!>= lmao

earnest phoenix
#

How would I make it not equal to then Thonk

sick cloud
#

<

#

less

earnest phoenix
#

I'm used to LUA so

sick cloud
#

than

earnest phoenix
#

oh

#

lmao i'm retarded

quartz kindle
#

not bigger than equal to

sick cloud
#

< 2

quartz kindle
#

lmao

#

if you want not equal, just !=

earnest phoenix
#

wait

quartz kindle
#

if you want smaller or equal, then <=

earnest phoenix
#

wait

#

boys

#

how would I make it so it doesn't have to be 2 words to send the message because with args.join(" ").slice(22) it requires a space inbetween 2 args

quartz kindle
#

wat

earnest phoenix
#

nvm lol

sick cloud
#

slice 22

#

the fuck

quartz kindle
#

you're joining all args into a single string separated by spaces, then removing 22 characters from the beginning of it, then checking if the final string length is 2 or not

#

maybe there is a better way to do whatever is it you're trying to do xD

sick cloud
#

.split(' ').shift()

#

hello

earnest phoenix
quartz kindle
#

well, you're removing 22 characters from the string

sick cloud
#

yeah how the f are you even getting 22

earnest phoenix
#

oh lmao right im dumb

#

i was using it from my ban message and thinking it'd work universally

sick cloud
#

copy pasting code

earnest phoenix
#

i have downsyndrome

#

pls be patient

sick cloud
#

biggest newbie error

earnest phoenix
#

ik

#

im kinda retarded 😂

quartz kindle
#

well, it does work universally, it will always remove 22 characters

#

xD

earnest phoenix
#

k well stfu

#

😂

#

@sick cloud "args.split is not a function"

sick cloud
#

because you split on the damn string

#

smh

earnest phoenix
#

wdym im confused. not asking for spoonfeeding just help explain pls

quartz kindle
#

you want to check if args length is bigger than 2, so you dont need any of that

#

just do if(args.length < 2){}

#

i assume args[0] is the prefix+command and args[1]+ is the message

shadow barn
#

Which would be better?

  1. Fetching a random sentence from a .js file using arrays.
  2. Fetching a random sentence from a json file?
sullen path
#

the one that works better

shadow barn
#

lol but i mean, do they respond differently in time?

quartz kindle
#

if your array is not too big, like tens of megabytes

#

better keep it in memory

#

or load it from a file into a variable

keen drift
#

does it have to be a json file

#

just one sentence per line, then you can seek to that line w/o reading it all

#

a json file meaning parsing the whole thing

quartz kindle
#

i think hes just asking about array in .js file or array in .json file

keen drift
#

yeah if it's large enough to need its separate file, perhaps it shouldn't be in json

quartz kindle
#

well it doesnt matter if its gonna go into memory

#

if its not bigger than a couple tens of MB

slim heart
#

cant .js transfer faster but takes longer compared to smaller arrays?

#

so if it's only like a length of 20 maybe then json will be faster but past that js will be a bit faster

quartz kindle
#

depends on how you're importing the data i guess

#

assuming both files will be read at the same average speed from disk, the difference is in how js parses the files

#

a json would need to be parsed into a js object

#

a js file would also need to be parsed from string into something usable

slim heart
#

Yea

keen drift
#

Here's my take, code base should not contain arbitrary data that it uses, it should be isolated out

slim heart
#

but the honest time is probably measured in nanoseconds of time difference i really dont think it matters too much lol

quartz kindle
#

nanoseconds will turn into minutes when you do into gigabytes xD

keen drift
#

unnecessary bundle size and additional work to edit

slim heart
#

s h h

keen drift
#

Reading large data is always better if it's sorted or indexed

#

JSON file would require entirety of it parsed, but if you seek to it in a standard sentence per line, you can get the result with minimal reading

quartz kindle
#

well he wants to get a random value from it

#

so an array fits better regardless

keen drift
#

there's a whole big difference between a char[64] and a char[2048]

#

I tend to not allocate what's not necessary

quartz kindle
#

well js doesnt have that

#

everything in js is varchar

keen drift
#

welcome to optimization

#

js is dynamically typed

#

nothing much you can do with that

quartz kindle
#

yeah

keen drift
#

best to get in the habit and not wonder why it's so slow after

quartz kindle
#

but still, the same principles remain, if the database is small, keep it into memory, else use a database

#

i've never had problems with slowness

#

¯_(ツ)_/¯

keen drift
#

well none of the typical application requires that level of speed

#

I'll be damned if my binary file ships with 10 mb+

quartz kindle
#

well, i agree on that point

#

but not much you can do when you have to ship node with an entire browser inside it

#

for a simple desktop app

keen drift
#

is that what he's working on Thonkang

#

an electron app?

quartz kindle
#

no, im just saying

bright spear
#

Ur thinking about electron

quartz kindle
#

like, you can easily build software with less than 5mb of code with lower level languages like the C family

#

you wont ever get close to that with js

#

but thats the price of multiplatform

#

the tradeoff between performance and compatiblity

#

high performance machine specific code, or lower performance works everywhere code

floral bloom
#

How do I make a bot create an invite for a server and send it in a message?

earnest phoenix
#

what lib

#

i think it has something to do with the coding process? id have to pull it up real quick

floral bloom
#

@earnest phoenix lib?

#

Oh

#

Discord.js

earnest phoenix
#

ok

#

.createInvite() on a channel

floral bloom
#

How would I do that if I'm not in the server?

earnest phoenix
#

you wouldnt

floral bloom
#

O.o

sinful lotus
#

u make the bot get the guild channel

#

who says u

earnest phoenix
#

you cant just use bots to hack into servers

#

you can only do that if they have perms

floral bloom
#

I won't 😔 🤦

sinful lotus
#

also the bot must be in that server

floral bloom
#

It is

sinful lotus
#

if it isnt on that server

earnest phoenix
#

thats what i meant

#

since it is in the server you can get a channel in that server and do .createInvite

sinful lotus
#

get a chanel from that server and use .createInvite

floral bloom
#

I tried

haughty jewel
#

...wha wen wron

floral bloom
#

It didn't work. I don't know what's wrong O.o

haughty jewel
#

...surely there must be an error

#

wait its js

#

i assume you are getting nulls and undefineds?

sinful lotus
#

tbh

#

a simple

#

guild.channels.first().createInvite would do it assuming ur bot has perms

#

channels is a collection

#

ofc using .creatInvite will not work on that

valid frigate
#

you sure you cant just do guild.createInvite() and the pass options

#

pass options*

#

excuse me

floral bloom
#

What are the options I need to do this??

valid frigate
#

scroll up it's in the docs

floral bloom
#

Oh

valid frigate
#

yeah

#

and never mind you can't do guild.createInvite() you'd have to follow what mr certified developer above wrote

floral bloom
#

Lol

valid frigate
#

also

#

on latest master theyve got internal sharding which is interesting

sinful lotus
#

if its not borked ^

floral bloom
#

I did:
guild.channels.first().createInvite()
And it just gave me:
[object Promise]

valid frigate
#

now apparently past v12 you wont have to spawn multiple instances of the bot

#

well are you console logging its value

sinful lotus
#

why not open whats inside that object promise?

#

console.log it and sEe

valid frigate
#

also make sure that you use awaiT

#

async/await

#

ajssjhslsls

sinful lotus
#

we are here to help u direct in the right way, not ur personal debugger :/

valid frigate
#

the docs has it all ig

floral bloom
valid frigate
#

and general rule of thumb if you get a promise returned use await mmLol

sinful lotus
#

or use .then

#

if u are old fashioned

valid frigate
#

es2017 why

sinful lotus
#

depends on the code structure, if u dont want some promise block the code below it cause its awaited use .then or .catch

#

specially if its a fire and forget promise, but u still want to catch it if it do errors

floral bloom
#

Huh

valid frigate
#

ok so basically

sinful lotus
#

just console.log it

valid frigate
#

you can choose between

sinful lotus
#

u will see the answer on that code, using eval wont let you see inside of that

#

unless ur eval supports async

valid frigate
#

await guild.channels.first().createInvite() or guild.channels.first().createInvite().then()

#

imo id go with await mmLol

floral bloom
#

It said "Can't use await outside an async function"

...but it is in an async function! O.o

sullen path
#

But it isn't

floral bloom
#

?

sullen path
#

If it says it's not in an async function, then it isn't and you messed up indentation

floral bloom
#

Uh... no

#

I didn't

#

Ok, I'll talk to my friend

#

Thanks

#

Bye

valid frigate
#

indentation doesn't matter

sullen path
#

It's py

#

I think

bright spear
#

no its js

sullen path
#

Ok

tight heath
#

Imagine not being able to auto-indent your code because of semantic indentation
This message made by Not Python Gang.

shadow dust
#

Imagine coding on a language designed in one week. This message was made by Not JS Gang.

tight heath
#

Yeah. Simple and quick.

#

😋

shadow dust
#

And very flawed

slender thistle
#

Whitespace > *

keen drift
#

no space > *

sinful lotus
#

NaN === NaN; // false

keen drift
shadow dust
#

1 == "1" // true

#

why is this okay

sinful lotus
#

because its not a strict comparison

#

one is a number one is a string

shadow dust
#

exactly

#

thats why it shouldnt work

#

at all

sinful lotus
#

use ===

#

if you want it not to work

shadow dust
#

its sad that you need an extra operator for this

sinful lotus
#

make it a habit to use === over ==

#

problem sovled

keen drift
#

or typescript it

shadow dust
#

yeah

#

ts

#

it shouldnt be a habit at all I dont know many other languages that do that

#

Maybe PHP does

keen drift
#

yeah php has that, but it's not nearly as weird as js is

sick cloud
#

i use ==

#

and !=

earnest phoenix
#

Well then you dont do strict comparisons

olive finch
#

Does <GuildMember>.hasPermission not check if the bot/person has the permission to talk in that specific channel?

slender thistle
#

Looks like not

olive finch
#

:/

sick cloud
#

@olive finch that guild only

olive finch
#

Figured. Thanks :>

bright spear
#

@olive finch BTW u can also check permissions in the channel

olive finch
#

Yeah; trying to figure of an easy way of doing so.

bright spear
#

d.js?

olive finch
#

yup

bright spear
#

Stable or master

olive finch
#

Stable

bright spear
olive finch
#

Ye, got that far. Hoped it'd return flags rather than bitfield.

#

Would've made life so much easier

#

😛

bright spear
#

You can use .serialize() to get a nice object

olive finch
#

oehh

#

thanks

bright spear
#

Yw

earnest phoenix
#

db.get is not a function

topaz fjord
#

show full error and code

mossy vine
#

nice token

earnest phoenix
#

F

#

i thought i hid it

earnest phoenix
#

that method doesn't exist on points?

earnest phoenix
#

Is it possible to grab a JSON Key using a string?
n!enable test - Enables test command

var command = args[0]; //This in this case is 'test'
const mods = require("./modules.json"); //Grabs the command Enabled file
mods.command = "true" //Finds the key specified with 'command' argument and sets it's value to true
... //Save file.

I do it like this basically however, it still doesnt work.

brittle nova
#

If I have a path like /dashboard/serverID/moduleName and I have an ejs file for each module, would the best way to check if it is valid have an array like ```js
[
{
module: "moduleName",
file: "something.ejs"
}
]

inner jewel
#

an object of name -> file

silver fulcrum
#

Are you meant to type Typescript Declaration Files or are they supposed to be generated

earnest phoenix
#

How would I restart all shards?

client.shard.broadcastEval(`this.shard.respawn`)

I think I am stupid though, because I might be completely wrong with this code 😂

earnest phoenix
#

?? ☝

keen drift
#

...

hollow fulcrum
#

dpy rewrite await ctx.send(f"{random.choice(possible_responses)}, + {ctx.author.mention}")

#

ctx is apparently a str object

#

even though ctx is being passed

chrome olive
#

Who can help me to create a login system with discord oAuth?

#

ping me

keen drift
#

h e l p you?

#

you better start showing some code 👏

earnest phoenix
#

@keen drift Hey, you know anything about making a bot customizable from a website?

keen drift
earnest phoenix
#

o... Sowwy 😢

keen drift
#

do I know anything, sure I know something

earnest phoenix
#

...

keen drift
#

what. you ask if I know anything

#

¯_(ツ)_/¯

earnest phoenix
#

about making a bot customizable from a website

keen drift
#

yeah, I know something

earnest phoenix
#

So?

#

would this work

    client.on('guildMemberAdd', async (member, message) => { 
      if(message.guild.id !== '497153287779516417') return;
      let joinmessage =  new discord.RichEmbed()
        .setAuthor("New Member!")
        .setColor("RANDOM")
        .addField(`User`, member.guild.id)
        .addField(`You Are The`, message.guild.members.size + "Member")
        .addField("Please Make Sure To Read [#497305721063604239](/guild/264445053596991498/channel/497305721063604239/)")
        .setFooter("Enjoy Your Stay!")
      client.channels.get('514438853747015693').send(joinmessage)
    });
#

Hm

#

Message?

keen drift
#

yeah where is message from

#

guildMemberAdd event only has one callback item

earnest phoenix
#

Would be

.addField(`You Are The`, member.guild.members.size + "Member")
``` i believe
#

so this would be it?

    client.on('guildMemberAdd', async (member, message) => { 
      if(message.guild.id !== '497153287779516417') return;
      let joinmessage =  new discord.RichEmbed()
        .setAuthor("New Member!")
        .setColor("RANDOM")
        .addField(`User`, member.guild.member.id)
        .addField(`You Are The`, member.guild.members.size + "Member")
        .addField("Please Make Sure To Read [#497305721063604239](/guild/264445053596991498/channel/497305721063604239/)")
        .setFooter("Enjoy Your Stay!")
      client.channels.get('514438853747015693').send(joinmessage)
    });
topaz fjord
#

guildMemberAdd gives member

#

not message

earnest phoenix
#

Get rid of message on the first line

#

nvm ye, i dont even need the first if because its sending to certain channel anyway

#

lul

topaz fjord
#

message.guild

#

Would be member.guild

keen drift
#

wtf is message on that event

#

client.on('guildMemberAdd', async (member, message)

earnest phoenix
#

now this?

    client.on('guildMemberAdd', async (member) => { 
      let joinmessage =  new discord.RichEmbed()
        .setAuthor("New Member!")
        .setColor("RANDOM")
        .addField(`User`, member.guild.member.id)
        .addField(`You Are The`, member.guild.members.size + "Member")
        .addField("Please Make Sure To Read [#497305721063604239](/guild/264445053596991498/channel/497305721063604239/)")
        .setFooter("Enjoy Your Stay!")
      client.channels.get('514438853747015693').send(joinmessage)
    });
keen drift
#

where you ge tmessage from

#

uh yeah

earnest phoenix
#

ok3e

keen drift
#

altho

#

that's kinda redundant?

#

and I don't think that works

earnest phoenix
#

Yeah it works

keen drift
topaz fjord
#

You do know this will send global member joins to your channel right?

earnest phoenix
#

Member ID would work

keen drift
#

.guild does not have .member

#

.addField(`User`, member.guild.member.id) would not work

earnest phoenix
#

member.guild.member(member).id? idfk 😂

keen drift
#

wtf

#

how extra can you be

topaz fjord
earnest phoenix
#

haha

inner jewel
#

no

#

embed fields need both title and value

topaz fjord
#

member.guild.member(member) you would have to have no brain cells to do this

keen drift
#

how about

#
member.guild.member(member).guild.member(member).guild.member(member)
#

ye?

earnest phoenix
#

OOOOOOOOOOOOOOOOOOOOOO

inner jewel
earnest phoenix
#

0KK

#

ok, i have this auto welcome message, which sends a message when a user joins my sever, how do i make it ignore other server users

#

an if statement

keen drift
#

ignore other server users?

#

guildMemberAdd works

inner jewel
#

check guild id

earnest phoenix
#

yes, but its in a memberguildadd event, and if i do if(message.guild.id !== 'whatever') return; then it says message is not defined, but i can only call one thing in the async

keen drift
#

?

inner jewel
#

member has a guild property

earnest phoenix
#

@earnest phoenix, you can't just create a message object out of nothing

#

Each event emits a specifc object or objects

inner jewel
#

const message = {guild: member.guild}

earnest phoenix
#

You seem to not understand how your library events even work

lofty hamlet
#

Hi

#

How do I remove the basic dbl background ?

#

Little triangle etc ...

#

@earnest phoenix exuse me for the mention but you know ?

earnest phoenix
#

Not a clue.

lofty hamlet
#

?

uneven rover
#

Inspect element

lofty hamlet
#

....

#

I want the back-gound-color pass before

earnest phoenix
#

i forgot what was the thing for the shapes

#

yoou might need to ask natan

lofty hamlet
#

Ntan ?

#

Natan ?*

earnest phoenix
#

yes

lofty hamlet
#

Who is he ?

earnest phoenix
#

the mod

#

a mod actually

lofty hamlet
#

Ok ok

#

@inner jewel ?

inner jewel
#

¯_(ツ)_/¯

#

try using inspect element

lofty hamlet
#

Wath ?

#

You don't know ?

uneven rover
#

ask the website dev

lofty hamlet
#

How am I supposed to delete it?

uneven rover
#

you meant replace

lofty hamlet
#

Why ?

uneven rover
#

no option to delete it, perhaps

lofty hamlet
#

So ?

uneven rover
#

it's either you inspect elements, or ask tje website developers

keen drift
#
.shapes-background {
    display: none;
  }
#

That's what I have on my bot

earnest phoenix
#

@keen drift why is ur bot down?

keen drift
#

why you pinging me here?

earnest phoenix
#

only server ur in that im in

keen drift
#

well shit

#

I have like 20 announcements on my support server regarding this

earnest phoenix
#

ok, joining it

#

except for the fact

#

that the only invite available for that server is invalid

#

or expired

keen drift
#

Where?

earnest phoenix
#

on the dbl website

inner jewel
#

invite invalid/expired happens if you're banned/on 100 guilds

keen drift
#

I don't have an invite on the dbl website, it's on my doc site

earnest phoenix
#

this one i mean

keen drift
#

yeah that one is invalid, I don't update that one

#

somehow my server image is broken as well

earnest phoenix
#

so how can i join ur server, because bot is dead

#

@coarse carbon

#

o, its back

keen drift
#

is that how autism works

earnest phoenix
#

Fishy

keen drift
#

You can check the endpoint to see if they have voted

earnest phoenix
#

How do I create a shard event?

keen drift
#

what's a shard event

earnest phoenix
keen drift
#

so you want to listen to the death event?

#

<Shard>.on('death')?

earnest phoenix
#

oo

#

Where do I put that?

#

In the main bot file, or the sharding file

west raptor
#

sharding file i presume

earnest phoenix
#

shard is not defined anywhere apart from this line

manager.on('launch', shard => console.log(`Launched shard ${shard.id}/${shard.totalShards}`));
valid frigate
#

client.shard?

earnest phoenix
#

No

#

wait

#

idk 😂

west raptor
#

what

earnest phoenix
#

no

pale marsh
#

Anyone knows if redirect_uri can work with the bot scope only?

#

In invite links

inner jewel
#

i don't think so

pale marsh
#

Welp

#

Was gonna try making my bot fancy by redirecting users to a page on my website

west raptor
#

thats not

#

english

earnest phoenix
#
/rbd/pnpm-volume/badc03b8-a538-46b8-a786-efd67ab85be3/node_modules/.registry.npmjs.org/enmap/4.3.3/node_modules/enmap/src/index.js:931

    if (!this.isReady) throw new Err('Database is not ready. Refer to the readme to use enmap.defer', 'EnmapReadyError');

                       ^


EnmapReadyError: Database is not ready. Refer to the readme to use enmap.defer
inner jewel
#

Database is not ready. Refer to the readme to use enmap.defer

earnest phoenix
#

which i have no clue where it is

bright spear
#
keen drift
#

when you use a pkg that you have no idea what it's

jagged sinew
#

hey i was just about to do something and idk if its allowed.. I was going to make it so that you can enable certain feature by voting.

#

is that allowed?

keen drift
#

yeah

west raptor
#

yeah

jagged sinew
#

hmm

#

but i need to make it not sound like its some scam

#

like To unlock this feature you must authenticate by clicking this link: votelink

tepid jasper
#

many bots do that, using votes in some way like that is actually a minimum requirement for certification:

- Implementation of voting in your bot (e.g rewards on user vote. Minium being a command with a link to vote)
bright spear
#

@tepid jasper you dont need to vote lock

tepid jasper
#

I know, but that's the way many bots implement it

bright spear
#

Well remember that the following is not allowed:
"Vote locking" a large percentage AND/OR majority of your bots commands AND/OR features.
Punishing users of your bot AND/OR community for not voting.

sick cloud
#

@jagged sinew legit just say upvote me at <> to get access to this

#

its not a scam

jagged sinew
#

ye

#

i mean one of the biggest features on my bot is this

#

but not all servers are going to use it

#

and it takes up alot of memory on my end

west raptor
#

the vote lock it

jagged sinew
#

so i want some way to make sure that people who want it actually need to enable it

#

in some way

tepid jasper
#

vote locking a lot of your features isn't just not allowed, it's super dumb :D

jagged sinew
#

ye ik..

tepid jasper
#

not saying you were going to do that, replying to advaith

jagged sinew
#

the thing is, idk if this would cout as vote locking because it locks like 5/6 commands

#

nah, i think i might just make a captcha

#

tbh

#

make voting just giv prizes on my server xD

#

hmm

#

is the voting http request a get or a post?

sullen path
#

Post

keen drift
#

Which endpoint?

#

Are you talking about the webhook?

#

Or the get votes endpoint

sick cloud
#

<li class="nav-item<% if (page.active == 'bots') { ' active' } %>">
my code has active set to "bots", so why wont it add the class?

gilded blaze
#

use <%=

sick cloud
#

that errors

haughty jewel
#

can anyone here do lil site for me i see css masters here and i feel outnumbered

open elm
#

use github pages tbh

earnest phoenix
#

How would I define a certain shard?

#

ShardingManager JS

coral trellis
#

If thats what you mean

earnest phoenix
#

No

#

I want to shut down a certain shard

#

@coral trellis

coral trellis
#

I believe you need to code it a specific way to do that

earnest phoenix
#

Couldn't I use a broadcast eval?

coral trellis
earnest phoenix
#

hmm

#

Okay lol Thanks anyway

brittle nova
#

How can I handle error codes with express?

#

eg 404

sick cloud
#

res.status(404).send('404 not found')

#

@brittle nova

#

basically use .status

brittle nova
#

@sick cloud so I have to do that with every error code?

#

I want to make an error code handler that will get you to an ejs page called error.ejs or something

sick cloud
#

uh

#

then make a page

brittle nova
#

Do I have to do that with every code though?

valid frigate
#

to shut down a shard i think you can just do shard.kill()

earnest phoenix
#

How can i get the vps uptime?
like my bot uptime is 10 minutes
but the server uptime is 1 hours, I want to use the server uptime but confused to get the uptime from the server

bright spear
#

it would probably depend on your language and os

earnest phoenix
#

The os.uptime() not a real uptime from vps/server

sullen path
#

What lang are you using

#

And what is your VPS running as an OS

earnest phoenix
#

I use discord.js
and the os: Linux @sullen path

sullen path
#

You can try running the command uptime and scrape the output

earnest phoenix
#

but the output is bot uptime, not vps/server uptime

sullen path
earnest phoenix
#

How can i put that uptime to command if that from exec

bright spear
sullen path
#

You use whatever library allows you to run shell commands and get the output

#

Or that

#

Same thing

bright spear
earnest phoenix
#

Aww okay, lemme try thanks 😅

brittle nova
#

Can you update a package's dependencies?

keen drift
#

not w/o forking it

brittle nova
#

Even if it's installed with npm?

#

I just want to do it in my server

keen drift
#

yeah cause package have specified dependency version, otherwise they'll be broken

brittle nova
#

how can I convert a language code to a flag emoji?

#

without making a l{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}ng object

valid frigate
#

:flag_${countryCode}: iirc if you're doing it in js

#

like :flag_eu: produces 🇪🇺

bright spear
#

thats for countries not languages

keen drift
#

@brittle nova can you show an example of language code

brittle nova
#

en => english

#

I think they're called isos

keen drift
#

there are a lot of isos

brittle nova
#

yes

keen drift
#

iso8601, etc

#

standardization

#

but yeah your best bet is to map language codes to flags

#

since the same language can be spoken in multiple countries

brittle nova
#

pretty long object though

#

@bright spear how can I do this for emojis?

heady anvil
#

english = england right so why is it an american flag

coral trellis
ivory marlin
#

Hey guys new to discord bot development, I am just learning the basics of handling events I am currently doing an channelCreate event that is posting in the new channel when created just fine, But I want it to make a post in the default channel as well, how do I get it to message the default channel?

#

I can post snippet if it is easier

west raptor
#

defaultChannel no longer exist, you will have to find it yourself

#

One second

ivory marlin
#

Oh wow thanks thats really helpful!

west raptor
#

Np

earnest phoenix
#

Hey

#

I need some help with the DBL Api for my site

#

How do I get the numbers there

valid frigate
#

alternatively you could somehow pass your client's guild and user count into the site

#

so you don't have to make api calls

west raptor
#

^

primal egret
#

Anyone knows how to add CUSTOM emojis only for bot? "Bot-Integrated" emojis?

keen drift
#

emojis only for bot?

primal egret
#

Yes

keen drift
#

I mean you can make emojis restricted to roles

primal egret
#

What I'm looking for is to do as the bot "Aki (Akinator)" has, for example, react with custom emojis that ONLY the bot has

earnest phoenix
#

does anyone know of a good npm module that like
tries to decode what language a string of text is in

#

it doesnt need to translate the text, just see what language it might be in

keen drift
#

@primal egret yeah no, no idea, that would require immense checking

primal egret
#

ok.. thanks

keen drift
#

@earnest phoenix best guess would be querying the google translation api

#

with its auto detect

earnest phoenix
#

oh ok

tight heath
#

@primal egret add the bot to a private server

#

Upload the emojis there

#

Done

primal egret
#

and use the \:emoji: to get the ID?

empty owl
#

Yeah

soft plaza
empty owl
#

@primal egret
message.channel.send().then(message => (message.react(''))

#

Wait that's not it

#

it's missing a )

#

It's something like that

opaque eagle
#

How do I fix ECONNRESET

#

I'm the client, not the server

remote heart
hollow fulcrum
#

stop unplugging your laptop from wifi

ruby dust
#

apparently google is no help for me on this one, how can I make a list of file objects in a specific directory that matches a specific extension?

hushed berry
#

in which language

#

@ruby dust

ruby dust
#

python

earnest phoenix
#

I have an issue with forever js, it well erm doesnt run forever. I have it on EC2 ubuntu server, just as normal node, it will stop after i execute. Any clue why this happens?

hollow fulcrum
#

How do I make my bot respond to commands again?

#

when mentioned

#

discordpy

#

nvm

earnest phoenix
hollow fulcrum
#

use tmux or something @earnest phoenix

dense mist
#

Anyone kno what the exit code -1 means? :/

hollow fulcrum
#

On java (windows), an exit code of -1 means closed unexpectedly

#

happens when your bot crashes

dense mist
#

welp probably means the same on js mac :/

#

thanx

hollow fulcrum
#

np

#
    return discord.ext.commands.when_mentioned_or(BOT_PREFIX)
TOKEN = 'get out'

client = Bot(command_prefix=get_prefix), case_insensitive=True,
    description=r"UltraBot, a bot which works 90% of the time")``` Why is my bot no longer responding to prefixes?
#

only mentions

#

bot_prefix is a string

inner jewel
#

non 0 exit codes mean errors

#

@dense mist

dense mist
#

ahhh

#

oki

#

thx

earnest phoenix
#
          if (slots[result1] && slots[result2] === slots[result3]) {

why does that do something when slots 2 and 3 are the same, even do i want it to be if slots 1,2 and 3 are same then blah blah

inner jewel
#

because that's what you wrote

#

if((slots[result1]) && (slots[result2] == slots[result3]))

#

that's what you have

earnest phoenix
#

thats what i should have u mean?

inner jewel
#

no

#

that's what you have

earnest phoenix
#

then what should i have

inner jewel
#

you want slots[result1] to be equal to slots[result2] and equal to slots[result3]

#

think about it a bit

earnest phoenix
#

yes

inner jewel
#

how many times does equal appear in that sentence

earnest phoenix
#

ye, if this equals this and this

inner jewel
#

wrong

earnest phoenix
#

if this equals this equals this?

inner jewel
#

if a equals b and c is wrong

earnest phoenix
#

a = b= c ?

inner jewel
#

you want if a equals b and a equals c

earnest phoenix
#

ok

inner jewel
#

since equality (on any sane language) is transitive, that code would also mean b == c

earnest phoenix
#

so if((slots[result1] == slots[result2] && slots[result1] == slots[result3]))

inner jewel
#

no

earnest phoenix
#

..

inner jewel
#

equality has a higher precedence than logical and

#

you can do just a == b && b == c

earnest phoenix
#

if((slots[result1]) == (slots[result2] && slots[result2] == slots[result3]))

inner jewel
#

no

thin loom
#

if(slots[result1] == slots[result2] && slots[result2] == slots[result3])

earnest phoenix
#

thats what u are saying fffs

#

what i sent is a == b && b == c

inner jewel
#

no

earnest phoenix
#

it is

inner jewel
#

what you sent is a == (b && b == c)

earnest phoenix
#

HOW?!

thin loom
#

dude

inner jewel
#

because you have (b && b == c)

#

that changes the parsing of the expression

earnest phoenix
#

so if((slots[result1] == slots[result2] && slots[result1] == slots[result3]))

inner jewel
#

yes

proven surge
#

uhhh whats a good bot hosting, reeeee

mossy vine
#

uhhh read pins, reeeee

proven surge
#

oof

ivory marlin
#

const commando = require('discord.js-commando');

class SetGame extends commando.Command
{
constructor(client)
{
super(client, {
name: 'setgame',
group: 'simple',
memberName: 'setgame',
description: 'sets the game the bot is playing'
});
}

async run(message, args)
{
    commando.user.setGame(args); 
}

}
module.exports = SetGame;

#

Do i understand args correctly here?

#

is it not the rest of the message after '!setgame'

#

Or is it an array of strings that I need to combine

west raptor
#

class SetGame extends commando.Command
{
    constructor(client)
    {
        super(client, {
            name: 'setgame',
            group: 'simple',
            memberName: 'setgame',
            description: 'sets the game the bot is playing'
        });
    }

    async run(message, args)
    {
        commando.user.setGame(args); 
    }

}
module.exports = SetGame;```
ivory marlin
#

Sorry eyes very tired lol what’s the difference?

west raptor
#

nothing, I was just putting it in a code block for people

#

I'm trying to remember

#

how to do

ivory marlin
#

Oh thank you

west raptor
#

args in commando

#

I think

#

hold on

#
args: [
                {
                    key: 'name',
                    propmt: 'what it will ask them if not provided here',
                    type: 'the type here (string, number, etc)'
                }
            ]```
#

and you will put that in ur super

ivory marlin
#

Ohhh I see. I’ll try this once I’m back on pc hopefully i didn’t fumble the code up anywhere else, I was able to get this to work pretty easy when doing a .on(‘message’.... but I want to make things a little neater I appreciate the help

west raptor
#

np

modern sable
#

when you try to set up the youtube data api

but their node.js quickstart script/tutorial doesn't work for some reason bloblul

earnest phoenix
#

would this work so it only does one of these

  if (message.content.indexOf(prefix) !== 0 && message.content.startsWith("@heavy thistle " && message.content.startsWith(config.prefix) !== 0)) return;
inner jewel
earnest phoenix
#

the above will work, ive tested it

inner jewel
#

"@heavy thistle " && message.content.startsWith(config.prefix) !== 0

earnest phoenix
#

It works, ok

#

but the part where the bot has to be pinged, never works

#

how can i make it work

inner jewel
#

"abc" && expr is always expr

warm wadi
#

I want a link for giveaways permmision

earnest phoenix
#

How do I setup the Vote Webhook on a VPS? What would I put as the URL on the Bot Edit Page on the Website?

loud salmon
#
Exception in thread "OkHttp Dispatcher" org.json.JSONException: JSONObject["stats"] not found.
    at org.json.JSONObject.get(JSONObject.java:520)
    at org.json.JSONObject.getJSONArray(JSONObject.java:714)
    at com.jagrosh.jdautilities.command.impl.CommandClientImpl$4.onResponse(CommandClientImpl.java:687)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
#

@coral trellis it just repeats this

#

no code of mine is being invoked

#

at least i dont think so

earnest phoenix
#

Spider Daddy

coral trellis
#

Rip

earnest phoenix
#

Or anyone

inner jewel
#

ratelimits are a meme

#

for reactions

earnest phoenix
#

Someone pwease halp mah

inner jewel
#

@earnest phoenix first you need a webserver

earnest phoenix
#

wut?

#

@inner jewel Whuts that? 😂

inner jewel
#

something to handle incoming http requests

earnest phoenix
#

How would I do that?

inner jewel
#

google "<your language> webserver"

earnest phoenix
#

...

keen drift
#

Are you using js?

earnest phoenix
#

Yes

#

I have just finished making a Web Server JavaScript

#

Do I run that in a tmux thingy also?

#

@keen drift

keen drift
#

the js lib have webhook built in

earnest phoenix
#

Wait

#

So I didn't need to do that?

keen drift
#

?

earnest phoenix
#

Did I still need to create a Web Server?

keen drift
#

no

earnest phoenix
#

ffs

#

So what do I put in the URL box?

keen drift
#

the ip and path

#

look at the js lib