#development

1 messages · Page 73 of 1

dim vault
#

or get the channel members.size only in order to delete the channel

quartz kindle
#

because if channelId is null/undefined, its still not equal to channel.id

#

so it still proceeds anyway

#

so you need something like if(state.channelId && state.channelId !== channel.id)

wide herald
#

scratches head

I've just read the upcoming changes, last post in #discord-news , and my bot does use the guild members intend. It's also written in python.
at the moment the line according to the guild members intend looks something like this:

intents = discord.Intents.default() | discord.Intents.members

Does someone know how to adjust this part, so it keeps working at December 16th and into the future?

quartz kindle
#

what news are you talking about?

earnest phoenix
#

Also there's nothing to change there, it's correct

quartz kindle
#

what time period are you from?

#

and who changed my name to development < football ??????

rose warren
#

👀

earnest phoenix
#

delevopment

quartz kindle
wide herald
quartz kindle
#

mod abuse

rose warren
earnest phoenix
#

Amazing

rose warren
wide herald
quartz kindle
dim vault
#

he meant 16th of december

earnest phoenix
boreal iron
#

I know that profile picture but not the name

#

Something is cursed

dim vault
wide herald
quartz kindle
#

that has nothing to do with intents

earnest phoenix
#

@quartz kindle you have been cursed

#

Oh no how will Tim go on with this

quartz kindle
#

lmao

wide herald
quartz kindle
#

the changes talk specifically about the permission system used in slash commands

wide herald
#

alright, thats something I use.

quartz kindle
#

when you receive a slash command or interaction, it contains a set of permissions to help you determine if the person is allowed to use the command or not, without having to check the user's roles and permissions manually

#

i believe you can also specify some required permissions when you create the command

opaque seal
#

Anyone here ever worked with google oauth?

quartz kindle
#

so it only appears for people who have the required permissions

boreal iron
#

default_member_permissions is the field name

#

Unfortunately the member requires to have exactly this permission(s)

wide herald
# quartz kindle so it only appears for people who have the required permissions

at the moment my slash commands don't check for permissions in the code. instead people get told in the bot's video, that they should only allow slash commands for this bot to people/roles they trust (cause it can kick) and are also shown how to control this within Discord.

is there a need for me to implement changes to this design?

quartz kindle
#

i believe you dont need to change anything

wide herald
#

And thank you so much for simplifying the post for me!!

boreal iron
#

You can also send a default permission requirement for the commands but only once you register them

#

You can not update them later

#

It all doesn't really make much sense to me tbh

#

But it is how it is

wide herald
#

btw, do I need to do anything to get the bot developer role?
mine got approved by top.gg just a day ago or so.

solemn latch
#

Our bot that gives the role keeps going down 😔

earnest phoenix
wide herald
#

Thanks for assigning me the role

boreal iron
#

Imagine declining bots on your completely bugged non working site for having issues or don't respond properly while your own bot doesn't do what it is supposed to

#

The irony is real

quartz kindle
solemn latch
#

we do that yeah

#

thankfully its our private bot that doesnt work

quartz kindle
#

thats called hypocrisy

#

:^)

boreal iron
#

Caught in 1080p

earnest phoenix
quartz kindle
#

OwO?

boreal iron
#

Uhm Tim cat girl tf

#

Is this Tim?

quartz kindle
#

lmao

earnest phoenix
quartz kindle
#

btw voltrex

boreal iron
quartz kindle
#

why does node get slow when it goes idle

#

too much paging/swapping?

earnest phoenix
#

Does it? I've never seen it become slow in idle mode

quartz kindle
#

i see it all the time

#

http responses are always much slower after idling for a while

#

like first request takes 1-2+ seconds

#

second request takes < 100ms

#

unless its nginx's fault?

#

x doubt

earnest phoenix
#

No idea, I haven't seen anybody else report that kind of issue either

#

It's probably something on your end but it's hard to know

quartz kindle
#

its always been like this

#

i always assumed it was part of node's design

#

to conserve resources

earnest phoenix
#

Well Node.js does hibernate and do some resource-saving tactics when it becomes idle but I wouldn't expect it to become that slow, never seen it myself either

#

V8 itself also does it's own part of tactics when it's idle

quartz kindle
#

yeah its not always as severe

#

but sometimes it makes my bot miss a discord webhook

#

and fail a command

earnest phoenix
#

Weird

quartz kindle
earnest phoenix
#

What Node.js version do you use btw?

quartz kindle
#

testing v19 rn

#

was v18 before

earnest phoenix
#

Did that also occur on v18?

quartz kindle
#

yup

#

i remember this occurring since forever

#

since v8 v10 v12

#

i see it happen in my benchmarks too

#

sometimes i leave the node repl on idle for a while

#

then run a benchmark on it, and the first one is always slower than the second one

earnest phoenix
# quartz kindle

I assume this is something related to the Discord API or the client not being able to send the request properly, I've seen this exact issue reported by multiple people in various different programming languages across different Discord API libraries

quartz kindle
#

yeah could also be

earnest phoenix
#

But moving Discord-related stuff aside, the performance part in idle mode in general is something interesting

#

Even though I've never seen it happen myself, could be that the idle tactics of Node.js and V8 are getting in each other's way and causing some sort of regression

#

People be using semver or other nice versioning schemes, like normal

Meanwhile "Speech Services by Google":

quartz kindle
#

xDD

lament rock
quartz kindle
#

rip

lament rock
#

or maybe my code just sucks

earnest phoenix
#

delevopment KusaWondering

#

shouldn’t it be development LMAO

#

the channel name

dry imp
#

nah delevopment is the correct one

crystal wigeon
#

lmao

dry imp
#

yall gotta learn english better

opaque acorn
spark pilot
hidden gorge
#
client.on("messageCreate", message => {
    if(message.author.bot) return;
    if(message.content.startsWith("unusual")) {
       message.channel.send("Hello!")
     }
     if(message.content.startsWith("Hi")) {
       message.reply(`Hello ${message.author} How are you?`)
     }
     if(message.content.startsWith("Im good")) {
       message.channel.send(`That's nice ${message.author} Im good too!`)
     }
   })
``` is not working and is supposed to send back a message but logs nothing and doesnt work at all
#

Also all intents are on and defined

young rune
#

bro yall made a typo or soemthing in the channel name?

hidden gorge
#

no

#

there is no log

sage bobcat
#

One message removed from a suspended account.

hidden gorge
#

i did

#
const Discord = require("discord.js");
const { Client, message } = require("discord.js");
const client = new Discord.Client({
    intents: 32767,
});
const config = require("./config.json");
const logs = 888162129520230464

client.on("ready", async () => {
    console.log(`Logged in as ${client.user.username}`)
    console.log(`Guilds: ${client.guilds.cache.size}`)
    console.log(`Users: ${client.users.cache.size}`)

    client.user.setPresence({
        activity: {
            name: `Unusual V1`,
            type: `WATCHING`
        },
        status: `idle`
    }),
    console.log("status set")
});

client.on("messageCreate", message => {
    if(message.author.bot) return;
    if(message.content.startsWith("unusual")) {
       message.channel.send("Hello!")
       console.log("test")
     }
     if(message.content.startsWith("Hi")) {
       message.reply(`Hello ${message.author} How are you?`)
     }
     if(message.content.startsWith("Im good")) {
       message.channel.send(`That's nice ${message.author} Im good too!`)
     }
   })

client.login(config.token)```
#

@sage bobcat

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hidden gorge
#

igor sent me the code

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hidden gorge
#

its also supposed to log the word test but it doesnt

wheat mesa
#

have you actually sent a message saying "unusual"

#

and exactly that

hidden gorge
#

yes

wheat mesa
#

actually do you have message content intent enabled? log the message before you do anything with it to see if it actually has a content prop

hidden gorge
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

wheat mesa
#

it's not

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

wheat mesa
#

startsWith just checks if the first letters in the message are the argument given to it

wheat mesa
hidden gorge
#

OHH

wheat mesa
sage bobcat
hidden gorge
#

i just typed h and it logged

wheat mesa
#

can you show your current code

hidden gorge
#

OH SHIT OH SHIT

#

ITS SPAMMING

wheat mesa
hidden gorge
#
const Discord = require("discord.js");
const { Client, message } = require("discord.js");
const client = new Discord.Client({
    intents: 32767,
});
const config = require("./config.json");
const logs = require("./config.json")


client.on("ready", async () => {
    console.log(`Logged in as ${client.user.username}`)
    console.log(`Guilds: ${client.guilds.cache.size}`)
    console.log(`Users: ${client.users.cache.size}`)
   

    client.user.setPresence({
        activity: {
            name: `Unusual V1`,
            type: `WATCHING`
        },
        status: `idle`
    }),
    console.log("status set")
});

client.on("messageCreate", message => {
    console.log("test")
    if(message.author.bot) return;
    if(message.content.startsWith("unusual")) {
       message.channel.send("Hello!")
       
     }
     if(message.content.startsWith("Hi")) {
       message.reply(`Hello ${message.author} How are you?`)
     }
     if(message.content.startsWith("Im good")) {
       message.channel.send(`That's nice ${message.author} Im good too!`)
     }
   })

client.login(config.token)```
#

thats it

#

@wheat mesa

wheat mesa
#

and what are you typing

hidden gorge
#

h

wheat mesa
#

ok well it's going to log test every time you type a message

hidden gorge
#

but when i remove the log nothing happens

wheat mesa
#

I told you to log the message, not test

hidden gorge
#

wdym

#

swap it out?

wheat mesa
#

console.log(message)

hidden gorge
#

<ref *1> Message { channelId: '888162129520230464', guildId: '888162129520230460', id: '1047725377189052527', createdTimestamp: 1669867595718, type: 0, system: false, content: '', author: User { id: '919674489581731842', bot: false, system: false, flags: UserFlagsBitField { bitfield: 4194432 }, username: 'TW rblx', discriminator: '0001', avatar: 'a_1c20c245c538d57634f25ba87b8a6654', banner: undefined, accentColor: undefined }, pinned: false, tts: false, nonce: '1047725374353440768', embeds: [], components: [], attachments: Collection(0) [Map] {}, stickers: Collection(0) [Map] {}, position: null, editedTimestamp: null, reactions: ReactionManager { message: [Circular *1] }, mentions: MessageMentions { everyone: false, users: Collection(0) [Map] {}, roles: Collection(0) [Map] {}, _members: null, _channels: null, _parsedUsers: null, crosspostedChannels: Collection(0) [Map] {}, repliedUser: null }, webhookId: null, groupActivityApplication: null, applicationId: null, activity: null, flags: MessageFlagsBitField { bitfield: 0 }, reference: null, interaction: null }

#

that uh happend

wheat mesa
#

you'll see that content is an empty string

#

go enable message content intent and then retry

hidden gorge
wheat mesa
#

looks like you didn't

hidden gorge
#

sorry forgot my music was on

#

@wheat mesa seee

wheat mesa
#

And did you reflect that change in your code with your intents flag?

hidden gorge
#

i think soo

wheat mesa
#

Use the enums, not a number please

hidden gorge
#

i don’t remember anything rn

wheat mesa
#

It is unreadable in that form because it's not meant to be understood in the context of a base 10 digit

hidden gorge
wheat mesa
hidden gorge
#

i wannnna kill my bot

lament rock
#

Do it

#

pull the plug

#

stop coding

#

save yourself the pain

#

There are heights in ux and performance you cannot attain

jovial prawn
#

gm

winter pasture
earnest phoenix
winter pasture
#

Gm to you too!

fluid marsh
#

hi

tranquil anvil
#

..

pale reef
#

can help me everyone with this error ???

lyric mountain
#

in this case, channel.messages

pale reef
#

ty

neon leaf
#

does anyone know why vscode screams me this?
Cannot find module '../config.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.ts(2732)
import config from "../config.json"
I already added "resolveJsonModule": true to my compilerconfig and when I compile and run everything works fine

lyric mountain
#

aren't u supposed to use require(jsonfile) for json files?

neon leaf
#

im in typescript

#

I could require but whats the point

lyric mountain
#

...require is supposed to be used for non-code files

neon leaf
#

'require' call may be converted to an import.

lyric mountain
#

did that appear as a warning?

neon leaf
#

no, neither does import

lyric mountain
#

then where did u see it?

neon leaf
#

mouse-over

lyric mountain
#

then it did appear as a warning

#

when I mean "warning" I mean the yellow highlighting

#

not runtime errors

#

but well, if the former works then use it, tho I'm skeptical whether it's the correct way of importing json files

quartz kindle
#

it should work

#

resolveJsonModule:true is made exactly for importing json files using the import syntax

#

try reloading the vsc window

#

sometimes that fixes intellisense bugs

neon leaf
#

yup, works

daring tapir
#

Hi

lyric mountain
#

wrong place to ask

winter pasture
#

@daring tapir hey! That’s great your looking for people. But please don’t advertise that here ☺️

Feel free to reach out to Xiuh or Mac if you want to have it posted in #434058442764714002

neon leaf
#

is it worth rewriting my bot with typescript?

#

I rewrote my api and it wasnt that big of a change

lyric mountain
#

well, you're not going to find any meaningful performance change if that's what ur expecting

#

ts is still js, but typed

#

it'll be either as fast or slower than js

#

but it'll for sure be easier to debug and prevent a lot of bad habits when coding

radiant kraken
#

ts takes more time to run since they need to be transpiled to js first

vestal quartz
#

Does my bot have to be in Slash Commands to be accepted on your site?

lyric mountain
#

no

#

they only require for the commands to actually work (and not break the rules)

neon leaf
vestal quartz
lyric mountain
#

perhaps, intellisense will be better than js since the editor knows what kind of value it's dealing with

vestal quartz
lyric mountain
#

won't be the same experience as a strictly-typed language tho

lyric mountain
#

did you test your commands to make sure they work without any perms?

lyric mountain
#

including admin?

#

because admin bypasses any other permission

vestal quartz
lyric mountain
#

what permissions does it have?

vestal quartz
lyric mountain
#

role permissions, try removing all except "Send Messages" and "Read Messages"

vestal quartz
lyric mountain
#

bot reviewers invite bots without any permissions

#

aside from "Read/Write Messages"

neon leaf
vestal quartz
lyric mountain
lyric mountain
#

then you can reapply and wait for review again

vestal quartz
#

Should it be a special language?

lyric mountain
#

not really, all languages are accepted in topgg

#

you just need to request permissions if a command requires it

neon leaf
#

found it

lofty cipher
#

Hello how can i get the server avatar?

#

In discord.js

solemn latch
earnest phoenix
#

Laziness stonks

wheat mesa
#

that's actually a pretty good idea

#

I assume there's a lib for that already but I should write one in rust for tons of the most common langs

earnest phoenix
#

It's also creating boilerplate code in the solving file

wheat mesa
#

I should do AOC this year

#

I'm going to do it

earnest phoenix
#

I will stop after 10 days as always

#

Loss of motivation to continue

earnest phoenix
#

Use .icon on a guild object

lofty cipher
#

okay thanks

lofty cipher
neon leaf
#

If you have an interaction variable called interaction that gets passed to your event / command its under the guild property, aka interaction.guild. thats the guild object

lofty cipher
#

thx

lofty cipher
#

how can i export the Discord Bot Client? in Discordjs

#

I will import this in a event

sharp geyser
#

🤔

#

All the events that get dispatched by the client should already have the client attached to one of the properties it returns

#

So I don't see why you or anyone else needs to pass this into an event

cinder patio
#

give me the cheapest vps you know

#

now

sharp geyser
cinder patio
#

that doesn't exist

neon leaf
#

whats the best way to get the commit count of a local dir in js?

#

I currently use this package but wanna do without it
import { default as commitCount } from "git-commit-count"

cinder patio
#

we'll all die one day

lyric mountain
#

@harsh nova kindly

harsh nova
#

Behave.

vapid flume
#

NO YOU FUCKING SHIT HEAD

harsh nova
#

-b 969690723647623239 didn’t behave

shell echoBOT
#

Banned slidersocer531#2407

gilded plankBOT
#

upvote slidersocer531#2407 was successfully banned.

lyric mountain
#

ty

neon leaf
#

doin const amount = interaction.options.get("amount").value
works but why doesnt getInteger?

lyric mountain
#

"doesn't work"?

neon leaf
#

well according to vscode its not defined

#

atleast if its in ts

boreal iron
#

Just don't use this stupid guards

#

Djs tends to remove or rename them with every version however they like

#

the getter get() method is all you need

#

Once the option isn't a required option, just chain the getter optionally

#

...get("...")?.value

#

Almost guaranteed the next djs version doesn't fuck your code up again just by renaming or removing those guarded methods

earnest phoenix
#

@ivory siren remov

dry imp
#

mf choose the wrong server to talk about nft

ivory siren
#

@visual dome please don't do self promotion here

radiant kraken
neon leaf
#

how can I fix this? preferrably without making a new variable

lament rock
#

because it's probably a getter and you need to use a method like setDisabled

neon leaf
#

because it is a read only property

lament rock
#

ok then great. A variable isn't gonna help you there lmao. if there's a setDisabled method, use it

#

actually since it's a received item, it might be frozen

neon leaf
#

well it does work in js, ts screams at me

#

but this seems to be fine

lament rock
#

because js doesn't care about annotations or types

#

it lets you throw runtime errors

#

If something is annotated as readonly, then maybe the intended approach is to create another message component with the desired data

surreal sage
#

Is it possible and if so how would I add 2 server names without duplicating the site config in Nginx?

surreal sage
neon leaf
#

this works
(interaction.message.components[0].components[1].disabled as any) = true

surreal sage
#

fuck I mean semi colons

neon leaf
#

I wouldnt call it unsafe, im not accessing it ever after again

lament rock
#

type casting to ignore compiler errors is literally unsafe 🤣

neon leaf
#

what else am I supposed to do then?

lament rock
#

alternatively, stop using Discord.js and use the raw api

neon leaf
#

thats exactly what im trying to avoid

lament rock
#

Your laziness may bite you in the ass when djs makes a breaking change and remakes builders for the 20th time

earnest phoenix
#

Jarvis, redesign the builders for the 50th time

lament rock
#

literally

earnest phoenix
lament rock
#

djs advocates coping so fucking hard when they have to redesign their entire code base for the 5th time ever since v11

#

I'm glad I stepped away from that

#

it was hilarious when they removed all mentions and I had to pr it back in because nobody knows regular expressions

#

context: disableEveryone was yeeted

grave hamlet
#

@gilded plank

crisp forge
#

a

lyric mountain
#

if the JIT judges them as redundant it'll inline them automatically

green kestrel
#

Deck the halls with bytes of joy
Fa la la la la, la la la la
Tis the season to code, oh boy
Fa la la la la, la la la la

Don your Santa hat, and grab your keyboard too
For it's time to create, and make our dreams come true
With C++ as our guide, we'll make our projects shine
And spread Christmas cheer, with each line of code divine

Oh, jingle bells, jingle bells
Coding all the way
Oh, what fun it is to code
A program on this day

Jingle all the way
Oh, what fun it is to code
A program on this day

So let us raise a glass, to C++ and its might
For it is the language, that makes our Christmas bright
Here's to a Merry C++ Christmas, and a Happy New Year
May your code always compile, without any fear!

jovial prawn
#

gm

lyric mountain
green kestrel
earnest phoenix
tired panther
dry imp
proud night
lament rock
proud night
#

💀💀💀

#

Okok

limber siren
#

Can anyone help me
it's coming up with an error and I don't know why

#

I have tried import I have no clue what to do

neon leaf
#

why does the error say you are using require?

limber siren
neon leaf
#

well whats the error when using import?

limber siren
neon leaf
#

try
import { token } from './config.json' assert { type: 'json' }

limber siren
neon leaf
#

well that error is obvious

#

you can just do
import config from './config.json' assert { type: 'json' }

and get values via
config.<key>, for example config.bottoken

limber siren
#

ok thankyou

warm burrow
#

any bot idea ?

lyric mountain
#

multipurpose bot with uhhh...music features

warm burrow
lament rock
#

DO NOT I REPEAT DO NOT TRY TO DO MUSIC

lyric mountain
#

I mean, they asked for ideas, not sane/original ideas

lament rock
#

fair enough

sharp geyser
vestal finch
#

.

sharp geyser
#

Wait until they find out its nearly impossible to use youtube without being api banned now

earnest phoenix
lament rock
#

fr

#

shit's so tough

sick agate
#

yes

lament rock
#

all of my problems require low level audio solutions like rust lib bindings for nodejs like songbird or symphonia

sick agate
#

OOF

#

i am happy i am just using YouTube dl with discord.py

sharp geyser
lament rock
#

that's the million dollar lawsuit question

sharp geyser
eternal osprey
#

in c++

#

how would i select a char character?

#

so '''?

#

(i basically input the ' as a character input), just like: '!'.

sharp geyser
lofty cipher
#

How can i create a Permission Handler in discordjs

lyric mountain
#

check permissions before executing a command

lofty cipher
#

How can i check this?

lyric mountain
lofty cipher
#
const { PermissionsBitField } = require('discord.js');

if (member.permissions.has(PermissionsBitField.Flags.KickMembers)) {
    console.log('This member can kick');
}

if (member.permissions.has([PermissionsBitField.Flags.KickMembers, PermissionsBitField.Flags.BanMembers])) {
    console.log('This member can kick and ban');
}

if (member.permissions.has(PermissionsBitField.Flags.KickMembers, false)) {
    console.log('This member can kick without allowing admin to override');
}

This is not working

eternal osprey
#

is anyone here good with databases?

#

i have a general question

#

imagine we would have to restrict the database constraints so that they are minimal, but we want to prevent dirty reads

#

could we first run a serializable isolation level, and then read uncomitted?

#

I mean, the whole read and write of the other transaction already passed so we will only get good data.

lyric mountain
#

they just enforce a certain data consistency

#

to prevent dirty reads you need to use some locking strategy

#

relying on uncommited state for data will only lead to race conditions

#

since the last to commit will always have the outdated version

limber siren
#

I need help

lament rock
surreal sage
#

How do I make the message(s) container scrollable instead of it being so long?

#

Message container CSS
Feel free to make improvements

surreal sage
#

Somebody?

limber siren
#

I have no clue what's wrong with this code?

surreal sage
#

or copy paste lgs

#

nvm I can see it

#

Send full code

#

terror

#

loadFiles != loadEvents

limber siren
surreal sage
limber siren
#

OMFD I am sooo dumb

surreal sage
limber siren
#

oh yh

#

ok cool its working now

sharp geyser
# surreal sage

At a certain point when the content of #chats exceeds its size it should automatically kick in and become scrollable

surreal sage
#

it is a height issue

#

I just don't know how to fix it

#

It's parent element is grid

sharp geyser
#

Also it seems like chats might be above everything else so it won't "clip" into the backround

surreal sage
#

And how would I..

sharp geyser
#

you could try messing with z-indices or positioning

#

I haven't messed too much with z-indices but you could try playing around with the position of the chat and the main container

surreal sage
#

I don't think z-index would fix it

#

It's a height issue

surreal sage
#

Display: grid is being weird for me

#

nah

#

grid is just being bad

round cove
#

Does Discord just do this automatically for some bots?

opaque acorn
#

how can i make the message be only viewable by the author?

lament rock
lament rock
lament rock
#

v12 is about to be unusable

#

it's time to upgrade or time to move libraries to something more low level instead of a library that monches ram for breakfast lunch and dinner

opaque acorn
#

Should I learn directly v14?

lament rock
#

If performance is of no concern then sure. If you want to make your app more scalable, then you should learn to use other libraries like SnowTransfer or other raw api libraries

opaque acorn
#

Ok thx

#

How much life does v12 have left approximately?

lament rock
#

I think it's getting killed with Discord api v6, v7 and v8

#

v12 is on api v8

craggy pine
#

the day msg commands get yeeted will be a sad one

opaque acorn
#

It's quite a mess when you have a lot of bots

lament rock
#

from a developer stand point, they're amazing. From a user stand point, they suck

round cove
#

I think slash commands from a user perspective are really good, especially for the dev. When it comes to selecting roles, channels, users and other thinks like autocompleted stuff it's really nice.

sharp geyser
#

💀

#

Also invalid argument

#

Why do you have so many bots to begin with?

#

Just invite the most needed for their topic

#

You dont need 15 different moderation bots

opaque acorn
#

Game bots

sharp geyser
#

Lock them to specific channels

#

5head

#

if you are going to have a fuck ton of game bots just make channels specific for those bots making it only so that bot can see it so no other bots interfere

dry imp
#

true

sharp geyser
#

People just try to find shit reasons to complain about something they don't understand instead of taking the time to see how they work

dry imp
#

exactly like u

sharp geyser
#

python bad cause slow

dry imp
#

♻️

north nymph
dry imp
#

also finish your site dummy

sharp geyser
dry imp
#

or you must build it in django

sharp geyser
#

I will make a bot in python, if I don't finish it I will work on my site if I do leave me alone about it

dry imp
#

but no copying from youtube

#

or any other source

sharp geyser
#

gotcha

#

just tell me what lib to use

dry imp
#

oh 😈

sharp geyser
#

Okay

#

give me doc link

#

I wanna make sure I use the right one

sharp geyser
#

I got like 3 results back

dry imp
#

yea

sharp geyser
#

Ight

#

Time to crank out the hours

#

Ima make a rpg bot or smth

#

I haven't decided yet

lament rock
#

wake up topgg, we gotta crank those 90s

north nymph
sharp geyser
#

yuh

north nymph
lament rock
#

I tried to make my own when I first started coding 6-8 years ago.

#

Didnt go well

north nymph
#

Ya i once tried that

#

got stuck with inventory system

#

and what db to use

sharp geyser
#

python is quite literally the easiest language to use

#

I have used lua and its essentially the same

lament rock
#

The backend yt lib im using is drunk

sharp geyser
#

imagine doing music

#

L bozo

lament rock
#

This is why I tell people not to

lament rock
#

I invest so much r&d into audio processing for node.js

north nymph
lament rock
sharp geyser
lament rock
#

are you fucking high

sharp geyser
#

I don't like using java it looks ugly syntactically though i do like how stuff works in it

lament rock
#

dont tell null that I'm writing bindings for rust libs to process audio

wheat mesa
#

Reflection in Java is much messier than js or python because it’s compiled to bytecode and run by the JVM as opposed to just a runtime JIT engine

lament rock
#

use c++

sharp geyser
#

I dont understand Reflection

sharp geyser
wheat mesa
#

Reflection is just getting data about your code during runtime

lament rock
wheat mesa
#

Js excels in that

#

Java is statically typed and it’s compiled to bytecode AOT so it’s more difficult to do stuff like that

lament rock
#

Someone made a c++ reflection library called Archimedes

wheat mesa
#

Saw that

#

Super impressive

lament rock
#

Some of the most cursed shit I've ever seen

#

but also really cool

sharp geyser
#

the Greek Mathematician ?

lament rock
#

Based off of, yes

#

The name was a joke because of what Archimedes did

sharp geyser
#

I dont know what he did but yea

#

I just heard his name thrown around

wheat mesa
#

Archimedes principle probably the most popular thing he did

earnest phoenix
sharp geyser
#

@dry imp might be a little trickier than I thought

dry imp
#

🧌

sharp geyser
#

Was wanting to attach the settings to the client but fuck it

stiff dust
#

Hi, I am using djs and for message commands like !avatar I want to also work with IDs to like !avatar 555688871023869952

now I want to know is there any better way than this or not

let member = message.mentions.members.first() || message.member;
if (args[0]) {
    const fetchedMember = await message.guild.members.fetch(args[0]).catch(() => null);
    if (fetchedMember) member = fetchedMember;
};
sharp geyser
#
const member = message.mentions.members.first() || message.guiild.members.fetch(args[0]) || message.member;
#

that way if all else fails you just get the member that initiated the command

wheat mesa
#

Don’t forget to await the fetch if you do that

sharp geyser
#

right

bleak jolt
#

.

stiff dust
sharp geyser
#

Oh god

#

That is hell

stiff dust
#

why?

sharp geyser
#
  1. if it doesn't fetch then it just wont exist and move onto the next one so no need to catch
  2. Why the fuck are you using a ternary operator here
stiff dust
#
  1. no if it doesn't fetch anything and you didn't catch it, it will return you an err
earnest phoenix
#

my eyes

sharp geyser
#

Then... give it a fucking snowflake

#

💀

#

If its a valid snowflake it won't error it will just return null if it doesn't exist on either cache or discord's servers

stiff dust
#
  1. because if someone use !avatar there isn't any args[0] and you can't fetch undefined so I just pass random string
stiff dust
sharp geyser
#

by passing in an ID

#

not A

#

you can check if they are passing in a snowflake yourself

stiff dust
sharp geyser
#

tell em no

#

or return their own avatar

stiff dust
sharp geyser
#

if argument != mention or user's id return their own avatar

stiff dust
sharp geyser
#

Then what is the issue here

#

if it works

stiff dust
#

there isn't issue I just fix your code :/

sharp geyser
#

but your fix is ugly and unneeded

#

idc tho tbh

#

you do you fam

stiff dust
earnest phoenix
#

why not just check if the first argument is an id

stiff dust
#

how can I check that first argument is an id ?

digital swan
#

Is it a known issue that relative time stamps are inaccurate on mobile?

earnest phoenix
#

why fetching a forum channel says unknown channel

#

like the channel id is correct

#

but it still says that

#

ok not only forum channels but also text messages too

limber siren
#

can anyone please help me with this problem

jovial prawn
#

gm

digital swan
# limber siren

You’ve got the wrong version of chalk installed for how your project is set up

#

Just go down 1 major version

limber siren
digital swan
#

npm i chalk@x.x.x

limber siren
#

thankyou

#

is that correct cuz I still have the error

digital swan
#

chalk@4 should work

limber siren
#

cheers it worked

#

now the events are not coming through

limber siren
digital swan
#

by that im assuming files is empty

boreal iron
#

exicute

radiant kraken
#

@earnest phoenix explain

wheat mesa
#

That’s just a floating point momento

radiant kraken
#

nice

craggy pine
thin flame
#

Hi everyone, stupid question here: How do I add images on a bot's description page on top.gg? Thank you

dry imp
thin flame
#

Thank you kind sir

lyric mountain
#

Mod bots, chatbots, leveling, stat bots, etc

craggy pine
#

From what I’ve heard itll be an intent and the way to get said intent is by convincing discord you MUST have the ability to see all messages

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

in typescript, do you always have to run the build and start?

#

and is there a better way to do both these steps?

sharp geyser
#

no

#

you can use ts-node

#

it just runs your typescript files as is

#

idk what it does internally as I have never checked but it just allows you to skip the build step yourself

#

only use this for development purposes though, as in production you want js code over the ts code any day

north nymph
#

They can't however be verified without moving to slash commands.

quartz kindle
#

unless you have a good enough reason to need access to messages

earnest phoenix
sharp geyser
#

I now prefer to manually sync my slash commands

wheat mesa
#

I understand that math generally uses radians far more often than degrees, but there is a loss of precision with radians in computers just because the values for special angles are at decimal positions

#

Because doing cos(90) = 0 is a lot easier than doing cos(pi/2) = 0 in computers

quartz kindle
wheat mesa
#

I know but you can convert between one or the other just fine

#

If you just think about it on the unit circle and just use degrees I see nothing wrong with it

#

But I'm not a mathematician I suppose

quartz kindle
#

conversion requires more processing power

wheat mesa
#

I know but I don't see why you would even need to do that

quartz kindle
wheat mesa
#

I don't know how the internal algorithm works but you can know special angles with degrees without conversion

#

Ah so it has to do with arc lengths

#

That cannot be calculated without radians

#

Damn that sucks

surreal sage
#

for loop but not async?

#

Or how would I do it in a diff way

#

Could do an array to forEach shrug

quartz kindle
#

what for?

surreal sage
#

Making a threaded scraper rn

#

Not using cluster 😅

#

missed a semicolon madThoonk

#

Nvm I'm going to use cluster

#

or maybe not 😉

#

all g

quartz kindle
#

a for loop is already sync

surreal sage
#

Yeah I know

quartz kindle
#

by cluster you mean the node:cluster module?

surreal sage
#

yeah but it's all g

quartz kindle
#

thats only useful if youre gonna run a server

#

otherwise dont use it

surreal sage
#

Just trying to add threads

#

Instead of having to open 5 terminal windows yk

wheat mesa
#

I'm going to assume you mean worker threads since js is a single threaded language lol

#

(Well, you have access to one thread within js that is, it uses more in the underlying process)

surreal sage
#

Just create more processes with slightly different tasks

limber siren
#

anyone got any reason why this is not working?

wheat mesa
#

you probably never call the execute function is my guess

surreal sage
#

Replace it with execute: (client) => {

wheat mesa
#
  • that
surreal sage
#

Or execute: function (client) {

#

not a major difference

#

Not even a difference to my knowledge (prove me wrong)

wheat mesa
#

=> is syntactic sugar for function

#

so yes there is no difference

surreal sage
limber siren
surreal sage
#

What's the error?

limber siren
#

no error

surreal sage
#

Are you even calling the function?

limber siren
surreal sage
#

What line?

limber siren
#

that's caliing the calling

wheat mesa
# limber siren

you're going to want to do const execute = (...args) => event.execute(client, ...args) instead of the other way around

#

Otherwise your client will not be passed in a reliable order

#

Since the args will vary

limber siren
#

what line

wheat mesa
#

the one I literally typed out lol

limber siren
#

still not saying test in the console

wheat mesa
#

are you ever calling loadEvents()

limber siren
#

yep

wheat mesa
#

also not quite sure what the point of calling client.events.set() is

surreal sage
limber siren
#

lol

surreal sage
#

lowered it's threads to 4 instead of 8 sad

limber siren
#

dose anyone have a clue with my code

limber siren
surreal sage
#

What we think is that you aren't calling the function at all

surreal sage
limber siren
#

..

surreal sage
#

at 8 mil now

wheat mesa
surreal sage
#

It does a decent 10k iterations per second tho

limber siren
wheat mesa
#

await that call

limber siren
wheat mesa
#
(async () => {
  await loadEvents(client);
})();
limber siren
#

dident work

wheat mesa
#

ok well you're not really giving me any info to work with

#

have you tried actually debugging your issue

limber siren
#

I am doing that now

limber siren
#

I have done some debugging and this is the problem

#

@wheat mesa

#

@surreal sage

surreal sage
#

what exactly?

limber siren
#

Load Files is not defined

surreal sage
#

full file ss

limber siren
surreal sage
#

nope looks fine

quartz kindle
wheat mesa
#

for some reason I highly doubt he wrote that himself and knows what it does 😉

quartz kindle
#

same

earnest phoenix
#

could someone hand me a script to keep my bot online hosting on uptimer?

#

if anyone can

lyric mountain
#

nobody will, that's not how things work

earnest phoenix
#

nvm i did it

earnest phoenix
lyric mountain
#

motivation?

quartz kindle
#

motivaison

lyric mountain
#

just iterate over each pixel and replace those that match

lyric mountain
#

less than you think

#

also it's the fastest possible solution - you gotta find the matching pixels anyway

#

anything else will either be slower or require preprocessing

lyric mountain
#

Mind to elaborate?

lyric mountain
#

That's just looping, but with functional interface

#

Run using regular for instead, not foreach

#

That's called foreach

#

"For each X in Y"

#

Doesn't python allow regular iterator loops?

#

while ++i < limit

#

Or smth

#

The thing is still using in

#

That'd work ig

sharp geyser
#

I like cashews

lyric mountain
#

Doesn't python have unary operators?

#

i++ for example

#

Sheesh

#

But oh well, there's probably a way to access the pixel array directly, so you don't need to have double loops

#

All buffered images are normal arrays of ints

#

You can also achieve a bidi access with a single loop, if the former fails

sharp geyser
#

just i += 1

#

ez

lyric mountain
#
i = 0
while i += 1 < imgSize:
    x = i % imgWidth
    y = i / imgWidth
#

Idk if that while expression would work btw, it should

#

At least in the langs I use

sharp geyser
#

nope

#

cant do it like that

lyric mountain
#

I mean, python was supposed to be used for quick scripts and automation

sharp geyser
#

can't do while i += 1

#

thats invalid syntax

lyric mountain
sharp geyser
#

can't you just add inside the loop?

lyric mountain
#

Well yes, but having it in one line would be better

sharp geyser
#

Yes well haku

#

python is not known for making your life better

#

it just makes it meh

lyric mountain
#

Usually value assignments return the post-op value, I thought it worked in py too

sharp geyser
#

py is odd

lyric mountain
#

Hsv min max?

#

H doesn't have a "min" per se, it's a circle

#

That'll be extremely hard without applying sobel edge detecting

#

Well, the issue is that those pixels also exist outside the minimap

#

Yes, the only way to solve that is by using sobel or some other ED algorithm

#

My graduation project was making a texture generator, so I had to use it for generating normal maps

#

It'll probably be hard to implement it in py tho, especially if looping through pixels is slow

#

In a nutshell, you loop over each pixel, comparing with its neighbors, if the contrast between them and the central pixel is big enough, you have an edge

#

Ik people usually make it for shape detection with opencv + python

#

Well, cameras have to process it fast enough to be realtime so...I think yes

#

But lemme tell you, you're in for one hell of a rabbit hole

#

For reference, download GIMP and look at their sobel implementation

#

Gimp uses python (python-fu) for filters

#

So u already have a good reference

feral aspen
#

If I have a regex of /A-Za-z0-9/ and I want to make a 10 random letter code...
How does the math work on how many 10 random letter codes I can make?

#

Example, fIjeKofeiw or rweGjOpioh, and etc. How many can I do? Is there a math that can determine this?
We need to also consider having capital and lower case letters, especially when we have 26 alphabets, and 10 numbers, too. Yeah, I'm lost on how to calculate such so.

glass geode
feral aspen
#

Sweet, that's pretty high, actually.

glass geode
#

Yeah haha kinda wild.

Interesting stat:
If you generated 1 billion UUIDs every second for the next 100 years, the probability of creating a duplicate would be ~50%

#

(A UUID being in the form of 123e4567-e89b-12d3-a456-426655440000)

feral aspen
#

That's pretty wild, I've just wanted to know such calculations since I'm hosting a CDN, and I was curious how many pictures I could generate.

#

I know the math, but never was sure if it was the right formula or not. However, thank you for confirming me with such so.

glass geode
feral aspen
glass geode
#

Yea

#

Unless you plan on uploading 840 quadrillion photos

feral aspen
#

839 quadrillion visuals, hopefully. 😂

glass geode
#

Then you might want to rethink it

glass geode
#

Gl with it 🫡

feral aspen
#

I'm starting to think whether storing all my CDNs on a VPS is worth it or not.

lean pike
#

Hi Guys, I always get this error when I runed the app on a linux vps.
I don't know what is the problem with it, It's work when I try it on windows

#

And this is my code

quartz kindle
#

what linux is it running?

lean pike
#

Ubuntu 22

quartz kindle
#

the crypto module relies on the system's installed cryptography libraries, on linux it uses openssl, no idea what it uses on windows

#

those libraries define what operations and algorithms are supported

#

its possible you're trying to use an algorithm that is not supported by your system's openssl

#

although ubuntu 22 should run everything out of the box

#

what algorithm are you trying to use there?

lean pike
#

Hmm I know that for the first time from u 😅

lean pike
#

I'm use aes-256-cbc-hmac-sha1

#

The name is long

quartz kindle
#

its possible that specific variant is not supported by your openssl, try using a different algorithm

lean pike
#

Hmm okay

quartz kindle
#

also, not sure if that was a typo

#

it should be aes not ase

lean pike
#

Lol

dusk panther
#

Hi guys

lean pike
dusk panther
#

@lean pike hi

lean pike
#

Hi bro

dusk panther
#

@lean pike pliz frend me

quartz kindle
#

no need to specify hmac sha1

lean pike
#

I'm working on big project and I want everything to be more secure

quartz kindle
#

AES 256 is pretty much the standard

#

now there are many variants, each with pros and cons

#

for example

#

CBC is one of the safer ones, but its slower to encrypt than decrypt

#

so for example if you need very fast encryption, ECB would be better since it supports parallel encryption

lean pike
#

Okay the user will wait for 2s

#

And he will be more safer

#

It will take time for one time only

quartz kindle
#

aes-256-cbc should be just fine, i believe thats what most people use

neon leaf
#

whats the best way to check if any possible winning tictactoe is achieved? I have a variable for each field with a userid if that helps

quartz kindle
#

you can check all the possible patterns and see if they match the current field

#
if(
  (a1 === a2 && a1 === a3) ||
  (b1 === b2 && b1 === b3) ||
  (c1 === c2 && c1 === c3) ||
  (a1 === b1 && a1 === c1) ||
  (a2 === b2 && a2 === c2) ||
  (a3 === b3 && a3 === c3) ||
  (a1 === b2 && a1 === c3) ||
  (a3 === b2 && a3 === c1)
) {
  // someone wins
}
#

lmao

#

you can also narrow down those conditions by the last piece that was played, to only check those that are relevant

sterile brook
#

Any ideas how to make gradient shadow on object on canvas?
Seems gradient can't be applied to shadows directly

neon leaf
quartz kindle
#

abc is rows 123 is columns

#

or vice versa

neon leaf
#

ah

quartz kindle
#

so basically its just checking if the piece that exists in that place is equal to the pieces that exist in the required places to make a win

neon leaf
#

but I probably have to check everything instead of your solution if I want to know which fields won, right?

quartz kindle
#

yeah, you will need to break it down some more

#

or use a switch statement

#
switch(true) {
  case a1 === a2 && a1 === a3: { /* this line won */; break; }
  case b1 === b2 && b1 === b3: { /* this line won */; break; }
}
neon leaf
#

ah

#

never seen code use a true in a switch, but smart

#

like this for the first one, right?

#

1 2 3
4 5 6
7 8 9

quartz kindle
#

should be yes

#

technically speaking this is pretty much a terrible way of doing things, since its O(n), but since tick tack toe only has 8 possible win combinations, we can get away with it lmao

neon leaf
#

oh

#

it seems to react if the values are undefined

neon leaf
#

fixed that but somehow when winning with the right row it ends up like this

north cairn
#

How to add cooldown command? Can anyone pls tell
I made it but its causing some errors

#

Js btw

solemn latch
#

what errors?

north cairn
#

I set the cooldown to 25 seconds but it's going way faster than it should be

#

Like when I type command it says 25
Next second it goes to 20

#

Here code

#

Here issue

#

Will be very helpful if u guys give a lil guide
And sry if I m in wrong channel

lyric mountain
#

And replace the extra 2 chars b64 uses

#

B64 is literally lowercase, uppercase, numbers, + and =

#

That's why "64" (26 + 26 + 10 + 2)

#

Or use a filter that can match hashes

wheat mesa
#

For your case, n would be the number of characters you’re selecting from, and r would be the length of the string you’re creating

#

So the actual number of combinations you can make with this would be like so

#

390 quadrillion approximately

north cairn
lyric mountain
#

also, are you properly identifying who sent the message? anonymous dm commands are a terrible thing

#

dm command by itself is pointless and annoying

feral aspen
# wheat mesa

Hmm.. well, what's the difference between just powering 62 to 10 and yours?

wheat mesa
#

One is correct and the other is wrong

feral aspen
#

Yours is correct?

wheat mesa
#

Yes

feral aspen
#

Ohh, fair enough. I've just researched this, by the way..

#

This'll be a fun topic to study about, actually. (and know how it works)

neon leaf
#

why does my bot randomly crash with this?

limber siren
#

dose anyone know how to set a prefix for commands on the command folder in discord.js

solemn latch
#

You'd want to do that in your command handler

limber siren
solemn latch
#

Depends on the other code tbh

#

Looks like thats the command file loader, not the command handler.

#
client.on(Events.messageCreate, message => {
// this part
});
limber siren
#

thankyou

#

I fixed the problem

#

wait new problem its not working

#

@solemn latch

earnest phoenix
#

i was wondering how do i make a rps command Slash supported

sudden geyser
#

Any of you doing the advent of code?

wheat mesa
#

Yup

lyric mountain
earnest phoenix
earnest phoenix
# wheat mesa Yup

MFW almost everyone used ||sets or ranges|| for day 4 instead of just ||simple math (or just conditionals)|| troll

lyric mountain
#

I mean, there are some interaction-exclusive features, but the logic will be exactly the same

earnest phoenix
#

I think they're asking for the logic rather than that

earnest phoenix
sudden geyser
#

I'm on day 3

lyric mountain
earnest phoenix
lyric mountain
#

You code or copy code from the internet?

boreal iron
lyric mountain
#

Did u start a rps command already?

#

Like, any code, even if not working

earnest phoenix
earnest phoenix
boreal iron
#

lols

lyric mountain
#

Well, at least you are sincere

#

A good start would be running a few courses, to understand what programming is and how it's done

#

Forget about bots for now, start with something very simple

#

Then work your way upwards

earnest phoenix
#

just like what i do usally

lyric mountain
#

That's a poor excuse

earnest phoenix
#

its not an excuse at all

lyric mountain
#

Did u learn something from the codes u copied?

#

Anything

earnest phoenix
#

a bit.

wheat mesa
#

copying isn't going to help you learn, you should start off by following a couple tutorials (but don't do TOO many, leave room for your own creativity), and then start to create your own projects

lyric mountain
wheat mesa
#

A thing that helps to learn programming is following tutorials but adding your own twists to them, like extra features

earnest phoenix
wheat mesa
#

that's... not really "a bit"

earnest phoenix
#

takes 2 months to master coding ngl

wheat mesa
#

I mean, it's a "bit" in the sense of a computer bit lol

wheat mesa
lyric mountain
wheat mesa
#

many of us in this channel have being doing this for several years and are still not considered "masters" by any means

earnest phoenix
#

like coding a bot

#

started off from tutorials

lyric mountain
#

Cloning*

earnest phoenix
#

on yt

wheat mesa
#

printing is the most basic thing you can do in pretty much any language tbh, with the exception of maybe assembly since it takes a little more knowledge

earnest phoenix
#

6 damn years

earnest phoenix
wheat mesa
#

I've been doing this for a little more than 2 years, I'm still a student

wheat mesa
#

Granted much of that time was consumed by school, so I didn't dedicate 2 full years to programming

wheat mesa
#

Should I get into AI stuff? Seems fun but I'm not sure what I'd use it for

#

I want to learn a new field since my main "expertise" is in parsing atm

earnest phoenix
lyric mountain
#

So people can play against the bot

wheat mesa
#

Oh yeah I wanted to make a chess engine at some point

#

but that requires me to make a chess game

#

and that's not so fun

lyric mountain
#

Lmao

wheat mesa
#

I like low level stuff but I want to see high level results

lyric mountain
#

Just make a plugin that controls your side on online chess

wheat mesa
#

Which is a predicament that I've been in for a while

earnest phoenix
wheat mesa
#

Eh it's not really my thing