#development

1 messages · Page 1451 of 1

misty sigil
#

and I cannot be arsed

crimson vapor
#

I want to

earnest phoenix
#

Superiority complex

#

Welp

#

🗿

crimson vapor
#

@opal plank what should I make as my first ts project?

earnest phoenix
#

I use typescript

misty sigil
#

is that why you forked the repo

opal plank
#

its like before you get into classes on js, thats roughly where you guys are at in ts

pure lion
#

Voltex is it work

earnest phoenix
#

Lemme update

opal plank
#

you know types in ts, and some es6 syntax, thats about 20% of what ts can offer, yall missing a shit ton more

pale vessel
#

typeof("yes")
"a" ==("a")

misty sigil
#

Teach us.

pale vessel
#

yes

crimson vapor
#

typeof() looks kinda weird tbh

#

but it works

earnest phoenix
#

Hii

misty sigil
#

It looks very, very weird

crimson vapor
#

yep

misty sigil
earnest phoenix
pure lion
#

If it doesn't work I'm going to jump through a window

#

import()

#

I'm not at my pc rn

honest perch
#

Ok if I go to sleep and when I wake up and its still broken, this is going to be written in js

misty sigil
#

dice let’s break it

pure lion
#

I WILL NOT ALLOW THAT

misty sigil
#

am staying up to 3

crimson vapor
#

ok

misty sigil
#

tryin to fix it

earnest phoenix
#

I'll be staying up until this shit is fixed

misty sigil
#

thanks

earnest phoenix
#

Like bruh

pure lion
#

This is stupid

honest perch
#

Voltrex, what time even is it in iran

pure lion
#

I read the docs for declaring a module, implemented it and it seemed to work

#

Fast forward

earnest phoenix
#

1:56 AM

pure lion
#

Now it doesn't work

honest perch
#

Bruh

earnest phoenix
#

Guys, panik

misty sigil
quartz kindle
#

coding in ts: 10% coding, 90% fighting ts

pure lion
#

Tim Matt wants your help

#

@mattthew#9014

#

Welp

sudden geyser
#

to fight the compiler

pure lion
#

Yes

#

For narniaaaa!!!

sudden geyser
#

or as crabs would know, fighting the borrow checker

opal plank
misty sigil
#

don’t forget waiting for build

crimson vapor
#

am learning ts

sudden geyser
#

defining all the types with x.d.ts looks tedious

quartz kindle
opal plank
#

i rather do the project once and have it be done with rather than maintaining a project for weeks and patch the dozens of bugs as they come

#

a good dev would use testing tools with babel and some other stuff to properly test it, alongside with ts, to properly get rid of bugs

honest perch
#

What even is babel

crimson vapor
#

who doesn't test in prod

#

smh

quartz kindle
#

easy

honest perch
#

If tim says js is good, it must be good

opal plank
#

tis why u code in ts, no bugus

honest perch
#

I dont get how ts will prevent bugs

crimson vapor
#

in ts how can I say a function takes ...variable?

honest perch
#

You can still create bugs in ts

opal plank
#

ts catches errors and bugs pre-compiling

#

you can, yeah

#

of course

#

though the same point goes as to why you use VSC and not notepad.exe

#

why not use a tool thats clearly there to help you catch bugs?

crimson vapor
#

Erwin

#

for typings

opal plank
#

thats a spread operator, what about it?

crimson vapor
#

how would I do it in ts

opal plank
#

just like...that?

#

just define what args is

pale vessel
#

lol

crimson vapor
#

hmmm

opal plank
#

i dont even get what the question is, you are simply defining args

crimson vapor
#

yeah but when I use the function ts gets mad and says "Expected 1 arguments, but got 2"

opal plank
#

just define args, thats it

quartz kindle
#

@opal plank how would you jsdoc a callback

#

i tried the callback tag but didnt work

opal plank
#

i wouldnt xD use jsdocs for that at all

#

best i can think of with jsdocs is set a function with object

earnest phoenix
#

Why would you even use JSDoc for a callback

quartz kindle
#

because why not

earnest phoenix
opal plank
#

@ callback - param 1 - param 2 - extra description

crimson vapor
opal plank
#

thats how i'd do it, i dont even know if you can do a callback and the params

#

wdym what to put there?

#

its UR code

crimson vapor
#

so how would I tell ts the input is strings?

opal plank
#

this is what i meant with making it object like

opal plank
#

thats a function with any param

#

thats vanilla js not ts

quartz kindle
opal plank
#

@quartz kindle ```js
/**

  • @typedef {function(FpsInfo)} fpsCallback
  • @callback fpsCallback
  • @param {FpsInfo} fps Fps info object
    */

/**

  • @typedef {Object} FpsInfo
  • @property {number} fps The calculated frames per second
  • @property {number} jitter The absolute difference since the last calculated fps
  • @property {number} elapsed Milliseconds ellapsed since the last computation
  • @property {number} frames Number of frames since the last computation
  • @property {number} trigger Next computation will happen at this amount of frames
    */

/**

  • FPS Meter - Returns a function that is used to compute the framerate without the overhead of updating the DOM every frame.
  • @param {fpsCallback} callback Callback fired every time the FPS is computed
  • @param {number} [refreshRate=1] Refresh rate which the fps is computed and the callback is fired (0 to compute every frame, not recommended)
  • @returns {function} Returns a function that should be called on every the loop tick
  • @author Victor B - www.vitim.us - github.com/victornpb/fpsMeter
    */
    function createFpsMeter(callback, refreshRate = 1) {
    // ...
    }```
crimson vapor
#

the problem is that I don't know what to put in the function in the typings to tell it that it can accept any amount of arguments

opal plank
#

try declaring the objects first and see if intellisense picks it up from there

opal plank
crimson vapor
#

I don't know what to define it as

opal plank
#

its your code, i dont know what it does dude

crimson vapor
#

the function in js takes ...args, args being a string. I don't know what ts would want that written as

opal plank
#

you're basically saying this

myFunction() 

Guys, help, myFunction is not workin g when i call it

pale vessel
#

is it like ...args: string[]

opal plank
#

is args a string?

pale vessel
#

or what

crimson vapor
#

yes a string

#

wait

opal plank
#

then why are you using a spread operator?

#

you spreading a string?

pale vessel
#

confused

crimson vapor
#

you're right flaze

opal plank
#

do you guys even know what a spread operator does?

pale vessel
#

is string[] valid or is it array<string>

quartz kindle
crimson vapor
#

but not enough

pale vessel
#

[..."abc"] is going to be ["a", "b", "c"]

opal plank
#

hmmmmm, i could 100% help you with ts declaration, jsdocs are super janky to the point im not too familiazed with it, but from the docs it seems to be doing a declaration of the OBJECT, then assinging the function TO the object, hence it pulls the OBJECT(which is a palceholder for tha params) @quartz kindle

pale vessel
#

fixed it

opal plank
#

i dont see why you spreading a string tbh

pale vessel
opal plank
pale vessel
#

oh pog

#

which one would you go for

crimson vapor
#

because I want to be able to say log('a', 'b', 'c') as well as log('a')

pale vessel
#

so it's an array of string

#

then define it like that

opal plank
#

which is what i said, just define with args is

#

if args is an array, use any[]

#

if args is an array of strings, use string[]

#

if its a map, use Map<>

pale vessel
#

any is useful sometimes

opal plank
#

it aint

crimson vapor
#

I used ...args: any[]

opal plank
#

i really dont think you guys would have a valid use case for any in your code

#

its like using vars

#

98% of the times you using it, its wrong

crimson vapor
#

ts gets mad when you say string and give number tho

#

and js doesn't care

opal plank
#

which is the whole point of ts

#

type safety

#

t s

opal plank
quartz kindle
#

im trying xd

opal plank
#

run ts without strict. No typings, nothing, just intellisense

quartz kindle
#

im not doing this for me

#

its for npm

#

people can use whatever they want, i just want the docs to work

opal plank
#

isnt it better to do separate files then?

#

do the jsdocs inside the actual js files and add a typings for it?

quartz kindle
#

i think im done (for now)

#

.d.ts went from 30 lines to 250 lines

#

f me

#

i'll send you the repo once i publish, then feel free to add ads for raid shadow legends

grizzled raven
#

what's this for

opal plank
#

❤️

heavy pebble
#

Need Bot background code?

opal plank
#

enough ads, already got raid shadow legends, not bot background ads now

heavy pebble
#

Support

#

I just want a bot background code.

#

Please support

gilded mirage
#

What the hell are you talking about

heavy pebble
#

Discord bot list background

#

@gilded mirage

gilded mirage
#

That doesn't make any sense what are you trying to accomplish?

opal plank
heavy pebble
#

I know, is there only one example?

opal plank
#

grab the tag and append a css class onto it

#

<style = stuffs here>

heavy pebble
#

Okay

opal plank
#

of course, you add that inside the body

#

theres more info on:

quartz kindle
opal plank
#

wdym?

#

i dont think jsdocs runs with the code, its just intellisense

quartz kindle
#

yeah thats what i mean

opal plank
#

oh, you mean mid way?

#

i dont think so

quartz kindle
#

like for example, i require my class

#

and i hover over the variable

opal plank
#

i think you can only get that pre-compilation, not post

quartz kindle
#

if i do const b = a and hover b, then it doesnt show anything

#

same with every thing that the class methods return

opal plank
#

yeah, i dont think you can inspect that while the code it running

quartz kindle
#

no not running

#

in intellisense

opal plank
#

oh, with ts i think you can, with jsdocs im not sure

#

the method would be the one i sent you before, but that isnt working

#

{function(OBJECTWITHPARAMS)}

quartz kindle
#

i guess i'll leave it for you to test later lmao

sudden geyser
#

It more sounds like intellisense isn't honoring what the type is.

golden condor
#

I think you can declare a type in jsdoc

quartz kindle
#

because for example, my interface jsdoc doesnt show at all

opal plank
#

i can definitvely add it in ts, though jsdocs im not too familiar

#

even though they are fairly similar

quartz kindle
#

i create a typedef in jsdoc, and set it as a return value to a func

#

then i call the func and put the result into a variable

#

hovering that variable should show the jsdoc for the typedef

#

but it doesnt work

opal plank
#

that variable shows as any?/no intellisense

#

let me see

golden condor
#

You'd probably get the typedef in the function's outcome, not in the function

quartz kindle
#

it shows the typings

opal plank
#

wouldnt that be part of @return though?

quartz kindle
#

but not the jsdoc

opal plank
#

hmmmm

quartz kindle
#

the typing is correct

#

but no jsdoc

opal plank
#

thats kinda odd, i havent seen it before

#

actually

#

hold shift/alt

quartz kindle
#

maybe its something that only works in ts

golden condor
#

What's your jsdoc?

opal plank
#

then hober

#

hover*

#

its either shift alt or ctrl

#

i dont remember which

#

ctrl

quartz kindle
#

ctrl shows this

opal plank
golden condor
#

I guess because these aren't function variables, they won't have jsdoc

quartz kindle
#

this is the typedef

opal plank
#

hmmmmm

golden condor
#

Isn't interface only in ts

opal plank
#

it is

quartz kindle
#

its in .d.ts

golden condor
#

o

#

right

opal plank
#

this might eb far fetched but

#

@quartz kindle npm i typescript

golden condor
#

Wait typescript doesn't use jsdoc because you don't put the typings inside the comment

opal plank
#

and then hold ctrl on it

quartz kindle
#

lmao

opal plank
#

just do that and uninstall after

quartz kindle
#

doesnt it need to be global?

opal plank
#

i wanna see if ts even pulls that

#

not really

#

if you wanna install with -g flag its even better

quartz kindle
#

install where then? in the module folder?

opal plank
#

yeah

#

vsc pulls from the local workspace

golden condor
#

You wouldn't put the typings in the comments in the .d.ts file

opal plank
#
  • globals
golden condor
#

That isn't how typescript works

#

Surely

opal plank
#

you wouldnt even make jsdocs in ts

#

set type in params after a colon

#

thats about it

quartz kindle
golden condor
#

You can use them for some things but can't use them for types

opal plank
#

take a look at this

golden condor
crystal wigeon
opal plank
#
test(a:string):boolean;


//is the same as

/**
* @returns boolean
* @param {a} string
*/
test(a) 

but look at how much simpler the ts one is

golden condor
#

Yeah

crimson vapor
#

lol

opal plank
#

you define the type right after the parameter, and the return followed by a colon, doing jsdocs in ts is not ideal

quartz kindle
#

im doing jsdoc for the comments, not the types

#

same as you

opal plank
#

i do both

golden condor
#

Wouldn't you do that in the actual file?

opal plank
#

only in ts

golden condor
#

I mean the jsdoc

opal plank
#

in js you dont have a way to force what type is coming from a function

#

with jsdocs, yeah

#

but that wouldnt be comment

#

thats actual type declaration

#
/**
* @param {string} a extra comments
* @return boolean extra comments
*/
golden condor
#

In auto-generated .d.ts with tsc, the jsdoc always went in the original file and only the typings in the .d.ts

quartz kindle
#

let me show another example

#

this is my typings for Cursor

opal plank
#

yeah tsc is amazing for that

quartz kindle
#

if i write cursor.current() or whatever and hover the function, the comments for that function show up normally

opal plank
#

yeah those on the interface are proper ts comments

quartz kindle
#

but if i hover cursor, the comments for cursor dont

#

thats what im trying to figure out

opal plank
#

which is what i asked you to try tim, try pulling ts and see if it imports them

golden condor
#

Is it because you've labelled an interface as an object

quartz kindle
#

i tried instaling ts globally

#

no difference

opal plank
#

hmm uninstall it then

#

i would've hoped ts would be able to properly import types

#

since it does auto generation on its own too

#

maybe there was some handy tool or something there

golden condor
#

Hold on

opal plank
#

im checking some ts libs

#

but not a single one of them uses anything other than @see and @exa\mple

#

there are some interesting tags i wasnt even aware of though

#

but this is all ts generated

golden condor
#

@‎example

#

That's a weird one with tsc

opal plank
#

i hate that it uses var when transpiling, but whatever, those guys know what they doing

quartz kindle
#

anyway, i'll leave it like this

#

i'll let you try test it later

opal plank
#

i keep telling tim he should write in ts and transpile xD

#

since it auto generates the jsdocs for em

quartz kindle
#

yeah i dont want to write my book in russian then google translate to ensligh

#

lmao

opal plank
#

xD

#

i mean fair

#

you could've asked for help though, i offered you before

quartz kindle
#

every time i ask for help i end up doing everything myself anyway

#

its always like this lmao

opal plank
#

fuck

#

there we go

quartz kindle
#

but its a good learning experience

opal plank
#

tim slowly coming to the ts territory

#

its just a matter of time

#

its like leading children with candy

#

slowly but surely

#

or penny

#

hey, look, a penny

#

hey, look, a penny

quartz kindle
#

goan fek urself

opal plank
#

hey look, another penny

#

but did you see that thing above?

#

the gif, that expansion thing is with ctrl

#

it shows the implementation

golden condor
#

I wish I knew about that

#

Before

opal plank
#

have i shown you the types i made?

golden condor
#

No

halcyon linden
#

Guys

#

How I can get the roles of a user?

opal plank
halcyon linden
#

Is for userinfo command

opal plank
golden condor
#

Lol

halcyon linden
opal plank
#

it what?

halcyon linden
#

I need that

#

sorry

#

not user

opal plank
#

which library u using?

golden condor
#

What lib are you using

halcyon linden
#

discord.js

opal plank
#

member.roles.cache

#

returns a map

golden condor
#

^

opal plank
#

i assume you know maps

#

TECHNICALLY its a DISCORD COLLECTION, but thats just a shitty extension of maps, which i love

halcyon linden
#

xD

#

Thanks a lot

opal plank
#

np

quartz kindle
#

is there any purpose in doing tsc index.d.ts?

halcyon linden
#

:(

#

doesn't work

#

@opal plank

quartz kindle
#

what did you do

halcyon linden
#

get the roles of a member

opal plank
#

wdym didnt work?

#

i asked if you knew what a map was

#

show me how you implemented it

halcyon linden
#

yeah

#

ok

quartz kindle
opal plank
#

lmao i warned ya xD

halcyon linden
opal plank
#

thats not how a map works my dude

halcyon linden
#

I used member.roles.cache.map also and nothing :((((

opal plank
#

do values() first

#

its a map

#

its like, why even bother writing in js, add support for ts, when you can simply do a ts one and compile everything. as far as the user is concerned, they are just importing what they need and getting the intellisense for it @quartz kindle

#

like here for example

#

all doodle code

#

but the user jsut does require('lib-name')

quartz kindle
#

it looks ugly af

opal plank
#

thats all, there shouldnt be much problem with having generated

#

thats the thing, why do you need the user to read internals?

#

they'll get lib usage AND ts + jsdocs support

#

have repo be ts files and npm be compiled code

#

if you really care about readability

#

which is what a couple libs do

#

if you write in ts both ts and js users use
if you write in js, you gotta add support for ts too manually

if you write in ts you simply compile
if you write in js you have to do work

any js syntax is valid ts, so you could just set ts to be in lax mode where it wont screech at code, and turn it on as needed

quartz kindle
#

im gonna be honest

opal plank
#

it just seems counter intuitive to write in js to add support to ts when the other way around is one simple command tsc

quartz kindle
#

i tried ts 3 times now

#

installed it globally, started a project, etc

#

every single time

#

it simply refused to work

#

errors everywhere

opal plank
#

define refused to work

#

cuz tsc is simply transpiling

quartz kindle
#

i dont remember now, but 2000 errors for a file with a couple lines

#

missing definitions for whatever

opal plank
#

when you IMPORT js TO ts, if its in strict, of course it will

#

thats cuz u didnt set it to be lax

#

legit, install typescript again, no kidding

quartz kindle
#

it already is

opal plank
#

okay, make a tsconfig.json

quartz kindle
#

its the same bullshit as webpack all over again

opal plank
#
{
  "compilerOptions": {
    "target": "ESNext",
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "out",
    "strict": false,
    "allowJs": true,
    "esModuleInterop": true
  },
  "include": ["./index.ts"],
  "exclude": ["node_modules", ".vscode"]
}
#

add this

quartz kindle
#

and the source maps bullshit

opal plank
#

not even

#

you just telling ts to ignore strict

quartz kindle
#

alright im gonna try something with this tomorrow

#

it will make a good performance test too

opal plank
#

if you dont want ANY, absolutely ANY check, and run simple js with ts installed and get SOME of the features AS you implement them, add this ontop of your file
//@ts-nocheck

quartz kindle
#

since this lib is micro-optimized

#

i wanna see if the ts compiler can keep the performance

opal plank
#

ts should make it even better, but try it tomorrow

#

just gimme a message, i can give you a hand no problem

#

you've helped me plenty of times before, i wont deny helping ya

tacit sundial
#

Someone familiar with youtube-dl?

crystal wigeon
#

youtube-dl is not good, not recommended

#

i had issues with it

tacit sundial
#

but do you know something about it

crystal wigeon
#

what kinda tho?

tacit sundial
#

Im trying to get each song info

#

because when a playlist contains something bad

#

everything collapses

#
        ytdl = youtube_dl.YoutubeDL(new_opts)
        download1 = await Downloader.video_url(song, ytdl=ytdl, loop=self.bot.loop)
#

this is my code

#

when I pass a playlist url

crystal wigeon
#

you need ytpl

#

there's a seperate package to handle playlist

#

ytdl only downloads a song

tacit sundial
#

the download1 gives a json format with video names

crystal wigeon
#

yeah of the songle vid right?

tacit sundial
#

(<music.Downloader object at 0x0000025EDB393E50>, {'title': 'test 3', 'queue': ['Vicetone vs. Nico Vega - Beast [Monstercat Official Music Video]', 'Domastic & Anna Yvette - Echoes [NCS Release] like that

crystal wigeon
#

or multiple tracks?

tacit sundial
#

it figures it out

#

if its either a playlist or a single video

crystal wigeon
#

but when you use a playlist url does it give you all songs in the playlist?

tacit sundial
#

all song names

crystal wigeon
#

or just one?

tacit sundial
#

in some sort of a list

crystal wigeon
#

hmm

#

i had a hard time with playlists

tacit sundial
#

this is what I get when I print out download1 given a playlist :

#

so basically all of the names

#

in the playlist

#

and when its a single track, it outputs a queue of []

crystal wigeon
#

downloading isn't recommended tho

#

the whole vid unless you want it to for some reason?

#

you're only playing music right?

tacit sundial
#

not really

#

yes

crystal wigeon
#

yeah Lavalink is better

#

i had the same problem

#

i was recommended Lavalink which kinda streams only audio from yt

tacit sundial
#

aha

crystal wigeon
#

erelajs and Lavalink

#

but idk if they support playlist

tacit sundial
#

hmm

#

I will check it out, but for now I'll think about it

sudden path
#

Pussys

rustic nova
drifting wedge
#

i have 2 epoch/unix times, i want to find 2 things

#

how much time is inbetween them

#

like in hours or something

#

just that

solemn latch
#

subtract them, that will give you the time between them in seconds.

drifting wedge
#

i did that

#

how can i convert into hours?

#

it doesnt seem right

#

i have current time - when my bot started

#

to find the total uptime

#

but it gives me a huge ass number

#

which i divided by 3600 and it was still huge af

solemn latch
#

what where the two times?

#

time stamps

#

or how are you getting the times

drifting wedge
#

it really doesnt seem right

#

i got the times from time.time()

#

and bot uptime from pm2

solemn latch
#

pm2 would just give you the uptime, not a epoch time

#

afaik

drifting wedge
#

it gives me when it started

zenith knoll
#

i do msg.guild.members but only get myself in the list. why?

#

py btw

drifting wedge
#

also

solemn latch
#

guild.members is only cached members

drifting wedge
#

the current time is less than uptime

#

im really confused

zenith knoll
#

yes but i made sure they all talked before testing

#

@solemn latch or is there a py way of js fetch

drifting wedge
#

uhh

#

i dont think caching works like that

zenith knoll
#

lol

#

.fetch?

solemn latch
#

yeah, probably

zenith knoll
#

k

solemn latch
#

it would be in docs

zenith knoll
#

ok

gilded olive
#

fetch?

drifting wedge
#

dude brain is dying

gilded olive
#

Depends what you are fetching

#

there is fetch_user

drifting wedge
#

this is wat it says the current time is

#

1607912178

#

and i checked

#

its rn

zenith knoll
#

msg.guild.members.fetch

or await msg.guild.members.fetch()

#

idk

drifting wedge
#

1607821837176 this is the uptime

#

which i checked

#

is correct with when i started the bot

gilded olive
#

you are trying to get all the members of a guild?

zenith knoll
#

yes

drifting wedge
#

so Waddafuck

gilded olive
#

Then you need to iterate over them

#

wait

zenith knoll
#

...

gilded olive
#

This is js nvm

zenith knoll
#

py

#

im using py

#

rn

gilded olive
#

Ohjhh

zenith knoll
#

i usually use js

gilded olive
#

for member in ctx.guild.members:

zenith knoll
#

members = msg.guild.members.cache
print(members)

#

i only get myself

solemn latch
#

one seems to be in ms, the other seconds @drifting wedge

gilded olive
drifting wedge
#

uhh

#

that makes sense

gilded olive
#

If its msg then

zenith knoll
drifting wedge
zenith knoll
#

i need everyone

#

not just cached

drifting wedge
#

im not sure if it like converts is

gilded olive
#

Intents?

drifting wedge
#

it

zenith knoll
drifting wedge
#

but it seems accurate

gilded olive
#

members?

zenith knoll
#

yes

#

all intents on

gilded olive
#

in your code?

zenith knoll
#

and enabled on portal

#

wait a minute

#

im dumb

solemn latch
zenith knoll
#

i forgot py needs intents in client

gilded olive
zenith knoll
#

is it like

drifting wedge
zenith knoll
#

<client>(intents: uh)

#

uh

drifting wedge
#

thanks!

#

uhh i just divide it by 60?

gilded olive
#

intents = discord.Intents.all()

#

where you describe your instance

#

intents=intents

drifting wedge
#

/ 1000*?

gilded olive
#

@zenith knoll there^^

clever vector
#

Hello Developers !

#

Anybody online?

thin tulip
#

Yes

clever vector
#

How do you make this

thin tulip
#

Make what

#

???

fierce ether
#

Hi

clever vector
#

If you are developer, when you do {prefix}help it's will show developer category for you, but if you aren't the developer it doesn't show developer category

thin tulip
#

Ok

fierce ether
#

js or py?

#

if js

clever vector
#

JS

fierce ether
#

if(message.author.id === 'developerid'){

#

use that

#

if your trying to log if there not a developer im guessing?

#

otherwise use return

clever vector
#

Noo i mean in {prefix}help

fierce ether
#

use that in your file

clever vector
#

hmm its gonna hide it right without this thing

fierce ether
#

oh your trying to hide a certain field?

clever vector
#

if (!client.config.owners.includes(message.author.id)) categories = categories.filter(f => !require(./${f}/module.json).hide);

#

Yes i hide dont let anybody see

fierce ether
#

well that checks message author id and checks if its a certain id if true it does what ever you write next

clever vector
#

Can you help me test cmd

fierce ether
#

sure

drifting wedge
#

how do i round a float to nearest tenth?

#

python

wicked sapphire
sudden path
#

Fuck me daddy

wicked sapphire
gilded olive
earnest phoenix
#

@sudden path let not get nsfw and let not get off topic

zenith knoll
gilded olive
#

Are you iterating over them?

#

use try/except

zenith knoll
#

members = msg.guild.members
at = ""
for i in range(len(members)):
at += members[i].mention

my friend wants me to make him a mention all but without @everyone in his bot

gilded olive
#

in 1 message?

zenith knoll
#

yes

gilded olive
#

Or in multiple

zenith knoll
#

one

#

and give out a list of members

gilded olive
#

iterating over them returns a list

zenith knoll
#

yes

gilded olive
#

So you just send that

zenith knoll
#

so uh

#

what am i doin wron

gilded olive
#

I would have to play around with this a little bit

zenith knoll
#

okie

gilded olive
#

Btw you ping all members but not just @everyone

zenith knoll
#

yea

#

idk why he wants it

#

lol

wicked sapphire
#

Because @everyone doesn't work here.

zenith knoll
#

?

#

ik obv

#

no perms or su,

wicked sapphire
#

ofc not

solemn latch
#

just a heads up, you could be breaking discord TOS trying to do this.

zenith knoll
#

oh

wicked sapphire
#

doing what?

zenith knoll
#

ok nvm imma tell him that

#

sorry didnt know

gilded olive
#

that isnt api abuse

#

If they were all in seperate lines

#

He would get rate limited

solemn latch
#

the fetch all members stuff is locked behind a privileged intent, if you want to fetch all members for something you should be going through that.

wicked sapphire
#

Very easily retelimited.

lucid prawn
#

...

gilded olive
zenith knoll
#

ok

#

ok

#

ok

#

ok

gilded olive
#

Idk i gotta read up on TOS

zenith knoll
#

telling him to just write announcements himself

wicked sapphire
gilded olive
#

Mobile

#

Mobile

#

And busy

solemn latch
#

theres also a developer TOS

zenith knoll
#

tf

#

just happened

earnest phoenix
#

dotpost isnt allowed.

zenith knoll
#

o

#

lol

solemn latch
#

dont spam

earnest phoenix
#

@glad charm

zenith knoll
#

ok

glad charm
#

Damn had to mute em

cerulean ingot
#

how do i add an embed to my sites url

main trench
#

Its in the meta tags

#

In the <head></head> tag

#

I forget exactly what its called but Google link embeds

#

That should bring it up

gritty gale
#

pls help

delicate zephyr
#

@glad charm kittyHuggles

glad charm
#

❤️

tribal siren
#

how to split the message content?

#

for example, i am doing <numbers 1 2

#

i'm using message.content.split(" ").slice(1).join(" ") and message.content.split(" ").slice(2).join(" ")

#

i want it to return this:

#
- 1
- 2```
#

But it returns this instead:

#
- 1 2
- 2```
#

how to fix it?

solemn latch
#

you can just use the first one, and use the array it returns

#

const args = message.content.split(" ").slice(1);
args[0]; // number 1
args[1]; // number 2

tribal siren
#

let me try and se

solemn latch
#

oh wait your joining there

#

lol

#

remove the join

#

but yeah

tribal siren
#

oh

#

there should be no join?

solemn latch
#

if you want to use just one of the numbers, no.

#

one of the numbers at a time.

tribal siren
#

ooooooh

glad charm
#

Why would you do that?

#

Assuming you parse out the command.

tribal siren
#

i thought i need to join so that it stops

glad charm
#

You can easily do

// To account for the command in the string
const [command, numOne, numTwo] = message.content.split(' ');

#

I handle commands by breaking up every message by a space and then sending that string array to each function (without the command)

#
const [command, ...args] = message.content.substring(length).match(/\S+/g) || [];
// some code 
clientCommand.run(message, args, client);```
tribal siren
#

oh

#

let me try

glad charm
#

Does that make sense?

#

length is the length of the bots prefix.

tribal siren
#

yes, now it works

#

thanks like

glad charm
#

No problem.

analog imp
#

anyone familiar with oauth2 flows?

analog imp
#

nvm about it, i think i got it down. issue i was looking at wasn't with the flow at all

hollow sedge
sand walrus
#

Hi, i'm new and i can learn yours bot code? I created a bot with simple commands but you suggest me another command can I implement in my bot, please?

earnest phoenix
#

Tbf

#

Learn basic coding first

analog imp
#

^

#

learning bot's code, that could be in any scripting language with supported packages for the discord api but i would start with learning the language first

earnest phoenix
#

Yes

#

Learning the package then the lang itself is confusing

sand walrus
#

@earnest phoenix i learn coding type an axample document.write

analog imp
#

yep, start with the language then the code

#

oh, html?

earnest phoenix
#

HTML's JS

sand walrus
#

Yes🤣

atomic vault
#

my bot is again stoped

analog imp
#

did you get an error?

sand walrus
#

Yesterday i create a bot with a personalize command with embed and admin command (kick & ban)

analog imp
#

i take it it's in js?

glad charm
#

One step at a time.

analog imp
#

there's a lot of resources out there for learning js lucikly :)

sand walrus
#

How can you create a javascipt bot? One file for each command or one js file for all commads?

pale vessel
#

Both is possible

atomic vault
#

what type?

glad charm
analog imp
#

^^^

atomic vault
#

i am using heroku

analog imp
#

if you use discord.js it's helpful to refer to this: https://discord.js.org/#/docs/main/stable/general/welcome

glad charm
atomic vault
#

in it web it is showing
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail

analog imp
#

ohhh, building a modmail bot for your server with heroku?

sand walrus
#

More tutorials use 1 js file for one command and how can i create a stucture folder for doing this?

analog imp
#

oh wait

atomic vault
#

anything in package.json file?

sand walrus
atomic vault
#

anything mystic in package.json file

analog imp
#

if that's what you want to do you can use fs

#

even though it's already included with node.js you still have to call on the module

#
const fs = require('fs');
sand walrus
#

Yes i inlude node.js plugin in js code for starting my bot

analog imp
#

if you aren't familiar with it i'd also check out the documentation for it

solemn jolt
#

Why this code don't plus args[2] +86400000

let time1 = args[2] + 86400000
 let time2 = Date.now() + time1;
message.reply(Date.now(time2))
summer torrent
#

is args[2] string

solemn jolt
#

@summer torrent args[2] is 30

ancient dagger
#
client.on("guildCreate", guild => {
  console.log("joined new guild: " + guild.name);
  if(guild.systemChannel) {
    guild.systemChannel.send("thank you for adding me pls do w!help if you need help")
  }
})
``` this works?
summer torrent
#

@solemn jolt try console.log(typeof args[2])

ancient dagger
#

Ok lmao

#

Read my pfp

crimson vapor
#

Being rude to someone helping you smh

#

Grow up

ancient dagger
earnest phoenix
#

@summer torrent Integer.parseInt(args[2])

crimson vapor
#

Yes

ancient dagger
#

NO

summer torrent
#

what

ancient dagger
#

Lmao

crimson vapor
#

Number(args[2])

ancient dagger
solemn jolt
#

I well try

#

Not work

crimson vapor
solemn jolt
#

i do this

ancient dagger
crimson vapor
ancient dagger
crimson vapor
solemn jolt
#
let time args[2] + 2000;
console.log(time)```
args[2] = 30
In console.log get me
```console.log
302000
ancient dagger
earnest phoenix
#

Math.add(args[2], 86400000)

crimson vapor
solemn jolt
#

@crimson vapor ok

crimson vapor
#

smh so many ways to do simple math

#

add function, parseInt, Number()

ancient dagger
#

@crimson vapor token login?

crimson vapor
#

Huh

ancient dagger
#

Nvm

crimson vapor
#

When your bot joins a guild console log the guild system channel

crimson vapor
#

on event guildCreate console.log(guild.systemChannel)

ancient dagger
solemn jolt
ancient dagger
#

Lmao

crimson vapor
#

Java is System.out.print LOL

earnest phoenix
#

Java is Javascript

#

xd

crimson vapor
#

🗿

ebon dune
ancient dagger
#

Lmao

solemn jolt
#

@crimson vapor i test the code by Number and parseInt but don't work

crimson vapor
#

Is it still appending the two strings?

solemn jolt
#

Yes in console.log get me (302000)

#

Not 2030

atomic vault
crimson vapor
#

I’m 40% sure print works as well

hollow sedge
#

println just prints it on a separate line

atomic vault
obsidian meadow
#

@obsidian meadow

analog imp
analog imp
sand walrus
#

Guys, why i can write in my mobile phone and not with a pc?

solemn jolt
#

@analog imp i well try

analog imp
#

if args[2] = 30, the result should be 2030

solemn jolt
#

Ok

analog imp
#

@solemn jolt yours might be different as far as how you have your args but that will work :)

solemn jolt
#

@analog imp work thank you

analog imp
#

no problem

sand walrus
#

@analog imp I learn the IT language writing code and re-writing for exercise. How to create a video link with image ( MEE6 plugin but more simple)?

analog imp
#

what language are you working in? @sand walrus

#

like what language are you using

#

IT language is a collection of types of languages afaik, might be wrong

earnest phoenix
#
#
#

Pls

wicked sapphire
#

Don't spam

analog imp
#

^

earnest phoenix
#

Sorry but pls can u

wicked sapphire
#

Also you need to tell us what the problem is before we can help

analog imp
#

can you tell us what's happening

earnest phoenix
#

Error on 158 line

sand walrus
#

I learn the js code in Html format but i can learn the js lang. In bot programming?

earnest phoenix
#

And I don’t know where type my token

summer torrent
#

do you know that lang

analog imp
#

start there

wicked sapphire
#

@earnest phoenix by putting out that link, you exposed your bot token.

earnest phoenix
#

What my bot token ain’t in it

#

@wicked sapphire that ain’t mine

wicked sapphire
#

@earnest phoenix at the bottom of one of your files.

#

Still it's dangerous to expose a bot token.

#

Even if not owned by you.

earnest phoenix
#

Screenshot

#

Where

#

So I can replace

summer torrent
#

alf do you know any programming language

earnest phoenix
#

Yea

#

I know python

#

And node.js

#

That all

wicked sapphire
#

@earnest phoenix hint: Bottom of Moderator Bot

summer torrent
#

then why do you ask "where type my token"

terse berry
#

Is it possible to keep the top.gg page bot's logo different than the actual logo of the bot?

#

I mean the pfp that shows on top.gg page

summer torrent
#

try with html/css but why do you want to do that

earnest phoenix
#

@wicked sapphire can u screenshot as I can’t find it and @summer torrent I’m knew to editing on mobile

wicked sapphire
#

@terse berry the PFP there syncs with your bots pfp

terse berry
#

I dont want the bg white color in top.gg page but if I remove that in bot's pfp, it looks bad

summer torrent
#

@earnest phoenix we won't spoonfeed you. Please go learn language first

terse berry
wicked sapphire
#

Also, why would you edit your code on mobile?

earnest phoenix
#

Bc at the moment my bro is studying and revision on it

#

On my pc

analog imp
earnest phoenix
#

It isn’t my token

#

Idk whose it is

pale vessel
#

balls

crystal wigeon
#

do i need nitro to create announcement channel?

solemn jolt
#

no you don't need

crystal wigeon
#

then why doesn't it show me the "announcement" channel thing ;-;

#

i cant create one

summer torrent
#

enable community server first on server settings

crystal wigeon
#

ahh

solemn jolt
#

You need create it by computer

crystal wigeon
#

bruh m on computer, it only shows me text and voice channels

#

ye imma enable community server

summer torrent
solemn jolt
#

Enable it

earnest phoenix
#

What my ID

#

Someone tell me

analog imp
earnest phoenix
#

Do u. Know

analog imp
#

go turn on developer mode in your settings

earnest phoenix
#

I have

analog imp
#

right click your username

#

then copyID

earnest phoenix
#

Just tell me what it says for you

#

I’m not on pc

#

I can’t right click

summer torrent
#

you can do it on mobile

analog imp
#

you can do it on mobile, enable it on your mobile device

earnest phoenix
#

I have

#

It only says copy message I’d

solemn jolt
#
let time = Date.now(1608015143524) 
let Y = time.getFullYear(), 
  M = time.getMonth(), 
  D = time.getDate(),
  H = time.getHours(),
  m = time.getMinutes();
message.channel.send(`this server have prime bot for: ${Y}/${M}/${D} \`${H}:${m}\``) 

Why this code get me error

summer torrent
#

we can't help if you don't show error

analog imp
#

what's your error?

earnest phoenix
#

I found it

solemn jolt
#

@pale vessel ow😂 🔫

#

Thank you

#

Get me this

pale vessel
#

Show code

solemn jolt
#
let time = new Date(1608015143524) 
let Y = time.getFullYear(), 
  M = time.getMonth(), 
  D = time.getDate(),
  H = time.getHours(),
  m = time.getMinutes();
message.channel.send(`this server have prime bot for: ${Y}/${M}/${D} \`${H}:${m}\``) 
#

This code

knotty obsidian
#

How can I catch a ContextException in my unban Command (Java)

#

It is thrown whenever the ban is unknown

#

yet I can't seem to catch it

#

Exception 'net.dv8tion.jda.api.exceptions.ContextException' is never thrown in the corresponding try block

crystal wigeon
#

umm

#

idk why message.crosspost isnt sending message

#
    if (channel.type === "news") {
      console.log("inside")
      return message.crosspost()
        .then(() => console.log("message sent"))
        .catch(err => {
          logger.error(err.stack);
          return;
        });
    }```
#

v12.5.1

lusty quest
#

why 2 returns?

crystal wigeon
#

forgot to remove it

#

ok it says missing access

#

not sure what that means

lusty quest
#

no permissions

crystal wigeon
#

wym

#

for the bot?

#

it has

lusty quest
#

yes

crystal wigeon
#

it has tho

lusty quest
#

apperently not.

crystal wigeon
#

ye the category was overriding it

#

also how do i unfollow?

#

from announcements

lusty quest
#

¯_(ツ)_/¯

zenith terrace
#

Delete the channel and remake it

pale vessel
#

Clone it?

timber fractal
zenith terrace
#

@solemn jolt also what are you trying to do? Get how long a bot has been in a server for?

vale garden
#

hi

#

i have a question

#

in

ctx.channel.purge(limit = 1)
#

is there a way to delete a certain message to that limit

#

if i use the the check attribute it just checks if the latest message is equal to that

#

so how can i delete the message even if it isnt the latest message

timber fractal
#

@vale garden idk but maybe something with args[0] and that the arg have to be a message id?

#

amd then maybe delete it with the message id?

#

idk

#

its just something i think

analog imp
#

that's a code snippet

earnest phoenix
#

Markdown*

#

Actually

#

Code block*

analog imp
#

client.giveawaysManager isn't defined

jovial nexus
#

how can i store a tempban/tempmute in a ddbb?

analog imp
#

when the tempban/tempmute is triggered, you could make a function to send the info to the db

timber fractal
analog imp
#

look at the documentation for that package you downloaded

#

i will look into it for a sec but

#

i don't see giveawaysManager defined anywhere

timber fractal
#

can i fix it with js const giveawasManager = require(`discord-giveaways`)

#

???

analog imp
#
const start = require(`discord-giveaways`)
timber fractal
#

ehmmm

#

ye

#

that was a problem

analog imp
#

you have it declared as start

timber fractal
#

woops

#

thanks

#

and

#

nvm

#

thx

analog imp
#

did you read the documentation for it on github?

timber fractal
#

yep

nocturne narwhal
#

ok

timber fractal
#

Klassien is typing......

analog imp