#development

1 messages · Page 86 of 1

compact pier
#

when people use a command, and then 10 ads popup

#

i guess

solemn latch
#

Ratelimits make no sense imo.
Since they are responding to an interaction.

#

Only one could pop up on an interaction

earnest phoenix
#

that wouldn't be possible, they would work the same as modals as you said

#

just no inputs

compact pier
solemn latch
#

It still would be awful, and a good reason for me to not use a bot

earnest phoenix
#

yeah lol

#

they need to add more modal options

#

like selects

sudden geyser
#

tldr don't be annoying

solemn latch
#

A message doesn't interrupt my flow.

If I type a command I might want to type a second right away.

Pop-ups would make that not be possible for no real good reason.

#

I also like to use hot keys on discord.
Maybe I want to swap channels, now I need to do extra steps before using that hotkey.

sudden geyser
#

you mean clicking escape

solemn latch
#

Yep kek

#

Extra steps annoy me

compact pier
#

but it is good for announcements or something, like you have a button that says new update and if people are interested, they will click on it and there is a message that pop out

solemn latch
#

I hate modern ui for that very reason

solemn latch
#

Or even just a message

earnest phoenix
#

basically the same thing

compact pier
#

well yeah, just saying

earnest phoenix
#

but less annoying

sudden geyser
#

even if it weren't an embed and was just a message sent afterwards that'd still be annoying since 99% of the time users don't care about updates

#

they want to run something and get an expected result

solemn latch
#

I dont necessarily disagree that it could be useful.
Sometimes it's hard to get users to read stuff, and a pop-up might make that easier.

#

But really, if a user doesn't read who cares.

compact pier
#

:))

#

a command guide would be nice for pop up

#

because embed limits character

solemn latch
#

Pop-ups would too imo

earnest phoenix
#

you could use buttons to pagination across multiple sections of the guide though

#

i think that would be a better process

solemn latch
#

Select menus are better anyway

earnest phoenix
#

yeah

compact pier
solemn latch
#

Plus, walls of text for command lists are much worse imo.

#

I find them to be practically unreadable

compact pier
#

and if the heights are diffrent, it will just go up and down

#

looks weird

earnest phoenix
#

i don't find buttons laggy think_bold

compact pier
earnest phoenix
#

don't really find them laggy either, most of my bots commands rely on paging through embeds and it works fine

compact pier
#

well yeah, I use it too

viral badge
#

well you as a user have ping to discord and then that needs to reach the bot and then the bot needs to reach discord and discord need to reach you
so if you and the bot have 300ms ping to Discord each then it would take around ~1.2s
you->discord 300ms
discord->bot 300ms
bot->discord 300ms
discord->you 300ms

neon leaf
#

does anyone have an idea? Ive been messing around and cant find anything for 7 hours now

hidden gorge
#

TypeError: Cannot read properties of undefined (reading 'user')

const { SlashCommandBuilder, client } = require ("discord.js");
const { EmbedBuilder } = require("discord.js");

module.exports = {
    data: new SlashCommandBuilder()
        .setName("info")
        .setDescription("bots info"),
    async execute(interaction) {
       
   

        const embed = new EmbedBuilder()
        .setTitle(`${client.user.tag}s Info`)
        .setDescription(`All info about ${client.user.tag}.`)
        .addFields(
            { name: "Members", value: `${client.users.cache.size}`, inline: true},
            { name: "Guilds", value: `${client.guilds.cache.size}`, inline: true} 

        )
   
    
    await interaction.reply({ embeds: [embed] });
    },  
};
deft wolf
#

You need to get the client out of the event

hidden gorge
#

?

deft wolf
#

In your case it is interaction, so your client will be interaction.client

hidden gorge
#

thx

sick agate
#

hell

#

how do I use {%%} in markdown with Jekyll

rustic nova
#

you mean variables?

sharp geyser
rustic nova
#

hi

sharp geyser
#

how you been

rustic nova
#

this is development, there's no how you been

sharp geyser
#

:c

lament rock
wicked pivot
#

Hello, I touch very little canvas and suddenly I need a little help with this thing:

    ctx.beginPath();
    ctx.arc(55, 95, 30, 0, 2 * Math.PI);
    ctx.clip();
    ctx.stroke();

    ctx.drawImage(avatar, 15, 55, 90, 90)

    ctx.beginPath();
    ctx.arc(55, 190, 30, 0, 2 * Math.PI);
    ctx.clip();
    ctx.stroke();

    ctx.drawImage(avatar, 15, 110, 90, 90)```

And suddenly I'm supposed to have two round avatars

And I only have one, the second doesn't even appear
earnest phoenix
craggy pine
#

Question: I want to make my 1 - 5 buttons edit apon clicking the <- or -> buttons to match up with the list I'm providing.

When a user clicks on for example ➡️

            case buttonsList[8].data.custom_id:
                {
                    buttonCollector.resetTimer()
                    page = page + 1 < pages.length ? ++page : 0;
                    row.components = []
                    for(i=0;i<5;i++) {
                        row.addComponents(buttonsList[i])
                    }
                    buttons.deferUpdate(interaction.editReply({embeds: [pages[page]], components: [row, row2], ephemeral: true}))
                    break;
                }

But trying other ways aswell, I don't seem to be able to change the label. All the lables when beginning are

        //this is  buttonList array
        new ButtonBuilder()
        .setCustomId(revisedRandId())
        .setStyle('Primary')
        .setLabel(`${page + 1}`), // + 2, +3, +4, & +5 for 1 - 5 buttons

any suggestions?

#

Seems I had to redeclare the array within the case for the arrows. But it works now so disregard.

odd citrus
#

hey

low olive
#

hey, I'm trying to add "h1" in my description, and tried like this, but nothing happened, what am I doing wrong exactly?

odd citrus
#

anybody knows why this is happening?

#

my txt gets cut in half

#

it depends on screen size

earnest phoenix
odd citrus
low olive
#

can you not make text bigger in headline?

low olive
deft wolf
earnest phoenix
#

` npx node ./src/index.js
node:internal/modules/cjs/loader:1170
throw err;
^

SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
at parse (<anonymous>)
 npx node ./src/index.js
node:internal/modules/cjs/loader:1170
throw err;
^

SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
at parse (<anonymous>)
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1167:22)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object.<anonymous> (/home/runner/Discord-500-Commands-Bot-1/src/index.js:10:17)
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)
exit status 1`

help plz

earnest phoenix
#

lemme try

#
 npx node ./src/index.js
node:internal/modules/cjs/loader:1170
    throw err;
    ^

SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
    at parse (<anonymous>)
 npx node ./src/index.js
node:internal/modules/cjs/loader:1170
    throw err;
    ^

SyntaxError: /home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json: Unexpected string in JSON at position 1826
    at parse (<anonymous>)
    at Object.Module._extensions..json (node:internal/modules/cjs/loader:1167:22)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/home/runner/Discord-500-Commands-Bot-1/src/index.js:10:17)
    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)
exit status 1
craggy pine
#

ty

earnest phoenix
#

there you go

low olive
#

how can I change the color of my text?

deft wolf
#

You have a given file, you have a given line, check what is there

#

The error shows that you have a string where it shouldn't be

earnest phoenix
deft wolf
#

1826 line

#

Just check it

craggy pine
#

in webhooks.json

earnest phoenix
#

/home/runner/Discord-500-Commands-Bot-1/src/config/webhooks.json here?

deft wolf
#

Yea

earnest phoenix
#

but there are only 58 lines

craggy pine
#

I wonder if 1826 is the character count

earnest phoenix
#

um lemme check

low olive
#

What is the command to add color on text? like <h1>

craggy pine
#

Html / css is very easy to lookup this

#
#
earnest phoenix
sharp geyser
earnest phoenix
craggy pine
#

mexShrug well there is tho since you're getting an error

earnest phoenix
#

if u dont mind can i invite u in replit?

deft wolf
#

XD

craggy pine
#

I'm good. You can share you json here tho..

earnest phoenix
craggy pine
#

And to be fair, seeing the code itself that writes to the json probably will be handy.

earnest phoenix
#

there u go

craggy pine
#

Not just the error

#

Oh it's a json database yikers.

earnest phoenix
#

um>

craggy pine
#

What's "Token" actually.

deft wolf
#

Webhook token

craggy pine
#

Ah cool

earnest phoenix
#

yep

craggy pine
#

can people yoink that and do naughty stuff smug

deft wolf
#

Wait

craggy pine
#

as in don't share things that only you or ur team is ment to see

deft wolf
#

But it's the same token and id I guess

solemn latch
#

deleted

earnest phoenix
craggy pine
#

Zoo to the rescue! huggies

deft wolf
#

Then why do you copy and paste it so many times when you can have it in one line

earnest phoenix
#

what can i write? btw .

craggy pine
#

Anyhoo. What I would suggest doing to help us help you.

#

You can share your json, but make sure the "token" values are hidden from us, just like delete it temporarily. Then, share us the code that calls the json just incase it's from there

earnest phoenix
#

ohk

#

there u go @craggy pine

craggy pine
#

Didn't I say to delete token KEKW

#

I still see it

earnest phoenix
#

but its half

craggy pine
#

ok

#

good nuf

earnest phoenix
#

half is deleted

earnest phoenix
craggy pine
#
{
    "startLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "shardLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "errorLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "dmLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "voiceLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "serverLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "serverLogs2": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "commandLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "consoleLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "warnLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "voiceErrorLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "creditLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    }
    "evalLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    },
    "interactionLogs": {
        "id": "1063091856373727282",
        "token": "mQi9frguE3cvE42wcewLcIHBJcD31_8o4MvVScMpiY"
    }
}
#

my internet provider is here, so I may have to go for a bit. What code calls there values? Maybe NyuNyu can solve it while I'm afk

pearl trail
#

💀 those tokens are invalid, aren't they

craggy pine
#

No scroll up ull see his issue

earnest phoenix
craggy pine
#

it's also half his token zoo so dw

solemn latch
#

ive been lurking dw

#

👀

wheat mesa
earnest phoenix
solemn latch
#

👀 shouldnt your code editor point that out?

#

I hope you're not using notepad

#

^_^

wheat mesa
#

Also replit is pretty garbage with intellisense

solemn latch
#

That's true

jaunty basalt
#

Hey there! I wanna ask that can i format code using shift+alt+f

?

earnest phoenix
jaunty basalt
earnest phoenix
#

But most IDEs and code editors provide a way to customize your keybindings

jaunty basalt
#

So that will not work?
Actually, I am not on pc right now so I'm asking

earnest phoenix
jaunty basalt
earnest phoenix
earnest phoenix
#

Even if it doesn't, you can customize it to work with any keybindings you want

earnest phoenix
earnest phoenix
#
© Uo | 2021 - 2023
All rights reserved


System >> Version 9.0.4 loaded

System >> Starting Shard #1 ...

(node:700) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:707) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166
        reject(new Error('SHARDING_READY_TIMEOUT', this.id));
               ^

Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
    at Timeout.onTimeout (/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166:16)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  [Symbol(code)]: 'SHARDING_READY_TIMEOUT'
}
exit status 1
#

what's the issue?

earnest phoenix
#

plz reply anyone

last tapir
#

where do you get the secret key from?

earnest phoenix
last tapir
#

what?

earnest phoenix
last tapir
#

my axios is not for discord

earnest phoenix
#

oh

neon leaf
earnest phoenix
# neon leaf from the website
© Uo | 2021 - 2023
All rights reserved


System >> Version 9.0.4 loaded

System >> Starting Shard #1 ...

(node:700) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:707) DeprecationWarning: MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166
        reject(new Error('SHARDING_READY_TIMEOUT', this.id));
               ^

Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
    at Timeout.onTimeout (/home/runner/Discord-500-Commands-Bot-1/node_modules/discord.js/src/sharding/Shard.js:166:16)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  [Symbol(code)]: 'SHARDING_READY_TIMEOUT'
}
exit status 1
#

could u plz help me out

neon leaf
#

do you need sharding? Id assume no so remove it

earnest phoenix
neon leaf
#

In your code...?

earnest phoenix
#

ik but where

neon leaf
#

how would I know?

#

I didnt write your code

earnest phoenix
neon leaf
#

then ask him

earnest phoenix
neon leaf
#

then wait

#

or try to do it yourself

earnest phoenix
neon leaf
#

I dont know because code doesnt look the same for everyone

#

everyone writes code that looks different

#

You gotta look for obvious words like "shard" or "manager" in your code

earnest phoenix
#

ok

earnest phoenix
neon leaf
#

try around

earnest phoenix
neon leaf
#

no

earnest phoenix
#

😦 OK

neon leaf
#

looking at that code it seems like your bot doesnt do anything

#

so removing the code wouldnt do anything

#

neither would keeping it do

earnest phoenix
#

my bot was working fine before like 30mins ago

#

after it restarted

#

please learn to code

#

it dosent start

earnest phoenix
#

plz help me out to solve my error

earnest phoenix
#

you dont even know what are you doing

earnest phoenix
#

like what am i doing?

neon leaf
#

tbh that code just looks like a template from github

wheat mesa
#

It is

#

If you look up his folder name it’s a replit template

neon leaf
#

I suppose he should remove Javascript from his bio for now

earnest phoenix
#

☠️

earnest phoenix
#

which java version is good for lavalink

lyric mountain
lyric mountain
earnest phoenix
#

this happen

lyric mountain
#

then u didn't install properly

#

are u using linux?

earnest phoenix
#

yes

#

ubuntu

lyric mountain
#

how did u install java? through apt?

earnest phoenix
#

sudo apt install openjdk-13-jdk

lyric mountain
#

try running java --version

earnest phoenix
#

java is not installed

lyric mountain
#

hm, do echo $JAVA_HOME

earnest phoenix
#

when i run install cmd its shows this

lyric mountain
#

ah, that's apt then

#

well, u don't install like that, I thought u somehow managed to isntall it already

#

java isn't on apt

earnest phoenix
#

how to install then

lyric mountain
#

there're instructions on openjdk

earnest phoenix
#

i find on google i didnt get anythign

lyric mountain
#

show what u searched

earnest phoenix
lyric mountain
#

did u search for it?

rustic nova
#

apt-cache search jdk to see if your distro even have repos for it

lyric mountain
#

jdk isn't on apt, u gotta install manually

rustic nova
#

it is on some distros

lyric mountain
#

the one that's available there is long obsolete

rustic nova
#

true

lyric mountain
#

iirc it was still 8 or 11

rustic nova
#

but tbf I never update to the newest java lmao

earnest phoenix
#

does lavalink run on java 17 ?

rustic nova
#

try it and see

lyric mountain
#

name, I got the tutorial link on my clipboard, I just want the truth

#

did u search or did u lie?

earnest phoenix
#

which onew

lyric mountain
earnest phoenix
lyric mountain
#

yes, that's the tutorial

earnest phoenix
#

this is in the website

#

that second link

lyric mountain
#

read the first link

earnest phoenix
earnest phoenix
#

see this

#

i think its more clear in this website

#

just watch it once

lyric mountain
#

...I think ur missing the point

#

but well, go on then, install it

#

btw, the one in that tutorial isn't openjdk

#

it's oracle jdk, and you'll need to sign in to download

#

also you'll be liable if u ever monetize ur bot

rustic nova
#

mfw I ended up using dockers to avoid compatibility issues on specific java versions

#

yeah get openjdk

lyric mountain
lyric mountain
#

much easier than doing it on windows

rustic nova
#

bricked my server

#

because im smart

lyric mountain
#

lmao how

rustic nova
#

no

#

fucking

#

clue

#

so I never bothered with new versions that caused my java-based bot to die

#

so dockers it were then

lyric mountain
#

I never got compatibility issues when upgrading versions, perhaps one of the libs u used relied on unsafe packages (like sun)

#

I'm waiting for the next release that'll introduce virtual threads

#

and switch pattern matching

#

like ```java
switch (number) {
case Integer i -> ...;
case Double d -> ...;
case Float f -> ...;
case Long l -> ...;
}

rustic nova
#

nah, got to a point where i had enough of switching to different versions because of me being dumb on setting it up properly

sick agate
#

i never got the compile shit on it so

hidden gorge
#

TypeError: Cannot read properties of null (reading 'avatarURL')

const joinembed = new EmbedBuilder()



.setTitle(`Thanks for Inviting RocketX to Your Server`)
.setDescription(`My Commands are </ping:1062467283785625783>, </info:1062842490450878515>, </server:1062467283785625784>, </help:1063171713375940680> `)
.setThumbnail(client.user.avatarURL())

client.on(Events.guildCreate, (g) => {
    const channel = g.channels.cache.find(channel => channel.type === 'GUILD_TEXT' && channel.permissionsFor(g.me).has('SEND_MESSAGES'))
    channel.send({ embeds: [joinembed] });
})```
deft wolf
#

Your embed must be built inside to be able to access the client

#
client.on(Events.guildCreate, (g) => {

const joinembed = new EmbedBuilder()
.setTitle(`Thanks for Inviting RocketX to Your Server`)
.setDescription(`My Commands are </ping:1062467283785625783>, </info:1062842490450878515>, </server:1062467283785625784>, </help:1063171713375940680> `)
.setThumbnail(client.user.avatarURL())

const channel = g.channels.cache.find(channel => channel.type === 'GUILD_TEXT' && channel.permissionsFor(g.me).has('SEND_MESSAGES'))
channel.send({ embeds: [joinembed] });
})
#

More like this

#
  • you have absolutely no client defined
#

The only thing you have access to is the server where the bot will be added

lyric mountain
deft wolf
#

Right

#

You can also try try catch or .catch()

#

But I leave that to him

lyric mountain
#

fair

deft wolf
#

I'm also wondering if the channel won't return a few channels

lyric mountain
#

I think find returns only a single channel

#

for many it'd be .filter

earnest phoenix
#

@lyric mountain hey my lavalink is not connecting

#

idk why i used default 2333 port and the external ip of google cloud

lyric mountain
#

does the log show something?

earnest phoenix
#

no

#

idk why it unable to connect to the ip

lyric mountain
#

try pinging that port

#

from your vps

#

btw, gcloud is by far not enough for music

#

at least not the free tier

earnest phoenix
#

um

#

i have trial

#

6gb ram 2 core

lyric mountain
#

music is very resource-intensive

earnest phoenix
#

but atleast it must run

lyric mountain
#

anyway, try pinging the port

earnest phoenix
#

how

#

wait

#

i just deleted the VM

#

let me create new

lyric mountain
earnest phoenix
#

yaa wait

earnest phoenix
lyric mountain
#

ping from the vps

#

not from ur pc

hasty lotus
#

can anyone explain me how an interaction can be in a "null" channel ? 😅

earnest phoenix
deft wolf
#

What is .isDMBased() because it's the first time I see it

earnest phoenix
#

but still bot cant connect

deft wolf
#

Alright, I found it

lyric mountain
#

and if the port is properly configured

earnest phoenix
hasty lotus
earnest phoenix
deft wolf
lyric mountain
earnest phoenix
lyric mountain
#

idk, search

#

I never used gcloud

earnest phoenix
#

i have a repo on github with lavalink files

#

i used same step and file on linode

#

and it work on linode

#

but not on gcloud

#

and port is open

lyric mountain
earnest phoenix
#

lavalink just need 2 file lavalink.jar and application.yml

lyric mountain
#

yes, I asked cuz u said "I have a repo"

#

but if ur getting files from the original repo then it cant be lavalink issue

#

are you 100% sure the log doesn't say anything?

#

also double-check if the port is open

earnest phoenix
#

uff

#

i m tired now

#

leave it

wicked pivot
lyric mountain
#

what is it supposed to do?

wicked pivot
#

one below the other.

#

Problem I dont know too little about canvas.
And I don't think I understood very well what Voltrex explained to me.

lyric mountain
#

ur drawing the avatar 2 times in the same place

#

x: 15, y: 55

craggy pine
#

If someone doesn't give a bot manage messages and I run <message>?.delete since I know that adding ? is for if something could work, will it still throw the missing permissions error? Idk when using ? is proper to use.

wicked pivot
# lyric mountain ur drawing the avatar 2 times in the same place

error on my part because I wrote too quickly I edited the message and even by changing that nothing

and when I delete the other the second appears

    //ctx.beginPath();
    //ctx.arc(55, 95, 155, 0, 2 * Math.PI);
    //ctx.closePath()
    //ctx.clip()

    //ctx.drawImage(avatar, 15, 55, 80, 80)

    ctx.beginPath();
    ctx.arc(55, 190, 30, 0, 2 * Math.PI);
    ctx.closePath()
    ctx.clip()

    ctx.drawImage(avatar, 15, 155, 80, 80)```
west stag
wicked pivot
pearl trail
craggy pine
#

Also realised my invite URL on top.gg basically was just the bot getting invited w/o permissions. So that's sick

#

even tho I'm pretty certain I used my default invite URL but whatever. Sad_Sackboy

quartz kindle
lyric mountain
#

java be like

g2d.setClip(new Ellipse(centerX, centerY, sizeX, sizeY));
rustic nova
lyric mountain
#

honestly I just put the coordinates directly 😅

#

I do enjoy how straightforward java graphics framework is

sharp geyser
#

straightforward?

#

What graphics framework are you speaking of

lyric mountain
#

graphics2d

sharp geyser
#

oh ok I didn't t ry that one

wheat mesa
#

to be fair I'd expect it to be straightforward considering it's 20+ years old

lyric mountain
sharp geyser
#

trying to figure UDP out is a little confusing

craggy pine
#

Made a moc-embed of me trying to think of how to make this as pretty as I can even tho emojis will always imo look the best.
How does this look?
https://scs.twilightgamez.net/jdzVV.png Can't replicate it 100% however it's close enough

sharp geyser
#

Is it just me or does the top left emote not look centered in the button

craggy pine
#

I mean it's just a website. mexShrug

#

I'll code it once I'm satisfied with how I want it

sharp geyser
#

Looks fine to me

craggy pine
#

I wish I could make buttons smaller, and have a max of like 10 so I can string them across like how I do emojis now

earnest phoenix
#

the color of the BOT label is throwing me off

lyric mountain
#

what errors?

earnest phoenix
#

The Way it's setup is throwing me off

wicked pivot
#

Good evening, I have a problem with the node-gyp installation. This is what the console tells me:

(although I have visual studio installed with desktop c++ ​​I don't understand)

quartz kindle
#

npm i -g windows-build-tools

wicked pivot
#

"Downloading installers failed. Error: TypeError: 'process.env' only accepts a configurable, writable, and enumerable data descriptor"

craggy pine
earnest phoenix
#

What language are you using?

lyric mountain
#

Js

earnest phoenix
#

Oh cool

wheat mesa
#

perhaps asking a specific question would help?

craggy pine
craggy pine
lyric mountain
#

It's the same emoji I think

#

\🔇

#

Hm

craggy pine
#

strange

lyric mountain
#

Doesn't render for me lul

wheat mesa
#

\🔇

#

works for me

craggy pine
#

I want it to be

wheat mesa
#

It will be like that

lyric mountain
#

It's what me and waffle sent

craggy pine
#

alright.

lyric mountain
#

I just can't see it cuz mobile

craggy pine
wheat mesa
#

The UTF representation is different-looking because that's what discord needs to be sent

craggy pine
#

I got 2 different emojis 😛

lyric mountain
#

If u send that emoji in the chat it'll become the one in discord

wheat mesa
#

You can't send it :mute: since it's expecting one char, it's just discord will render it differently when posting that to a button

craggy pine
#

aight

lyric mountain
#

It's just unicode vs discord render differences

wary sapphire
#

how much time does it usually takes to approve the bot?

boreal iron
#

Usually 1-2 weeks afaik

#

But no guarantee on that

last tapir
#

how do you get a secret key when it comes to using axios

#

i didnt understand how the secret key works

sterile brook
last tapir
#

._.

sterile brook
#

Salary first

rustic nova
#

most least sus user ever

#

@ivory siren

ivory siren
#

Banned

ivory siren
worthy belfry
#

What's goingbon

deft wolf
#

Thanks

rustic nova
#

The pay: 5 robux

#

@ivory siren

ivory siren
sudden geyser
digital swan
sudden geyser
#

hello

#

no

#

don't know what a tt account is, plus can't be bothered

earnest phoenix
#

@real rose also here

sudden geyser
#

just make a dance video or something

#

should have the same effect

earnest phoenix
#

tik these balls

real rose
#

thanks

#

bonked

#

ongod

#

was wondering because I never get pinged in there lol

crystal wigeon
#

Hey how does djs permissions “serialise” method work?

#

Like permissions is a bit field or something and then when I call this method it returns an object

#

What’s the logic behind this?

sudden geyser
#

It just takes the list of permissions, filters for the ones the permission instance has, and returns an object of it

#

Serializing permissions is really only useful if you need the permissions in a more generic format

crystal wigeon
#

So they’re adding up numbers ?

surreal sage
#

Any DOM variable that returns a number based on amount scrolled is always zero for me

sudden geyser
# crystal wigeon So they’re adding up numbers ?

No. Serialize filters for the permissions the permission object has and returns an object representing it. Internally, checking permissions just uses bitwise and (&), which is inline with how Discord handles permissions (as a single int)

#

If you're interested in the actual bits, a permission in its bit form is just a number, but as a set, constantly doubled, starting at 1, then 2, 4, 8, 16, 32, etc.

#

To get the sum of permissions, you just sum up the numbers to get a single number

#

The numbers doubling allow them to be distinguished. If you want to see if a user has admin (represented as 1), you just do perms & 1, where perms is the sum of permissions, and see if the returned number is the same (if it is, they have the permission; if not, they don't)

crystal wigeon
#

Nice thanks!

sudden geyser
neon leaf
#

is there any maintained package similar to canvacord?

earnest phoenix
#

There's also https://npmjs.com/package/canvas-constructor which is basically canvas with additional utilities

neon leaf
#

is there any template for a level card?

tawdry bone
#

Hello

#

My Bot 2 week Send To Top.ggg

deft wolf
#

Okay and?

untold steppe
tawdry bone
#

@untold steppe me 2 week wait

deft wolf
#

No

#

U did not

untold steppe
tawdry bone
#

@untold steppe ok thanks

slender wagon
#

so what do you guys do when everything works but you still got these errors around

sudden geyser
#

click on quick fix and hope a good solution is available

#

it's complaining that you haven't assigned a type to filteredData

#

you could be lazy and just say : any so it shuts up

#

or assign a proper type for the situation

slender wagon
slender wagon
craggy pine
#

What would be a good way to work around this specific error. This occurs when someone invites my bot, plays music, and just kicks the bot. Since the music player is active and as soon as it leaves a disconnect event fires and says "Finished playing music!" but since its a no-longer cached channel, it can't.

Promise {
  <rejected> Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
      at Message.delete (/etc/opt/NyuMusic/node_modules/discord.js/src/structures/Message.js:783:30)
      at Timeout._onTimeout (/etc/opt/NyuMusic/src/library/functions.js:250:104)
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7) {
    code: 'ChannelNotCached'
  }
}
    .on("disconnect", async (queue) => {
        const getEmbedFromDB = await client.database(`SELECT message_id, voice_channel_id FROM music WHERE queue_id = ${queue.id}`, false, true)
        if(getEmbedFromDB[0]) {
            let m
            try {
                m = await queue.textChannel.messages.fetch(getEmbedFromDB[0].message_id, {limit: 1}) //it fetches fine appearently.
            }catch(err){}
            if(m) {
                if(m.id === getEmbedFromDB[0].message_id) m.delete()
                await client.database(`DELETE FROM music WHERE queue_id = ${queue.id}`, false, false)
    
                await client.successEmbed(`Finished playing music! Disconnecting...`, queue.textChannel, 7500) // but here it fails.
            }
        }
    })
tulip ledge
craggy pine
#

Uh. It's not crashing

#

It's also not exactly related to my question either.

tulip ledge
#

Huh?

craggy pine
#

So the cache part. Obviously the bot leaving will uncache a channel however, its still able to fetch it.

tulip ledge
#

Can you elaborate

craggy pine
#

read my comments in the code

tulip ledge
#

Ahh

#

So if I get it right

#

The bot can fetch the channel even though it’s not in the server?

#

Is that what you mean?

craggy pine
#

It appearently does because if(m)

tulip ledge
#

Mhm

#

I havent used djs since v13 but maybe you can get a list of all guilds of your bot and check if the guildid of that channel is in that list

craggy pine
#

well this is v14 so things have drastically changed.

#

but not a terrible idea.

tulip ledge
#

Yeah then i cant rlly help

#

Good luck though

craggy pine
#

ty

sudden geyser
#

I'm surprised you can delete the message given that the bot was kicked

craggy pine
#

ya it's specifically throwing that error within client.successEmbed() at this piece of code

sudden geyser
#

actually

#

wait

craggy pine
#

return setTimeout(() => {if(channel.messages.cache.find(m => m.id === timeOut.id)) timeOut.delete()}, time)

#

probably not the best way of doing a timeout

#

but it works

earnest phoenix
tulip ledge
#

Ahh

earnest phoenix
#

Look at the call stack in the error

craggy pine
#

at Timeout._onTimeout (/etc/opt/NyuMusic/src/library/functions.js:250:104) yes this part

#

which is

craggy pine
#

I forgot to put that part in my above code my b

#

but the whole reason this is even failing

#

is because it's still able to fetch an uncached channel

earnest phoenix
#

What exactly is the timeOut variable declared as?

craggy pine
#

the successEmbed

#

sec

#
  client.successEmbed = async (str, channel, time) => {
    const sucEmbed = new EmbedBuilder()
      .setColor("#00FF00")
      .setTitle("✅ SUCCESS")
      .setDescription(str)
      .setTimestamp()

    if(channel && !time) {
      return channel.send({embeds: [sucEmbed]})
    }

    if(channel && time) {
      const timeOut = await channel.send({embeds: [sucEmbed]})
      return setTimeout(() => {if(channel.messages.cache.find(m => m.id === timeOut.id)) timeOut.delete()}, time) //here
    }

    if(!channel && !time) {
      return sucEmbed
    }
  }
tulip ledge
#

Well one way to solve thzt would be to store all the succesembeds in a map (create your own cache) and remove them after x amount of seconds and also remove everyone of a guild when the bot gets kicked and add another if statement to the timeout for if the guild of the message is in the map

#

If you get what I mean

earnest phoenix
craggy pine
#

It works quite well actually. It only fails on this specific instance

earnest phoenix
#

I meant that it's not gonna work for this scenario

craggy pine
#

Ah fair LUL

#

I could just .catch() ya

#

but my main question really and I'm glad you're here voltrex

#

m = await queue.textChannel.messages.fetch(getEmbedFromDB[0].message_id, {limit: 1})

#

Why does this work when its uncached

earnest phoenix
#

What is uncached? The channel?

craggy pine
#

Well everything

#

because...

#

The person who played a song, kicked my bot while it was playing

#

so it ran through the code and if(m) returned true so it ran the rest

earnest phoenix
#

There's a very high chance that the bot sent a request to that endpoint and successfully fetched the message right before it was kicked

#

It would've failed if it was sent after it was kicked

craggy pine
#

I see.

sudden geyser
#

could try pausing for a second to verify

#

but that is most likely what's happening

craggy pine
#

so realistically, best thing to do is just to .catch() and move on with my life KEKW

earnest phoenix
#

Yes

craggy pine
#

works for me

earnest phoenix
#

There can be a lot of edge cases with the Discord API so spam catch everywhere /s

craggy pine
#

I specifically did that whole

let m
m = fetch message
if(m)

thing to prevent this but I still got beaten by random users who magically know ways to make my bot hate me

#

1 sweaty nerd who tests his own code for hours on end vs 1 random user who wants to listen to music. Who will win, find out next time in the next episode of...

#

also is this valid js timeOut.delete().catch(err)

earnest phoenix
#

It's funny how the users are able to find every edge case you didn't even expect to see

craggy pine
#

it doesn't need to be in a try catch right

earnest phoenix
# craggy pine also is this valid js `timeOut.delete().catch(err)`

The catch() method of a Promise object schedules a function to be called when the promise is rejected. It immediately returns an equivalent Promise object, allowing you to chain calls to other promise methods. It is a shortcut for Promise.prototype.then(undefined, onRejected).

craggy pine
#

I see

lament rock
#

.catch(() => void 0);

sudden geyser
#

🙂

function ignore(f) {
  try {
    f();
  } catch {}
}
lament rock
#

would need to await

sudden geyser
#

:(

lament rock
sudden geyser
#

===

#

eq

earnest phoenix
#

I need help with a duration command to show much of the song is left (I use youtube_dl and d.py)

lyric mountain
#

Then just do start + duration - current

#

And convert the millis to ur desired format

#

If u have a pause command make sure to store a pause timestamp too

rustic nova
#

fuck sockets

#

can I just go the "fuck it" way and have js just make a request to some endpoint every 10 seconds or so

lyric mountain
#

What's the problem?

rustic nova
#

keeping track of active sessions, making heartbeat messages towards the sockets

Though I'm certain its me not fully understanding that library am using

#

so just closed it and didnt bother with it anymore, its 5 am anyways

lyric mountain
#

Keeping track is fairly easy, just have a map where u ads sessions on connect and remove them on disconnect

rustic nova
#

is what I did, with IDs along it since I wanna occasionally talk to these sessions when needed

lyric mountain
#

You're supposed to send a ping regularly, if any of the clients fail to pong back just send a close frame and remove it as inactive

rustic nova
#

yeah but its probably just the shitty library am using

lyric mountain
#

I always used java for the backend, so idk any good ws server libs

sharp geyser
#

Is this js or py

earnest phoenix
#

working fine last night

earnest phoenix
#

why is my bot offline but is running on replit?? working fine last night

#

we dont know

#

😦

#

what could be the reasons?

earnest phoenix
#

np pkill 1 worked

lapis cliff
#

What is the best place to host a vps for a discord bot? For less bot ping.

earnest phoenix
deft wolf
#

Personally, I have a VPS in France and I don't complain much about the ping, but it would probably be higher if I had a VPS in the United States

sterile brook
#

Eh, one week passed

deft wolf
#

Just one more

spark flint
#

Close to discords main dc

formal jacinth
#

my bot is now already two weeks in verify and still no response

deft wolf
#

Two weeks = 14 days

#

Not 12

tulip ledge
bright thorn
#

In some of my server the bot is not online even after a restart

#

i did 4 restart but still the same server
i know it was 13.62k server before restart

crystal wigeon
#

Someone give me topgg invite link pls

earnest phoenix
crystal wigeon
#

thanks

signal lance
#

anyone has a clue how i move this image more to the right? I've tried mr but it didnt do anything

pearl trail
#

if it's a flex, you can use justify-content space-between or space-around to make a space between it that will make the image move to the right

compact pier
#

or with position:absolute

dry imp
#

absolute disgust

rustic nova
#

absolute, if you dont care about your users

dry imp
pearl trail
#

oh bootstrap?

dry imp
#

tailwind

pearl trail
#

icic

lyric mountain
#

Can also create an invisible div between them

compact pier
#

changing the width of the div, so it moves?

bright thorn
# pearl trail icic

I am working in ICICI Bank but then I realised this is what I see I see 🤓

pearl trail
bright thorn
#

Shortcuts 🙈

compact pier
#

I'm trying to make a select menu and this appers

 {"code": 50035, "errors": {"data": {"components": {"0": {"components": {"1": {"_errors": [{"code": "COMPONENT_LAYOUT_WIDTH_EXCEEDED", "message": "The specified component exceeds the maximum width"}]}}}}}}, "message": "Invalid Form Body"}
#

Why is this happening?

#

what is that width?

crystal plover
#

guys can ya help me

#

i cant join the server i just joined this discord

earnest phoenix
#

Am I allowed to use the topgg sdk to make and publish my own library. [ to make use of api more easily? ]

spark flint
#

as long as you dont claim its official

solemn latch
#

not an official topgg stance, but I don't see why not.

but also, the sdk is very simple to use already.

solemn latch
#

I mean, most things in the sdk are one line, one parameter.

#

I dont see how they can be simplified.

#

If you can find a way to simplify it though, I dont really see why we wouldnt allow that.

lyric mountain
sharp geyser
#

much easier to write

earnest phoenix
sharp geyser
#

Which one do you use

#

I notice you use python but there are a lot of youtube-dl libs

slow ibex
#

i feel honestly kinda dumb asking this.. but how the f. do i get a DiscordJS client object into a loaded module?

#

index.js
src\commands\ban\addwatch.js
loads
src\lib\watchlistmanagement.js
which uses client.watchlistDB2 which is created in index.js

slender wagon
#

fixd

sudden geyser
#

or, if you have a discord.js object, just access .client on it

#

I'd recommend the first or last one

sharp geyser
slender wagon
#

fixd fixd

hidden gorge
#

TypeError: (intermediate value).setName is not a function

// https://api.popcat.xyz/showerthoughts

const { EmbedBuilder } = require("discord.js");
const { SlashCommandBuilder } = require("discord.js");
const { ActionRowBuilder, ButtonStyle, ButtonBuilder } = require("discord.js");

module.exports = {
    data: new SlashCommandBuilder()
        .setName("shower")
        .setDescription("Sends A Shower Thought"),
    async execute(interaction) {

        const embed = new EmbedBuilder()
        .setName("Random Shower Thought")
        .setImage("https://api.popcat.xyz/showerthoughts")

        await interaction.reply({ embeds: [embed] })
    }  
}```
spark flint
#

const embed = new EmbedBuilder()
.setName("Random Shower Thought")

#

not possible

#

.setTitle

hidden gorge
#

OH

#

im an idiot

sudden geyser
#

that's a slash command builder though oh I see now

spark flint
#

lol

hidden gorge
#

thanks big bun

spark flint
#

np trigger warning roblox

hidden gorge
#

SHUT UP

wheat mesa
#

js mfs when their IDE doesn’t highlight a basic non-existent function error

spark flint
#

lol

sharp geyser
#

👀

slow ibex
#

OK.. i've actually managed it to work.. kinda
My Problem now is that if i return something.. its always undefined.. like wtf.

#

"im gonna break my monitor, i swear" - calmly said by some random guy on the internet

sharp geyser
#

I have no idea what you are talking about rn

slow ibex
#

same

#

so.. i have this function.. right?

const sqlite3 = require('sqlite3').verbose();
const watchlistDB2 = new sqlite3.Database('./database/watchlistDB.sqlite');

module.exports = {
    async checkWatchlist(userID) {
        var checkWatchListSQLStmt = `SELECT * FROM watchlist WHERE userID = ${userID}`;
        await watchlistDB2.get(checkWatchListSQLStmt, [], (err, row) => {
            if(err) {
                toad.error(`CMD: /addwatch | ${err}`);
            } else {
                if(row) {
                    console.log("Is on Watchlist")
                    return true;
                } else {
                    return false;
                }
            }
        });
    }
}
#

and when i call it somewhere else.. like that for example const check = await wlm.checkWatchlist(watchlistUserID); its result is always undefined

#

The Fun stuff is.. the console.log from the function works. so i know it got a result

sharp geyser
#

You are returning bools tho

#

how is it undefined

spark flint
#

if (err) nothing gets returned either

sharp geyser
#

Also

#

I'd make a map of some sort of all the watchlist users, as making a lot of calls to an sqlite db is not good

wheat mesa
#

What would I be using for

sharp geyser
#

you said you were using djs

#

5head

slow ibex
wheat mesa
#

Djs is written in ts

sharp geyser
slow ibex
#

But i know that the query works.. because the log said so

wheat mesa
#

You’re returning from the callback function and not the function itself

#

Return outside of the callback and your problem will be solved

sharp geyser
#

Didn't even realize the scoping problem

#

Also do you even need to use a callback when using asynchronous

slow ibex
#

The async stuff was just a troubleshooting step because im interally raging lol

#

Okay.. even that didnt work.. also.. my table has now an imprint of my head

covert gale
#

so uh

#
  File "air.py", line 55
    print(f"pm2.5: {pm25ug}, pm10: {pm10ug} ug/m^3")
                                                  ^
SyntaxError: invalid syntax
#

cc: @spark flint python master pls help

spark flint
#

wrong

#

i am not python master

#

python sucks

covert gale
#

u were

#

pls help me

#

im desperate

spark flint
#

no im busy

covert gale
#

now getting

#
Traceback (most recent call last):
  File "air.py", line 4, in <module>
    import requests
ImportError: No module named requests
wheat mesa
spark flint
#

😭

#

are you forking a bot

covert gale
#

bro this is my first time using opython

spark flint
#

ImportError: No module named requests

covert gale
#

i got requests already

spark flint
#

i'll say the same as i would say to someone using js

#

learn the basics of the language first

covert gale
#

pip3 install requests

covert gale
#

cant do that

spark flint
#

try pip install requests

covert gale
# spark flint try `pip install requests`

root@rockpi-4b:~# pip install requests
Requirement already satisfied: requests in /usr/local/lib/python3.8/dist-packages (2.28.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests) (1.26.7)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.8/dist-packages (from requests) (2.0.9)
root@rockpi-4b:~#

spark flint
#

idk then

#

💤

covert gale
spark flint
spark flint
#

thats all im saying

covert gale
#

ill learn later

#

i dont have time

spark flint
#

i literally can't

covert gale
#
class SDS011(object):
    """Provides method to read from a SDS011 air particlate density sensor
    using UART.
    """

    HEAD = b'\xaa'
    TAIL = b'\xab'
    CMD_ID = b'\xb4'

    # The sent command is a read or a write
    READ = b"\x00"
    WRITE = b"\x01"
#

root@rockpi-4b:~# python3 air.py
File "air.py", line 13
HEAD = b'\xaa'
^
IndentationError: unexpected indent

sudden geyser
spark flint
sudden geyser
round cove
#

Is there a way to check if my bot is in a server with just an API call with the secret token, and not with an actual bot client?

sudden geyser
#

I don't think so, given that'd imply some access to the member list, which requires an account

#

Though if by "secret token" and "not with an actual bot client" you just mean being able to request from the API without establishing an actual (websocket) connection, it should be possible, given the auth header. Actually maybe not, since you'd need to act as the bot.

lyric mountain
#

Yes, u can only know which servers ur bot is in through the actual bot

#

If bots could authorize oauth2 you could use the servers endpoint, but they can't

round cove
#

Right. I think I figured out a local wa yto do it, if the server doesn't have a config then they most likely don't have the bot invited lol.

sudden geyser
#

inb4 user kicks your bot while it's offline

craggy pine
#

Why I do a "Check all guilds / members" on boot thing and if anything has changed or is missing it'll throw it into my DB

worthy belfry
wheat mesa
#

this is not relevant to us whatsoever

viral badge
#

do a speedtest

sterile brook
#

Why command still usable in dms?

deft wolf
#

You may need to wait for it to update

#

I had a similar situation where one of the commands worked in dm despite the fact that they are all written in the same way so that they could not be used in dm. After a few hours everything worked as it should

deft wolf
#

Hi

#

You must have a verified bot on the top.gg

earnest phoenix
#

get a bot approved

slow ibex
#

Did i miss a memo or something like that?
If i define a Variable inside a function... i should be able to access it outside it?

lament rock
#

no

slow ibex
#

then how the f should i get data from it?

lament rock
#

the return value

slow ibex
#

didnt do shit for me

#

i just get an empty object out of it

#

but i know that there is data

#

but it hides from me

lament rock
#

can you actually provide code

slow ibex
#

Of course...

case 'statistics': {
                const watchlistDB2 = client.watchlistDB2;
                const entryCountForGuildStmt = `SELECT COUNT(dbID) FROM watchlist WHERE guildID = ${interaction.guild.id}`;
                const entryCountGlobalStmt = `SELECT COUNT(*) count FROM watchlist`;
                var entryCountForGuild, entryCountGlobal;
                entryCountForGuild = watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
                    if(err) {
                        client.toad.error(`CMD: /admin statistics | ${err}`);
                    } else {
                         return row['COUNT(dbID)'];
                    }
                });
                watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
                    if(err) {
                        client.toad.error(`CMD: /admin statistics | ${err}`);
                    } else {
                        entryCountGlobal = row['COUNT(*)'];
                    }
                });
                console.log("Guild: " + JSON.stringify(entryCountForGuild));
                console.log("Global: " + entryCountGlobal);
                break;
            }
sudden geyser
#

Is there a way to get Discord's perception of time when running an interaction? I'd like my purge messages command to account for when Discord considers a message too old (currently I'm just taking my perception of time, going back two weeks, and adding a minute)

slow ibex
#

ah sh.. thanks for that discord.

lament rock
slow ibex
#

oh btw.. im using sqlite3

lyric mountain
#

use better-sqlite3

deft wolf
#

Problem solved poggythumbsup

lyric mountain
#

it unironically solves lots of problems with the older lib

#

besides, don't use var ever

#

also I'm not sure, but isn't .get async?

#

@slow ibex cm here

sudden geyser
slow ibex
#

normally i use const so..

lyric mountain
#

const is for constants

#

for variables use let

slow ibex
#

well.. tried all of them tbh

lyric mountain
#

it isn't the solution to the issue, but will prevent u from getting memory and scope issues

slow ibex
#

The callbacks are already in an Async function

lyric mountain
#

still

slow ibex
#

And i tried it with await but no change

lyric mountain
#

you're returning a value, but if .get is async u need to await it

lyric mountain
slow ibex
#
Guild: {}
Global: {}
lyric mountain
#

global will always be empty cuz u cant assign a value inside an async callback

slow ibex
#

Oh no no no.. global != global.

lyric mountain
#

I mean this

#

wont work if u do this

slow ibex
#

k

#

as of now im returning it

#

but.. still.. yeah

lyric mountain
#

put console.log(row) inside the first callback

#

see what it returns

#

and use aliases for aggregates

#

count(dbID) AS total

#

also, row is more likely to be rows, since it can return more than one row

slow ibex
#

i already did all of that lol

#

{ 'COUNT(dbID)': 120 }

lyric mountain
#

this is what printed?

slow ibex
#

i just reverted that stuff while troubleshooting

lyric mountain
#

show the current code please

slow ibex
#
case 'statistics': {
                const watchlistDB2 = client.watchlistDB2;
                const entryCountForGuildStmt = `SELECT COUNT(dbID) FROM watchlist WHERE guildID = ${interaction.guild.id}`;
                const entryCountGlobalStmt = `SELECT COUNT(*) count FROM watchlist`;
                
                let entryCountForGuild = await watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
                    if(err) {
                        client.toad.error(`CMD: /admin statistics | ${err}`);
                    } else {
                        console.log(row);
                         return row;
                    }
                });
                let entryCountGlobal = await watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
                    if(err) {
                        client.toad.error(`CMD: /admin statistics | ${err}`);
                    } else {
                        return row['COUNT(*)'];
                    }
                });
                //im gonna loose my fcking mind... why cant this be like the good ol' PHP days
                console.log("Guild: " + JSON.stringify(entryCountForGuild));
                console.log("Global: " +  JSON.stringify(entryCountGlobal));
                break;
            }
quartz kindle
#

is that sqlite3 or better-sqlite3?

slow ibex
#

sqlite3

quartz kindle
#

did you do npm i sqlite3?

#

or npm i sqlite

slow ibex
#

"sqlite3": "^5.1.4"

quartz kindle
#

does not look like that library supports async/await syntax

#

it only uses callbacks

lyric mountain
#

that's beyond cursed

slow ibex
#

And it wasnt a problem for me so far.

quartz kindle
#

therefore you must either use it the callback-hell way, or promisify it yourself

viral badge
#

callbacks pretty ez tho

craggy pine
#

Idk if related, but I believe mariadb supports it if that's the route you wish to go.

lyric mountain
#

easy yes, but unreadable (in this case)

quartz kindle
#

the callback-hell way: ```js
watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if (err) {
client.toad.error(CMD: /admin statistics | ${err});
} else {
console.log(row);
watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
if (err) {
client.toad.error(CMD: /admin statistics | ${err});
} else {
console.log(row)
}
});
}
});

slow ibex
#

Oh.. i did that a couple of times so far.

#

and i hate it

#

why the f. did i forgot that..

#

i think im sleep deprived lmao

lyric mountain
#

promise-way would be ```js
const prom = new Promise((resolve, reject) => {
watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
if (err) {
client.toad.error(CMD: /admin statistics | ${err});
reject(err); // idk what's the fail version of resolve
} else {
resolve(row);
}
});
});

console.log(await prom);

lyric mountain
slow ibex
quartz kindle
#
const prom = await new Promise((resolve, reject) => {
  watchlistDB2.get(...., (err, row) => {
    if(err) reject(err);
    resolve(row);
  })
})
wooden ember
#

when did discord change the colours of their text highlighting? (the codeblock highlighting i mean)

lyric mountain
#

wasn't it like that for js?

quartz kindle
slow ibex
lyric mountain
#

caution must be taken tho, since u can lock ur runtime with shitty-written queries

slow ibex
#

Is there a way to timeout it?

#

for example if there is no result after 5000ms then just error out?

lyric mountain
#

I didn't mean the promise, was talking abt better-sqlite3

slow ibex
#

ah k

lyric mountain
#

since it's sync u need to make sure you dont lock ur only thread

lyric mountain
#

const time = setTimeout(() => reject("Timeout"), 5000)

#

just make sure to cancel the timeout on success

wooden ember
lyric mountain
wooden ember
#

you did?

lyric mountain
wooden ember
#

oh that

quartz kindle
#

i also didnt notice any difference with syntax highlighting

wooden ember
#

i was refering to the md highlighting

#

it looks like garbage now

slow ibex
#
case 'statistics': {
                const watchlistDB2 = client.watchlistDB2;

                const entryCountForGuildStmt = `SELECT COUNT(dbID) FROM watchlist WHERE guildID = ${interaction.guild.id}`;
                let entryCountGuildPromise = await new Promise((resolve, reject) => {
                    watchlistDB2.get(entryCountForGuildStmt, [], (err, row) => {
                        if(err) {
                            client.toad.error(`CMD: /admin statistics | ${err}`);
                            reject(err);
                        } else {
                            resolve(row['COUNT(dbID)']);
                        }
                    })
                });

                const entryCountGlobalStmt = `SELECT COUNT(*) FROM watchlist`;
                let entryCountGlobalPromise = await new Promise((resolve, reject) => {
                    watchlistDB2.get(entryCountGlobalStmt, [], (err, row) => {
                        if(err) {
                            client.toad.error(`CMD: /admin statistics | ${err}`);
                            reject(err);
                        } else {
                            console.log(row);
                            resolve(row['COUNT(*)']);
                        }
                    })
                });
                
                console.log("Guild: " + JSON.stringify(entryCountGuildPromise));
                console.log("Global: " +  JSON.stringify(entryCountGlobalPromise));
                // TODO: Embed magic
                break;
            }

Definitely better than before

quartz kindle
#
# test
## this is an md
lol
wooden ember
#

now it is:

quartz kindle
#

hmm

#

i actually like the bottom one better lol

wooden ember
#

i hate it, but then thats cuz i used it got my bot's menus rather than actual markdown

#

so in its actual usage its probably still ok

quartz kindle
#
> RELOAD >
Test
[abc:][99]
#

hmm, still looks like the old one for me

slow ibex
#

same

quartz kindle
wooden ember
#

client update maybe?

quartz kindle
#

maybe an update is needed

#

let me relog

#

ah yes

#

now it changed

wooden ember
#

oof was a recent update then

quartz kindle
#

indeed, the js one is also different now

wooden ember
#

welp now i gotta change ALL my bot's menues to something that looks presentable

#

sigh

quartz kindle
#

rip

wooden ember
#

indeed

#

why cant people just leave stuff alone

quartz kindle
#

mine also has some of that, but im just gonna leave it the way it is lol

#

i dont even know how it looks now

wooden ember
#

I'm guessing that ancii colours still are only supported on pc

#

I know that codeblock colouring only worked on android but oh well

#

also bruh my cd player command has melted for some reason

#

have to bork it and run the aux command for the audio link and then run the cd command to start the drive

#

and then connect the aux cable to the headphone jack of my cd drive

quartz kindle
#

your bot is still the craziest bot i've even seen

wooden ember
#

lol

covert gale
#

need hex help

#

badly

wooden ember
#

huh?

covert gale
#

need to change it to active mode

wooden ember
#

what do you mean?

#

you want to edit it or something?

covert gale
#

yea

#

its in byte code shit

#

which i dont understand

#

and im not sure how to change the mode

#

@quartz kindle pls help if u know this stuff

wooden ember
#

i know nothing about machine code/hex really so i cant really help much

neon leaf
#

this is very weird but does anyone know why I always get a different json structure when requesting https://www.reddit.com/r/cursedimages/random/.json?

deft wolf
#

What do u mean?

#

Its random so its gonna be always different

neon leaf
#

no, like the structure is different. in one its { data: [] } ... in the other its [ {} ]

deft wolf
#

I don't know then

neon leaf
#

like it works half of the time

torpid crystal
#

suppose i fetch

result = User.findOne({ id: user.id})
amount = 1

//suppose result.wallet = 100

result.wallet += amount
result.save()

then am getting result.wallet = 1001 instead of 101. its adding the strings instead of the amounts.

rustic nova
#

I'm talking a fair guess that whatever result.wallet is, is string based

#

then you appending it to that

#

check the type of wallet

deft wolf
rustic nova
#

what happens if you do result.wallet = result.wallet + amount

#

same thing I know, just wanna see what it does

#

since 100 to 1001 sounds like string appending to me, dunno why it provides you a string though

torpid crystal
#

strangely nothing changed.

i used this code:

     const user = message.mentions.users.first() || message.author;
     const result = await User.findOne({ userId: user.id }) || new User({ userId: user.id })
     let amount = args[1];
    
if (!client.config.owner.includes(message.author.id))  return message.reply("u cant use")

     result.wallet + amount
     result.save()
  
     return message.reply("done")
torpid crystal
#

hmm after using result.wallet = result.wallet + amount still it added the strings

rustic nova
#

cant you check the type of result.wallet using typeof or whatever to use in js to check the type of something

torpid crystal
#

hmm let me try

craggy pine
#

Could use Number(whatever) + Number(whatever) I think that's what I ended up doing with my currency system

sharp geyser
#

inb4 it turns out not to be a number and you get NaN

craggy pine
#

tru

#

but in his case I would imagine it always is a number.

sharp geyser
#

you'd wanna parseInt first

#

just to be safe

craggy pine
#
let newBal = balance[0].currency + 100
#

well in my db I store them as ints

#

so I didn't do that

sharp geyser
#

cause even if you 1a at that point parseInt will ignore a and give you 1 iirc

quartz kindle
#
const data =  Array.isArray(json) ? json[0] : json;
#

when its an array, it will have more than 1 item tho

#

and the url changes to /comments/

quartz kindle
torpid crystal
rustic nova
#

parse amount as int lol

sharp geyser
#

Isn't that what we were just talking about

torpid crystal
#

thanks everyone for your help. finally fixed it with your help opthanks

sharp geyser
#

you could of saved yourself the trouble of making a variable

#

but hey that works

torpid crystal
#

ill try that too, thanks again

neon leaf
#

how can I do something like this:
let ok: interfaceXYZ<interfaceZYX>
?

#

aka how can Imake my interfaceXYZ support arguments?

lyric mountain
#

that's called generics

#

it's not an argument per se

sudden geyser
#

wdym by an interface in an interface

neon leaf
#

I already got it, I mean this:

hidden gorge
#

Interaction Already Replied

const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
const { EmbedBuilder } = require("discord.js");
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const save = require("../models/bans.js");

module.exports = {
    data: new SlashCommandBuilder()
        .setName("ban")
        .setDescription("Moderation +")
        .addUserOption(option => 
            option
                .setName("user")
                .setDescription("Member to ban")
                .setRequired(true))     
        .addStringOption(option => 
            option
                .setName("reason")
                .setDescription("reason"))
        .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers),
    async execute(interaction) {

        const user = interaction.options.getUser("user");
        const reason = interaction.options.getString("reason") ?? "No Reason Provided";

        const embed = new EmbedBuilder()
        .setTitle("User banned")
        .setDescription(`${user} has been banned for **${reason}**`)
        .setThumbnail(`${user.avatarURL()}`)
        .setColor("Red")
        
        

                            await interaction.reply({ embeds: [embed] });
                            await interaction.guild.members.ban(user);
                        },
                    };```
compact pier
#

when should I switch to a microservicec architechture (web backend server)?

#

I trying to build a mobile app, that has a server behind it

#

but I don't know, if should build microservices from beginning or not

compact pier
compact pier
#

Like you defer the interaction and then send the actually message?

#

because when it shows that you already replied the message

#

you should edit the message, or just send a followup message

hidden gorge
#

fixed

lyric mountain
compact pier
#

now I'm starting the project

#

but I don't know what architechture to use

lyric mountain
#

wdym "architechture"?

compact pier
#

you know, there is a monorepo, microservices and so on

lyric mountain
#

just make a backend

#

like, normal server

#

don't worry too much abt those things, make whatever works then optimize ur way up

compact pier
#

I know, but maybe in the future I will scale it up and one server cannot handle it, so I need to split it in the future. What if I split it from the beginning (ik, it won't be that big, just learn, how it works)

#

having 20k+ users is just a dream, but yeah :D

lyric mountain
#

just make a single server, if u need to scale it later just install the api in the other servers and let nginx balance it out

#

20k is absolute nothing

#

unless u buy the worst possible server available, u wont have issues until u hit hundreds of thousands

compact pier
#

yeah, my idea was using kubernetes and nginx to host it

quartz kindle
compact pier
quartz kindle
#

sure, threading also works

compact pier
#

ah, well I will use golang as my main lang and it has auto threading, so I think I don't need worry about that

quartz kindle
#

no lang has auto-threading, unless you mean something else

sudden geyser
#

it basically does

compact pier
#

I mean goroutine

quartz kindle
#

threading always introduces race conditions and other issues

#

which cannot be dealt with automatically