#development

1 messages ยท Page 331 of 1

earnest phoenix
#

@shrewd field good luck your nodejs bot process eating your pc memory

shrewd field
#

really

earnest phoenix
#

yes

shrewd field
#

is that what it says

scenic crest
#

do you need to register them in events

shrewd field
#

ohh

#

and

neon pasture
#

@shrewd field please your code inside a pastebin, WITHOUT the token.

shrewd field
#

i know dude and ok

#

good idea

neon pasture
#

That are more as 25 fields or not?

shrewd field
#

i know how to use embeds

#

dude

neon pasture
#

Paste the pastebin

tawny lava
#

hastebin > pastebin : ^)

shrewd field
scenic crest
#

upload it to a server and let me scp it

#

let's have al ook shall we

shrewd field
#

server

earnest phoenix
#
.addBlankField(true)```
i don't remember that being a thing
tawny lava
#

it is a thing

neon pasture
#

It's a thing

earnest phoenix
#

oh

scenic crest
#

it is

shrewd field
#

it is a thing

uncut slate
#

Essentially zws'es for field name and body

shrewd field
#

huh

neon pasture
#

Those comments tho

shrewd field
#

ya

neon pasture
#

/*``

  • Takes a Date object, defaults to current date.
    */
#

Change that to '// Takes a Date object, defaults to current date.'

shrewd field
#

ok

#

then

neon pasture
#

Change those const embed things to var embed = new Discord.RichEmbed()

uncut slate
#

..no.

#

are you seriously suggesting someone to use var over const

neon pasture
#

yeah? nvm then

tawny lava
#

no

uncut slate
#

๐Ÿคข

tawny lava
#

why would he change const to var

#

smh

prime cliff
#

Welcome to 24/7 Deni tech support help

neon pasture
#

Why don't you guys help him then

uncut slate
#

what's the issue again

tawny lava
neon pasture
#

lol

tawny lava
#

too many listeners

uncut slate
#

yes, it's obvious he has a listener per command

shrewd field
#

nope

umbral pelican
#

if you don't have multiple of the same listener, just ignore it

shrewd field
#

ok

polar granite
#

is there a way to dynamically check what version of discord.js is being used?

shrewd field
#

removes the command

#

gets rid of it

umbral pelican
#

dynamically GWbowsuBlobThonkeng

uncut slate
#

require('discord.js').version, but I wouldn't run that on each command call

tawny lava
#

hmm

uncut slate
#

have it as a variable outside of your export function/class/module

polar granite
#

perfect, thanks!

shrewd field
#

hey i have pm2 installed and i am wondering how can i make a restart command

restive silo
#

have a command what process.exit() is enough since pm2 will auto restart

shrewd field
#

huh

#

what do u mena

scenic crest
#

they mean

restive silo
#

use your brain

scenic crest
#

"have a command what process.exit() is enough since pm2 will auto restart"

#

this is what they mean

shrewd field
#

what do they mean

#

can u give an example

restive silo
#

no

shrewd field
#

why

neon pasture
#

You can't spoon feed

#

or how the hell you call it

restive silo
#

because you can just do what i told you and has also everything you need to use goole at the same time

scenic crest
#

what they said is generally clear

#

I'm terrible at JS and d.js but I understood it

restive silo
#

heh

scenic crest
#

make a command that does process.exit() then pm2 will handle restarts for you

restive silo
#

^

shrewd field
#

like this

#
if(message.content === "restart" ) {
message.channel.send("restarting")
.then(process.exit)```
restive silo
#

try it

shrewd field
#

this is what u mean

restive silo
#

shrug

shrewd field
#

ok i will

topaz fjord
#

Ni

#

No

shrewd field
#

no

#

then what is right

topaz fjord
#

Do

scenic crest
#

try it

#

worst case scenario your PC will blow up

#

honestly development is mostly test driven

topaz fjord
#

Lol

shrewd field
#

huhu

scenic crest
#

you make something, you test it

shrewd field
#

i wont then

topaz fjord
#

It was a joke....

scenic crest
#

no it actually did blow up

#

but yeah it's not if you're gonna run a bot

neon pasture
#

dude

#

How the hell can you blow up your PC when you run a command

shrewd field
#

ok

#

idk dude

neon pasture
#

So just run that shit

#

Nothing is going to happen

#

You only see a error message

#

if it's wrong then

shrewd field
#

i did it and i got restarting

topaz fjord
#

Did it process.exit

restive silo
#

i can give you a snipped of code what will delete your whole hard drive when executed in js lul

shrewd field
#

process.exit

scenic crest
#

have you set up pm2 to do restarts or does it do it automatically @restive silo

shrewd field
#

no it dident

#

process.exit

restive silo
#

no it should auto restart

shrewd field
#

how

restive silo
#

i didn't changed anything from the default config

#

and it does autor restart eyesFlipped

neon pasture
#

O wait

#

nvm

restive silo
#

hasPermission FeelsRageMan

neon pasture
#

ikr

scenic crest
#

you may also wanna limit that command to you only

topaz fjord
#
if(message.content === "restart" ) {
message.channel.send("restarting").then(message => {
process.exit()
})
#

Try that

neon pasture
#

Was thinking about a private bot

shrewd field
#

k

topaz fjord
#

tb!uptime

restive silo
#

you cant use bots in here

topaz fjord
#

...

neon pasture
shrewd field
#

error

scenic crest
#

now what might thta error be

topaz fjord
#

Then put

scenic crest
#

it literally tells you the line

topaz fjord
#

A )

shrewd field
scenic crest
#

where you're missing a bracket

neon pasture
#

it literally tells you the line <---

topaz fjord
#

Ye

shrewd field
#

is this it

topaz fjord
#

No

#

Put a bracket after the })

neon pasture
#

lol

topaz fjord
#

And also yes hats pm2

neon pasture
#

Learn javascript dude.

#

When you open something, you have to close it

topaz fjord
#

pm2 autorestarts when process.exit is used

neon pasture
#

Just copy and paste it code from above

topaz fjord
#

Learn js pls

shrewd field
#

i know js

topaz fjord
#

if you know js then you should know how to code discord.js

shrewd field
#

i know

topaz fjord
#

Then why do you need help with simple things

#

?

shrewd field
#

ok

#

look

#

can u just tell me how do i do the command

topaz fjord
#

I don't wanna spoon-feed you

shrewd field
#

u didnt get what i mean

earnest phoenix
#

I recommend learning a language before making a discord bot in it

shrewd field
#

i have pm2

#

how can i use it in making process.exit

#

because i have process.exit for a shutdown command

topaz fjord
#

And I'm telling you if you know js then why is discord.js hard

shrewd field
#

i made this

scenic crest
#

you know you don't need to send every message in an embed right

topaz fjord
#

Making it all in an embed doesn't look that good

scenic crest
#

^

topaz fjord
#

I learned that the hard way

shrewd field
#

i know

#

not all

#

i have

neon pasture
#

Why do you use .then?

#

Can't you do send message, and then process.exit?

#

Or is that to fast?

restive silo
#

also you maybe wanna make sure the message is sent before killing the client

shrewd field
#

OK

topaz fjord
#

@neon pasture

#

Ye u can

restive silo
#

await it or just use the .then() callback

neon pasture
#

Or just add a cooldown

topaz fjord
#

You can set a timeout on it to

shrewd field
#

ok thanks

restive silo
#

what cooldown eww

neon pasture
#

setTimeout(() => {
// command here
}, 2500);

restive silo
#

dont set any timeout notLikeMiya

#

oml

topaz fjord
#

I might just remove my bots

#

-bots

gilded plankBOT
#
TurtleGamingFTW#4822
Bots

@grave sonnet
@fleet lodge
@sturdy jewel

topaz fjord
#

Ye

restive silo
#

just learn how to use promises and there callbacks/await instead adding delays everywhere

topaz fjord
#

Turtlebot is the only one who will stay

restive silo
#

delays are the most eww

neon pasture
#

It's just an option

restive silo
#

no

#

its shit

topaz fjord
#

Quick question

restive silo
#

ask away i guess

topaz fjord
#

How do you like make the commands of the bot in a list on the website

#

Like when writing

restive silo
#

an websocket module like express

inner jewel
#

edit the description

topaz fjord
#

I di

#

Do

inner jewel
#

html lists

topaz fjord
#

But it comes out like a paragraph

restive silo
#

oh

topaz fjord
#

Not like a list

#

Oh

#

J

#

K

restive silo
#

i though he mean on a website not on the dbots website

#

xD

topaz fjord
#

Forgot totally about that

restive silo
#

yea edit the description you can even use html/css and stuff

shrewd field
#

i think i did it

#

i did what this says

earnest phoenix
#

&&help

#

g help

#

ghelp

scenic crest
earnest phoenix
#
function win(positions, num) {
    console.log("win: " + JSON.stringify(positions) + " (" + (Date.now() - start) + "ms)");
}

var start = Date.now();
for (var col = 0; col < board.length; col++) {
    for (var row = 0; row < board[col].length; row++) {
        if (board[col][row] !== 0) {
            if (board[col][row + 1] !== 0 && board[col][row + 1] === board[col][row]) {
                if (board[col][row + 2] !== 0 && board[col][row + 2] === board[col][row + 1]) {
                    if (board[col][row + 3] !== 0 && board[col][row + 3] === board[col][row + 2]) {
                        win([[col, row], [col, row + 1], [col, row + 2], [col, row + 3]], board[col][row]);
                    }
                }
            }
        } else if (board[col][row] !== 0) {
            if (board[col + 1] && board[col + 1][row] !== 0 && board[col + 1][row] === board[col][row]) {
                if (board[col + 2] && board[col + 2][row] !== 0 && board[col + 2][row] === board[col][row + 1]) {
                    if (board[col + 3] && board[col + 3][row] !== 0 && board[col + 3][row] === board[col][row + 2]) {
                        win([[col, row], [col + 1, row], [col + 2, row], [col + 3, row]], board[col][row]);
                    }
                }
            }
        } else if (board[col][row] !== 0) {
            if (board[col + 1] && board[col + 1][row + 1] && board[col + 1][row + 1] !== 0 && board[col + 1][row + 1] === board[col][row]) {
                if (board[col + 2] && board[col + 2][row + 2] && board[col + 2][row + 2] !== 0 && board[col + 2][row + 2] === board[col + 1][row + 1]) {
                    if (board[col + 3] && board[col + 3][row + 3] && board[col + 3][row + 3] !== 0 && board[col + 3][row + 3] === board[col + 2][row + 2]) {
                        win([[col, row], [col + 1, row + 1], [col + 2, row + 2], [col + 3, row + 3]], board[col][row]);
                    }
                }
            }
        }
    }
}```
#

connect 4 game win logic if anyone wants it

sinful meadow
#

oh god lmao

earnest phoenix
#

lmao

umbral pelican
#

eww

earnest phoenix
#

lol

abstract mango
#

jesus fuck

#

the spaghetti is real

cosmic plover
#

what in the name of actual real fuck

#

@earnest phoenix I like your code now

tawny lava
#

Thonk

earnest phoenix
#

lul

shrewd field
#

hey hey

#

guys guys fast

#

i just bought a vps how do i set it up to run my bot

earnest phoenix
#

Anyone mind helping me?

shrewd field
#

Anyobe

#

Help me

restive silo
#

dude

#

really

#

you should be able to use google for that if you wanna call you a "programmer"

#

._.

trim steppe
#

How to use a vps: See how to use a command line

neon pasture
#

How can I loop all guilds and check if they have more then 10 bots?

restive silo
#

which lang/libary?

neon pasture
#

javascript / discord.js

restive silo
#

use the filter method for collections and then check the size of the result collection something like ```js
<CollectionOfGuilds>.filter(g => g.members.filter(member => member.user.bot).size >= 10)

trim steppe
#

on phone pls excuse
client.guilds.filter(guild => guild.members.filter(member => member.user.bot) > 10)

restive silo
#

rip

neon pasture
#

Thanks

restive silo
#

you can loop through that collection of guilds with more than 10 bots with an forEach

neon pasture
#

so like

#

guild.forEach?

restive silo
#

wat

#

the code above returns a collection with all guilds with 10+ bots

#

you can use a forEach on the returned collection

neon pasture
#

yeah, I need to forEach them right?

restive silo
#

if you wanna loop them, yes

#

depending on what you are doing you could maybe also use map

neon pasture
#

I just want to add +1 to my counter in sql

#

I just use this for one time

restive silo
#

hmm i guess a map could work there blobupsidedown

neon pasture
#

@restive silo

restive silo
#

why ping Thonk

neon pasture
#
  guild.forEach(function(guild) {
              
  }, this);
}```
restive silo
#

what

neon pasture
#

I'm doing something wrong

restive silo
#

thats not how a filter function works ThinkFish

#

its synced

neon pasture
#

Do I first need to loop it and then filter it?

restive silo
#

no

#

you just dont need any {} there

#

(only in the forEach needed)

neon pasture
#

But then it's says this: guild is not defined

restive silo
#
client.guilds.filter(guild => guild.members.filter(member => member.user.bot) > 10).forEach(guild => {
    //code here
})
neon pasture
#

Thanks

uncut slate
#

don't need them in the forEach either, depending on what you're doing

restive silo
#

i told that already

#
Yukine
ID:

368293214530306050

Message:

depending on what you are doing you could maybe also use map

#

๐Ÿ‘€

uncut slate
#

was talking about curlies

#
Yukine

no
you just dont need any {} there
(only in the forEach needed)

restive silo
#

oh

#

thats true

neon pasture
#

How do I edit my bots message? message.edit?

jagged plume
#

yep

#

oh wait

#

no

neon pasture
#

Cannot edit a message authored by another user

#

It tries to edit the message that was sended by the user, not the bot

jagged plume
#

you need to send the message, await the promise (async/await or use .then) and then edit that

neon pasture
#

message.channel.send('test').then(message.edit('test2'))

jagged plume
#

because it resolves the promise with the bot's message

#

nope

#

you'll want to use a function in there

#

.then(function(newmessage) {
// do stuff with newmessage
})

neon pasture
#

function in .then?

jagged plume
#

either use function or you can be cool and use an arrow function

#

kek

neon pasture
#

okay

tawny lava
#

Thonk

uncut slate
#

@neon pasture that's not how JS works

neon pasture
#

Was thinking about PHP

median lintel
#

make a bot in php

neon pasture
#

Nah

earnest phoenix
#

How do u find roles that includes a name? In discord.js

languid dragon
#

guild.roles.find("name", "Role Name Here");

#

that'll get you one ๐Ÿ‘€

earnest phoenix
#

I mean find all

languid dragon
#

ah, well you'd probably need some sort of for statement, or map all roles

#

then iterate through them to find all matching keys

scenic crest
#

iterate*

earnest phoenix
#

Find all roles that includes a sign, ex "$" sends rolea with "$"

scenic crest
#

how do you wnna handle all of them roles

earnest phoenix
#

I want to send a message with the roleS that have a "$"

scenic crest
#

ahh

#

have you considered discord's character limit?

earnest phoenix
#

No

scenic crest
#

it's definitely doable and shouldn't be hard

#

but you might encounter guilds where there are so many roles that they do not fit in the character limit

earnest phoenix
#

Yea but i made a cmd that is only usable on my server

scenic crest
#

is this only intended for you?

earnest phoenix
#

And thts why i need it to list roles with $

scenic crest
#

this example uses string concatenation so it may be extremely inefficient and "bad practise"

  1. Get a collection of all roles that start with $ (Ken showed you how I think)
  2. Declare a "roles" variable and set it to an empty string
  3. Iterate (loop) through the collection on each iteration:
    roles += role.name + '\n' // presuming this is how you get a role name in JS
  4. You now have a string "list" of roles.
  5. Check if roles is empty, if it is, assign it to something like "No roles found". Also check if it's longer than > 2000 chars. If it is, then assign it to something like "Too many roles"
  6. Send roles to the current text channel
#

@earnest phoenix

earnest phoenix
#

K, but who is ken?

scenic crest
#

the weeb with japanese characters as his nickname

#

and a dog pfp

earnest phoenix
#

K

languid dragon
#
var roles = message.guild.roles(find out what the object is exactly);
var toSend = "**Roles with $:**\n";
for(var role in roles){
    if(role.name.toLowerCase().includes(/([$])/g))
        toSend += "Role: " + role.name + " - Colour: " +role.colour + "\n";
}
message.channel.send(toSend);
#

Obviously it's untested but the idea is obviously there, you'd need to check what message.guild.roles; returns in json object

earnest phoenix
#

K

scenic crest
#

just a little social hint

#

"K" often seems a little disprespectful especially when someone just send you a block of code

earnest phoenix
#

Ok

#

But i use "k" as a mark that i read it

scenic crest
#

ahh right

#

well people often use K or OK like

#

"right I didn't understand anything whatever lemme just copy and paste"

languid dragon
#

Read 20:23

earnest phoenix
#

It returns empty on message.guild.roles

#

Wait it returns a lot

lavish mango
#

you need to map it

#

or message.guild.roles.size

earnest phoenix
#

Is it possible to give someone a rule by using args? (Example: !getrole Rolename) instead of mention?

#

*role

scenic crest
#

yes

tawny lava
#

what library

#

and yes

earnest phoenix
#

Cuz when i use args.join(' ') it says its not a role or snowflake

tawny lava
#

what lib

earnest phoenix
#

Discord.js

tawny lava
#

it needs to be a role resolvable

#

const role = <message>.guild.roles.find('name', <roleName>)

uncut slate
#

uhm, no, what you just said needs a name specifically

tawny lava
#

he could replace <roleName> with args.join(' ') but Idk how well that works kek

earnest phoenix
#

So that means thw only say is either specific or mention?

tawny lava
#

no

earnest phoenix
#

*way

tawny lava
#

if you want to add the role to the person who did the command just do <message>.member.addRole(role)

earnest phoenix
#

Yea but i want to find a role by args instead of mention

#

And someone said it isn't possible

uncut slate
#

it is

earnest phoenix
#

Ok do you know how? When i type rolename it just says its not a role or snowflake

uncut slate
#

Lizards solution should work

earnest phoenix
#

Ok ill see if it works

tawny lava
#

<message>.guild.roles.find(role => role.name.toLowerCase() === args.join(' ')) could also work if you don't want it to be case sensitive

earnest phoenix
#

It works thanks

keen nest
#

Real quick what content-type does the sever count API take?

inner jewel
#

application/json

keen nest
#

Hm okay

#

Making sure

#

Guess I'll try it again.

#

-bots

gilded plankBOT
#
VictoryForPhil#4759
Bots <:certifieddev:308880841382297610>

@timber jungle certifiedbot
@trail wing
@round bramble

keen nest
#

Hm

earnest phoenix
#

-bots

gilded plankBOT
#
SilverRoxetZ#5826
Bots

@acoustic sonnet

scenic crest
keen nest
#

Ughhh

#

๐Ÿคฃ am sorry mods.

#

I'm so used to going to dev for this

#

It's a bad habbit

topaz fjord
#

quick question

#

why doesnt this work

#
if(banmember.highestRole.position >= bot.highestRole.position) return message.channel.send("I do not have the proper perms to ban this member, move me up in rank to do this");
earnest phoenix
#

Is it discord.js

#

Who is banmember

topaz fjord
#
let banmember = message.guild.members.get(message.mentions.users.first().id);
#

@earnest phoenix

#

i wanna check if the person they wanna ban has a higher role than the bot

earnest phoenix
#

Why you put .get

#

Id recommend let banmember = message.mentions.users.first()

topaz fjord
#

ik but thats besides the pont

earnest phoenix
#

Ye sorry

#

But idk why it does not know in one of my codes i wrpte this ```if(toMute.highestRole.position >= message.member.highestRole.position) return message.channel.sendMessage("Yutz this person has a higher role");``

#

But

topaz fjord
#

but thats for checking if the member has a higher role than the mute person

earnest phoenix
#

Id recommend u this: ```if (!message.guild.member(banmember).bannable) return message.reply("I can't ban this person!")

#

Thats if the user is not bannable meaninh they cannot be banned it works if the guybhas righer role

topaz fjord
#

k

#

ill try it

earnest phoenix
#

It should work as i did it on my bot

#

And it works perfectly

topaz fjord
#
0|TurtleBo | DiscordAPIError: Privilege is too low...
0|TurtleBo |     at item.request.gen.end (/root/Bot/TurtleBot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:68:65)
0|TurtleBo |     at then (/root/Bot/TurtleBot/node_modules/snekfetch/src/index.js:257:21)
0|TurtleBo |     at <anonymous>
0|TurtleBo |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)
0|TurtleBo | Uncaught Promise Error:
0|TurtleBo | DiscordAPIError: Privilege is too low...
0|TurtleBo |     at item.request.gen.end (/root/Bot/TurtleBot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:68:65)
0|TurtleBo |     at then (/root/Bot/TurtleBot/node_modules/snekfetch/src/index.js:257:21)
0|TurtleBo |     at <anonymous>
0|TurtleBo |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)
#

cause it kept giving me that

#

havent tried the code yet

#

but i asked since i wanted to stop this

earnest phoenix
#

That means user has higjer role than the bot

#

Fucking android lags like its running battlefield 1 with 2gb ram

#

@topaz fjord

topaz fjord
#

it worked ty ๐Ÿ˜ƒ

earnest phoenix
#

Np

#

If you want for kick then just chabge the "bannable" to kickable

topaz fjord
#

ye

neon pasture
#

How do I count all users with shards? discord.js / javascript

#
for(var guild of client.guilds.array()){
  count += guild.memberCount
}```
torpid juniper
#

don't use d.js' shard manager

#

write your own

neon pasture
#

Why not?

torpid juniper
#

it doesn't really provide the function to get the shard id afaik

#

and 1. it's fun to write your own and 2. you know how it works

neon pasture
#
  1. I don't know how to write one.
torpid juniper
#

get cluster

#

npm

neon pasture
#

I'm not the best with javascript

#

cluster

torpid juniper
#

i'll give you mine

neon pasture
#

Thank you

torpid juniper
#

yes

#
const cluster = require("cluster");
const workers = 2;

if (cluster.isMaster) {
    var running = {};
    for (let i = 0; i < workers; i++) {
        cluster.fork({firstShardID: i, maxShards: workers});
    };
    cluster.on('fork', function(shard) {
        shard.on('message', msg => {
            if (msg.type == 'alive') {
                running[shard.process.pid] = msg.id;
            }
        });
        shard.on('exit', (code, signal) => {
            cluster.fork({ firstShardID: running[shard.process.pid], maxShards: workers });
        });
    });
} else {
... code ...
// to get the shard id, do:
process.env.firstShardID
// shard count is:
process.env.maxShards
#

this is mine stripped of all of its bells and whistles

#

obviously your code is there, and the if block is closed correctly

#

@neon pasture

neon pasture
#

O thanks

#

Don't understand anything of it.

torpid juniper
#

just use the variables at the bottom

#

you'll be fine

earnest phoenix
#

you can fetch client values with d.js

torpid juniper
#

shard manager?

neon pasture
#

Already did that with guild.size

torpid juniper
#

Discord.ShardManager('index.js'); is what swepy's using

#

or something like that

earnest phoenix
#

then u can do the same thing and client.guilds.reduce((p, c) => p + c.memberCount, 0)

#

Though I havent used d.js with sharding in months

neon pasture
#
    const guildsizes = result.reduce((prev, val) => prev + val, 0)
})```
torpid juniper
#

swepy

neon pasture
#

yes?

torpid juniper
#

if you're going to use my shard manager then you'll need to put it in your main file.

#

and then you just use client.guilds.size (like in a normal non-sharded bot)

neon pasture
#

So that piece of code inside index.js right?

torpid juniper
#

also hang on

#

yeah

#

but you need to do something else

#
new Discord.Client({shardId: process.env.shardId, shardCount: process.env.maxShards});
neon pasture
torpid juniper
#

no.

neon pasture
#

I didn't change anything

torpid juniper
#

you need to use the new Discord.Client() line i just posted

#

oh.

#

then no it's really not good

neon pasture
#

That's from the discord.js shard manager

torpid juniper
#

hm

#

use mine

neon pasture
#

And on the last line you have this: else {

torpid juniper
#

i don't know how d.js' shard manager works

neon pasture
#

but there is nothing

torpid juniper
#

?

neon pasture
#

} else {
... code ...

torpid juniper
#

yeah

#

that's where you put your bot's code

neon pasture
#

O

#

I need to put that under the new.dicord right?

torpid juniper
#

?

#

the new Discord.Client() replaces your old line that you had

neon pasture
#

I did

torpid juniper
#

var client = ...

#

so you put the shard manager above it

neon pasture
#

const client = new Discord.Client({shardId: process.env.shardId, shardCount: process.env.maxShards});

torpid juniper
#

yes

neon pasture
#

above, okay

torpid juniper
#

and then at the bottom of your code put }

#

because then that ends the block

#

so it should be

neon pasture
torpid juniper
#
-shardmanager-
-code-
}
#

did you add the } at the end of all of your code

neon pasture
#

yes

torpid juniper
#

start it now

neon pasture
#

without the sharder.js right?

torpid juniper
#

yes

#

just index.js

#

sharder.js will break everything

neon pasture
#

The shardCount option must be a number.

torpid juniper
#

instead of shardCount: ...

#

write shardCount: workers

neon pasture
#

wut, where?

torpid juniper
#

in the new Discord.Client()]

neon pasture
#

The shardId option must be a number.

torpid juniper
#

okay what?

#

d.js, hel-

neon pasture
#

That's the error

torpid juniper
#

oh.

#

god damnit.

#

put it back to how it was

#

where you got the shardCount error

neon pasture
#

/pepebot/node_modules/discord.js/src/client/Client.js:506
throw new TypeError('The shardId option must be a number.');
^

TypeError: The shardId option must be a number.
at Client._validateOptions (/pepebot/node_modules/discord.js/src/client/Client.js:506:13)
at new Client (/pepebot/node_modules/discord.js/src/client/Client.js:37:10)
at Object.<anonymous> (/pepebot/index.js:22:16)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)

torpid juniper
#

yeah, i know.

#

you need to go back to how it was

#

where it threw shardCount errors

neon pasture
#

did that

torpid juniper
#

now you see the two process.env.shard[whatever] bits

neon pasture
#

I don't see them

torpid juniper
#

in new Discord.Client

neon pasture
#

O yes

#

process.env.shardId, shardCount: process.env.maxShards

torpid juniper
#

parseInt(process.env.[blah]);

#

do that to them

neon pasture
#

where?

torpid juniper
#

in the new Discord.Client

#

so like shardCount: parseInt(process.env.maxShards)

neon pasture
#

const client = new Discord.Client({shardId: parseInt(process.env.[blah]), shardCount: parseInt(process.env.[blah])});

torpid juniper
#

with the [blah] being whatever was after it

#

like shardId or maxShards

neon pasture
#

with []

torpid juniper
#

without

#

process.env.shardId for example

neon pasture
#

run it?

torpid juniper
#

yeah.

#

try it.

neon pasture
#

The shardId option must be a number.

torpid juniper
#

and you did parseInt(process.env.shardId)

neon pasture
#

const client = new Discord.Client({shardId: parseInt(process.env.shardId), shardCount: parseInt(process.env.maxShards)});

torpid juniper
#

and it's throwing that error?

neon pasture
#

yes

torpid juniper
#

then i recommend you go and talk to d.js in discord-api

#

because that should work.

#

sounds like a bug on their end

neon pasture
#

Okay, thanks for your help ๐Ÿ˜ƒ

torpid juniper
#

no problem.

#

if you still get issues, try switching to eris

#

it's a bit more complicated but when you get the hang of it it's like butter

neon pasture
#

Going to rewrite to eris

weak parrot
neon pasture
#

Said that to my self 2 weeks ago

torpid juniper
#

the thing with the shard manager is that it's written with eris in mind

#

so d.js is fucking up somewhere

#

works fine for eris

neon pasture
#

But eris has a buildin shard system right?

torpid juniper
#

if you mean like d.js' Discord.ShardManager

#

no

neon pasture
#

Someone told me it was just one line

torpid juniper
#

eris is just a library for making discord bots with sharding support

#

you write the shard manager yourself

neon pasture
#

okay.

shrewd field
#

Hey

weak parrot
#

Hi

shrewd field
#

how can i make pm2 to auto restart

#

My b0t

#

Bot

#

Is it like this

#
If(command === "restart") {
message.reply("restarting" .then(process.exit) .then (pm2 autorestart) });```
median lintel
#

u just need the .then statement for process.exit

earnest phoenix
#

How do u restart ur bot with node

scenic crest
#

process.exit and then apparently pm2 will handle it ^^^^

topaz fjord
#

@shrewd field

#

pm2 autorestarts whenever process.exit() is used

earnest phoenix
#

What is pm2

#

A npm?

#

Or program

scenic crest
topaz fjord
#

process manager 2

#

npm

earnest phoenix
#

Where can i get it

topaz fjord
#

techically its like node bot.js but

#

the bot runs when the cmd terminal is closed

#

but pc has to be on

earnest phoenix
#

I use android as host

topaz fjord
#

oh

earnest phoenix
#

Even if i dont use my phone

topaz fjord
#

i use a vps

earnest phoenix
#

But i have to leave screen on otherwise it loses internet

shrewd field
#

ok

amber snow
#

rip

cerulean zinc
#

Should I make it so that some services of my bot cost DCN (Its currency) or should I have it so music is SQ and to get HQ audio it costs X amount of DCN?

shrewd field
#

guys

scenic crest
#

@cerulean zinc how does one obtain DCN

shrewd field
#

i am locally running my bot but

cerulean zinc
#

ddaily, slots, more coming soon

#

or converting from other bots

shrewd field
#

it doesnt seem to appear online and i dont get any errors

cerulean zinc
#

Is it in Invisible mode?

shrewd field
#

yes

cerulean zinc
#

Thats why

scenic crest
#

๐Ÿคฆ

shrewd field
#

noo

#

soorry

#

it is not

scenic crest
#

imo that sounds reasonable ye, make some services paid

shrewd field
#

i use node bot.js

scenic crest
#

and then also make a site where people can manually buy DCN if they're too lazy

shrewd field
#

and it takes a very long time and doesnt work

#

this is what it looks now

scenic crest
#

is the token correct

shrewd field
#

yes

scenic crest
#

are you getting any logging messages

shrewd field
#

how do i show the logs

scenic crest
#

you paste the console output (if there is any)

cerulean zinc
#

What lib is your bot?

shrewd field
#

js

#

d.js

#

there is none @scenic crest

scenic crest
#

rip

#

did you log in the bot?

shrewd field
#

i used node mybot.js

#

nothing appeared

scenic crest
#

did you log in the bot?

shrewd field
#

yes

#

it was working but suddenly it stopped

#

i was using pm2 start -watch

#

and kept it working then it suddunly stopped

scenic crest
#

oh well idk how to help with pm2 sorry

shrewd field
#

i will try to get any previous screenshots of any logging that i have

earnest phoenix
#

Lmao

#

You dont run node mybot.js then pm2 start --watch

shrewd field
#

no

#

i did pm2

#

only

cerulean zinc
#

Maybe ask the help channel for your lib in Discord API

earnest phoenix
#

You just run pm2 start mybot.js --watch

shrewd field
#

can someone help

restive silo
#

get a linter

#

use a proper editor

#

and then that should not happen

shrewd field
#

i have linter

#

i have a proper editor

#

vs code

restive silo
#

how defuq can you get a syntex error then?

median lintel
#

vs code it for C#

restive silo
#

@median lintel no

#

thats VS

#

not VSC

#

Visual Studio is not Visual Studios code

#

that are 2 programms

shrewd field
#

i have vsc

cerulean zinc
#

Anyone know how to resample audio in ffmpeg and have it play at 48K for discord still?

earnest phoenix
#

@shrewd field Install the ESLint extension

#

then that wont happen

#

iirc VSC already alerts you when you're missing a )

sinful meadow
#

@restive silo Check your dms

earnest phoenix
#

@sinful meadow wrong channel

sinful meadow
#

how?

earnest phoenix
#

this is dev

sinful meadow
#

Ik

earnest phoenix
#

not general

sinful meadow
#

I need to talk to him about development

#

lmfao

earnest phoenix
#

but what you said does not relate to development

#

also, stop telling people to check dm's, if they cared enough, they would reply in DM

idle mountain
#

incoming stupid question: when we upload info to the discordbots.org api what is the token that we have to include in the header? is that our bot's token?

#

just asking before i go throwing my bot's token all willy nilly bingV

lime falcon
#

The discordbots API token is not your bots token, it's a different one generated by discordbots.org

#

At the bottom of the API page, 'Select a bot to see the token'

idle mountain
#

ah, alright that would make more sense

#

thank you!

lime falcon
#

No problem

earnest phoenix
#

Do you guys know in js if its possible to end an argument? Like for ex if i wirte "a b" then the b will not be included in the args? Soz if its hard to understand i sux at explaining

languid dragon
#

well you could do "a b".replace("b","");

#

probably a better way of doing it but ye

earnest phoenix
#

Cuz im making a create role cmd, and the name & color gets included

#

Instead of only one of em

languid dragon
#

yeah now you got me lost

earnest phoenix
#

If i do "args.slice" it then skips the first thing but on the first thing i have args.join

#

So if i write name: dd color: red output comes "dd red" as name

languid dragon
#

why not just
//newrole <name> <colour>

#

that way all you gotta do is
//newrole New_Role_Name BLUE

#

๐Ÿ‘€

earnest phoenix
#

Yea but im making it optional

#

To set color

languid dragon
#

well then if someone doesn't add colour? just ignore it?

#

nobody wants to write an entire name: soguhasoeughaoue colour: oaughseoguaeh

#

thats so much effort

#

and it makes it harder for you

earnest phoenix
#

And i also have a cmd called "rolecolor" which chabges the role color of a role but i wanna do it withoutbhaving to mention a role

#

Makes sense

languid dragon
#

then how are you going to change a roles colour without specifying what role?

earnest phoenix
#

I just used "name" the cmd add someone to a role works without mentioning it

#

Omg my keyboard is pure shit

languid dragon
#

honestly i dont know what your aim is rn

#

got me 100% lost

earnest phoenix
#

Its hard to explain but if i have 2 args.join in my code, one is supposted tp ignore the other one that comes after the first onw

languid dragon
#

๐Ÿ‘€

earnest phoenix
#

Idk how to explain it

#

Hi help me for java script start my bot

#

the bot is open source

median lintel
#

node bot.js

#

if ur file is named bot.js

earnest phoenix
jagged plume
#

inb4 token

#

oh wait

median lintel
#

lmao

jagged plume
earnest phoenix
jagged plume
#

Follow that

#

It tells you what to do?

median lintel
#

ibn4 its not his bot

earnest phoenix
#

but i don't understand

median lintel
#

INSTALL NODE.JS

#

the latest version

earnest phoenix
#

yes 8. ....

#

it's good

median lintel
#

then download the bot

earnest phoenix
#

i think ๐Ÿ˜‚ ....

median lintel
#

because its not yours

#

after have a discord server to "be used as the modmail inbox"

earnest phoenix
#

i have completed config.example.json with token and id

median lintel
#

ok

#

rename it to config.json

earnest phoenix
#

it's good

#

and after ? ๐Ÿ˜ฎ

median lintel
#

then open command prompt

earnest phoenix
median lintel
#

just do

#

windows key + r

earnest phoenix
#

aahh cmd ?

median lintel
#

yes type in cmd

earnest phoenix
#

cmd.exe *

#

no just cmd

#

and after ?

median lintel
#

it opened?

earnest phoenix
#

yes

median lintel
#

go to the directory u downloaded the bot from

earnest phoenix
#

how just copy the file ?

#

and paste in cmd ?

median lintel
#

no

earnest phoenix
#

how ?

#

this ? C:\Users\Idk\Desktop\SharpBot-master\TESTBOT\modmailbot-master

median lintel
#

ye

#

copy it

#

and in cmd do cd <yourdirectory>

earnest phoenix
#

yes and after ? ๐Ÿ˜ฎ

median lintel
#

screenshot the cmd screen

#

pls

earnest phoenix
median lintel
#

ok

#

do npm install

earnest phoenix
#

ok

#

loading wait

median lintel
#

let the dependences install

#

tell me when done

earnest phoenix
#

yes wait

#

@median lintel ok after ?

median lintel
#

invite the bot to a server

earnest phoenix
#

that good

#

yes after ?

median lintel
#

then

#

npm start

#

and the bot should start

earnest phoenix
#

ok wait

#

@median lintel ๐Ÿ˜ข

median lintel
#

holy shit

#

maybe eris

earnest phoenix
#

it's craaazy

median lintel
#

eris just fucking up

earnest phoenix
#

how ?

median lintel
#

idk

earnest phoenix
#

It's what eris ?

median lintel
#

eris is library for the bot

earnest phoenix
#

Ohhh ๐Ÿ˜ฎ

median lintel
#

idk ask someone else

earnest phoenix
#

So the bot can not work?

median lintel
#

unless that error is fixed

#

no

neon pasture
toxic oracle
#

You're probably doing something on ready that requires all clients to be ready

tawny lava
#

is there a way to check an invite link's guild name in d.js?

#

if that makes sense

neon pasture
#

I send the server_count to the discordbots API

restive silo
#

@tawny lava you must get first the invite Object you can do that with <Client>.fetchInvite() (it returns a promise btw) and then it resolves with an invite object what has a guild property (normal Guild or PartialGuild)

tawny lava
#

oo alright

#

ty

restive silo
#

np thumbUp

earnest phoenix
#

help..

inner jewel
#

(null).id

#

:^)

earnest phoenix
#

wrong.

restive silo
#

you call .id on something what has is defined as null

#

ยฏ_(ใƒ„)_/ยฏ

elder badge
#

any1 got a code to post a random picture

earnest phoenix
elder badge
#

everytime you post the command it posts a random picture?

restive silo
#

oh you need to put it in an event @earnest phoenix

#

you defined that outside, im pretty sure

earnest phoenix
#

@restive silo Oh, ๐Ÿฆ† .. I need to make a event.. Uh

#

Yeah, I did.

#

like guild create

#

or guild delet

#

I know where to put it!

restive silo
#

no dont "make" an event, use it in one

earnest phoenix
#

^

restive silo
#

wat

earnest phoenix
#

sorry

#

i dont know

#

wrong server and channel

#

a lot of things

#

yes

neon pasture
#

How do I use options when I register a new command?

fleet epoch
#

hmmm should i put my bot back on this list?

its alot better, more fetures and i think i fixed the issue of why console got spammed when it got here.

restive silo
#

Jeffrey are you using commando?

neon pasture
#

umm

#

I'm not sure

neon pasture
#

thumbnail: {
thumbnail_url: 'image'
}
Is there a way to add a thumbnail to an rich embed?

bitter sundial
#

yes

neon pasture
#

How?

#

That piece of code isn't working

bitter sundial
#

is the image a url

neon pasture
#

yes

bitter sundial
#

oh

#

it's not thumbnail_url

#

it's just url

neon pasture
#

Thank you

earnest phoenix
#

@neon pasture that means you're using bot.shard.broadcastEval or bot.shard.fetchClientValues before all shards have finished spawning

#

For that error: Still spawning shards

#

I used to get the same error, but I fixed it

neon pasture
#

I fixed the problem

earnest phoenix
#

ok

neon pasture
#

I did: client.on {

#

But that was to fast

earnest phoenix
#

yeah

#

ready doesn't mean all shards are done, sadly :/

#

I wish that was a feature

neon pasture
#

That would be cool

earnest phoenix
#

I'll suggest it in an issue on gh

neon pasture
#

console.log('all shards are launched.')

earnest phoenix
#

lol

neon pasture
#

xd

earnest phoenix
neon pasture
#

sharing manager, isn't it sharding manager?

uncut slate
#

typo

earnest phoenix
#

Yeah, a typo

#

It's fixed now

neon pasture
#

Nice

shrewd field
#

hey

#

hey

#

i have something i opened my bot today and i wrote this and it kept giving me the loading bar and no result

#

what does this mean

#

anyone

#

hey my code

scenic crest
#

read the error message

shrewd field
#

what it means

scenic crest
#

"something took too long to do"

shrewd field
#

what is the something

scenic crest
#

dunno

#

no idea how node works

shrewd field
#

but

#

do u know someone who knows

#

can u ping him for me

elder badge
#

any1 got a code when the bot is added to the guild it gives you a message

#

@uncut slate?

#

nvm i got it

shrewd field
#

@uncut slate

#

can u help

uncut slate
#

With?

shrewd field
pale light
#

if you search it up theres something online

earnest phoenix
#

@shrewd field maybe if you try searching online

#

we won't always be able to help you

#

be smart and google it yourself

#

also "Something took too long to do." means you tried to use a promise but it didn't return anything back within the max amount of time

fringe flame
#

@shrewd field you are sharing the bot token '-'

#

in the github

#

i used heroku cli

#

to host

median lintel
#

eww

prime cliff
#

Oh god he leaked his token lmao bad

fringe flame
#

i don't leaked

#

'-'

#

i don't need

#

i'm only viewing the commands

#

\๐Ÿ˜„

earnest phoenix
#

Guys do you know in js how to get uptime by minutes?

uncut slate
#

math

earnest phoenix
#

Math? You mean divize by 1000

#

It returns full uptime

uncut slate
#

"full uptime" is in ms or seconds

#

60 seconds in a minute

#

math

fringe flame
#

@earnest phoenix you can do: var botuptime = bot.uptime; x = botuptime / 1000 seconds = Math.round(x % 60) x /= 60 minutes = Math.round(x % 60) x /= 60 hours = Math.round(x % 24) var uptime = hours + ' hours, ' + minutes + ' minutes and ' + seconds + ' seconds.'

earnest phoenix
#

But it comes with dots

median lintel
#

u dont just

restive silo
#

dont use var notLikeMiya

median lintel
#

give away code

#

no

#

thats spoonfeeding

fringe flame
#

i don't use var

#

i use const or let

median lintel
#

use humanize-duration

#

node module

#

very handy ๐Ÿ‘Œ

restive silo
#

or you just format yourself WaitWhat

#

you dont need million dependencies for shit

median lintel
#

this is why they exist

#

SO USE THEM

restive silo
#

yea but YOU DONT HAVE TO USE FUCKING MILIONS IF YOU CAN DO THAT YOURSELF WITH 1 FUCKING FUNCTION

#

Jeez

earnest phoenix
#

Lol wut

uncut slate
#

Humanize-duration is nice.

median lintel
#

very nice its sexy

restive silo
#

well but if you only need the format in 1 thing you dont have to use a dependency tbh

#

its 1 fucking function

uncut slate
#

In my eyes it offers way more than a simple milliseconds to days+hours+min+s or whatever, it offers different styles or writing, languages and everything

restive silo
#

with 10 lines of codes

uncut slate
#

I made one in 4 mmLol

#

(excluding function parseTime (ms) { and }

restive silo
#

hmm Thinkeyes

uncut slate
#

point is, I get where you're coming from

#

I wouldn't recommend HD for parsing uptime, way better in dd:hh:mm:ss

#

it is a useful lib, but I wouldn't use it for bot uptime

restive silo
#

yea

#

same

median lintel
#

i recommend it for how much weeks of free memory you have mmLol

uncut slate
#

๐Ÿค”

restive silo
#

its dam usefull but if you use it 1 time only for uptime and can do that yourself with 1 function its just not needed at all

#

ยฏ_(ใƒ„)_/ยฏ

uncut slate
#

ye

earnest phoenix
#

How is giving away code considered spoon feeding?

clear kernel
#

instead of learning how to code, they just take the code and plop it in

#

that's not helping

uncut slate
#

How is it not considered spoon feeding?

earnest phoenix
#

Ok

prime cliff
#

@earnest phoenix Who even are you do you even know how to code?

uncut slate
#

heyyyy

#

calm it down

earnest phoenix
#

Im learning how to

prime cliff
#

Mkay

#

And to answer your question @earnest phoenix Deni has been constantly asking and pinging people in this channel for tiny little things that are clearly explained in the docs

#

Its ok to ask for help but if you are pinging people everyone 1 minute for it then no

earnest phoenix
#

What?

prime cliff
#

Deni has been constantly annoying people in this channel with lack of common sense and pings

#

What more can i explain? @earnest phoenix

earnest phoenix
#

No

#

Thing

prime cliff
jagged plume
#

@wide totem ?

prime cliff
#

Shard 9/11 oh god

jagged plume
#

If so, you need to go to their support server or ask the owner

#

We cant help you

#

i see 2/11

prime cliff
#

Wait wut?

#

Send pic

jagged plume
trim steppe
jagged plume
#

woa

trim steppe
#

For support on that bot, find their support server

prime cliff
trim steppe
#

this channel is for development

#

of bots

prime cliff
#

Wow thats so weird

#

How is it diffrent numbers

trim steppe
#

Isn't DMs shard 0?

#

No idea

jagged plume
#

i thought so

#

says 5/11 for me on pc Thonk

toxic oracle
#

im on 5/11 on PC aswell

#

sharding is a crazy thing eh?

#

_help

#

@wide totem help