#development

1 messages · Page 1973 of 1

solemn latch
#

looking at some verified bots and dont see any public privacy policy or TOS on many of them

elder jewel
#

idk, but im just annoyed rn since my bot is full, ppl can't use it
and most likely after waiting for a few weeks ill be told no since it grew to fast

solemn latch
#

on the invite page correct?

dry imp
#

it is a recent changes

solemn latch
#

ah okay

dry imp
#

i think

sudden geyser
#

people will go far to get a badge

solemn latch
#

good change

sudden geyser
#

in some ways it's actually smart

elder jewel
dry imp
#

good and bad

sudden geyser
#

my friend was offered $1.4k for their account just for the badge

dry imp
#

too complicated for devs who do this just as a hobby

elder jewel
sudden geyser
#

verification is just so discord can say "yeah you can have x, y, and z"

elder jewel
#

no its not

sudden geyser
#

not so you can feel special because you have a blue badge and torture yourself writing html

dry imp
elder jewel
#

most servers do not trust unverified bots

elder jewel
#

since fast growth is bad how?

dry imp
#

it used to be for the badge abuse

solemn latch
#

that flag is probably just to limit people submitting

#

yeah

dry imp
#

thats why the badge is limited

elder jewel
#

no, its not to limit submitting since they tell you weeks after you apply

dry imp
#

ppl abusing the system as always

elder jewel
#

there is no badge to be earned

#

like, do I really have to slow down growing my bot to be verified

dry imp
#

some ppl say they can change the ppl who review the bot by emailing them again, but some dont

elder jewel
#

yeah, and wait another few weeks whilst no one can use your bot

#

it can effectively kill all growth

dry imp
#

thats why you should make your bot sucks, so it will grow to the point that dsc approves it, then you make the changes

elder jewel
#

if it sucks, you can not get in 100 servers

solemn latch
#

👀 can you still request a 250 guild cap?

elder jewel
#

yeah, after waiting for weeks again

#

discord is not big on fast replys

dry imp
solemn latch
#

sounds like your issue with the system is discords reply time more than anything else

elder jewel
#

Yeah

#

I'd have no issue if it took them 2 days to say something about the bot

#

but no, they stop you from growing

#

and you may end up waiting 3 months

sudden geyser
#

it basically kills your bot's best window of becoming popular

elder jewel
#

you work hard to grow it to the number needed to apply

#

and your shut down.

solemn latch
#

I disagree with that tbh

sudden geyser
#

because after those 2-3+ weeks your bot's initial popularity will fade away

elder jewel
#

I hit the 100 today, ive had 8 server owners join my discord and leave since they can not add it

sudden geyser
#

and after that good luck promoting it

solemn latch
#

I would agree with that, if you are talking about something like a video game.
I dont think that applies for bots

elder jewel
#

when you enter a new server, ppl see it and add it to their servers
if you have a time where no one can add it, there is no one seeing it after that

elder jewel
dry imp
#

lmao dsc be like

solemn latch
#

otherwise, get verified kick all the servers your bot is in and restart lol

dry imp
#

@elder jewel you get 100 server in one day?

#

if so then it will obvsly get flagged

elder jewel
#

I got a lot of steam going for my bot
and now its artificially stopped

sudden geyser
#

isn't it not allowed to try republishing your bot on top.gg

elder jewel
#

I applied today

dry imp
elder jewel
#

ugh 100

#

well, in last 11 days

#

100

solemn latch
dry imp
#

well thats kinda hard

#

might get flagged

elder jewel
#

which I think is stupid, as all the servers it is in are real

sudden geyser
#

then how does getting verified, kicking all servers, and restarting work

#

unless you mean something else

elder jewel
#

thats a silly idea

solemn latch
#

the argument you all seem to suggest is that starting from zero is easier than starting with 100

elder jewel
#

yes, wipe away all progress since thatll stop you loosing your progress for them taking super long to accept/deny

solemn latch
#

(after verification)

elder jewel
#

that is not my argument

#

its that, you gain steam
and are forced to stop

solemn latch
#

I dont think bots, on a small scale have any steam

elder jewel
#

speak for yourself

#

oops did I do a bad

solemn latch
#

probably best not to leak private information

elder jewel
#

yeah, forgot user IDs are in that

dry imp
#

yeah and the photo is stuck in my browser

solemn latch
elder jewel
#

well, you get the point

dry imp
elder jewel
#

rn I keep having ppl join my discord, try to invite, and then leave

dry imp
#

you could try promoting it later

solemn latch
#

^^

#

thats generally what discord recommends(or implies) you should do

sudden geyser
#

I think I'm on a different page than you. The process right now goes:

Develop bot > publish on top.gg > get popular > hit 100 server limit > wait 3+ weeks for discord to verify > initial popularity has died, now you're stuck

compare this with the traditional path:

Develop bot > publish on top.gg > get popular > after some time, popularity wears down and you have the boost top.gg gave you

As such, Discord is practically kneecapping bots at 100 servers, killing their chance of becoming popular. Steam's process would be more like the second one. I don't understand why you two are fine with such an abysmal system.

dry imp
#

cant you just use auctions and promote it as usual?

elder jewel
#

I havent paid a dime in advertising

#

I made a bot ppl like

sudden geyser
#

That requires money, and this is just initial popularity after being added.

dry imp
#

vote credits

elder jewel
#

I got into a server, and he got all his owner friends to add it

#

I only got verified on top.gg yesterday, after my bot was already in like 70 servers

earnest phoenix
#

Vote credits are hard to earn, they won't help you much

sudden geyser
#

Vote credits as in regular votes?

dry imp
#

100 votes = $15 credit

earnest phoenix
#

Vote credits are auctions credits gained from monthly votes

elder jewel
#

the point still stands

sudden geyser
#

Ah

#

Yeah that's still a half baked solution.

elder jewel
#

Discord ruins the growth bots have by making them wait a few weeks to keep growing

earnest phoenix
#

First 100 monthly votes gives you $15 worth of auction credits, after that, every 1000 votes is $1

sudden geyser
#

Because you could've gotten many more vote credits if your bot hadn't been kneecapped at 100

earnest phoenix
#

So yea, it doesn't help much

dry imp
#

just gotta deal with it ig

elder jewel
#

My bot is a moderation bot that is not seen often, and requires basically no action from admins to work, how would I get votes from that?

The issue still stands of growing a bot, and getting popular only for it to be toppled by a 100 server limit.

left finch
#

My bot's confirmation form didn't go

sudden geyser
#

Like, imagine if GitHub published recently created repositories for exposure but after 50 stars required a 3+ week long verification process. By the end of it, your repo's out of trending and you're stuck at 50 when you could've had 500. It's like a dunning kruger graph except instead of a gradual decline you straight up stop for 3 weeks.

dry imp
earnest phoenix
#

The problem here is attention, people seeing the bot and adding it, and interacting with and supporting it in various ways, people won't be able to vote your bot if it doesn't even get attention to be seen and acknowledged

elder jewel
#

like
today I had 3 servers announce my bot since they like it a lot

but it cant do anything as it is full

elder jewel
#

my bot rarely does anything that someone other then a staff member would notice

#

even then, its rare when a staff member is using it

earnest phoenix
#

After the bot is out of the trending cycle, it's basically soft-locked in most cases, as the Discord server limit for the verification clause would block more and more growth of the bot, which will lead to unpopularity and demise of the bot

dry imp
#

so your bot is a moderation bot? @elder jewel

elder jewel
#

kind of, it only handles moderation of links

sudden geyser
#

I feel bad for the devs who go through this every day

elder jewel
#

and then you add on top
"your bot has grown too quickly, try to apply in 3 weeks"

#

after waiting however long

dry imp
#

no wonder ppl make multipurpose bot since they knew this was going to happen

elder jewel
#

then you face another issue
if your bot does too much, people will not trust it if it needs certain permissions

#

since its not verified

dry imp
#

handle the error then

elder jewel
#

what error?

sudden geyser
#

Like, Discord could at least revoke intents but still allow bots to grow until it's verified.

dry imp
elder jewel
sudden geyser
#

It doesn't completely stop malicious bots, but is an improvement.

elder jewel
#

Im saying, if the bot needs certain perms to work, people will not trust it

sudden geyser
#

Nah, straight up revoke it until verified.

dry imp
sudden geyser
#

that's what they want

elder jewel
#

bruh

#

lets add dyno, and not let it do anything

#

why add it?

dry imp
#

lmapo

elder jewel
#

a bot without the perms its need is useless

sudden geyser
#

daff the issue is users won't trust unverified bots compared to verified bots

dry imp
#

bruh

#

i know

dry imp
#

but people could disable specific perms upon adding the bot

sudden geyser
#

A user would rather not invite it.

elder jewel
#

^

dry imp
#

thats not the bot's problem then

elder jewel
#

Yes

sudden geyser
#

Yes it is

elder jewel
#

it literally is

sudden geyser
#

That's one less server.

dry imp
#

....

#

then what can you do abt it?

elder jewel
#

No servers add it since it is not verified
but you cant get verified unless servers add it

earnest phoenix
#

The trust in bots have significantly diverged since the verification process was introduced, which adds even more problems to the table of problems, piling up the cesspool of problems which can lead to the demise of the bot

elder jewel
#

My bot literally needs
• manage messages
• send messages
• embed messages
and people still have lots of trouble trusting it

earnest phoenix
#

Most Discord users aren't understanding of these problems and the ways they handle things, which is the cause of it

elder jewel
#

^

dry imp
#

then the problem is in the users

elder jewel
#

no

#

its the bots

#

it is literally the bot developers issue if no one will use it

dry imp
#

then it is your problem not discord?

elder jewel
#

there is probably hundreds of people with good intentions, and a great bot who will never make it since they cant grow

dry imp
#

well this issue was known long ago and there havent been any improvements, so you just gotta suck it up and deal with it ig

sudden geyser
#

That's such a terrible response

dry imp
#

literally nothing can be done

sudden geyser
#

"Oh, this platform is still screwing you and hundreds of other small bots over? Just suck it up"

#

This is what's wrong with the process

elder jewel
#

sounds like something a politician would say on any complicated issue

sudden geyser
#

pull yourself up by those bootstraps

dry imp
#

ppl complaint for a long time and discord doesnt improve it, do you think they will improve it now?

#

thats what im saying

elder jewel
#

to be fair, discord tries to improve

#

they just make the wrong move like youtube

dry imp
#

thats true

earnest phoenix
#

The problems now differ, in the old times where these problems (or at least most of it) didn't exist, these bots were easily able to obtain the popularity they were seeking for, after the verification process was introduced, Discord users are less likely to use unverified bots, and trust them in any way, which just kills the goal of the bot, and it's ways to overcome these problems and adapt to the current "meta" of how these things work, Discord server limit, intents, permission issues, concerned users, and much much more

elder jewel
#

yes

earnest phoenix
#

And the queue times being in the way, and all of that, and the ways to promote the bot just significantly reduces by a shit ton

elder jewel
#

its not only the queue time, its them saying after youve waited "No, youve grown to quickly, try again later"

#

like, with this logic you can stop a bot from getting verified by announcing it in a large server

#

how is the developer supposed to regulate how fast it grows

earnest phoenix
#

The way they handle "suspicious growth" is outright incorrect, they've even automated it, to check how fast it is being added to servers, which the suspicious growth is just the killing hammer for the bot and it's popularity

elder jewel
#

THIS ^

#

today I gained like 20 servers in a hour or two, nothing I did caused it

#

now im probably going to get screwed

#

:/

slender thistle
#

The current verification system is the main reason I have gone away from maintaining public bots in the first place

sudden geyser
#

same

elder jewel
earnest phoenix
#

what do i do here

#

i tried to do the webhook thing

azure walrus
#

how do i make a vote reminder like this?
i use djs fyi btw

near stratus
gilded plankBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

near stratus
azure walrus
#

sorry

lunar palm
#

no

#

It has the link

#

Should've just gotten the link instead of posting that

signal estuary
#

How can I edit an existing Field?

embed.setFields()

how does the setFields property work?
I wanted to change an existing field:

embed = embed.setFields([`Size`, 'value'])

but it gives me an MessageEmbed-fields-must-be-non-empty-strings error

pale vessel
#

I don't think setFields() is valid?

boreal iron
#

It is but I’m basically doing the things myself, it always has been like this, so it’s just another kind of experience to gather

I’m actually really optimistic how it already looks and feels

#

It’s the first time ever I’m working with a css framework and I pretty much like it

#

At least now I got some predefined structures and don’t need to design anything myself, except the fact I’m still typing each line code myself

signal estuary
#

How can I create a channel in a category?
This doesnt work for me - setParent() is not a function

let channel = inter.guild.channels.create('new-general', { type: 'text' })
channel.setParent(category.id)
earnest phoenix
calm stone
#

hi

#

how can i make vote log ?

#

sends a message when someone vote to my bot

calm stone
quartz kindle
#

await inter.guild...

timber fractal
#

I have this code, so if the array already includes a value, it will remove that from the array and update a mongoDB schema Code: ```js
if(response.disabledCmds.includes(value)) {
console.log('includes')
await guildSchema.findOneAndUpdate(
{
guildId: guild.id
},
{
blacklistRole: response.disabledCmds.remove(value)
}
);

        console.log(response.disabledCmds.remove(value));

        return true;
    }``` on the console, it shows ```

includes
[]``` but after it updated the schema, the exact same array is still there. Any solutions?

feral aspen
# quartz kindle `await inter.guild...`

Tim, I have a question on await continuing to last time.

const user = message.mentions.members.first() || await bot.users.fetch(args[0]).catch(() => {});
console.log(user.user.username);
````TypeError: Cannot read properties of undefined (reading 'username')`

This is returning an error when I input an ID like `!bugreview 342963104306429954`.
quartz kindle
#

message.mentions.members.first is a Member

#

members have member.user

#

bot.users.fetch is a User

#

there is no user.user

feral aspen
#

Oh, damn.

quartz kindle
quartz kindle
#

arrays dont have .remove()

timber fractal
timber fractal
# quartz kindle arrays dont have .remove()
Array.prototype.remove = function() {
            var what, a = arguments, L = a.length, ax;

            while (L && this.length) {
                what = a[--L];

                while ((ax = this.indexOf(what)) !== -1) {
                    this.splice(ax, 1);
                }
            }
            return this;
        }```
#

it would give me an error if remove was undefined right?

#
  • when i console.log the array with removing the value it gives an empty array, so without the removed value cause i removed that element
solemn latch
raw nest
#

If I have 1 route f.e. /api/items and I want to be able to create, get, update etc. on it and everything just depends on the request method. But let's say if I want to only get them. I heard that you shouldn't put important body (which changes the output) into the request when making a get request. How do I do it then? Make an extra param?

#

I could also make:
api/get/items
api/post/items
and so on

earnest phoenix
#

@rustic nova

rustic nova
#

russian this time lmao

raw nest
quartz kindle
#

like if you want to put the item you want to request in the body?

#

theres nothing preventing you from doing that

#

its just not semantically correct

#

but you're free to do it

raw nest
#

oh okay

quartz kindle
#

if you want to be semantically correct, a GET request should have all its data in the url, either in the path or in query params

raw nest
#

because then my thing would be much simpler xD just change request method and the params etc.

quartz kindle
#

to send a body, a POST request should be used, even if its only used to retrieve data

#

but theres nothing stopping you from sending GET requests with a body

raw nest
#

okay alright thank you Tim^^

quartz kindle
#

the only possible issue you might run into is that if someone uses a very strict http library that does not allow sending body with GET requests, they will have issues using your api unless they change their library or do the request manually

raw nest
#

well it's not a public api but yes that's true I already had such a problem once and that's why I even asked

hollow oak
#

for my discord bot i was given these intructions to set up the api could you explain it a bit more fr me



    "{}To find your API key:\n"
    "**1.** Login on Top.gg <https://top.gg/login>\n"
    "**2.** Go on your profile <https://top.gg/me>\n"
    "**3.** Click on `Edit` on one of your bot.\n"
    "**4.** Scroll to the bottom of the edit page, in `API Options` section, "
    "then click on `Show token` and copy the token.\n"
    "**5.** Use in DM `[p]set api dbl api_key your_api_key_here`\n"
    "**6.** There you go! You can now use DblTools cog."
)```
#

it is a bit outdated

quartz kindle
hollow oak
#

how to remove the webhook url box and authy box

#

i have contents in box when i try to remove it dosent let me

feral aspen
#
0|attitude  | Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
0|attitude  |     at Timeout.onTimeout (/root/bot/node_modules/discord.js/src/sharding/Shard.js:166:16)
0|attitude  |     at listOnTimeout (node:internal/timers:559:17)
0|attitude  |     at processTimers (node:internal/timers:502:7) {
0|attitude  |   [Symbol(code)]: 'SHARDING_READY_TIMEOUT'
0|attitude  | }
#

Am I doing something wrong, it keeps crashing my public bot.

solemn latch
#

personally I would increase the timeout

feral aspen
#

How, so?

#

I read an online github issue, didn't understand what they meant by timeout?

#
require('dotenv').config();
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./src/index.js', { token: process.env.TOKEN, totalShards: 'auto' });

manager.on('shardCreate', shard => {
    console.log(`[SHARDS]: Launched shard ${shard.id}`)
});

manager.spawn();
solemn latch
#

the timeout means if it takes too long to be ready it will fail.

#

increasing the timeout increases the time before it fails

feral aspen
#

What's the default timeout?

solemn latch
#

15 seconds iirc

feral aspen
#

How can I know how long it will take mine?

#

My bot is in 1,000 servers, supposedly.

solemn latch
#

I would increase delay to 10000 and timeout to 60000
seems the default is 30 seconds, which is strange to have it take so long for a bot with 1000 servers.

feral aspen
#

Like this, correct?

manager.spawn({ delay: 10000, timeout: 30000 });
solemn latch
#

yep!

feral aspen
#

I don't understand, yet, the difference between them. I have read the documentation but what, does it take time to spawn each shard?

hollow oak
solemn latch
hollow oak
#

on the webhook section

#

there are 3 boxes one is a url box the other an authy and the other a token

#

how do i remove the contents in the authy and url box

feral aspen
# solemn latch yep!

Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.

solemn latch
elder jewel
#

Good morning

simple stump
#

When trying to delete a channel via another method, I get this error:

throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Unknown Channel
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async TextChannel.delete (/home/container/node_modules/discord.js/src/structures/GuildChannel.js:547:5) {
  method: 'delete',
  path: '/channels/939911034708299936',
  code: 10003,
  httpStatus: 404,
  requestData: { json: undefined, files: [] }
}

To prevent this I have this statement:

          if (interaction.channel != undefined) {
            interaction.channel.delete();
          }

However the error still persists. Would I have to add a .catch statement to prevent this or is the code I have sufficient?

lament rock
#

might want to just catch because the channel could be deleted before your cache gets updated or something on Discord's end happen because lol Discord isn't so stable

#

also, what you want to check for is Channel.deleted

#

also don't need to specify != undefined. undefined, null, "" all lead to falsy values

#

Earlier versions of node do not support optional chaining

#

Try doing that in the middle of production without a fallback server

#

delete is undefined

#

ah nvm.

#

missed the object brackets

#

I just woke up

#

Other people probably find that haha funny and don't care, but I care

#

Would appreciate not insulting my skills

raw nest
#

Some one quite familiar with the npm package nanoid? Whenever I'm using it I'm feeling quite scary because it says the strings are unique but my question is how they did it? You can do something with timestamp + crypto and then it's unique for sure but still... Is it better to check for uniqueness?

sudden geyser
#

The ID is just randomly generated.

raw nest
#

but also unique

sudden geyser
#

It is using crypto internally to generate "pseudorandom data"

lament rock
#

You can increment specific portions of the string to make sure everything is unique always

raw nest
#

with my custom Alphabet this got calculated xD This really let's me feel better everytime but I'm curious lol

sudden geyser
#

I'd argue the point of nanoid is not to make collisions next to impossible, but to make generating IDs more convenient than the alternative (i.e. uuid). The collision rate is negligible, and even if there was one, there's a good chance the format you're storing it in will block collisions (e.g. database).

That range is huge though. I'd suggest something smaller, like 4-8 characters.

round cove
#

Guids can't even collide if you use the default time based guid.

signal estuary
#

Is it smart to write a file, upload it and delete it then?

                                let data = ''
                                messageCollection.forEach(msg => {
                                    data += msg.author.tag + ': ' + msg.content + '\n'
                                })

                                await fs.writeFile("transcript.txt", data, (err) => {
                                    if (err) { console.log(err) } else {
                                        console.log('file written successfully')
                                        let file = new Discord.MessageAttachment('./transcript.txt')
                                        if (file) inter.channel.send({
                                            files: [file]
                                        }).then(() => {
                                            fs.unlink('./transcript.txt', (err) => {
                                                if (err) { console.log(err) } else {
                                                    console.log('file unlinked successfully')
                                                }
                                            })
                                        })
                                    }
                                })

Or is there a better solution?

sudden geyser
#

Nah

#

I'm pretty sure you can store it in memory as a buffer.

#

Like Buffer.from(data, "utf8") and add it as a value in files: [...]

elder jewel
#

when you have to watch a 1 and a half minute ad to vote

sudden geyser
#

They're still doing that? I thought they canceled that.

elder jewel
#

I guess not

quaint rampart
#

anyone know ab express?

i’m trying to redirect /e:id to /cdn/embed:id
how can i achieve this? i tried res.redirect(“/cdn/embed/${req.params.id}”) but it didn’t work

quaint rampart
signal estuary
#

I wanna upload a txt file but this here uploads a png file. How can I change the file type?

data = 'just a string'
let file = new Discord.MessageAttachment(Buffer.from(data))
if (file) inter.channel.send({
  files: [file]
})
sudden geyser
#

you can give it a file name

signal estuary
sudden geyser
#

so instead of files: [...] you go files: [{...}]

slender wagon
#

what the fuck is this data thingy

#

and does it change

sudden geyser
#

it's just metadata an app provides for itself

slender wagon
#

hmm

#

does it prevent webscrapping

sudden geyser
#

not really

slender wagon
#

okay good

sudden geyser
#

if a scraper can figure out what it means they can find it useful

nocturne sail
sudden geyser
#

You should only need Send Embeds to send an embed.

pale vessel
#

did they change the perm name?

#

it was embed links

solemn latch
#

embed links are the embeds when you post a link

pale vessel
#

also applies for embeds sent by bots

nocturne sail
spark flint
#

i love when my permission has my bot

nocturne sail
#

?

sudden geyser
#

meant to say that

nocturne sail
#

but when i removing him the MANAGE_MESSAGES its not working.
Other Embed working. But in this one Command not.

cold shell
#

whenever i send a command fthrough my bot it sends the response twice

solemn latch
#

sounds like you may be running the bot twice

cold shell
#

this is the code (its python)
`` import discord
import os
from keep_alive import keep_alive

client = discord.Client()

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith('.hello'):
await message.channel.send('Hello!')

if message.content.startswith('man i really want to listen to roblox horror music'):
await message.channel.send('https://www.youtube.com/watch?v=kpeMpyG-ryE'')

keep_alive()
client.run(os.getenv('token'))
my_secret = os.environ['token']``

earnest phoenix
#

will startswith even work for that second one

cold shell
#

yeah its worked for the past few days

earnest phoenix
#

mmm

proven lantern
#

epic is probably right. there is probably a ghost process running

earnest phoenix
#

You might have a double instance of the bot running other then that I see no reason why it'd respond twice

solemn latch
#

typically thats what happens

cold shell
#

yeah

#

i'll restart the bot see if that fcixed it

#

fixes*

earnest phoenix
#

Doesn't matter if you restart it, there will still be that ghost process

proven lantern
#

check the process manager. are you using windows or linux?

woeful pike
#

um sir... this is not what deprecation means

#

typical golang developer

solemn latch
#

is retaining Prometheus data for a year actually viable? 👀

earnest phoenix
woeful pike
#

looks like a breaking change to me

cinder patio
#

why is go syntax so quirky

earnest phoenix
#

cause ur quirky

sudden geyser
#

syntax looks fine imo

woeful pike
#

syntax is whatever

#

as long as you're not writing APL it doesn't really matter

sudden geyser
#

apl looks cool though

cinder patio
#

The square brackets before the type... return type right after arguments (no delimiter like most languages with return type after args), tuple not wrapped in parentheses. Not saying it's bad but

#

it makes you wonder

woeful pike
#

definitely... unique

sudden geyser
#

please tell me that's not valid apl

woeful pike
#

very valid

sudden geyser
#

why are all examples without syntax highlighting

#

okay here

earnest phoenix
#

wtf is that

sudden geyser
#

apl

earnest phoenix
#

it looks bad

sudden geyser
#

it's very foreign

#

I'd like to learn it some time in the future

earnest phoenix
#

I wouldn't

woeful pike
#

for people who want to roleplay being a scribe in 2000 BC in ancient egypt

earnest phoenix
#

Looks like i'd go through a mental meltdown trying to make sense of it

earnest phoenix
woeful pike
#

K is a proprietary array processing programming language developed by Arthur Whitney and commercialized by Kx Systems. The language serves as the foundation for kdb+, an in-memory, column-based database, and other related financial products. The language, originally developed in 1993, is a variant of APL and contains elements of Scheme. Advocate...

#

The function below can be used to list all of the prime numbers between 1 and R with:

2_&{&/x!/:2_!x}'!R
#

I know someone who uses both of these languages to solve coding challenges, actually cracked

cinder patio
#

ah yes very concise

earnest phoenix
#

I dont even want to begin to try and understand that

#

:p

woeful pike
#

they're not even joke/esoteric languages like brainfuck

#

just a very different paradigm

sudden geyser
#

that you'll actually find in production systems

woeful pike
#

yes

#

array based languages? is the name I think

sudden geyser
#

array-oriented

woeful pike
#

is that the same as stack oriented

sudden geyser
#

or just array

#

eh all the names mean the same

woeful pike
#

forth is like the most sane of these languages

#

every other one I've seen is some alien hieroglyph

#

like J lmfao

cinder patio
#

2!!7!4
woeful pike
#

at least with J I can kind of see the flow

cinder patio
#

But that lang was made in '93

woeful pike
#

this isn't functional

#

in the most readable way

#

all the other languages are some kind of extreme end of this idea

cinder patio
#

Might as well just write python bytecode by hand

woeful pike
#

well yeah forth is meant to be an assembly

#

low level but more readable imo

#

tho I've never written assembly so I don't know

surreal needle
#

Hey uh im new to sequelize and im struggling a lot

#

i dont know what im doing wrong but nothing is working anymore

#

Im using discord.js, sequelize and mariadb

#

If anyone knows how to help, please lmk

earnest phoenix
#

We cannot help you if you don't tell us what is wrong and show the error & code

surreal needle
#

ive only been working with discord.js and javascript in general for about a week

#

functions is in the main folder and warn is in the command folder

#

hence the ../ on the import

#

im having trouble with my "guildTableCreate" function

#

it doesnt seem to be creating anything. When i create and then try to fetch it, it just outputs "null"

#

my userTableCreate function works fine so this is giving me a headache

#

Here's my entire bot

#

console output when doing warn command

split hazel
#

lets do some debugging

#

what line of code is in warn.js at line 44?

surreal needle
#

if (guildtable.get('maxinfractions') <= 1) {

surreal needle
split hazel
#

think i may know the problem

#

any operations performed on the database such as guildtable.get take time to complete

#

so you have to add await before them

#

otherwise the value will not be ready yet and your program continues to execute

surreal needle
#

console.log(guildtable = await guildTables.findOne({ where: { name: guildTableName } })); what about this outputting null?

split hazel
#

sequelize returns null if it cant find what you requested

#

so the query returns nothing

#

meaning the entry does not exist

surreal needle
#

that line is after the create function

split hazel
#

thats because you arent awaiting it

#

that could be the first problem

surreal needle
#

hmm okay

#

wait ill try to await in the if statement

split hazel
#

referring to this by the way guildTableCreate({ name: guildTableName });

#

you might want to also practise using promises and when to use await or not as it is a big part of javascript

surreal needle
#

still same error on the if statement

split hazel
surreal needle
#

no.. ill try that too

#

Still getting null in the if statement

#

added await to guildtable.get() and createGuildTable()

split hazel
#

show the updated code just so i can keep up to date

surreal needle
#

highlighted

#

also if you have a better way of doing any of this, i would appreciate some input haha

split hazel
#

are you able to check the database itself?

#

to see if the entries were added

modern sphinx
#

i added my bot

surreal needle
#

i know how to check tables and describe them

#

but checking contents, idk

#

The database and the tables are there

#

i know that much

modern sphinx
#

my bot not starts if checked this is the error

split hazel
surreal needle
#

i checked, executed the command and checked again

#

nothing both times

split hazel
#

that means theres nothing in the database

#

strange

surreal needle
#

yeah im not having this issue with my other table

#

which is what's so frustrating

#

it works fine here

split hazel
#

can you log guildTableName just to make sure

surreal needle
#

console.log it?

split hazel
#

oh wait

#

you're messing up your query

surreal needle
#

hm?

split hazel
#

the create function expects this

#

you're giving it an object instead

surreal needle
#

are you talking about the name?

#

i do const guildTableName = String(interaction.guild.id);

split hazel
#

so instead of guildTableCreate({ name: guildTableName }) you need to do something like guildTableCreate(guildTableName, 10, role, role) filling out the other fields with what they're supposed to be

surreal needle
#

hm

#

well you see

#

I need to find it 1 sec

split hazel
#

and also some of your columns are labelled as required so you have to provide them too (not just name) otherwise make them nullable

surreal needle
#

i did that

#

and it didnt work

#

i just set them to a string that contained the word null

#

to test and it didnt change anything

split hazel
#

you're still doing it wrong

#

it should be guildTabelCreate(guildTableName, 2, 'null', 'null')

#

because thats what the function expects

#

if you want to use objects you need to query the model directly

#

like guildTables.create({ ... })

surreal needle
#

i didnt know there was a difference between those two, thats interesting

#

i thought when using {} you could define what you're actually assigning a value to

split hazel
#

you can do that but youd need to make the function like function guildTableCreate({ name, max, manrole, modrole }) { ... }

surreal needle
#

ahh

split hazel
#

that way you can directly query the data

surreal needle
#

okay

#

Yeah this will probably work then

#

i didnt know that it had to be like that

#

OH MY GOD

#

THANK YOU DUDE

#

IVE BEEN TRYING TO FIGURE THIS OUT ALL DAY

#

It's been driving me nuts

split hazel
#

glad to see that! i'd recommend you take some javascript courses to learn some of the syntax

#

otherwise you're kind of just guessing

surreal needle
#

I have tried taking courses before and i can tell you that i cant get the motivation

#

i learn from doing and looking up issues

split hazel
#

and continue trial and error because i think thats the best way to learn

surreal needle
#

asking friends for help along the way

split hazel
#

yeah you should also try to apply the things you've learnt because you'll forget them quickly

surreal needle
#

I used to code my bot in python and then switched to javascript for more control over what im doing

split hazel
#

my first week of javascript i was begging some guy in dms to give me code for stuff

surreal needle
dry imp
#

@surreal needle which one do you think is easier for beginner py or js?

surreal needle
#

definitely python imo

#

also if you're gonna go javascript then eslint is great for not making subtle mistakes that dont actually show up as mistakes

marble juniper
#

ruby though

split hazel
#

shit just crashes and glitches with no clues or leads

surreal needle
#

my friend tried coding an os in C

marble juniper
#

code an os in B when

surreal needle
#

i think he's gone insane

rigid lark
#

me using java

surreal needle
#

it looked pretty cool

split hazel
surreal needle
rigid lark
marble juniper
#

the floor is java!

dry imp
rigid lark
#

if you need to run a js bot you need like a vps and node and blah blah

marble juniper
#

when log4j allows you to do remote code execution

rigid lark
dry imp
#

hacking from minecraft moment

surreal needle
rigid lark
marble juniper
rigid lark
marble juniper
#

You know many pcs often get hacked because they don't frequently update them

rigid lark
marble juniper
#

Ye

surreal needle
# surreal needle

my bot got rejected because my idiot ass was debugging this while someone was reviewing it, i didnt know when it was gonna happen so i was just changing the code and then i broke everything

dry imp
#

java s fault for being bad

marble juniper
#

Many people seem to switch to functional programming anyways

surreal needle
#

Time to add modrole checks and make my commands even more bloated

marble juniper
#

Writing a bot to test ur bot is the real shit

split hazel
dry imp
split hazel
#

and they're multiple gbs in size

surreal needle
marble juniper
#

Or just

#

submit the bot untill its actually done

surreal needle
dry imp
#

but its better to submit now ig

surreal needle
#

When is a bot 'done' though

#

i need a userbase

dry imp
#

wait time now is so much shorter

surreal needle
#

im running out of stuff to add

marble juniper
#

You probably don't wanna ship an unfinished product

dry imp
#

true

surreal needle
dry imp
#

copy other bot

surreal needle
#

lmao

#

thanks for the input CB_thumbs_up

dry imp
#

make a discord bot so that it can cook rice at 5 am and fry chicken nuggets at the same time, ill invite that bot

surreal needle
#

on it

sudden geyser
surreal needle
#

Should the warn command have a permission check or should it just check for the mod role?

marble juniper
#

You should use permission checks where possible lol

split hazel
#

honestly dont trust discords command permission system

#

they've fucked it up a few times already

#

use it mostly for shows but keep an internal permission check

sudden geyser
#

wdym

split hazel
#

i meant if you're gonna be using discords permission system

sudden geyser
#

oh the permission in general? like using bits?

#

I've just been using sets of enums in my app

surreal needle
#

if (interaction.member.roles.resolveId(guildtable.get('modrole')) == member.roles.resolveId(guildtable.get('modrole')))

#

does this work?

#

I'm honestly just guessing how i could check something like this

#

I want to check if both users have the modrole and if they do then return;

lyric mountain
#

interaction.member.roles -> member.roles I fail to see what ur doing there

surreal needle
#

im getting a role id from a database table

#

i want to check if they both have that role

#

not if one has more roles than the other

boreal iron
lyric mountain
#

interaction.member I imagine is the user that pressed the button

surreal needle
#

its the person that sent the command

#

and member is the mentioned user in the command

#

im using discord.js

lyric mountain
#

first of all, save guildtable.get('modrole') to a variable

#

no need to call it twice

#

second, you could just check if both users have the role

#

instead of getting it from each one and comparing both

#

idk what resolveId does tho

surreal needle
#

the role is stored as an id in the database

#

OH wait

#

i know how to turn it back

#

its been right in front of me

#

i can do RoleManager.fetch(id)

#

and then check that

exotic shard
#
node:internal/modules/cjs/loader:936

  throw err;


  ^

ErrorCannot find module '../../functions'


Require stack:


- /home/node/commands/uptime.js/home/node/index.js/etc/917358002070224936m938887546786676836.js


    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)


    at Function.Module._load (node:internal/modules/cjs/loader:778:27)


    at Module.require (node:internal/modules/cjs/loader:1005:19)


    at Module.newFunc (/etc/node_modules/appmetrics/lib/aspect.js:101:26)


    at Module.newFunc [as require] (/etc/node_modules/ibmapm-embed/appmetrics-zipkin/lib/aspect.js:101:26)


    at require (node:internal/modules/cjs/helpers:102:18)


    at Object.\u003canonymous\u003e (/home/node/commands/uptime.js:4:22)


    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) {


  code'MODULE_NOT_FOUND',


  requireStack: [


    '/home/node/commands/uptime.js',


    '/home/node/index.js',


    '/etc/917358002070224936m938887546786676836.js'


  ]

}```
#

Voici le code

const Discord = require("discord.js");
const config = require('../config.json');
const { MessageEmbed } = require('discord.js');
const { parseDur } = require('../../functions');

exports.run = async(bot,message,args) => {

const duration = parseDur(client.uptime);
		message.channel.send('⌛ Loading...').then((msg) => {
			const embed = new MessageEmbed()
				.setTitle('📥 Online for')
				.setColor('BLUE')
				.setDescription(
					`**${duration}**`,
				);
			msg.edit(embed);
		});
	}```
exotic shard
#

@rose warren

boreal iron
#

No need to ping random guys

#

It obviously says it can’t find your module functions

#

What type of module is it?

#

Do you maybe miss the file type?

#

Is the path valid?

quartz kindle
surreal needle
#

Im storing the role in a database using the id

#

so im fetching the role object using interaction.guild.roles.fetch()

quartz kindle
#

unnecessary

surreal needle
#

eh?

boreal iron
# quartz kindle unnecessary

I mean it doesn’t matter if it’s cached, it will first check the cache before fetching anyways if you don’t enforce it

surreal needle
#

Why is that unnecessary?

quartz kindle
#

if you have a member object, you have its roles

#

all member objects have a roles array

#

array of role ids

#

in discord.js its stored under member._roles

boreal iron
#

Oh you’re speaking about members lmao

#

Nvm then

#

pleb out

surreal needle
quartz kindle
#

array of role ids

surreal needle
#

yeah

quartz kindle
#

that array will always exist since it comes directly from the api

#

so it doesnt matter if you cache roles or not

#

you can have all roles disabled and uncached, and members will still have that array

surreal needle
#

so i could do something like this

quartz kindle
#

not has

#

includes

surreal needle
#

oh nice thanks

feral aspen
#

Hey @quartz kindle ! I'd like to ask a question about interactions. You see, I know for a fact that when you .reply(), you will have to do it via 3 seconds or else it would error and exit out the process. Although, sometimes. I .deferReply() and .followUp() but an error always comes about Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred..

Always, when the error comes, it restarts/exits the process making my public bot restart, I mean, this used to never happen before and keeps continuing, even when the error occures, but when I started working on sharding, that type of habit started appearing. To prevent it from erroring and restarting.. do you think I should do something like. .reply().catch(() => console.log("Failed to Reply")); and .deferReply() .followUp().catch(() => console.log("Failed to Reply"));?

#

It's getting annoying seeing the bot restart because of an error.

round cove
#

When you defer you have to edit the reply.

#

IIRC?

#

Because you didn't really "reply" to it yet.

feral aspen
#

I don't think that's how it works.

round cove
#

Thankfully it works for me then (:

earnest phoenix
feral aspen
#

You .followUp() although sometimes it errors crashing the bot because of the Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred.. error restarting the bot from PM2.

round cove
#

Clearly not lmao

feral aspen
#

Always been?

earnest phoenix
#

You're literally encountering an error about it

feral aspen
#

How is it supposed to work, then?

round cove
#

I just said.

#

You reply first.

#

Then you can edit the reply.

#

Or follow up.

earnest phoenix
#

When you defer the reply to an interaction, you must send a reply before sending a follow up, as Dylan said

feral aspen
#

I'm sorry? I've never seen .deferReply() and then .reply()?

round cove
#

Where do you see any deferReply examples?

earnest phoenix
round cove
#

deferReply is LITERALLY to ensure the interaction doesn't expire in 3 seconds and gives you a 15minute window to reply.

earnest phoenix
#

There's a reason it's called "deferReply"

feral aspen
#

When do people use .followUp then?

boreal iron
# feral aspen I don't think that's how it works.

When you defer you have to edit the reply.

That’s exactly how it works.
Think of the deferring like an actual message you send.
It’s in fact not a message but the UI will show "Bot is thinking…"
See this as your “loading message” you sent until you edit the reply (which is you thinking-message)

round cove
#

Right.

earnest phoenix
#

Basically, following up the chain of replies to the initial response

feral aspen
round cove
#

😔

boreal iron
earnest phoenix
#

After those calls, you can call <CommandInteraction>.followUp() to send a follow up

boreal iron
#

You can’t reply as you already replied with the deferring

#

You need to use editReply()

earnest phoenix
#

That's not how it works FakE

boreal iron
#

For his case it is

earnest phoenix
#

You must send a reply, not edit it, you can't edit something that does not exist

boreal iron
#

I’m not speaking about the followUp

earnest phoenix
#

I know what you're exactly talking about, after you defer the reply to an interaction, you must send a reply, not edit the reply, because there's no reply in the first place

feral aspen
#

Anyways, at all cases, I'm .deferReply()ing all my interactions.

#
if (interaction.isCommand()) await interaction.deferReply({ ephemeral: false }).catch(() => {});
earnest phoenix
#
// Invalid.
await interaction.deferReply();
await interaction.editReply(...);

// Invalid.
await interaction.deferReply();
await interaction.followUp(...);

// Valid.
await inteeraction.deferReply();
await interaction.reply(...);
await interaction.editReply(...);

// Valid.
await interaction.deferReply();
await interaction.reply(...);
await interaction.followUp(...);
boreal iron
#

First isn’t invalid

feral aspen
#

Dude, I've just did the second Valid one, that's not how it works, and the first Invalid is valid?

boreal iron
#

Test it yourself, first case is valid

feral aspen
#

Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.

boreal iron
feral aspen
#

.. and it works pretty pretty fine for me?

#

Although, sometimes the interaction fails causing an error 10% of the times.

boreal iron
#

Yeah Voltrex is wrong here

feral aspen
#
// Valid
await interaction.deferReply();
await interaction.editReply(...);

// Valid
await interaction.deferReply();
await interaction.followUp(...);

// Invalid
await inteeraction.deferReply();
await interaction.reply(...);
await interaction.editReply(...);

// Invalid
await interaction.deferReply();
await interaction.reply(...);
await interaction.followUp(...);
#

I believe this is how it should be?

#

There is absolutely no way you can use .reply() after a .deferReply()?

feral aspen
boreal iron
#

As I said deferReply() then reply() doesn’t work as deferring is already the reply, you need to edit your reply (deferred message)

#

That’s how it works

feral aspen
#

Exactly.

#

.. or you can defer reply and then follow up?

boreal iron
#

Not sure about that one tbh

feral aspen
#

Works according to tutorials.

#

Okay, back to my point whether I use your way or my way.

boreal iron
#

But you should be able to as in no case a folloeUp message would make sense

feral aspen
#

I've been using it since September.

boreal iron
#

I’m using the first case

feral aspen
boreal iron
#

The opposite between a followUp message and the bot responding to your interaction should be understandable

#

(Using editReply())

feral aspen
# boreal iron When it fails?

Yes, most of the times, when you use the commands of the second case, it sometimes fails but the action has been done.

await interaction.deferReply();
killBob()
await interaction.followUp(...);

It doesn't follow up but killBob() has been executed.

boreal iron
#

I mean there’s actually no response to followUp for the bot

feral aspen
#

It has been working pretty fine for me since 5 months?

boreal iron
#

The only message is the “Bot is thinking…”

feral aspen
#

So? That's considered a message?

boreal iron
#

This is only visible in the UI and will be gone once you send the followUp

feral aspen
#

That's what I wanted?

boreal iron
#

That means without sending an actual reply or editReply this will always error

feral aspen
#

.. because of the .followUp()?

boreal iron
#

Yes

feral aspen
#

Okay, makes sense. How about if I added .catch(() => {})?

boreal iron
#

You should always use the first case when deferring

feral aspen
boreal iron
#

Not in your code but in the UI of the client

feral aspen
#

But it doesn't error and crash the bot, correct? Although, yet fails?

boreal iron
#

I wouldn’t do it

feral aspen
boreal iron
#

It’s not meant to be used like that and might be fixed in the future

feral aspen
#

If it fails, it silently fails and not error and crash the bot but it would say This interaction failed? (if I use .catch(() => {});?)

boreal iron
#

Don’t know for sure without testing
Once you’re suppressing errors in your code you know something is wrong
The error discord shows in his client has nothing to do with you suppressing API errors

feral aspen
#

Ah, no worries. 👍

boreal iron
#

Think of it as if Discord does not get the right response to the interaction it will say Interaction failed in the client or as API error

#

Suppressing is a bad idea here

feral aspen
#

Yeah, true.

#

.. so do I just use the first case?

earnest phoenix
#

After doing some tests, the first 2 ways seem to be working now, they didn't use to work before
This is how things are handled now:

// Invalid.
await interaction.deferReply();
await interaction.reply(...);

// Valid.
await interaction.deferReply();
await interaction.editReply(...);

// Valid.
await interaction.deferReply();
await interaction.followUp(...);

I suppose what you're encountering here is something that is silently unhandled, I've encountered this issue before but the cause was of some interaction not being unhandled correctly

#

It if fails randomly, I can't think of anything else causing it other than Discord API issues

boreal iron
earnest phoenix
#

Probably

boreal iron
#

But as I said replying after replying with a defer causes an API error

feral aspen
#

Anyways, what's the final difference between .editReply() and .followUp()?

boreal iron
#

I mentioned above

feral aspen
#

Kind-of lost it.

boreal iron
#

See this:

boreal iron
#

A followUp is a reply to the bots first reply (response )

#

He actually replies to itself not to you

feral aspen
#

No, not really?

boreal iron
#

Yes

feral aspen
#

Nope.

boreal iron
#

Wait I will show

#

Gimme a second

earnest phoenix
#

The editReply() method edits the initial response, when deferred, the initial response is considered as the "thinking" state, the followUp() method however, replies to the bot's initial response (if deferred, it edits the "thinking" state)

boreal iron
#

Ah

feral aspen
#

Well.. what is better preventing future errors?

earnest phoenix
#

It wasn't, maybe you didn't realize the outputs as that, we confuse things with each other as how interactions work can be confusing

earnest phoenix
feral aspen
#

Sometimes. Both methods can error due to you mentioning about this, is .catch(() => {}); a fix for this?

earnest phoenix
feral aspen
#

Yup. ^

#

I appreciate it a lot.

boreal iron
#

Send an eval real quick with a followUp which edited the deferReply thinking message before deferred the eval output was send

#

So yeah that’s how it is

feral aspen
#

Thanks a lot everyone.

boreal iron
#

Sure np that actually helped Voltrex and me, too as we’re back up to date as well

earnest phoenix
#

Cumulative update to ourselves when trying to help mmLol

boreal iron
#

Aye a win-win situation

boreal iron
#

Is the same as:

#

(only when deferred)

earnest phoenix
#

does anyone know how to recieve vote data when the bot is hosted on heroku?

#
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
#

but whats the webhook url for heroku?

boreal iron
#

When not deferring, followUp actually is a follow up message of the first reponse
As you can see the bot is responding to itself

solemn latch
earnest phoenix
boreal iron
#

And the last use case...
This case also shows that followUp() is a reply the first webhook the bot has send (editReply() in this case)
It does not mention the interaction user
@feral aspen

earnest phoenix
#

is it this?

solemn latch
boreal iron
#

huh

earnest phoenix
#

oh yes

solemn latch
#

then the path added at the end

earnest phoenix
#

so the link is

#

?

solemn latch
#

yep

earnest phoenix
#

also

#

when i go to that link it shows this

#

is this supposed to happen?

solemn latch
#

stinky woo

boreal iron
solemn latch
earnest phoenix
#

thank you

earnest phoenix
# solemn latch the url is for a post request, so getting it in your browser wont work
    def __init__(self, bot):
        self.bot = bot
        self.token = os.environ.get("TOPGG_KEY")
        self.auth = os.environ.get("TOPGG_AUTH")
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
        self.update_stats_channel = self.bot.get_channel(938674473094246433)
        self.update_stats.start()
#
    def __init__(self, bot):
        self.bot = bot
        self.token = os.environ.get("TOPGG_KEY")
        self.auth = os.environ.get("TOPGG_AUTH")
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth = f"{self.auth}", webhook_port = 6000)
        self.update_stats_channel = self.bot.get_channel(938674473094246433)
        self.update_stats.start()
#

does not work

#

is the link i set the webhook url too

solemn latch
#

do you have a web dyno enabled?

earnest phoenix
#

which one is web dyno

#

There is one dyno

earnest phoenix
solemn latch
#

nope, unless you need the scaling already(which would be unusual)

earnest phoenix
#

what am i supposed to do

solemn latch
#

I'm not a heroku user, so I can only really link to the docs.

earnest phoenix
#

alright

earnest phoenix
solemn latch
#

I dont think so, I think multiple dynos can be enabled within one

earnest phoenix
#

so basically

#

i have two lines

#

one for worker

#

one for web

solemn latch
#

yep

earnest phoenix
#

idk how to get a web procfile

#

web dyno*

lyric mountain
#

Running two dynos is risky if ur bot is hosted there

#

It effectively halves your free time quota

earnest phoenix
#

oh

#

so what am i supposed to do

lyric mountain
#

Well, that's one of the drawbacks of running free

#

You could technically use something else for the api alone

#

Like glitch or replit

earnest phoenix
#

oh yes

#

so like

#

run topgg seperatel

#

on replit?

lyric mountain
#

Then process votes there or somehow send data to ur bot

earnest phoenix
#

i use mongodb

lyric mountain
#

Regardless of what u use, you'd need to notify ur bot that someone voted

earnest phoenix
#

so i can use replit to process votes?

lyric mountain
#

Unless u don't do vote messages

earnest phoenix
#

oh true

earnest phoenix
lyric mountain
#

Get creative

solemn latch
#

you can realistically forward it to a discord webhook using replit

#

and get the message with your bot

earnest phoenix
#

hmm

#

yes

#

il prob do that

#

thx

lyric mountain
#

Can also use the database as a message queue and have the bot periodically check if there are new entries there

solemn latch
#

thats probably more reliable

lyric mountain
#

Many ways to solve that

earnest phoenix
#

il go with a vote helper webhook for now

lethal trout
#

i want to make a thing like when i type a command in the terminal it will make a new project for me like i open a new folder for making a bot and i want it to automatically add the pre made handler and events..

lyric mountain
#

You could also make a script to pregenerate such files, but at that point git will be easier and more reliable

#

If u use an ide, some allow you to create project templates too, at least I know that in intellij it's possible

lethal trout
#

YES

#

YES

#

THANKS

#

@lyric mountain UR GREAT

lyric mountain
#

You...please tell me you already used git in ur projects

#

Like, it's way too dangerous not to use it, and u can use it as a template repository

#

Just remember to switch detach the origin once u finish cloning the template

elder jewel
#

how can I add things like servercount, or a communities tab on my top.gg page

lyric mountain
#

Get the number of guilds and upload using top.gg api

bright hornet
#

errmm why if(!user === undefiend) is not working?

const user = message.mentions.users.first();
    
    if(!user === undefined) {
      message.channel.send("Tag someone")
    } else {
      const messages = await Messages.findOne({
        guildID: message.guild.id,
        userID: message.mentions.users.first()?.id
      })
      const member = message.mentions.users.first()
      message.channel.send(`${member} has ${messages.messageCount} in total.`)
    }```

Keep sending error in console log `messageCount` is undefined
earnest phoenix
feral aspen
#

It has confused us all but was able to achieve the answers and understand it.

bright hornet
#

erm when i pinged someone with the command their username shows up, but if use their id it shows undefined

try {
      const Messages = require('../../messagesSchema');
      const users = message.mentions.users.first() || message.member.id;
      const member = users.username || message.member.id
      if(!users) return message.reply("Tag someone.")
      const messages = await Messages.findOne({
        guildID: message.guild.id,
        userID: message.mentions.users.first()?.id || message.member.id
      })
      
      message.channel.send(`${member} has ${messages.messageCount} in total.`)
    } catch {
      message.channel.send("This member doens't have any records yet.")
    }``` 

Am i missing something?
lament rock
#

Your code is also rather illogical and doesn't make sense from a strictly type perspective

#

if (!users) will never run because it will fall back to the guild member issuing the command unless this command is being run in DMs which you should be checking anyways.

In your database findOne, you use a logical OR expression to retrieve a value you already have access to users.id assuming users is a GuildMember.

Assignment of variable member is unnecessary since you can just access users.user.username

covert slate
#

how to solve

pine nova
dry imp
covert slate
dry imp
#

your welcome

covert slate
#

I haven't told you thanks 😂

boreal iron
dry imp
#

gotta be more gentle fake

boreal iron
#

I can’t… I’m dead inside
Can’t feel anything

raw nest
#

If I have a mysql table with mutliple columns f.e. x, y, z.
And I make an API route where you can send patch requests to. How should I do the params to patch multiple values? Should I make like columns + values and both are arrays so I can map in the backend over'em. Or like for every change a request in the backend?

boreal iron
#

I would use the same structure for all request methods
Instead of an array a JSON stringified object as body to provide the data makes more sense
Where the key is the column and the the value, guess the value

#

Concert the body back to an object in your backend to check if it’s a valid object

#

Then escape both the key and the value and build your database query

spark flint
#

how can i set permissions on a slashcommand using SlashCommandBuilder with discord.js

#

I want it to appear disabled for everyone but me

feral aspen
modest maple
feral aspen
#

Since this has been getting annoying, errors just crashing the application when it's a Discord API issue.

#

I mean I mentioned the issue, they want proper evidences, do I just show them the code example?

earnest phoenix
#

The subject should be of what you're encountering, as you've said before, you seem to be encountering random Discord API errors, you can ask what the cause of this can be while showing the error you get on those random errors

#

Yea

feral aspen
#

Sweet.. I'll do so.

boreal iron
slender wagon
#

member.guild.channels.find(channel => channel.name.includes === "welcome")
how can i check if the channel name includes welcome

#

ik this isn't correct

lyric mountain
#

how so?

boreal iron
#

.includes(“search string”)

quartz kindle
#

some databases dont support prepared statements for column names

#

i know sqlite doesnt

boreal iron
#

What a random statement

quartz kindle
#

what i do is manually filter the keys by colum names

boreal iron
boreal iron
#

Stop being so old, Tim

quartz kindle
#

you said escape the name and value

#

i didnt say that

modest maple
#

I dont actually know of a single db that does tbh

#

None of you mainstream dbs do

boreal iron
#

I mean the object key can’t actually be any SQL injection as it wouldn’t be a valid object key anymore after parsing the stringified data

modest maple
#

pithink errr no don't rely on that idea

boreal iron
#

Alright I said escaping them - was wrong, now not escaping them - is wrong to, fuck you all

quartz kindle
#

im talking about filtering, not escaping, ie have an array of actual clumn names that actually exist in the db, then remove all keys from the json that dont exist in that array, before building the query

boreal iron
#

Looks like you didn’t press reply

modest maple
#

You just shouldn't try to escape anything like that

boreal iron
#

If you don’t use prepared statements of course you escape the value

modest maple
#

No

quartz kindle
#

well, only if somehow your db/lib doesnt support prepared statements

boreal iron
#

Yeah, if

modest maple
#

You should never try to be smart and escape the data

#

Also prepared statements does not equal parameterized statements

boreal iron
#

No? You just send unescaped values along with your query to risk an injection?
I’m not

modest maple
boreal iron
#

Im still not speaking about prepared statements, my gosh

#

Said this the 3rd time now

modest maple
#

I know

#

Hence why i said dont try to be smart and escape it

#

Because thats playing with fire

#

However what you are doing is lumping prepared statements with parameterized statements

boreal iron
#

How is escaping the value in your query string dangerous?
Not doing it, is dangerous

modest maple
#

I dare you to try escape it correctly

#

Without someone being able to bypass it

boreal iron
#

Of course I do

quartz kindle
#

the danger is not using the better solution

boreal iron
#

You can’t bypass the escape function

modest maple
#

🤨 what escape function

boreal iron
#

Depends on the language you’re using

#

One is part of PHPs mysqli extension

#

Oh I see

modest maple
#

🤨 i have never heard of anything having a direct escape function that makes your data a okay to just send as if its harcoded in the query

quartz kindle
#

php actually does have native escaping functions

#

parameterized queries were introduced quite late

modest maple
#

Php also has two of the same functions because the first didnt work

boreal iron
quartz kindle
#

yes i was confirming what you said

#

so fish doesnt think you crazy

#

:^)

modest maple
#

I know what he's talking about now

#

Although php is a good example of why it's a bad idea

boreal iron