#development

1 messages · Page 1271 of 1

unique patio
#

Most code can't be licensed if it's generally pulled from a site like stackoverflow where all code is public

#

Simple API/WS

earnest phoenix
#

What license should i get

  • no private use
  • give credit
    Idk what license, too hard to search ig
unique patio
#

would be hard to license or hold as your own when disputed.

opal plank
#

im searching for one rn, i need one of 'no copy unless expressively permitted'

earnest phoenix
#
  • i dont even know how to search for a license
faint prism
#

The GNU GPLv3 also lets people do almost anything they want with your project, except distributing closed source versions.

#

That's all I want tbh

quartz kindle
#

APIs and web services dont count as distributing

unique patio
#

Enjoy

quartz kindle
#

hence you can make apis with gpl libs

opal plank
#

ty cosmos

quartz kindle
#

without sharing source

unique patio
#

NP

opal plank
#

wait what?:

unique patio
#

I default on most projects not adding such license category

opal plank
#

invalid link lul

unique patio
#

oh

#

There

#

I hit an extra-key

opal plank
#

ah there we go

#

thanks

unique patio
#

let me delete the other link 😄

#

So m uch more I assume but wiki got a lot of them

earnest phoenix
#

@unique patio heyo, you have so much knowledge on license

quartz kindle
earnest phoenix
#

You should DMCA yandere sim

unique patio
#

I write nice code people want to take.

#

😦

earnest phoenix
#

@quartz kindle HELL YEAH THANKS

faint prism
opal plank
#

what is copy lefted?

quartz kindle
#

copy left = opposite from copy right

unique patio
#

Makes it free

faint prism
unique patio
#

vs not

#

🙂

#

Opposing affect of copyright

earnest phoenix
#

GNU General Public License v3.0
Is mine now

faint prism
#

yeet

opal plank
#

Hmmm i still need one that is copyrighted without modifications

#

its a private repo, it shouldnt get out of there

#

no distribution /modification

earnest phoenix
#

Does copying script from mee6 count as copyright stRIke

quartz kindle
#

if you want to prevent people from using your code in webservers and other non-distributed applications, you need to use AGPL

earnest phoenix
#

I see

opal plank
#

AGPL?

quartz kindle
#

the lib my api relies on has a licencing fee of about 1k usd

#

but they are gpl v2, so i can use it server side for free

#

because i dont distribute it

unique patio
#

Not leave it blank

#

🙂

#

License: "blank"

#

For private

#

You can put Copyright @ not erwin

#

But yeah nothing major needed if you want to lock it off

quartz kindle
#

AGPL prevents also non-distributed things from being done without a licence agreement

unique patio
#

you permit the rights then

opal plank
#

the only concearn is leaks

unique patio
#

Leaks can happen

opal plank
#

anything on the private repo needs to stay there

unique patio
#

You would just find the source and request it be taken down

earnest phoenix
#

@quartz kindle what api

unique patio
#

You can whois registrars for site hosts/etc

#

and show your initial release.

candid onyx
#

Oof

unique patio
#

EZPZ

#

But applying these licenses at times allow or permit use and that's what we don't want persay

#

ruling is at your discretion.

#

Thus your own copyright/license

#

🙂

#

GG no re

#

Applies for north america/USA

silver lintel
#

how to get user by id djs? message.client.users.fetch(args[0]) isnt working

quartz kindle
#

@earnest phoenix astrologico api

opal plank
#

hmmm i see

earnest phoenix
#

What does it do

unique patio
#

Isn't it users.has("id")

#

?

silver lintel
#

ohh ok

unique patio
#

I haven't touched that part of the discord API fully but they have a "has" function to check fast.

#

Also too cache is used.

quartz kindle
#

@earnest phoenix astronomy/astrology

unique patio
#

So it'd be users.cache?

opal plank
#

users is fetch

#

users.cache is map

quartz kindle
#

planetary positions and coordinates at any given point in time

earnest phoenix
#

I am interested

opal plank
#

idk why u fetching it though, unless you disabled caching

earnest phoenix
#

Give pink

#

Link

unique patio
#

You can reference the ID from received message or on a call to client you initiated.

quartz kindle
unique patio
#

Both require a diff approach

opal plank
#

im pinging the api directly

#

axios with a get request

unique patio
#

They have FeatchUser I think?

opal plank
#

i think you can use client.api.fetch

#

lemme check

unique patio
#

Yeah I haven't used fetch for that ever

#

there's a cache.has

opal plank
#

client.api.users.(id).get

#

i THINK that might work

unique patio
#

.get at the end? nope

opal plank
#

im fairly certain yeah

#

its a method at the end

unique patio
quartz kindle
#

message.client.users.fetch() is the correct way of getting a user in discord.js

#

no need to use the private api methods

opal plank
#

or that

unique patio
#

Yeah that should work

#

but it's cached

opal plank
#

fetch() should get it from api iirc

unique patio
#

few ways to do it.

#

Yup

#

If you require real-time

opal plank
#

users.cache .get() should grab it cached

quartz kindle
#

fetch does both, gets from cache if it exists and fallsback to the api if it doesnt

opal plank
#

oh, even better then

unique patio
#

Oh yeah derp

#

I forgot that with my XHR run throughs

#

If cache exists

#

DERP

#

Generally go for the more direct solid approach for processing in the values, so I am not relying on a nested feature.

#

I*

west agate
#

how do i check if a user sent a channel in a message? like if they sent ,announce #announcements some random text

#

idk if i explained properly

unique patio
#

on('message', func);

opal plank
#

sent a channel?

#

oh

#

that

#

i got a whole bunch of handy regexes there

unique patio
#

There's an emitter event for the discord client that will emit when a message is sent and ready.

quartz kindle
#

you can use message.mentions.channels

opal plank
#

wait really?

unique patio
#

If you're looking to ready discord history then that's done differently, and on ready event.

opal plank
#

mentions has channels?

quartz kindle
#

yes

opal plank
#

ive been regexing that shit this whole time

quartz kindle
#

mentions has all possible mentions lol

opal plank
#

i thought it only resolved on user mentions

#

frick

#

guild mentions when?

quartz kindle
#

it even has built in regexes

unique patio
#

Haha

quartz kindle
unique patio
#

Regex is very powerful don't get that twisted.

opal plank
#

damn thats handy

#

welp, added to TODO list

#

to fix that

unique patio
#

Neat wasn't sure how adv'd the api was

#

Good to know, regex is the true promise land

#

to unhackable.

quartz kindle
#

regex is slow af tho

opal plank
#

^^

unique patio
#

Noooo!

#

If done right

#

it's fast and can't be hacked.

#

Safest way to pass through strings.

quartz kindle
#

"hacked" how

unique patio
#

There's a CTF yearly

#

where the objective is to break through regex checks

west agate
#

what do i do with the regex?

unique patio
#

and it can't be done.

quartz kindle
#

what kind of regex checks

unique patio
#

0% solve-rate atm.

#

Anything
Like:
a-z0-9

pass ` through some how

quartz kindle
#

why tho

unique patio
#

Security

opal plank
#

watch me try to use it properly and accidently break regex on a whole scale. My code is notorious for doing fucked up shit
mmulu

#

ima good dev

quartz kindle
#

nobody uses regex in security tho?

unique patio
#

Good regex use is promising

opal plank
#

if('string'.match(token)) => user.login

unique patio
#

Woah it's used lots 😮

opal plank
#

ezpz

unique patio
#

Regex matching^

opal plank
#

clyde is a great example of dumb shit

#

post your token

quartz kindle
#

i havent seen any example of a situation where regex is actually the better solution

opal plank
#

see what happens

#

thats the only example i can think of regex being used in security

unique patio
#

You rarely see it yes, but it's used at the core of processing machines

opal plank
#

matching leaked tokens

unique patio
#

for sensitive data to categorize it properly.

west agate
#

say the user sends a message like this:

unique patio
#

Server-end

west agate
unique patio
#

Discord would definitely be using regex to turn this message to whatever it needs final conversion. Finding and inserting links.

west agate
#

how would i get #announcements in the message and send the message in that channel

opal plank
#

we said that

#

either regex or use Tim's better solution

unique patio
#

Built in

#

is nice/easier

quartz kindle
#

i still fail to see how regex would be applied there but whatever lul

unique patio
#

You may not use it at all then

opal plank
#

i cant see either, that example is all i can think of tbh

west agate
#

i still fail to see how regex would be applied there but whatever lul
@quartz kindle me too

opal plank
#

sensitive info in chat or something like that

unique patio
#

Okay, so this message could be plain-text; it doesn't know www.google.com is a-href already.

#

It still doesn't

opal plank
#

thats my only use-case, though if you are back end you have access to said token. using any other method is also valid(startsWith for example)

unique patio
#

Why? Regex wasn't detected

#

http/s was missing

#

It's used lots just don't know it.

quartz kindle
#

regex is good for finding instances of a pattern in a string, yes, but nobody types a password in a string for example, no program needs to extract a username or a password from a large string

unique patio
#

no but for password checking

quartz kindle
#

unless you're trying to do something shady

unique patio
#

regex is used to keep you in bounds

#

on a client log-in page if you can't type `; you're not to be typing it error throws back

opal plank
#

i guess its good to escape multiplle chars at once?

unique patio
#

check can be easily made for specific sets.

#

It can do all that

quartz kindle
#

that isnt solved with regex, thats solved with sanitization and prepared statements in a database for example

#

using regex for sanitization is considered bad practice afaik

unique patio
#

You're to decode/encode how you would and strip slashes yes, and that's low-key regex.

#

🙂

opal plank
#

for example, you have a template in your code
Postgres.query('INSERT {args} INTO SOMETHING'); If you provide args as DELETE DATABASE' you might get some shady shit, i guess its better to use regex for that sort of sanitization might not be that bad

unique patio
#

It all goes hand in hand exactly

opal plank
#

thats bad design overall though, but i guess

unique patio
#

🙂

quartz kindle
#

low key maybe, but they probably have many under the hood improvements tailored specifically for these kind of situations when you're processing passwords in a database

#

so they usually advise against using regex yourself

unique patio
#

You want to always confirm input to an extent and you can't do it any other way

#

properly or as fast.

errant perch
#

how do i convert @ mentions to text in discord.js?

opal plank
#

toString()

unique patio
#

You don't want them to mention?

quartz kindle
#

@errant perch when sending or when receiving?

unique patio
#

Don't use the <> around them.

errant perch
#

sending

unique patio
#

<@ example> mentions

opal plank
#

warp it around <@ >

unique patio
#

bot lingo

quartz kindle
#

.send("some mention here", { disableMentions:"all" })

opal plank
#

im confused

#

dont they WANT to mention?

unique patio
#

Oh I like that extra param tim

errant perch
#

yes

unique patio
#

Lol not sure erwin

errant perch
#

i dont want the mention

opal plank
#

OOOH

unique patio
#

Oh so don't wrap it or use that option tim gave

errant perch
#

oh

opal plank
#

i misinterpreted the question

errant perch
#

{ disableMentions:"all" } worked

unique patio
#

I like the paramater approach a lot.

opal plank
#

i thought they HAD a mention and wanted to convert to text

unique patio
#

^

opal plank
#

message.mentions.first().toString()

#

though thats not a valid example

quartz kindle
#

thats why i asked, when sending or when receiving

opal plank
#

you get the point

#

smort

unique patio
#

😄

quartz kindle
#

welp, getting l8

opal plank
#

hmmm i should add a webhook to this test repo tbh

quartz kindle
#

gnight

unique patio
#

Enjoy tim

opal plank
#

gnit tim

unique patio
#

I've been meaning to get my web-hook on; running a cluster atm and can't be bothered to take it offline.

#

Learned recently I can actually change username and avatar of the web-hook

#

my bot tells it what to do?

#

Nice to see discord sets it up very nicely with their API

opal plank
#

im still wondering if i should cluster my twitch bot

unique patio
#

Not till it's stable

opal plank
#

only for testing purposes only(otherwise it'd be data mining)

unique patio
#

You have crash-handle and auto-reboot on connection lost

rocky hearth
#

Is anybody TS expert here?

unique patio
#

so each node can act independently.

opal plank
#

Expert? no, but i use TS a lot Curios

unique patio
#

Teamspeak?

#

Use to be lmfao

opal plank
#

Typescript i assume

unique patio
#

Oh right

#

yeah nope

opal plank
#

i do

unique patio
#

I could probably go as far as understanding it like script.

#

count me out

opal plank
#

lmao

unique patio
#

Honesty best policy lol

opal plank
#

agreed

#

i might end up branching my repo into a master-slave version tbh

#

so i can cluster it

#

maybe IPC to communicated between them

rocky hearth
#

Listen, I've two folders on root directory name, src and dist. Every time to test my commands, I've to compile src code and it produces the js files in dist folder, and then I start the bot to test it. How can I do it more quickly/efficiently??

unique patio
#

This is all you gotta do if you want fast

#
require("./HorizonLookup/server");
require ("./HorizonQueue/server");
opal plank
#

use ts-node/register

unique patio
#

I got like 20 in the list 😄

opal plank
#

or use npx

rocky hearth
#

how to use ts-node

opal plank
unique patio
#

Isn't that package manager stuff/terminal?

opal plank
#

you can use ts-node with node

unique patio
#

Should be a way to launch terminal tasks via batch file.

opal plank
#

node ts-node/register file

unique patio
#

Oh cool

opal plank
#

or you can use npx

unique patio
#

Can you globally use it in a command prompt?

#

If so you could just run executables/batch files to run the process

#

short-cut it.

opal plank
#

yeah

unique patio
#

This is my example

start nodemon --exitcrash server.js
#

nodemon reboots my app if crashes,

opal plank
#

i dislike nodemon

unique patio
#

not sure the lingo you'd need if it was cmd based.

opal plank
#

as it restarts on every change

unique patio
#

Yeah I don't use it.

opal plank
#

i prefer forever for a reboot module

unique patio
#

Oh I like that feature in early develop

#

It's a life-saver and keeps you logging errors

opal plank
#

forever > nodemon imo

unique patio
#

But release, hell naw if you can't get it stable GG

#

what's forever do?

#

I don't necessarily need reboot modules I build them in to the code

opal plank
#

i got 2 instances, a recover and a reboot

unique patio
#

Oh interesting, individually handles them?

#

through a JSON

opal plank
#

on fatal i got a script trying to restart/recover the process, if it doesnt work, it kills it, that trigger forever to restart it with a limit

#

it tries 5 continiously times with at minimum 1 minute uptime. if that fails, it sends me a notification

unique patio
#

That's cool, I didn't know this may exist and wrote a handler for each bot.

#

it's a simple copy/pasta but I can have 1/20 go down and reboot in my cmd.

opal plank
#

theres some really advanced things you can do with those tools

#

nodemon is bad imo since it will reboot if it detects a change

unique patio
#

Yeah I never used it for releases

#

All my bots run just node

#

npm start

opal plank
#

both @earnest phoenix and LeviathanTwitch are running on forever

unique patio
#

Ty for that heads up if I embark

opal plank
unique patio
#

nice

#

I store my data via clouds, it's a bit fancy so I can't have sudden crashes before it unloads.

#

or it reverts to back-up; no recent blobs.

opal plank
#

i backup non static data every 10 minutes, for static i use on the command itself to add it to memory along with the database

#

say prefixes for example

unique patio
#

Design them to run off like 200MB ram and 100 instances per i7

#

Yup

opal plank
#

!add prefix

=> prefix dumped into database
=> prefix added onto memory

// crash

startup => fetch all database prefixes
=> map them all

=> we back up and running with no loss of data

#

thats one example of how i run my things

unique patio
#

nice

#

I need fast as I render as much data as google searches at times

opal plank
#

others for example non static data(metrics, logs, errors) are all backed up every 10 minutes

unique patio
#

So how we render it is with a black-hole method.

opal plank
#

so worst case scenario its a short roll-back

#

you could use redis to cluster all processes tbh

#

as long as master keeps online(make sure it doesnt carash) all other processes will have access to it

unique patio
#

The setup I use uses no hard-drives.

#

or DBs

#

All setups are strictly CPU/RAM machines

opal plank
#

but then you cannot recover data

unique patio
#

All data is memory stored t emporary then shipped off.

#

It's ramdac server

opal plank
#

you could run redis as i said

unique patio
#

I can ship data 5GB/s

#

machine to machine so it doesn't have much let-down

subtle osprey
#

uhm, is there anyone here knows about voiceStateUpdate in discord.js@12.3.1?
i need help

unique patio
#

I get about 0.2% drop-rate on servers from odd reconnects/etc

opal plank
#

i'd do a master-slave method tbh and cluster them even more

indigo burrow
#

I need help rn

subtle osprey
#

bruh

indigo burrow
#

Like rn rn

unique patio
#

Not sure of the voice channel much on js

#

What's up

#

erwin if you wanna see blazing fast, these clouds on their local can transfer a peta-byte in an hour.

#

They use atoms for processes and 1GB each node.

#

LOL

opal plank
#

Main storage/process
local redis backup Local redis backup

                   Master 1                                                                       Master 2

Slave 1 Slave 2 Slave 3 slave 4 slave 5 slave 6

subtle osprey
#

bruh

faint prism
#

master and slave

indigo burrow
#

@unique patio can I dm u for a sec? I wanna ask something related to oauth

faint prism
#

git with the times

opal plank
unique patio
#

Keep it here I get too many PMs

opal plank
#

something like this cosmos

#

as long as master's are online, you dont lose any data

#

the slaves do all the processes like you are running

unique patio
#

Oh I could line something like that up

#

I do have AWS

opal plank
#

but you have a main process to keep a local backup

unique patio
#

handling the RAID

#

when it leaves cloud

#

That process is very slow though

#

My network is at 1.2GB/s right now upload

opal plank
#

instead of one Main/master with 100's pointing into one, doing it the way i showed would make it almost 0 loss on a outtage(except if the whole master cluster fail)

unique patio
#

I can't necessarily feed back a couple GB of data to AWS like that

#

or to any redis

opal plank
#

the redis isnt part of the main process

#

its just local backup

unique patio
#

Nope but the latency to get it there

#

I do use such on a daily interval well similar

opal plank
#

you'd be seinding it to two different sources

unique patio
#

but it takes an hour to complete.

opal plank
#

its not master =>redis => main

#

its master => redis
=> main

#

you only pull from redis on a fail

unique patio
#

Yeah, I hear that there is a backup in place if the drives die

#

(ram drives)

opal plank
#

then there isnt much need to backup the drives with redis as im suggesting

unique patio
#

It's just a long upload process

#

So I store it locally for now the backups

opal plank
#

i mean, fair

unique patio
#

My ISP only gives me so much and can't ping like that

#

rate-limit

#

One bot I'm hosting, not sure whose it is, they're in 6,000 servers

#

and one of them is peaking 600K users abusing the shit out of it.

#

They crashed it several times till this solution came in.

#

Good thing buddy is paying a preem for it.

sudden geyser
#

speaking of master/slave, github is changing the default naming for a lot of stuff, such as master to main

opal plank
#

holdup gotta patch something rq

unique patio
#

They should have done that a while ago

indigo burrow
#

@unique patio so what I am gonna ask is illegal maybe but it is for educational purposes

#

The question is

sudden geyser
#

I'm fine with the name master but I think it causes a lot of inconsistency

indigo burrow
#

When I have access token of someone

sudden geyser
#

atm they say they're developing tools to make it as painless as possible to change it

indigo burrow
#

How can I make them join server using their access token

unique patio
#

Easy.

#

If you can hijack their auth or cookies you can do a lot and these bots can assist lol

#

It's not illegal persay, for teaching purposes.

indigo burrow
#

@unique patio is there any code for that

#

Like coz I have access tokens in bulk

opal plank
#

is there any code to pass university?

indigo burrow
#

I am just left with

#

That part

unique patio
#

That part will rate-limit you

#

Discord will sniff you right out the arse and boot you

#

possibly call the new naws on you

opal plank
#

you cant even

#

try logging in on a different ip see what happens

unique patio
#

so many limits exist that allows but doesn't allow it.

#

if 2-step occurs/etc.

opal plank
#

im fairly certain it checks for ip along with cookies

unique patio
#

Discord will poop on you

#

Uh

#

Depends on how you do it.

#

The cookie calls your session and can retrieve the token to gain accesses

#

That token is your "encrypted" cookie

#

in temp form

indigo burrow
#

@unique patio so there isn't any way I can make people join servers with access tokens?

unique patio
#

With a auth token or their cookies, you can get the token and in you go.

#

IP is checked on join only, and during auth checks.

#

Discord does do huge filtering on the IPs and phone #'s to keep abuse minimal

#

You can do it wraith

indigo burrow
#

Can't or can?

unique patio
#

There's no how-to cause it's simple discord bot stuff

#

Learn basics and it'll be obvious.

opal plank
#

he isnt even talking about bot tokens cosmos

#

its user tokens

unique patio
#

With any cookie, you can send post to the server and get auth

opal plank
#

this is too shady for me to give any advice

unique patio
#

That in exchange can get you the WS addr to connect (gateway perms)

indigo burrow
#

The question is

#

Hbt I give you

unique patio
#

Yeah I know

indigo burrow
#

Access tokens

#

In exchange of

slender thistle
#

Why

indigo burrow
#

U showing it to me pratically

unique patio
#

@opal plank

opal plank
#

Yeah dude, not happening

unique patio
#

I don't need them?

#

I manage millions of users

opal plank
#

You enjoy doing shady stuff on discord

unique patio
#

I could care-less...

opal plank
#

not gonna teach someone how to 'hack' an account

#

nor do i have any interest in it

unique patio
#

Normally I have people feed me wads of cash for these services

#

I still say no 😄

opal plank
#

you should cease that Wraith

slender thistle
#

You just send HTTP requests with the user's bearer token you get from their access token

indigo burrow
#

I just wanna know how to make peesp join servers xddddd coz Many server owners do it for there benefir

slender thistle
#

Why

unique patio
#

Yeah explained that shivaco D:

opal plank
#

you shouldnt be dealing with ANY tokens except yours

#

period

unique patio
#

They need to learn basics

#

And what erwin said

slender thistle
#

I just wanna know how to make peesp join servers xddddd coz Many server owners do it for there benefir
@indigo burrow why

indigo burrow
#

You just send HTTP requests with the user's bearer token you get from their access token
@slender thistle I have I already made half of my thingy thing

#

It's in python

#

I can easily get access token

#

The problem is

#

Of using it

opal plank
#

i can think of 10 different scenarios of what you are trying to do, not a single one of them is for legit purposes

unique patio
#

Let's say hypothetically speaking, I was this hacker, I could help you. What makes you think I won't fuck you over?

opal plank
#

you said 'user tokens'

unique patio
#

🙂

opal plank
#

not bot tokens

unique patio
#

Some vicious cats out there

slender thistle
#

Hi OAuth and guilds.join scope

unique patio
#

Ya'll ever play with catz lol you know.

opal plank
#

'how to make peeps join serveres' requires user tokens, as bots cant join servers without invites. What you are doing is at minimum, SHADY

indigo burrow
#

Told ya

#

I just wanted to learn new thing

#

.-.

slender thistle
#

Ehh

opal plank
#

If you got your hands on other users tokens, i dont wanna have anything to do with it

#

just in case

slender thistle
#

Are you talking about literal user tokens or the ones received with Discord OAuth

indigo burrow
#

@slender thistle discord 0auth

#

Duh

#

Getting real tokens is || Bad ||

slender thistle
#

Hi OAuth and guilds.join scope
I'd suggesting reading more into Discord OAuth2. There might be a few articles on Google

indigo burrow
#

Guild.join scope ah I see

#

But then

#

The questio comes

#

What shall I fing code in python using guilds.join

#

Even without an example

slender thistle
#

I'd say I could help if I ever worked with Discord OAuth

#

😔

indigo burrow
#

Even am new

#

To

#

0auth

#

Gonna yt it now

#

This whole time I was talking about 0auth token

unique patio
#

why would you want to share oauth tokens in return for help?

#

Doesn't add up 😄

slender thistle
#

They're temporary as well so eh

unique patio
#

yeah lol

rocky hearth
#

Hey, Erwin I've set up the ts-node but still my commands are not working

opal plank
#

@rocky hearth you'd have more luck pinging me btw

#

im in way too many servers, you'll likely not get my attention without a mention

#

what exactly are you running?

rocky hearth
#

my commands are working when I compile the src folder and run the bot through dist folder.

opal plank
#

rathen that doing tsc to transpile, use npx to run it in one go

#

make sure you got your tsconfig running as well

rocky hearth
opal plank
#

thats your package

#

not your tsconfig

rocky hearth
#

can ts4 be an issue

opal plank
#

Typescript 4?

rocky hearth
#

yes

opal plank
#

nah, im using ts4 aswell

rocky hearth
#

And I'm using discord commando too

opal plank
#

show me your folder sctructure

#

thats fine

#

its unrelated

rocky hearth
opal plank
#

run this command

rocky hearth
opal plank
#

npx ts-node/register ./src/bot.ts

#

on the terminal

rocky hearth
#

ok

opal plank
#

did you not install npx?

rocky hearth
#

may be not

#

I use yarn

opal plank
#

then install it

rocky hearth
#

I've npm though

#

I did install ts-node -D

opal plank
#

hmmm

#

try node ts-node ./src/bot.ts

rocky hearth
#

MODULE_NOT_FOUND

opal plank
#

then you dont have ts-node installed

rocky hearth
opal plank
#

not sure why u installed the dev one but okay

#

is your terminal on the right folder?

rocky hearth
#

I followed a tutorial

slender thistle
#

dev in package names equals better coder

opal plank
#

as always

#

just disregards the potential bugs in it and non polished content

rocky hearth
#

its targeting my root forlder

opal plank
#

show the whole error

#

i wanna check if its not finding ts-node or my path is wrong

rocky hearth
opal plank
#

move the bot.ts stuff a folder above

#

to the same root as the node modules

rocky hearth
#

ownly-one-typescript is my project folder

opal plank
rocky hearth
#

ok then

opal plank
#

you installing ts-node on Discord.js arent you?

#

not on ownly-one-typescript

#

ooooh

#

i forgot a flag

#

node -r ts-node/register bot.ts

#

though ts-node should find it fine

#

nvm

rocky hearth
#

Hmm, it seems to be working but .env file is not get read I think

#

It is showing INVALID_TOKEN provided

opal plank
#

log it beforehand

#

also

#

json > env

rocky hearth
#

But I also need to host the bot later

#

I tried set NODE_ENV=development&&node -r ts-node/register bot.ts

opal plank
#

just convert it to config and require it

#

solve 90% of your problems

unique patio
#

Depending on how you host it

#

If locally, sure config.json it. If through github; have it handle the platforms system environment

#

variables

#

or other hosts use the system environments they provide for your token.

rocky hearth
unique patio
#

I don't do type-script.

earnest phoenix
#

i use program args for my c# bot it works really well

#

so like dotnet DLL TOKEN

#

and it works

unique patio
#

But if you wanted that in JSON:

{
  "BOT_TOKEN":"KEY HERE",
  "BOT_PREFIX":"!",
  "YOUTUBE_API_KEY": "KEY",
  "OWNER_ID": "ID",
  "SERVER_INVITE_LINK": "",
  "MONGO_URL": "Location"
}
rocky hearth
#

Nah, I didn't wanted that. Erwin just suggested to do so

earnest phoenix
#

really its up to how u do it

unique patio
#

It'd probably be better yes.

#

Yeah few different ways.

earnest phoenix
#

if its a private bot thats closed source u should probally just hard code it

opal plank
#

never hardcode tokens

unique patio
#

100% or use global variables if used multiple times 😄

#

But yeah bad practice if code gets hi-jacked;

earnest phoenix
#

yeah ig

unique patio
#

But if shell hacked, or some you losing it all anyways so

opal plank
#

not if you smart enough

unique patio
#

Eh nah

#

If I run execution on it

#

or SSH it

#

Depends on your protocol/SSL setup/etc.

earnest phoenix
#

if ur at the point where ur pc / host is hacked u should probally be worrying about more sensitive stuff then a bot token that can be regened in a second

unique patio
#

Apache and Nginx are major culprits.

#

when exploits go down with the HTTP

#

Yup

opal plank
#

i can eval my token

unique patio
#

You got it games, DB

#

Just keep encrypted or be able to change the key fast.

#

well stay encrypted

#

T.T

opal plank
#

just swap the key after its been used

unique patio
#

Keep hashing in check.

opal plank
#

after client.login() promise resolves, delete the config entry from memory

earnest phoenix
#

cries in java Dumpster

unique patio
#

😛

rocky hearth
#

Doing "set NODE_ENV=development&&node -r ts-node/register bot.ts" is not setting the env variable NODE_ENV

opal plank
#

aight, imma go code

#

gotta somehow deal with this BS

#

discord member ban/kick is one hell of a bs

unique patio
#

?

opal plank
#

its so inconsistent

#

when you ban someone it can take minutes to recieve the logs

unique patio
#

Odd.

#

I just select user, and run user.ban({reason: "noob"});

#

or kick

#

I run FlagEventHandler to determine people's status in spam

#

A custom class that I set to monitor how many times you message in a second/etc; fun stuff.

#

If the flag.kick > 20 I run the warn

#

if it flag.kick > 50 I kick them 5 minutes, when it goes to 100 it's an auto-ban

opal plank
#

ive got a rough idea of how i'll do it

#

just gonna get some snacks, music and get to coding

unique patio
#

Should be straight forward 😛

#

Hell yeah

opal plank
#

need to grab a couple alts to test it with

unique patio
#

Make a flagging system though that will increase on abuse

#

🙂

#

You'll kill it fast.

opal plank
#

im gonna do it differently

unique patio
#

There's a few cool ways; safelist-method is a nice one too.

#

Well gl! I'm currently botting my bots to crash them/test them.

#

You may like a project like that, BotTesters, make a cluster bot for testing units to enter server and type your requests out and complete tasks with the bot you need testing main-scale.

opal plank
#

ty

unique patio
#

😄

slender zenith
#

Umm hello

#

I have a question

#

Im doing the node . or node main.js

#

And it says Error Cannot Find Module

#

In command prompt

#

How to fix this?

glad charm
#

You need to give more information if you want people to help.

earnest phoenix
#

You need to go into your project folder

slender zenith
#

Done

unique patio
#

npm start at the main folder

earnest phoenix
#

In terminal

unique patio
#

but run an npm init first

slender zenith
#

I did

unique patio
#

to make a package to establish main program

#

🙂

slender zenith
#

Im at the last touch to make my bot online

#

Im using visual studio code

unique patio
#

yup

#

You can hit F5 and run as node.js; if all is right it should run.

slender zenith
#

Ok

unique patio
#

or do an npm start project.js

#

or if you create a package, aka npm init

#

You can tell other services/or your compiler/etc

#

which is main/etc; gives package details(instructions so others know how to run it as well)

slender zenith
#

It tells me to presd ^c

unique patio
#

When you NPM init, you need to set up your stuff

#

confirm it, then save. it creates a new package.json

#

This will forever tell whoever is running the bot it's nodejs and file.js is what you want to run.

slender zenith
#

Oh i already have package.json

unique patio
#

Good, you can just npm start and it should launch its designated js file.

#

or whatever you're working with! 🙂

#

or F5 in studio either or

slender zenith
#

It says sorry name can only contain url friendly characters

unique patio
#

The program is running error may be deeper in

#

?

slender zenith
#

Did i just broke my bot because im following a tutorial and this is the last step to do the node . or node main.js

unique patio
#

Not necessarily

#

When you run it in studio the bot runs, correct?

#

It just returns error?

#

See at which point it returns that error, you can use console.log("I made it here 1") to see where you make it before the error

#

if you're new and get lost. 🙂

slender zenith
#

In visual studio?

unique patio
#

yeah

slender zenith
#

I have console.log already

unique patio
#

The console.log("message"); is a way to report back to console. It's for troubleshooting.

#

You insert them in your code to follow where it's going, values all sorts.

#

So what's y our co nsole outputting?

modest smelt
#

how do i get the position of a certain channel discord.py?

slender zenith
#

I did const Discord = require ('discord.js')

Const client = new Discord.Client ();

Client.once('ready', () => {
});

Then my token

modest smelt
#

how do i get the position of a certain channel discord.py?

unique patio
#

Position in array @modest smelt

modest smelt
#

how?

#

@unique patio

unique patio
#

?

slender zenith
#

My console outputting is ('SwordBot is online!')

unique patio
#

That's okay sword

modest smelt
#

how should i do that

unique patio
#

Not red-text following sword?

slender zenith
#

Umm like orange

#

Wait is it " not '

opal plank
#

why is Client uppercase?

unique patio
#

Oh yeah

#

it is

glad charm
#

Pascal hater

opal plank
#

this wont run

#

client =/= Client

unique patio
#

Your Client.once isn't client

#

Try truning client to Client

#

case-sensitive

slender zenith
#

Oh ok

opal plank
#

snake_case or camelCase

#

actually

#

is it pascal?

#

pascalCase

#

CamelCase

unique patio
#

lol

slender thistle
#

PascalCase

#

camelCase

opal plank
#

camelCase then

unique patio
#

That's only for making reading classes/objects/functions easier

#

in summary

#

doesn't really matter

opal plank
#

im aware

#

i forgot which is which

slender thistle
#

Caps lock everything

unique patio
#

Ahhh I don't reherse the cases

opal plank
#

laughs in SQL

slender zenith
#

Wait is all client needs to be Client?

unique patio
#

Discord = require('discord.js'),
DiscordClient = new Discord.Client(),

#

if you called it like that

opal plank
#

SELECT EVERYTHING WHERE EVERYTHING IS CASE SENSIVITE SORT BY SENSITIVENESS @slender thistle

slender zenith
#

Oh ok

unique patio
#

Then you'd need DiscordClient.on

#

catch my drift?

glad charm
#

SQL isn't case sensitive

opal plank
#

im aware

#

its just optional

unique patio
#

So you defined the const and never used it

opal plank
#

though if you dont run commands in upper case you disgust me

#

spit

glad charm
#

fair

unique patio
#
const Discord = require ('discord.js')

Const Client= new Discord.Client ();

Client.once('ready', () => {
});

Change case to match Client like above @slender zenith

opal plank
#

the other way around is better

#

Uppercase only constructors

unique patio
#

I'd maybe change once to on, you may get many ready's

opal plank
#

client is just variable in this case

#

lowercase the client

#

rather than uppercasing it

unique patio
#

?

opal plank
#

Uppercase for constructors

#

client there is just a variable

#

Discord is the constructor, therefore it should eb uppercase

slender zenith
#

Ok

unique patio
#

If we want to be factual; all caps on Consts.

#

😉

#

for clarity

slender zenith
#

Ok

opal plank
#

just run everything in caps

#

fuck it

#

fuck everything

unique patio
#

Know your cases?

#

lol

glad charm
#

Better start using hungarian notation in js

#

Xd

unique patio
#

lol

white vapor
#

do bots need to be verified to use animated emoji?

opal plank
#
CONST DISCORD = REQUIRE ('DISCORD.JS')

CONST CLIENT= NEW DISCORD.CLIENT ();

CLIENT.ONCE('READY', () => {
});

#

there

#

fuck it all

unique patio
#

Well that'd be wrong

opal plank
#

shhhh

unique patio
#

lol

opal plank
#

no tears, just dreams

unique patio
#

WORK

#

WORK!!!!

slender thistle
#

do bots need to be verified to use animated emoji?
@white vapor no, all bots can use animated emojis

slender zenith
#

I cant run the node . or node main.js code in command prompt

unique patio
#

In command prompt you need to CD

#

to the directory

#

Or run a batch file in the folder

slender zenith
#

cd main.js?

unique patio
#

and short-cut to it.

#

like cd C:/

unique patio
#

to your project

opal plank
#

just upper case everything

unique patio
#

😛 @opal plank

opal plank
#

it'll be fine

slender zenith
#

Soo i make a shortcut to main.js run cd

opal plank
#

you on windows?

slender zenith
#

Yes

unique patio
#

Try this sword

opal plank
#

go to the bot folder

white vapor
#

@white vapor no, all bots can use animated emojis
@slender thistle my bot was unable to, even though I entered the ID, Name, and put the <> symbols

opal plank
#

shift + right click anywhere that isnt selecting a file

unique patio
#

start node server.js

opal plank
#

open powershell window here <=

unique patio
#

in run.bat file

#

in the folder of your script

#

and just make a short-cut to it.

#

GG

slender thistle
#

How exactly did you enter it

slender zenith
#

Ok i close my visual studio rn

unique patio
#

A bat, made in folder will CD right to it.

#

otherwise you can CMD and CD right to your project folder and run it.

#

Many options with node, but if nodejs is not CMD installed it won't work.

opal plank
#

OR

#

gg ez

#

no files, no complication, no nothing

#

simple and easy

slender zenith
#

Thanks! :D

opal plank
unique patio
#

🙂

slender zenith
#

the node still isnt workin in my command prompt im tired after coding for 3 hours 2 hours waiting for visual studio code finish downloading 1 hour coding i need to rest my back is hurting

opal plank
#

wdym 'the node'?

#

did you initialize your project before?

slender zenith
#

node .

opal plank
#

show me your folder strcuture

#

also dont do node.

#

do node file

unique patio
#

Setup is like this generally

opal plank
#

@unique patio not you , you dork

unique patio
#

node_module can be privately added

#

or globally added

modest smelt
#

@slender thistle how can i get the position of a certain channel?

unique patio
#

outside the project folder.

slender zenith
#

I just need to rest thanks for the help everyone

slender thistle
#

channelobject.position

opal plank
modest smelt
#

ok

slender thistle
#

P.S. I have zero fucking idea how that positioning works

unique patio
#

You could keyword indexof in python

opal plank
#

im also fucking with roles position rn, not fun

slender thistle
#

I've tried comprehending whether it's relative to categories or absolute and it made zero sense to me

unique patio
#

not sure how they write that.

slender thistle
#

Oh yeah

modest smelt
#

where is the documentation for that?

slender thistle
#

guild.channels.index(channelobject)

modest smelt
#

link?

slender thistle
#

not sure if it's a good idea

unique patio
#

Perfect

slender thistle
#

link to what

modest smelt
#

the documentation

#

for the channel position

slender thistle
#

search TextChannel class

opal plank
#

ima code the rest of this tomorrow

#

time for gaming

unique patio
#

lol

earnest phoenix
#

owo

opal plank
#

ngl i wanna work on the twitch branch

#

but i havent given enough attention to the discord branch recently

#

so the TODO has been stacking up

unique patio
#

I got a bit of that atm, need to verify ice candidates

opal plank
#

kinda forced to do it

unique patio
#

and broad-cast them to the video section of discord.

#

I've been combining services lol

earnest phoenix
#

does Firebase Cloud Functions NEED Firebase Hosting too or can it work without Hosting (it obviously won't have a website without Hosting)

unique patio
#

huh

earnest phoenix
#

How do i add the custom status to the bot

#

How do i add the custom status to the bot
@earnest phoenix discord.js?

#

yes

#

it's Client#User#setPresence

#

hold up lemme fetch the docs

#

ok

#

Client.user returns a User object

https://discord.js.org/#/docs/main/stable/class/User?scrollto=setPresence this should tell you how to change the status of a user

#

for example

#

where do i put the script?

#

where do i put the script?
@earnest phoenix probably after your bot is online

#

oh so in the ready event

#

changing the status of a user while he's offline is pointless

#

and bots don't retain their status after going down and coming back up again

#

why?

#

because discord is gay

#

lol

#

but can you just give me the full script bc i am not very good at codeing

#

Hey I need help making a nuke command. My current one just clones and deletes, but it moves the channel to the bottom of the category

#

also i want to send a message in the cloned channel

#

hmm

#

i want it to stay in the same position

nimble kiln
#

I dont think anyone will help you with a nuke command because they're most likely abusing API ratelimits/will hit API ratelimits

earnest phoenix
#

yep

#

what does that mean

#

i mean nuking a channel

nimble kiln
#

Have you heard of ratelimits?

earnest phoenix
#

no

nimble kiln
#

You can only do X actions per Y seconds

earnest phoenix
#

idk

#

then how come many bots have it

#

like better antispam

#

which nukes channels

nimble kiln
#

they probably use the clone functionality

#

Or I understand your feature wrong, what exactly do you want to do with your nuke command again

earnest phoenix
#

but can you just give me the full script bc i am not very good at codeing
@earnest phoenix that's spoonfeeding we won't just give you code else you're pretty much useless and we're the guys who are doing your stuff

#

also it's against rules to spoonfeed

#

delete your post pls

#

i meant reddit lmfao

#

oh lol

rocky hearth
#

Does someone about this error

supple oriole
#

How do I add my server count to top.gg website

earnest phoenix
#

How do I add my server count to top.gg website
@supple oriole #topgg-api there should be someone who can help (idk dblapi tbh)

supple oriole
#

;/

slender thistle
silent cloud
#

Yoooo

#

Thats me again lol

#

const args = message.content.slice(matchedPrefix.length).trim().split(/ +/); const commandName = args.shift().toLowerCase();

#

Why in toLowerCase have error?

unique patio
#

You're trying to run function on undefined.

earnest phoenix
#

If it's python isn't it just .lower()

unique patio
#

if matched prefix is the index

silent cloud
#

If it's python isn't it just .lower()
@earnest phoenix js

unique patio
#

Try splice(indexval, 1)

earnest phoenix
#

Unless I'm dumb which is very possible

#

ah yes that's probs why then lmao

supple oriole
silent cloud
#

K

unique patio
#

Yeah the reason it's not working is somewhere with your values it's undefined.

slender thistle
#

If it's python isn't it just .lower()
Correct, but I can't see Python around here

unique patio
#

@silent cloud so try so you can learn, to run console.log on all the values there so console.log(args);

#

right below defining it, see if it's there 🙂

#

Then piece by piece it find your issue. May be your matchedprefix returning blank.

#
const string = "will work!!!";
console.log(string.toUpperCase());
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
console.log(args);
    const commandName = args.shift().toLowerCase();
console.log(commandName);


#

Try playing with it like that. GL

silent cloud
#

Yo

#

How i can connect commands folder with code?

#

Idk rly

earnest phoenix
#

@silent cloud what do you mean exactly?

silent cloud
#

I have bot.js file with code

#

And folder commands

#

With all commands

earnest phoenix
#

import all scripts from the command folder into the bot.js code?

silent cloud
#

Ye

#

Rip

patent geyser
#

vs code has given me this error and have no idea how to fix it, I thought it would be the update, but once I updated it, it gave me the same error.

earnest phoenix
#

vs code has given me this error and have no idea how to fix it, I thought it would be the update, but once I updated it, it gave me the same error.
@patent geyser does node.js and/or VSC have firewall blocking against connecting to the internet?

#

check your firewall settings

patent geyser
#

okay

#

I've never had this problem before

astral yoke
#

dumb question

#

how come in my message.js event right

#

i have let afk = await bot.db.fetch(`afk_${message.guild.id}_${message.author.id}`)

#

how come it cant (node:6348) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null

patent geyser
#

does node.js and/or VSC have firewall blocking against connecting to the internet?
@earnest phoenix ahh, firewall blocked the connection ty

earnest phoenix
#

@astral yoke since it's a promise rejection it's probably that the message got deleted so d.js can't fetch the guild and the author

silent cloud
#

So

#

How to import all scripts from the command folder into the bot.js code?

astral yoke
#

how would i work around that?

earnest phoenix
#

how would i work around that?
@astral yoke not delete the message ig?

astral yoke
#

i never did

#

it just randomly happened

earnest phoenix
#

it says guild is null

#

author can't be the one causing the problem (yet) because it comes after message.guild

astral yoke
#

i just did a message and deleted it and it didnt error

earnest phoenix
#

try JSON.stringify(message) then console.log() it