#development

1 messages · Page 1495 of 1

halcyon kite
#

did not notice that tbh

#

im blind

opal plank
#

why even chain that promise?

#

i assume your command handler is type void @halcyon kite

#

actually, i just noticed, there ISNT a command handler

#

still, why return it?

#

just await the message and run the rest of the code

earnest phoenix
#

Hey

snow tendon
#

How do I test vote my bot?

#

To test the on_vote event thing

pale vessel
snow tendon
#

Where do I find that?

pale vessel
#

https://top.gg/bot/id/webhooks

snow tendon
#

K

#

Thanks!

lament cradle
#

uh, sorry, it didn't work. I've asked on another server

drifting wedge
#

@coral trellis do you plan on adding more to the shirogg api?

coral trellis
#

Yeah

drifting wedge
#

Alr

#

Cool stuff

coral trellis
#

I am open to suggestions

drifting wedge
#

Uhh

#

I recommend don't do anything other apis already have

#

Cuz it's a waste of time really

coral trellis
#

I mean what I am doing is just making a safer api for people to use

drifting wedge
#

Maybe do a rank card maker

coral trellis
#

But I'll probably add some reddit stuff in there as well

#

A rank card maker?

drifting wedge
#

Like don't do same stuff as ksoft or dank memer I think

#

Mhm

#

Like u put info

#

And it returns the card

coral trellis
#

Hmm maybe

drifting wedge
#

It's unique basically

coral trellis
#

Yeah

gilded olive
#

Loggers

drifting wedge
#

Uh... maybe make a Twitter fake message thing

#

Or a pfp thing like the wallpaper one u have

#

@coral trellis

coral trellis
#

Yeah

gilded olive
#

nekobots API does that

#

The tweet thingy

solemn latch
#

oh that sounds like a homework problem

slender lion
#

how to i setting a voting system like someone voted my bot then my boy sending a message in the dm "Thanks for vote me!"

outer niche
earnest phoenix
#

What more features should i add to bot? Any suggestions?

tribal siren
#

what's your bot

earnest phoenix
#

Moderation

tribal siren
#

do tempban

earnest phoenix
#

just get snipe command

earnest phoenix
#

so when someone deletes a message

#

you could just to (prefix)snipe

#

and then they can see what message they deleted

#

isnt it a privacy issue?

#

well.

#

it depends

cinder patio
#

no

#

Bots which log every single deleted message are allowed

lusty quest
#

it just depends on how you are able to retrive them.

earnest phoenix
#

can anyone tell or give souce code example of how patemoji works?

#

Vx_patemoji

rustic nova
#

There's an api that allows you to make that, look up petpet

cinder patio
#

what's that?

#

aah pat emoji

rustic nova
#

this thing is what they're referring to

earnest phoenix
#

👍

earnest phoenix
#
node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.5.0/canvas-v2.5.0-node-v83-win32-unknown-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for canvas@2.5.0 and node@14.15.1 (node-v83 ABI, unknown) (falling back to source compile with node-gyp)``` why this err? While installing npm canvas package
ivory seal
#

message.channel.messages.fetch() is there something like this forf the entire guild

humble rock
#

Can you recommend a free host (except heroku) for my bot?

lusty quest
#

there are none to recomend. if you have a credit card, look into the 1 free year Google and AWS offer

humble rock
#

there's discloud.com... i had host my bot but has a problem with ytdl-core

lusty quest
earnest phoenix
lusty quest
lusty quest
earnest phoenix
#

okkk

lusty quest
earnest phoenix
#

Its asking to download additional Dependencies

earnest phoenix
lusty quest
#

yea it requires Build tools did you have them installed?

earnest phoenix
#

I am skipping canvas.

opal plank
#

fuck canvas

#

that shit slow as hell

#

more leaning towards learning rust and doing image manipulation/generation myself

silver lintel
#

How can i generate a random color

lusty quest
#

js?

silver lintel
#

yes

#

random hex color

#

In js-

rustic nova
#

Referring to embeds or just random hex color?

eternal osprey
delicate shore
#

Hey guys

eternal osprey
delicate shore
#

I wanna get image sent by user

eternal osprey
#

how do i stop the bat file from running the file?

delicate shore
#

But it has to be - must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number},

terse swallow
#

Hello !

lusty quest
delicate shore
#

It just gives URL

#

Not a buffer

eternal osprey
# eternal osprey

this bat file is making the bot run 24/7, but i realised i want to use pm2 instead. How would i stop the bat file?

#

like should i just remove it?

#

from the file

lusty quest
delicate shore
lusty quest
delicate shore
#

message.attachments

quartz kindle
rustic nova
#

Do you want to autorestart it when you stop it?

delicate shore
eternal osprey
delicate shore
#

But now I need to figure out How i get the URL

eternal osprey
#

as it was running against some issues.

#

so i thought a quick restart should be good as it is running for months nonstop.

rustic nova
#

use pause then before the GOTO BOT and after the timeout

#

This should wait for a key press

#

after the keypress, it should start it again

eternal osprey
near stratus
#

@delicate shore

module.exports = async message => {
    if (message.attachments.size > 0) {
        message.attachments.forEach(Attachment => {
            console.log(`Attachment sent by ${message.author.tag} >> Url: ${Attachment.url}`)
        })
    } else {
        console.log(`\nCHATLOGS - [${message.guild}] ${message.author.tag}: ${message.content}`);
    }
};

This is from StackOverFlow

eternal osprey
#

would that be able to handle the bat file?

quartz kindle
#

linux doesnt support bat files lol

rustic nova
#

A vps can't handle a bat file, you'd need to make 2 seperate versions of that

#

a sh file and your current one

eternal osprey
#

i am

rustic nova
#

if you're working with deploying your bot onto your vps through sftp/ftp for example

#

You can start the sh on your vps then

#

Your bat cannot be run on a linux vps

eternal osprey
#

could you tell me the commands to start/stop the sh file?

rustic nova
#

Can't really help you with that

terse swallow
#

how to do as soon as a command is executed (example:! commands) the command message is deleted and it executes the command?

eternal osprey
rustic nova
#

you can also use ./start-CoordsBot.sh to make it easier

eternal osprey
#

after running my command.

rustic nova
rustic nova
terse swallow
#

thanks

rustic nova
#

also, just pasting your bat's content inside it doesn't work

quartz kindle
#

linux shell scripts and windows batch files are two completely different languages

rustic nova
#

exactly

vale garden
#

hi

#

does anyone here know how to use guilds.join

#

i tried using it

#

but

#

i have no idea how to

#

lmao

eternal osprey
#

the sh:

vale garden
#
@staticmethod
  def user_join(access_token):

    url = Oauth.discord_api_url + "/guilds/768019392596017164/members/446670262440820746"

    headers = {
      "Authorization": "Bearer {}" .format(access_token)
    }

    user_object = requests.get(url = url, headers = headers)
    user_json = user_object.json()

    return user_json
#

i thought a function like this

#

would work

#

and i would be able to join the user to a server

#

but it doesnt work

#

im really dumb plz help me aa

eternal osprey
rustic nova
#

make sure you're in the same directory as the sh file

ivory seal
#
const logs = db.get(`${user.id}_modlogs`);
   var string = ""
 
   for(i in logs){
       var string2 = `**Case ${logs[i].casenumber}**\n**Type:**${logs[i].type}`
       string.concat(string2)
       console.log(string)
       console.log(logs[0].casenumber)
   }```
and logs is something like
```{
  casenumber: 4,
  userid: '789380389687918622',
  usertag: 'Jet#7073',
  reasons: 'bad',
  moderator: 'Sahhas#0003',
  date: 1609671262454,
  type: 'Warn'
}```
rustic nova
#

also, you do not have a stop-coordsbot file

ivory seal
#

can someone help me withthat?

eternal osprey
vale garden
#

can anyone helpp

rustic nova
#

that is not how these files work

eternal osprey
delicate shore
#
(node:7766) UnhandledPromiseRejectionWarning: Error: pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was Image```
cinder patio
delicate shore
#

How can I change image into one of this thing

vale garden
#

hi

#

can anyone help me out

delicate shore
eternal osprey
#

otherwise i have 2 instances running the bot.

#

could i just stop the process by simply removing the sh file?

cinder patio
#

Did you make the sh file run on startup?

eternal osprey
vale garden
#

asked my question..

#

but no one responded

cinder patio
#

try deleting the files and restarting your vps

eternal osprey
opal plank
vale garden
#

yo does anyone know anything about the guilds.join scope here?

eternal osprey
#

Never really worked with sh files.

opal plank
#

wait what?

#

why u using sh files?

eternal osprey
#

this was just done by a friend of me that moved out.

#

i want to use pm2

#

so i could delete the sh files right?

#

and that would terminate the process?

opal plank
#

you should 100% use pm2 dude

eternal osprey
#

So i can use pm2.

opal plank
#

i dont think they would

#

sh files are just scripts

#

aka its like someone running node index.js from a terminal

#

killing the terminal doesnt kill the process

eternal osprey
#

hmm okay.

opal plank
#

you need a process explorer and send a SIGKILL

#

htop can do it, but idk if you have it

#

also check this

eternal osprey
#

i already now how to use pm2

#

have been using it a lot.

eternal osprey
opal plank
#

dunno, check if its already there

#

its ur vps

cinder patio
#

um just deleting the files and restarting your vps should do it

opal plank
#

you need to see what stuff you got running there

#

what distro, what version, what are the compatible packages

eternal osprey
opal plank
#

of course

eternal osprey
#

i have many bots running on my vps.

opal plank
#

restarting would kill all of them

eternal osprey
#

sheesh lets not do that

cinder patio
#

well you have to stop them anyway in order to transition to pm2

delicate shore
#

ok so I need help

#

I made an image

opal plank
#

probably best to get np2 ready to be deployed BEFORE killing all ur bots

delicate shore
#

using canvas

#

But my module asks me for a - Error: pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was Image

#

How can I transfer one to any of these

quartz kindle
#

show code

opal plank
#

show bebs

quartz kindle
#

show vegana

opal plank
#

u first

delicate shore
#

ok

eternal osprey
delicate shore
#
    if(msg.attachments.size > 0){
        msg.attachments.forEach(async(Attachment) => {
      
    let lol = await canvas.loadImage(Attachment.url)
    model.classify(lol).then(function (predictions) {
        console.log('Predictions: ', predictions)
      })
        })
    }```
#

Here

opal plank
#

i told you what to do

quartz kindle
#

what is model.classify?

delicate shore
#

It's an module to check for nsfw

quartz kindle
#

whats its name on npm?

delicate shore
#
    let model = await nsfwjs.load()
#

nsfwjs

quartz kindle
#

you likely need to create the canvas

delicate shore
#

How tho

#

wait so

#

I need to

quartz kindle
#

canvas = new Canvas()
context = canvas.getContext("2d")
context.drawImage(Image)
data = canvas.getImageData()

delicate shore
#

But I need to make it into a web page??

quartz kindle
#

no, node-canvas supports all of that

delicate shore
#

Oh

#

Alr

quartz kindle
#

but if all you're doing is feeding the image to tensorflow, try giving it a buffer directly

delicate shore
#

Ok

quartz kindle
#

model.cassify(await fetch(Attachment.url).then(data => data.Buffer()))

#

or however fetch works

delicate shore
#

Oh alright

earnest phoenix
#

I know uh I asked this before but I can’t remember

#

This footer which line should I add it so I can use it?

delicate shore
#

So like

#
const {Canvas} = require('canvas')
const { data } = require('@tensorflow/tfjs')
const Client = new Discord.Client()
canvas = new Canvas()
context = canvas.getContext("2d")
earnest phoenix
#

@delicate shore do u know html or css

delicate shore
#

Kind of

earnest phoenix
#

Anyone help me..

rustic nova
#

not sure though lol

#

wait lemme check docs

earnest phoenix
#

Lemme try

#

@delicate shore can u give the code for a registresion and login page and then goes to a blank page?mmulu

willow mirage
#
message.channel.send('Please supply the channels that Talky can access to.');
            const filter = msg => msg.member.id == message.member.id;
            const collected = await message.channel.awaitMessages(filter, { max: 1, errors: ['time']  })
            const result = collected.first().content;
            // IT STOP FUCKING HERE, I DUNNO WHY <-----------------------
            const ids = await require('../../tools/string/mentions')(result.split(" ").split(",").split("-"))
            if(!ids) return message.channel.send("Bruh");
            for (let id of ids) {
                console.log(id)
                const channel = message.guild.channels.cache.get(id);
                if (!channel) return message.channel.send("There are some channel that I can't access, please look again.");
                if (!channel.permissionsFor(message.guild.me).has("SEND_MESSAGES")) {
                    return require("../../tools/embeds/missingPerms")(`I don't have permission to send messages in a channel has name ${channel.name}`)
                }
                guildCache.channel.push({ _id: id });
            }

Why my code stop for no reason

rustic nova
# earnest phoenix <@587663056046391302> can u give the code for a registresion and login page and ...
delicate shore
earnest phoenix
#

Poor

#

Ass

rustic nova
earnest phoenix
#

O/

earnest phoenix
willow mirage
#

@rustic nova i did

earnest phoenix
#

that wont go well

delicate shore
#

oh

willow mirage
#

it stop at the line that i made comment

earnest phoenix
#

@rustic nova didn’t work

rustic nova
delicate shore
#

How to get buffer of image sent by user

rustic nova
earnest phoenix
#

Which topic is it? @rustic nova

rustic nova
#

make sure the file is there

earnest phoenix
willow mirage
#

hmm let me see

distant bramble
willow mirage
#

Ah i know why

#

i did

.split().split()

But i can't split arrays

#

xD

earnest phoenix
#

Someone help I cannot understand it’s showing no error and not working I

#

In the same time

#

it quite literally tells you what and where the error is

#

Don’t see it where?

#

look at the big dark blue box

#

I don’t really see any errors

#

lol

#

Just tell me..

#

@earnest phoenix where’s the error?

#

I am looking I can’t see it

#

It’s red if it’s an error...

#

seems like a you problem

#

lmfao

#

yikes

#

Can you just tell me the problem?

#

no

#

:/

#

learn the difference between syntax errors and runtime errors

#

I came here for help not a fight

#

what

#

Just tell me where the error is

#

in the big dark blue box

#

I repeat I can’t see the problem

earnest phoenix
#

an error doesn't have to be exclusively a syntax error and underlined in red

delicate shore
#

Ok

earnest phoenix
#

Why are you acting so hard? Just tell the damn problem

delicate shore
#

but

#

that was what I was asking

earnest phoenix
#

oh, you using djs?

pale vessel
#

dee jay ass

delicate shore
earnest phoenix
delicate shore
#

kk thanks

earnest phoenix
#

Someone help.

#

Please help

rustic nova
earnest phoenix
#

I CANNOT FIND THE ISSUE PLEASE

summer torrent
#

look at top of dark box

earnest phoenix
#

OHH Line 27?

#

@summer torrent

summer torrent
#

yes

earnest phoenix
#

Do I remove it?

#

Or the comma

#

My bad do I just remove it?

summer torrent
#

what is error's message

#

scroll in that dark box

earnest phoenix
#

@summer torrent it shows no error that’s why I’m confused

regal creek
#

Hm

#

.footer is not a function.

earnest phoenix
#

Then what should it be? @regal creek

#

“Footer”:

#

?

regal creek
#

Yes lol but not a capital F

earnest phoenix
#

just remove the .footer call from the json

rustic nova
earnest phoenix
#

and add a footer property

terse swallow
earnest phoenix
#

"footer": shit

#

oooh

sacred aurora
#

how can i get total user from all server that my bot in?

earnest phoenix
#

.setfooter("nejsjsjs")

#

but add it outside of fields @earnest phoenix

#

Ok

#

except you can't call setfooter because you're passing a raw object

#

like on the same level where you defined the title

sacred aurora
#
client.users.cache.size
```?
regal creek
#

message.reply is ugly

terse swallow
#

if you want to create an embed look at its

earnest phoenix
#

k

terse swallow
pale vessel
earnest phoenix
#

Till not working

sacred aurora
#

hmm

earnest phoenix
regal creek
sacred aurora
#

is there any other way then

earnest phoenix
regal creek
sacred aurora
#

:v

earnest phoenix
#

You guys said outside footer...

#

I mean field

regal creek
sacred aurora
#

why not using messageembed from discord.js

terse swallow
#

how to create your self role?

regal creek
#

Read it for the love pf god

opal plank
#

dont use that garbage

sacred aurora
#

hmmmm

regal creek
terse swallow
pale vessel
#

You can combine all your guild's memberCount client.guilds.cache.reduce((x, y) => x + y.memberCount, 0);

regal creek
#

Indeed

earnest phoenix
#

BRUH

sacred aurora
#

welp

opal plank
#

from 15ms to 250ms using messageembed

sacred aurora
#

thanks for letting me know :V

regal creek
#

Pffft

let members = 0;

client.guilds.cache.forEach(v => members = members + v.memberCount)

Best code 2020

pale vessel
#

thank god you used that code

sacred aurora
#

but dunno if its accurate

earnest phoenix
#

@opal plank hey you like typescript right

opal plank
#

hate*

earnest phoenix
#

ytho

#

ts is good

opal plank
#

i was being sarcastic

#

but go ahead

earnest phoenix
#

ok why tf does it turn my async await code to this bullshit

opal plank
#

cuz your target version is wrong

#

you compiling to es5

pale vessel
opal plank
#

pick your target to es6+ where async is natively supported

pale vessel
#

what's esnext

#

is it an actual version

opal plank
#

latest es version

#

es2020

earnest phoenix
#

@opal plank i set target to es2020 in tsconfig.json

#

yet it still does that

opal plank
#

your async looks fucked cuz ts is LEGIT ADDING async to your code since its not supported

earnest phoenix
opal plank
#

@earnest phoenix do this then

#

tsc --target "ES6"

#

im assuming its not picking up your tsconfig automatically

#

@earnest phoenix since theres no response i assume it worked fine?

earnest phoenix
#

not tested yet

#

did it on a local vsc project on mah pc

#

me on phone rn

#

and imma head out play minecrafr

pulsar bone
#

what is the keyword for
except unknown message error:

#

@opal plank

opal plank
#

@pulsar bone yes?

pulsar bone
opal plank
#

what are you even trying to do?

pulsar bone
#

try:
statement
except discord.errors.{unknow message error keyword that I don't know}:

opal plank
#

thats py

#

not js

pulsar bone
earnest phoenix
#

Uh help

opal plank
#

bold of you to assume i know py enough to give advice on it, specially since we were talking about ts/js above

lusty quest
#

i still cant understand why people dont use dynamic generated Help commands, they are set and forget, you make them once and have to never touch them again.

earnest phoenix
#

@earnest phoenix what does the first paragraph on discordjs.guide say

earnest phoenix
#

learn javascript before trying to make a bot

pulsar bone
opal plank
#

then why u pinged me if you didnt know i know python?

earnest phoenix
#

because erwin is proficient in js/ts, you started being passive aggressive when erwin said that's python lol

pulsar bone
opal plank
#

again, why ping random users?

earnest phoenix
#

@opal plank u could literally ignore them if you're unable to help...

opal plank
earnest phoenix
#

me and the bois mobile push notifications: off

opal plank
#

me and the bois desktop

earnest phoenix
#

me and the bois desktop client is useless

earnest phoenix
opal plank
earnest phoenix
#

"it's your fault for being murdered, you were standing right in front of the murderer!!"

opal plank
#

its still on chanenl topic to not ping random users for just being impatient

earnest phoenix
#

i ignore every single ping from creators hub im only there for giveaways

opal plank
#

regardless of all that

#

well you're free to ignore whomever you want, i got pinged, i answered, end of story

earnest phoenix
tribal siren
#

offtopic

#

so

#

what is wrong in message.channel.rateLimitPerUser?

opal plank
tribal siren
#

how to get channel's slowmode then?

quartz kindle
opal plank
#

say what now?

tribal siren
opal plank
quartz kindle
#

you need to cast it to TextChannel

opal plank
#

oh, lets see

tribal siren
#

oh

#

let's test it

opal plank
#

oh yeah, it sure does

#

interesting

#

now why the heck is it not auto detecting its a TextChannel

#

cuz it should

tribal siren
#

ye i agree

quartz kindle
#

djs's typings are fucked up

#

there's a lot of ambiguous stuff, and stuff where they cant make sure what type is supposed to be

terse swallow
#

I have a problem in the console but I can't see what it could be, can you help me?

opal plank
#

miMIMiMI NU ERwiN ThaNK YoU BuT We DOnT NEEd TyPinGs TS usErs KnoW WhAT ThEY ArE DOInG

earnest phoenix
#

if (!user.roles.cache.find(`name`, "Muted")) return message.channel.send(new Discord.MessageEmbed().setColor("BLUE").setTitle('Kişi Mutelenmemiş.')) how do i switch this to V12

quartz kindle
#

that calls the question tho, how would you make typings for something ambiguous?

#

how you would make the typings dectect which class is it?

opal plank
#

wdym?

#

ts works by merging same names

#

if the class is called TextChannel, so is the typing

#

its just a matter of copying the code over and changing usable code for types, thats it

quartz kindle
#

yes but lets say you have this in js:

if(a) {
  message.channel = new TextChannel()
} else {
  message.channel = new DMChannel()
}
opal plank
#

unless its shit in c or c++, then you kinda fucked

quartz kindle
#

how would you make typings for that?

opal plank
#

message.channel : TextChannel | DmChannel

quartz kindle
#

thats what djs does

#

and you have to typecast it that way

opal plank
#

thats not what i meant though

terse swallow
#

I didn't understand

lusty quest
#

its not about your problem

opal plank
#

@quartz kindle this is what i mean

terse swallow
#

ok

opal plank
terse swallow
#

that scared me

lusty quest
opal plank
#

then when i call it on another file, since it generated from this listener, it should keep the type

quartz kindle
#

but thats ts, not js

opal plank
#

correct

quartz kindle
#

how would you type that in js

opal plank
#

js you wouldnt even check for this

#

i dont even think you would be able to do it in js too well

quartz kindle
#

aka, how would you fix the fact that djs cant autodetect types

opal plank
#

i guess you can declare jsdocs on it

lusty quest
opal plank
#

thats the thing tim

#

you want types in js

#

types in js are jsdocs, there ARE no types in js

#

you need ts to add types

quartz kindle
#

well, you started complaining about djs's types

opal plank
#

which is TS

quartz kindle
#

djs is not ts

opal plank
#

this is clearly ts tim

quartz kindle
#

djs is a js lib

opal plank
#

with ts types

quartz kindle
#

yes

#

so im asking

opal plank
#

there isnt ts libs

quartz kindle
#

how would you fix it?

opal plank
#

its all compiled to js

quartz kindle
#

ofc there are ts libs

#

where everything is written in ts, then compiled

opal plank
#

well yeah, but it needs to be compiled later on

quartz kindle
#

djs is not like that

#

everything is written in js

opal plank
#

it ends up being js at the end of the day

#

and the ts are likely manually typed too

quartz kindle
#

so how would you fix djs?

#

how would you fix djs typings to autodetect the channel type?

#

without having to rewrite the code in ts?

opal plank
#

im fairly certain its nothing related to djs tim

#

its likely ts

#

ts is type checking on index

quartz kindle
#

still, how would you fix it?

opal plank
#

in my code?

quartz kindle
#

in djs's typings

opal plank
#

you cant, you need to check it yourself

quartz kindle
#

you complained that djs cant autodetect channel types

opal plank
#

typeof doesnt work with ts

quartz kindle
#

so im asking, how would you fix that?

opal plank
#

in djs? i cant think of a good way

#

in my code? i can think of

#

actually

#

actually

#

idk if i can do this, probably not

#

but lets see

quartz kindle
#

because im interested if there is a way

#

i just wanna know if its possible and how

opal plank
#

oooh

#

actually

#

i think there is

#

one second

#

yup

#

you can

#

this was my guetto idea

#

aparently it works

#

this is the better typeof

#

if i were to assume this is probably being transpiled into a Object.hasOwnProperty() looped on every key of the object to be checked and the checkee' and seeing if they are the same, ontop of typeof to check the types

cinder patio
#

the instanceof?

#

It's a javascript feature, not ts

pale vessel
#

lmao

quartz kindle
#

@opal plank thats not what im talking about tho, but ok

opal plank
#

wait what?

#

i though instanceof was a ts typeguard

cinder patio
quartz kindle
#

im taking about changing .d.ts in a way that it autodetects the channel type

quartz kindle
#

likely using <T> shenanigans

crimson vapor
#

Tim doesn't djs just extend a base channel class?

quartz kindle
#

yes

opal plank
#

maybe

crimson vapor
#

so are you using the base channel class? or are you doing something else

quartz kindle
#

for those out of the loop,
they were trying to use channel.rateLimitPerUser, which is a property of TextChannel, and ts was complaining that the property doesnt exist, because it gives message.channel a union type, not the specific channel type, so the user needs to typecast the channel themselves to be able to access the property.
my question is if there is a way to create typings in .d.ts that can successfully detect a channel type instead of using Unions, so the user does not need to typecast

cinder patio
#

I don't think there's a way

opal plank
#

me neither

#

you can check in js/ts, but not with typings

crimson vapor
#

assuming they are just using it, they could do something like ratelimit = Channel.rateLimitPerUser ? Channel.rateLimitPerUser : 0

pale vessel
#

|| Thonk

crimson vapor
#

true

pale vessel
#

no

#

??

crimson vapor
#

?? is null operator?

opal plank
#

nullish coallescensing?

pale vessel
#

yes

opal plank
#

something along those lines

crimson vapor
#

but it wouldn't be null, only undefined right

opal plank
#

it checks if a valua is nullable, if its is, it passes the right value

pale vessel
#

null and undefined

crimson vapor
#

oh

opal plank
#

rather than

#

if(!thing) thing = something;

you do thing ?? something

#

if thing alreayd has a value, send thing

#

else, send something

earnest phoenix
#

now if only es6 had null coalescing assignment var ??= var2 if var is nullmmLol

opal plank
#

declaring is bad

#
let foo;
foo ?? bar
#

that should work

#

it might screech at declaration though

#

cuz its doesnt have a declared value

earnest phoenix
#

null coalescing returns a boolean

opal plank
#

js might be able to pass that by

earnest phoenix
#

you would have to foo ?? (foo = bar)

opal plank
#

oh i see what you mean

#

you want to assing foo bar if foo is null

#

or undefined

earnest phoenix
#

exactly

opal plank
#

hmmm

#

yeah dont think thats a thing

earnest phoenix
opal plank
#

well yeah

earnest phoenix
#

it's just syntax sugar

opal plank
#

i should really go sleep

#

its 11AM and i havent slept at all

#

my braincells are fried

crimson vapor
#

yes go sleep

terse swallow
#

excuse me but i cant remember the commands that delete the command after it is executed

lusty quest
#

if you use js call .delete() on the message object

terse swallow
#

thank

desert hazel
halcyon kite
#

hmmm

#

i think this means that

#

uhhh

#

u need to install something?

sudden geyser
#

This looks like the error: js The system cannot find the path specified. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\Users\Jozef\Desktop\Xpl_Top.GG_Bot\Xpl Top.GG Bot\node_modules\vultrex.db\node_module s\sqlite3\build\deps\action_before_build.vcxproj]

#

At the same time it's not descriptive.

desert hazel
#

what it was, there was somthing in the package which requires it and it wasnt installing it

terse swallow
#

how to do as soon as the bot arrives on a new server it puts an automatic message?

sudden geyser
#

What library are you using

terse swallow
#

library ? application ?

sudden geyser
terse swallow
#

discord.js

sudden geyser
#

Listen for the guildCreate event

scarlet stratus
#

Can anyone help me with this codepython async def status_task(bot): while True: await bot.change_presence(activity=discord.Game(name=f"servers: {len(bot.guilds)}")) await asyncio.sleep(5).change_presence(activity=discord.Streaming(name="Type !help in Chat!", url="")) await asyncio.sleep(5)

sudden geyser
#

Can you tell us what's wrong with it?

#

I'm sure asyncio.sleep doesn't return a Bot instance, so doing asyncio.sleep(N).change_presence(...) is wrong.

scarlet stratus
#

It worked before

sudden geyser
#

Doubt.

halcyon kite
#

what is it supposed to do

scarlet stratus
#

It think there is something missing :/

halcyon kite
#

hmmmmm

sudden geyser
#

and if you really want to do something on an interval you should be using timers the library already provides.

scarlet stratus
#

A presence code

halcyon kite
#

ahh ok

gilded olive
#

What the

scarlet stratus
#

Python 3.8

gilded olive
#

you cant do asyncio.sleep. . . .

#

^^^

scarlet stratus
#

Uh what? But it worked like 5 minutes before

#

:/

halcyon kite
#

so e

#

goodbye

scarlet stratus
#

Object has no Attribute

gilded olive
#

which object

#

full traceback

sudden geyser
#

Z1 may want to fix that spacing

gilded olive
#

Just the error is fine

scarlet stratus
#

change_presence

gilded olive
#

🤨

#

Full traceback

#

Please

scarlet stratus
#

Im on Buddy
/data/user/0/ru.iiec.pydroid3/files/temp_iiec_codefile.py:22: RuntimeWarning: coroutine 'sleep' was never awaited
await asyncio.sleep(5).change_presence(activity=discord.Streaming(name="Type !help in Chat!", url="/yoschi_der_allerfalsche"))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task exception was never retrieved
future: <Task finished name='Task-97' coro=<status_task() done, defined at /data/user/0/ru.iiec.pydroid3/files/temp_iiec_codefile.py:19> exception=AttributeError("'coroutine' object has no attribute 'change_presence'")>
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/temp_iiec_codefile.py", line 22, in status_task
await asyncio.sleep(5).change_presence(activity=discord.Streaming(name="Type !help in Chat!", url=""))
AttributeError: 'coroutine' object has no attribute 'change_presence'

#

Idk lol

rocky hearth
#

How can I remove an element from a Set by value?

earnest phoenix
#

sleep returns coroutine, which makes sense that it doesn't have change_presence attribute

scarlet stratus
#

Ok

mellow kelp
scarlet stratus
#

:/ damn i feel hopeless bc i never got that error

rocky hearth
#

yes, JS (I hate Python)

earnest phoenix
#

That doesn't make sense unless you deleted some parts of code by mistake

mellow kelp
#

You can use Set.delete(value) i think

#

Use some intellisense to get it right

halcyon kite
earnest phoenix
#

h

gilded olive
#

Not this bullshit again lmfaooo

halcyon kite
#

hmmmmmmm we can get into an argument but i chill

gilded olive
#

Always gotta have someone hating indentation

halcyon kite
#

ok cool i just like JS better

gilded olive
mellow kelp
#

Lets not start another discussion KEKW

halcyon kite
#

ok

mellow kelp
#

Maybe

halcyon kite
#

hmmm

rocky hearth
#

I want to say "python is depressing 😨 ". But I'll not, because I don't want to start a war.

halcyon kite
#

no i dont but i dont wana get into an argument

halcyon kite
scarlet stratus
#

Imay get a solution imma try it out

halcyon kite
#

ok

earnest phoenix
#

The solution is to learn python kekw

halcyon kite
#

hmmmmmmmmmmmmmmmmmmmmmmmmm true i guess

gilded olive
#

I would disagree about that dpy part

halcyon kite
#

but still in my opinion js is better and u cant change it lol

gilded olive
#

Ive seen some interesting people not knowing the definition of the basic data types trying to make mee6 clones

rocky hearth
#

Python is not best language for beginners. It won't let you understand the core principles of a programming language.

gilded olive
#

Lie

gilded olive
#

Ah yea not the dashboard buts its core functions

terse swallow
#

He tells me that "$ {mentions}" is not defined, what is my fault?

distant mango
#

Python:
if x is True:

JavaScript:
if(x === true){}

earnest phoenix
#

or if x to be implicit kekw

halcyon kite
#

dude

halcyon kite
#

wut u want mentions to do

#

like

distant mango
#

Just wanted to prove a point

halcyon kite
#

make it select a user of ur choice

earnest phoenix
#

But explicit is better than implicit so

gilded olive
#

Haha

halcyon kite
gilded olive
#

Zen of python

earnest phoenix
#

import this moment

distant mango
#

lol

#

It is tho

#

Isn’t it

earnest phoenix
#

Bru

opal plank
#

im gonna pretend i didnt see that

halcyon kite
#

let works too

opal plank
#

wrong

#

absolutely wrong

halcyon kite
#

lol

opal plank
#

dude, you shouldnt argue about something you dont know about

earnest phoenix
#

Wha-

distant mango
#

Big oof, what you don’t use doesn’t have to be wrong

earnest phoenix
#

name isn't mention MegaThonk

opal plank
#

but you talking about js

terse swallow
#

it's a for author and no for mention , no?

halcyon kite
#

lol

opal plank
#

u did

distant mango
#

^

earnest phoenix
#

What

opal plank
#

dude

#

stop

#

just stop embarassing yourself

earnest phoenix
#

What are you on, Z1

halcyon kite
opal plank
#

shh

#

trust me, stop

#

good

distant mango
#

Good

halcyon kite
#

so e

opal plank
halcyon kite
#

and if u want it to not show an error when u dont use it i suggest puttin this: || message.author;

opal plank
#

members.first() returns a member or undefined

#

author is a user

#

completely different things

#

dont use different things in your code

terse swallow
opal plank
#
message.mentions.users.first() || message.author

message.mentions.members.first()?.user || message.author

message.mentions.members.first() || message.member

all those are valid, but the ones you suggested arent @halcyon kite

opal plank
halcyon kite
opal plank
#

wrong

#

member isnt the same as user

#

if you set that to a vairable, that variable now can be a member or a user

#

and they dont overlap

earnest phoenix
#

Hey how can i get a server invite link with the bot?
example: !serverlink message.channel.send(`message.guild.<invitelink>`)

opal plank
#

they are completely different things

#

a member is a member, part of guild

#

a user is a user

#

all 3 examples i sent above are valid

rocky hearth
#

Can we ask the mods to create distinct channels for js-development and py-development. To get everything organised and sorted.

halcyon kite
pale vessel
#

That makes everything harder

#

Plus what about other languages?

halcyon kite
opal plank
earnest phoenix
#

Please help, how can i get a server invite link with the bot?
example: !serverlink message.channel.send(`message.guild.<invitelink>`)

terse swallow
opal plank
#

so like !avatar @terse swallow ?

terse swallow
#

no user info

opal plank
#

or !command @terse swallow

#

the command is up to you

#

just giving you an example

earnest phoenix
#

.-. help please?

terse swallow
#

example : /user-info @terse swallow

opal plank
#

do you have a prefix already?

terse swallow
#

yes

opal plank
#

do you have a command handler?

#

i assume you dont know what that is

#

do you have any working commands?

terse swallow
opal plank
#

show me one of your commands

#

any command you have

earnest phoenix
#

Please help, how can i get a server invite link with the bot?
example: !serverlink message.channel.send(`message.guild.<invitelink>`)

opal plank
earnest phoenix
#

okay thanks

opal plank
#

<guild>.fetchInvites()

#

its a promise, so either await it or chain it

earnest phoenix
#

its the invite link of the server?

terse swallow
opal plank
#

@terse swallow okay so you using content, its all good

terse swallow
#

yes

#

this is just one command

opal plank
#

so

#

above the embed

terse swallow
#

yes

opal plank
#

do a let user = msg.mentions.users.first() || msg.author

#

now replace msg.author on the embed with user

terse swallow
#

yes but else is in problems

opal plank
#

thats it

#

also remove that setURL()

terse swallow
#

ok

opal plank
#

its empty, no point in creating it

#

same for setThumbnail()

terse swallow
#

ok

opal plank
#

thats it, it should work just fine

#

just send that

#

msg.send(helpuserinfo)

#

also

#

dont require discord multiple times

terse swallow
#

it's just below

opal plank
#

that shouldnt affect the code though

#

just performance

#

now restart the bot and try the command

terse swallow
#

yes i say but is copie coller

opal plank
#

if you @ someone it should get their avatar and id

#

also

#

remember that you got a typoe on your command

#

typo*

earnest phoenix
opal plank
#

the command you need to use is /help user(info @thick lake

opal plank
earnest phoenix
terse swallow
opal plank
#

holy shit, this is getting quite big quite quickly

earnest phoenix
opal plank
#

yes

#

i told you right after i told you about using fecthInvites()

earnest phoenix
#

oh i see

terse swallow
#

let user = msg.mentions.users.first() || msg.author
^[it's no defined ]

opal plank
#

it should be

#

whats the error?

#

like, WHOLE error

#

and show the updated code too

earnest phoenix
#

@opal plank Thanks working!

opal plank
opal plank
#

you didnt change what i said though

#

no dude

#

nono

terse swallow
#

yes i change

opal plank
#

what i told you to put was HERE

#

re-read those

terse swallow
#

here it is and excuse me but I am French so quite difficult to understand

opal plank
#

no problem

#

so, i make it easy

#

i understand a bit of french

#

so i can understand some words if you are confused

quartz kindle
#

omelette au fromage

opal plank
#

LMAO

#

legit though

terse swallow
#

ok thank

opal plank
#

in canada i learned a bit of french

#

let user = msg.mentions.users.first() || msg.author

#

mets ca lá dedans

#

au desssus de ca

#

compris?

terse swallow
#

yes

opal plank
#

aight

#

remplacer ceci

#

avec user

#

jesus christ, i should go to google translate

#

i dont remember almost anything from french

#

how bad was that french? xD

quartz kindle
#

spoken french is alright, but written french is hell

opal plank
#

specially bcause we know portuguese, ti helps a lot with pronunciation and similarity

terse swallow
#

0 you speak very good french

mellow kelp
#

makes english look like a walk by the park

opal plank
#

xD

opal plank
quartz kindle
#

nothing in written french is pronounced the way you write it

#

lmao

opal plank
#

nono

terse swallow
#

It's the truth

opal plank
#

i didnt both

#

i mean them separated

#

spoken portuguese has some quirks that helps with french

quartz kindle
#

meanwhile my native language is slovenian, where everything is literally pronounced the way you write it (except for the letter J for some reason)

opal plank
#

same for written, apart from the crap ton of ç à è an shit sprinkled around, the roots are from latin, which is similar

opal plank
#

time for another beer

#

brb

terse swallow
quartz kindle
opal plank
#

i disagree, portuguses and mandarin are worse

mellow kelp
opal plank
#

cantonese is probably the bitchiest of the languages

terse swallow
#

i'm afk 10 minute , escuse

opal plank
#

okie

mellow kelp
#

aight

quartz kindle
#

in slovenian is "dizajn"

#

lmao

mellow kelp
opal plank
#

in portuguese its design

mellow kelp
#

but i can kinda see the connections

quartz kindle
#

its a literal transcription of the way it sounds like in english

mellow kelp
#

why did i read it as broken english

opal plank
#

the good thing abuot portuguese is that its almost a 1 to 1 translation

#

the structure is so similar that you can translate the words individually and make a readable sentence

mellow kelp
#

yeah thats true

#

i can sometimes understand a bit of portuguese

opal plank
#

we getting carried away a bit in here lol, its dev chat

mellow kelp
#

wait yes

#

imma head out

opal plank
#

imma go code more, and drink more, of course

#

dude, 55 servers in 2 days

#

jesus christ

mellow kelp
#

sounds epic

quartz kindle
#

wait a few more days, then i'll send you this c++ lib with 90 functions for you to type/doc for me :^)

opal plank
#

be careful tim, im still a virgin

quartz kindle
#

at first i put everything in a single cpp file, was over 3.5k lines long

opal plank
#

barely ever touched cpp, its going to be a new thing

quartz kindle
#

now im slowly splitting it into 90 files, one per function

opal plank
#

nani?

#

NANI?

#

90 files?

quartz kindle
#

ye

opal plank
#

well, like i said, as long as you got js i can make docs

#

i know its cpp, but i need some sort of js base to work from

#

i cant interpret cpp code

quartz kindle
#

the only js is re-adding all the constants that c++ cant export

#

lmao

opal plank
#

i'll need some funciton examples

#

at the very least then

quartz kindle
#

you wont need to, i'll do it for you

#

its ez

opal plank
#

oh, then its fine

#

as long as its js its easy

quartz kindle
#

i need to change a few funcs

#

remember what i talked about before? some funcs return arrays with attaches props lmao

opal plank
#

yeah i'll need to have a look at that

quartz kindle
#

im gonna change that

#

gonna make it the normal way

opal plank
#

but like i said, as long as its js i should be able to pull it off without much effort

#

its just repetitive

quartz kindle
#

an object with a data prop for the array