#development

1 messages · Page 1927 of 1

green kestrel
#

discord: imagine a place
discord.js: imagine a bot
D++: imagine not using all your ram and cpu kekek

wheat mesa
slow terrace
#

Can someone help me in some css/html?

delicate zephyr
#

its literally

#

.env

THING=VALUE

index.js

require('dotenv').config()

console.log(process.env.THING) // Returns: VALUE
#

ye

#

it gets the .env and parses it

#

only need to load it once

#

you dont need to?

#

it doesnt

#

just put it at the top of the file

#

unused variables are yukky

#

np

woeful pike
#

you probably don't want to rely on the order of key value pairs in an object

#

also if you have an object that has numbers as keys, why not just use an array

fair axle
#

I solved the problem thanks

quartz kindle
#

why do people delete their questions lol

#

deleting your own questions makes you look more noob than posting stupid questions :^)

boreal iron
#

I was wondering what Xetera was referring to

earnest phoenix
earnest phoenix
earnest phoenix
bold lion
#

why can't i submit my bot again after it has been declined yesterday?

ripe prairie
bold lion
#

ok

warm meadow
#

help

#

i need help

ripe prairie
#

with?

#

just ask, don't ask to ask

warm meadow
#

my bot doesnt delete another bot message

#

lol

ripe prairie
#

what language

warm meadow
#

js

#

😩

lunar cove
#

Do I have a risk of my bot being hacked when I use replit ?

I do use environment variables so yeah imp stuff is saved but I'm worried that replit codes are public so that's why asking.

earnest phoenix
#

there is no risk

#

but yes people can copy your code but not your token

lunar cove
#

Ok thanks.

earnest phoenix
#

I'm using oauth to authorize the user through a nextjs api endpoint:

// /api/oauth_callback

export default function OAuthCallback({ req, res, query }) {
  const { token } = query;

  // authorize smh
}
#

How do I redirect the user after authorizing?

#

3xx status code?

earnest phoenix
#

not sure if next is same but in express I would use
res.status(302).redirect('/path')

fast marsh
#

MongooseError: Operation `prefixes.findOne()` buffering timed out after 10000ms at Timeout.<anonymous> (C:\Users\Admin\OneDrive\Desktop\Tension Bot\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:149:23) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7)

#

tbh im completely lost here

wheat mesa
#

looks like your db didn't respond within 10 seconds ig

fast marsh
#

would that be a mongoose issue?

wheat mesa
#

no, a mongodb issue

#

either your db isn't responding or you did something incorrect in your query

#

(from what I can tell at least)

earnest phoenix
wheat mesa
#

ah yeah that's important

earnest phoenix
#

like await mongo.connect(....)

#

actually mongoose has the mechanism to detect it,but sometimes if the db/internet is slow ,it buffers out,since it couldn't connect at the shorttime

fast marsh
#

yeah i added the await and it still gave me the same issue, prolly my internet

earnest phoenix
#

is your function async and is it executed async?

fast marsh
#

yes

earnest phoenix
#

(async()=>{
...
})();
This would be a approach,if you paste inside your root file(index.js)

fast marsh
#

ahhh

#

nah it still doesnt work for me

#

i dont have my connection in index.js, i have it in ready.js

earnest phoenix
fast marsh
#
const mongoose = require("mongoose");

const { mongoPass } = require("../../config.json"); 
module.exports = async (client) => {
 setInterval(() => {
   client.user.setActivity(`${client.guilds.cache.size} Servers | .help`, {
     type: "WATCHING",
   });
 }, 40000)

  let allMembers = new Set();
  client.guilds.cache.forEach((guild) => {
    guild.members.cache.forEach((member) => {
      allMembers.add(member.user.id);
    });
  });

  let allChannels = new Set();
  client.guilds.cache.forEach((guild) => {
    guild.channels.cache.forEach((channel) => {
      allChannels.add(channel.id);
    });
  });

  console.log(
    chalk.bgMagentaBright.black(` ${client.guilds.cache.size} servers `),
    chalk.bgMagentaBright.black(` ${client.channels.cache.size} channels `),
    chalk.bgMagentaBright.black(` ${allMembers.size} members `)
  );

  await mongoose
    .connect(mongoPass, {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useCreateIndex: true,
      useFindAndModify: false,
    })
    .then(
      console.log(
        chalk.bgGreenBright.black(
          ` ${client.user.username} connected to Mongo DB `
        )
      )
    )
    .catch((err) =>
      console.log(
        chalk.bgRedBright.black(
          ` ${client.user.username} could not connect to mongo DB `
        )
      )
    );
};``` 

this is my ready.js and cant seem to figure out the problem here
earnest phoenix
#

apparently you can't access window or document in nextjs

#

no

#

file databases are harder to use and more easy to corrupt

wheat mesa
#

If you try to write to the same file with more than one thread you’ll corrupt your data iirc

#

File databases are not thread safe

earnest phoenix
#

I have a user's oauth access token
how do I fetch data about them
the discord docs are super shit and idk which credentials I need to send to /users/@me/guilds to get the user's guilds

#

I may have underestimated the power of a google search

pale vessel
#

Just the authorization header?

earnest phoenix
#

what do I send in authorization header

#

Bearer tokensjds8uyfj?

pale vessel
#

Yes

earnest phoenix
#

ty

pale vessel
#

Remove the Bearer if you're doing some self-botting stuff

earnest phoenix
#

no v9 in the api url?

pale vessel
#

That would use latest by default

earnest phoenix
#

that is always a bad idea

pale vessel
#

If you're going for prod, specify the ver

earnest phoenix
#

slap me with try it and see

pale vessel
#

Sorry, by default it uses version 6

#

Not latest

earnest phoenix
pale vessel
#

So specify v9 manually

#

No idea, Discord is retarded

#

v6 is deprecated too

earnest phoenix
#

35 reasons to work at discord:

  1. you got rejected for everything else.
  2. smol brain
  3. countn't
grand wharf
#

whats the command to get the user's name?

grand wharf
#

ty

rancid token
#

Can anyone who knows the right discord tell me how to assign roles but can't message in admin's private chats

ripe prairie
#

just give them manage roles and not admin perms

rancid token
#

How to make a role into a manager?

boreal iron
#

@quartz kindle Finally...

delicate zephyr
boreal iron
waxen bough
#

is it possible to put nodejs source code to android studio?

glacial vapor
earnest phoenix
#

I can already sense somebody complaining about it

glacial vapor
earnest phoenix
#

do you actually think people care if the feature's useful

stuck ravine
#

Hello, does anyone have another method for stopping a while? Because I have an if that is in a while but with a return it doesn't stop anything

earnest phoenix
#

break

spark flint
#

do something like ```py
x = True
while x == True:
#do something
x = False

earnest phoenix
#

you're not telling me python is so stupid to not even have break

spark flint
#

there is break

#

iirc

stuck ravine
#

Yes but break doesn't work in this and the technique with true and false either, nothing works in js

spark flint
#

i just would use x = False

#

ohh js

#

i forgot other languages existed

quartz kindle
#

if you have an async function, then no, it will not work

#

because the event loop will never execute pending operations until all the current sync code is done

delicate zephyr
#

wait is that public or just experimental atm

#

ah

tribal karma
#

yiğit benim pc bişi oldu

#

ekranın fovu içiçe

#

nasıl düzelticem

quartz kindle
lyric mountain
#

well, python is sync by nature

#

and runtime waits for async stuff to finish so they're virtually useless

quartz kindle
#

well idk about python

#

but in js for example:

#
let a = true;
setTimeout(() => a = false, 100);
while(a) {};
console.log("done")
#

this will cause an infinite loop

#

because the while loop does not allow the event loop to proceed, so the timers are never executed

#

the same would happen if it was a promise instead of a timeout

#

the only way to fix it is to have an await inside the while loop, to break its synchronicity, something to pause it and allow the event loop to run its pending operations

earnest phoenix
lyric mountain
#

are you coding on powershell?

#

well, you could add a return to the very start of the cmd or thing like that

#

it'd prevent further execution of the command

quartz kindle
#

that error has nothing to do with your snippet

quartz kindle
#

lmao once again people delete their question

rose warren
#

Can you really only have one emoji in slash command string options?

#

These are my options

  { name: 'Default: 👍 🤣 ❤️ 😮 🔥 🥱', value: 'default' },
  { name: 'test: 👍', value: 'test' }

Only test works and default shows but when I try to select it it says invalid value

#

Oh weird... When I separate them with a comma it works

#
let slash_choices = []
for (let i = 0; i < templates.length; i++) {
    let emoji = templates[i].emoji.join(', ')
    slash_choices[i] = {
        name: `${templates[i].name}: ${emoji}`,
        value: `${templates[i].value}`
    }
}
#

That works

#

But spaces doesn't...

#
let slash_choices = []
for (let i = 0; i < templates.length; i++) {
    let emoji = templates[i].emoji.join(' ')
    slash_choices[i] = {
        name: `${templates[i].name}: ${emoji}`,
        value: `${templates[i].value}`
    }
}```
#

I am confusion

mellow mauve
#

looks weird Thonk

rose warren
#

Literally you can separate the emoji with , or - (so, with spaces around them), and that will work, but separating the emoji with just a space doesn't work...

#

Discord moment...

#

I even tried alternative whitespace characters and they didn't work either

main trench
bold lion
#

it appears that my bot has been temp rated so i dont know if it can come back by the time the bot reviewers check it

solemn latch
#

Not sure what temp rated is referring to, but if we can't use the bot then we cannot test it.

bold lion
solemn latch
#

Ah ratelimited? Then we can't test it

short pilot
#

buttons no longer are removable from a message now?

#

every time i refresh the page, the buttons come back, saw someone with same issue in discord server

#

editing the buttons to something different works however

bold lion
solemn latch
short pilot
#

before i just did components="" and it removed them

#

idk why they would stop that working

solemn latch
#

Try components=null

#

Rather than empty string

short pilot
#

i'm in python and tried that, it threw and error

quartz kindle
#

try an empty array/list

short pilot
#

oh wait it didn't throw an error, double checked

quartz kindle
#

pretty sure the json api expects an empty array

short pilot
#

same behaviour, the buttons reappear on refresh of components=None

short pilot
solemn latch
#

Like they go away then come back after refreshing discord?

short pilot
#

yeah

solemn latch
#

Potentially a discord bug?

short pilot
#

Possibly, editing the buttons to be disabled or whatever works though flork_uuhhmm

short pilot
#

have no idea what argument it wants pepe_thinking

boreal iron
#

Try the message.components as argument

short pilot
#

also tried pasting the list of components in there and Button

#

also tried the custom_id

woeful pike
#

array.map is also a great alternative

const slashChoices = templates.map(template => {
  const emoji = template.emoji.join(" ")
  return {
    name: `${template.name}: ${emoji}`,
    value: `${template.value}`
  }
})

look at how much cleaner this is

spark flint
#

slash commands are confusing

rose warren
boreal iron
rose warren
#

Still though. It's weird how it doesn't let you put spaces between emoji...

lament rock
#

string choices can have any character in them

rose warren
#

Shows as invalid if you have multiple emoji separated by spaces

short pilot
#

angryawooglitch how do i figure out what argument it wants

rose warren
#

But commas, hyphens etc all work

lament rock
#

Make sure there are no spaces between choices like
this,is,a,choice

rose warren
#

But I want spaces between them. That's the point.

lament rock
#

idk then

rose warren
#

A comma and a space between each works, but just a space doesn't

#

Discord moment

lament rock
#

discord sucks. Nothing new

rose warren
#

(space)hyphen(space) also works

#

Basically anything works with a space between the emoji as long as there's another character with it. Separate the emoji with spaces alone and Discord's like "nope"

ember fiber
#

i need help

earnest phoenix
#

H

lament rock
#

??= is a node 16 operator pretty sure

ember fiber
#

oh okay i'm in node 14

wicked pivot
#

how to create this by percent example 10/50 = 10% out of 10 single blue emoji

solemn latch
#

then just put them next to each other

wheat mesa
lyric mountain
#

same for red

#

adjust precision to ur liking

boreal iron
solemn latch
#

Oh they meant the logic for it

#

I thought they meant the practicality

lyric mountain
#

also u don't need parens for that fake mmLol

wheat mesa
#

still easier to read

boreal iron
#

just because you're crazy doesn't mean, I am, too

#

formatting is one of the most important things when coding

simple stump
#

My bot isn’t displaying their game on their status for some reason.
Code: https://sourceb.in/yl0dmOnQ03
The bot has it’s status set to “idle” sometimes (for some reason it doesn’t show all the time…?), but it doesn’t say, “Listening to Ranked Bridge” for some reason.

lyric mountain
#

let progress = 57 * 10 / 100
vs
let progress = ((57 * 10) / 100)

boreal iron
#

not even what I wrote

lyric mountain
#

let ((57 / 100) * 10) = 5,7
Unexpected token: "," on index 26
Illegal assignment on left side (idk what console would even output in this case)

boreal iron
#

That's called TEXT not code example lol

#

GO ON WEIRD BRAZIL!!!!11!

lyric mountain
boreal iron
#

pandasad 🔫

fast marsh
#

Mongoose will be the death of me

lyric mountain
#

splash splash

lyric mountain
woeful pike
#

not using mongodb gang

delicate zephyr
earnest phoenix
lyric mountain
#

pogstress sometimes

cinder patio
#

Using the most appropriate database for the job gang

main trench
#

MySQL best bot db 🥰

lyric mountain
#

woah there, no need to brag abt ur masochism

brave stump
#

A

lyric mountain
#

don't think so

brave stump
delicate zephyr
#

not really

#

You could do

lyric mountain
#

save the lambda to a variable

#

then pass it to both events

delicate zephyr
#

function thing() {}

client.on('thing', thing)
#

=>

#

is lambda

lyric mountain
#

lambda = () -> { stuff }
arrow = () => { stuff }

#

I just call it lambda bcuz fuck it

main trench
lyric mountain
#

mysql has too many self-sabotaging issues to be bearable

#

maria is basically mysql but useable

main trench
#

Good thing I don't log much

#

Also since yall are faster and more reliable than d.js server do you know if let's say I set global commands then after a minute turn off the bot if those commands will continue to register or not?

lyric mountain
#

the interactions will still send events to the bot

#

but the bot will not answer 'em since it'll be off

#

the commands don't store any action or code, they only tell your bot they were used

rocky hearth
#

For node14 which target should i select in tsconfig.json?

earnest phoenix
#

my english broke there

brave stump
earnest phoenix
#

btw mongodb module > mongoose

rocky hearth
#

U broke again there

earnest phoenix
#

wut

rocky hearth
#

**module ^

earnest phoenix
#

uwot

main trench
#

I added a option to the command that if it's not used will basically break the db

lyric mountain
#

how?

main trench
#

My bot does custom commands and I added command permissions that can be set

#

However in the db permissions is a required thing

#

So 💀

lyric mountain
#

ic

main trench
#

In reality I can just lock the command until that option pushes

lyric mountain
#

ur using params instead of concatenation right?

main trench
#

Lemme google what that is 💀

lyric mountain
#

SELECT * FROM table WHERE id = :id instead of SELECT * FROM table WHERE id = ${id}

main trench
#

Pretty sure it is like I said I use prisma so it handles the painful sql stuff

lyric mountain
#

ah ok then

main trench
#
const exists = await prisma.cCommands.findUnique({
 where: {
 id: triggertouse, 
},
 select: {
 guild: true 
  } 
})
#

Basically

#

Then I sort the guilds the trigger is in

#

And yeah

main trench
#

Can't wait

cinder patio
#

Codacy is so fucking stupid

#

99% of my issues are from markdown files

#

Everything else is the "Expected linebreaks to be 'CRLF' but found 'LF'." error

lyric mountain
#

just use crlf

cinder patio
#

which is also bull because GITHUB AUTOMATICALLY CHANGES THEM TO LF

#

EXCUSE ME

simple stump
#

My bot isn’t displaying their game on their status for some reason.
Code: https://sourceb.in/yl0dmOnQ03
The bot has it’s status set to “idle” sometimes (for some reason it doesn’t show all the time…?), but it doesn’t say, “Listening to Ranked Bridge” for some reason.

main trench
#

v12 or v13

#

@simple stump

simple stump
main trench
#

Yeah they changed how to do it

#
client.user.setPresence({
 status: '',
 activities: [{
 name: "",
 type: "", 
}],
}, time);
#

@simple stump

#

Time isn't required my bot uses it to i kept it

simple stump
#

👍

#

Thanks

quartz kindle
#

time is not even a thing

#

where did you get that from?

main trench
#

Works on my bot 🤷‍♂️

simple stump
#

By the way does anyone use node-canvas? I think I’ve had issues with it in the past. Can you use the latest version with Node v16?

quartz kindle
#

it literally does nothing

main trench
#

Changes the status every few minutes

quartz kindle
#

no?

main trench
#

Does on my bot

quartz kindle
#

are you not confusing it with setInterval?

main trench
#

I know set intverval does that but it works on my bot like this so idk

#

Can't explain it 🤷‍♂️

quartz kindle
#

if you cant explain it, then it doesnt work

#

its something else doing it

main trench
#

It works I use it to displays what servers the bots in

simple stump
main trench
#

Idk

#

I'll take a look later

quartz kindle
#

the time parameter literally doesnt exist

#

neither in the docs nor in the source code

main trench
#

🤷‍♂️

#

I don't display the servers anymore so it doesn't really matter

quartz kindle
#

well it matters that you cant really tell other people to do that, since it doesnt exist

#

id like to know where you even got that from

blissful falcon
#

does anyone know how to make a say command on a bot on js

main trench
blissful falcon
#

what?

#

im new to this lol

#

all in index.js

#

k

#

should do that lol

stray seal
#

      app.get('/', (req, res) => {
        render(res, req, 'stats-index.ejs', {
      guilds: client.guilds.cache.size,
      users: client.users.cache.size 
    });
    });

The code is SUPPOSED to count how many Users and Servers the bot has. It says 6 Servers, which is true, but only 1 User, which it has 36 i think i seen in my Console. Can someone help me?

lyric mountain
#

don't brag user count, it's unnecessary strain on the bot

#

you can tho return a rowcount of users saved on db, which is probably the only right way to do so

lyric mountain
#

other ways are either too imprecise or too heavy

lyric mountain
stray seal
#

So, i should take out users?

#

And just have Servers showing on my Website?

lyric mountain
#

probably, usercount is meaningless anyway

#

cache is supposed to store only frequently used values

drifting wedge
#

Usercount is big number

#

Big numbers good

lyric mountain
#

yeah, that's (kinda) close but imprecise

#

at some point, you're better just doing serverCount * (7500 + 2500 * Math.random()) if bragging does matter for u

#

noone is gonna count anyway

glacial vapor
#

i forgot what bot perm my bot needs for that KEK

lyric mountain
#

fetch instead of cache

stray seal
#

@lyric mountain, @earnest phoenix tried to add it and it is not working either

#

xD

main trench
earnest phoenix
#

Create .gitignore file

#

and paste node_modules inside the file

#

An Extra Step is required if ,you pushed node_modules too github

lyric mountain
#

kekw

#

you also have those 2 dbs

earnest phoenix
#

btw ignore your config.json to

lyric mountain
#

which should be gitignored

#

why would u push a db? you should always re-create if missing

#

but never push

earnest phoenix
lyric mountain
#
node_modules/
config.json
*.db
#

put inside a .gitignore

#

then clear git cache and git add .

#

cuz already added files won't get ignored automatically

earnest phoenix
lyric mountain
#

git rm -r --cached .

earnest phoenix
#

sweet

glacial vapor
#

gitignore doesnt like ignoring .env files KEK for me

lyric mountain
#

*.env

#

if u do only .env it'll ignore all files named .env

surreal sage
#

I'm starting with PHP and I've come across an error

#

It seems like it cant handle more characters then ~7

#

Please ping me when you're helping

lyric mountain
#

error is the first 4 words in your first message KEKW

surreal sage
#

@lyric mountain Can you explain?

lyric mountain
#

just a joke, don't take it seriously

surreal sage
#

Oh

#

It's just a decor thing

lyric mountain
#

anyway, doesn't .replace accept a regex?

#

if so, you might need to escape characters such as *

surreal sage
#

'escape characters'?

#

as in avoid?

lyric mountain
#

as in make it treat as a literal

surreal sage
lyric mountain
#

* matches 0 or more characters

#

that in regex

#

usually replace accepts regex as input

surreal sage
#

Do i have to use something else for that one

lyric mountain
#

try first with simple chars like a, b, c, d, etc

#

see if the 7-char error still occurs

#

if it doesn't it's mostly likely a regex issue

surreal sage
#

(left, right)

lyric mountain
#

use simple chars

surreal sage
#

ight

lyric mountain
#

instead of special chars

#

see if it'll work

surreal sage
#

Hmm yeah..

#

Issue resolved

#

Thanks

lyric mountain
#

so, was it that?

#

if so, just use \ to escape

#

like \*

lament stump
#

Does someone here have experience with ReactTS / Next.js?

#

I want to make a nav-bar that:

Normally:

  • Shows links as text
  • Hides the icons

and at 800px Screenwidth:

  • Shows links as icons
  • Hides the text
#

(Like a budget way of making it responsive)

#

Please ping me if you have an idea

quartz kindle
#

idk if there is a specific way for next/react

#

but you can just use css media queries lol

lament stump
#

i'm trying to use useState

lament stump
quartz kindle
#

well, react is js, so you can use js functions to check window size

lament stump
#

idk js like that .-.

quartz kindle
#

literally just google "js window size"

lament stump
#

oh

#

i am dum

#

now I just need to make a check

#

nvm useState would be stupid to use

#

Okay, I figured it out. I just made the text transparent on 800px+

warm jewel
#

Anyone have a bot that will change every humans nick name

boreal iron
#

Sounds like spam

warm jewel
#

I just want a bot to change everyone’s nick to have a 🎄for Christmas

boreal iron
#

Well… spam, therefore API abuse

slender wagon
#

how do i add a required option on slash commands
/p 'messageId'

warm jewel
boreal iron
slender wagon
#

do u have link to the docs

boreal iron
#

Sure one second

slender wagon
#

man these slash commands are weird as hell

#

idek how to get the input from em

#

also thx

boreal iron
#

You’re working with djs?

#

If so interaction.options provides the user input

#

You can simply use get() or other methods to get the value (user input) of an option you defined with your slash command

slender wagon
#

oki thx

slender wagon
#

ty

boreal iron
#

For example, you defined an option named "link"

slender wagon
#

what do types do

boreal iron
#

interaction.options.get("link").value

slender wagon
#

oh gotchya

#

i wanna make an option that gets an id

boreal iron
#

Or using the predefined methods

#

interaction.options.getString("link");

slender wagon
#

gotchya on that part

#

the one on the docs only displays a slashcommand with choices

boreal iron
#

If you specify the option as user then use the associated method getMember() or getUser() to get the user/member resolvable

#

A random ID? That would be a number then

#

The option would need to be a number (type) to verify the inputs

proven lantern
#

how do you make these groups?

boreal iron
#

Assuming it’s just a number

slender wagon
#

i just wanna get the number

boreal iron
slender wagon
#

i define it later on

proven lantern
slender wagon
#

which type stands for strings?

boreal iron
#

Well string

#

You don’t need to use the type numbers

#

The API also accepts the associated names

#

type: "STRING"

#

This counts for ANYTHING btw

slender wagon
#
data: new SlashCommandBuilder()
        .setName('p')
        .setDescription('Post a message, made just for me!'),
        options: [
            {
                "name": "messageid",
                "description": "Message Id",
                "type": String,
                "required": true,
            }
        ],
#

this no worki

#

i mean it doesn't throw any error

#

it just no worki

boreal iron
#

Look what I wrote about the type

slender wagon
#
 options: [
            {
                "name": "messageid",
                "description": "Message Id",
                "type": "STRING",
                "required": true,
            }
        ],
boreal iron
#

Yeah that comma at the last property

#

That doesn’t belong there

#

just to say

slender wagon
#

doesn't show the error yet

#

i mean the option

boreal iron
#

?

slender wagon
boreal iron
#

Did you register the command right now?

slender wagon
#

wym

#

no it's only on development

#

afaik

boreal iron
#

If you define options for a slash command you need to register them

#

Register the slash command in the first place or if you change options then update it

slender wagon
#

wym register

boreal iron
#

Well slash commands need to be registered before you can use them in a Discord server

slender wagon
#

i can use em

#

it just doesn't show the option

boreal iron
#

Idk your library backend and what does register the commands for you

slender wagon
#

the slash commands work just fine

#

but it's not showing this option for some reason

boreal iron
#

If that is a global command it can take up to an hour until it’s registered or updates are pushed to all guilds

slender wagon
#

it's not

boreal iron
#

Well I’ve got no clue what lib you are using to create slash commands and register them

slender wagon
#

d.js

boreal iron
#

Yeah but you must have registered this command somehow

slender wagon
#

woops

#

my bad

boreal iron
#

If not it would never magically show up

slender wagon
#

found this

boreal iron
#

// Get the final raw data that can be sent to Discord

#

You have to send (register) that command to the API if that builder isn’t doing it automatically

#

I doubt it does for you

#

You might wanna take a look into the docs how they are registered

#

That’s essentially to use slash commands

#

The slash command builder just creates the final object for you like the embed builder etc not more

#

You have to serialize that object and send it to Discord or use an inbuilt method in your lib to do that for you

slender wagon
#

they are registered

boreal iron
#

It’s similar to building a command handler for common commands

slender wagon
#

i think i found the problem

#

but it's reallly late for me now to think properly

#

so i am thinking of working tomorrow on it

boreal iron
#

If you update the options you need to update the registered command as I already said

slender wagon
#

bruh these slash commands really suck tbh

boreal iron
#

Not really

slender wagon
#

the issue is i am dumb

#

and that option would never work there

boreal iron
#

What no?! Wtf

slender wagon
#

but tomorrow i gotta find out how to use options inside a command handler

boreal iron
#

Yes changes will always require you to update the registered command to the API

slender wagon
#

yeah but i am using dev mode

#

so it shouldn't require that

boreal iron
#

Wtf is dev mode?!

#

Commands need to be registered always if a guild should show them

#

That’s how it works - no exceptions

earnest phoenix
boreal iron
#

Discord stores you registered commands, they don’t care if your bot is running or not or you’re able to receive the event or not

#

If you change something you will have to tell Discord the changes

#

Or they will still store the previous old version

stray seal
#

How do you install Java 16 on replit?

#

Ping me with answer since I have this server muted xD

boreal iron
#

If they are registered (stores by Discord) they will be usable in guilds

#

There’s no dev mode or test mode or whatever

#

That’s how slash commands work - simplified

stray seal
#

How do I upgrade to NODE 16+ on REPLIT?

#

can someone help me?

#

FIXED

lyric mountain
stray seal
#

FIXED

solemn latch
#

you are missing a comma before the type line

stray seal
#

ok

#
const { Client, CommandInteraction, MessageEmbed } = require("discord.js");
const commands = require('../commads.json')

module.exports = {
    name: "help",
    description: "Get the help menu",
    type: 'CHAT_INPUT',
    run: async (client, interaction, args) => {
      const help = new MessageEmbed()
      .setTitle('**Commands**')
      .setDescription('here are the commands' + ${commands})
      message.channel.send({ embeds: [help] })
    },
};

What errors will i get this if i run this? My IRL friend wants to know xD

lyric mountain
stray seal
lyric mountain
#

It's a douchebag move to delete/edit your question after being solved

#

What if someone else hit the same issue as you? They could've read what u did to solve

lyric mountain
#

And ask ur friend to come here and ask himself, it's weird to have a middleman

stray seal
#

So he can't join...

lyric mountain
#

Ah

#

Well anyway, run the code and see for yourself

boreal iron
#

Lots of stuff is wrong with it oldEyes

boreal iron
#

Enter the verification code and Discord stops fucking you up with it

#

You don’t need the number again

#

Not only a valid option if you haven’t a phone number also if you don’t wanna share the number to Discord

woeful pike
#

why not just ask in one of the countless programming servers without phone verification instead of sending someone to ask a question on your behalf in an unrelated server lol

prime glacier
boreal iron
#

Assuming you’re still speaking about SQL

#

For variable strings VARCHAR

lyric mountain
#

TIL ++i++ is a valid statement

boreal iron
#

For larger non-indexed strings TEXT is your choice

#

No matter its length making it a tiny text, long text etc.

#

Same as ints

wheat mesa
earnest phoenix
#

I was just about to ask the purpose of ++i

wheat mesa
#

nvm I think I'm wrong

#

thought i remembered something about shallow and deep copies from somewhere, ig I'm wrong

lyric mountain
#

It's more like "return then increment" and "increment then return"

#

++i is very rare to be able to exist in any code anyway

woeful pike
#

it's
copy the number
increment the variable
return the copy
vs
increment the number
return the number

wheat mesa
ripe prairie
#

i++;

#

not ++i, i dont think

wheat mesa
#

I always use ++i in those

#

that's what I was taught to do

#

I use i++ in every other lang though

cinder patio
#

Uh no they both incrememt the variable, i++ just returns the previous number, ++i returns the new number

#

at least that's how it is in js ^

lament bronze
#

Use arrays

lament rock
#

Arrays have alloc overhead in memory since they're special objects. The alloc size of a long string is much smaller than an Array of chars since strings have an initial alloc size

grand wharf
#

any1 knows why this isnt working?

slender thistle
#

If you want to format the string, refer to Python formatting methods, such as %, .format(), or f-strings.

#

What you are doing is pass multiple arguments instead of one formatted string. Python's print function uses all positional arguments to format the string, whereas .send() in d.py does not.

delicate zephyr
#

for example: @slender thistle correct me if Im wrong havent done python in a while
f-string format is: f"Hi there my name is {name}"

spark flint
#

f string flooshed

#

gotta love it

slender thistle
delicate zephyr
#

honestly, that's helpful for me

#

havent done python in a while

slender thistle
#

They follow different implementations and by far f-strings have also proven to have the best performance compared to the rest. The difference, however, isn't very significant unless you are working with hundreds/thousands of strings

#

xd np

delicate shore
#

Hello guys

#

how to use require or import in web-based javascript

#
const {fetchInfo} = require('functions/fetchInfo.js');
const {editDislikes} = require('functions/editDislikes.js');
const {fetch_from_repl} = require('functions/fetch_from_repl.js');
const {put_on_repl} = require('functions/put_on_repl.js');
const {addBar, likePercentage} = require('functions/bar_fns.js');
#

This is my script.js for a chrome extension

#

I want to use require

delicate shore
#

Even if I try to use import it doesn't work

delicate zephyr
#

You can

#
// Require an ESM package
const { default: package } = require('esm-thing')
#

@delicate shore ^^^

delicate shore
#

if we are using ESM

#

lemme try

#

what is default: package supposed to be

delicate zephyr
#

package is the variable name

#

so like

delicate shore
#
const { default: fetchInfo } = require('./functions/fetchInfo')
#

alr

#

thanks

#

lemme see

delicate shore
delicate zephyr
#

weird

delicate shore
delicate zephyr
#

oh?

delicate shore
#

this is what I have been getting

#

from starting

delicate zephyr
#

Oh

#

you cant use require in browser

#

thats a nodeJS built-in tool

delicate shore
#

bruh moment

pale vessel
delicate shore
#

which language

#

which wrapper

#

if its true then it is

#

if not then not

spark flint
#

what language

#

oh djs

#

in python its if not ctx.message.channel

#

so its likely if (!message.channel) or something similar

delicate shore
#

😩

earnest phoenix
spark flint
#

ohh yeah

#

that

pale vessel
#

Could also check the channel type

spark flint
#

<message>.channel.type === 'dm'

earnest phoenix
#

Yeah, you can't generalize Python btw bloblul

spark flint
#

ik

#

i just know that its similar because i've used a bit of djs before

earnest phoenix
#

Fair

spark flint
#

message.guild === null would work too

pale vessel
#

!!(await Boolean(message.guild))

#

I don't know about you guys but this looks much cleaner

#

!message.guild

#

It could be other than null, like undefined but I'm not so sure since Discord.js's structures are quite consistent

spark flint
#

if (!message.guild)

#

oh

lyric mountain
#

in what sense doesn't it work?

#

it pass the condition or it errors?

delicate shore
#
  "web_accessible_resources": [
    {
      "resources": ["/functions/*"]
    }
  ],

I tried something and got this error :```
Invalid value for 'web_accessible_resources[0]'. Entry must at least have resources, and one other valid key.
Could not load manifest.


But according to their docs, I am doing it correctly: <https://developer.chrome.com/docs/extensions/mv3/manifest/web_accessible_resources/>
lunar cove
#

Umm what would be regex for ` which is backtick, I have tried and searched a lot but couldn't find

hybrid cargo
#

` is the regex for `

#

idk what you exactly need, like match all the ` in a string, or replace all ` in a string, cuz your question is so blunt

lunar cove
lyric mountain
#

use console.log("works") to find out where the runtime pass

#

also log what message.guild is returning

vast cedar
#

it is possible to send a json file using discordjs?

earnest phoenix
#

Hello

cinder aspen
#

Hello what is the lignes to see in mode in the bot's bio we see how many members it has in all on all the combined services ?

raven urchin
#

${client.guilds.cache.size}

lyric mountain
#

cache will never return the full count

#

and bragging user count is quite dumb if you ask

cinder aspen
#

no, but to see the total of members in my bot mode and on 30 servers and the number of members in all ?

lyric mountain
#

what?

cinder aspen
lyric mountain
#

I can't really understand what you're saying, sorry

cinder aspen
lyric mountain
#

nope

cinder aspen
lyric mountain
#

even if you need to sacrifice your RAM?

cinder aspen
boreal iron
cinder aspen
#

the server I have the line but it is the member efectively.

cinder aspen
#

Should anyone mention it to me?

quartz kindle
#

you need guild.memberCount

#
let count = 0;
client.guilds.cache.forEach(guild => {
    count += guild.memberCount;
});
cinder aspen
quartz kindle
#

${count} users!

#

after creating the count like i showed

cinder aspen
#

?

lyric mountain
#

that wouldn't return the exact member count tho

#

not by a long shot

lyric mountain
# cinder aspen Yes

if you're willing to sacrifice ram to achieve the membercount, just fetch all guilds and fetch all members of each

#

do note however, that this is effectively a ram nuke

#

I don't mean a GB or two, I mean ALL or even more than your available ram

quartz kindle
#

memberCount will always be more accurate than counting cached members

#

even if you fetch them all

lyric mountain
#

I meant fetch both guilds and members

quartz kindle
#

guilds are cached by default

cinder aspen
quartz kindle
#

i already told you what to do

#

its not hard, just think a little

cinder aspen
#

But I am basic French

#

I do not understand everything

spark flint
#

And I’m a basic bitch but that doesn’t stop me coolio

cinder aspen
quartz kindle
#
{
// your other code ...
let count = 0;
client.guilds.cache.forEach... etc...
// your other code ...
{ name : `${count} users!`, etc... }
// your other code ...
}
lyric mountain
#

cant u just map it tho?

quartz kindle
#

you can reduce it

#

but im not gonna show him that if he cant even underatand this

lyric mountain
#

true

delicate zephyr
#

trial by fire

lyric mountain
#

abt to be dad luke?

delicate zephyr
#

indeed

#

Have a kid on the way

quartz kindle
#

woah

lyric mountain
#

nice, wish u good luck

grizzled raven
#

yoooO

quartz kindle
#

congrats

grizzled raven
#

character development

delicate zephyr
#

Thanks 😄

solemn jolt
#

What's happened to my bot

solemn latch
# solemn jolt

have you enabled sharding?
if not is your bot in above 2500 guilds?

solemn jolt
solemn latch
#

id suggest reading the whole page

#

otherwise sharding could become very confusing.

solemn jolt
#

Ok thx

earnest phoenix
#

Internal sharding is fine till 15-20 shards and it comes up to your bot usage

solemn latch
#

Can you really internal shard that far? Cool

lyric mountain
#

20 shards is like, 30k servers if my math is right

earnest phoenix
#

1 shard max 2.5 guilds

earnest phoenix
solemn latch
#

I thought it would be like 10 max on a good cpu and being pretty lightweight code

#

Great cpu*

But I'll admit I've never gotten any bot large enough to shard

earnest phoenix
solemn latch
#

The way I would check is just using the date.getDay method to check the day of the week.

blissful coral
#

Just check if the day is Saturday or Sunday?

#

if(["Friday", "Saturday", "Sunday"].includes(Date.getDay()))

solemn jolt
#

Another error

solemn latch
#

Get day returns an int doesn't it?

solemn latch
blissful coral
#

o wait

#

im dumb

solemn jolt
solemn jolt
blissful coral
#

.getDay() returns a number

#

if its 6 or 0

#

its a weekend

#

yeah there you go

solemn latch
#

Op I was going to suggest a way less cleaner method of doing it ^_^

lyric mountain
#

6 or 0?

solemn latch
#

0 is sunday

lyric mountain
#

friday is a weekend too isnt it?

blissful coral
#

I almost sent

#
if(!(myDate.getDay() % 6)) alert('Weekend!');
#

Some people consider friday a weekend

lyric mountain
#

technically sunday is a weekstart KEKW

blissful coral
#

tf

#

lmao

solemn latch
#

Was going to do getDay === 6 || getDay === 0
Kek

lyric mountain
#

getDay === 6 || 0

#

kekw

blissful coral
#

Nah thats not how it works

#

That'll be like saying Boolean || 0

lyric mountain
solemn latch
#

Once I tried to do
(getDay ===) 6 || 0

blissful coral
#

lul

solemn latch
#

Like actually tried to do that

#

Hi

#

It won't

blissful coral
#

I mean

#

Woo

#

If you knew

#

Basic JS fundamentals

#

And syntax

#

Then

solemn latch
#

But I tried, and logically it made sense to me.

#

I was new ^_^

blissful coral
#

but in javascripts eyes that logic is big dum

#

ah nvm then

#

lul

#

fr

solemn latch
#

I wonder what the error would be, can't remember

blissful coral
#

uh

#

unexpected token

solemn latch
#

which is valid

blissful coral
#

yeah

#

lmao

lyric mountain
#

imagine a compile that'd mock you anytime an error happened

#

army's instructor compiler

solemn latch
#

you wizard

#

I miss the days of not understanding syntax.
stuff was so simple

#

copy the error into google, bam answer

lyric mountain
#

I miss the days of not understanding syntax.
hop into an esolang

#

if you want a syntax challenge

#

nah, uwupp

#

best lang

solemn latch
#

its less about the syntax errors and more of just being simple and rewarding.
any issue I have now I am just annoyed finding the fix rather than happy.
the number of times the solution I know, but didn't think of is astounding kek

wheat mesa
#

amonguslang

lyric mountain
#

it's actually called among us (the lang)

#

and is a real lang

wheat mesa
#

yes

lyric mountain
solemn jolt
#

Why I get this error ?

slow terrace
#

My bot is on heroku it was fast but now it's laggy and i don't know the reason!

solemn latch
#

Has it gradually gotten laggier as your bot has grown? Or just suddenly after an update? Or just suddenly without an update?

spark flint
#

because its heroku

solemn latch
#

If it was suddenly without an update probably contact heroku support tbh.

slow terrace
slow terrace
#

or the bot

solemn latch
#

The bot

slow terrace
#

No i didn't

wooden tusk
#

If I tried to post a review of the bot

slow terrace
#

The code is working fine in another bot and it's fast

#

but not on heroku

solemn latch
#

If its just growth, it's potentially just heroku(not really meant for bots).
Probably best to move platforms at this point.

slow terrace
#

on my pc

slow terrace
solemn latch
#

Well, it's not meant for bots.
Once you start maxing your alloted resources with a bot you can't really easily increase your available resources on heroku(easy for sites, not as easy with bots), making the response time slow.

#

It's totally possible to stay with heroku, but probably best to move on.

spark flint
#

any vps is better then heroku

#

this is a great starting point

slow terrace
spark flint
#

still

solemn latch
#

Hosting a bot costs money.

#

Even on heroku(even if you are not directly paying for it currently)

spark flint
#

no offence to anyone but don't get into bot development expecting to get everything for free. you would rather pay for good service then have 0 users

solemn latch
#

You can temporarily move to something like Google cloud if you really need free

#

You can also get a free debit card(assuming you are over 14 years old) if that's a limiting factor.

#

Many banks offer them for free. I've never actually paid for one tbh

#

Yep?

#

Nope kek

#

The trick I used to use is Skype numbers

#

Used to be line $1 to get a temp number

#

Like*

#

Or use an mvno, like $3-$5 for a temp number

lyric mountain
#

I did read "to get trump number"

solemn latch
#

Nah I can sell you trumps number for $15

#

/s

lyric mountain
#

wanna trade for bolsonabo number?

quartz kindle
#

salnorabo

slow terrace
#

but i moved rn into rdp still lag

#

maybe events ?

#

are making the bot lagging

spark flint
#

its because its heroku

#

heroku isn't really a very good bot host

slow terrace
#

temp

spark flint
#

who is hosting the rdp

#

a vps?

lyric mountain
#

rdp?

spark flint
#

remote desktop protocol

lyric mountain
#

as in "remote desktop protocol"?

#

aint that a windows thing?

spark flint
solemn latch
#

Rdp can lag for a ton of reasons too

slow terrace
lyric mountain
#

why and where are u hosting the bot?

slow terrace
lyric mountain
#

like, why windows?

spark flint
slow terrace
#

it's temp

#

i need to know why is the bot lagging

spark flint
#

who is hosting the rdp

#

you mean you are hosting on your pc and accesing from elsewhere?

slow terrace
#

temp

#

How?

lyric mountain
#

I'm still failling to see what rdp has to do with anything of this

spark flint
#

yeah

lyric mountain
#

bruh

#

rdp is an access protocol

spark flint
lyric mountain
#

not a host

slow terrace
lyric mountain
#

it's like saying you're driving a diesel

spark flint
#

be more helpful - WHO is hosting the rdp

lyric mountain
#

we don't care abt the fuel, we want to know the car

spark flint
#

???

solemn latch
#

Azure?

slow terrace
lyric mountain
#

○| ̄|_

spark flint
#

what else would i need in a databse for blacklisted servers

lyric mountain
#

only server id

#

a single-column table would suffice

spark flint
#

i mean so it has a reason for being blacklisted, who owns the server etc

lyric mountain
#

members, bots and emojis are unnecessary

spark flint
#

bot count and member count are necesary

#

as its to log bot farms etc

lyric mountain
#

why?

#

ah, I see

spark flint
#

so it saves the bot to member ratio

lyric mountain
#

but why emoji?

spark flint
#

idk

#

i'm gonna remove that

slow terrace
spark flint
slow terrace
#

I mean the command to write in the powershell

#

to run the code

spark flint
#

oh

lyric mountain
spark flint
#

nodejs, python etc

lyric mountain
#

python ig

#

judging by his bio

spark flint
#

oh yeah

#

true

slow terrace
spark flint
#

what language

#

python

#

what is your bot file called

slow terrace
#

node.js

spark flint
#

oh

slow terrace
#

node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module 'C:\Users\WolfWolfy'
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}

spark flint
#

cd into the folder

lyric mountain
#

shift + right click -> open poweshell here

slow terrace
#

@spark flint
PS C:\Users\WolfWolfy> cd c:\Downloads\Wolfy-master\Wolfy-master
cd : Cannot find path 'C:\Downloads\Wolfy-master\Wolfy-master' because it does not exist.
At line:1 char:1

  • cd c:\Downloads\Wolfy-master\Wolfy-master
  •   + CategoryInfo          : ObjectNotFound: (C:\Downloads\Wolfy-master\Wolfy-master:String) [Set-Location], ItemNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
spark flint
#

do cd..

slow terrace
#

cdC:\Downloads\Wolfy-master\Wolfy-master : The term 'cdC:\Downloads\Wolfy-master\Wolfy-master' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1

  • cdC:\Downloads\Wolfy-master\Wolfy-master
  •   + CategoryInfo          : ObjectNotFound: (cdC:\Downloads\Wolfy-master\Wolfy-master:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
spark flint
#

no not the c:

#

literally put in cd..

slow terrace
#

It's worked

#

The bot is sometimes is fast and sometimes it's slow what may be the reason?

lyric mountain
#

your network and hardware specs

#
  • using windows
slow terrace
#

The sources are not used as much as possible in rdp

#

I know but until i know the problem

#

It may be from heroku

lyric mountain
#

linux is not known as "the best server environment" for nothing

#

windows is a resource hog

#

still linux

slow terrace
#

it waas good

#

?

#

Why are you doing like thaat

lyric mountain
#

looks like we're having a communication issue here

slow terrace
#

I developed it by my self

lyric mountain
#

let's assert some things

#

you're hosting on azure right?

slow terrace
lyric mountain
#

and you're using rdp to access it

slow terrace
#

ye

lyric mountain
#

ok, that settles everything

spark flint
#

@hollow cairn ask here

hollow cairn
#

I need help.

spark flint
#

with

#

be more specific

summer solar
#

hello

spark flint
hollow cairn
#

My bot

spark flint
#

wtf

#

be more specific

#

WHAT WITH

hollow cairn
#

I can’t add it to my server.

spark flint
#

there

weary root
#

What

earnest phoenix
#

big bun wants to tear his hair out

#

@hollow cairn

spark flint
weary root
#

To clone

earnest phoenix
#

wdym

#

help

#

or I should say to the assigned person to my verification process that i can't make it

#

and apologize?

#

"We have to make sure that the data is not stored forever. We recommend that the information is stored for 30 days or less after a user is no longer in a server with your bot." this

#

when the user leaves the bot completely