#development

1 messages · Page 1947 of 1

lyric mountain
#

Log it

earnest phoenix
#

Error: Top.gg token is missing
at AutoPoster (C:\Users\ADMINISTRADOR\Downloads\Clash-Chest\node_modules\topgg-autoposter\dist\index.js:20:15)
at Object.<anonymous> (C:\Users\ADMINISTRADOR\Downloads\Clash-Chest\index.js:58:15)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

#
        throw new Error('Top.gg token is missing');
        ^

gilded creek
#

Do people here plan on trying to implement the new timeout feature into their bots? If so, I have a few questions about it:

  1. Timeouts are indeed cool, but how exactly should one go about logging when they expire? Discord doesn't send a gateway event when the member's timeout expires, only a GUILD_MEMBER_UPDATE event when the timeout is created. My initial thought was to have a background service that checks every 30 seconds, but I could end up looping through thousands of members needlessly.
earnest phoenix
#
const dotenv = require('dotenv')
dotenv.config();

const apost = AutoPoster(process.env.DBL_TOKEN, client);
lyric mountain
#

Yes yes, log the token to see if it's returning it at all

#

Don't show her obv

earnest phoenix
#

??

lyric mountain
#

Console log

gilded creek
#

don't post your token here, just try to log it and see if it works.

lyric mountain
earnest phoenix
#

idk why but vsc is much comfortable than replit

lyric mountain
#

When you mute also add the user to the db with the timestamp

gilded creek
#

Ah, so it really isn't any different. Thanks!

lyric mountain
#

It's not an ide, but it's more ide than replit

earnest phoenix
#

yeah

#
dotenv.config();
console.log(process.env.DBL_TOKEN)
``` i'm console logging it but nothing's appearing, just the error
lyric mountain
gilded creek
gilded creek
earnest phoenix
#

yeah

gilded creek
#

can you send a screenshot? Blurring out the token ofc.

earnest phoenix
gilded creek
#

did you make sure that the file was saved?

#

vsc doesn't automatically save. so try making sure all your envs are set, then doing ctrl + s

earnest phoenix
#

it's saved but 0kb. i'll re-save it

gilded creek
#

Yea, re save everything and try again.

wheat mesa
#

It’s probably 0kb because you’re storing like 100 bytes of data

earnest phoenix
#

oh

#

working

modest maple
earnest phoenix
neat ingot
#

so lets say im using discord.js and getting the number of guilds my bot is in using something like client.guilds.cache.size. If my bot is then kicked from a server, will that server remain in the cache? 👀

earnest phoenix
#
C:\Users\ADMINISTRADOR\Downloads\Clash-Chest>git init
'git' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\ADMINISTRADOR\Downloads\Clash-Chest>heroku git:remote -a clash-chest2
 »   Warning: heroku update available from 7.53.0 to 7.59.2.
 »   Error: Git must be installed to use the Heroku CLI.  See instructions here: https://git-scm.com

#

bruh

#

I've installed git

wooden ember
#

why does this never return as equal?

#

if args = 1 it still says its not

#

i have tried using '' and just no marks at all

earnest phoenix
#

without the !

boreal iron
#

What in the name... is that syntax

earnest phoenix
#

backticks can't be used tho

wooden ember
earnest phoenix
#

oh

boreal iron
#

if(number !== "1" && number !== "2" ...) return

wooden ember
#

i did try '' and "" and [] as well just didnt put it back to what it was orriginally

#

oooooh

#

i put the ! in the wrong place

#

thx

boreal iron
#

not OR not is logical nonsense

earnest phoenix
#

!number == 1 will work if number is 0

wooden ember
#

mmm its still not working

earnest phoenix
#
error: src refspec main does not match any
error: failed to push some refs to 'nope'
wooden ember
#

i think I'll just do it the other way around instead of using the ! and using return

boreal iron
#

Just show what you did

wooden ember
#

who, me? or the other guy?

boreal iron
#

You

wooden ember
#

ok one sec

solemn latch
#

you need to use members not users

boreal iron
solemn latch
#

users dont have permissions

boreal iron
#

not OR not is logical nonsense

wooden ember
#

yeah but if you use and that means it wil only work if it is all of them

neat ingot
wooden ember
#

oh that is way neater

#

thx

neat ingot
#

np, might need to parseInt(number) to make sure its not a string 🙂

solemn latch
#

that will only check if they have ban members, not kick or admin

boreal iron
#

You could use any

#

<member>.permissions.any(["KICK_MEMBERS", "..."])

#

Using the flags, bitfields etc.

#

Anything works

solemn latch
#

I always forget any

boreal iron
#

I mean you can complicate things a little bit more, too

#

let permissions = member.permissions.toArray();

earnest phoenix
#

How can i add event listener on a module

boreal iron
#

Then checking if permissions.includes("...")

#

Well the method return a boolean

#

true if the permissions contain any of the one you're looking for

#

If not it returns false

#

Well if the target has any of the permissions the message will be send

#

That's what you check

#

You need to provide the permission flags

#

Strings will not work anymore

#

I just wrote an example for you

#

The array needs to contain the numeric permission flags

#

any([Discord.Permissions.FLAGS.KICK_MEMBERS, ...])

wheat mesa
#

Permissions.FLAGS.PERMISSION_NAME

#

Ah he beat me to it

earnest phoenix
#

"dependencies": {
"discord-giveaways": "^5.0.1",
"discord-nsfw": "^1.3.0",
"discord.js": "^13.3.1",
"moment": "^2.29.1",
"ms": "^2.1.3",
"quick.db": "^7.1.3"
},

#

thats my moduls

boreal iron
#

Log the targets permissions

#

They might not be cached

#

.toArray()

#

What's target then

#

Is he the guild owner?

#

Check if the mentioned member is the right one

#

<dm channel>.send().then(ban())

#

Or simply

#

await message.send()

#

await member.ban()

#

You await the message at first

spark flint
#

send the message befor ethe ban

#
await target.send("message") #send message
await target.ban() #then ban, reason is optional```
#

what language

boreal iron
#

Not any user accepts direct messages

#

catch the promise

spark flint
#
try {
//send
}
catch {
//whatever the js equivelant of pass is 
}```
boreal iron
#

Not any user accepts direct messages

#

If he doesn't you obviously can't send a message to him

tribal crow
#

Hey! The Discord docs says this should work, but when i try to execute it i get an error saying it isnt a function. Does anyone know y?user.timeout(ms(time + string), reason);

boreal iron
#

You can supress the error as well... catch(() => {});

#

Not needed to log the fact some users don't accept DMs

still storm
#

Hey how should i make premium system to my bot? (Per-user/per-guilds and etc, just tell way how i should make it)

spark flint
#

have a database of premium users or guilds

#

and then check if they are there

#

based on id

still storm
#

I asked what method

spark flint
#

I said

still storm
#

Per-user, per-guild

spark flint
#

using a database

still storm
#

What will be best

spark flint
#

ohhhh

still storm
spark flint
#

per user

still storm
#

Should i make it like dankmemer??

spark flint
#

idk

#

make it like how you aspire it to be

still storm
#

And what's your reason behind per user

still storm
spark flint
#

if per guild then they will only buy if they are a server owner

still storm
#

Pricing:

Premium without server upgrade:
1 month - 2$
1 year - 20$

Premium with server upgrade:
1 month - 2.50$
1 year - 25$

Upgrade when have premium:
1 month - 1$
1 year - 10$

Upgrade when dont have premium:
1 month - 1.50$
1 year - 15$
spark flint
#

if per user than multiple people would buy

#

for capyhost i'm just storing images on a vps located in Europe, is it worth using geodns to have a second vps located in the US for faster image speeds?

still storm
#

How else can i do it lol, there are just few ways how you can make premium system

#

bruh we can do only per guild, per user, per user but you can upgrade server

#

Multipurpose

#

Then last option

#

Dank memer did like that

#

Most profit tbh

still storm
earnest phoenix
#

whyjustwhy it's replying to itself

#

if(message.author.bot) return; isn't working o-o

#

because its not a message

#

hm?

earnest phoenix
earnest phoenix
#

How can i fix this? I create youtube together link from discord api

earnest phoenix
tribal crow
earnest phoenix
boreal iron
wheat mesa
#

if it's a User object then that's why

boreal iron
#

Yee it has to be a guild member of course

knotty quartz
#

Does anyone know why an error has came up saying something is wrong with the string of this when it been checked by 2 other people and they say there is nothing wrong?

  new SlashCommandBuilder().setName('updateVersion').setDescription('You are able to see the current updateVersion of the bot with this.'),
  new SlashCommandBuilder().setName('update').setDescription('The owner of the bot will write updates on the bot here.'),
  new SlashCommandBuilder().setName('status').setDescription('If the owner detects a lag this will be updated by him.'),
  new SlashCommandBuilder().setName('developer').setDescription('Lets you know who made the bot.'),```
boreal iron
#

I think names need to be lower case

#

iirc

sudden geyser
#

Yep

#

You can't use spaces either

#

But you can use dashes

tribal crow
#

xd

earnest phoenix
#

How can I get the channel topic in djs v13?

#

.getTopic()?

spark flint
#

i've only just been able to get to it again

tribal crow
knotty quartz
#

Imma sleep then fix this tmrw

boreal iron
#

That’s what we mean

tribal crow
#

and that means...?

#

cuz user is interaction.options.getUser("user");

boreal iron
#

Use the getMember() method

tribal crow
#

is that a thing?

tribal crow
#

holy

#

tysm

#

ily <3

boreal iron
#

Djs will get the guild member using the user ID

tribal crow
#

ah

#

one last thing

#

does the duration of the timeout matter?

#

Like does it have to be 60s, 5m, 1h, 1d or 1w?

#

Or can it be anything

boreal iron
#

Idk which timeout you’re speaking about

tribal crow
#

the discord one

earnest phoenix
#

what Procfile needs?

tribal crow
earnest phoenix
#

idk what to put in there, the tutorial ain't providing me it

boreal iron
tribal crow
#

ah ok

earnest phoenix
#
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;
    if (!interaction.isButton()) return;
  
if(interaction.customId === 'claim'){```
#

Does that not work?

#

Because I'm trying to make a button in a index.js file

#

but uh, failing

#
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;
    if (!interaction.isButton()) return;
  
if(interaction.customId === 'claim'){
const cl1 = new MessageEmbed()
         .setAuthor(message.author.tag, message.author.displayAvatarURL({ 
dynamic:true }))
  .setDescription(`<@${interaction.user.id}> Claimed this Thread.\n ${message.author.tag} Opened a Thread.`)

  await db.set(`claimed_${interaction.channel.id}`, interaction.user.id)
await chan.send({ embeds:[cl1], components:[claimed] })  
}```
boreal iron
#

You’re sure your component ID is "claim"?

#

Also instead of returning non button interactions wrap the button code inside an if statement checking if(interaction.isButtion())

#

the property customId doesn’t exist for slash command and your code will error then

#

Saying customId is undefined

#

Well not erroring as non existent properties are magically exist in JS but you know what I mean

#

At least I hope you know

earnest phoenix
#

I just actually checked the ID and it worked lol

#

Now its just saying "interaction failed" on another one of my commands

#
interaction.deferReply;

const claimed = db.fetch(`claimed_${interaction.channel.id}`)
    if(claimed === interaction.user.id) {```
#

Is that the way to do it

#

or is it interaction.user.id ==== claimed

earnest phoenix
#

Well, not its not registering my commands period

#

yeah its not registering my commands

#

You've probably registered the slash-commands correctly, but not handling them correctly, you can log the list of the slash-commands you've registered to see if they're actually registered or not by using <Client>.application.commands.fetch() and logging it's value after resolving it's promise

boreal iron
#

Huh Voltrex in development? General chat must be dead…

earnest phoenix
#

Ahh, yep works

#

Idek what I did wrong here

#

Mind taking a look at this

#

It'll send the embed to the user.

#

not the channel

#

could it be like interaction.editReply?

#

I think it'd just be reply

#

but not sure.

earnest phoenix
boreal iron
#

I am atm

earnest phoenix
#

lmfao

#

I'm confused what is unknown interaction?

boreal iron
#

Wtf is that indentation

earnest phoenix
#

I just fixed it whyyyyy

boreal iron
#

That’s like posting a code block for mobile clients

earnest phoenix
#

You can guess by the error message, it means that the interaction either doesn't exist or it's expired

earnest phoenix
earnest phoenix
#

All I did was interaction.deferReply() > interaction.reply

#

You only have 3 seconds to respond to an interaction if the interaction is not deferred, you don't seem to be calling the deferReply() method as I've mentioned earlier, you seem to be using it as a property instead

#

It's been right there.

#

The whole time.

#

Then resolve it's promise...

#

hm?

boreal iron
#

Do you even respond to a slash command or a button?

earnest phoenix
#

It's not in a index.js file anymore.

#
    interaction.deferReply()

    const claimed = db.fetch(`claimed_${interaction.channel.id}`)
    if (claimed === interaction.user.id) {


      let topic = interaction.channel.topic;
      let user1 = client.users.cache.get(topic)
      let reply = interaction.options.getString('message')



      const embed = new MessageEmbed()
        .setAuthor(interaction.user.tag, interaction.user.displayAvatarURL({
          dynamic: true
        }))
        .setColor('#7289DA')
        .setDescription(`${reply}`)
        .setFooter(`Lightning Staff Team`)

      const embed1 = new MessageEmbed()
        .setAuthor(interaction.user.tag, interaction.user.displayAvatarURL({
          dynamic: true
        }))
        .setFooter(`Lightning Staff Team`)
        .setColor('#7289DA')
        .setDescription(`${reply}`)
      
      interaction.reply({ embeds: [embed1] })
      user1.send({ embeds: [embed] })```
earnest phoenix
#

Resole it.... like interaction.editReply?

#

You can resolve a promise by using async/await, as await <CommandInteraction>.deferReply()

boreal iron
#

Voltrex has left the channel

earnest phoenix
#

That's the pain of the development channel sadly, yes

boreal iron
earnest phoenix
#

await interaction.reply({ embeds: [embed1] })

boreal iron
#

Oh no… do you register the commands at any restart?

earnest phoenix
#

Idfk

#

I went off the docs

#

I don't think the code inside of that if statement is even being executed at all, have you tried logging something in it?

#

So yes.

earnest phoenix
#

It logs the user id

#

It's the same error

#

unknown interaction

#

Can you show your new code including the execute() method?

#

Okay omfg

#

This thingggggg

#

Okay

#

So

#

Once I moved the commands up

#

for them to register

#

the buttons don't work in the index.js

#

Which is why the claimed user in the DB is null

#
    interaction.deferReply()
  client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);
    if (!command) return;
    try {
      await command.execute(interaction, client);
    } catch (error) {
      if (error) console.error(error);
      await interaction.channel.send({ content: 'There was an error while executing this command!', ephemeral: true });
    }
    if (!interaction.isButton()) return;

    if (interaction.customId === 'claim') {
      const claimed = new MessageActionRow().addComponents(
        new MessageButton()
          .setLabel("Claim")
          .setStyle('PRIMARY')
          .setDisabled(true)
          .setCustomId('claim2'),

        new MessageButton()
          .setLabel('Unclaim')
          .setStyle('DANGER')
          .setDisabled(false)
          .setCustomId('unclaim2'))
      const cl1 = new MessageEmbed()
        .setAuthor(interaction.user.tag, interaction.user.displayAvatarURL({
          dynamic: true
        }))
        .setDescription(`<@${interaction.user.id}> Claimed this Thread.`)

      await db.set(`claimed_${interaction.channel.id}`, interaction.user.id)
      await interaction.channel.send({ embeds: [cl1], components: [claimed] })
    }



  })
})```
#

The buttons don't work, the commands do.

#

I should add a return; {} huh?

boreal iron
#

Hold on do you listen to the events multiple times?

earnest phoenix
#

You're returning if the interaction isn't a button component in the first place, so it never reaches to the bottom

#

ahhh

#

So.... how does one fix that?

boreal iron
#

Nah he has another event listener

#

In the code he sent before

earnest phoenix
#

I needa clean the bot's ears with a q-tip to make it listen?

#

Damn, I wish it was that simple.

#

No FakE, it's just why it doesn't work

#

You can simply fix it by not returning...

boreal iron
#

You can do this I believe in your…
Gotta some work to do

earnest phoenix
#

Still doesn't work.

#
if (interaction.isCommand()) {
  // Code for slash-commands.
} else if (interaction.isButton()) {
  // Code for button components.
}
...
#

I removed return

#

ahh

#

Okay, now one problem down

#

Another to go

eternal osprey
#

where is quick.db being saved and how can i revert the dattabase like it's new

earnest phoenix
eternal osprey
#

i can't really find it bh

#

tbh*

earnest phoenix
#

Voltrex idk what im doing wrong man

#

The claimed if{} works, it's just not sending to the interaction channel

eternal osprey
earnest phoenix
earnest phoenix
#
    const claimed = db.fetch(`claimed_${interaction.channel.id}`)
    console.log(claimed)
    if (claimed === interaction.user.id) {


      let topic = interaction.channel.topic;
      let user1 = client.users.cache.get(topic)
      let reply = interaction.options.getString('message')



      const embed = new MessageEmbed()
        .setAuthor(interaction.user.tag, interaction.user.displayAvatarURL({
          dynamic: true
        }))
        .setColor('#7289DA')
        .setDescription(`${reply}`)
        .setFooter(`Lightning Staff Team`)

      const embed1 = new MessageEmbed()
        .setAuthor(interaction.user.tag, interaction.user.displayAvatarURL({
          dynamic: true
        }))
        .setFooter(`Lightning Staff Team`)
        .setColor('#7289DA')
        .setDescription(`${reply}`)
      
     await interaction.reply({ embeds: [embed1] })
      await user1.send({ embeds: [embed] })
      ```
eternal osprey
#

I deleted it, does that mean that it removed all info?

#

So i am basically starting of fresh

earnest phoenix
#

Yea

#

yeah, once you delete quick.db's file its gone

eternal osprey
#

awesome

earnest phoenix
#

The user's ID

earnest phoenix
#
if (...) {
  // Log it here.
}
#

Yeah it logs the ID still.

#

What exactly do you mean by that?

earnest phoenix
#

Interactions carry a channel instance with them, so you can just access it and do whatever you want

#

Yes

#

Still logs the User ID @earnest phoenix

#

Ahh

#

Didn't mean to ping

#

My baddd

#

Wait, did you remove the <CommandInteraction>.deferReply() call at the start?

#

Wait

#

Could it be something do do with my execute()?

#

No, at least it doesn't seem to be

#

Ah alr

#

Now it works without deferReply()

#

help....

#

Then there you go

#

Ty lmfao

earnest phoenix
#

I deployed my bot today on heroku with git and heroku CLI

#

how do I apply changes?

#

or it automatically changes when the file changes in my laptop?

#

You just commit the changes and it automatically restarts and applies the changes for you, if it doesn't; you might have to do some configurations

#

oh

earnest phoenix
#

Yes, but global slash-commands take an hour to be cached

#

Then it's not being registered, show code

#

so I do ```cmd
git add .
git commit -m "Message"

earnest phoenix
#

where

#

to heroku?

#

To your GitHub repository, you can't push to Heroku

#

In a tutorial they didn't make a repo tho they used Heroku CLI and git

#

It seems like you're doing it correctly, does it log that it successfully reloaded the slash-commands?

#

and they made me install heroku and git in my laptop

#

oh

earnest phoenix
#

pass me a good tutorial

#

then what would you recommend me to use? freely

#

Buy a VPS, cheap, way better than free hosting platforms and full accessibility

#

It is not a good idea to leech onto free stuff

#

i'm broke

#

Heard the same thing from 95% of the bot developers in Discord (goldenfredy), if you don't want to spend a few dollars on a VPS, then sure; you can use Heroku, but there are lots of downsides on hosting a Discord bot on Heroku, but anyway, you can just Google ways of linking your GitHub repository to Heroku instead of watching lame tutorials

#

ok

#

I honestly just recommend using the client itself for registration of the slash-commands instead of using the REST module

#
// Guild to register the slash-commands to.
const guild = client.guilds.cache.get(/* Guild ID */);

// Register the slash-commands to the guild.
await guild.commands.set(/* An array of slash-command data */);
#

"An array"

#

You're iterating through the slash-commands so just

#
await client.application.commands.set(commands);
#

You can just use the ESM side of our Node.js runtime to get that juicy Top-level await mmLol

#

You're supposed to get the guild, you're calling that method on a string which is guildId variable's value

boreal iron
#

Or by working with the inbuilt methods instead of using that weird builder functions

#

<guild>.commands.set([…]);

#

As well as create() delete() etc

earnest phoenix
#

Okay, so this bot is just a instant struggle rn lol, so its main purpose is what you and I were talking ab FakE, I got it to create the channel & send the message w/the buttons.

But it's supposed to check if the channel already exists and if not create the channel, if the channel does exist, it just sends the message.content but it keeps creating multiple channels.

#

Okay nvm, now it just doesn't send the message to the already made channel.

#
let channel = guild.channels.cache.find(c => c.topic === message.author.id)
#

Can it locate a channel using the topic?

boreal iron
#

All channels should be cached by default iirc and yes you can filter or find for any property

earnest phoenix
#
let channel = guild.channels.cache.find(c => c.name === message.author.tag)
              let topic = message.channel.topic;
      let user1 = client.users.cache.get(topic)
        
        if (client.users.cache.get(user1) && !message.author.bot) {
          let user = client.users.cache.get(user1);
          let attachs = [];

 const mm1 = new MessageEmbed()
          .setAuthor(message.author.tag, message.author.displayAvatarURL({
            dynamic: true
          }))
          .setDescription(`${message.content}`)
            .setImage(message.attachments.forEach(attach => attachs.push({ name: attach.name, attachment: attach.url })))
          
        channel.send({ embeds: [mm1] })
          ```
#

It doesn't send the message to the channel

boreal iron
#

Did you log channel to see if it’s the right one?

earnest phoenix
#

if (user1 !== undefined && !message.author.bot) { ... }

boreal iron
#

Even if that’s unnecessary

earnest phoenix
#

It's not a string

boreal iron
#

Oh I’m stupid

#

It’s an user object

#

Yeah

#

Should concentrate on driving freerealestate

earnest phoenix
#

Yea, you just focus on your driving troll

boreal iron
#

Fuck I thought I got you this time

#

That would have made my day

earnest phoenix
#

How can I make a command that auto-deletes embeds sent from the bot? discord.py

#

Like auto-deletes all embeds that contain the same message

spark flint
#
function submitReport() {
        return false;
        $('form#report').submit();
        document.getElementById("before").style.display = "none"
        document.getElementById("after").style.display = "block"

      }```
#

why doesn't that work

pale vessel
#

Why did you return

#

That's not going to execute the rest of the code

spark flint
#

true

pearl trail
#

maybe if you want to prevent redirecting after submit, try
<form>.preventDefault()

spark flint
#

oh ok

#

i'll try that now

spark flint
#

ty

#
function submitReport() {
        $('#report').submit(function(event) {
          event.preventDefault();
          var form = $(this);
          console.log(form.serialize());
          $.ajax({
            type: form.attr('method'),
            url: form.attr('action'),
            data: form.serialize()
            });
          });
        document.getElementById("before").style.display = "none"
        document.getElementById("after").style.display = "block"
}```
#

was my final code

pearl trail
earnest phoenix
#
let category = client.channels.cache.find(c => c.name == cc && c.type == "category");

          interaction.channel.setParent(category.id)```
#

How come that doesn't move the current channel?

#

o-o

sudden geyser
#

Because you're searching over generic Channels

#

You want something more specific, like searching the guild channels.

#

Rather than every channel your bot has access to

#

@earnest phoenix*

earnest phoenix
#

Oh

#

interaction.guild.channels.cache.find()?

sudden geyser
#

Yeh

earnest phoenix
sudden geyser
#

Was a channel with the name found?

earnest phoenix
#

Does it have to be the full category name or just the channel?

sudden geyser
#

full category name

#

case sensitive

earnest phoenix
#

It's still not moving.

#

Nope, just "undefined"

sudden geyser
#

How about setting the type to GUILD_CATEGORY as well?

earnest phoenix
#

That worked^^, how would I make it so that it moves if it also just has like the first part of the cateogry name?

#

.startsWith ik there is something like that...

sudden geyser
#

You can adjust the finding.

earnest phoenix
#

oh?

#
let category = interaction.guild.channels.cache.find(c => c.name == cc && c.type == "GUILD_CATEGORY");
sudden geyser
#

find works by returning the first item in the collection that returns logical true

earnest phoenix
#

c.name.starsWith?

sudden geyser
#

And since the channel name is a string, you can use it like a string

#

So c.name.startsWith(...)

#

Notice how it returns a boolean

earnest phoenix
#

Yeah

#
let category = interaction.guild.channels.cache.find(c => c.name.startsWith == cc && c.type == "GUILD_CATEGORY");
#

So I should have (cc) in it?

sudden geyser
#

Yeah, since startsWith is a function

#

Most issues can be resolved by searching the docs

#

Since it'll usually has good details

earnest phoenix
#

ahh

#

Tysm

#

wait

#
let category = interaction.guild.channels.cache.find(c => c.name.startsWith(cc) && c.type == "GUILD_CATEGORY");
#

That didn't work? 🤣

sudden geyser
#

You may want to check the value of cc and the channel name then

earnest phoenix
#

Question when people send embeds in discord.js

#

How would you check if the message is an embed would you just check the embeds field and see if it is empty?

boreal iron
#

Yeah

#

if(!message.embeds.length) no embeds

#

The embeds property is an array

#

Means it’s never "empty"

#

But the array can be empty not the property

wheat mesa
earnest phoenix
#

I am curious if I could use smth like msg instanceof MessageEmbed(or Embed if using detritus)

#

But then I realized that wouldn't work

#

since it is still a message just with an embed prop populated

boreal iron
#

The detritus infection spreads oldEyes

earnest phoenix
#

not an infection if its a good thing

sudden geyser
#

Remember that it takes up to an hour to propagate updates

#

though existing commands shouldn't be affected

#

Can you show where you're loading the commands

#

but commands is empty

#

Then what did you have before to set the global commands?

#

Unless I'm misinterpreting this.

#

As the array is obviously empty, there are no global commands. But there are per-guild commands as expected.

#

Yet you're asking why commands aren't updated globally despite reseting the list.

boreal iron
#

Does the command already exist?

#

If not create() is the method to go with

#

You don’t register commands on any startup

#

You fetch the commands, compare them with your loaded ones and register/update/delete them if needed

#

That’s what a proper command needs to include

earnest phoenix
#

await message.delete(msgID);

delete message by ID 🤔

boreal iron
#

Updating global commands can take a while, too

sudden geyser
#

fetch message first then call delete

#

or maybe discord.js has a specialized method that doesn't require prefetching

earnest phoenix
#

Its python.

all the examples of fetch .then use => and it throws something about unexpected syntax something about pylance

boreal iron
#

Generally updating the commands on any startup is nonsense
Why would you do that?
They are registered globally or in the guild until you change them.
Also there are limits how many registrations can be fired

boreal iron
#

Also it does create new ones, set() just updates already existing commands

#

You dont update the registered commands on any startup, just if they require an update cause of changes you made

slender thistle
sudden geyser
slender thistle
#

It's not Python

pale vessel
slender thistle
#

Oh hold on did I miss a message or a few here

earnest phoenix
boreal iron
#

That doesn’t include the registered commands name or description as you don’t change it on any startup.

slender thistle
#

Meh I can't be bothered to play detective here I'm out cya

boreal iron
#

Because there are rate limits you probably break cause of your update/register spam and even updates sometimes take up to an hour for global commands (at least in my experience)

#

There is, yes

#

200 iirc

#

That includes all, not just each one

#

5 cmds x 20 startups are already 100

#

I am speaking about guild limits

#

Not sure about global ones

#

But you will receive an API error if you run into the limits

#

What’s the code of the guild command which doesn’t appear?

#

Do you register or update it?

#

Guild commands or global commands?

royal herald
boreal iron
#

The bot has the right scope?

#

Do you register or update it?

#

*the commands

#

set only updates registered commands as I said before

earnest phoenix
boreal iron
#

set() does not register commands

#

Yes

earnest phoenix
#

I really wanna troll and ask how to import js into python but I dont wanna cause any rage quitting xD

boreal iron
#

client.application.commands.create(…);

Guild commands:

client.application.commands.create(…, guildID);

#

Nope it only requires the name and the description

#

Any other parameter is optional

#

create() requires an object

earnest phoenix
#
        await message.delete(msg)```
plz tell me Im being retarded
boreal iron
#

client.application.commands.create({ name: "test", description: "test123");

#

You don’t need (privileged) intents for slash commands

#

Do you actually read what I wrote?

#

A slash command name and description is always required

#

As I wrote create() requires a command object

#

Like the example I wrote

#

You can simply loop your loaded command files, and use the name and description to register the command

#

By passing them as object like I wrote in my example

#

for(const command of youtCommands)
{
client.application.commands.create({ name: command.name, description: command.description );
}

#

Because the guild is absolutely bullshit, waste, trash, nonsense …

#

Anyways even the builder examples, any of it has a setName() and setDescription() method

#

As both are required for commands

#

Djs docs also show that both parameters are required (not optional)

earnest phoenix
#

hey

#

presence intent is just used to track the status/profile update of guild users right?

quartz kindle
#

discord.js became such a clusterfuck they had to do this...

#

fucking unbelievable lmao

earnest phoenix
#

when I disabled presence intent, the bot's streaming status was removed. was this normal?
I thought that intent is used to track guild members' presence update

sudden geyser
#

whatever happened to using maps and arrays'

#

why do we need special manager, util, xchannel, blah

keen sable
#

What mean Of this Line

quartz kindle
#

but how on earth did they manage to introduce circular dependencies

#

then added weird hacks to fix them

#

lmao

keen sable
quartz kindle
#

its obviously getting some kind of prefix

earnest phoenix
#

I'm gonna regen token

quartz kindle
#

intents only matter for what data you receive

#

your bot's own activity has nothing to do with it

#

just check if your activity code is correct

#

and make sure its reset when needed, since disconnects can remove it

keen sable
earnest phoenix
#

Ive finished my first bot V1 thanks to a lot of ppl in this group ❤️

keen sable
#

Help please

sly sierra
#

I can barely read tnat error message

keen sable
#

Come dm

supple oriole
#

I did

const Schema = require('mongoose')

in my setlogs cmd as I needed to save more then just 1 Schema in the command.
Now I get an error

Schema is not a constructor

Code: https://sourceb.in/t8Hh2I8CtJ
If you can help me, thank u. Im like new to using mongodb lol

earnest phoenix
#

you probably want to either do Schema.Schema or just deconstruct tthe package

#
const { Schema } = require('mongoose')

new Schema(...)
supple oriole
#

from adding new Schema(...)

tiny lily
#
.setDescription(`:stopwatch: ┃ <@${message.author.id}> You are on cooldown. Please wait for `)]})

does any1 know how to use ms to say how much time is remaining ?

wheat mesa
#

So if I have a class, called Foo and I want to store a static list of Foo objects in a map, how would I do that in TypeScript? This is what I'm trying to do, but it's not working ```ts
class Foo {
public static fooList: Map<string, Foo>;

constructor(id: string) {
Foo.fooList.set(id, this); // Not working, no idea why
}
}

woeful pike
#

works fine for me

wheat mesa
#

hmmm

woeful pike
#

what's "not working"?

wheat mesa
#

let me try something rq

#

ok so basically I have a MusicPlayer class that looks something like this: ```ts
export class MusicPlayer {
private connection: VoiceConnection | undefined;
private guildId: string;
private state: AuxVoiceState;
private encoder: Encoder;
public static musicPlayers: Map<string, MusicPlayer>;

constructor(guildId: string, state: AuxVoiceState) {
    this.guildId = guildId;
    this.state = state;
    this.encoder = new Encoder({ channels: 2, sample_rate: 48000, application: 'audio' });
    this.encoder.complexity = 10;
    this.encoder.signal = 'music';
    MusicPlayer.musicPlayers.set(guildId, this);
}
// other methods like play, stop, connect, etc

}
``` and it works perfectly fine if I remove the MusicPlayer.musicPlayers.set(guildId, this); line, but for some reason my code never executes past creating a MusicPlayer object if I have that line in there

#

oh wait I'm stupid

#

I didn't initialize the Map

#

if I do ts class Foo { public static fooList = new Map<string, Foo>(); } will it instantiate a new map every time a Foo is created?

EDIT: seems like it doesn't

earnest phoenix
# supple oriole

You don't literally put ... inside the parentheses it was a placeholder

#

that just means you fill in the parameters required

supple oriole
#

and now got this

earnest phoenix
supple oriole
earnest phoenix
#

Can you show me your schema

supple oriole
#

I have 3.

#

the command tryna save data into 3 schemas.

earnest phoenix
#

Whatever one requires a guild id then

supple oriole
#

all of em

earnest phoenix
#

Just show me one of them then

supple oriole
#
const mongoose = require('mongoose');
const memberSchema = new mongoose.Schema({
    GuildID: String,
    ChannelID: String,
})
const memberModel = module.exports = mongoose.model('memberupdates', memberSchema);
earnest phoenix
#

mmmm

#

I assume you are using discord.js right?

short shell
#

you prob tried to pass a number when it wants a string

supple oriole
earnest phoenix
#

iirc Discord.js Snowflakes are now of type BigInt

#

which isn't a string persay

#

It outputs as a stringified bigint iirc

supple oriole
#

sooo, how do I fix that Madge

earnest phoenix
#

Might be wrong though I haven't read the docs in a while so they might of changed it again

short shell
#

nope its a string

#

then no idea

earnest phoenix
#

I get type bigint

supple oriole
#

now my bot doesnt go online now

short shell
#

what djs version

supple oriole
#

13.1.0

short shell
#

try msg.guild.id.toString() ig

earnest phoenix
#

Might work

#

But if it is indeed already a string then it shouldn't matter I dont think

supple oriole
#

or the command

#

Im a bit braindead now

earnest phoenix
#

when you are setting the id

#

the type will still be String in the schema

#

just whenever setting the id it would be .toString()

supple oriole
#

so,

#
            new Schema({
                GuildID: message.guild.id.toString(),
                ChannelID: channell.id,
            }).save();
#

like that?

short shell
#

yeah

earnest phoenix
#

No

#

tf

short shell
#

wait what

supple oriole
earnest phoenix
#

Unless you named your model Schema which is bad idea

#

When making a new schema the type will still be String

#

when inserting int othe model you will set the value of GuildID to be that

supple oriole
#

ok,

#

well my bot isnt going online rn-

#

is it some sort of rate limit

#

or what

#

it happens to me alot of times

earnest phoenix
#
const mongoose = require('mongoose');
const memberSchema = new mongoose.Schema({
    GuildID: String,
    ChannelID: String,
})
const memberModel = module.exports = mongoose.model('memberupdates', memberSchema);

//later on
memberSchema.create({GuildID: <Message>.guild.id.toString(), /* and so on */})
supple oriole
#

for the later on part, do I place it in the command where the old code was or in the Schema.

earnest phoenix
#

Wherever you are going to use memberSchema.create

#

you'd do it smth like that

supple oriole
#

ok bet.

earnest phoenix
#

Keep in mind if this works it probably isn't the best method to solving the problem tho :p

#

I just can't think of anything else

supple oriole
#

oki.

#

well my bot isnt going online now sooo

#

gotta wait ig.

earnest phoenix
#

also reading mongoose's docs is a good idea

supple oriole
sand crown
#

Hi guys,

Does any of you know a way to scrape a website that requires authentication in Node.js? I've found solutions for python such as robobrowser, however, I don't mess with that language.

woeful pike
#

find out how it does authentication. Usually through cookies or authorization header

#

no need for a browser

sand crown
#

It's a <form>

#

Hard to tell how they're authenticating. I might be too blank to try and bypass this 😄

woeful pike
#

look at the request and try to replay it in an http client like insomnia or postman. Uncheck different headers/cookies until your request fails

sand crown
#

I'll try this out, thanks.

woeful pike
pulsar bone
#

hey guys can someone tell how to send message to all guilds that have a channel named "Iceland" in discord.py

split hazel
pulsar bone
#

🆘

slender thistle
#

Iterate over each guild, and for each iterated guild, over its text channels. In order to send a message, you'll need to apply logic and use an if statement

eternal osprey
#

how do i show in what folders i can find the pm2 list processes?

#

basically, how can i identify the folders of these namespaces

compact pier
#

@eternal osprey you can look at my setting

#

maybe it would help you

#

btw out-source since 2020 :>

#

and then use this to start pm2 start ecosystem.config.js

eternal osprey
#

is that a pm2 config file?

#

Never used one. Will have a look!

neat ingot
#

how can i check if my bot has application.commands scope for the current guild? is this a thing?

eternal osprey
#

that last index.js is coming from a deleted folder
how the fuck should i retrieve it?

woeful pike
#

retrieve what? the code gets loaded into memory before execution

eternal osprey
#

i deleted the operating folder after starting it with pm2

#

so now i can't even close the pm2 process either as i can't locate that folder

#

so that's why i need the folder back

modest maple
#

if you deleted this with rm -rf ... then you're not getting that back if you dont have a copy

neat ingot
#

Anyone? sad

boreal iron
neat ingot
#

doesnt work

#

global commands arent registered on a per guild level

boreal iron
#

That doesn't matter...

neat ingot
#

ie, that, only works for the guilds that have specific guild commands defined (my support server)

boreal iron
#

They work the same.

#

If you can register a guild command, global commands wont appear, too

neat ingot
#

then why does every other guild return error? even when they are defined

boreal iron
#

As the bot does not have the scope to register commands (in the guild)

#

And the guild can't access global commands

neat ingot
#

but they can, this is what im saying.

#

in a guild that has application commands for my bot, that call returns an error

boreal iron
#

Which call?

#

How do fetch the commands?

neat ingot
#

only in the support server, which is the only one that has guild specific commands defined, does the call return any data. the call to discord api for guild commands list

boreal iron
#

client.application.commands.fetch()

neat ingot
#

and how does that then help for checking if a guild has commands defined?

boreal iron
#

but you can fetch the commands for each guild

neat ingot
#

can you kindly show me how to then?

boreal iron
#

sure

pale vessel
#

Make sure to do it kindly, not aggressively 😛

boreal iron
#
for(const [id, guild] of client.guilds.cache) guild.commands.fetch().catch((error) => console.log(`You can't fetch commands for guild [${id}] (missing scope) - ${error}`));
#

Oh yeah

pale vessel
#

That code looks aggressive

#

{
}

boreal iron
#

Might cause a rate limit if you're in many guilds

pale vessel
#

Thanks

boreal iron
neat ingot
#

ty, im sure i already tried similar code and threw an error, sec

boreal iron
#

Hold on

neat ingot
#

there, fetches nada from a guild that has commands defined

#

for more than one bot

boreal iron
#

Do you may speak about guild commands which aren't registered by your bot? You can't fetch them, never

neat ingot
#

yea i dont want to

#

i only want my ones

#

but there are more than one bot registered commands in that guild, including mine

#

and no commands are being returned by guild.commands.fetch()

boreal iron
#

It doesn't throw an error but an empty collection?

neat ingot
#

correct 😦

boreal iron
#

Okay I've seen many weird issues in the past... You may try to reinvite your bot making sure the scope is correct

neat ingot
#

sigh, im trying to detect when the bot has already been reinvited and the commands are registered, so i can display the appropriate support message (between kick and reinvite, or use slash commands)

#

i cant ask the 750 guilds that just kicked and reinvited him to do so again

#

lol

boreal iron
#

Yeah I got that but that's tricky

#

Discord should automatically add the scope in April (once again)

#

For existing bots

eternal osprey
#

i have made sure that all channels my bot is in have a bot-logging channel. Am i allowed to notify my servers on the bot updates in that specific channel?

neat ingot
#

oh, they are going to auto add the scope for existing bots? interesting, i was expecting them to all just break lol

boreal iron
#

I got told they already did the that once in the past

#

When they introduced the new feature

#

What you can do to make a 100% sure you have the right scope, is to actually register a slash command per guild (and delete it after)

neat ingot
#

~even after kicked/reinvited, still showing an empty collection 😦

boreal iron
#

If that throws an error you can send the guild owner a message to reinvite the bot to use slash commands

neat ingot
#

im sure that would only get guild specific commands

boreal iron
#

OH

#

still showing an empty collection

#

Discord client issue then

neat ingot
#

yes, it only gets guild specific commands.

boreal iron
#

Clear the cache and/or remove the local web story of Discord

neat ingot
#

~ just tested

boreal iron
#

Some have shown for me, too even after I deleted them

neat ingot
#

it returns a collection of 2 in my support server

#

which is exactly correct

boreal iron
#

Ok for the server returning an empty collection do the following:

#

<guild>.commands.set([]);

pulsar bone
#

hey guys can someone tell how to send message to all guilds that have a channel named "Iceland" in discord.py

boreal iron
#

Which will update the guild commands with an empty array, means it clears them all

neat ingot
boreal iron
#

Just in that specific case as something seems to be weird...

boreal iron
#

For all guilds with a huge timeout between each action to make sure not running into any rate limits

neat ingot
#

ok so it seem thats umm

boreal iron
neat ingot
#

if a guild doesnt have the applications command scope, the fetch to guild commands will throw an error, but otherwise returns an empty collection

#

i can use that 🙂

boreal iron
#

You can't check the scope, so that's your only solution atm

neat ingot
#

ty for your helpings ❤️

boreal iron
#

Yeah fetching the guild command will throw an error if the scope is missing

neat ingot
#

i didnt realise that lol, been stressing out for hours over this 😄

boreal iron
#

That's what I told you in the beginning freerealestate

neat ingot
#

yea... i realize that now 😐

boreal iron
#

python

earnest phoenix
#

What have you tried?

boreal iron
#

We will never know

earnest phoenix
#

Guess you can continue driving then

boreal iron
#

lol

#

not at the moment

earnest phoenix
#

I thought you drive all day long

slender thistle
earnest phoenix
#

It may take an hour

boreal iron
#

Try clearing your cache etc.

#

Sometimes it's a client issue

#

You can fetch the global commands

boreal iron
boreal iron
earnest phoenix
#

All I can say is, stay in lane mmulu

boreal iron
#

cough

#

What do we do with promises?

#

2nd

earnest phoenix
#

Break them

boreal iron
#

While 1st choice sounds good, too

#

dude

#

Look at WHAT I wrote

#

Compare that to this

#

And you will see some differences

#

just a few major differences

#

Correct

#

That means they are NOT registered

#

Pushed to guilds is a different story

#

ALSO

#

Your code example will register commands to a guild

#

Can't repeat that more often...
D O N O T use that guide bullshit code, it's BULLSHIT; SHIT SHIT; WASTE; TRASH; GARBADE ...

#

Yeah because guildId isn't defined anywhere in your code

#

You just copied something out of context

#

If you read the guide until the end, it shows how to register global commands even if the guide is SHIT as I said

#

Take a look at there, no need to include builder structures etc.

#

All inbuilt into djs

#

Load your commands from your files, save them in a map (or array), loop through them and push them

#
for(const command of yourLoadedCommands) client.application.commands.create({ name: command.name, description: command.description, options: command.options });

(non-aggressive version just for flazepe)

#

This registration needs to happen ONCE only, never again

#

Updating commands will then happen using set() instead of create()

#

Correct

#

Build a proper command handler, fetching the global commands ONCE on the startup, compare the collection to your (local) loaded files, then update/register/delete them if needed

#

Just a few lines of code will solve all your slash command issues forever

#

Registering them over and over again will sometimes overwrite existing commands causing them to show twice or multiple times all using the slash commands, will result in an error "unknown command interaction" in Discord

#

I share parts of a command handler in here a while ago

#

But you can't search for images (screenshots) if I'm not wrong

#

And nope I'm coding offline... there's no platform or service I'm using to upload my code

#

Just bare npp and copying files as backup sometimes...

#

I mean I can share the image again but I doubt you really see what's going on

#

@earnest phoenix

#

A method I created, part of my utils

#

just a different editor and theme

sage bobcat
#

One message removed from a suspended account.

boreal iron
#

Notepad++

#

Because it's just like writing code like in the default Windows editor

#

hardcore

#

That clearCache function exists to reload the commands (on force) while the bot is running

#

Which would not work since the imported files are cached by default by nodejs

#

Means you gotta clear them before importing the command files

#

(again)

#

huh? No you actually delete the cached file really easy

#

You just need the full path + file name

quartz kindle
boreal iron
#

yeah I mean that's less code than checking any property in a single statement

#

@quartz kindle I think I asked you before but does catch also catches errors appearing in the then clause?

#

Or do I need to catch them as well?

#

promise.then(() => inline.promise).catch((error) => log);

#

If inline.promise fails, does catch throws the error or does my process error handler catch that one?

quartz kindle
#

the catch will work yes

boreal iron
#

If I add catch to the inline.promise, let's say with a different error message, will that catch the inline.promise then?

#

I mean regarding the hierarchy it should, shouldn't it?

quartz kindle
#

yes, if you add another catch, that one will have priority

#

then the outer catch will not work if the inner already did, unless the inner catch throws another error

boreal iron
#

alright, ty

split hazel
#

catch seption

boreal iron
#

fuck nitro

earnest phoenix
boreal iron
#

imagine that's a 16x16 icon, please

earnest phoenix
#

*96x96

sharp saddle
#

a random question, JDA or Discord4J? wich better for bot creation on Discord?

sudden geyser
#

JDA is more popular, so people tend to pick that.

earnest phoenix
sudden geyser
#

I've never used Discord4J, but it does make some bold claims, like being modular and reactive

#

I'd suggest trying it out to see if you like it.

silent spire
#

how to verfy my bot

boreal iron
#

Head to the developer portal and follow the instructions

sudden geyser
#

Personally I don't like JDA since to do anything on an entity you basically have to fetch it first

sharp saddle
quartz kindle
sudden geyser
#

Not really

#

It's not updated often, but it does have the features most bots need

#

including interactions and newer things like autocomplete

#

Eris always felt like abal's project rather than a "for the community" project, so that's probably why it's rarely active.

quartz kindle
#

it feels like its popularity dropped quite a bit tho

earnest phoenix
#

and that's why you should use detritus

quartz kindle
#

nah, you should use tiny-discord

#

:^)

boreal iron
#

That suspiciously sounds like "Tim-discord"

#

you better be careful with Tim's never released API v1 collecting your personal data

quartz kindle
#

lmao

compact pier
#

I can't belive my old commit message are starting with fixed ....

#

sometime just "fixed"...

quartz kindle
sudden geyser
#

"ok time to get serious" would've been the best commit message

quartz kindle
#

nah lets just spam a

boreal iron
#

... while I'm sitting here to press confirm overwrite when manually backing up my files

sudden geyser
#

none of us know git

#

don't feel bad

boreal iron
#

well I don't use github at all

sudden geyser
#

ew

boreal iron
#

I don't like new things, you know

sudden geyser
#

ok fine but categorized stars is killer

boreal iron
#

Am I supposed to answer yes or no? No clue what you're talking about KEKW

sudden geyser
#

it's supposed to confuse you 🙃

#

github has stars

#

you know those things

#

that people think they can eat for breakfast and live off of

#

but now we can categorize (aka list) them, so they're more useful

#

therefore use github :)

boreal iron
#

Stars like the stars I see if I raise my head?

sudden geyser
#

be less dizzy

boreal iron
#

there's actually no reason to, no advantage

#

also the time to figure out all the shit and how it works, eww

#

don't even know if that shit is compatibile with notepad++

small tangle
#

So a is the alias for "damnit i need a commit msg" FeelsSmartMan

sudden geyser
#

Or "Update"

earnest phoenix
#
let snippetName = interaction.options.getString('name')
                let snip = db.get(`snippets.${interaction.guild.id}.${snippetName}`)
                if(snip === null) return; interaction.reply({ content: `No Snippet Found Matching That Name!`, ephemeral:true })```
#

It sends that even tho it did find a snippet.

sleek garden
#

does topggpy work with disnake?

boreal iron
#

db.get() may returns undefined then if it wasn't found

#

you better change the statement to if(!snip)

#

or literally to if(snip) interaction.reply(...)

#

means if snip exists and is anything but not undefined, null etc.

earnest phoenix
#

Fixed! I was passing it even though it was null.

#

I was using return; instead of return

boreal iron
#

yeah didn't read that response message

#

if(!snip) return interaction.reply(...); then

earnest phoenix
#

why...

#
function isWin(type){
  const h={"Common":0.2,"Rare":0.1,"Epic":0.05,"Legendary":0.001,"Champion":0.001}
  return (h[type]<=Math.random())?"chr":"nada"
}
``` this worked in replit but now it doesn't
#

it always returns chr

#

and people getting all the characters/cards in a few seconds

sudden geyser
#

Try logging the value of type

#

and what's happening in your program

earnest phoenix
#

ok

#
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/DragonTahmid1/Clash'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help
#

I've changed git's master branch to main (default one)

#

and it's returning this

eternal osprey
#

How do I actually fix this?

#

Occurred after usin npm I better-sqlite3

small tangle
sudden geyser
#

coding without a plan

#

as you change more and more things, more generic messages are needed

earnest phoenix
boreal iron
#

It’s actually not really needed to install that stuff
You just have to adjust the GitHub links a little to download the packages as archives

quartz kindle
#

hes using 32 bit node

#

there are no prebuilt binaries for that

#

so he needs visual studio to build them

surreal sage
#

How can you calculate this:

If something is ran every 100 MS, how many times does it run per minute?

#

6000 times?

#

no heck

boreal iron
#

100ms * 10 = 1000ms (1s)
1000ms * 60 = 60000ms (60s)

surreal sage
#

Wait what

#

10 per second if 100 ms?

#

What is it

#

Add variables if you can for me to understand

boreal iron
#

600/min

surreal sage
#

And what if its every 5 ms?

boreal iron
#

60000/5

#

Then

#

60000ms = 60s = 1min

surreal sage
#

Basicly

#

How many times until it has reached 60000ms

#

Right?

#

like

#

60000/ms

boreal iron
#

60000ms / 5ms = 12000 times

surreal sage
#

I get it

#

Thanks!

earnest phoenix
#

working (for now), ty

#

and why the db keeps restarting every time I re-deploy?

boreal iron
#

_meth complicated _

earnest phoenix
#

google calculator always helps

lyric mountain
earnest phoenix
#

How can I check if just a normal message contains any 16 digit number, such as a ID?

lyric mountain
#

\d{16}

#

do note, IDs aren't bound by 16-length rule

quartz kindle
#

arent most ids 18 chars now?

boreal iron
#

{16,18}

sudden geyser
#

some are 19

#

I'm pretty sure

boreal iron
#

Hax

sudden geyser
#

though I think restricting the max length is bad

#

since they can continuously grow in that direction

#

astrisk

#

so setting the minimum based on discord epoch and verifying the format would do better

boreal iron
#

That forces you to update your shit! freerealestate

earnest phoenix
#

my id is 18 of length

#

Wait, so how would I tell if its a ID?

#

someone could just post 0000000000000000

quartz kindle
#

the only way to test if its a valid id is to try and use it

boreal iron
#

Isn’t there a djs helper function checking for valid IDs?

quartz kindle
#

for example if its a user id, try fetching the user

quartz kindle
earnest phoenix
#

bruh then better I re-move to replit and use mongoDB atlas

#

all the time in work is wasted

quartz kindle
#

get a vps then

lyric mountain
earnest phoenix