#development

1 messages ยท Page 1840 of 1

earnest phoenix
#

I had the idea to use machine learning for auto mod features

#

Turned out to be more trouble than its worth

rose warren
#

Lots of server owners just give all bots and moderators admin permissions by default. You're fighting a losing battle. The ones who know what they're doing don't need a bot that does that. No offence or anything ๐Ÿ˜…

earnest phoenix
#

I learned my lesson wit hthat

#

I had a poppin discord server one time

#

Someone pissed someone off and it disappeared

rose warren
#

Yeah I've seen it happen before too. Lots of times. But never on a server I manage.

earnest phoenix
#

I wanna start a server

#

but lack of motivation

lyric mountain
rose warren
#

Lol or bot dev submits nuking bot to top.gg... Like, guuurrlll... anim_skeptical_conceited

lyric mountain
#

as my old teacher said, NO amount of security will prevent a dumb user from doing dumb shit

rose warren
#

I've seen owners claim bots have deleted their servers before KEKW

#

Go figure

earnest phoenix
#

pfft

#

bottum deleted server plez help

lyric mountain
#

it's like people who get their account "hacked" from nowhere

except they click sketchy links and use dodgy clients

rose warren
lyric mountain
#

lul

novel snow
#

It was his idea before

#

And now I want to make it

earnest phoenix
#

๐Ÿ‘€

#

That took a dark turn

rose warren
#

It's a good idea to maybe check how many people on the server have certain permissions like "manage server" or "manage channels" permissions for sure. But apart from getting them to change their moderators and bots permissions, the reality is there's nothing much more you can do. Sorry to hear about your friend.

novel snow
#

Still see it as a challenge

novel snow
#

I know it will be quite useless

earnest phoenix
#

Good job on it

novel snow
#

I will do it

rose warren
novel snow
#

With my balls of glory and fury

rose warren
#

And tbh, when I see 20% of the servers my bot is in it has admin permissions, I cry a little inside.

novel snow
#

Still had Wick as anti nuke on a server of mine for safety, Even though I know precisely how to set up all perms, Just in case something goes wrong or someone in a high position gets mad at me or some shit, Always wanted to make sure

novel snow
#

I don't like Mee6

#

It mentions you so fucking much it gets so damn annoying

earnest phoenix
#

I have mee6 blocked

rose warren
#

These are actual stats. My bot never asks for administrator permissions.

earnest phoenix
#

oof

rose warren
#

That's server owners being lazy / not knowing how to do perms.

novel snow
#

Yeah

rose warren
#

They just make a "Bot" role with all the perms and stick it on all the bots.

earnest phoenix
#

Makes sense

rose warren
#

Does it tho? ๐Ÿ˜‚

novel snow
#

I don't make community servers since I quit that shit a while ago, But I do make servers for groups like in game servers, For example on one group, And it is quite common for spies and shit or just insiders to just having experience with perms from before is very usefull, Nothing can really go wrong in my servers, Other than the occasional dumbass who decides to post gore in general but yeah

earnest phoenix
#

Oh why ofc

#

Less work

#

I stopped making discord servers after I realized I was never going to be successful in growing em

rose warren
#

If you make an anti-nuke bot though, you need to have a disclaimer somewhere saying you can only make recommendations and if people don't follow your recommendations you can't guarantee their server isn't nukeable.

#

Because at the end of the day it's up to them.

novel snow
#

I made one which was very active and pretty gucci, Just couldn't be bothered anymore, I just lost interest, \

earnest phoenix
#

I made 1 active server and someone blew it up cause a mod made another mod mad

sudden geyser
rose warren
#

This is true but it's easy enough to find best practices online.

sudden geyser
#

Maybe, but for users (and even me), it's a nightmare

#

Understanding hierarchies of roles, categories, channels, and text/voice/stage/etc.

#

How they get applied and in what order

#

And the way Discord applies permissions to new and existing roles is even more frustrating

earnest phoenix
#

I myself still struggle with it

sudden geyser
#

So everyone just wants to throw administrator and never have to think about it

#

and users really shouldn't have to think about it

rose warren
#

Yeah so those checks are the best an anti-nuke bot can do.

copper relic
#

When installing an npm package gloabally, and then trying to use its CLI, this happens: zsh: command not found: slappey

sudden geyser
#

I manage this server with 400 members and I'm so reluctant to fixing some channel permissions because it's just so tedious and may accidently expose channels I don't want for a second

wheat mesa
#

The average user doesn't want to go through all the permissions of bots to make sure they can't nuke the server. They're too trusting of the idea that "Oh it's a program it can't be used maliciously!"

#

So they just give it administrator and forget about it

earnest phoenix
#

or make sure you have node on the path

rose warren
#

Yeah but even if the dev isn't malicious, what happens if the bot's host gets hacked or the token gets compromised? The dev might still be completely innocent and their bot might still be able to nuke the server.

copper relic
wheat mesa
#

Saw that happen to a 100k+ member server

#

Their custom bot token got leaked

earnest phoenix
#

can you run node or npm

rose warren
#

Yeah ๐Ÿคทโ€โ™‚๏ธ

wheat mesa
#

Pinged @everyone thousands of times before it was shut down

earnest phoenix
#

without doing weird stuff

wheat mesa
#

I don't think they gave it ban perms though

#

Otherwise that would've been a mess

quartz kindle
#

as if anyone would fall for that (nitro scam)

pale vessel
#

unfortunately they do this a lot since people actually fall for them

earnest phoenix
digital ibex
#

node 17

pale vessel
#

new feature in node 17

digital ibex
#

you've got const Client twice

earnest phoenix
#

I wonder why you are getting this error

#

Fuck wrong emote

#

I apparently no longer have that emote since i left that server

#

sad

sudden geyser
#

names (identifiers) are case sensitive.

median moss
#

(JS)
How can I make my bot to only work if a person has a role?

sudden geyser
#

You don't need to create the client two times either.

earnest phoenix
#

Why are you declaring two clients anyway

sudden geyser
#

So you may be new to JavaScript.

pallid jungle
#

@sudden geyser I want to upgrade to v13

sudden geyser
#

Do you know JavaScript well

earnest phoenix
#

Thats not how you do it

digital ibex
pallid jungle
sudden geyser
#

Then let's start there

digital ibex
#

yw

hexed sedge
earnest phoenix
#

hasRole isn't a thing

pale vessel
#

why is it not a thing

earnest phoenix
#

Hasn't been for many versions

hexed sedge
#

Why isnt hasRole an actual function

#

I want it now

pale vessel
#

it was

earnest phoenix
#

It was

#

but its not anymore

median moss
hexed sedge
#

It was

#

I want it to be

earnest phoenix
#

You have to go through the RoleManager iirc

hexed sedge
#

Present, not past

earnest phoenix
#

<Member>.roles.has or smth

pale vessel
#

ever since they moved to cache managers they just ask you to use collection.has()

earnest phoenix
#

actually no

pale vessel
#

O

hexed sedge
#

member.roles

pale vessel
#

cash

#

๐Ÿ’ธ

hexed sedge
#

cash

sudden geyser
earnest phoenix
#

Yea

digital ibex
#

dont worry guys, node 18 is out: js String.ptrototype.addRole = function() { return message.guild.members.addRole(this) }

#

idk if <Members>.addRole is a thing

#

btw

earnest phoenix
#

Its not

pale vessel
#

why is it not a thing?

hexed sedge
digital ibex
#

but if it isnt node 18 is broken

earnest phoenix
pale vessel
#

so rude man

sudden geyser
digital ibex
#

u just a node hater

hexed sedge
digital ibex
#

go back to assembly

sudden geyser
#

what's really wack is mutating the prototype

hexed sedge
sudden geyser
#

it means that X.prototype.y = z

hexed sedge
#

Thank you for the explanation

#

here is the gold

quartz kindle
#
String.prototype.send = function(...args) {
  const channel = client.channels.cache.get(this) || client.users.cache.get(this);
  if(channel) { channel.send(...args); }
}

"7346587364853672355".send("hi");
#

:^)

digital ibex
#

No

pale vessel
#

why not?

digital ibex
#

because he missed semi colon. gettin me angry ๐Ÿ˜ 

earnest phoenix
#

Makes life easy

earnest phoenix
#

nerd

digital ibex
#

Yes

sudden geyser
#

depends

#

js is mixed about semicolons

earnest phoenix
#

Typically it doesn't

#

If you were to make an async function about something tho

#

then you need it

#

that fucks shit up for some reason

pale vessel
#

no bro it needs semicolons so much it automatically inserts them for you if you forgot to include them

#

so you're wrong

earnest phoenix
#

No

pale vessel
#

destroyed and facts and logic

hexed sedge
#

Like shouldnt you be questioning other things that are more important?

pale vessel
#

You do have a point

earnest phoenix
#

Well

#

whats important?

hexed sedge
#

I dont think shitposts on a discord server is important to question

earnest phoenix
#

What is classified as important

hexed sedge
earnest phoenix
#

your classification as important could be different than flazepe's

hexed sedge
earnest phoenix
#

Wanna know whats important

#

the meaning of life

#

what is it?

hexed sedge
#

no

#

try again

earnest phoenix
#

tf you going to tell me no

#

you aren't me

hexed sedge
#

right

earnest phoenix
#

If I value it as important to me then it is important

hexed sedge
#

i forgot i can have a different view point on whats important or not than you

hexed sedge
#

im not sure i quite understand what to value as important or unimportant yet

sudden geyser
# earnest phoenix then you need it

I've never had a case where that was necessary, though I've heard about it. A more trivial case would be:

let a = "b"
[1, 2, 3].forEach((c) => console.log(c));

Woo, hoo!

earnest phoenix
#

What the hell

#

why does that even happen

sudden geyser
#

javascript

earnest phoenix
#

Also yea

hexed sedge
#

based js

earnest phoenix
#

Not using a semi colon on a async function causes issues for me

sudden geyser
#

it's because it's really doing "b"[1, 2, 3]

earnest phoenix
#

in most cases

hexed sedge
#

how

earnest phoenix
#

Cause its doing exactly what klay said

#

(async => ())()something

#

it pulls it onto the same line

#

and makes shit weird

hexed sedge
#

tf

pale vessel
#

then use them

earnest phoenix
#

I do

pale vessel
#

Ily

earnest phoenix
#

prettier at least does

#

I don't remember to do it all the time

#

so what I miss prettier does for me

hexed sedge
#

imagine not using eslint

earnest phoenix
#

eslint is so fucking garbage

#

and annoying

hexed sedge
#

Just need to steal someones rules

#

And your based

earnest phoenix
#

Even then

#

its absolutely annoying

#

red lines everywhere

sudden geyser
#

when I started programming I had this 300 line eslint file

earnest phoenix
#

When I started programming I didn't use a linter

sudden geyser
#

I think linters are fine, but I prefer to default to what the language gives me (e.g. Rust's clippy)

hexed sedge
#

when i started programming, i did shitty decisions

sudden geyser
#

we all did

earnest phoenix
#

I used vsc

sudden geyser
#

do you use emacs now

earnest phoenix
#

now i used webstorm

#

Actually I dont use webstorm anymore

#

cause I dont program in js/ts anymore

#

Im swapping to the golang

hexed sedge
#

I use vsc

#

bruh

earnest phoenix
#

Which I use GoLand for

#

most based Golang IDE there is

hexed sedge
earnest phoenix
#

yea so

hexed sedge
#

anyways

#

what should i make a guide on next? i already did basic get api and command line tool

#

How to breathe would be good

pale vessel
#

"how to prototype pollute in JS"

hexed sedge
earnest phoenix
#

who knows what anything in js is tbh

hexed sedge
#

true

#

all i know is...

earnest phoenix
#

well

#

tim probably does

quartz kindle
#

so i made my own erlpack in js and its only 15% slower than discord's c++ erlpack (running in js), not bad for a first run

earnest phoenix
#

this mf knows everything

quartz kindle
#

its not really worth it tho

#

its still 3x slower than json

hexed sedge
#

Invent the next json i dare u

pale vessel
#

aka JSON5

hot star
#

Anyone here use wavelink?

pale vessel
#

JSON5 is amazing

quartz kindle
#

erl is a bit smaller than json, but the performance diff is not worth it

hexed sedge
#

wtf is a json2+3

quartz kindle
#

json+zlib is pretty much the best combo

hot star
quartz kindle
#

jason 5

hot star
#

Or json101

hexed sedge
#

like maroon 5???

quartz kindle
#

hey if you're still around and still interested, im pretty much doing this right now

hexed sedge
#

sus

pale vessel
#

when both Tim are smart

hexed sedge
#

I finished a game of csgo with someone called tim on my team, and he didnt do well

#

anyways, fr what should i make a guide on?

#

how to breathe is on the table ngl

#

how to use brain is also a good one

pale vessel
#

how to play Rush E on a piano would be a good one

hexed sedge
#

Ahh a man of culture

hot star
hexed sedge
rose warren
#

Yall see context menus in the API just now? ๐Ÿ‘€

hexed sedge
#

no i dont pay attention to anything

#

is Tim good?

#

he do be typin tho

rose warren
#

I've been wanting something to be able to bookmark messages for so long...

hexed sedge
quartz kindle
#
(node.js v16.6)
~1760 GUILD_CREATE packets:

json:         ~41.2mb   ~600ms
json+z1:      ~7.9mb    ~800ms
json+z2:      ~6.7mb    ~650ms
etf:          ~39.8mb   ~1250ms
etf+z1:       ~7.6mb    ~1400ms
etf+z2:       ~6.2mb    ~1300ms

z1 = packet compression
z2 = zlib-stream (synchronous)
hexed sedge
#

@rose warren are u using linux? if so, ill make you something similar

rose warren
#

No. Guess what OS i use? KEKW

hexed sedge
#

hmmmmmmmmmmmmmmmmmmmmmmm

#

I need to use my brain on this one

boreal iron
#

It must be Windows Iโ€™m sure

rose warren
#

๐Ÿ˜‚

hexed sedge
#

No he is deffo using Solaris

hot star
rose warren
#

It's a total coincidence btw

#

My username is based off my surname

hexed sedge
boreal iron
#

Damn my MacBook has a hardware issue and Apple refused the warranty shit

hexed sedge
#

Absolutely nothing

#

I dont code assembly

rose warren
hexed sedge
#

I could have used ICodeInJavascript but 1 long and 2 js? lame

rose warren
#

Fellow Irishman?

hexed sedge
#

Just searched up irish, and i saw irish hook????

#

what does that mean

hot star
#

Every product in Ireland have 4 yr warranty?

rose warren
#

We're hella off topic

hexed sedge
rose warren
hexed sedge
rose warren
#

Sorey

boreal iron
#

But a good idea tho

hexed sedge
#

@rose warren Is the source for your rpc open?

hot star
hexed sedge
#

bc like I want rpc

#

But like, how bruh_momento

rose warren
hexed sedge
#

hecc

sudden geyser
#

how does that stop it from being open source though

hexed sedge
#

I guess bc sensitive data

rose warren
#

Because I can't be bothered to clean it up to share

sudden geyser
#

cringe

hexed sedge
#

I keep getting German ads wtf

final obsidian
#

So I want my bot to now have like music features how do I do that?

sudden geyser
#

make music stuff

#

search up what your set of tools currently has

hexed sedge
sudden geyser
#

e.g. a library

hot star
#

xD

sudden geyser
#

aka be more specific

hexed sedge
#

^ This is also useful

final obsidian
#

Yeah I might look it up but I code on node

hot star
#

For js it's called lavalink

sudden geyser
#

If you use Discord.js, there's a voice library that comes separately

final obsidian
#

So pretty much it's a different library

hot star
#

More like framework I guess

#

I don't understand it fully

#

Still learning

final obsidian
#

I'l work on updates when I get my laptop back..

#

But I have a question

pale vessel
#

Wavelink is the library/wrapper

hot star
#

@pale vessel u know how to use wavelink with discord.py?

final obsidian
#

Should I use repl.it as my main ide for programming or visual studio code?

pale vessel
#

There's lots of libraries for JS too, like Erela.js and Shoukaku (based wrapper)

hot star
pale vessel
hot star
#

New name Into my dictionary ๐Ÿ‘

final obsidian
#

What are the advantages in coding in visual studio?

pale vessel
#

None?

hot star
final obsidian
#

Ok I will set it up later

sudden geyser
final obsidian
#

I know I used both of them

sudden geyser
#

There are (probably) no advantages.

final obsidian
#

But I like visual studio code better since I used it in a Friday night funkin mod. Don't ask

pallid jungle
#

if (message.author.Client) return;
^

TypeError: Cannot read property 'Client' of null

final obsidian
#

I don't think client is required

sudden geyser
#

You should start by learning JavaScript.

final obsidian
#

I did

pallid jungle
sudden geyser
#

Not you.

final obsidian
#

Just remove .Client

#

I think

#

Tell me if it fixed it

pallid jungle
pallid jungle
sudden geyser
#

If you want your client instance just access the property for it (message.client)

pale vessel
final obsidian
#

I'm not the best but at least I tried to help

pallid jungle
sudden geyser
#

what isn't working about it

pallid jungle
#

Wait i will try something

final obsidian
#

Let me check something in replit

hexed sedge
earnest phoenix
#

wavelink

#

tf is that

pale vessel
#

I assumed it was a wrapper in python

#

Heard it somewhere

hexed sedge
#

Searched it, couldnt find it

#

Only a few german companies

#

Maybe I should turn off my german vpn

pale vessel
#

Search in Python Package Index

earnest phoenix
#

cant be bothered

tardy hornet
#

i have a giveaway command, but if the bot crashes/restart it wont end them, like it will just keep going after i turn the bot on (database: quick.db)

earnest phoenix
#

Do you want them to end

#

sounds counter productive

pale vessel
#

You gotta check em on startup

earnest phoenix
#

Really you want them to start again on startup tbh

tardy hornet
#

yes if the giveaway end time ended when the bot restated, but if the giveaway end time was not suppose to end it will just keep on doing the giveaway (wont stop the timer)

earnest phoenix
#

If the timer is up during which the bot is offline

pale vessel
#

No, like giveaways that are supposed to end end up starting is what they meant

#

A

earnest phoenix
#

just check the giveaways on startup

pale vessel
#

Fucking internet

earnest phoenix
#

and end the ones that should end

pale vessel
#

Check if the end time is less than the current time

tardy hornet
earnest phoenix
#

Same

pale vessel
#

How do you store your giveaways

#

It depends on the structure you laid out

amber thistle
#

is it possible to add a bot to a server without needing to manually invite it?

earnest phoenix
#

No

#

Thats the whole point of bots

#

they need to be authorized to join

long crow
#

Right click menu rolled out quite fast.. Have not fully read the docs

earnest phoenix
#

What

long crow
#

Basically like this, right click on someone message to evaluate the content

lyric mountain
#

Hm

#

That one's nice

long crow
#

don't quote on me for that though, I have not fully understand on it

lyric mountain
#

Probably the only use case I have tho KEKW

#

Maybe inspect card? Idk, I don't see too much opportunity for that

earnest phoenix
#

same

long crow
#

It still too new, have not fully discover it, and of course, djs with it slow pace.. kekw

errant flax
#

idk whats the use for context menus dog_kek

lyric mountain
#

They are menus

#

But contextual

errant flax
long crow
errant flax
#

context menus rnt in mobile tho notsopog

quartz kindle
#

right click -> kick/ban is too hard, lets do it with bots instead
typing ban/kick commands is too hard, lets do it with context menus instead
right click -> app -> kick/ban is too hard...

#

we've come full circle

long crow
#

just delete the server, easy

vivid fulcrum
#

tasker integration soon โ„ข๏ธ

lyric mountain
#

Taskede

errant flax
long crow
#

I don't see much use for context menu as now, unless I want some cringe command like right click this x member - send "hug" text with cringe anime hugging

sudden geyser
#

I think they could be very useful

#

Just right click and perform some special action

#

It's just up to people to find a use for it (else poof)

long crow
#

might be useful for others. Right now, it does not much useful for my use case

vivid fulcrum
#

maybe when we get dialogs

sudden geyser
#

For example, instead of running /sanction <user> [reason] [options] or whatever, you can just right click the offender and bring up a dialog for more details

fallen holly
#

can someone help make a slash command handler

sudden geyser
#

Your library probably offers guides or an official API to using slash commands

long crow
errant flax
#

lmao discord amongus

#

thats probably not a bad idea tho with context menus vvGFXRT_flushedspin

long crow
#

well, make credit with my name if you make one, kekw

lyric mountain
#

The issue is how to win as imposter

#

It's not like you can kill anyone without other people seeing

#

Since you can't even know who's in the channel

quartz kindle
#

just by changing how bigints are read from the buffer, etf's decoding time went from 1800ms to 1200ms lol

lyric mountain
#

Tim

#

You're optimizeophile

quartz kindle
#

send help

lament rock
#

I also like to optimize things to obscurity

#

I like when things can run on my low end hardware

errant flax
proper bolt
#

is it possible to respond to an interaction in discordgo with just nothing so it doesnt say interaction failed?

#

i tried to do InteractionResponsePong but it didnt work

errant flax
#

no that isnt possible

#

u could either send a reply that isnt ephemeral then delete it quickly dog_kek

proper bolt
#

im trying to just avoid the interactions api while providing slash commands

slender thistle
#

Can't you ACK it?

proper bolt
#

doesnt work

slender thistle
#

Just Discord things apparently

proper bolt
#

do i need to send any data along with the ACK

slender thistle
#

I don't remember unfortunately

#

Sec

#

Unsurprisingly enough this is the only thing that can help somewhat

#

Other than that you're shit outta luck

proper bolt
#

yea im doing that

slender thistle
#

Then yeah I reckon you'll have to make do with that

errant flax
amber thistle
#

so i have added markdown to my dbl, but the problem is, since my frontend takes the description of the bot, converts it to html:
from markdown to html

**hello**
<strong>hello</strong>

and it sets it as a html element, which is dangerous because users can type something like

hehe ur website is ruined<l>

because it treats the text as html, not a string

slender thistle
#

short for ACKNOWLEDGEMENT

proper bolt
#

{"message": "Value must be one of (4, 5)."}

#

it wants these trolldisappointed

slender thistle
#

Yeah 6-7 are for message components

proper bolt
#

why does it exist if i cant use it

#

wait it might work for components

#

nvm i dont think it does

slender thistle
#

wdym if you can't use it

errant flax
#

whats the best way to detect when someone boost the server

proper bolt
#

like its not allowed as a callback type

#

for either components or slash commands

slender thistle
#

You mean 6 and 7?

proper bolt
#

no

#

1

slender thistle
#

Ah nah yeah

#

PINGs are for webhooks, not gateway

proper bolt
#

ah

slender thistle
proper bolt
#

i dont like the interactions api

slender thistle
#

Who does?

proper bolt
#

can i cancel a deferred response

snow urchin
#

Any reason why interactionCreate would not be receiving guild specific commands?

proper bolt
#

hmm i can but then it doesnt show who ran the command

snow urchin
#

im just not receiving them at all, quite frustrating

snow urchin
#

well, I just have a console.log(1) at the very top of the interactionCreate event and run the commnad, global commands work fine, guild commands do not

proper bolt
#

yes can you show any code for how you register them

snow urchin
#

I just created them with the api before v13 even released ๐Ÿคทโ€โ™‚๏ธ

earnest phoenix
#

Is this against discord tos? the bot watches the status of my bot. Is that against tos?

knotty steeple
#

no

earnest phoenix
#

Ok

errant flax
#

wait how do u even tell if a bot is offline isee

quasi hearth
#

<User>.presence.status === "offline" (discord.js)

eternal elbow
#

How can I convert a number to as many bits as I want?
Example: 20 => 000000000000000000000000000000000000010100

snow dragon
#

alright im having issues, how do i go about deleting the last message my bot sent in a channel using only channel ID

#

i can get the lastmessageID of the message in a channel but i cant get the content

#

when i do client.channels.cache.get(id).lastMessage.content it only gives me my message

#

the rest are null

sterile thicket
#

Is this how I log and trace the rate limit and see how many requests remaining?

!e client.on('rateLimit', (info) => { 
    console.log( `Rate limit hit ${info.timeDifference ? info.timeDifference : info.timeout ? info.timeout: 'Unknown timeout '}`)
})```
summer acorn
#

ok so apparently this is a problem in djs v13, so if you're going to check what type of channel your slash commands are used in, make sure to check if there actually is a channel with the interaction first

marble juniper
#

or just use

#

interaction.isText()

#

these methods

summer acorn
#

I was already checking if the interaction was a command before checking the channel type

marble juniper
#

ok

long crow
#

Are you checking for dm?

#

Use .inGuild() or check .member property

#

And dm become DM now

errant flax
#

wait slash commands can be used in dms?

#

what the fuck

marble juniper
#

don't even think they can

earnest phoenix
marble juniper
errant flax
#

this is in a dm channel

marble juniper
#

bruh

errant flax
#

tf

marble juniper
#

so they can

#

lol

small tangle
#

global commands appear everywhere

#

guild commands obv in the guild they're registered

errant flax
#

so i have to check if guild exist in a command interaction then

marble juniper
#

yes

small tangle
#

depends on the interaction

earnest phoenix
small tangle
#

my commands are completely fine in dms

marble juniper
#

I have 2 commands

errant flax
#

most of my commands r guild based

marble juniper
#

that require you to be in a guild

errant flax
#

for eg. settings

marble juniper
#

same

#

has to read and write data for the guild in the database

small tangle
#

since i dont have to offer per guild prefixes anymore, i dont need guilds

earnest phoenix
marble juniper
#

lol

small tangle
#

yeah sure, depends on the bot purpose

earnest phoenix
errant flax
#

does it count as a bug or someth

earnest phoenix
errant flax
#

bc i feel like slash commands rnt supposed to be in dms

small tangle
#

i have a tamagotchi bot, so it only interacts with user, independent from guilds

marble juniper
errant flax
#

since uknow there commands? vvGFXRT_flushedspin

marble juniper
#

there were already large bots

#

that have commands usuable in dms

near stratus
marble juniper
#

lol

#

then what math is

earnest phoenix
#

Yes idk what that means

small tangle
#

e.g. mod mail and reports could be good in DMs

errant flax
#

good point vvGFXRT_flushedspin

#

wait do u still need the partial tho?

small tangle
#

but i mean with emphemeral (?) messages this could move to guilds to be fair

earnest phoenix
#

I don't get it?

marble juniper
#

since only you see the messages so

small tangle
#

yeah

errant flax
#

imagine using ephemerals in dms :dog_kek:

small tangle
#

but they are gone once discord reloaded, something to keep maybe in mind

earnest phoenix
near stratus
errant flax
small tangle
#

im using emphemerals for error messages to keep the chat cleaner

errant flax
#

i mostly use ephemeral messages to keep chat cleaner danceydance

#

except for some cases,
like ban warn etc.

earnest phoenix
marble juniper
#

it shouldn't be

#

lol

earnest phoenix
#

I need to take a bath now brb sad

small tangle
#

should be fine, just dont spam the api i guess

marble juniper
#

yes

earnest phoenix
#

ok

small tangle
#

but i guess most wrappers handles ratelimiting before you hit the limit

errant flax
#

djs v13 doesnt anymore

small tangle
#

well

marble juniper
#

doesn't djs queue the request

#

if it got ratelimited

errant flax
#

i think ive remembered something that djs community says that v13 doesn't handles the ratelimits anymore

marble juniper
#

thats stupid

#

at least let the request be queued

#

lol

errant flax
#

wdym by that?

marble juniper
#

like if you got ratelimited

errant flax
#

stop the action or something?

marble juniper
#

it sends the request after the ratelimit cooldown is over

hollow depot
#

i have a question, in djsv13, can i use ephemerals also without interactions? like, with a โ€˜normalโ€™ command

errant flax
#

until the ratelimits is gone?

#

oh..

marble juniper
#

yes

#

it resends the request

#

after the cooldown is over

#

so like if ur ratelimited for 10s

#

it sends it after 10 seconds again

#

when its no longer ratelimited

#

lol

errant flax
#

dont think djs v13 do that anymore

small tangle
errant flax
#

i remembered me getting ratelimited, it didnt queued the req

#

dont ask why/how i got ratelimited but misosface

marble juniper
#

they can only be used in slash commands

hollow depot
#

k, thanks

#

that sucks tbh but anyway

marble juniper
#

article says so too

small tangle
#
while (true) {
    event.getChannel().sendMessage("To the ratelimit and back!").queue();
}

Kappa

hollow depot
errant flax
#

you can only send ephemerals with interactions for eg.
slash commands, btns, context menus

small tangle
#

no like in terms of ratelimiting

#

i mean it would spam ton of messages

#

its the java wrapper of discord

lethal trout
#

in my purge cmd
How would it be if I don't want it to delete pinned messages?

woeful pike
small tangle
#

this too

#

but in my very first beginnings of learning JS and coding a discord bot i forgot to check if the author is a bot... well my chat was full pretty fast

errant flax
small tangle
#

smooth brain moment

errant flax
#

bet the bot had a lot of levels/j

small tangle
#

levels? :o

wooden kindle
#

how do u find out the biggest Guild ur bots in

feral aspen
wooden kindle
#

i mean i just wanna know how

#

or code

#

something like that

#

if its the name of the server

#

the inv link anything

small tangle
#

you could compare the membercount of each guild

feral aspen
#

I can write it for you.. but I hope you could understand how I did it.. since I'm not only going to spoonfeed.

feral aspen
#

Let me write it...

wooden kindle
wooden kindle
feral aspen
#

Yes.

wooden kindle
#

okay good

feral aspen
#

Please understand the code afterwards.

#
let orderedMap = bot.guilds.cache.sort((a, b) => b.memberCount - a.memberCount);

let i = 0; // Start of for loop.
let msg = ""; // Starts as empty string to start adding the servers' name, member count (which you will see below)

for (const key of orderedMap.keys()) { // Start of for loop
    if (i >= 30) break; // Showing Top 30 servers.
    let guild = orderedMap.get(key);
    msg += guild.name + " - " + guild.memberCount + "###"; // How you organise the list.
    i++;
};

msg.split("###")
wooden kindle
#

i dont understand what tf this is

feral aspen
wooden kindle
#

ok ok i see

#

top 30 servers i see

#

i put this in index file im guessing ye

feral aspen
#

What??

small tangle
#

msg[0]? FeelsSmartMan

#

index on a string?

feral aspen
#

Woops.

rocky hearth
feral aspen
#

That returns the object.

feral aspen
rocky hearth
#

he does want the guild with max members right?

feral aspen
#

By the way.. I have a question. Writing it down...

#

I have this leaderboard command which takes from all the document in my MongoDB database and loops around them making it a leaderboard.. now is there a way to try getting the leaderboard for the specific server the command is executed in only not the global one?
I believe I have to try fetching, do some code to get the users who has a document in the server the command is executed in.. and check if the user has a document then add him to the list?
https://sourceb.in/zLHskSoVy5

hot star
#

I guess you have to make separate table for each server

rocky hearth
#

I would be saving the user data along with guild Id. So I could fetch all the docs having a specific, guildId

#

than it would go normal, as u r doing with the global leaderboard, just that, it would filter out the docs u dont need at first place

hot star
#

Rn i am storing all user data with their ID

#

as an key

feral aspen
#
name: "HamoodiHajjiri",
userID: "528256079101034506",
lb: "all",
money: 10586811,
bank: 20
#

That is how I do it? (Ignore "name")

hot star
#

not perfect for all situation but works for me

feral aspen
rocky hearth
#

do u want the user data to be same, in all guilds? If the user is in multiple guilds?

feral aspen
hot star
feral aspen
#

Damn..

hot star
#

I only do global leaderboards xD

feral aspen
#

Can't I loop through all the users in the server, check if each user has a document, if so, add his ID to the array, then descend the array from the greater coins to low?

#

.. or is that rate limit/API abuse?

hot star
rocky hearth
rocky hearth
#

that would require to access the database multiple times.

feral aspen
#

I don't think?

rocky hearth
#

would be very slow.

feral aspen
#

Yeah.. would be.

#

For each user having a document, if do, then add his id to the array, yeah, too slow.

#

@drowsy crag

hot star
#

y u don't give up?

#

same link for idk how long it will not work

feral aspen
#

L

hot star
#

mods please delete this scam link before some use it

feral aspen
#

Probably 10 people clicked already. ๐Ÿ˜‚

quartz kindle
#

i sure did

hot star
#

lol

feral aspen
quartz kindle
#

nah

feral aspen
#

.. they do get your IP, afaik?

quartz kindle
#

they're likely recording whatever you type in username/password, so im sending them garbage

#

they cant do anything with my ip

small tangle
#

whats next? sign into steam using your discord?

feral aspen
feral aspen
#

Sign into YouTube using snapchat.

#

Get free nitro by entering your credit card. ๐Ÿ˜‚

earnest phoenix
quartz kindle
#

all websites track your ip anyway

feral aspen
#

True.

hot star
quartz kindle
#

i believe someone here already did

hot star
#

300 response / sec

quartz kindle
#

they got ratelimited by the scammers

#

lmao

feral aspen
#

I know some dumbass developers like to use their IP for an advantage, they usually tell you (try this website), if I don't like it, they use my IP and start threatening, this is why I use a VPN.

quartz kindle
#

using your ip as a threat is not worth anything

rocky hearth
#

what's the difference?
/\n+/ and /[\n]+/

quartz kindle
#

its an empty threat

feral aspen
quartz kindle
#

its like trying to scare you with a rubber knife

rocky hearth
feral aspen
#

Uhm...

#

I need to figure out what \n was again, I know it makes a new line. ๐Ÿ‘€

#

OH.

hot star
#

"/[\n]+/" this is regex probably

rocky hearth
#

that regex is for replacing multiple new lines with a single one
but what [ and ] is for?

feral aspen
#
/\n+/

.. basically finds a new line in a string.

quartz kindle
boreal iron
feral aspen
#
let string = "Hello there.\nI am HamoodiHajjiri";
let reg1 = /\n+/;
let reg2 = /[\n]+/;

console.log(string.match(reg1)); // [" "]
console.log(string.match(reg2)); // [" "]
#

Weird.

rocky hearth
#

they both are doing the same thing, yes! why?

hot star
feral aspen
#

[ ] means a set of characters.

rocky hearth
#

so here, i dont need one. right?

feral aspen
#

After further testing.. no.

hot star
earnest phoenix
#

How could i track top.gg votes in my bot

boreal iron
#

You wanna use global and multiline as flag to let the regex donโ€™t stop after the first match

#

/โ€ฆ/gm

rocky hearth
#

I want a regex, to match multiple new lines, not a single one. How do I do that

feral aspen
boreal iron
#

Did you read what I wrote above your message?

real helm
#

Hello

#

Who help me to do a regexp for js

real helm
#

I have that: /\d{1,3}/gm

#

for match all 1-3 long numbers

#

thats good

young rune
#

@warm swan speak here

real helm
#

but i need to match this: 1/4

warm swan
#

How do i set the dots in the top.gg desc?

real helm
young rune
young rune
real helm
#

oh okay okay, my bad

young rune
#

like <a> and basic headers

#

else markdown will also do the trick

warm swan
#

oh

quartz kindle
#

wdym set the dots?

warm swan
boreal iron
#

He means a HTML li

quartz kindle
#

ah

#

you can do that with markdown

boreal iron
#

<ul>
<li>item</>
<li>item</>
</ul>

spark breach
#

Hello people, I am trying to make a ban command but I can't figure out how to find out if a person has a higher role or not. Can anyone help? I've tried searching on google and this is what they recommended, didn't work

                        message.channel.send(Error4);```

member is a const for ```const member = message.mentions.users.first();```
and Error4 is an embed

Thanks in advance!
warm swan
#

i never coded in html

quartz kindle
#
* item
* item
  * subitem
young rune
young rune
warm swan
#

what does

<ul>
<li>item</>
<li>item</>
</ul>
``` do?
young rune
#

it is much easier.

boreal iron
#

Well yes or markdown

young rune
#

but i won't use lists anymore

warm swan
#

is there a eval command in the server?

young rune
#

i rather use <br> all the way

#

xd

young rune
warm swan
#

to test the code

#

lol

#

like

#

.eval [code]

young rune
#

wdym?

warm swan
#

just pass it ๐Ÿ˜‚

young rune
#

mk

warm swan
#

is a command to check a code

young rune
#

mk

#

noted

#

ima look up on that-

warm swan
#

how do i set links?

young rune
#

read

boreal iron
#

There are bot in here but who knows their command prefixes

spark breach
young rune
#

i can't ever remember prefixes

#

nor my own bot

#

urgh

spark breach
#

oof

young rune
#

i made it well dam confusng

warm swan
#

@young rune make a check prefix command

#

when the bot is mentioned

spark breach
#

I just made mine *

young rune
#

i know

#

im just lazy

#

:/

#

cause i made changeprefix commands

#

which makes me literally forget

warm swan
#

i have that too

young rune
#

as i have to check what server

#

:/

quartz kindle
#

that wont be a problem anymore when you move to slash commands

young rune
#

mhm

quartz kindle
#

:^)

boreal iron
#

Aye

#

Was about to say it

young rune
#

but slash commands ain't on discord.py yet officially

real helm
#

how can i regexp that 1/4 to work with any number

young rune
#

:<

warm swan
#

i will try to use the code that @boreal iron sent

young rune
#

am using third-party libraries

#

but their slash commands don't even work

#

so-

#

only buttons do.

spark breach
#

oof

quartz kindle
#

cant you just use their dev version?

young rune
rose warren
young rune
#

why would i do that

quartz kindle
#

d.py dev should support that already

quartz kindle
#

better than using third party libs

young rune
warm swan
#

i m already lost

#

๐Ÿ˜‚

young rune
warm swan
#

Ohhh

#

i see i see

young rune
warm swan
#

nah i got this

young rune
#

using <> can be confusing at times

warm swan
#

nah dw

young rune
#

with markdown all you gotta do is write -

#

:/

warm swan
#

what about the other buttons?

young rune
#

liek text links?

warm swan
#

just another type of buttons

#

like

#

circle

young rune
#

do <a href="yourlink"> your text here </a>

warm swan
#

a empty circle

young rune
warm swan
#

<a href="yourlink"> your text here </a> this also helps

young rune
#

<button style = "border-radius: 50px;"> hi </button>

#

it'll make the button circly

warm swan
#

alright

#

awesome

boreal iron
#

50% not 50px

young rune
#

i use px sorry

rose warren
#

border-radius: 50% is better practice. It'll always be round no matter how big the element is.

quartz kindle
#

for you to see the difference

rocky hearth
#

with regex, I want to select more than one repeating A
"helloAthereAAworldAAA" - I only want to select AA and AAA here.

young rune
boreal iron
#

Eww Tim go away with your magical converter

young rune
#

if you alr know html what for learn markdown on the same thing :/

quartz kindle
#

its literally a pic from google images

boreal iron
young rune
#

XD

rose warren
#

Oh there I was thinking Tim went to all that trouble n all

#

I was having a moment

boreal iron
#

Me too

young rune
#

nice

quartz kindle
#

i went through the trouble of searching for it

young rune
#

is it really hard

quartz kindle
#

took a whole minute

young rune
#

bet google finds that for me...

#

:/

quartz kindle
#

:^)

young rune
#

..

quartz kindle
#

lmao

young rune
#

mac deleted the message

#

O_O

rose warren
#

๐Ÿ˜‚

warm swan
boreal iron
warm swan
#

didnt set the button

#

empty one

young rune
#

wdym empty?

warm swan
#

wait

warm swan
#

i used the link script

quartz kindle
#

dont feel like getting up yet

warm swan
#

holy crap

boreal iron
#

lol

quartz kindle
#

perks of being unemployed

boreal iron
#

Yeah woke up 15 mins ago bc you knowโ€ฆ something wanna gets out my body okeh

young rune
#

technically i think asking google to search for u is more efficient

#

then searching google manually

warm swan
#
<button style = "border-radius: 50%;"> hi </button>
young rune
#

you'll miss out a whole bunch of details

warm swan
#

do i gotta change the button style?

young rune
young rune
#

for the circly part

warm swan
#

How lol

quartz kindle
#

you need to learn css

boreal iron
young rune
#

just use markdown damn

#

:/

quartz kindle
#

dayum

young rune
#

if html isn't ur thing

quartz kindle
#

you cant style with markdown alone

young rune
#

mhm

quartz kindle
#

you need css for styling

young rune
#

yeah

#

but you need to learn slowly

#

html is quite easy ngl

#

@warm swan if you are still lost, you can try w3schools or other docs about html

#

they have a pretty rich doc

sterile thicket
#

Is this a spam?

setInterval(() => {
      bot.user.setActivity(`I have around ${bot.guilds.cache.reduce((x, y) => x + y.memberCount, 1)} Members. Lmao!`, { type: 'LISTENING' });
    }, 60*1000);```
warm swan
#

i am trying not to get confused

young rune
sterile thicket
young rune
#

...

#

aiyo

warm swan
#

can't reach that page

young rune
#

what was that webpage

sterile thicket
#

anyone else?

young rune
#

oh

#

finally

sterile thicket
young rune
rose warren
#

It's too often in my personal opinion but... Technically...

young rune
#

:/

sterile thicket
boreal iron
rose warren
#

6s will get you rate limited

boreal iron
#

Oops wrong person

#

Damn

#

Wtf how did that even happen waitWhat

sterile thicket
quartz kindle
#

also, why is the reduce starting at 1 :^)

warm swan
#
<html>
<title>MODULES</title>
</html>
#

like this?

#

lol

sterile thicket
boreal iron
#

Nothing usually starts by null, yes

quartz kindle
#

well yes, unless you want your total count to have 1 extra member in the end

#

xD

rose warren
#

Well... Members also doesn't mean anything either but... ๐Ÿ˜‚

young rune
#

that sets the title page

#

but uhhh

#

not nessary...

#

cause top.gg alr has a title for u :/

#

unless its an iframe

rose warren
#

My bot has over 1 million members across the servers it's in but only about 100k people with bot profiles. Members is a pointless statistic. They don't all use your bot.

quartz kindle
#

top.gg takes your html code and puts it inside an existing page

young rune
#

sigh'

quartz kindle
#

the existing page already has those, so dont put them yourself

young rune
#

wait

#

i don't even use doctype...

#

hehe

#

nor head