#development

1 messages · Page 1550 of 1

earnest phoenix
#

Thanks too uh...

glossy spoke
#

?

lusty quest
#

is the bot a higher role that you? otherwise the bot doesnt get permissions

solemn leaf
#

Okay

#

well

#

why

#

when I accept it

#

it timesout

#

but it does show teh og message

lusty quest
#

did you handle the await correctly?

#

did you get any error?

#

yea i think i see the issue

rocky hearth
#

@earnest phoenix u can set images at 2 places.
thumbnail (right to title) and image above timestamp

lusty quest
#

you get the message you get only if the user got the role

earnest phoenix
#

Ohh thanks so

#

.setThumbnail('link') @rocky hearth right?

rocky hearth
#

yup

lusty quest
#
if(rMember.roles.cache.has(role.id)) { //Returns true if the member got the role 
      return message.channel.send(`${rMember.displayName}, doesnt have the role!`)
    } else { //will execute if member doesnt have the role
earnest phoenix
#

Thanks

rocky hearth
faint tangle
#

Aye anyone have a status script?

#

I have one

earnest phoenix
#

Damn, I was in a whole other fake discord.js website @rocky hearth

faint tangle
#

but for only playing

lusty quest
#

your code will return the doesnt have the role message if the member got the role. invert the check

faint tangle
#

not watching or listening

#

anyone got a script for all of thos

trim saddle
rocky hearth
earnest phoenix
#

Ohh yeah ok

#

Thanks

trim saddle
#

@lusty quest explain how you're supposed to choose a system channel on creating a guild when all you can provide is partial channel objects

lusty quest
# faint tangle not watching or listening
struct Handler;

impl EventHandler for Handler {
    fn message(&self, ctx: Context, msg: Message) {
        if msg.content == "!online" {
            ctx.online();
        }
    }
}

let mut client = Client::new("token", Handler).unwrap();

client.start().unwrap();
solemn leaf
#
if (reaction.emoji.name === '👍') {
                            const embedcom = new Discord.MessageEmbed()
                                .setColor("#36393F")
                                .setAuthor("Comfirmed!")
                                .setTimestamp()
                                .setFooter(message.id)
                            msg.edit(embedcom);
                            runOrder(message.author.id)

this makes it timeout for some strange reason but removing myfunction to handle the order it works and edits the mesage to say comfirmed

lusty quest
trim saddle
#

on creating a guild

#

h o w

lusty quest
#

partials send a channel id

trim saddle
#

ok but

#

before the request is sent to make the guild

lusty quest
#

fetch the channel?

trim saddle
#

i'm trying to figure out discords logic behind this

lusty quest
#

so you want to create a guild with a bot?

#

iirc by default the first channel is also the system channel

trim saddle
#

yet discord provides an argument for choosing a system channel by id

#

which is dumb as hell on creation

lusty quest
#

if the situation is the same your check is still wrong, if you inverted the check you should get a different outcome

lusty quest
lusty quest
solemn leaf
#
.then(collected => {
                        const reaction = collected.first();
                        if (reaction.emoji.name === '👍') {
                            const embedcom = new Discord.MessageEmbed()
                                .setColor("#36393F")
                                .setAuthor("Comfirmed!")
                                .setTimestamp()
                                .setFooter(message.id)
                            msg.edit(embedcom);
                            runOrder(message.author.id)
                        } else {
                            const embedde = new Discord.MessageEmbed()
                                .setColor("#36393F")
                                .setAuthor("Declined!")
                                .setTimestamp()
                                .setFooter(message.id)
                            msg.edit(embedde);
                        }
                    })
                    .catch(collected => {
                        const embed1 = new Discord.MessageEmbed()
                            .setColor("#36393F")
                            .setAuthor("Timed out. Use the command to try again!")
                        msg.edit(embed1)
                        message.reactions.removeAll().catch()
                        return
                    });

Why when I run the function it times out

#

is that all you need?

trim saddle
#

@lusty quest here's the thing

lusty quest
solemn leaf
#

?

trim saddle
#

the channels you provided on creation are structured like this

{
    "name": "sb8-has-cute",
    "type": 0
}
solemn leaf
#

what

#

did you got

#

whatt

#

wydm

lusty quest
#

just invert the check i told you a few minutes ago

lusty quest
lusty quest
earnest phoenix
#

Guys should I add something it looks a bit dry..

solemn leaf
#

dued

#

wtf

#

did you got

#

pls tell me you are new to english

lusty quest
earnest phoenix
solemn leaf
#

no

#

I have one and 1 catch

rocky hearth
#

@solemn leaf

.then(async collected => { // Change to this
// and also change this part
await msg.edit(embedcom);
lusty quest
opal plank
#

correct

rocky hearth
solemn leaf
#

@rocky hearth it flashes to comfrimed then it edits it again to timed out

#

and my function doesnt log

rocky hearth
#

does ur runOrder depends on the msg edit?

solemn leaf
#

it runs after it

rocky hearth
#

yeah, does it use the msg, in runOrder body?

solemn leaf
#

no

#

it only uses the users id

#
function handleOrder(UserId) {
    const orderembed = new Discord.MessageEmbed()
        .setColor("#36393F")
        .setTitle(`From ${message.author}`)
        .setAuthor(`x${args.pop()} ${x.displayName}`)
        .setTimestamp()
        .setFooter(message.id)
    client.channels.cache.get(804070122401955881).send(orderembed).then((m) => {
        db.set(`orders_${message.guild.id}`, { "MessageId": m.id, "UserId": UserId })
    })
    console.log("hhhhhh")
}
lusty quest
#

did you get a different issue?

#

or did you just copy/pasted the code?

solemn leaf
rocky hearth
#

Show ur collector.

lusty quest
#

did you just copy/pasted the code?

solemn leaf
#

@rocky hearth I moved te fucntion above the dit and it dgoes straight to the collector

#

or the time out

#

founbd out why

#

this is undefined @lusty quest

#

client.channels.cache.get(804070122401955881)

glossy spoke
#

try using fetch

#

client.channels.fetch("804070122401955881");

solemn leaf
#

I got it

#

but

#

I need help thinking

#

I need to store message ids of orders

#

Im using quick.db

#

Can I just make the b name be orders

#

then .set

#

or if many orders were put it

#

in would it be deleted

glossy spoke
#

if you use .set to set orders using the same key it just changes the value of the key

solemn leaf
#

Okay

lyric mountain
#

you can, tho, store an array in it

glossy spoke
#

so i suggest you to .set with a unique key

solemn leaf
#

db.set(`orders_${UserId}`, { "MessageId": Id})

glossy spoke
#

like Order_(orderID)

#

ya

solemn leaf
#

I might just do that

#

unless if I can search all of them

glossy spoke
#

using db.get you get all data

crimson vapor
#

what should I do to correctly get the language of a code snippet?

lyric mountain
#

you mean this?

crimson vapor
#

yeah so say someone inputs
console.log('') how should I determine, in nodejs, that that language is js

lyric mountain
#

oh hell

#

how can I type it

#

^```.+$ for regex

#

without using regex, get the index of the first space character, then make a substring and replace ```

#

like, an example:

crimson vapor
#

but not in discord tho

#

like in general

earnest phoenix
#

Are you trying to get the language and the content of a codeblock?

lyric mountain
#

afaik ``` is markdown, so any codeblock written will be detectable

earnest phoenix
#

If so that would be really easy

solemn leaf
#

how can I get a message from its id

crimson vapor
#

from like any text input

lyric mountain
#

that'd be impossible then

crimson vapor
#

without any ```

lyric mountain
#

for example:

#

int value = 0

earnest phoenix
#
/\`\`\`([\s\S]*)\`\`\`/
lyric mountain
#

that could be:
C
C++
C#
Java
etc

gilded olive
#

That's an interesting question, but it looks impossible

crimson vapor
#

highlightjs does it decently well

earnest phoenix
#

Bruh

crimson vapor
#

but I need it more precise

gilded olive
lyric mountain
#

highlightjs is JS-only

#

if you know the lang, it's pretty simple

solemn leaf
# gilded olive lang?

cleint.channels.cache.get("804070122401955881").messages.fetch(order.MessageId).then((msg) => {...})

crimson vapor
#

I don't

lyric mountain
#

just make a regex dict

crimson vapor
#

it could be any

solemn leaf
#

is that correct?

lyric mountain
gilded olive
#

oh idk about djs

crimson vapor
#

yes

lyric mountain
#

you can't

lyric mountain
#

unless the lang has a highly unique syntax, you can't tell what lang it is only by the syntax

earnest phoenix
#

Are you trying to highlight the syntax of a given codeblock content?

lyric mountain
#

any text

gilded olive
#

not a codeblock he said

#

Any given text

lyric mountain
crimson vapor
#

any input

lyric mountain
#

tldr: impossible task

#

not without some identification

#

like: js blablabla

crimson vapor
#

fuck

lyric mountain
#

then u can get the first word to identify

gilded olive
#

is this some

#

eval?

crimson vapor
#

what do people use to paste code?

#

like in browsers

earnest phoenix
#

So he trying to determine the syntax of any text to apply something specific to it?

lyric mountain
crimson vapor
#

yes

lyric mountain
#

hatebin

#

pastebin

#

any -bin

crimson vapor
#

it doesn't want to save reeeee

lyric mountain
#

but those make a ton of mistakes

lyric mountain
gilded olive
#

if its some eval (which I think it is) you can use identification

lyric mountain
#

hastebin is bugged af

crimson vapor
#

I am trying

lyric mountain
#

hatebin, not hastebin

crimson vapor
#

oh I see

#

my bad

gilded olive
#

Yea they make tons of mistakes, python tracebacks = sql files

crimson vapor
#

looks like it just uses hljs

#

so yea

#

not much I can do

lyric mountain
#

yep

#

all u can do are suppositions

earnest phoenix
#

It's really Impossible to determine the syntax without false positives, because you gotta have thousands of checks for just a single one of the languages

#

Time consuming, and already Impossible

crimson vapor
#

yea

solemn leaf
#

I got Unknown Message

crimson vapor
#

ima just live with highlightjs

lyric mountain
#

there are, however, some langs that are readily recognizable

#

like cobol

#

but that ain't useful

earnest phoenix
#

The node trying to determine brainfuck be like KEKW

wicked pivot
#

Hello I have just had my bot checked on discord I did not have the right to intents, now my bot does not start anymore

lyric mountain
#

you need to request those intents

wicked pivot
#

yes yes I made the request I was not allowed because I have commands a little too basic. but now I have a problem I cannot start the bot

#

I delete "fetchAllMembers" because suddenly I knew that I could not start my bot if I mention it but that doesn't change anything

lyric mountain
#

fetchAllMembers require GUILD_MEMBERS gateway

#

so yeah, you need to request it to be able to use

wicked pivot
livid lichen
#

Does anyone know how I would check if a number is in an Environmental Variable table?

#

I tried .Includes().

lyric mountain
#

what's the error?

wicked pivot
#

there is no error, nothing happens

lyric mountain
#

so KEY-VALUE

livid lichen
#

oo

lyric mountain
#

you need to check if it contains the key

trim saddle
#

@quartz kindle, im trying to compile my stuff with tsc but when it comes to getting all my types i think this

foo.d.ts
foo.js

bar.d.ts
bar.js

index.d.ts
index.js

doesn't look good, is there any other way i can assign my types without sending them to @feral hornets

livid lichen
#

Yeah

#

Thank you.

trim saddle
#

i don't regret that ping.

livid lichen
#

I swear my h key is broken-

wicked pivot
livid lichen
#

@lyric mountain I have an error. TypeError: process.env.Admins.map is not a function.

#

Did I misunderstand you?

trim saddle
#

Admins is probably undefined

livid lichen
#

Nope.

trim saddle
#

then it's not an array

livid lichen
#

It's an array of numbers.

trim saddle
#

it probably isn't

livid lichen
#

Admins="[ EXAMPLENUMBER1, EXAMPLENUMBER2]"This is the ENV.

trim saddle
#

check what it is with typeof

#

because it clearly isn't

earnest phoenix
#

It's literally a string

#

Pepega

livid lichen
earnest phoenix
#

Then don't make it a string if you want an array?

livid lichen
#

🤦‍♂️

#

I feel extremely dumb thanks.

trim saddle
#

???

livid lichen
#

Nope didn't work.

trim saddle
#

wdym

livid lichen
#

Admins=[]

#

That's in the .env file.

trim saddle
#

it's an empty array

livid lichen
#
if (process.env.Admins.map(message.author.id)){
        return true
      }
      
      return false
livid lichen
earnest phoenix
#

Bruh

#

Array.prototype.map() expects a callback function, not a string

livid lichen
#

@lyric mountain ^

trim saddle
#

map doesn't work like that

livid lichen
#

She said .map. I must have misunderstood her.

earnest phoenix
#

I think you wanted to do Array.prototype.includes()

livid lichen
#

.has & .includes doesn't work

trim saddle
#
const friends = ["jerry", "jason"]
console.log(friends.map(f => `+${f}`)) // ["+jerry", "+jason"]
#

that's how you use map

earnest phoenix
#

I don't think they wanted to use map

trim saddle
#

well still

#

for future reference

livid lichen
#

@earnest phoenix TypeError: Cannot read property 'includes' of undefined

earnest phoenix
#

Show new code

livid lichen
#
if (process.env.Admins.prototype.includes(message.author.id)){
        return true
      }
      
      return false
earnest phoenix
#

Array.prototype was for the reference of an array prototype, not to be copied

#

Admins.includes()

livid lichen
livid lichen
earnest phoenix
#

I'm pretty sure it's not even set

#

Log this

#

'Admins' in process.env

livid lichen
#

Command not found

earnest phoenix
#

Log it i said

#

console.log('Admins' in process.env)

livid lichen
#

true

earnest phoenix
#

Then process.env.Admins.includes(message.author.id) should already work

livid lichen
#

hmmm

#

lemme try somthing

wicked pivot
livid lichen
#

Nope

earnest phoenix
#

You're probably not even saving and running the code at all @livid lichen

earnest phoenix
#

So what is the error

livid lichen
#

My program automatically updates it.

livid lichen
#

But mostly just includes is not a function

earnest phoenix
#

console.log(typeof process.env.Admins)

livid lichen
#

I fixed it.

#

It cannot be a string holding the table.

#

Idk why I even thought it was right.

#

Thanks for the help @earnest phoenix.

earnest phoenix
#
- <GuildMember>.voiceChannel
+ <GuildMember>.voice.channel```
trim saddle
#

@earnest phoenix who did that, d.js?

earnest phoenix
#

Did wut

#

You're using discord.js v12, message.member.voiceChannel is v11 not v12

#

message.member.voice.channel is v12

#

https://sourceb.in/XBfkbl3ucR
Please help I give nitro for help Ping me

#

f

lyric mountain
#

no that you needed to use a map on it

earnest phoenix
#

https://sourceb.in/YvPgiG4hcE
Why the channel is invalid

mellow kelp
#

"I give nitro" KEKW

earnest phoenix
#

when you have to bribe someone to fix your dumpster fire

livid lichen
#
const BotMessage = await msg.channel.send("Ping!");

    BotMessage.edit({
      content: "_",
      embed: {
        title: "Pong!",
        description: [
          "**Responce time: **: `" +
            (BotMessage.createdAt - msg.createdAt) +
            "ms`"
        ].join("\n"),
        color: "#0099ff",
        timestamp: new Date()
      }
    })
```This is my code and this is my output `UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body`.
#

I didn't read much of the message.edit() function on discord.js docs.

sturdy dock
#

dumb question but how do you check if a channel ID is located within a guild? discord.js v12

crimson vapor
#

does it make sense to use redis over a basic object cache in js if you are caching small data like ints?

earnest phoenix
#

Miss click

sturdy dock
#

someone ping?

#

oh

#

nvm

obtuse jolt
#

my empty php file gives a 500 error

earnest phoenix
#

ew

#

is there any reason for using php

earnest phoenix
earnest phoenix
limber flume
#

@drowsy crag ^

earnest phoenix
#

?

misty sigil
#

We dont fix code for nitro

#

what are we ?

#

a fucking code monkey farm?

quartz kindle
#

yes

misty sigil
#

ohok

solemn leaf
#

@opal plank waht is the diff between ts and js

#

they are both high level programing lang

#

and can work with each other

earnest phoenix
#

How to put server count on my bot page

solemn leaf
#

@opal plank also that is a dam nice rich presence I might do that

opal plank
opal plank
solemn leaf
#

just the add bot

#

ANd I made m rich presence long before you had one

#

so you copied off of mine and added things

opal plank
#

what?

#

SDK is public, having the idea to ad bots in status is my thing dude

solemn leaf
#

gottem

opal plank
#

also good luck writing in C#, SDK is a bitch to play with because RPC is deprecated

#

so no node support

misty sigil
#

ill do it

opal plank
#

i would rather people do their own thing rather than copying mmulu

solemn latch
#

thats how the internet works

opal plank
#

you have all this creativety and thinking just for it to be copied

#

¯_(ツ)_/¯

#

same for the bots

misty sigil
#

writing in c# is not my thing so i'd have to be lucky with my keyboard smashes to work

#

tbh

solemn leaf
#

@opal plank what?

mellow kelp
#

it's just microsoft java

opal plank
#

there wasnt a single genshin bot apart from the wiki one, now theres plenty out there

mellow kelp
#

the basics of c# ain't that much

earnest phoenix
#

semi related hey remember when discord said they'll make presence REST compatible
well, it's been 3 years now

misty sigil
#

discord™️

solemn latch
#

someone by the end of the month will have an exe version so users can do it themselves in a few seconds.

opal plank
#

Discord™️

#

actually

#

i should not speak about that

#

👀

solemn latch
#

my bots already got an exe KEKW

opal plank
#

nothing happened, move along

solemn leaf
#

h

#

@opal plank wdym

#

node still works

#

stop cap

opal plank
#

RPC is deprecated dude

mellow kelp
#

not working !== deprecated

solemn leaf
#

look at my status

#

I knwothat

#

but did they add new stuff/

opal plank
#

they still deprecated it, the proper way to do presence is SDK

steel heath
#

how can I make a discord permission bit field (flags) in readable format on my website? not in a bot using discord.js so no Discord.Permissions but there has to be a separate package or at least a way to achieve it with pure javascript

solemn leaf
#

sdk

#

what evs

misty sigil
mellow kelp
#

make a constant with the perms and their numbers

#

and use bitwise operators to calculate stuff

opal plank
#

@solemn leaf

wicked pivot
#

silly question is my status cleared by discord?

steel heath
#

i wish i knew what you're talking about lol @mellow kelp

opal plank
misty sigil
#

shite.

steel heath
#

i just don't get how 1 << 0 would help in my 2146959094 flags to see if it has manage roles or smth

mellow kelp
#

roles use | and &

opal plank
#

its bitfield

#

you need to decode it

mellow kelp
#

not really sure why they work that way but it works

earnest phoenix
#

sounds like it's a good time to learn how bit masks work

opal plank
#

reduces packets size

mellow kelp
#

i guess each of those numbers has different bits that don't conflict with the others right?

steel heath
mellow kelp
#

so that they don't get conflicts when using |

earnest phoenix
#

yes

opal plank
#

correct, is 2 to the power on N

#

1, 2, 4, 8, 16, 32 ...

mellow kelp
#

ohh aight

#

now it makes sense

opal plank
#

even if you add multiple, it'll never touch the next

#

so they are all unique

mellow kelp
#

that's pog

earnest phoenix
#

that's why discord started using strings for permissions iirc, the numbers became too big for json

opal plank
#

it is decoded with 0's and 1's

#

let me get my code for deconding

earnest phoenix
#

in v8 yeah

opal plank
#

i assume thats clear enough on how to use it

mellow kelp
#

let permissions: any

#

that was not very cash money

earnest phoenix
#
Permissions are stored within a variable-length integer serialized into a string, and are calculated using bitwise operations. For example, the permission value 123 will be serialized as "123". For long-term stability, we recommend deserializing the permissions using your languages' Big Integer libraries

taken from docs

opal plank
#

shoo, fuckoff

#

cant be arsed to type an interface for that

opal plank
#

its not used anywhere

mellow kelp
#

o

steel heath
#

well thank you very much, will try this one

opal plank
#

bitfield is confusing, but not hard at all

#

you gotta understand how binary works to decode it

#

since its all turned into 0's and 1's

mellow kelp
#

.toString(2)

opal plank
#

and it cheks that

earnest phoenix
#

it's really simple if you ever covered binary in cs

mellow kelp
#

i got to practice binary with the advent of code thing during december

#

there was this puzzle where you had to apply some bitmasks to some numbers

opal plank
#

i need to get my daily rates of bot growth

#

i shit you not its at a rate of 60 servers a day now

#

@quartz kindle how long will internal sharding survive for?

mellow kelp
#

jokes on you

#

my bot is at a rate of -1 guilds per hour

misty sigil
#

JOKES ON YOU

#

MINE'S AT -3 PER HOUR

mellow kelp
misty sigil
#

i win

opal plank
#

im so fucked though, this bot isnt going to be surving a month if it keeps going like that on a single thread, its insanely complex and intricate

misty sigil
#

uninternally shard it

opal plank
#

you make it sound like its easy

#

i even made my own cluster/spawner for twitch, and im struggling to properly think of a good way to do it in d.js

austere zealot
#
Traceback (most recent call last):
  File "C:\Users\25dch\OneDrive\Desktop\Timer bot\calcybot\calcybot.py", line 182, in <module>
    async def cookie(ctx):
  File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 1257, in decorator
    self.add_command(result)
  File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 1149, in add_command
    raise CommandRegistrationError(alias, alias_conflict=True)
discord.ext.commands.errors.CommandRegistrationError: The alias Cookie is already an existing command or alias.
``` im getting this error even tho i only have 1 cookie aliases
misty sigil
#

i do make it sound easy!

opal plank
#

its a complete rewrite though

#

i'd probably be better off making my own gateway and spawner

#

rather than using d.js's

gilded olive
#

The error is exactly as it says

#

async def cookie()

#

Something is already called cookie

austere zealot
#

oh

#

....

gilded olive
earnest phoenix
#

How to put server count on my bot page

earnest phoenix
#

Yes

opal plank
#

which language?

earnest phoenix
#

Html I think i have no idea

opal plank
#

programming language

#

javascript? python? c? c++?

earnest phoenix
#

Bdscript

opal plank
#

dont know, Bdscript isnt a proper programming language, maybe they have their own thing

earnest phoenix
#

Ok 👍

mellow kelp
#

apparently you can use javascript on bdscript

opal plank
earnest phoenix
#

Ty

opal plank
#

okay now im confused

#

how do i properly add an event emitter to a class?

lyric mountain
#

Connect to websocket and send the message to urself maybe?

opal plank
#

what?:

lyric mountain
#

Like, self-send the websocket message

opal plank
#

not that, an eventEmitter, from node

lyric mountain
#

Oh, idk then

misty sigil
opal plank
#

i am not, i'd like to make the class itself be able to emit events

misty sigil
#

oh

#

why not extend?

opal plank
#

should i?

misty sigil
#

it makes life a lot easier and the events package is build into node

opal plank
#

i worked with emitters before, but never in a way to actually make the class itself be an emitter

#

i usually call the new EventEmitter from node

mellow kelp
#

just extend EventEmitter i guess

#

maybe you could try implementing it's prototype methods

earnest phoenix
#

extending it will give you a lot of flexibility out of the box

misty sigil
mellow kelp
#

like EventEmitter.prototype.emit.call(this, 'event')

misty sigil
#

iirc

mellow kelp
#

yea

solemn leaf
#

why isnt this loggign

#
bot.on("guildMemberAdd", (member) => {
    console.log("h");
});
opal plank
#

yeah, its annoying that i have to call super

solemn leaf
#

I left and rejoined

misty sigil
#

do you have intent?

solemn leaf
#

what intent?

misty sigil
#

GUILD_MEMBERS

solemn leaf
#

hm

#

I thought I did

misty sigil
#

is it specified in client opts

solemn leaf
#

do I have to enable in portal?

misty sigil
#

yep

solemn leaf
#

k

#

thank you

#

still didnt work

opal plank
#

@earnest phoenix @mellow kelp @misty sigil thank you

misty sigil
#

np erwin't

opal plank
#

im used to doing this, which is fine

#

but in this case i need the class itself to have emitters inside

#

without adding another variable

mellow kelp
#

pog

opal plank
#

hmmm

#

this is annoying

misty sigil
#

did you super()

opal plank
#

i did

solemn leaf
#

@misty sigil didnt log it

misty sigil
#

prove it

opal plank
misty sigil
#

oh shit

opal plank
#

and i already compiled it

#

imma restart VSC maybe it picks it up

#

nope

#

still triggering

#

hilp

#

i think its the declaration

#

but tsc should've taken care of that

#

weird

#

wrong token or trying to access something that you dont have access to

earnest phoenix
#

it's wrong token

#

the latter is 403

opal plank
#

there you have it

drowsy grail
#

got a really odd error

#

this happened after i imported something to a module

#

anyone ever seen anything like this?

earnest phoenix
#

that seems like a segfault

#

what did you import

opal plank
#

hmmmmm im starting to think 16 seconds for a full startup is quite slow

#

how long do the bot yall' have take to fully startup?

lyric mountain
#

About 1 mins (actually)

earnest phoenix
#

are you firing all of that in serial or parallel

opal plank
#

me cry?

earnest phoenix
#

yeah

opal plank
#

pararell

earnest phoenix
#

hm, i guess it's not actually that much for that amount

lyric mountain
#

Just done the test

opal plank
#

there are some stuff that takes a bit longer to load

#

but they are not core parts

#

theres a full minute just there to fetch all buffers

#

i think theres about 50 requests being made there

#

correction, 73 requests

#

73 requests in under a minute isnt that bad either

drowsy grail
#

possibly a sgfault yea, pretty odd

mellow kelp
opal plank
#

its a whole class

split hazel
#

imagine doing this.function instead of defining class methods how they're supposed to be defined

opal plank
#

i know how they are done

#

this case is needed

#

since i need to assign that value to something without fucking it with a promise failing

#

@split hazel angery

split hazel
#

bigint is incorrect

#

it should be ThiccInt

opal plank
#

you're ThiccInt

mellow kelp
#

thicc ints save lives

crimson vapor
#

thicc ints steal bits

solemn leaf
solemn latch
#

272764566411149314

#

whoops

solemn leaf
#

No

#

Like with code

misty sigil
#

what library you using?

solemn leaf
#

djs

solemn latch
#

as in in a message get the mentioned channel?

misty sigil
solemn leaf
#

yea

misty sigil
#

for raw channel

#

or mentions.channels.first().id for mentioned

solemn leaf
#

thank you

#

and does it return undefined if there isnt one?

misty sigil
#

yep so you can just check mentions || message channel's id

solemn leaf
#

mentions.channels.first() || mentions.channels.first().id

mellow kelp
#

you could also use the optional chaining operator

#

mentions.channels.first()?.id

misty sigil
#

no?

mellow kelp
#

it there's no mention, it will just return undefined and not throw an error

misty sigil
#

or this...
const channel = mentions.channels.first() || message.channel

#

fucking hell

mellow kelp
#

o

#

yeah also that

solemn leaf
#

can I get help with a regex

solemn latch
#

maybe, whats it for and what have you tried

solemn leaf
#

I havent tried

#

would I use \w

earnest phoenix
#

I need help,
I'm trying to update a document in my mongo database, but it's giving me the error:
TypeError: Update document requires atomic operators

collection.updateOne({ $push: { "economy.disabledUsers": "420366170428801025" } }, function(err, updated) {
        if(err) {
          console.error(`[Server][ERROR] ${err}`);
          return res.json({ code: 500, data: err });
        }

        console.log(updated);
        return res.json({ code: 200, data: updated });
      })
    })

I've already googled it but it's not really too helpful, everything looks the same
$push is not right, i've also tried "$push".

#

$push is not right or something

#

I've tried it as $push and also "$push"

earnest phoenix
#

@solemn leaf use regex

solemn leaf
#

Bruh I know to use

#

@solemn latch doesnt replace just do 1?

earnest phoenix
#

Do a string.replace() and use regex

mellow kelp
#

use /\{username\}/g

earnest phoenix
#

^

mellow kelp
#

it's like '{username}', but the g flag makes it global

#

the \'s are just for escaping the brackets

solemn leaf
#

I know that

#

so its that simple

#

nice

mellow kelp
#

pog

earnest phoenix
#

Any help on my issue? lmao

solemn leaf
#

never used mongo

mellow kelp
#

i use mongoose so i dunno

earnest phoenix
#

...

#

thats the same

mellow kelp
#

do you use mongodb or mongoose?

#

(i mean library)

earnest phoenix
#

oh lmao

#

mb

#

mongodb

mellow kelp
#

o

solemn latch
#

not 100%, but shouldnt the first option be which document to update

earnest phoenix
#

omg

#

wait no

#

wait fuck, yes

solemn latch
#

lol

#

its one of the two

earnest phoenix
#

ur a legend

#

love u

solemn latch
#

❤️

earnest phoenix
#

❤️

#

Been stuck on this for hours

solemn latch
#

op

#

its always nice to see people try and solve things themselves

earnest phoenix
#

It is indeed

solemn latch
#

but sometimes a fresh pair of eyes is all you need too.

earnest phoenix
#

Especially when tired from working haha

solemn leaf
#

how do I mention a channel again?

ebon kelp
#

.channel

solemn leaf
#

mention

#

like

#

<#id>

ebon kelp
#

`ping channel: ${message.channel}`

solemn leaf
#

dude

ebon kelp
#

.toString() ?

solemn leaf
#

im ebing trolled

earnest phoenix
solemn leaf
#

to mention a channel

ebon kelp
#

Bro I just told you how to ping a channel

solemn leaf
#

from id

#

bruh

solemn latch
#

<#${idvariablehere}>

solemn leaf
#

thanks

#

How do I get guild name from message

lyric mountain
#

Hm

#

Oh, nvm

#

Wasn't supposed to ping

grizzled raven
#

[#development](/guild/264445053596991498/channel/272764566411149314/)

ebon kelp
solemn leaf
#

oml not this again

grizzled raven
solemn leaf
#

how do I end awaitMessages

opal plank
solemn leaf
#

I need like 3 of them

opal plank
#

unless you pass in time or a filter, i dont think they can be ended externally

sudden geyser
#

awaitMessages is just a higher level form of a collection

opal plank
#

collectors in the other hand can be removed fairly easily

solemn leaf
#

how do I end it so I can stat another one when its over?

sudden geyser
#

actually doesn't node feature promise cancellation in later versions

#

cry mentioned something about it

#

Though you may not need three separate collectors/await messages. You could probably squash it into one.

solemn leaf
#

How lite?

#

it never actually does anything after this

#
    function startWelcome() {
        message.reply("Please tag the channel you want people welcomed in!").then(async (msg) => {
            console.log("h")
            message.channel.awaitMessages(filter2, { max: 1, time: 30000, errors: ['time'] })
                .then(collected => {

it never logs after the collected

#

that is my first filter

pale vessel
#

what's filter2?

tribal siren
#

is there a filter2 at all

#

also @pale vessel i use aeon

#

:)

sudden geyser
# solemn leaf How lite?

You basically need to create one single filter that allows X number of responses. When a message is collected, do something like validating the message. If it fails the validation, inform the user and cancel it. If it works, continue. You keep doing this and keep record of the data you have and the order you're in, but you may run into race conditions this way.

solemn leaf
#

@sudden geyser

#
    const filter2 = (msg, user) => {
        return msg.content && user.id === message.author.id;
    }
pale vessel
#

It's only msg

sacred trout
#
channel_nsfw = await self.is_nsfw(ctx.message.channel)
pale vessel
#

it doesn't provide user

sacred trout
#

is this code correct to check for nsfw?

pale vessel
#

you use msg.author.id instead @solemn leaf

solemn leaf
#

okay

sacred trout
pale vessel
#

huh

#

can't you use ctx.channel.is_nsfw()?

sacred trout
#

if ctx.channel.nsfw:
code
else:
bruh

pale vessel
#

I just checked the docs, it's channel.is_nsfw()

#

that's weird

sacred trout
#

lol yeah it is weird

#

shouldn't it be

#

ctx.channel.is_nsfw()

pale vessel
#

yes

#

i meant that it's not the property nsfw but is_nsfw and it being a method

solemn leaf
#

@pale vessel didnt work

#

wait

#

I see

pale vessel
solemn leaf
#

@pale vessel

#

it goes right to time out

gilded olive
pale vessel
#

how do you handle your timeout?

pale vessel
solemn leaf
#

.catch

pale vessel
#

can you show your code

solemn leaf
#
message.channel.awaitMessages(filter2, { max: 1, time: 30000, errors: ['time'] })
                .then(collected => {
                    console.log("hh")
                    const channel = mentions.channels.first().id || message.channel.id
                    message.reply("Great now please give me what you want it to say!\n{username} for the user's name, {guildname} for the guild's name!").then(async (msg2) => {
                        message.channel.awaitMessages(filter2, { max: 1, time: 60000, errors: ['time'] })
                            .then(collected2 => {
                })
                .catch(collected => {
                    message.reply('Timed out, please restart.');
                    return
                });
#

I had to cut stuff out

tribal siren
solemn leaf
#

so remove channel?

#

@tribal siren

tribal siren
#

wdym

pale vessel
#

hmm

solemn leaf
#

hmm

tribal siren
#

hmm

tribal siren
solemn leaf
#

message.await

#

that

#

remvoe channel

pale vessel
#

it doesn't matter, it's the same channel

austere zealot
#
@client.command()
async def ull(ctx):
    await ctx.send("Timer set for 20 secs!")
    await asyncio.sleep(20)
    await ctx.send(f"{ctx.author.mention}, You can swap now!")
``` this is a part of my code and i already have a code for gb, so when i type gb it sets a timer for 8 secs and this is the same thing but its for fishing so i want it to set a timer for 20 secs but to catch the poke you have to do gb so it also sets a timer for 8 secs..so what should i do?
solemn leaf
#

@pale vessel what else cna I do?

#

flaze?

pale vessel
#

you should do some cleaning on your code

#

use await instead of then()

#

it makes everything look better and easy for you to understand/troubleshoot

solemn leaf
#

I could make a fucntion for each one

#

and what

#

dont you do .then for it to do it after?

pale vessel
#

await does that too```js
send("Pick an option");

try {
const firstResponse = await channel.awaitMessages(filter1, options);
firstResponse.first().content;

const secondResponse = await channel.awaitMessages(filter2, options);
secondResponse.first().content;

}

catch { send("Timeout, please try again."); }```

solemn leaf
#

okay

#

give me 30 misn to get back to you to rewrite eveything

gilded olive
#

Confusion

#

Sounds like you want a custom timer?

#
@client.command()
async def count(ctx, timer: int) -> int:
       await ctx.send("")
       await asyncio.sleep(timer)
       await ctx.send("")```
#

(Ofc import asyncio)

earnest phoenix
#

hh that annotation

gilded olive
#

IDE support PoggersHype

earnest phoenix
#

but the thing is, you don't return anything lol

gilded olive
#

meh

#

I just like sweet autocompletion

austere zealot
# gilded olive What?

ok so..you type ;p and then gb to catch it, and then theres a cooldown for the command, for that i want to make a timer which will notify the author that they can spawn a pokemon and i already have a timer bot gb, and now im trying to make a timer for ;fish command which has a 20 sec cooldown but in that you also need to use gb to catch it. So my gb timer is for 8 secs and the fish cooldown is 20 secs, and so when i type gb it sets a timer for 8 secs and 20 secs

#

gb = greatball

#

basically trying to make a timer bot for an another pokemon bot which has a cooldown between commands

earnest phoenix
#

could you just wait_for a command before actually sleeping for 20 seconds?

solemn leaf
#

@pale vessel it insta timed out

earnest phoenix
#

is gb a command or

solemn leaf
#

flaze playing osu great

austere zealot
earnest phoenix
#

so ;p is awaiting for gb message?

austere zealot
#

no lul

#

theres an 8 sec cooldown after you catch the poke

earnest phoenix
#

lmao, I don't really get it

solemn leaf
austere zealot
#

im trying to make a timer for the cooldown so that it notifies the person that they can do ;p again

#

and so theres another command called ;f which has a 20 sec cooldown but uses the same thing to catch it which is gb

#

greatball*

solemn leaf
#

Cannot access 'channel' before initialization

earnest phoenix
#

uh could you send the p command? Perhaps I can understand what you want to achieve better.

austere zealot
earnest phoenix
#

sure

gilded olive
#

Basically

#

When a cooldown is finished, it will notify the user?

solemn leaf
#

@pale vessel how do I get messages mentions from the .frist()

#

first()

pale vessel
#

first().mentions?

solemn leaf
#
const channel = firstResponse.first().mentions.channels.first().id || message.channel.id
tribal siren
#
`**Members with the Role (${message.guild.members.cache.filter(m => m.roles.cache.some(role.id)).size} / ${message.guild.members.cache.size}):** ${message.guild.members.cache.filter(m => m.roles.cache.some(role.id)).map(r => r.join(", "))}````
#

something's wrong

#

i mean i know what's wrong

pale vessel
#

array.some takes a function

tribal siren
#

fn is not a function

solemn leaf
#

flaze?

pale vessel
#

show your code

solemn leaf
#
            const firstResponse = await message.channel.awaitMessages(filter2, { max: 1, time: 30000, errors: ['time'] });
            const channel = firstResponse.first().mentions.channels.first().id || message.channel.id

            message.reply("Great now please give me what you want it to say!\n{username} for the user's name, {guildname} for the guild's name!")

            const secondResponse = await message.channel.awaitMessages(filter2, { max: 1, time: 30000, errors: ['time'] });
            const welcomemessage = secondResponse.first().content.replace(/\{guildname\}/g, message.guild.name).replace(/\{username\}/g, message.author.displayName);

Collection(0) [Map] {}
TypeError: Cannot read property 'id' of undefined

tribal siren
#

oof

#

try doing this

pale vessel
#

add console.log(firstResponse.first().mentions.channels) before const channel

#

oh

#

you did that

tribal siren
#
const channela = firstResponse.first().mentions.channels.first() || message.channel
const channel = channela.id```
solemn leaf
#

brace

#

that is the same as

pale vessel
#

not quite

tribal siren
#

that looks more trustworthy

pale vessel
#

if channels.first() doesn't exist, it will error since it can't read the property id from undefined

tribal siren
#

yes

solemn leaf
#

ok

pale vessel
#

(firstResponse.first().mentions.channels.first() || message.channel).id would be safe to use

solemn leaf
#

wot

pale vessel
#

that is if firstResponse.first() exists (the user responded)

solemn leaf
#

you can do that

#

epic

#

seems to have worked

#

but my username is undefiend

#
const welcomemessage = secondResponse.first().content.replace(/\{guildname\}/g, message.guild.name).replace(/\{username\}/g, message.author.displayName);
#

#meeting, undefined ℂ𝕙𝕒𝕟 ℂ𝕦𝕝𝕥𝕤

zenith terrace
#

why not just message.author.tag

solemn leaf
#

what if I want display name

zenith terrace
#

does the user have a nickname?

pale vessel
sacred trout
#

does anyone know any spotify api for py?

zenith terrace
sacred trout
#

lol

zenith terrace
#

idk do a google search

delicate shore
#
app.get("/random/meme", async (req, res, next) => {
    try{
         new Promise(async (resolve) => {
            giveMeAJoke.getRandomDadJoke(function(joke) {
                res.json([resolve(joke)])
            })
        })

    }catch(err){
        console.log(err)
    }
   });
#

Why

#

oh wait

#

Do I need to await it?

trim saddle
#

idk what that is

earnest phoenix
#

that joke package is garbage

delicate shore
#

Yes I know

earnest phoenix
#

why not just use node-fetch directly to call the apis

trim saddle
#

using packages for minimal apis is usually a bad idea

delicate shore
#

🤔

trim saddle
#

because if you do it yourself it's easier to optimize

delicate shore
#

I have never worked with express yk

earnest phoenix
#

that way you can just

const r = await fetch(...);
res.json(await r.json());
delicate shore
#

what you mean?
I fetch from another site?

#

and then put it on my site?

trim saddle
#

yes?

earnest phoenix
#

yes

#

that's what that package does

#

but worse

#

lol

delicate shore
#

Like this

earnest phoenix
#

sure

delicate shore
#

Pog it worked

young flame
#

    const evalOutput = [];

    if (res.callbackOutput) {
      evalOutput.push(
        "-[ Eval Output ]---------",
        typeof res.callbackOutput === "string" ? res.callbackOutput : inspect(res.callbackOutput)
      );
    }

    if (res.stdout) {
      evalOutput.push(
        "-[ stdout ]--------------",
        typeof res.stdout === "string" ? res.stdout : inspect(res.stdout)
      );
    }

    if (res.stderr) {
      evalOutput.push(
        "-[ stderr ]--------------",
        typeof res.stderr === "string" ? res.stderr : inspect(res.stderr)
      );
    }

    const body = await fetch("https://hastebin.com/documents", {
      method: "post",
      body: evalOutput.join()
    })
      .then(async (res) => await res.json());

    await msg.edit({ embed: embed.addField(":notepad_spiral: Hastebin", `https://hastebin.com/${body.key}`) });
  });
#

idk why it no workkk

pale vessel
#

it hardly works

young flame
#

ive tried changing the code altogether but then it instantly gives me a error H

pale vessel
young flame
pale vessel
#

yes

young flame
#

whats thaat

rustic nova
#

i just use my self-hosted pastebin

pale vessel
#

just another hastebin server

pale vessel
young flame
#

how would i hook it up to that tho

pale vessel
#

ya

young flame
#

or do i need the document thing

pale vessel
#

just change the domain

young flame
#

kk

#

keep the document thing right

pale vessel
#

yea

young flame
#

bet

pale vessel
#

but it's for an exec command? it might contains sensitive info

#

so be careful/self host

young flame
pale vessel
#

eval is different

young flame
#

but i already put in failsafes

pale vessel
#

all right

young flame
#

well execute command lol

#

1 of them is that every time its ran it calls a function that scans everything for sensitive info

#

like the bots token ect

#

so it always gives a heads up

pale vessel
#

pogpog

young flame
rocky hearth
#

@delicate shore u can't use async function in Promise contructor.

young flame
#

would that give a rejection because its calling a function in a promise

#

wouldn't

delicate shore
#

ah

rocky hearth
#

u no need to do new Promise stuff

young flame
#

before it wouldn't send anything and after id get a error in my console

pale vessel
#

i got that haste url from cry

young flame
#

yeeeee

delicate shore
young flame
#

well that part of the eval

#

most of it is just me testing out shit and it working on accident

#

i would make it embed only but it breaks the bot since it pre loads everything

rocky hearth
#
app.get("/random/meme", async (req, res, next) => {
    try{
         const val = await fetch('your link to resource')
            .then(res => res.json());
    }catch(err){
        console.log(err)
    }
   });

@delicate shore

delicate shore
#

yes, I am doing with that atm

#

any idea how can I yk
do it with npm packages like that

pale vessel
#

const val = await (await fetch('your link to resource')).json();

delicate shore
#

npm package

#

ok nvm I will do with node-fetch only

rocky hearth
#

its the saame for, every fetchable link or npm packages

young flame
#

why didnt you use node-fetch to begin with

#

or super whatever its called

pale vessel
#

node-superfetch?

young flame
#

yeee

pale vessel
#

i think xiao uses that

young flame
#

its good lol

pale vessel
#

it's like superagent

young flame
#

i would use if if my bot isn't a economy bot with decent music commands

#

also fuck lavalink

#

i read the docs 4 times when all i had to do was copy someone elses code

earnest phoenix
#

lavalink is a piece of garbage

#

glorified ffmpeg

young flame
#

IKR

rocky hearth
#

y though?

young flame
#

ytdl core sucks but dang

earnest phoenix
#

in .net we have youtubeexplode

#

super fast

#

youtubeexplode + ffmpeg is my best combo for music streaming

pale vessel
mellow kelp
#

does it explode tho

pale vessel
#

fuck i pinged

earnest phoenix
#

its fine

rocky hearth
#

r u guyz familiar with Next.js?

pale vessel
#

hmm I've only tried cra

young flame
mellow kelp
#

at least i've done some small projects

rocky hearth
#

ohh, so I wanted to know, is next.js is similiar to how we used to build sites with php?

mellow kelp
#

cries in no php experience

#

well at least i can make out some stuff

earnest phoenix
#

hey im 13 and started coding at 12 idk y but when i started it i couldnt stop i do html & css i do bot dev and thats it

mellow kelp
#

you can make dynamic routes for example

#

with php i think you would need query params or something

rocky hearth
earnest phoenix
#

php in 2021 KEKW

mellow kelp
rocky hearth
#

why people troll, php so much.?? 😆

mellow kelp
#

you can get query params in getServerSideProps iirc

rocky hearth
#

so nextjs has nothing to do, with client side rendering.?

earnest phoenix
#

plus there's much better and more performant alrernatives to php today

drowsy grail
#

strlen()

#

pog u

mellow kelp
#

oh nvm

#

well kinda

drowsy grail
#

hey, for some reason I keep getting an empty Permissions bitfield with this in discord.js

let channel = await msg.guild.channels.fetch(msg.channel.id)
return channel.permissionsFor(msg.author)

same goes for msg.member and msg.author.id, am I doing something wrong here?

mellow kelp
#

i think there are a couple of cases which still need client side rendering

crimson vapor
#

ive never understood php, is it like nodejs but no running process and everything is computed on the fly?

mellow kelp
#

kinda

#

i never understood it either

crimson vapor
#

ik the language and syntax is different

#

but it seems very cool for static sites

earnest phoenix
#

it's deeply integrated with web rendering

#

but it's absolute garbage nowadays

rocky hearth
#

we all hate php, but still it runs on majority of the sites today... 🤦‍♂️

mellow kelp
#

unfortunately, that is

earnest phoenix
#

the only people who use it are ones who got scammed by buying a web host where you don't have full access to the server

pale vessel
#

Especially WP, which is a slow hot piece of garbage

earnest phoenix
#

ugh i hate wp

mellow kelp
#

whats wp

pale vessel
#

Backdoor extensions

drowsy grail
#

wordpress

pale vessel
#

Insecure

#

hell no

mellow kelp
#

oh shit no wp

pale vessel
#

I would rather use something like Ghost

mellow kelp
#

how's vercel for next.js sites?

#

i tried it out and it seemed pretty cool

earnest phoenix
#

And this is a segway to our sponsor, Squarespace

pale vessel
#

Can you export the static files from Squarespace?

earnest phoenix
#

dunno

#

never took interest in those sites

rocky hearth
#

if we remove wp, from this world. How much php sites would be left behind.?

earnest phoenix
#

probably still a huge amount

#

companies still run it