#development

1 messages · Page 1978 of 1

sudden geyser
#

What's special about them is they sync instantly, so there's no up to 1 hour grace period.

blissful falcon
#

Yea.

#

But I'm not finished all my commands, so I need to update that thing to what in order for the guild commands to register instantly?

sudden geyser
#

The front page does show an example with them, but you'll need to fill out GUILD_ID

await rest.put(Routes.applicationGuildCommands(guildId, GUILD_ID), { body: commands });
blissful falcon
#

Alright, thanks!

spark flint
#
<script>
  async function addUser() {
    const { value: userid } = await Swal.fire({
      title: 'Enter user id',
      input: 'number',
      inputLabel: 'User ID',
      showCancelButton: true,
      inputValidator: (value) => {
        if (!value) {
          return 'You need to enter a user id!'
        }
      }
    })
    if (userid) {
      const { value: reason } = await Swal.fire({
        title: 'Enter blacklist reason',
        input: 'text',
        inputLabel: 'Reason',
        showCancelButton: true,
        inputValidator: (value) => {
          if (!value) {
              return 'You need to enter a reason!'
          }
        }
      })
      if (reason) {
        $.ajax({
            url: "/addUser",
            type: "post",
            dataType: 'json',
            data: JSON.stringify({userid, reason}),
            success: function(result) {
                console.log(result)
                document.getElementById("userCount").innerText = Number("<%= users.length %>") + 1
                const Toast = Swal.mixin({
                  toast: true,
                  position: 'top-right',
                  iconColor: 'white',
                  customClass: {
                    popup: 'colored-toast'
                  },
                  showConfirmButton: false,
                  timer: 1500,
                  timerProgressBar: true
                })
                await Toast.fire({
                  icon: 'success',
                  title: 'Success'
                })
            }
        });
      }
    }
  }
</script>```
#

have i gone stupid

#

Uncaught ReferenceError: addUser is not defined

#

i removed all and made it do alert("test") and it worked

#

so its a code issue

sudden geyser
#

is the function loaded by time you use it

#

I think script tags behave a bit differently

spark flint
#

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> is at the top

sudden geyser
#

I'm referring to the addUser function

earnest phoenix
#

I do not understand animations in css at all 😔

sudden geyser
#

since that clearly doesn't exist in whatever area

spark flint
sudden geyser
#

I don't even know css and don't want to know it exists

spark flint
#

its at the bottom of the page before </body>

earnest phoenix
#

All I am trying to do is have a link change color on hover but not instantly

earnest phoenix
#

I tried using a transition but I have 0 clue of how it works

sudden geyser
spark flint
#

it works with other code

#

in the same position

spark flint
#

like that

#

that works

#

(just tested)

earnest phoenix
#

Mmm that doesn't work for me but I figured it out

#
    .link {
      transition: color 0.3s;
    }
    .link:hover {
      color: red;
    }
#

Apparently that tells it ye use that prop on whatever is using it e.g hover

spark flint
#

did you do class="link"

#

on those links

earnest phoenix
#

I did apply it to my nav links yes

#

but Igot it working anyway

spark flint
#

alr

earnest phoenix
#

I also fixed my nav bar

#

which one do you think

#

The border shadow on 2 is darker

spark flint
#

aren't both identical

#

oh

#

1

earnest phoenix
#

Yea I thought so as well just wanted a second opinion

eternal osprey
#

hey i have made this little quiz for friends, the question1 is always the right answer. How can i actually randomize it's place, from 1. 2. and 3.? js .setDescription(`Which one is the lie about ${user.username}:\n1. ${question1}\n2.${question2}\n3.${question3}.Type the number *1, 2 or 3* below to guess!`)

quartz kindle
#

how do you define the questions?

eternal osprey
#

User inputs

spark flint
#
          $.ajax({
              url: "/addUser",
              type: "post",
              contentType: 'application/json',
              data: JSON.stringify({userid, reason}),
              success: function(result) {
                const Toast = Swal.mixin({
                  toast: true,
                  position: 'top-right',
                  iconColor: 'white',
                  customClass: {
                    popup: 'colored-toast'
                  },
                  showConfirmButton: false,
                  timer: 1500,
                  timerProgressBar: true
                })
                if (result.err) {
                    await Toast.fire({
                      icon: 'error',
                      title: `Error: ${result.errmsg}`
                    })
                }
                else {
                  await Toast.fire({
                    icon: 'success',
                    title: 'Success'
                  })
                }
              }
          })```
#

is that formatted wrong

#

because its not working pain

#

when i remove the "success: function(result)"part of the code it works

#

ok i'm a fucking dumbass

#

i fixed it

vivid fulcrum
#

why are you using ajax anyways

spark flint
#

because

#

yes

modest maple
#

thats no excuse

quartz kindle
lament rock
spark flint
#

it works now

#

i just forgot async

lament rock
#

Cool

atomic kindle
#

right @spark flint

earnest phoenix
#
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! disbots@1.3.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the disbots@1.3.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-02-13T05_07_16_737Z-debug.log
exit status 1
 
#

Anyone know how to fix?

atomic kindle
earnest phoenix
# atomic kindle This error log does not provide any valuable information to work with. Try runni...
/home/runner/Disbots-2/index.js:1
x/*=======================================================================================*/
^

ReferenceError: x is not defined
    at Object.<anonymous> (/home/runner/Disbots-2/index.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
wheat mesa
#

lmfao what

earnest phoenix
wheat mesa
#

show your code

earnest phoenix
atomic kindle
#

Yes.

wheat mesa
#

show line 1 of index.js

#

or preferably more than line 1

atomic kindle
#

This is line 1.

wheat mesa
#

I'm aware

atomic kindle
#

You have an un-escaped character there. Remove it.

earnest phoenix
#

idek how that came, i must have typed random stuff while sleeping

wheat mesa
#

it's very obvious that he just typed x at the top

lament rock
#

I "love" helping people who don't know anything about their language or coding in general. Trying to teach someone how to think in terms of logic is "really fun"

#

teaching the concept of types should also be simple, but people usually have difficulty with it

earnest phoenix
#

what is the difference between computer science and software development

lament rock
#

Comp sci can teach hardware components and their logical approaches as to how we got from then to now. Also the concept of firmware

#

Comp sci does mostly focus on software development though, since that's what most people are after other than the pink thigh highs

#

I learned how DDR ram came around and their generational improvements

#

At the time, I was somewhat hoping they'd cover firmware or OS dev since that's what I originally wanted to get into, but coming out of it and knowing what I do now scares me to think how tf someone would try to teach that

rigid maple
#

thank you so much Tim i was trying to get around this problem for 6 hours

round cove
round cove
woeful pike
#

Comp Sci is usually theory backed with a tiny bit of practical application of code written like were in 1993

slender thistle
#

Pretty much

woeful pike
#

great work Anthony however I took some points off because you used 21st century patterns in your code

round cove
#

"You used C++23. However, we only allow C++98 here. Therefore you failed"

woeful pike
#

next time please do not be excited by the class material I'm teaching or attempt to learn more by reading ahead

slender thistle
#

This actually reminds me

#

I had to blindly guess the C++ standard an old friend of mine used by literally trying out all of them going back all the way to 98

#

They were taught C++98 in some engineering degree

round cove
#

My uni teaches 98 lmao

#

and I TA'd 98 for almost 4 years

#

What a fun time

#

We taught C with classes basically

cinder patio
#

Unis are a joke

wicked pivot
#

google docs work ?

#

And what should the terms of use contain?

marble juniper
#

they require you to have a terms of service and privacy policy now

#

terms of service describes how users can use your bot

#

privacy policy describes what data you collect

#

as well as how long you store it etc

split hazel
rocky hearth
#

what happen if I try to set topic in voice channel. Will the topic persist?

boreal iron
earnest phoenix
#

set it to goggle.com to do a considerable amount of trolling

rigid maple
#

what can I do ?

eternal osprey
#

hey i have made this little quiz for friends, the question1 is always the right answer. How can i actually randomize it's place, from 1. 2. and 3.? ```js

.setDescription(Which one is the lie about ${user.username}:\n1. ${question1}\n2.${question2}\n3.${question3}.Type the number *1, 2 or 3* below to guess!)```

woeful pike
#

use an array and shuffle

#

as a rule of thumb, if you have variable names that end in numbers you're probably doing something wrong

#

in this case you can generalize your problem by putting answers into an array and shuffling them and formatting it into a string later

quartz kindle
#

i asked you yesterday to show how you define question1, question2 and question3

woeful pike
#

that's what I was gonna ask hahah

boreal iron
spark flint
boreal iron
wanton wraith
#

can anyone help me how to reply when the button is clicked?

boreal iron
#

You will receive a button interaction object with your event listener

wanton wraith
#

?

boreal iron
#

Did you already create a listener for the interactionCreate event?

wanton wraith
#

not yet

boreal iron
#

Well then go for it

#

Without listening for interaction events you won’t get far freerealestate

wanton wraith
#

I'll show you the code and you'll help me finish it

#

ok?

dry imp
#

fake, good luck

boreal iron
#

I’m on mobile, I guess it will get wild

dry imp
#

fake can you also help me build the next facebook

wanton wraith
#
const client = new Client({ intents : 32767 })
const prefix = "!"
client.on("ready", async() => {
    console.log("bot is online")
})


client.on("messageCreate", async message => {

    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const command = args.shift();

    if(command == "ping") {
        message.channel.send(`:ping_pong: pong! ${client.ws.ping} ms.....`)
    }

if(command == "button") {

        const embed = new MessageEmbed()
        .setTitle("These are some discord buttons")
        .setColor("GREEN") ..................
quartz kindle
#

wheres the rest of it? perhaps the archives are incomplete?

boreal iron
#

Instead of listening to the messageCreate event you will have to create an event listener for interactionCreate

wanton wraith
#

ok i will try

boreal iron
#

Ignore the dude called Tim, he’s a known troll but we can’t get rid of him since he invented JS

quartz kindle
boreal iron
#

Oh oh, we made him angry

earnest phoenix
dry imp
#

messageCreate topggPensive

#

on_message topggPensive

boreal iron
dry imp
#

god please be soon

boreal iron
#

Aye no more NSA bots

#

Stealing our chats, yaay

#

Except it gets the intent for

dry imp
quartz kindle
#

MESSAGE_CREATE > *

split hazel
#

i wonder if you can get self bots to work in djs just by setting the token from BOT to user or whatever the prefix for user tokens are

#

asking for a friend

quartz kindle
#

pretty sure you can

#

but could possibly lead to insta ban

split hazel
#

meh do they really check

quartz kindle
#

only one way to check :^)

split hazel
#

but then you can uh fake the user agent?

#

unless its something else

quartz kindle
#

theres also the lib string in the identify

split hazel
#

i'll remove that i mean he will remove that

quartz kindle
#

xD

split hazel
#

just trying to have some fun tho

#

no nefarious reasons

quartz kindle
#

do it on a fake account

split hazel
#

well yeah what im already doing

quartz kindle
#

or better yet, do it on FakE's account

split hazel
#

i will

#

need to phish him first

split hazel
#

if someone stole your token they could do that to ban you

#

but then ah they'd rather have you banned than have you spam send dms or something

#

also discord recently told eris to remove all selfbot support

#

not like it worked anyways

quartz kindle
#

yeah if someone stole your token, you'd have bigger problems

split hazel
#

discord isnt doing that much to stop self bots

#

they could do a lot more

#

its annoying and time consuming reverse engineer apis so they could use that to their advantage

#

even if its changing something like "content" to "value" it could stop a lot of attacks

#

but then old clients would die lmao

#

nvm

#

honestly just setup traps idk and ban on the slightest inconsistency

quartz kindle
#

honeypots are very effective

#

i use them to protect html forms for example

woeful pike
jovial nexus
#

Does someone know why docker keeps throwing me this error? /bin/sh: 1: [npm,: not found
this is what i have:

woeful pike
#

it's the reason why so many votebots still exist on topgg. I could make it crazy difficult to vote with bots but it would also be crazy difficult to get legitimate votes in and would piss everyone off

sudden geyser
#

And self bots will just update the value

#

And old clients of actual users may just stop working

woeful pike
#

yep, when you're fighting against bots there are so many things that make your life difficult

jovial nexus
woeful pike
sudden geyser
#

Like, that's like going "oh, I'll just rotate this string by one character and hope anyone who manages to break in is stupid enough to not figure out how to decrypt it"

modest maple
#

have you actually built your image off of the node image?

#

also be wary of doing a COPY . . without having a .dockerignore to stop it trying to copy things like your node_modules folder

woeful pike
solemn jolt
#

hello guy im try to open share screen by selfbot i use this code frome discord.js-selfbot but this is dont work

client.on("message", async (message) => {
  if (message.author.id !== "920038866621177927") return;
  let args = message.content.split(" ");
  if (args[0] === "~play") {
    const connection = await message.member.voice.channel.join();
    const stream = await ytdl(
      args[1],
      {
        stream: true 
      },
      {
        quality: "94",
      }
    );
    connection
      .play(stream, { seek: 0, volume: 1 })
      .on("finish", () => message.member.voice.channel.leave());
    console.log("playing");
  }
});
modest maple
#

oh nice self bot bro

sudden geyser
#

Yes, but using that in areas where genuine security is required is what I'm talking about

#

Like your password

modest maple
#

what??

woeful pike
#

you can't really stop bots like that tho

solemn jolt
earnest phoenix
#

dont use selfbot 😬

woeful pike
#

I think the easiest way to raise the bar significantly is to completely block clients through tls fingerprints. I'm curious why cloudflare doesn't use that heuristic to stop anyone connecting with a user token not on a browser

vivid fulcrum
#

trust me, you can't screeenshare through djs

woeful pike
#

surely there must be a good reason but I don't know what that is

vivid fulcrum
#

or any other lib really

solemn jolt
vivid fulcrum
#

no lib has video streaming implementation

solemn jolt
#

this is bad

woeful pike
#

just stop making selfbots you nerd

earnest phoenix
#

lol

solemn jolt
vivid fulcrum
#

video streaming is undocumented and it's way too much effort to reverse engineer it, so nobody bothered to implement it

modest maple
#

Except me verycool

woeful pike
#

why risk losing your account

modest maple
#

but you gotta pay me to tell you how it works WICKED

boreal iron
#

damn capitalism everywhere

vivid fulcrum
#

discord won't do anything to your account unless you actually start affecting other people (i.e. mass dm)

solemn jolt
#

come to prv😂

royal herald
#

how do i make the imput a fa icon?

modest maple
solemn jolt
vivid fulcrum
#

even if you got told how it works you probably wouldn't understand it

modest maple
#

because I am a mean individual who doesn't like people self botting :P

boreal iron
royal herald
modest maple
#

😛

woeful pike
#

reverse engineering a webrtc connection sounds fun

#

for the first 30 seconds

solemn jolt
vivid fulcrum
#

bet

#

you won't do it lol

boreal iron
vivid fulcrum
#

you're underestimating the technologies used and their flow

#

it's not as rainbows and sunshines as just using djs

modest maple
#

oh yeah

solemn jolt
modest maple
#

you dont touch a discord lib at all

solemn jolt
modest maple
#

you will spend most your time working with a WebRTC client and dealing with all the handshakes around that

woeful pike
#

hacker time to find out where they hid the video streaming code in the discord.js codebase

solemn jolt
#

but i have othe package to get a chrome tab i use this

modest maple
vivid fulcrum
#

dumb people will stay dumb because they think they're the smartest
smart people will stay smart because they know they're not the smartest

solemn jolt
#

ok guy ill work on it i need to create it for tomorrow

vivid fulcrum
#

🤷‍♂️

woeful pike
#

passing screen inputs to puppeteer so you can stream random shit on a headless browser 5Head

vivid fulcrum
#

been there done that

#

the only problem is logging into discord

solemn jolt
woeful pike
#

oh I mean you log in once and save a session

vivid fulcrum
#

good point

#

i tried a hacky way at first

woeful pike
#

userDataDir bois

vivid fulcrum
#

storing a token in localStorage

solemn jolt
#

and now im in 2 discord derver that have this bot

woeful pike
#

hello how do I get my selfbot verified by discord so ppl can add it to their server

earnest phoenix
boreal iron
woeful pike
modest maple
#

always suprises me about the intelligence of discord users

vivid fulcrum
#

i get infuriated

boreal iron
# royal herald its a form

You can also go totally crazy by applying the font family to your input tag
<input type="submit" class="btn btn-default" value="&#xf7ba;" style="font-family: 'Font Awesome 6 Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;"/>

#

But I would suggest to use the button as I mentioned above

woeful pike
#

help prometheus isn't reading metrics from my services

#

feelssighman webserver where

#

bruh why are my logs out of order

#

wait no I'm just... reading it in the wrong order omg kill me

modest maple
#

a slightly scary piece of rust code

slender thistle
#

Uhhh

#

I'm scared

modest maple
#

bit nicer

boreal iron
#

The background actually is more scary than the code

modest maple
#

nah

#

love this background

split hazel
#

@quartz kindle trying to get it to work i just found out something

#

gateway intents ALSO work for user accounts

#

if you dont provide any you wont get any events

sudden geyser
#

and where is it from

modest maple
#

Sword art online

split hazel
#

probably a bug

woeful pike
#

no material theme, literally unusable

sudden geyser
#

material SumiCringe

split hazel
#

you must find another community

#

no more javascript for you

#

maybe python will accept you

#

but they hate people that use semi colons

woeful pike
sudden geyser
#

did you get blocked

woeful pike
#

not sure

severe summit
#

Is there a bot spam channel?

sudden geyser
#

there once was

#

now it's gone

#

turned into ashes

severe summit
#

Ok thx

woeful pike
#

not sure how I'm exceeding rate limits 4 hours in between requests

split hazel
#

what is that graph

woeful pike
#

just a scatterplot of individual requests per website

solemn latch
#

Ratelimits of once per day is the best.
All my sites use it.
^_^

woeful pike
#

@modest maple do you use json logging in rust?

modest maple
#

depends on if i need it to or not

gleaming solar
#

how do you get a user with a user id?

modest maple
#

normally I just expose it behind a flag on the runtime with like --json-logs

#

what I do for lnx atleast

sudden geyser
gleaming solar
#

nodejs

sudden geyser
#

so discord.js

earnest phoenix
#

lmao

lament rock
#

I suppose everyone forgot eris existed

sudden geyser
#

fetch will look in the cache for you first

#

if not it'll ask discord for the user by their id

lament rock
gleaming solar
#

Ah ok thx!

split hazel
#

unless you specify in the options you dont want it to cache

sudden geyser
split hazel
#

useful if you need to fetch multiple objects but dont want to store them

split hazel
sudden geyser
#

damn stole the words from me

woeful pike
sudden geyser
#

where's erwin when you need him

lament rock
sudden geyser
#

shameless plug

lament rock
#

I didn't say I'd maintain Discord Libs to not plug them

#

Dealing with Discord's shit is annoying

gleaming solar
#

But the id exists

slender thistle
lament rock
woeful pike
#

how many bots would there be if there were no discord libraries and everyone had to use the api

split hazel
#

a few

wheat mesa
marble juniper
lament rock
#

Good thing I understand how stupid the api is

#

I'd probably spare myself the pain of doing another bot

split hazel
#

yo

#

so like

#

if you were to do map.entries() are results ordered?

#

based on which element was set first

modest maple
#

if its a Map then it's insertion order

#

although I wouldn't ever rely on insertion order of things like that regardless

split hazel
#

say less

quartz kindle
#

1% is already a lot imo

solemn latch
#

It probably depends on what you mean with no libraries.

If example bots exist I bet it wouldn't matter much

cinder stratus
#

But still there would be alot less bots

split hazel
#

how tho

#

if its a hash map the order is based on the output of the hash

#

unless theres an internal object which keeps track of each objects position

#

OR

#

the map is also a linked list

cinder patio
quartz kindle
#

an array of keys plus a hashtable of keys values

split hazel
cinder patio
#

what do you mean lmao

split hazel
quartz kindle
#

or rather, a linked list, as described in the link above

#

since there is no need to access data by index, you dont need a full array of indexes

#

a linked list is enough to iterate in order

split hazel
#

i went through so many segfaults to implement a working linked list

quartz kindle
#

xD

rough current
#

In discord.py is there a way to stop users from spamming commands and gettings the bot API banned?
I've added cooldowns but i'm not sure if it works for the API bans

quartz kindle
#

make cooldowns per channel

rough current
#

Do the e.g @commands.cooldown(1,15,commands.BucketType.user) work for API bans

#

Like do they count as a API request

sudden geyser
rough current
#

error 419

#

discord

sudden geyser
#

alright

#

do you happen to use a host like repl.it as well

rough current
#

Or 429 cannot quite remember

sudden geyser
#

429

sudden geyser
#

then your api ban may be due to other bots as well

#

since repl.it clusters projects under the same host, a different bot may spam the api and get you banned

#

despite you not being the one actually spamming the api

rough current
#

Could this get my discord it's self banned?

#

For spam or something

#

Or only IP based

sudden geyser
#

pretty sure only ip bans

#

but discord can step in and do more if they want

lament rock
#

only ip bans

#

requests are made under a token

#

tokens exceeding rate limit buckets are more prone to bans

#

although, if the lib handles buckets properly, it's really hard to hit buckets unless it's intentional or sharding at a large scale

rough current
lament rock
#

If you don't reply to people who are on cooldown and just return, then no requests are made. The user input is ignored

rough current
#

So I should not make a @command.error?

lament rock
#

see if dpy has cooldown handling

#

and how it handles it

rough current
#

Okay ty for ur help

marble juniper
#

Real chads code in COBOL

#

change my mind

split hazel
lyric mountain
split hazel
#

question are bots required to be connected to the gateway to send messages?

round cove
#

No?

earnest phoenix
#

How can I do something like this:

Like I have a object with all the cards possible in the game and with their arena, ability, name...
And I have a array that calls the owned cards from my db, and it's another array with only names, e.g ["Giant", "Archer", ...]. If I want to get all owned cards arena, how do I get it? I know that I have to check it from the object but how's it with multiple entries

split hazel
#

reason i dont want to use webhooks is because i want to edit messages as well

round cove
#

People make serverless bots

split hazel
#

o

#

i'll try it

split hazel
#

im guessing that wont really fly with discord.js since objects need to be cached

earnest phoenix
#

sqlite (quick.db)

lyric mountain
#

what's the primary key for the cards?

earnest phoenix
#

all

lyric mountain
#

no

#

the primary key, as in, what do you use to identify each card?

earnest phoenix
#

a name

#

in lowercase

#

it's in the object

lyric mountain
#

and where do you store what cards each player have?

#

a third table or an array within a column?

earnest phoenix
#

?

lyric mountain
#

how do you know what cards each user has?

earnest phoenix
#

I store it in another table (i think), every time a player gets a card it puts the card as true (owned) and it pushes in the table

lyric mountain
#

why do you have an owned value at all?

#

like, do you have a diagram of ur database so I can understand the actual scenario?

earnest phoenix
#

wait

#

i'll draw something

lyric mountain
#

some database tools have a diagram generator (just saying)

cinder patio
#

He's using quick.db

#

which in turn is using sqlite

lyric mountain
#

yes

split hazel
lyric mountain
#

I just need to understand his structure

split hazel
#

iirc discord made it so you have to connect to the gateway every once a while in order to be able to send messages

modest maple
#

eh?

split hazel
#

otherwise it returns a 401

modest maple
#

no?

#

You can run bots entirely without connecting to the gateway now

#

this is the entire point of slash commands and HTTP

split hazel
#

let me try

lyric mountain
#

you don't even need to add bots to the server

split hazel
#

oh maybe its because my permissions dont work lmao

cinder patio
sudden geyser
#

In Python, is there a shorter way to express "if x, x, else raise"? Take this for example:

if ctx.author.id in whitelist or ctx.author.guild_permissions.administrator:
  return True
else:
  raise UserChecks("You are not whitelisted to use this command.")

I thought I could use or:

ctx.author.id in whitelist or ctx.author.guild_permissions.administrator or raise UserChecks("You are not whitelisted to use this command.")

But that's apparently not valid syntax. I could abstract this away into a function, but is that the only option?

split hazel
#

nope its not permissions

split hazel
#

just hasnt connected recently

#

like 2 years lmao

cinder patio
#

What error is discord giving you?

earnest phoenix
#

this works?

sudden geyser
#

oh god the color

split hazel
#

once i connect it lets me send

lyric mountain
earnest phoenix
#

ok

cinder patio
lyric mountain
#

like, normally you'd have this:

  • User (id, other info)
  • Owned cards (user_id, card_id)
  • Cards (id, name, other info)
#

then when an user collects a card, you'd add in the middle table

#

containing both user ID and card ID

#

no need for a boolean field at all, just check if the card exists there

#

OR you have an array column (not recommended) in user table

#
  • User (id, card_ids, other info)
  • Cards (id, name, other info)
cinder patio
#

I don't think they know what you're talking about. quick.db completely hides stuff like this and just lets you add / remove things from the database. I think it just stores everything as JSON in a single table

#

garbage

cinder patio
#

indeed

slender thistle
#

What the fuck

earnest phoenix
#

this helps?

modest maple
#

please stop using red

earnest phoenix
#

ok

boreal iron
#

My eyes

cinder patio
#

might as well use a single JSON file, lmao, just make sure writes are atomic

cinder patio
# earnest phoenix this helps?

Just use mongo.db if you can't be bothered to learn how to use relational databases. It's as simple and it's 100% better than what quickdb is doing

earnest phoenix
#

yeah but I can't import my data to it

#

or I can?

cinder patio
#

sure you can. Just create a script which gets all data from your current db and saves it to a mongodb one

earnest phoenix
#

how

lyric mountain
#

I refuse to call that sql

earnest phoenix
#

but it sure saves it in a .sqlite file lol

#

in a json.sqlite

#

what's easier, postgreSQL or mongoDB?

cinder patio
#
const allRecords = await db.all();
// loop through all records and add them to your mongo db
#

mongoDB

#

mongoDB is JSON but better

lyric mountain
#

like, the whole thing abt sql is how freedom u have with queries

cinder patio
#

his DB is already fucked up thanks to quick.db, might as well go full JSON

earnest phoenix
#

better I start from 0 and go adding all the data slowly

wheat mesa
#

Mongo is easier, postgres is “better”

earnest phoenix
#

tutorial to incorporate and use mongo?

cinder patio
earnest phoenix
#

ty

wheat mesa
#

From the way I assume your code is set up, swapping to mongo might take a little while

earnest phoenix
#

2 hours?

#

1 day?

wheat mesa
#

Depends on your code

earnest phoenix
#

I have too much time so it's okay

wheat mesa
#

If it’s organized and proper then it wouldn’t take long at all

cinder patio
#

nah. Switching to sql will definitely take longer, considering this person knows nothing about relational DBs, and that they're using quick.db

sudden geyser
#

not even a villain would make that comparison

wheat mesa
lyric mountain
earnest phoenix
wheat mesa
#

I’ve seen the way he has some things set up and I think he makes a lot of unnecessary db calls if it’s what I remember

earnest phoenix
#

my code isn't messy but the db sure is

wheat mesa
#

(Also you’re going to want to implement a cache preferably if you’re using mongo)

#

Depending on what kind of data you need to store

earnest phoenix
#

cache?

void patio
#

Can I ask for UI advice in this channel?

wheat mesa
#

A system so that you’re not making unnecessary queries to your db

wheat mesa
#

Assuming it’s dev related

wheat mesa
#

This is usually done with a Map of some sort, in djs they use the Collection class for caches

#

But I’d focus on getting it working without a cache first, then implementing a cache after

sudden geyser
# lyric mountain how so?

SQL is not an expressive language. When writing small, simple queries, SQL looks like it works until you need something slightly more complex or if you need to change a query. There are many instances where wanting to make minor changes to a query results in 1/3 to 1/2 of the query being rewritten. The standard is huge to the point where no database fully conforms to it, and it doesn't help that every new addition results in more syntax, making the language more verbose and less reusable.

cinder patio
#

use redis if u care about scaling

#

for guild prefixes a Map is fine tho

void patio
#

I feel like the playback control icons are too bold do you guys know any icon libraries?

wheat mesa
lyric mountain
#

I didn't say "smaller" or "simpler", I said "freedom"

wheat mesa
lyric mountain
#

being flexible doesn't mean you need to be small nor simple

cinder patio
void patio
lyric mountain
#

with sql you can manipulate the data however you want before leaving the database, that's what I call freedom

cinder patio
#

you could just use SVGs instead of using icon libraries:

Forward:

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  <path d="M15.5 3.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-1 0V8.752l-6.267 3.636c-.52.302-1.233-.043-1.233-.696v-2.94l-6.267 3.636C.713 12.69 0 12.345 0 11.692V4.308c0-.653.713-.998 1.233-.696L7.5 7.248v-2.94c0-.653.713-.998 1.233-.696L15 7.248V4a.5.5 0 0 1 .5-.5zM1 4.633v6.734L6.804 8 1 4.633zm7.5 0v6.734L14.304 8 8.5 4.633z"/>
</svg>

Backwards:

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  <path d="M.5 3.5A.5.5 0 0 1 1 4v3.248l6.267-3.636c.52-.302 1.233.043 1.233.696v2.94l6.267-3.636c.52-.302 1.233.043 1.233.696v7.384c0 .653-.713.998-1.233.696L8.5 8.752v2.94c0 .653-.713.998-1.233.696L1 8.752V12a.5.5 0 0 1-1 0V4a.5.5 0 0 1 .5-.5zm7 1.133L1.696 8 7.5 11.367V4.633zm7.5 0L9.196 8 15 11.367V4.633z"/>
</svg>
sudden geyser
#

flexibility is not limited to small and simple. but adding more syntax and calling it "flexible" because you can do "more" is not really flexible, since every bit of syntax added requires more input from you and makes queries much harder to write and maintain

sudden geyser
cinder patio
#
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
  <path d="M5 6.25a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0v-3.5zm3.5 0a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0v-3.5z"/>
</svg>

This is pause

lyric mountain
wheat mesa
#

I don’t know SQL very well and an ORM just prevents me from writing horrendous SQL that would probably be exploited

lyric mountain
#

simplicity/complexity and rigid/flexible aren't mutually exclusive

sudden geyser
solemn latch
#

Sql has a lot of freedom

sudden geyser
#

like

solemn latch
#

One of the my sql queries I use for my analytics is like 10-14 lines long 👀

It's not very efficent but it works extremely well.

boreal iron
cinder patio
#

I prefer ORMs tbh. I find it better than just inserting large SQL code inside of a string, but that's just me

solemn latch
#

I use prepared statements anyway.

cinder patio
#

well yeah but the string is still there just not in the middle of ur logic

rough current
#

Does any1 know someone to host a discord bot for free/cheap

sudden geyser
#

replit or heroku if you're willing

cinder patio
#

heruko is pretty good

rough current
#

Okay ty

wheat mesa
#

I’ll say that I never really had issues with Heroku but it’s certainly not something for scaling imo

cinder patio
#

Nah scaling is easy on heruko

solemn latch
#

Heroku scales great

cinder patio
#

but it's pricey

wheat mesa
#

Isn’t it expensive

solemn latch
#

Yep

rough current
#

Is heruko free?

wheat mesa
#

Heroku has a free option yeah

cinder patio
#

You get free dynos each month

#

or whatever they're called lmao

wheat mesa
#

You’ll only get like 21 ish days of uptime per month with one dyno

spark flint
wheat mesa
#

Unless you add a credit card

sudden geyser
wheat mesa
#

Which will give you like 40 days worth of dyno hours per month iirc

spark flint
#

yes

#

only nodejs for now, python soon ™️

cinder patio
#

I wouldn't trust that

rough current
#

I use python anyways

spark flint
#

the gradient is animated btw

#

its not just shitty blue and purple

solemn latch
split hazel
#

fun fact I just learnt: making a djs client with no intents, connecting then disconnecting the websocket makes djs a discord api wrapper without the gateway or events

lyric mountain
sudden geyser
#

I don't think I am.

earnest phoenix
#

I have question that i dont want answer like change hosting
Why bot cant be online when i type node bot.js no error just nothing happens and process wasntt killed

solemn latch
#

Are you doing the client login?

earnest phoenix
#

Yes

#

client.login(process.env.token)
Key = token
Value = my bot token which i get from discord dev portal

sudden geyser
#

I don't care if someone has a 10-30 line SQL query. I care about if that query is simple to modify (hence, flexible, since you can easily change it to meet other needs) and how writing it in the first place went, since it won't matter how much syntax you give me to do x, y, and z when I can barely do any of them.

lyric mountain
#

that's not being flexible

#

that's being adaptive

sudden geyser
#

adaptive is flexible

#

at least, that's what sql is clearly not

lyric mountain
#

no, adaptive is being able to fit multiple needs

#

flexible is being able to handle something with great freedom

sudden geyser
#

they sound similar don't they

lyric mountain
#

nope

#

a language can be very adaptive but strictly rigid

solemn latch
#

Like sqlite?

lyric mountain
#

sqlite is a database, it's just simple

#

like, less data types

sudden geyser
lyric mountain
sudden geyser
#

so adaptive. being able to manipulate the output however you like is a form of adaptation. if you could only manipulate it in this narrow scope (like what happens with sql often), that wouldn't give you much freedom, flexibility, or adaptability

this feels more like a grammar war, which I don't want to get into

lyric mountain
#

adaptive woul be able to use one code for multiple needs

#

or reuse

rough current
#

Can heroku host more than 1 python file

#

And jsons

#

4 free

sudden geyser
#

Anyway, I do mean a form of flexibility. In fact, a dictionary form: "able to be easily modified to respond to altered circumstances or conditions" which sounds, to me, exactly what I'm complaining about. In fact, it sounds very similar to adaptive: "A change that is made or undergone to suit a condition or environment."

lament rock
#

orms are pretty flexible (imo)

sudden geyser
#

to me they aren't, but to others, they certainly are

lament rock
#

Mine is less of an orm and more of just a way to buffer insert statements together

#

but comes with my database layout as typings

eternal osprey
#

Hey how do i let a cron function run once each friday at 9:am sydney time>?

#
cron.schedule('0 0 * * 1', async function() {```
lament rock
#

using maths and setTimeout

eternal osprey
#

I find their docs so damn confusing

eternal osprey
lament rock
#

I run a function every week at tuesday at 00:00GMT by finding how many ms is remaining today and then set a timeout for remainingToday to set an Interval for doing the task

eternal osprey
#

wouldn't cron be a better option?

lament rock
#

Then you have to install another dependency and read their docs which like you mentioned is confusing

#

I think setting up a "cron" manually is easier the way I described

eternal osprey
#

I think that cron is easier and more reliable in terms of events, but yeah their fucking parameters are so damn vague

strong flicker
#

anyone know of a good way to prevent command spamming from bypassing a cooldown if the bot like lags or something?

vivid fulcrum
#

that scenario is highly unlikely

strong flicker
#

True indeed, but it happens and I aint want my users to sell one item 6 times

sudden geyser
#

store the cooldowns in some central place, like a map

#

then check it when the user runs a command

strong flicker
#

we use redis to save it in memory, and we do check

sudden geyser
#

that's a party

vivid fulcrum
#

use your language's equivalent of a semaphore/a lock

earnest phoenix
#

What do I select for bot?

sudden geyser
#

the one that looks easier

earnest phoenix
earnest phoenix
spark flint
#

i host my bot on railway, really good

earnest phoenix
#

👍

solemn latch
#

👀 does discord provide referer headers? No right?

spark flint
#

not sure if still relevant

solemn latch
#

Thought so, thanks

cinder patio
earnest phoenix
#

0.0.0.0 still works?

cinder patio
#

That allows anyone to connect to your db afaik

earnest phoenix
#

oh then still works

#

railway makes different ips for every deployment so with this, it's not a major problem

red valve
#

Morning, can anyone help me with discord permissions for a bot?
Basically I get this error {"message": "Missing Permissions", "code": 50013}
When the bot tries to change everyone role permissions in newly created channels removing their visibility.
I've been banging my head with it for 30 minutes trying different permissions combinations, but the only one that obviously seems to work is admin (8)

vivid fulcrum
#

you need manage channels permission

earnest phoenix
#

how was it to send a log when connected to db?

red valve
#

already has it

vivid fulcrum
#

manage roles?

earnest phoenix
#

client.mongo.connect(console.log("Connected to mongo")) <= this?

red valve
vivid fulcrum
#

thonk

red valve
vivid fulcrum
#

have you tried modifying another role?

red valve
#

What could I add to make it work?

red valve
#

but not other roles

vivid fulcrum
#

i know, have you tried another role except the everyone role

red valve
#

nop

vivid fulcrum
#

try it

#

if it works, you might need admin to modify the everyone role

red valve
#

what if it works?
I need to modify the permissions of everyone.

vivid fulcrum
#

iirc the bot also can't modify permissions it doesn't have

unreal steeple
vivid fulcrum
#

ah

rustic nova
#

modifying the everyone role also requires manage role

spark flint
rustic nova
unreal steeple
#

is there like the style css heartbeat code available like can it still be used?

#

like on the bots profile

solemn latch
#

Css heartbeat? 👀
Like an animation?

unreal steeple
unreal steeple
#

yh but kinda slower

solemn latch
#

You can change the speed in css in the animation

unreal steeple
#

alr ty

unreal steeple
# solemn latch

doesnt work im trying to get it for the profile if that works

solemn latch
#

In what way is it not working?

unreal steeple
#

it shows a heart on the bottom of the Long description but nothing else

solemn latch
#

What is your css?

unreal steeple
solemn latch
#

That's not a heartbeat, that's just moving up and down.

unreal steeple
#

looked like a kinda heart beat for me ig

proven lantern
#

is there a new version of promise.all that does everything and then gives you the results even if there is an error

#

found it

solemn latch
#

I was thinking promise some lol

proven lantern
solemn latch
#

Op, is it?

#

I've never used it, just was a quick Google search

#

AllSettled seems really powerful

proven lantern
#

it'll let you get rid of the try/catch around Promise.all

#

i wonder how new it really is

#

it's probably like 4 years old

sudden geyser
#

it's nice cause try/catch wouldn't even solve the problem

#

since you'd lose all your promises that did succeed

#

or what the errors were

earnest phoenix
#

wtf is bluebird

proven lantern
#

it still is a library

earnest phoenix
#

I see

eternal osprey
#
 const collector = new Discord.MessageCollector(user.createDM() , filter, {``` why is it throwing this error:    if (options.time) this._timeout = this.client.setTimeout(() => this.stop('time'), options.time);
                                                  ^

TypeError: Cannot read property 'setTimeout' of undefined
pale vessel
#

might not solve it, but createDM() returns a promise

proven lantern
#

is there an easy way to see which ecmascript version a version of node is using? does nodejs 14 support ecmascript version 11?

eternal osprey
#

because i am trying to create a messagecollector in my dm

#

but it's not working

pulsar bone
#

make sure systems knows it don't wanna get errors later on

earnest phoenix
pale vessel
#

await the promise and check if it fixes it

pulsar bone
#

yeah

proven lantern
earnest phoenix
#

Those optimizations are done by the V8 engine, and it's actually correct, it still does not support it because it's one of the hardest to implement with all the abstract shifting made in the core of the engine, and the custom language the V8 engine uses AKA Torque

proven lantern
#

maybe they could make like a subset of the language that supports recursion somehow. it's probably a lot trickier than i understand

modest maple
#

massively

proven lantern
#

a lot of features could be removed to simplify it

#

are there certain features that make it more difficult?

earnest phoenix
#

You see, the recursion in the technical terms isn't that simple in case of optimizing such a thing that could cause extensive failures in the other parts of the engine, some recursion methods are proposed to fix this problem and implement it already, but it is still being discussed to this day, the features that could block this from being implemented are mostly in the parsing phases, the syntax sugars that could cause lots of problems

#

This problem was also encountered with the optional chaining operator (?.)

#

This is also the main reason why the pipeline operator (|>) TC39 proposal is not on stage 4 yet, as more and more syntax sugars are added and the syntax gets more complicated, it becomes extremely hard to stabilize with the new features and optimizations

proven lantern
#

i wonder if they could keep track of the features used and then enable the optimizations if only a subset of features are used

#

that might slow it down too much though. idk

earnest phoenix
#

That would add way too much overhead, to initialize a new marker and mark every feature that is unused, and omit them entirely, although this is already done, but partially

eternal osprey
#
if(message.content === "start"){
  const questions3 = [
    `test`,
  ]
  
      let counter3 = 0
      const filter3 = (m) => {
        return m.author.id === message.author.id
      }
  //verander deze naar dm en ga dan alles ook voor firstmember doen
  const channel = message.channel;
      const collector3 = channel.createMessageCollector(filter3, {
        max: questions3.length
       
      })
  
      message.member.send(questions3[counter3++])
      collector3.on('collect', (m) => {
        if (counter3 < questions3.length) {
          message.member.send(questions3[counter3++])
         
        }
      })
  
      collector3.on('end', (collected) => {
      
     console.log(collected)
  
  })
}```I still can't get this to collect the messages in the dm
#

i mean, the message.channel includes dmchannels too right? What am i doing wrong

earnest phoenix
#

The <TextChannel>.createMessageCollector() method takes a single parameter, an object with options you should specify

woeful pike
#

god trying to setup prometheus has been a huge hassle so far

proven lantern
#

Maybe a flag like "use strict" could let the engine know to use optimizations and let it fail when the rules are broken

eternal osprey
#

But it just doesn't get info from the dm

#

This is v12 btw

earnest phoenix
#

Oh god...

#

Why are you still using v12?

eternal osprey
#

idk i am too lazy to upgrade to v13 not going to lie

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

You're risking a breakage, v12 will stop working soon entirely

eternal osprey
#

i will change it soon, but for now i am trying to fix this

proven lantern
earnest phoenix
#

I don't think that'll be the major breakage, but I've heard it was an endpoint change that would cause the whole lib to fail

eternal osprey
earnest phoenix
eternal osprey
#

yeah

#

it just doesn't accept the answer

proven lantern
earnest phoenix
#

Also have you tried logging anything in the collect event listener to see if anything is actually being collected?

split hazel
#

developers are lazy

earnest phoenix
split hazel
#

i dont want to be changing my code every month because discord.js released a breaking change and i have to update

vivid fulcrum
#

i quit because bot deving is annoying and end users are dumb

#

now i get paid to do it for people who haven't realized that yet

#

😅

solemn latch
#

Ah the life of a developer

earnest phoenix
#

Major releases are to be expected, and it's not really discord.js' fault that Discord keeps changing major stuff that could cause heavy breakage

#
btnlistner.on('collect', async (b) => {
            let i = await interaction.fetchReply()
            switch(b.customId) {
                case 'previousPage':
                    currentPage--;
                    if(currentPage <= 1) i.components[0].setDisabled(true)
                    break
                case 'nextPage':
                    currentPage++;
                    if(currentPage > 1) i.components[0].setDisabled(false)
                    if(currentPage <= pages) i.components[1].setDisabled(true)
                    break
            }
        })``` Any idea why I can't change `i.components[0].setDisabled(true)`? It says it's not a function, I've tried `interaction` too.
split hazel
#

but they changed a lot of function names

#

without deprecating

#

just flat out removing them

earnest phoenix
earnest phoenix
#
components[/* top components, AKA action rows */][/* The actual components in the row */]
earnest phoenix
#

thanks.

earnest phoenix
# split hazel just flat out removing them

Then yeah, many discord.js users were also angry against that, causing breakage for consistency with Discord's naming conventions, removing utilities and similar stuff

earnest phoenix
#

Ideas?

#

Oh yeah I forgot to mention something

#
components[/* The top components, AKA the action rows */]
  .components[/* The actual components within the row */]
#

djs...

#

You make me cry sometimes.

#

I mean, that's exactly how Discord designed those in their Discord API

earnest phoenix
split hazel
#

they did start deprecating instead of removing though which is good i guess

#

like using message instead of messageCreate gives a warning but still works

earnest phoenix
#

One more thing, (I'm still newer to buttons) i.components[0].components[0].disabled = false; nor i.components[0].components[0].setDisabled(false) work. What am I doing wrong?

#

You have to edit the interaction response with the edited components

earnest phoenix
split hazel
#

pov you're a javascript developer by heart using c++

round cove
#

Gg

quartz kindle
split hazel
#

also I was thinking how to add different colour characters in my string print function for my os

#

I settled for a cooler looking modern solution where you can pass a function which gets called with the character in question and returns a colour

#

c++ has a very nice lambda syntax

round cove
#

Cpp lambda are very good

#

Captures can create tons of unique usecases

split hazel
#

I still don't know what captures do

#

do they just copy a variable from source function to the lambda?

quartz kindle
#

i hope not, wouldnt that be inefficient?

#

it probably does something like ownership shenanigans on the memory

#

nvm

#

An entity is captured by copy if it is implicitly captured and the capture-default is = or if it is explicitly captured with a capture that does not include an &.

round cove
earnest phoenix
#
(node:3037) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
    at /home/runner/Disbots-2/src/server.js:235:48
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3037) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3037) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3037) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
    at /home/runner/Disbots-2/src/routers/servers/server/view.js:73:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3037) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:3037) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
#

How do I fix?

quartz kindle
#

this is the weirdest syntax ever:

commands[interaction.data?.name]?.(interaction);
sudden geyser
#

I'm surprised that's even valid

#

potentially doing commands[undefined]

quartz kindle
#

guaranteed to return undefined, but still

prime mist
quartz kindle
#

huehuehue

#

its stringified tho

quartz kindle
#

same as { "undefined": 123 }

green kestrel
#

we release new versions every 2 weeks without breaking compatibility

#

😉

prime mist
#

Seems like javascript converts whatever to a string before performing a key lookup.

earnest phoenix
quartz kindle
#

yeah objects only support strings as keys

green kestrel
#

javascript converts software into developer pain

quartz kindle
#

for non-strings you need to use Map

earnest phoenix
#
(node:3037) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
    at /home/runner/Disbots-2/src/server.js:235:48
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3037) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3037) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3037) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
prime mist
#

There is also WeakMap, which has some interesting GC properties.

green kestrel
#

what do you call .send on?

quartz kindle
#

more specifically around lines 235

green kestrel
#

nah he doesnt need to, we're psychic here

earnest phoenix
green kestrel
#

aaaaaah

#

900 lines of js

#

🤮

#

i suppose cant complain theres not enough lol

quartz kindle
#

discord's preview doesnt show line numbers

#

i dont feel like downloading it and opening it in vsc

earnest phoenix
#
res.redirect(req.session.backURL || '/')
    client.users.fetch(req.user.id).then(async a => {
      client.channels.cache.get(channels.login).send(new Discord.MessageEmbed().setAuthor(a.username, a.avatarURL({
        dynamic: true
      })).setThumbnail(a.avatarURL({
        dynamic: true
      })).setColor("GREEN").setDescription(`[**${a.username}**#${a.discriminator}](https://disbots.xyz/user/${a.id}) User named **site** logged in.`).addField("Username", a.username).addField("User ID", a.id).addField("User Discriminator", a.discriminator))

    })
  }
});
#

This is the code around it

#

for line 235

prime mist
#
client.channels.cache.get(channels.login)

Is returning undefined.

quartz kindle
#

^

#

either channels.login is not a valid channel id, or that channel doesnt exist

severe perch
#

Does anyone knows why my music would lag sometimes and sometimes it wouldn't at all? the code is in djs and it's a very basic music command with ytdl without applying any filters in the ytdl function. At first I thought it had something to do with filtering but that didn't change anything.

Like one day I was playing and it was lagging a lot(like A LOT) and then it's not happening rn.

green kestrel
#

can i offer some advice @earnest phoenix ...

comments

#

you have precisely TWO comments in 900 lines of code

#

one says views, the other says models

#

just sayin

earnest phoenix
#

I am very unorganized 😅

green kestrel
#

it does help, especially if you need others to help they can pick stuff up quicker

earnest phoenix
green kestrel
#

nice

prime mist
#

Well, comments probably won't help here either lol. Breaking things out in files and self documenting functions would help a lot more.

green kestrel
#

that too

#

but one step at a time 😄

earnest phoenix
#

(node:3124) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined

#

Ok, so I see the error comes whenever I try to login through Discord on my website.

sudden geyser
#

tbh the program already self documents itself

#

I can tell what like 1/2 - 3/4 of it is doing

green kestrel
#

so you making a bot list?

sudden geyser
#

noop

earnest phoenix
#

and i fixed it!

green kestrel
#

looks very familiar

#

is it a fork?

earnest phoenix
# green kestrel is it a fork?

It actually is a fork of a very outdated one. I have deleted more than half of the code and been rewriting it as most of it does not work

#

The original code was so messed up you couldn't even run npm install without an erorr. smh

green kestrel
earnest phoenix
green kestrel
#

youll need to make it very different or google will penalise you

earnest phoenix
#

thats the one i cloned it from

earnest phoenix
green kestrel
#

yeah i mean the site content

earnest phoenix
#
(node:3290) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
    at /home/runner/Disbots-2/src/routers/servers/server/view.js:73:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3290) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
#

smh i now get another error

green kestrel
#

thats how i found duplicates, e.g. your certification page is exactly the same

earnest phoenix
green kestrel
#

good idea

#

is there no official support for this code?

#

or have its devs abandoned it

earnest phoenix
#

everytime i have a question he either says Restart it or he says i have to go

quartz kindle
#

what exactly happens when two people click a message component button at once?

#

like, when you click the button, does it show the loading state to other people as well? probably no right?

vivid fulcrum
#

it does

#

every interaction is isolated

#

oh

#

i read the question wrong

#

the loading is only shown to the person who clicked it

quartz kindle
#

so basically its spam-safe as long as the user is the same

#

but not spam-safe once multiple users start clicking

#

so i still need to add cooldowns for the buttons themselves

boreal iron
#

Depends on your action an interaction triggers

#

I doubt there’s a case multiple selfbots or scripts will try to spam components

quartz kindle
#

no but for example a help command with multiple pages

#

with multiple people clicking prev/next

boreal iron
#

Hmm yeah that might require a cooldown

#

Or simply ephemeral responses

quartz kindle
#

ephemeral responses dont have rate limits?

boreal iron
#

Idk but at least only one guy can spam it’s pagination components then

sudden geyser
#

I know what I'm doing tomorrow

quartz kindle
#

ah you mean make the entire help command ephemeral

earnest phoenix
#

dm help commands

earnest phoenix
#

extremely bullshit UX but works

lyric mountain
quartz kindle
#

i like the idea of a help command being public

lyric mountain
#

oh

boreal iron
quartz kindle
#

so you can for example put it in a read only channel, and have people refer to it

earnest phoenix
#

If you need a help command so big you need pagination then why not send it in dms to avoid spam

lyric mountain
#

what if, instead of changing the pages, it send the respective help page as an ephemeral?

quartz kindle
#

literally

lyric mountain
#

like, user clicks category -> sends ephemeral with content

earnest phoenix
lyric mountain
#

the original message stays untouched

earnest phoenix
#

i forgor how massive your bot long description is

quartz kindle
#

lul

boreal iron
quartz kindle
#

there is one

#

in the help command itself there is a link to the github version

boreal iron
#

Stop making jokes of my jokes

#

You gonna pay the price now

#

I’m going to sleep and you will miss my expertise

earnest phoenix
boreal iron
#

Shut up angeryBOYE

waxen bough
#

does <GuildMember>.roles.highest default to guildId if there's no roles?

boreal iron
earnest phoenix
#

i sincerely believe coronavirus is real unlike 99% of the nation

hybrid cargo
bright hornet
#

Why my bot can't send a dm with only that one person? It always throw this error DiscordAPIError: Cannot send messages to this user, but in others it's working perfectly fine

woeful pike
#

they have dms turned off

wheat mesa
#

DMs turned off, blocked bot, not in mutual server, etc

marble juniper
#

Just catch the error bruh

lament rock
#

my bot casually throwing irrecoverable errors like segfault or somehow receiving sigterm

#

child_processes do be kinda quirky tho

#

Pro tip. Don't fuck with gif encoding

pulsar bone
#

sometimes after inviting a bot it redirects to other website so how you do that

atomic kindle
#

OAuth Redirects.

pulsar bone
atomic kindle
#

You have to add it here but it won't work unless you have set up an OAuth authentication service.

onyx socket
#

why undefined?

spark flint
#

what botlist

#

most botlists have the same looking widgets

onyx socket
spark flint
onyx socket
#

yep

spark flint
#

then yo need to post server count with the api

onyx socket
#

i see

nova basin
#

hello how do you put a button in a webhook?

spark flint
#

what do you mean

quartz kindle
#

you ask the webhook nicely

spark flint
nova basin
#

I would like to know how to put a button in a webhook I had put this code but there is nothing that appears

  "components": [
    {
      "type": 1,
      "components": [
        {
          "style": 1,
          "label": `bihbn`,
          "custom_id": `row_0_button_0`,
          "disabled": false,
          "type": 2
        }
      ]
    }
  ]