#development

1 messages · Page 1824 of 1

quartz kindle
#

Discord.SnowflakeUtil.generate()

tulip ledge
#

Does canvas has a way to get a url from the image?

#

Or do I have to set up an express server

quartz kindle
#

custom emojis have a url

rocky hearth
quartz kindle
#

get the url from the custom emoji object

#

then download/fetch the image from that url

tulip ledge
#

Ok

#

And then I add that image onto a canvas image, what’s the best way of using that image in an embed?

quartz kindle
#

you can use canvas.loadImage

errant flax
#

what does the time does in the params of .generate([time])

quartz kindle
#

by default it uses the current date (Date.now())

rocky hearth
#

convert canvas image to buffer, and use buffer to generate a image file, and then attach the file to the embed

tulip ledge
quartz kindle
errant flax
#

wait what is a snowflake again misosface
ik snowflake as like an id or somth

tulip ledge
#

I dont want to us emessage attachments

vivid fulcrum
#

Snowflake IDs, or snowflakes, are a form of unique identifier used in distributed computing. The format was created by Twitter and is used for the IDs of tweets. The format has been adopted by other companies, including Discord, and Instagram, which uses a modified version.

quartz kindle
#

snowflake is a unique ID that is built with 3 variables

tulip ledge
#

As when you edit it the image just appears at the top

errant flax
#

im just confused on why does time correlates to snowflake if u know what i mean

vivid fulcrum
#

read the link

quartz kindle
#

timestamp is one of the variables in the snowflake

rocky hearth
tulip ledge
#

Creating an express server is an option or sending the image in a dummy channel and getting the link from there

#

That’s what I’ve been doing

errant flax
#

ohhh now i get it

quartz kindle
#

im not understanding what you mean

errant flax
#

thx!

tulip ledge
#

But I wanna know if there’s a better solution

quartz kindle
#

why do you need to save an image to a dummy channel?

tulip ledge
#

To get the url

#

And use that as image for an embed

rocky hearth
modest maple
#

KannaWhat why not just.... upload as an attachement

#

or use an actually content serving system

quartz kindle
#

you want to use embeds without the actual file?

tulip ledge
quartz kindle
#

then you need to host the image somewhere

#

you could upload to somthing like imgur

tulip ledge
#

Can you upload to imgur using code?

modest maple
quartz kindle
#

hot

errant flax
tulip ledge
lyric mountain
#

we get it, you vape

modest maple
#

bloblul discord embeds

quartz kindle
modest maple
valid frigate
#

threads were available for a while but what the fuck does "dropped" mean

#

as in being added or being removed

vivid fulcrum
#

removed

valid frigate
#

ic

quartz kindle
#

wait what

#

dropped in what sense

#

not removed from the api i presume

vivid fulcrum
#

deprecated ig

lyric mountain
valid frigate
#

and then

#

literally what

vivid fulcrum
#

the events will probably get replaced with something uniform in later gw versions

valid frigate
#

they did say it was not stable but v9 is available without those gateway events

quartz kindle
#

oh

valid frigate
#

aka the library cant pick up those events when i tell it to listen for them

quartz kindle
#

no thats not what it is

valid frigate
#

maybe skill issue or discord just said nah

quartz kindle
#

those events are dropped in api v8-

#

in the sense that if you dont have api v9, you will not receive any of those events

#

from messages inside threads

#

or messages using the threads system

valid frigate
#

i see

quartz kindle
#

thread events you obviously dont receive if you dont use api v9

#

and the others may be dropped if they are part of threads

valid frigate
#

yeah ive already updated it to use v9 but raw events dont show any thread events being received

#

so im curious if its just not a thing yet or something

quartz kindle
#

well they are being rolled out slowly

#

not many servers have them yet

valid frigate
#

this was tested on a server with threads enabled

tulip ledge
#

Mine has it!

valid frigate
#

i really want to believe this is a issue with my code but im wondering if anyone else's bots can pick up these events

tulip ledge
#

Do you think threads will be usefull for bots?

quartz kindle
#

hmm, maybe they didnt enable thread events for bots yet

#

idk

valid frigate
#

also

#

private threads are hard to test since theyre limited to servers with tier 2 or higher

#

as for this

valid frigate
#

when on v9

tulip ledge
#

Essentially we can make private “channels”?

#

For users

quartz kindle
#

tbh i dont get the whole idea of threads

valid frigate
#

the idea of a private thread was that the person who instantiated it can invite other people

#

and yeah me neither, though i guess the implication was keeping chat tidy

valid frigate
#

discord really gonna make it hard for everyone who doesnt have a partnered server

lyric mountain
#

the whole thing about threads was about allowing users to continue a topic on private, if that's limited to tier 2 or above then wtf?

valid frigate
#

mfw not enough vc funding

quartz kindle
#

just create group dms

valid frigate
#

yeah

#

i really do not know the motivation behind threads but im going on a tangent here

nimble kiln
#

But to create group DMs you have to add that person as friend

#

I dont like having friends 😦

vivid fulcrum
#

threads are genuinely pointless imo

valid frigate
#

but its not like its gonna be removed or anything

vivid fulcrum
#

they say people have been requesting them for years but i haven't met a single person who said that

valid frigate
#

same

nimble kiln
#

People have been requesting custom statuses for bots for years, but they're not here yet

#

:]

vivid fulcrum
#

it's just their attempt to copy slack and cater to a wider audience

lyric mountain
#

I mean, in my case I'd have a GREAT use-case for threads, but the private ones

#

public threads are fckin pointless

valid frigate
#

the issue is not necessarily why they implemented threads its how

#

because i think i have confirmation that no bot is receiving thread events

lyric mountain
#

also why tf can't I send ephemeral messages at will?

valid frigate
#

limited to interactions mfw

lyric mountain
#

datsucks

novel oar
#

Public threads are only useful to side-talk about something in chat
ie someone said something in chat and you wanna talk about it, but can't do it in general

#

But yeah it's pointless to make private threads accessible to tier 2...

vivid fulcrum
#

it's their business model

#

they know it's dumb

novel oar
#

Yeaah

valid frigate
#

if they want people to like it at least make it easy to implement

#

instead of dispatching a "thread delete" event every time the client loses access

#

this happens

cinder stratus
#
const { appID } = require("../config.js");
module.exports = {
  players: {
    data: {
      [appID]: {
        queue: [],
      }
    }
  }
}
``` hey anyone know's how do I push and pull data from that queue array
valid frigate
lyric mountain
#

can you please don't bump it that way?

valid frigate
#

"no we dont send you thread delete events, youll have to use context to figure it out"

quartz kindle
cinder stratus
#

.push() works in mongodb offical package?

quartz kindle
#

wut

small tangle
#

push is an array operation

quartz kindle
#

your code doesnt say anything about mongo

cinder stratus
#

oh my bad, I forgot to tell it's the data structures for my mongodb document

lyric mountain
#

what's the inverse of pop()? poll()?

#

like, pop removes first element, what removes last element?

nimble kiln
#

pop removes the last element

small tangle
#

pop removes the last element

nimble kiln
#

shift removes the first one

valid frigate
#

unshift adds an element to the beginning

lyric mountain
#

ah yeah, gotta think like a stack

valid frigate
#

now imagine unpop adds an element to the end

#

winning

nimble kiln
#

add element to end is push(), how sad 😦

small tangle
lyric mountain
#

could be push/pull

quartz kindle
#

in js, the opposite of push/pop is unshift/shift

small tangle
#

i was about to type LULW

median moss
#

do I need any extra lib for buttons, or discord.js can handle it out?

quartz kindle
#

buttons are supported in v13/master

#

in v12 you need to either use a library or implement them using raw events

median moss
#

yeah, I'm on v12

#

do you know any library for this?

summer torrent
#

i don't recommend 3rd party lib

quartz kindle
#

most people use discord-buttons

summer torrent
#

just use dev version

quartz kindle
#

yes

#

i just use the raw event

median moss
#

.-.

summer torrent
median moss
quartz kindle
quartz kindle
median moss
#

hm

#

is there any docs with that?

summer torrent
#

no

quartz kindle
#

nope, raw events are not documented

summer torrent
#

its not public thing

quartz kindle
#

i can show you my code tho

summer torrent
#

also tim, it is client.api

median moss
median moss
quartz kindle
median moss
quartz kindle
#

yes

median moss
#

ok

quartz kindle
#

and in my interactions function i have

median moss
#

hm

#

ok

#

thx

quartz kindle
#

and my createButtons makes the button structure

#

that you can find in the discord api docs

median moss
#

ok

#

I'll try it

#

thx

median moss
summer torrent
quartz kindle
#

anywhere

summer torrent
#

just use v13

median moss
quartz kindle
#

yes

median moss
#

ok

#

thx

quartz kindle
summer torrent
#

why

quartz kindle
#

i will use it once its released, not while its in dev

#

not for a prod bot

summer torrent
#

im using it in dev too

quartz kindle
#

plus the caching changes screwed me over

#

i have to redesign djsl around them, which i didnt do yet

spark flint
#

anyone good at flask

summer torrent
earnest phoenix
spark flint
#

i'm using flask for a log system

#

basically, my bot creates a html file and saves it to a folder. I want people to be able to login with Discord and if their ID is on a list of allowed Id's, they can access the html file

vivid fulcrum
#

is there any need for that

spark flint
#

yeah, i don't want unauthorised users to be able to access the html file

wheat mesa
#

Is there a type that's similar to Map except I can just have 2 keys and no value? I'm trying to associate a server id and user id together, but there might be multiple entries of both. I'm thinking Map<string[], string> except I don't know what do put in the value portion of the map

vivid fulcrum
#

can't you just send the html file in dms is what i was implying

quartz kindle
#

there is no get(), only has() and delete()

spark flint
wheat mesa
#

Oh alright

#

Perfect

spark flint
#

like i have it on backend.(botdomain).xyz and its just login redirect looping atm

vivid fulcrum
#

seems like you want a proper dashboard then

spark flint
#

so the login feature works, its just looping and I need help with making it not loop

vivid fulcrum
#

not just generating html files

quartz kindle
#

an html file by itself has no backend

#

you need the backend to verify the authorization before sending the contents

spark flint
#

i know but i am currently restricting access to the directory with discord login

#

i'm now looking at discordbotdash module

quartz kindle
#

so you can read the file into flask, then send the file as text from flask

#

if the user is authorized

vivid fulcrum
#

it isn't really a proper way to do it

#

don't generate html files in the first place

sage bobcat
#

One message removed from a suspended account.

vivid fulcrum
#

do SSR with flask or create an SPA that makes calls to your backend api

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

/hug

acoustic elm
#

you need a /login endpoint and a /auth endpoint,
the /auth should return an object of the user or a 401 error, the /login should handle all the stuff and redirect you to the discord oauth page

quartz kindle
#

SSR is essentially the same

vivid fulcrum
#

the end result is

#

the process isn't

#

why in the hell would you save html files in a directory and then save/update them constantly

#

and then serve them

acoustic elm
#

that makes no sense

quartz kindle
#

you save the html template/unchanged parts

spark flint
#

its never updated, it generates the html when i run the command

acoustic elm
#

if you want to do that use a library like ReactJS

quartz kindle
#

then serve it with changes

#

if all you're doing is authorization and nothing else, then you dont need SSR, you just send the entire unchanged html contents

#

after the proper authorization

limber mica
#
N:\Desktop\ColdRP bot\node_modules\kurasuta\dist\Sharding\ShardingManager.js:85
                    this.emit(Constants_1.SharderEvents.ERROR, new Error(`Cluster ${cluster.id} failed to start`));
                                                               ^

Error: Cluster 0 failed to start
    at ShardingManager.spawn (N:\Desktop\ColdRP bot\node_modules\kurasuta\dist\Sharding\ShardingManager.js:85:64)
Emitted 'error' event on ShardingManager instance at:
    at ShardingManager.spawn (N:\Desktop\ColdRP bot\node_modules\kurasuta\dist\Sharding\ShardingManager.js:85:26)
#

;-;

#

debug time!

velvet pewter
quartz kindle
#

ok

wheat mesa
#

I now have a set containing an array of 2 strings, as [userid, guildid], however when I use the Set.has([userid, guildid]), it's not seeming to find my entries. Anyone have an idea why?

quartz kindle
#

you cant do that

#

Set doesnt store the contents of the array, it stores the reference to it

wheat mesa
#

Oh

#

What should I use as an alternative

quartz kindle
#

every time you do [a,b] you create a new array, so the reference will never be the same

#

unless you save the ref in a variable

#

a = [1,2]
Set.set(a)
Set.has(a) // true

#

you want to store a unique combination of user id and guild id?

wheat mesa
#

Yup

quartz kindle
#

you can store it as a bigint

#

or a string

wheat mesa
#

Like... concatenated?

quartz kindle
#

yes

wheat mesa
#

Then just split by length since it's always the same

#

Seems like a solution

quartz kindle
#

its not always the same

wheat mesa
#

Oh

quartz kindle
#

for string you need a separator

#

for bigint you can use bit length

wheat mesa
#

Alright

earnest phoenix
#

Is it possible to run js stuff and inject it in the script before building the file in esbuild?
Astro does this but I want to do it with vanilla js

wheat mesa
#

I'll try that out

quartz kindle
#

a bigint will be much more memory efficient than string

quartz kindle
earnest phoenix
#

imma look for a plugin that does that

spark flint
earnest phoenix
#

wdym bot panel

spark flint
#

dashboard

#

like panel to manage bot settings for your server

wheat mesa
#

I'll look into the bigint solution in a little bit (no pun intended), but the string solution should do as a temporary fix for now. Thanks tim!

earnest phoenix
# spark flint dashboard

Spin up an http server that serves the html for the page
Add some javascript in the html to send the updated settings to an endpoint on your server
The server should update the settings in your db

earnest phoenix
#

I dont know python but flask seems like a good server

earnest phoenix
#

sarcasm intended

wheat mesa
#

Is there a way to get typescript (or eslint) to require me to put semicolons? I seem to forget sometimes, and even though they're not necessary I like using them for consistency

near stratus
wheat mesa
#

I have prettier, not sure why it's not doing that

dense flame
#

You have to configure it in the settings. Just search for prettier

near stratus
#

in eslintrc.json

#

I suggest using this tho

"semi": ["error", "always", { "omitLastInOneLineBlock": true }]
wheat mesa
#

Doesn't seem to do anything for me

#

Whatever, I'll figure it out later

quartz kindle
#

eslint does work for me

near stratus
lilac bridge
#

APA INI ANJAY

wheat mesa
near stratus
near stratus
lilac bridge
#

Where u from:v

near stratus
rocky hearth
#

will the Structures be removed in djs13?

earnest phoenix
rocky hearth
#

yes it is already removed

earnest phoenix
#

wtf

rocky hearth
earnest phoenix
#

ah yes structures fix: remove structures

rocky hearth
#

the devs are saying, it is removed, and shouldn't be able to be imported now with djs13

#

but for some reason I'm able to do

#

I'v cleared my yarn cache, tried deleting node_modules, but no luck

woeful pike
#

oh did they finally remove the pointless class extending abstraction? lol

#

good

cinder patio
#

really though

woeful pike
#

Please don't remove Structures. My bot's entirely dependent on it. If someone adds something that doesn't work, its them to blame, not you. They should've known what they're messing with before updating the structure.
lmao

#

"please don't remove this so I can continue to incorrectly use it"

cinder patio
#

they can be useful, but yeah the disadvantages outweigh the advantages

earnest phoenix
#

Imagine storing your custom server prefixes in a mongodb collection
You'll only need to fetch the collection ONCE then djs will cache the prefixes because you extended Guild with a customPrefix property

cinder patio
#

you can store the prefixes in a map which is attached to your client instance

woeful pike
#

don't do that either, just pass a context to your commands that has all the data you need to run commands

quartz kindle
#

everything that people did with structure extensions you can easily do without them

rocky hearth
#

can someone confirm , if Structures been removed from discord.js@dev, bcoz for me it is still there.

quartz kindle
#

yes it was removed lol

woeful pike
#
type CommandContext = {
  client: Client,
  message: Message,
  db: Database,
  prefixes: Map<string, string>
}
earnest phoenix
#

wtf ts bad!!!

woeful pike
#

just pass this around why would you need to fuck with the discord.js API just to check a prefix

quartz kindle
#

why would you even need to pass prefix around after the initial check in the message event?

woeful pike
#

yep

rocky hearth
quartz kindle
rocky hearth
#

yes

earnest phoenix
#

delete djs and install detritus

cinder patio
#

Attaching the database instance to your client could be useful when you need it in an event rather than a command

quartz kindle
#

close and reopen

#

after updating deps

woeful pike
#

you could create an EventContext too

quartz kindle
#

vsc caches typings for dependencies

woeful pike
#

this is how you deal with problems like this in any other language

rocky hearth
#

no, even the files are there

quartz kindle
#

then you didnt update your dependencies

cinder patio
#

how would you do that tho

rocky hearth
cinder patio
#

oh nvm just thought of a way of doing it

quartz kindle
#

how did you do it

woeful pike
#
type EventContext = {
  client: Client,
  db: Database,
}

type CommandContext = EventContext & {
  message: Message,
}
earnest phoenix
#

what's &

quartz kindle
#

and

woeful pike
#

merges 2 types

rocky hearth
quartz kindle
#

use the github version

cinder patio
#

That's not what I meant by how would you do it, how would you replace the argument in the event

quartz kindle
#

github:discordjs/discord.js

#

npm i discordjs/discord.js

earnest phoenix
#

what if my code is on gitlab mmulu

quartz kindle
#

ur fuxed

rocky hearth
#

I did this discord.js@dev

earnest phoenix
#

or macrohard excel

quartz kindle
#

ye dont do that

#

do what i said

rocky hearth
#

ok

woeful pike
#
const ctx = createContext({ client, db })
client.on("memberAdd", (...args) => f(ctx, ...args))
quartz kindle
#

or... just use member.client?

#

lel

earnest phoenix
#

what is that code supposed to do

woeful pike
#

I'm talking about how you can pass around a context without modifying the discord.js api

#

adding random shit on top of client isn't the best either

earnest phoenix
#

yo how did you reply to my message before i typed it

quartz kindle
#

you can keep all your stuff in a single client property object

woeful pike
quartz kindle
#

to keep it orgnized

#

but yeah you can also create contexts like that

#

more upkeep tho

woeful pike
#

you're essentially doing the same thing as Structures there and it's a pain to work with in typescript

#

I don't want to pass client everywhere if I don't need to

#

this way you can create different kinds of contexts and pass the things you need to different things

cinder patio
#

Most discord.js objects have the client attached to em

quartz kindle
#

thats the thing, you dont need to. client exists everywhere inside djs

cinder patio
#

Though yeah contexts are definitely more organized

#

at least imo

rocky hearth
quartz kindle
#

not the way you did it

rocky hearth
#

then y they say to install this discord.js@dev

earnest phoenix
#

what is the equivalent of window in node

quartz kindle
#

the way you did it looks into npm for a version with that tag, which requires the devs to actually publish that tag to npm. and dev versions are not regularly published to npm, if ever

woeful pike
#

if you were executing a command and wanted to include the current command being executed in the function you would need to pass it as an extra positional argument whereas with ctx pattern you can just create a separate CommandContext that has a non-nullable command property on top of it that extends from a base context

#

that's just how I like to organize my programs I guess though

quartz kindle
#

in short: discord.js@dev = the latest version that the devs explicitly put on npm
discordjs/discord.js = the latest version directly from github including the very latest commits

cinder patio
#

Up to preference, If I had a huge codebase I'd use the context pattern

#

but with a small bot I'll just attach everything to the client

woeful pike
#

I don't like mutating things because it's extra work to represent it in typescript

cinder patio
#

true, there's always the ! postfix tho

#

eslint has a rule against that operator by default

woeful pike
#

when Client gets created it doesn't have any of those properties, you just have to remember to add them and fool the typescript compiler into believing they exist when you try to access them

#

which is not an approach I like

#

contexts can be safely typechecked

rocky hearth
quartz kindle
#

well it didnt for you

#

and apparently they didnt know why either

#

or you did something wrong

rocky hearth
#

i dont think so. I cleared yarn cache, than removed node_modules, reinstalled all packages again

quartz kindle
#

or just npm i?

brave garnet
#

Is it a good idea for a bot to automod stearn scam?

quartz kindle
#

probably?

brave garnet
#

O rly?

quartz kindle
#

as long as people know the bot is doing it

brave garnet
#

IK. Now it filters swears and its said on bot's page

lethal trout
lyric mountain
#

show where you defined graph

slender thistle
sudden geyser
#

yes

valid frigate
#

no it would not be an array

#

i dont know jack about rust but iirc that sql statement produces a single value for cat color

sudden geyser
#

By array he means the parameter list is in an array and ?1 refers to the first element in the array

valid frigate
#

AH

sudden geyser
#

Though, it could be shortened to just ? if the same value doesn't need to be represented in multiple parts of the query

warped lintel
#

Nekomaki. Who

sudden geyser
warped lintel
#

@ripe prairie

sudden geyser
warped lintel
warped lintel
wheat mesa
#

That’s why

sudden geyser
#

Your bot's commands have emojis or gifs that could cause epileptic seizures due to its flashy and flickering nature. Please remove all content of such nature in your commands.
It means the emoji/gif your bot presents is too flashy/flickery.

#

e.g. a blob rainbow dance emoji

#

if you know what one I'm talking about

#

But you'll want to explain your issue in #support or contact a moderator via DMs.

warped lintel
slender thistle
#

That's best

#

Neat

#

Thanks a lot

#

Watch me corrupt my db within seconds

small tangle
#

first time with docker iPog

sudden geyser
#

what is docker useful for

small tangle
#

u can use already configured docker container e.g. for db and they are pretty fast up and running

#

but thats probably not the best explanation for dockers advantages

wheat mesa
#

Is it considered a privacy breach if I create a command to list the servers my bot is in (by name) as long as the command is only available to me, in a private channel?

quartz kindle
#

if its only available to you then no

wheat mesa
#

Alright

brazen epoch
#

For some reason its not sending a webhook when i vote for a server any idea why?

earnest temple
#

What was the command to show on the status in how many guilds are the bot (discord.js)

lament rock
#

client.guilds.cache.size

earnest temple
#

Ty

proven lantern
#

const x = "hello [go here](http//websitelink.com) blah blah [another link](http//websitelink2.com) blah blah"
i am trying to split out the markdown links, but this isn't working.

x.split(/\[.*\]\(.*\)/)

#

i need to use a different character set than .

#

can i say all characters besides [ ] ( ) somehow?

lament rock
#

You can use [^chars] to specify any characters except for those specified in the Array (the ^ is necessary)

proven lantern
#

[.^\[^\]]

#

something like that?

lament rock
#

\[[^\[\]]\]\(([^\(\)])\)

#

That's for

proven lantern
#

ouch

#

let my brain work for a second

#

also thanks

modest maple
#
pub struct TimedCache<K, V>
where
    K: Eq + Hash + Clone + Send + 'static,
    V: Eq + Hash + ShallowCopy + Send + 'static,
{
    state: RandomState,
    internal_queue: DelayQueue<K>,
    internal_map: MultiValueMap<K, V>
}

impl<K, V> TimedCache<K, V>
where
    K: Eq + Hash + Clone + Send + 'static,
    V: Eq + Hash + ShallowCopy + Send + 'static,
{
    
}
``` Ngl really wish there was a simpler way of defining large blocks of traits combinations other than super traits
viral spade
#

My statistics bot is not receiving any messages coming from threads. Is there a way with discord.js to also get the message events from threads, not only from the main channels?

lament rock
#

You'd need to upgrade to djs master and add logic to listen for thread related events

#

v12 does not support threads

#

or you use the raw gateway :)

quartz kindle
#

you need to be in the api v9 to even receive events

proven lantern
#

shouldn't this work?
"hello [go here](http//websitelink.com) blah blah [another link](http//websitelink2.com) blah blah".split(/\[[.^\]]*\]\([.^\)]*\)/);

quartz kindle
#

and even then someone here said they were on v9 and were still not receiving events from threads

#

so we dont know the current state of the threads api

modest maple
#

v9 is a lil all over the place

lament rock
#

I messed up my regex by mistake. This is the fixed one: /\[[^\[\]]+\]\(([^\(\)]+\))/

proven lantern
lament rock
#

and you shouldn't use split since it would remove the link

proven lantern
#

my isn't as helpful

proven lantern
#

and make the strings react components too

#

[.] matches the . not all characters

lament rock
#

then you can match the string with the regex I provided and string.replace(match[0] /* The matched string */, "") and then do something with the match[1]
If you include the g flag and don't iterate over the string, then you'd have to chain replaces

proven lantern
#

the split function will iterate for me

lament rock
#

matching the string with the g flag will reduce the amount of iterations you have to do when using the regex against the string. Using regexs should be done sparingly

proven lantern
#

first i will get a list of markdown links. then a list of the text with links missing. then i iterate over the text and add back in the links

#
["[go here](http//websitelink.com)", "[another link](http//websitelink2.com)"]```
#

i want to get these two lists

#

then i'll make <React.Component>hello <React.Component2 href="asdfasd">go here</React.Component2> ... </React.Component>

#

there must be a way to do .split and .match at the same time

lyric mountain
#

\[(?<text>.+)\]\((?<link>.+)\)

#

then just get named groups, "text" will be the text, and "link" will be the link inside parentheses

lament rock
#

the . matches outside of the bounds

viral spade
#

does the most actual version of discord.js support threads?

lyric mountain
#

nope, it won't match outside

#

it'll stop at )

#

note the \) after it

lament rock
lyric mountain
#

ye, nothing wrong

#

click "details"

lament rock
#

FF doesn't support named groups

lyric mountain
#

ah I see what you mean

proven lantern
#

dang, that would be nice

#

i need to support ie 11

#

lol

lyric mountain
#

you can still use numbered groups

proven lantern
#

let me try it out

#

i finally got this to work \[[^\]]*\]\([^\)\s]*\)

eternal osprey
#

Hey! Why did I get a message that my bot got approved?

proven lantern
eternal osprey
#

My bot was approved for like half a year already or something

#

never pushed any other bot

lament rock
#

If someone listed you as a collab, it probably DMs you about that as well

lyric mountain
lament rock
#

Logical expressions

fathom tiger
#

very dumb question, but I'm new to this. How do I determine the webhook URL for my bot?
like, I know where to enter it on my top.gg page, but I don't know what it should be

lament rock
#

Once you create a route on your web server which is designed to handle requests from topgg, then you pass that route to topgg

fathom tiger
lyric mountain
#

ye

lament rock
#

No lol. How is your bot supposed to know what to do if you don't provide any code for it

lyric mountain
#

the bot is just a connection between your code and discord

#

the actual bot is the code

fathom tiger
#

im still confused

eternal osprey
#

Ah nvm, how bad can it be

lament rock
#

Look into how to make a web server and how to handle topgg requests with their docs

lyric mountain
#

a webhook is just a reverse api, you handle requests made to it

boreal iron
#

Topgg sends a request to your endpoint (webserver) and it will manage the request, for example running your code sending a message via your bot

lyric mountain
#

if you setup a webserver together with your bot you can grab the requests directly and pass to the bot

fathom tiger
lament rock
#

what don't you understand

fathom tiger
lyric mountain
#

here

#

mozilla explains it well

fathom tiger
#

like i know what a webserver IS, I just dont know HOW to easily set one up alongside the bot

vivid fulcrum
#

you have a common misconception that your bot == your app

lyric mountain
#

express.js, @ripe niche/sdk, etc

#

oh fck

#

I'll not edit, it's his fault

vivid fulcrum
#

your bot is merely something you're using inside of your app

#

it isn't your app entirely

#

you can add anything you want into your app

#

your app just happened to run the discord bot as well

fathom tiger
vivid fulcrum
#

correct

#

but it doesn't have to do that exclusively

lament rock
#

How to efficiently do it which is scalable is to have the website be independent from the bot and then have some form of IPC like a websocket layer. and your web server would act as a coordinator for front facing requests

lyric mountain
#

you what?

boreal iron
#

Or simply follow the docs and it’s examples to host the webhook service (webserver), importing your discord client to it, spawn a second instance and if a request comes from topgg, do whatever you want the bot to do

vivid fulcrum
fathom tiger
#

I assume I'd have to mess with something like Flask

#

or django

lament rock
#

Not entirely necessary unless that's what you absolutely want to go for

fathom tiger
#

my users keep asking me for vote command lol

#

(mainly cause they want free stuff lmao)

lament rock
#

Fair... A simple back end server without any fancy front end should be more than sufficient to process that

lament rock
#

the website logic should still follow what I suggested

earnest phoenix
#

How can i download node js raspberry pi

lament rock
#

The package manager should offer node since node should support rpi

earnest phoenix
#

I can only download version 10.24.0

lament rock
#

Then you'd have to build the latest version of node yourself or find builds online

fathom tiger
lament rock
#

google

earnest phoenix
#

Version of linux i can not

fathom tiger
lament rock
#

Then don't do top gg specifically. Get a basic structure laid out first and then try to adapt what the docs say to your structure

fathom tiger
lyric mountain
#

flask

lament rock
#

I don't code in python, so I wouldn't know

fathom tiger
boreal iron
lament rock
boreal iron
#

Not that this the most decent way but it will donuts job

#

WTF

#

Auto correct…

lyric mountain
#

donuts

boreal iron
#

*do its job

#

iOS "AI“ is great

boreal iron
vagrant sedge
#

ig if i have two word commands, should i keep the words separate, underscored, combined, or dashed?

lyric mountain
#

up to you

vivid fulcrum
#

whatever's the easiest to type

#

that as well

lyric mountain
#

EDIT: now I understood what you mean

#

ye, anything but spaces are fine

wheat mesa
#

Anyone know how to respond to button interactions using detritus?

chrome silo
#

Do I get the Bot Developer role when my bot get's verified on top.gg?

#

Wrong Channel sry

chrome silo
#

Thx 👍

lofty cedar
#

in socket when trying to connect, how could i make that if the connection didn't worked:
do something
(python)

earnest phoenix
#

The connection object should return a state

lofty cedar
earnest phoenix
#

Well you could always try showing me

lofty cedar
#
    s.connect((host, port))
ConnectionRefusedError: [WinError 10061] Impossibile stabilire la connessione. Rifiuto persistente del computer di destinazione

C:\Users\Eugenio\Desktop\hexye developing\automation>```
translation: Impossible to connect. Persistent refusal from the destination computer
earnest phoenix
#

You could simply try to

#

try catch it

half solstice
#

Hi

earnest phoenix
#

Try except in your case

half solstice
#

:3

#

I'm bored

#

:3 XD

earnest phoenix
#

hi sir

half solstice
#

Hi

earnest phoenix
#

hru sir

lofty cedar
#

it works, thx 🙂

half solstice
lofty cedar
#

now how could i make an infinite loop so while except it try to connect again?

earnest phoenix
#

maybe with a cool down

#

like wait a few seconds before retrying

lofty cedar
#

yes actually good idea

half solstice
#

You can use

earnest phoenix
#

python

half solstice
#

setTimeout

half solstice
earnest phoenix
#

You should probably use asyncio

#

so it doesn't block the rest of your code

#

then asyncio.sleep for the cool down

half solstice
lofty cedar
#

also could use time

earnest phoenix
#

asyncio is the async library for python

half solstice
#

Well I'm gonna sleep bye guys have a nice day

half solstice
robust fern
#

embed.image.url: Could not interpret "{'name': 'welcome-image.png'}" as string.

#

y tho

#

i give code once someone pings or somthn lol

#

oh look someones here

earnest phoenix
#

or just give it

lofty cedar
robust fern
#
const canvas = Canvas.createCanvas(700, 250);
    const ctx = canvas.getContext('2d');

    const background = await Canvas.loadImage('link lol');
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'welcome-image.png')
  const welcembd = new Discord.MessageEmbed()
  .setTitle(`Welcome to ${member.guild.name}, ${member}`)
  .setImage(attachment)
  message.channel.send(welcembd);```
earnest phoenix
#

have a global variable isConnected or something

robust fern
earnest phoenix
#

set to true if you connect

#

so while not isConnected

robust fern
#

me

dawn kernel
#

Does medal use

#

C#

#

for their back-end?

robust fern
#

sigh i didnt get help

earnest phoenix
#

you have no patience at all bud

robust fern
#

lmayo

#

so help

#

sigh no help

#

fixed it on my own

#

now i have other issues

robust fern
#

and i need help with those issues

#

ctx.beginPath();
ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ format: 'jpg' }));
ctx.drawImage(avatar, 25, 25, 200, 200);

#

y does the begin path arc closepath and clip not work lol

lyric mountain
#

I'm pretty sure clip doesn't work like that

south vector
#

Hello there deos anyone have a bot that when someone is banned by a bot or a user it displayes a message in a channel saying like user is banned for reason.

vivid fulcrum
#

wrong channel

south vector
#

Um

#

What is the right channel

split hazel
#

probably #general but people there will tell you to find the bot yourself

robust fern
quartz kindle
#

remove closePath

earnest phoenix
#

how can i add codeblocks in my embed description?

sudden geyser
#

```language
code here
```

earnest phoenix
sudden geyser
#

then you're doing it wrong

earnest phoenix
#

like i only want certain words highlighted

sudden geyser
#

it should be in a string

#

so you should show what you're doing

river peak
#

do thread id's act the same as channel ids?

hybrid cargo
river peak
#

ok

hybrid cargo
valid frigate
#

anyone know what channel_ids is supposed to represent in THREAD_LIST_SYNC?

wheat mesa
#

(Assuming you’re using js, not sure how it works in py)

valid frigate
#

but i really dont understand its use

#

do events like CHANNEL_DELETE register for channels that the client cannot see?

solemn latch
valid frigate
#

ok

paper isle
#

watchbot.app might be something you could be interested in.

#

Uptime of your own bot, right? You could save when the bot starts and stops in your db and calculate the uptime yourself. More hassle than it's worth imo. Especially the part where you save the stop time.

I use watchbot and it's pretty much what you're asking for; get the % uptime of your bot.

#

Or list your bot on discord.bots.gg. They add all their bots to their server and monitor their uptime % that you can see by using a command.

honest gorge
#

anyone how to get notification of my vote bot?

lament rock
long crow
#

Any general idea how I can stress test memory usage of my bot?

#

I don't I can just throw it to public for testing

lament rock
#

Spin up a dev bot and add to large servers you have authority over and add the presence intent

#

or store user data in a db and then create fake message create payloads and fill in the user data with stored which you can fill from live and then your lib will cache those users

valid frigate
#

when syncing threads is member already included in the channel object or am i required to use the members field

long crow
#

^ I don't have presence intent, only ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES']

lament rock
#

Users and Messages are what take the most memory

valid frigate
#

you could consider increasing the amount of messages your library is allowed to store per channel

#

you don't necessarily need a large server for that but it might be hard to write messages over and over

long crow
#

that why I ask on it since I dont think I can measure with me all alone spamming message

valid frigate
#

lol

long crow
#

client.sweepMessages(10 * 60 * 1000); djs master branch have this feature now, what I fear is the hidden one

valid frigate
#

this is what i have so far, i'm replacing channels in the cache if a channel is sent through the thread sync event

lament rock
#

That's why I mentioned making fake message payloads and filling in with users you store in a database from live

#

The channel ID has to be real and cached is the only requirement for message create on Discord.js's end

#

you should also be making those fake message payloads for a guild text channel as DM channels won't work

wheat mesa
#

Just so I'm prepared in the future... how many guilds per shard should I be using?

long crow
#

I just return when it is a DM, now the real question how am I executing it 🤔

lament rock
#

The max amnt is 2500 before Discord says you can't connect. If you're a music bot owner, consider 1500. Otherwise, 2000-2500

wheat mesa
#

Alright

lament rock
valid frigate
#

it does

#

listen for "raw"

#

unless they changed that, i havent used the lib since v11

lament rock
#

Not listen

#

injecting fake payloads

sudden geyser
#

For stress testing, it really depends on what you're testing and how it'll be used. I find it more efficient to calculate the cost of something ahead of time and see how that would scale in the future (like SQL's EXPLAIN clause) rather than trying to simulate the real environment and hoping it's accurate enough.

For a developer working on an algorithms library, it would mean reviewing the amount of processing your functions does. Maybe it looks fine at first until you realize it's n * n.

long crow
#

What step by step I should go? I think I can do test run online few days on my test server first? and does process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2) is suffice to measure it?

sudden geyser
#

Use a benchmarking library

#

If node has one

#

It'll probably give you more insight than just standard calculation of the memory (and some console.time)

long crow
#

This might be a starter, though 3 years ago published

#

nvm, failed to install on v16

bitter turret
#

My bot got declined loo

#

Lol

lethal trout
earnest phoenix
#

I need some help with my battery
My battery is having trouble charging. I've changed sockets and tried charging the phone in short blasts and it seems to be charging a bit better but still takes way too long. The problem ain't with the charger because my mom's phone (same brand as mine and older model) charges fine and WAY quickly.
Last night I put it on charge at 5% and I wake up to see it at 1%
I tried to clear off apps in the background but then my phone died

Specs
vivo 1173
FuntouchOS (vivo doing a great job at vendor lock in)

Help

earnest phoenix
#

big brain

#

why dont you use it for coding GOOD bots

wary flame
#

You can still export it if needed

earnest phoenix
#

Will erwin lend me a free usbc charger for saying detritus rules?

valid frigate
#

this is a bit random

#

but does anyone know if thread sync event syncs only channels the client couldnt see before

#

this is because if not, then the event would wipe the message cache of channels which the client could see before the event happened

wheat mesa
#

Learn the ways of the discord bot library king itself, detritus!

earnest phoenix
#

lol

earnest phoenix
lament rock
#

imagine shilling for a lib

#

npm i request
request gud
ignore deprecation warning is good.
a 1GB install size is a small price to pay for request
/s

wheat mesa
#

npm i is-odd

near stratus
wraith solar
#

Is it normal for my charger to just stop working bc I've had to change the charger way too many times

earnest phoenix
lament rock
#

want a very low memory usage bot?
npm i cloudstorm
learn raw gateway
npm i snowtransfer
learn raw rest

earnest phoenix
lament rock
#

🗑️

near stratus
earnest phoenix
#

?

#

The adapter that goes in the wall?

near stratus
#

huh ?

novel oar
foggy kestrel
wheat mesa
#

Anyone know why my host (temporarily a free heroku dyno) is incredibly slow? I'm getting a response of about 2300ms when posting a simple message to a channel. On my local machine, the process takes only about 60mb of ram. Can heroku just not handle that, or is the connection on their end bad?

rocky hearth
#

what does this error mean

cinder patio
#

function is in strict mode

#

you know, "use strict" this thing

eternal elbow
#

How are these temporary messages made?

near stratus
near stratus
rocky hearth
cinder patio
#

most likely

near stratus
eternal elbow
wheat mesa
#

Anyone here hosted a bot using AWS? I need some help with connecting to an instance. It tells me to run these commands, but I'm on a windows pc, not linux.

cinder patio
eternal elbow
rocky hearth
#

bot.on("ready", function () {
  bot.removeListener("ready", arguments.callee)
})

so this wouldn't work in strict mode. What are other alternatives, other that using bot.once()

paper surge
#

Anyone know anything about the buttons ??

wheat mesa
cinder patio
copper cradle
#

what's the point of that anyway

paper surge
copper cradle
#

you just create a listener and then instantly remove it

#

wouldn't it be better if u didn't create it in the first place?

cinder patio
#

you remove it after the first time it's emitted*

inner fulcrum
copper cradle
#

well yeah but still

#

makes no sense

rocky hearth
#

frees up memory

cinder patio
#

it does if you want to remove it only if a condition is met

paper surge
#

ya lol

cinder patio
#

ok that's not a good reason

copper cradle
#

then don't use it

#

¯_(ツ)_/¯

rocky hearth
#

I want it to listen only once

cinder patio
#

then use .once

pale vessel
wheat mesa
#
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'WaffleBot.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "WaffleBot.pem": bad permissions
myAWSserver: Permission denied (publickey).
#

That's the error I get when attempting to open an ssh client to it

#

It says to run chmod 400 WaffleBot.pem if I need to, but I can't do that without being connected to the server, as I'm running windows not linux

#

Got it to work

#

Followed a yt tutorial on how to do the equivalent on windows using icacl

wheat mesa
#

How do I update node from a linux terminal window? I've tried this so far, but it keeps outputting v10.19.0 whenever I type node --version

#

Also throws this when I try to run my normal startup command

#

I'm gonna assume that's just thrown because of the outdated node version

#

Actually that's a slightly big problem, every npm command throws that error

#

Just tried uninstalling and reinstalling nodejs and npm, still throws that error :/

regal jacinth
#

guys, how do i store a text with emojis in sqlite3 ?

rocky hearth
#

does mee6 uses discord.js?

cinder patio
#

most likely no

rocky hearth
#

then which popular bot uses discord.js?

cinder patio
#

Most popular bots use a custom library

stable eagle
cinder patio
#

Okay wh-

new RegExp("git\+|\.git", "g")

eslint is telling me to remove the \ because they're unnecessary but they are not

nimble kiln
# wheat mesa

You forgot to censor your IP in this screenshot, and the screenshot below.

Regarding that error:
You're require-ing semver somewhere in your script, so I guess do npm install semver in the directory where the package.json is

cinder patio
#

oh nvm

wheat mesa
#

But no, it's not an issue with my code

#

It's likely an issue with NPM itself

nimble kiln
#

No I didnt say it's an issue with your code

#

I'm saying that you require semver in your code but it's not installed as a module

wheat mesa
#

Npm will not run any commands I give it

#

Even just typing npm causes that error

nimble kiln
#

oh alright, what OS are you running on that VPS?

#

And what node version does your script need?

wheat mesa
#

My script needs v14 or above (I believe that's when null-coalescing was introduced into node)

nimble kiln
#

Alright, and which OS? Debian, Ubuntu, etc.?

wheat mesa
#

Ubuntu

#

My current method of installing is running the commands as follows:
sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm

#

However this is my first time ever using Linux, so I'm not entirely sure if that's correct or not

nimble kiln
#

That itself is correct

#

But it may be that your current package repository doesnt have v14 in it

wheat mesa
#

How would I get that to have v14?

nimble kiln
#

If you're fine in copy pasting commands do this:
sudo apt-get remove nodejs && sudo apt-get remove npm && sudo apt-get update && sudo apt-get install nodejs && sudo apt-get install npm

#

Uninstalls both nodejs and npm, updates, and reinstalls

#

After that please go run
node --version and tell me if it works and what it says

wheat mesa
#

Alright, doing that rn

#

Still v10.19.0

nimble kiln
#

alright that means your package repository is just behind

#

Let me get you the commands for v14

restive furnace
nimble kiln
#

First command downloads the v14 package repository URLs and puts it in /etc/apt/sources.list.d/nodesource.list

wheat mesa
#

It's ubuntu 20.something I believe

nimble kiln
wheat mesa
#

20.04.2 LTS

nimble kiln
#

yup I have the same on my server

#

(not an AWS server tho)

shut veldt
#

I see...

nimble kiln
shut veldt
#

So that's how you do it

#

Hmm

nimble kiln
shut veldt
nimble kiln
#

oh

shut veldt
nimble kiln
#

Yeah the (official OS) package repositories are usually behind

shut veldt
#

Ohh

wheat mesa
#

Perfect, node is now on v14.17.2

nimble kiln
#

awesome

shut veldt
nimble kiln
#

Does your script now just work out of the box?

shut veldt
#

Yes

wheat mesa
#

Not yet, still have to figure out how to add in env vars

shut veldt
#

Hmm

wheat mesa
#

Is that something I should just create the file for manually or...

nimble kiln
#

Yes you create the .env file in the directory where your script.js is

#

But you do have to install it first:
npm install dotenv

wheat mesa
#

Yeah, I'll run npm install to get all my dependencies

nimble kiln
#

ah alright so it should be mostly set up

wheat mesa
#

I just found a guide on injecting config vars into aws

#

I'll see what I find there

shut veldt
#

Where did you guys learned this stuffs...I can just develop simple games with coding till now...

wheat mesa
#

Probably easier to just manually create the env file though

nimble kiln
wheat mesa
#

How would I manually create the env file in the terminal?

nimble kiln
#

touch .env creates an empty .env file in your current directory

wheat mesa
#

Or is that not a possibility

nimble kiln
#

You can also use your favorite text editor directly
nano .env
vi .env

wheat mesa
#

damn you AWS, not letting me copy paste my token...

#

I have to type it out manually, ugh

nimble kiln
#

hold up

wheat mesa
#

Wait a minute

nimble kiln
#

Usually SSH client are: Right click to paste

wheat mesa
#

That worked

#

lmao

nimble kiln
#

yeah

wheat mesa
#

Literally right as you typed that

#

I accidentally right clicked

nimble kiln
#

If you highlight something and left click it, that usually is copy

#

depends on the ssh client tbh

wheat mesa
#

I can just exit once I'm done editing the file right, or is there a keybind to save?

nimble kiln
#

Which editor are you using? Nano?

wheat mesa
#

Yeah

nimble kiln
#

nano is:
CTRL+X
Press Y
Press Enter

wheat mesa
#

Thank you

nimble kiln
#

CTRL+X to close the file
Then it asks if you wanna save -> Y
Then it asks if the file name/path is right: Enter

wheat mesa
#

hmmmm... it's decided to tell me that I still need a token...

nimble kiln
#

Go check your script for process.env

#

Did you type the variable correct for the bot token?

wheat mesa
#

The code is all correct, it works perfectly when hosting through VSC

nimble kiln
wheat mesa
#

Should it list the .env when I type ls -a?

nimble kiln
#

yes

waxen bough
wheat mesa
#

Okay, it's there

nimble kiln
wheat mesa
#

Not sure why it's not working

nimble kiln
#

@wheat mesa If you do cat .env does it also show you the content?

wheat mesa
#

Yup

nimble kiln
#

Ok then go check your bot script where it logs in

#

Check that the variable in your .env is the same as in your script, case sensitive

#

or maybe, yeah no check that first

wheat mesa
#
dotenv.config({ path: __dirname + '/.env' });

const prefixes = config.prefixes;

const startup = Date.now();

console.log('Starting bot...');

const commandClient = new CommandClient(process.env.BOT_TOKEN ?? '' // Other stuff after this doesn't matter
nimble kiln
#

ok yeah and I assume you put BOT_TOKEN = 'asdf' in your .env file?

wheat mesa
#

Yes

nimble kiln
#

ok that should work then

nimble kiln
lethal trout
#

err: if anyone joins to any server it is coming in my server smh

const canvas = require('discord-canvas'),
    welcomeCanvas = new canvas.Welcome(),
    leaveCanvas = new canvas.Goodbye()
const Discord = require('discord.js')
const client = require('../index')

client.on('guildMemberAdd', async member => {
client.guilds.cache.forEach(guild => {
        if (!guild || !guild.id) return;

const Schema = require("../models/joinchannel")
 Schema.findOne({ guild: guild.id }, async (err, data) => {
if (!data) return;
                if(!data.channel) return;
    let image = await welcomeCanvas
        .setUsername(member.user.username)
        .setDiscriminator(member.user.discriminator)
        .setMemberCount(member.guild.memberCount)
        .setGuildName(member.guild.name)
        .setAvatar(member.user.displayAvatarURL({
            format: 'png'
        }))
        .setColor("border", 'BLUE')
        .setColor("username-box", 'RED')
        .setColor("discriminator-box", 'GREEN')
        .setColor("message-box", 'BLACK')
        .setColor("title", 'YELLOW')
        .setColor("avatar", 'PINK')
        .setBackground('https://media.discordapp.net/attachments/847794443180048394/863973336035885056/wallpaper.jpg?width=1178&height=662')
        .toAttachment()


    let attachment = new Discord.MessageAttachment(image.toBuffer(), "welcome-image.png");

    client.channels.cache.get(data.channel).send(attachment)
 })
})
})```
wheat mesa
#

could it be something to do with the __dirname?

#

Yes it is

nimble kiln
wheat mesa
nimble kiln
#

Try modifying it to:
dotenv.config();

#

It'll default to .env in current directory

wheat mesa
#

Oh wait...

#

I might be incredibly stupid

nimble kiln
#

Is your script in /src/? 😄

wheat mesa
#

Perhaps 😅

nimble kiln
#

Yeeeah

wheat mesa
#

That would do it!

nimble kiln
#

You could do 2 things

#

either make it go 1 directory back or move the .env file 😉

wheat mesa
#

I'm gonna move the env

#

I really don't feel like pushing an update to the repo then grabbing it and all that stuff

nimble kiln
#

mv .env src

#

mv is also used for renaming, fyi
mv .env hurrdurr renames .env to hurrdurr

wheat mesa
#

Finally, it works!

nimble kiln
#

👌

wheat mesa
#

In your opinion, do you think pm2 or Forever is better for keeping the bot up?

nimble kiln
#

tbh I never used any of those

wheat mesa
#

Does your vps do it automatically?

nimble kiln
#

start.sh

do
        node discord-bot.js
done
wheat mesa
#

Ah

nimble kiln
#

A while loop to start the script when it exits 😄

#

But I started using pm2 on other projects and I really like it

wheat mesa
#

I think I'll use pm2 because I'm lazy and want a module to do the work for me

nimble kiln
#

and you can use pm2 plus (free version) to have a neat-o webinterface to remotely restart your bot (and more)

#

In case you didnt know 🙂

wheat mesa
#

Stupid question, but is there a way to get out of this window without closing the terminal?

nimble kiln
#

how did you start that: node bot.js?

wheat mesa
#

npm start runs node -r ts-node/register/transpile-only ./src/index.ts

nimble kiln
#

alright so it's running in your current SSH session

bitter turret
#

My bot got declined even tho I have a help command. :|

nimble kiln
#

The only way is like Tsukuyomi said is to kill it entirely with CTRL+C

wheat mesa
#

Sounds good

nimble kiln
#

You have to use something like screen, tmux or straight up pm2 for it to run in the background

wheat mesa
#

Yeah, was just testing for the sake of my sanity lol

waxen bough
#

i use screen -S node

#

then i press ctrl + a then ctrl +d

#

when i go back i type screen -x node

nimble kiln
#

He's gonna use pm2

#

But you should write that down Waffle

waxen bough
nimble kiln
#

Screen is a nice tool

wheat mesa
#

When I run sudo npm install -g pm2 does it matter what directory I run it in?

nimble kiln
#

nope it doesnt matter

wheat mesa
#

Alright

nimble kiln
#

cause you install it -globally

bitter turret
#

Waffle

#

I voted ur bot

wheat mesa
#

Thanks!

bitter turret
#

Wc!

wheat mesa
#

Is there a way for pm2 to run npm start, or should I just have it run node -r ts-node/register/transpile-only ./src/index.ts

nimble kiln
#

I dont have much experience in pm2 but I think you can achieve it by using a pm2.json start file

balmy rivet
#

@wheat mesa your bot looks cool

nimble kiln
wheat mesa
wheat mesa
nimble kiln
#

tbh a pm2.json is simpler than your approach

#

But if you wanna do it, make sure that your start.sh is executable after you create it:
chmod +x start.sh

pale vessel
#

Tf

#

I only heard of ecosystem.json or whatever

nimble kiln
#

pm2.json = ecosystem file

wheat mesa
#

Is that allowed?

nimble kiln
pale vessel
#

Why not pm2 start "npm start"

nimble kiln
#

would work

#

But with a ecosystem you can do pm2 stop all and pm2 start all 😄

wheat mesa
#

Okay, the bot is up and running now

#

Let's hope it stays that way lol

nimble kiln
wheat mesa
#

Nope