#development

1 messages · Page 1831 of 1

polar quartz
#

Still barely know how to code but I somehow managed to make a discord bot with 40+ commands without copying others code Thonk

lyric mountain
#

the issue is not learning by doing, is learning by leeching

polar quartz
#

Well…I know a lot more now then I did before

lyric mountain
#

and goddamn code leechers are fcking stupid

polar quartz
#

What’s a leecher?

#

Me?

quartz kindle
lyric mountain
#

basically a person that comes here, refuses to elaborate and wants nasa-grade code for yesterday

lyric mountain
quartz kindle
#

if i paste code can you fix it and send it back?

polar quartz
#

Oh alright

#

So not me PogChamp

near stratus
polar quartz
#

Well…nvm

rose warren
#

People who DM BRs because their bot was declined for being a clone and get angry when they don't understand because "they followed the steps in the YouTube video"

quartz kindle
#

xD

polar quartz
#

I had my bot get declined right before summer started a was was pissed bc they declined it bc I made user require manage_message if they wanted to use !embed and I just didn’t know what to do

#

They discord.js v13 guide is so ugly 😭

earnest phoenix
#

be grateful you've been provided w one

#

or just contribute to make it better

polar quartz
#

Umm how do I go to the v12 guide. I meant to press browse v12 but I hit the x

lyric mountain
#

you have quite a fat thumb

polar quartz
#

Nah man I hit the x not realizing what I was doing lmao

#

I was looking at the page thinking about how ugly

#

Nvm

sudden geyser
#

You may be interested in a site like https://exercism.io/ for learning.

lyric mountain
#

exorcising the youtube from you

lethal trout
#
            if (!message.member.permissions.has(command.UserPerms || [])) return message.channel.send(`![wrong](https://cdn.discordapp.com/emojis/777910274011299850.webp?size=128 "wrong") You need ${command.UserPerms}`)
sudden geyser
#

implanting the mentorships in one

lethal trout
#
module.exports = {
    name: '8ball',
    description: '8ball\'s your question',
    usage: 'f!8ball <your question>',
UserPerms: ['ADMINISTRATOR'],
    run: async (client, message, args) => {```
lethal trout
sudden geyser
#

figure out what command is and if it should have UserPerms

lyric mountain
#

the weird casing tells me it doesn't

lethal trout
lyric mountain
#

I meant the UserPerms

#

instead of userperms

#

it's sticking like a sore thumb there

lethal trout
#

bruh

lyric mountain
#

don't forget js is case-sensitive

#

ah nvm, that's a thing you added yourself

#

if (!message.member.permissions.has(command.UserPerms || [])) is invalid

#

you're checking if UserPerms is inside permissions, which it'll never be

#

and ye, what is command?

lethal trout
sudden geyser
primal tundra
#

respone return : { message: '400: Bad Request', code: 0 }

#

why ???

quartz kindle
#

why is your fetch named featch lmao

quiet pawn
#

anyone know of a way to make statcord to work with djs-light

quartz kindle
#

what is statcord

primal tundra
quiet pawn
#

i used to use it

#

till i moved to djs-light

#

they only support official libs

quartz kindle
#

you mean the api?

#

you want to post your stats to them?

quiet pawn
#

yea

#

but they dont support djs-light

#

wait

#

your the maker of djs-light

#

arent u

quartz kindle
#

yes

quiet pawn
#

damn

#

lol

quartz kindle
#

you can use their api directly

#

you dont need the statcord lib

quiet pawn
#

wdym

#

i dont know much when it comes to that

quartz kindle
quiet pawn
#

o yea

#

i did that before

#

tahts what i used to do

#

but when i switched to djs-light

#

it just stopped working

quartz kindle
#

show code

quiet pawn
#

i took it out

#

1 sec ill rewrite what i did have

primal tundra
#

,,,

snow urchin
#

why is vscode telling me it cannot find a module which is 100% added

near stratus
quiet pawn
#

my bots not on git

#

i uploaded it once to git and stopped using git

#

and tha twas after i stopped using statcord

#

because i wanted djs-light

near stratus
quiet pawn
#

just rewrite it

#

lol

#

i barely update my bot anymore so i dont worry about it

#

i have like abit under 200 commands so i kinda just stopped adding things

#

@quartz kindle

const Statcord = require("statcord.js");
const config = require('../config.json'); 
const Discord = require('discord.js-light');
module.exports = async (client, message) => {
 
    const statcord = new Statcord.Client({
        client,
        key: "Statcord.com-<statcordToken>",
        postCpuStatistics: true,
        postMemStatistics: true, 
        postNetworkStatistics: true, 
    });
  
    //--------------------------------------------------------------------
    if (message.author.bot) return;
    if (message.content.indexOf(config.prefix) !== 0) return;
   //--------------------------------------------------------------------
    const args = message.content.slice(config.prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();
    //--------------------------------------------------------------------
    const cmd = client.commands.get(command) || client.commands.find(a => a.aliases && a.aliases.includes(command));
    
    statcord.postCommand(command, message.author.id);

    if(cmd) cmd.execute(client, message, args, command, Discord);

    statcord.post();
};
#

thats in my handler

#

since it tracks command usage aswell

#

well thast was in my handler

#

before i switched

quartz kindle
#

i dont know what the statcord library is doing internally

#

thats why i suggested using the their api directly

quiet pawn
#

just check the userid lol

quartz kindle
#

so you have full control over what you send

quiet pawn
#

js or?

#

send a command as example you want to use

#

and ill add it too the command so you have an idea

quartz kindle
#

do you have a database?

quiet pawn
#

or just use a array in config.json

#

if you have one

#

thats what i do

#

o

#

you wanna do that not manual

quartz kindle
#

then store the user ids in the database

quiet pawn
#

i thought you meant like an aray of ideas that you manually put

snow urchin
quartz kindle
#

then when a command is used, check if the author id is in the ban database

#

and if it is, dont run the command

snow urchin
#

??

snow urchin
summer torrent
#

try installing @types/canvas-constructor

snow urchin
#

its not types

snow urchin
#

it straight up thinks the module is not there

summer torrent
#

try restarting ts server

primal tundra
#

respone return : { message: '400: Bad Request', code: 0 }

#

why ?

primal tundra
snow urchin
quartz kindle
primal tundra
#

yup"

#

I test it in my bot too , the same problem

#

web site dosn't working , and bot too

quartz kindle
#

maybe try without content type?

#

since a delete request doesnt have content at all

#

there is also no json response, it should be an empty 204 response

snow urchin
#

how can I respond to an interaction with a file

quartz kindle
#

you cant

#

attachments are not supported yet

#

you can upload the file somewhere and put the url in the reponse embed

primal tundra
quartz kindle
primal tundra
#

oh okay

primal tundra
valid frigate
#

this is concerning golang, so i'm making a small bot however i see no way to create it without holding everything in a global state, would it still be ok to do this if every struct being used as a global variable used a mutex?

#

i want to try to not use global variables but it seems unavoidable in these kinds of scenarios especially when i need to create a local message cache

nova basin
#

Hello I saw on the bot koya when you send twice in a row a command you have to wait 10 seconds nothing new it's a cooldown but when you send 5 or 4 times in a row the bot send you have to wait 10 seconds to two command but to the other three it didn't send you have to wait 10 seconds I don't know if I explained myself well and if you understood how I can do that?

lyric mountain
#

maybe it's a logic fault instead of intended feature

nova basin
lyric mountain
#

yes

#

ah, the command doesn't execute also?

#

then it's just a simple if (cooldown.has(userId)) return;

#

or if you want to alert just once, use a map instead of an array

nova basin
lyric mountain
#

{"id": userId, "alerted": false}

#

then when it alerts once, just flip "alerted" to true

#

for further alerts, check if "alerted" is true, if it is just return without any alert

earnest phoenix
#

One message removed from a suspended account.

lyric mountain
#

we code

nova basin
#

@lyric mountain

earnest phoenix
#

One message removed from a suspended account.

lyric mountain
earnest phoenix
#

One message removed from a suspended account.

lyric mountain
nova basin
#

As in the picture the bot tells a single command that it must wait 10 seconds to execute it and then the bot does not respond even if you send it again

earnest phoenix
#

One message removed from a suspended account.

lyric mountain
earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

One message removed from a suspended account.

lyric mountain
#

yes

nova basin
#
{"id": userId, "alerted": false}```
#

As it tmumm_peki

lyric mountain
#

you say "do you know any other languages?"

#

"other" implies you mentioned one earlier

earnest phoenix
#

One message removed from a suspended account.

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

nova basin
lyric mountain
#

that's the structure for the map, you need to create one to store the users in cooldown

lyric mountain
earnest phoenix
#

One message removed from a suspended account.

nova basin
earnest phoenix
#

One message removed from a suspended account.

lyric mountain
#

no

#

do you have a cooldown handler already?

lyric mountain
nova basin
lyric mountain
#

well, that's your starting point

#

make one first, then you make a one-time notification

earnest phoenix
#

One message removed from a suspended account.

nova basin
#

Okey thank you

lyric mountain
#

...tbf, you popped out of nowhere so...

#

but anyway

#

I code primarily in java

earnest phoenix
#

One message removed from a suspended account.

quartz kindle
#

you can do that with a counter in your cooldown map

lyric mountain
#

a boolean switch would be easier and faster

quartz kindle
#

example ```js
if(!cooldowns[channelID])) { cooldowns[channelID] = 0; }
if(++cooldowns[channelID] === 3) { send warning }
if(cooldowns[channelID] >= 3) { return; }

boreal iron
#

++cooldowns[] wtf is that syntax

lyric mountain
#
let cd = cooldowns[userId];
if (!cd?.alerted) {
  //send alert message
} else {
  cooldowns.put({userId: theID, alerted: cd == true});
}
quartz kindle
#

incrementing an object property lol

boreal iron
#

Huh never saw that one before okeh

#

(or needed it)

lyric mountain
#

++prop = increment and get

#

prop++ = get and increment

#

1++ == 2 is false

boreal iron
#

Yeah got it lol

lyric mountain
#

++1 == 2 is true

boreal iron
#

Oh lol you’re right

#

Shame on me

lyric mountain
#

wish there was a prop** where it's raised by itself

#

like prop = prop ** prop

quartz kindle
#

haha

crimson vapor
#

**prop

quartz kindle
#

people will confuse it with pointers

crimson vapor
#

wait a minute

quartz kindle
#

you can do prop **= prop tho

crimson vapor
#

can you do something like

#

++1++ + ++1++

quartz kindle
lyric mountain
#

no one likes them

lyric mountain
#

"Ba"++"a"

crimson vapor
#

oh

#

so sad

lyric mountain
#

but if it conforts you, you can code an entire application in js with 4 chars

quartz kindle
#

4 chars?

#

jsfuck is 6 chars, what uses 4 chars?

#

jsfuck++?

lyric mountain
#

jsfuck is 6?

quartz kindle
#

ye

lyric mountain
#

ah, it includes parentheses

#

I wonder, how compressed can a jsfuck code be?

#

since it only uses 6 heavily repeated chars

#

with gzip I mean

quartz kindle
#

yeah but in so many random orders and combinations, good luck

lyric mountain
#

well, true

#

@earnest phoenix up to you

#

just save the user id in a table or collection or whatever

#

up to you

#

it's you who defines what command it'll be

quartz kindle
#

lmao

lyric mountain
#

yes ig

quartz kindle
#

console.log("lol") in jsfuck compressed with deflate:
eJztVFsOwCAIO4t/LB6JcP9rjExmsHPbx9Rlj5iYSEoL2EAsTIElskysl8T8CnrHUMby26cAHDDX6S0eTYyUkwUSkLR7EVWG3TL0WPYZ1BMuWtNxo917TECD0TfsksVRyXOtgb7zgFI6fHIJL0pxI2zTpdFCs85fg5queaLUeKDRx+4GsA1tP/eefQUMv7Heaayk164IXHozMCBoJA==

#

original jsfuck is 2.3k chars

quartz kindle
#

show code

crimson vapor
#

thats actually very interesting tbh

#

compressing "console.log("lol")" is still larger than the original one

#

it does make sense but its interesting

lyric mountain
#

how didn't it work?

#

how are you putting the id? and how are you retrieving it?

quartz kindle
#

you dont need a database for short cooldowns

lyric mountain
#

...how the heck do you "create a new line" on a db?

lyric mountain
quartz kindle
#

oh

lyric mountain
quartz kindle
#

its about banning users from the bot right?

#

show code

#

depends

#

which db are you using?

lyric mountain
#

I have a slightly impression that you don't know how to deal with a db

#

I'm mistaken right?

quartz kindle
#

ok so show db code

lyric mountain
#

...RIGHT?

quartz kindle
#

btw

#

lets write a bot in sql

modest maple
#

holy fuck

lyric mountain
#

what the holy for the fuck?

quartz kindle
#

what is this?

#

thats not code?

#

which database are you using

#

the actual database program/module/library

#

sql is a language

#

many databases use sql

#

that doesnt help

modest maple
quartz kindle
#

how do you use it in your code

#

what do you require

#

lol

lyric mountain
#

sqlite then

#

99% sure it's sqlite

quartz kindle
#

could be sqlite, better-sqlite3, quickdb, etc

lyric mountain
quartz kindle
#

thats not quickdb

#

quickdb doesnt save files as main_scheme_1.sql

#

and it doesnt let you chose the file name either

#

no idea what that is

#

how about you show your code?

#

your code

#

your actual code

#

js files

#

thats not code

#

thats data

#

ye

#

oh lord

#

do you have any command that uses the database?

eternal osprey
#

how would i enter the image content from this message.attachment?

quartz kindle
#

its a Collection

#

so either .get(id) or .first() since it only has 1 value

stark abyss
#
    let imageUrl = ''
    if(args[0] && args[0].toLowerCase() != '-ov'){
      imageUrl = args[0]
    }else if(message.attachments.first()){
      imageUrl = message.attachments.first().url
    }else{
      message.channel.messages.fetch().then((messages) => {
        const lastMessage = messages.sort((a, b) => b.createdTimestamp - a.createdTimestamp).filter((m) => m.attachments.size > 0).first();
        imageUrl = lastMessage.attachments.first().url
        console.log(imageUrl + " | f")
      });
      console.log(imageUrl + " | x")
      if(!imageUrl) return message.channel.send("❎ | Please provide an (uncropped, original) picture, or an url!")
    }

x is undefined and f is actual url i am not really sure how to fix this

quartz kindle
#

because its inside a then

#

a .then() is like a callback

#

things inside it only exist inside it

stark abyss
#

oh so I gotta use await instead thanks

split hazel
#

the peak of the javascript community

grim sundial
limber mica
#

Im having a stroke trying to get kurasuta to post to topgg

#

HOW

#

In js

fresh bluff
#

Hey Guys i need some help with my code

#

my code is

#

static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "Watching the Server";
discordPresence.details = "Be careful";
discordPresence.startTimestamp = 1;
discordPresence.partySize = 1;
discordPresence.joinSecret = "= ";
Discord_UpdatePresence(&discordPresence);
}

#

but i get

#

File "main.py", line 22
UpdatePresence()
^
IndentationError: unexpected indent

wheat mesa
#

Because that’s not python code

fresh bluff
#

ooooooh

#

...

wheat mesa
#

From what it looks like that’s c++

fresh bluff
#

well how do i make it python code?

summer torrent
#

do you know any programming language?

#

or you just want to make rpc

fresh bluff
#

No Besides some java and Python

#

is there any way to make that code into python?

wheat mesa
#

I’m not sure

fresh bluff
#

Nope

#

Its not possible

quartz kindle
#

of course it is lol

fresh bluff
#

nope

quartz kindle
#

you have to write actual python code if you want to run your bot with python

jolly vale
#

just get someone that knows c++ to write the same thing in python

wheat mesa
#

He’s making an RPC I believe

quartz kindle
#

whatever that code is doing you can also do with python or anything else

fresh bluff
wheat mesa
#

Rich Presence

fresh bluff
#

oh

#

LETS GO I FIXED MY CODE

wheat mesa
#

Actually I think RPC and rich presence are different things, my bad

grim sundial
#

er, quick question. im a bit confused

#

and where are the options supposed to be?

#

btw the test object is straight from the discord docs

fresh bluff
#

Ok im dumb

#

I forgot the Dam Hosting code

#

I need someone with Replit To check my code bc its broken

wooden dust
#

you can't turn code into other code

fresh bluff
#

no my Hosting code i made for other bots broken

wooden dust
fresh bluff
#

/home/runner/DiscordBotHosting/index.js:2
import discord
^^^^^^

SyntaxError: Cannot use import statement outside a module

grim sundial
wooden dust
#

wdym by "options"

wooden dust
#

You're using the raw api?

grim sundial
#

yes

wooden dust
grim sundial
#

what

fresh bluff
#

const keepalive = require("./server")
import discord
from discord.ext import commands, tasks
import hostbot
from hostbot import keep_alive

bot = commands.Bot(command_prefix = "!")

@bot.event
async def on_ready():
change_status.start()
print("Your bot is ready.")

@tasks.loop(seconds=10)
async def change_status():
await bot.change_presence(activity=discord.Game(name="In" + str(len(bot.guilds))+ "servers | prefix ! "))

keep_alive()
bot.run
const keepAlive = require("./server");

keepAlive();

client.login(Taken out Token) 4oH_wlav7vo36N7Ywk.x-w_i1gdy7g_HTTza2MINgwsxoc);

#

whats wrong with it?

grim sundial
#

oh my god

#

oh

#

my

wheat mesa
#

Are you...

grim sundial
#

goodness

wheat mesa
#

Using

#

Javascript

#

With

#

Python

wooden dust
#

LMFAO

#

bruv what

fresh bluff
#

idk my friend helped make the code

wheat mesa
#

Just so you know

wooden dust
#

😂

wheat mesa
#

Python and javascript don’t mix

grim sundial
#

er

wooden dust
#

Okay either use python or javascript

wheat mesa
#

You can’t use two languages in one file

wooden dust
fresh bluff
#

I NEED HELP

wooden dust
#

First learn the basics of a language

wheat mesa
#

(There’s probably some black magic to use two languages in one file but still)

fresh bluff
#

I CAN'T CODE

wooden dust
#

Then don't

fresh bluff
#

i want to

wheat mesa
#

Learn to code before making a discord bot

wooden dust
#

Then learn

grim sundial
#

learn

wooden dust
summer torrent
fresh bluff
#

ok see you in 5 hours then

wheat mesa
#

It’ll take more than 5 hours

wooden dust
#

You won't learn something in 5 hours

grim sundial
#

poggy ur kinda takin the piss out of him, theres really no need

wooden dust
#

but ok

summer torrent
#

bye

wooden dust
#

I am putting it as it is

wheat mesa
#

I also recommend that you don’t do bulk learning sessions when attempting to code

grim sundial
#

ok

wheat mesa
#

Just take it one step at a time

wooden dust
#

mm

grim sundial
#

btw waffle u kno whats goin on with my problem?

wooden dust
#

you can probably find those 2 hour tutorials

thorny flume
#

I'm creating an API for my bot and it has a command tab and I use a function to get the command names, but I'm only getting 1 command as it has 50 commands, how can I list these commands?

javascript

wheat mesa
wooden dust
#

hm

wooden dust
#

@grim sundial why don't you try the libraries?

#

Just curious

long crow
# grim sundial goodness

Try change the uppercase of the choices name to lowercase? Nothing in the official doc about it, but iirc all name must be lowercase

wheat mesa
#

More of a challenge

grim sundial
wooden dust
#

Ah

grim sundial
#

as it has to be lowercase

#

so that cant be the problem. the command itself is registering, but the options are the issue

thorny flume
# grim sundial show ur code
const router = require('express').Router()

const handler = require('../../../src/thebrozy-bot/commands/handler') 

router.get('/commands', (req, res) => {
    res.json(
        {
            "command": handler.commandOptions(),
        }
    )
})

module.exports = router
grim sundial
#

req not res

thorny flume
#

?

thorny flume
grim sundial
grim sundial
thorny flume
#

ok...

wooden dust
#

thonk

grim sundial
thorny flume
#

It's been a long time since I've dealt with strings

#

ou no

#

lol

thorny flume
quartz kindle
#

show the code for your handler

grim sundial
#

yo tim u kno whats goin on with my problem btw?

long crow
#

I meant the name here. Though this should return you back error 400, bad request

quartz kindle
wooden dust
#

dpy v2 hasn't even come out

#

Am probably gonna switch to djs since I am learning js anyway

grim sundial
#

thank god, my internet came back

long crow
#

djs v13 doesnt come out either KEKW

grim sundial
grim sundial
long crow
#

Ya i know, but iirc I did a mistake on the name with uppercase one time and it got rejected

wooden dust
#

at least djs has buttons and slash commands

long crow
#

Other than that, I'm not sure the problem is

grim sundial
#

the name is lowercase

long crow
#

The option choices name

grim sundial
#

if im takin 4 years to reply, thats my internet jus randomly cuttin off i have no idea whats goin on

#

same thing, everything is lowercase

fresh bluff
#

Hey Guys I have some news

#

I got A bot Running With Only Python code

solemn latch
#

Gz

#

Now to make it do stuff

fresh bluff
#

I will

limber mica
boreal iron
#

Be careful not calling JS unholy, too

split hazel
#

assuming you're proficient at js what would you do if it completely disappeared overnight

boreal iron
#

Using PHP again as I did for 12 years (and still)

#

Even if it’s not client-sided

fresh bluff
wheat mesa
#

python 🤢

cedar quarry
#

Hi I just want to ask that can I store giveaway data in quick.db in discord.js?

lyric mountain
#

Yes

cedar quarry
lyric mountain
#

I never used quickdb (although I do know the war crimes it commit), so you'll need to figure out that yourself

#

But since it's a db, anything is storable

cedar quarry
#

Oh lol

fresh bluff
#

I did it right

lyric mountain
#

Yes I guess

fresh bluff
#

i watched a YT video to help me

umbral oriole
#

if member vote to my bot i want bot thanks hem , command handler javascript

wheat mesa
fresh bluff
stark pendant
#

Hi

Can someone help me setup autoroles?

I tried but cannot

wooden dust
#

@stark pendant what lang

#

And you should probably send the code you tried

stark pendant
#

ok nothing already

#

just want to ask

lyric mountain
#

You said you tried but couldn't

stark pendant
#

do i need to give dsl bot admin

lyric mountain
#

No

stark pendant
#

Is it like this?

solemn latch
gilded plankBOT
#

@stark pendant

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(

stark pendant
#

0-0

wooden dust
lean lake
#

How do I render a HTML element from CSS?

#

Does anyone know about this?

earnest phoenix
lean lake
#

Can I put scripts in Long Description?

earnest phoenix
#

now that i think about it, why do you need to render an element with css?

earnest phoenix
lean lake
#

JS

earnest phoenix
#

bruh

lean lake
#

huh?

#

What can be done?

#

No idea.

earnest phoenix
#

just add them as an actual owner in the bot page

lean lake
earnest phoenix
#

f

lean lake
#

@earnest phoenix any idea?

wooden dust
#

@lean lake you should see them in the team

#

like everyone in the team should be shows an owners

#

If you wanna use html I think you have to have all the tags

#
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>```
cinder stratus
#
class Conf {
  constructor(client, guildID) {
    this.client = client;
    this.guildID = guildID;
    this.settings = (async () => await this.client.settings.guilds.get(this.guildID))();
  }
}
``` Hey, I'm trying to resolve the promise of my `this.settings` value, but it returns `Promise<Object>` but I want to resolve the promise. I'm confused
pale vessel
#

You can't do that in the constructor method

cinder stratus
#

any other way to do that in the class

#

beause I also tried methods it also returned Promise<Object>

pale vessel
#

Create another method that's async and do it in there and return back the instance/this

#

Like await new Class(opts).init()

cinder stratus
#
class Conf {
  constructor(client, guildID) {
    this.client = client;
    this.guildID = guildID;
  }
   
  async settings() {
    const settings = await this.client.settings.guilds.get(this.guildID);
    return settings;
  }
}
``` Do you think this will return my data with promise getting resolved?
pale vessel
#

How are you using it

#

And what's client.settings.guilds

crimson vapor
#

FuelClient.settings

pale vessel
#

so true

cinder patio
#

you need to await the promise returnes by settings

mild agate
#

How to do this?

#

<t:1628057936>

#

got it

cinder patio
#

🤔

#

Lmao I misspelled readme but it's still erroring

earnest phoenix
#

typescript is just being dumb

#

try restarting vsc

pale vessel
#

It's TypeScript blobweary

#

TypeScriptExtractor

cinder patio
#

no 😛

pale vessel
#

Yes

#

I can guarantee it won't error anymore if you change the name to that 😏

cinder patio
#

😮 omg it worked

#

thanks!!!!!

pale vessel
#

Glad to be of help

wooden dust
pure lily
#

Why does my cooldown apply to all the same shards? Like when I send a message to a guild connected to Shard 0 and then send another command in another server with the same shard the cooldown applies.

rose warren
#

You might be cooling down the user globally and not per-guild? Are you associating the guild id with the user id in the cooldown?

#

For my cooldown I just joined the user id and guild id together as a long string and checked for that in the cooldown. That way the cooldown is per-user per-guild and not global across guilds.

mossy wagon
#

Hi

#

How can i use .toString() or .toDateString()
To local time zone which user area in (auto detect)?
Is that possible?

(Javascript)

rose warren
#

You can't auto-detect timezone in a Discord bot if that's what you're trying to do? I assume it's for a bot.

marsh bluff
#

If you have a website, I assume you can calculate the timezone from the IP and then convert the time from local timezone to user's timezone

#

like this

rose warren
#

Nah in web dev it's easier to use getTimezoneOffset(). That gets the time from the browser not the IP.

tulip ledge
cinder patio
#

remote: hooks/pre-receive: 26: .: Can't open /data/gitrpcd/.app-config/.sh 🤔 it's not letting me push to github

tulip ledge
mossy wagon
rose warren
#

Read the docs of the library you're using

mossy wagon
#

Alright

rose warren
#

Ah no wait. My bad. That's not an embed timestamp

mossy wagon
#

Okay

rose warren
#

In a Discord bot you can't auto-detect timezones

#

That bot probably asks for the user's timezone during setup

#

You have to rely on user input

mossy wagon
#

Oh, but the bot doesn't ask me timezone during setup

green kestrel
rose warren
#

Yeah that's the only way. You can try and guess.

#

But if your user is in Europe and has their server region set to US East then there would be a big difference for example.

green kestrel
#

yeah

mossy wagon
#

Alright. I will try!
Thanks.

grim sundial
#

another reason why thats ur timezone, could be because where that bot is being hosted is also in the same timezone lul

mossy wagon
#

Oh "brain" is the developer TriviaBot?

#

Nice

green kestrel
#

tis me

#

it'sa me, brainio!

mossy wagon
#

Nice bot bro!

green kestrel
#

thanks 🙂

mossy wagon
#

How long you made them? 🤣

green kestrel
#

bots?

#

i was making bots long before discord was a thing

mossy wagon
green kestrel
#

yeah

#

my first bot was a general purpose irc bot in 1999

#

🙂

mossy wagon
#

Woah 1999 🤣

pale vessel
#

Last modified 2006 😢

green kestrel
#

yeah its a dead project

mossy wagon
#

but, already adsense approved!

eternal osprey
#

hey guys

#

how would i remove all black color instances from an image using jimp?

#

I tried reading the docs but found nothing about color manipulation and deletion.

pale vessel
#

Nope

woeful pike
#

you would usually use some kind of build tool for this that includes the typescript compiler somewhere in the pipeline

#

maybe something like esbuild with a minify flag

#

ya that doesn't work with all options tho since it breaks the concept of modules

waxen bough
#

why do you need to minify

#

i tried doing the same

#

i installed a package i don't remember the name

#

i added to "scripts" in package.json

eternal osprey
#

does anyone know how to remove all the black color in an image and make it transparent using jimp?

lament rock
#

loop through all of the pixels in the bitmap and set the alpha based on if the color is black. You'd have to provide logic for fuzzy replace

#

Each Jimp instance should have a bitmap property iirc

pale vessel
#

If the original image is transparent then use the PNG mimetype

grim sundial
#

does anyone know why the options are not showing?

#

idk if im just misunderstanding slash commands or what. the test object is straight from the discord docs btw so thats why im even more confused

eternal osprey
lament rock
#

theoretically not necessary if you know that rgb values of black is 0,0,0

#

so, you could fuzzy replace anything within like 5 of each rgb

#

if (r <= 5 && g <= 5 && b <= 5)

grim sundial
#

btw any ideas on my issue?

lament rock
#

You'd probably also have to write logic for anti-aliasing

nocturne grove
#

can anyone provide discord.js code for this: "Edit Original Interaction Response"?

#

docs say PATCH /webhooks/{application.id}/{interaction.token}/messages/@original, but how to do that in discord.js

grim sundial
#

maybe discord.js has not yet implemented that. im not sure, but i think u can use the dev branch of discord.js which has prob has it

nocturne grove
#

and what is the dev branch?

pale vessel
#

client.api.webhooks[application.id][interaction.token].messages["@original"].patch({ data: {} })

grim sundial
#

nevermind 🤷

nocturne grove
#

and why are many things I log a buffer or a [Function: noop]. That makes it very hard to understand these stuff

eternal osprey
grim sundial
#

btw flazepe any ideas on my issue btw?

pale vessel
#

Haven't worked on slash commands, nope

eternal osprey
#

however, how would i remove that filthy transparent grey look? I have an image composited under the original image. Why is that not showing in full contrast?:

  let chosenFile = files[Math.floor(Math.random() * files.length)]
                  const baitimage =  await Jimp.read(`./baitimages/${chosenFile}`);
                  console.log(baitimage)
                  const finallink = baitimage.resize(420, 420).opacity(1)
             const image3 = await Jimp.read('./pictures/output2.png');
             const finaloutput = finallink.composite(image3, 0 , 0).opacity(1).write('./pictures/sender.png');```
grim sundial
#

alr

nocturne grove
grim sundial
#

er, na

long crow
#

Going ask on the developer server itself might be better for you

#

since I saw the structure you sent earlier is all good, so it should pass through

#

I'm using 3rd party library, so I'm not sure what is really wrong

grim sundial
#

i think dapi is more suitable

#

but i'll try that sure

eternal osprey
#

i mean it's already there, but how would i make it stand out more

errant flax
grim sundial
#

u sure? at the start of the loop, console.log link

errant flax
#

yep im sure

grim sundial
#

what does it log?

errant flax
#

it logs the code
discord.gg/[code]
trying to do with
discord.com/invite/[code] but doesn't work

grim sundial
#

it logs the invite code?

errant flax
wooden dust
#

what database are you using @earnest phoenix

#

and what language

errant flax
#

idk why js is ignoring the second item in the array

grim sundial
#
for (const link of inviteLinks) {
  console.log(link)
``` logs the code ?
quartz kindle
#

you're still going on about that? lmao

#

did you find a command that uses the database?

#

then we cant help

#

we have no idea how your bot is built

long crow
#

Hi Tim

wooden dust
#

Hi Tim

quartz kindle
#

so anything we tell you to do will likely not work

#

because it wont fit with your bot's current code

wooden dust
quartz kindle
#

how many js files do you have?

wooden dust
#

Like initializing it?

errant flax
# grim sundial ```js for (const link of inviteLinks) { console.log(link) ``` logs the code ?
for (const link of inviteLinks) {
      console.log(link)
      if (!msg.content.toLowerCase().includes(link)) return
      
      const code = msg.content.split(link)[1].split(/ +/)[0]
      console.log(code)
      const guildInvite = msg.guild.invites.cache.has(code)
      if (!guildInvite) {
        try {
          const vanity = await msg.guild.fetchVanityData()
          if (code!==vanity?.code) {
            msg.delete()
            msg.channel.send(`<@${msg.author.id}>, Please do not try to advertise here!`).then(m=>{
              setTimeout(()=>{
                m.delete()
              },1000*5)
            })
          }
        } catch(e) {
          msg.delete()
          msg.channel.send(`<@${msg.author.id}>, Please do not try to advertise here!`).then(m=>{
            setTimeout(()=>{
                m.delete()
            },1000*5)
          })
        }
      }
    }

Ignore the first log

wooden dust
errant flax
#

just use fs then get the length

quartz kindle
#

and you have no idea which of those files have commands that use the database?

quartz kindle
#

lol

#

do you have commands that store settings for example?

#

level up commands?

wooden dust
#

The fuck

quartz kindle
#

show them

wooden dust
#

51 files

#

god damn 😂

wooden dust
#

no

quartz kindle
#

thats all?

#

i see

#

so you dont have any actual code anywhere

#

your entire bot is made with dbd

#

i mean dbd.js

earnest phoenix
#

there is a tim in development

#

hello

quartz kindle
#

well thats a problem

#

nobody here uses dbd

errant flax
quartz kindle
#

and if you use dbd, you cant really use anything else, you have to do it the dbd way

earnest phoenix
#

what is dbd

quartz kindle
#

you have to ask in the dbd server

errant flax
#

im guessing dbd is a db dog_kek

quartz kindle
#

no

#

its a bot designer thingy

wooden dust
#

what's dbd

errant flax
#

oh

#

ohhh

quartz kindle
#

dbd.js

errant flax
#

discord bot designer?

quartz kindle
#

no idea

#

literally go to their website

errant flax
#

that wasnt the server dog_kek

quartz kindle
quartz kindle
#

and click join discord

#

lol

earnest phoenix
wooden dust
#

Yeah

quartz kindle
#

return exits the entire function

errant flax
#

oh

#

guess ill wrap it in brackets then

earnest phoenix
#

why

quartz kindle
#

if you want to exit the current loop only use continue

errant flax
#
if () continue

?

quartz kindle
#

yes

latent heron
#

hey tim

#

tim

#

do you like python code

earnest phoenix
#

no

#

one does

latent heron
#

i have python code

#

please rate it

earnest phoenix
#

ugly

latent heron
#

is your name tim

earnest phoenix
#

it is now

quartz kindle
#

kinda

latent heron
#

TIM HOW COULD YOU

quartz kindle
#

its a short

latent heron
#

😭

quartz kindle
#

lmao

latent heron
#

that's it

#

we're no longer bffs

quartz kindle
#

xD

earnest phoenix
#

you and tim were bffs?

#

since when?

latent heron
#

i made the executive decision

#

3 seconds ago

earnest phoenix
#

lol

latent heron
#

and now we no longer are

quartz kindle
#

rip

#

i never actually used py in my life lmao

errant flax
#

just learn a language or somth

proven musk
#

Hello there i'm looking for signup bot for events

errant flax
#

much more faster iara_sunglasses_cool

#

wait nvm misosface

earnest phoenix
#

dbd.js is a deprecated library

#

lmfao

errant flax
#

idk what im talking about dog_kek

earnest phoenix
#

No wonder they dont talk

errant flax
#

fuck

#

what does dbd stands for?

#

also just use discord.js

earnest phoenix
#

Well the npm page says its deprecated

errant flax
#

discord.js is up to date (with master atleast)

earnest phoenix
#

and suggests to use aoi.js

errant flax
#

whats that

earnest phoenix
#

Same thing as dbdjs ig

errant flax
#

just save a backup?

earnest phoenix
#

not my problem

errant flax
#

save a backup to reference to for transferring with djs

earnest phoenix
#

well ig you will have to wait until someone who knows how to use dbd.js comes along

errant flax
#

and for chat about development

quartz kindle
#

they use discord.js anyway lol

earnest phoenix
#

They use d.js for dbdjs?

quartz kindle
#

yes

#

and for aoi.js

#

aoi.js looks like its the exact same thing as dbd.js

#

just dbd wasnt updated in 2 years

earnest phoenix
#

aoi.js is the exact same

errant flax
earnest phoenix
#

even the website is pretty much the same

quartz kindle
#

at least aoi is more recent

earnest phoenix
#

lmfao

quartz kindle
#

it uses discord.js v12

earnest phoenix
#

imagine not using v13

#

This could of been avoided

errant flax
earnest phoenix
#

had you just use discord.js

quartz kindle
#

good idea

earnest phoenix
quartz kindle
#

first step, stop using dbd/aoi

errant flax
#

well what i mean is its not stable

#

and still in development

#

but djs v13 cul tho

earnest phoenix
#

I'd say its pretty much out of development by now tbh

#

There isn't much more they can really do

#

They've already fucked it

quartz kindle
errant flax
#

context menus?

quartz kindle
#

they can always fuck it more

#

:^)

earnest phoenix
#

True

earnest phoenix
quartz kindle
#

tere are still many pending PRs

earnest phoenix
#

that introduce useless shit

errant flax
#

context

quartz kindle
#

im pretty sure some of those will be merged before its released

errant flax
#

not select

quartz kindle
#

whichever you want

earnest phoenix
#

Tim uses json

quartz kindle
#

but like, before chosing a database, chose a discord library

quartz kindle
#

not anymore

earnest phoenix
#

lol

errant flax
#

wonder how context menus works

quartz kindle
#

i use better-sqlite3

earnest phoenix
#

ew

#

I hate sqlite

errant flax
#

i use mongo

earnest phoenix
#

bad

#

mongo sucks

errant flax
#

no u bad

earnest phoenix
#

Postgres is fresh

quartz kindle
#

postgre is bloat :^)

errant flax
#

atleast mongo works

earnest phoenix
#

ur bloat

#

Wdym

quartz kindle
#

mongo is uber bloat :^)

earnest phoenix
#

Postgres works

#

You just gotta not be a dummy

#

and typically people who use mongodb

errant flax
#

a

earnest phoenix
#

are hella new

errant flax
#

fax

#

lel

earnest phoenix
#

or just lameos

#

who can't realize the potential of postgres

errant flax
#

atleast we have a db bonk

earnest phoenix
#

I also have a DB

#

one I dont have to worry about once its up

quartz kindle
#

postgres is good, its just way overkill for a discord bot

quartz kindle
#

unless your bot is so big you need multiple machines

earnest phoenix
#

How big is your bot

errant flax
#

whats postgres anyways

earnest phoenix
#

Its a database dummy

#

Its a variant to the SQL language

errant flax
#

yes ik that but makes it "fresh"

earnest phoenix
#

Omega scalable

errant flax
#

what makes it "fresh"*

earnest phoenix
#

hence it being widely common on bigger projects

quartz kindle
#

no point using a server-based database system for only one app. either use it for multiple apps, or for one giant app

earnest phoenix
#

Yep

#

I just dont care

quartz kindle
#

lel

earnest phoenix
#

I love overkilling everything

#

Never know when you might need it

quartz kindle
#

i prefer sqlite, smaller, simpler, faster

earnest phoenix
#

I'd use sqlite if I didn't have to make my own array system

errant flax
#

i use mongo cuz ik how to use it

earnest phoenix
#

or store things as json

#

sqlite can't support array types

#

and I use array types a lot

#

so its easier to just use postgres

earnest phoenix
errant flax
#

just use objects isnt array just objects

{
0: "lel"
}[0]

dog_kek

earnest phoenix
#

no

#

array are not objects

errant flax
#

i was joking lel

earnest phoenix
#

bad joke

errant flax
#

no u bad

earnest phoenix
#

Rake is typing an essay

#

oh no

earnest phoenix
errant flax
#

whats dbd stands for?

lyric mountain
#

dead by daylight

earnest phoenix
#

Im sticking with just using discord.js

quartz kindle
#

discord bot designer

earnest phoenix
#

Yep

#

Tim use a CV database

#

they are extremely small

#

and fast

quartz kindle
#

a cv? like a csv file?

#

comma delimited?

earnest phoenix
#

yep

quartz kindle
#

lel

errant flax
#

is it good interacting with the api with urself or use a lib bonk

quartz kindle
#

i have a lib that stores data in a delimited string

earnest phoenix
#

I had to convert a csv datbase to sqlite

#

it was pain

quartz kindle
#

but its only in memory, not for storage

lyric mountain
quartz kindle
#

could easily read/write from a file tho

lyric mountain
#

using COPY command

earnest phoenix
quartz kindle
#

no

#

you can append

earnest phoenix
#

Ah right

#

append

#

But truthfully it was easier just converting to sqlite

#

then using sequelize

nocturne grove
#

maybe a weird question, but imagine I have this:

// foo is an object
foo.function = Function1;

foo.function(input);

function Function1(data) {
  // is there a way to access "foo" in this function?
}```
See the question inside the function
lyric mountain
#

yes

earnest phoenix
lyric mountain
#

pass foo as a param

nocturne grove
lyric mountain
#

or if foo is a property of the same class, you can access foo with this.foo

nocturne grove
#

when I logged this, it didn't show me foo tho

quartz kindle
lyric mountain
#

declare foo as this.foo = something

nocturne grove
#

I don't really understand it (or it doesn't work for me)

earnest phoenix
quartz kindle
lyric mountain
#

or whatever

nocturne grove
quartz kindle
#

then it should work

#

unless youre doing something weird

#

in which case, you can always explicitly bind the function to the object

nocturne grove
#

okay I will post the real piece of code, maybe I will understand better then

quartz kindle
#

obj.fn = fn.bind(obj)

nocturne grove
lyric mountain
#

where you first declared foo

quartz kindle
#

thats for classes, are you working with classes?

nocturne grove
#

oh no I'm not using that

lyric mountain
#

ye, has to be classes for that

nocturne grove
#

do you think it's useful for me to learn classes?

#
interaction.editFirstResponse = editFirstResponse();

function editFirstResponse(data) {
  console.log(this.interaction)
  client.api.webhooks[interaction.application_id][interaction.token].messages["@original"].patch({ data: {
      data
  }});
}```
stuff like this is what I wanted to do btw
quartz kindle
#

useful yes, for your specific issue i dont know

cinder patio
#

classes are good to know

quartz kindle
#

you're calling the function, not assigning it

nocturne grove
#

okay thanks, will look into that

#

oh that's dumb 😂

quartz kindle
#

and this is already interaction

#

not this.interaction

nocturne grove
#

oh that was just to try

quartz kindle
#
function a() {
  console.log(this.token);
}

interaction.edit = a;
interaction.token = "f";
interaction.edit(); // f
#

or just ```js
interaction.edit = function() { console.log(this.token) }

#

you dont need to declare the function separately

nocturne grove
#

oh awesome it works! Thank you guys/girls

quartz kindle
#

unless you also want to use it independently

#

or attach it to other objects

nocturne grove
#

did you already convert your bot to slash commands?

quartz kindle
#

no

#

i cant do it yet, i need attachments

#

slash commands dont support attachments yet

nocturne grove
#

ohh

#

will they come soon?

#

the support I mean

quartz kindle
#

hopefully

nocturne grove
#

yeah I hope for you too

quartz kindle
#

im not worried

#

there is enough time

nocturne grove
#

oh yes that's for sure

long crow
quartz kindle
#

attachment with files, not url

nocturne grove
#

for anyone wondering, there was another little error in my code. It was inside the .patch() This is working:

interaction.editFirstResponse = function(data) {
    client.api.webhooks[this.application_id][this.token].messages["@original"].patch({ data });
}

interaction.editFirstResponse('Edited');```
#

thanks to the devs here tho, without their help I failed making this function ^

wooden dust
#

For anyone using djs rather than dpy mind explaining why, like if there is a particular reason and if you've tried both.

#

Other than djs covering more of the API

sudden geyser
#

I used it because I wanted to get a taste of Python.

#

There was no particular reason in features. Though, it's built-in command handler is nice as opposed to building your own or seeking out another library

split hazel
#

i used it because i just wanted to make a bot with python

#

with some ml libraries

solemn latch
#

js libraries do have built in command handlers too, just not discordjs

split hazel
#

built in command handlers cringe

#

*cries in trash command handler*