#development

1 messages · Page 1355 of 1

hollow sedge
#

then in your later_time do now.day+1

earnest phoenix
#

kk

#

would this be a correct full code?

now = datetime.datetime.now
later = datetime.datetime(now.year, now.month, now.day+1, hour=0, minutes=0)
wait_for_seconds = (now-later_time).total_seconds()
await asyncio.sleep(wait_for_seconds)
func(),start
#

and then the func

hollow sedge
#

yes

#

without the () on func tho

earnest phoenix
#

will it be func().start?

#

kk

hollow sedge
#

func.start()

earnest phoenix
#

kk

#

thx

#

I just typed "reboot" in my ssh client

#

and now i cant acces my vps anymore

floral rune
#

@earnest phoenix try this maybe it will help ```js
bot.on('presenceUpdate', (_,newPresence)=>{
newPresence.member.guild.roles.get('role id').then(role=>{
if (newPresence.activities.find(({type,state})=>type==='CUSTOM_STATUS'&&state&&state.includes('server link'))) {
newPresence.member.roles.add(role)
} else {
newPresence.member.roles.remove(role)
}
});
})

hollow sedge
#

@earnest phoenix there might be another module that is better than datetime because it requires a bit of tweaking before you get the date right each time you start (like if the time has already passed on the day you have to do now.day+1) but just know the basic premise is finding the difference in seconds between now and your time and asyncio.sleep for that amount of time

earnest phoenix
#

yeah got it thanks!

sudden geyser
hollow sedge
#

@earnest phoenix let me know if it works

cloud pebble
#

I get the feeling it's to do with the latest intents update but anyone know why the bot can send DMs to some users and not to others?

hollow sedge
#

@cloud pebble no some users have dms turned off

floral rune
#

@earnest phoenix sorry replace roles.get with roles.resolve

cloud pebble
#

DMs are definitely not turned off, the same users that could receive a DM yesterday can't today after I updated the bot library

hollow sedge
#

how are you getting the user to send the dm to?

floral rune
#

sharding weirdness maybe?

cloud pebble
#

using ctx.author and then sending a DM with user.send()

floral rune
#

wait resolve is synchronous oops

hollow sedge
#

@cloud pebble you mean ctx.author.send(message)?

floral rune
#
bot.on('presenceUpdate', (_,newPresence)=>{
    const role = newPresence.member.guild.roles.resolve('role id');
    if (newPresence.activities.find(({type,state})=>type==='CUSTOM\_STATUS'&&state&&state.includes('server link'))) {
        newPresence.member.roles.add(role)
    } else {
        newPresence.member.roles.remove(role)
    }
})
cloud pebble
#

actually I just double checked:

user = bot.get_user(USER_ID)
await user.send(message)```
hollow sedge
#

i think you need to enable the members intent to use bot.get_user

cloud pebble
#

hmm that was my guess, wanted to get a second opinion first

floral rune
#

wtf
are you sure the error is in that code

vale juniper
#

Hey, I currently working on a Web Interface for my Discord Bot and I'm struggling with the discord oAuth2. I can already identify user and I added guilds as scope, but how can I access the guilds and other data now. working on nodejs btw

floral rune
#

@earnest phoenix ```js
bot.on('presenceUpdate', (_,newPresence)=>{
const role = newPresence.member.guild.roles.resolve('role id');
if (newPresence.activities.find(({type,state})=>type==='CUSTOM_STATUS'&&state&&state.includes('server link'))) {
if (!newPresence.member.roles.cache.has(role)) newPresence.member.roles.add(role)
} else {
if (newPresence.member.roles.cache.has(role)) newPresence.member.roles.remove(role)
}
})

#

maybe it throws the error trying to add a role that you already have?

umbral zealot
#

Maybe add some goddamn spaces to this code >.<

floral rune
#

bot.on("presenceUpdate",(e,r)=>{const s=r.member.guild.roles.resolve("role id");r.activities.find(({type:e,state:r})=>"CUSTOM_STATUS"===e&&r&&r.includes("server link"))?r.member.roles.cache.has(s)||r.member.roles.add(s):r.member.roles.cache.has(s)&&r.member.roles.remove(s)});

umbral zealot
#

@strange raven Since today (Oct 27) the privileged intents have been disabled, so it no longer loads all the members by default. But, this isn't a problem for you. You are probably checking the amount of cached users, the users the bot has seen, which will be lower without the member and presence intents (which is good, your bot will use less ram). Instead of looking at the cached user count, you would need to add up the member_count property of every guild individually. That way you can get the number of users without having to cache the entire lot. Less ram, much faster, everyone wins.

dark grove
#

Making a bot that if it detects a message other than "pog" it starts screaming violently but I can't see what is making it not work. Code:


  if (message.content === `pog`) {
        return;
  }
  else if (
      message.channel.send(`HOW DARE YOU NOT FOLLOW MY RULES`);
  )

});```
strange raven
#

cool thanks evie

floral rune
#

@earnest phoenix its the same as the other one

#

hmmm

umbral zealot
#

@dark grove else if(message.channel.send()) isn't a valid condition

#

you probably were looking for just else, not else if

floral rune
#

you don't even need else since you return from the if

umbral zealot
#

You could also shorten this to if(message.content !== 'pog')

dark grove
#

Thanks!

floral rune
#

i must make it shorter

#
bot.on('message',m=>m.content!='pog'&&m.channel.send`HOW DARE YOU NOT FOLLOW MY RULES`);
strange raven
#

@umbral zealot do you know what to enter to get the member count in the code

floral rune
#

it's similar but it does a lot of unnecessary tests

umbral zealot
#

Depends on the language and library, but you literally just have to add up the member counts of each guild.

dark grove
#

do you know what to enter to get the member count in the code
@strange raven is it not message.guild.memberCount in node.js?

strange raven
#

👍

#

yes

dark grove
#

or sorry just MemberCount

vocal sluice
#

i have a help command and on it i have it so you can do say !help command with if (args[0] == 'command') but it sends the main help page and the command page. how would i make it so it only sends the command page?

floral rune
#

i'm actually not sure how it thinks a role object isn't a role

#

i have a help command and on it i have it so you can do say !help command with if (args[0] == 'command') but it sends the main help page and the command page. how would i make it so it only sends the command page?
@vocal sluice send the whole if statement

#

@earnest phoenix you don't give roles anywhere else in the bot?

vocal sluice
#
    let embedcommand = new MessageEmbed()

_my embed stuff goes here_
        message.channel.send(embedcommand)
} ```
floral rune
#

send the whole execute() if possible

strange raven
#

it keeps saying undefined

#

im kinda stupid

floral rune
#

but i am assuming the issue is this: send help embed if (command) send command embed when it should be ```
if (command) send command embed
else send help embed

zenith knoll
#

how do you do a reaction collecter with multiple emojis?

earnest phoenix
#

@hollow sedge There is an error:

Ignoring exception in on_ready
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/discord/client.py", line 333, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 124, in on_ready
    later = datetime.datetime(now.year, now.month, now.day, now.hour, now.minute+1)
AttributeError: 'builtin_function_or_method' object has no attribute 'year'

basically it is saying that now.year is not valid

#

fyi i made it minute+1 for testing purposes

#

I dont do js...

sudden geyser
#

that is quite messy

earnest phoenix
#

@earnest phoenix Do oldPresence && oldPresence // whatever else

dark grove
#

BTW how scared should i be if ESLint finds a bunch of unused variables in my code? Is it just my shit programming or is it normal when dealing with node?

earnest phoenix
#

Unused variables are no threat to the actual code

sudden geyser
#

Assign stuff to variables to bind them to a value.

#

If you don't use them later on you don't need them to be variables.

#

They're not a threat to your actual code like Voltrex said

dark grove
#

Like my stuff still works, just has a lot of errors

#

If you don't use them later on you don't need them to be variables.
Oh ok

sudden geyser
#

You could set up a .eslintrc.json file to change it from displaying as an error to a warning.

earnest phoenix
#

@earnest phoenix js bot.on("presenceUpdate", (oldPresence, newPresence) => oldPresence && !oldPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) && newPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) ? newPresence.member.roles.add("Role ID") : oldPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) && !newPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) ? newPresence.member.roles.remove("Role ID") : null);

hollow sedge
#

@hollow sedge There is an error:
basically it is saying that now.year is not valid
@earnest phoenix do now = datetime.datetime.now()

earnest phoenix
#

Probably the second check

#

@earnest phoenix do now = datetime.datetime.now()
@hollow sedge ah ok

#

@earnest phoenix js bot.on("presenceUpdate", (oldPresence, newPresence) => oldPresence && !oldPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) && newPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) ? newPresence.member.roles.add("Role ID") : oldPresence && oldPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) && !newPresence.activities.find(a => a.type === "CUSTOM\_STATUS" && (a.state && a.state.includes("Server link here"))) ? newPresence.member.roles.remove("Role ID") : null);

dark grove
#

How do you give a bot a custom status in discord.js?

#

Do you have to log in as them and change it or can it be done in the index.js file?

sudden geyser
#

You can't set custom statuses as a bot user.

earnest phoenix
#

Bots can't have a custom status

sudden geyser
#

You can read them, but you can't create them.

dark grove
#

I meant more like

earnest phoenix
#

You can set playing, watching, streaming, listening and competing activities

dark grove
#

WATCHING DISCORD BOTS

sudden geyser
#

That's just a regular status.

#

You an use <Client>.user.setActivity to accomplish that.

earnest phoenix
#
<client>.user.setActivity("status", {
type: "PLAYING or STREAMING or LISTENING or WATCHING or COMPETING"
});```
dark grove
#

And can it only be one of those? Or are those just examples?

earnest phoenix
#

It can only be one of them

#

@hollow sedge no errors but nothing got sent

dark grove
#

Thank you wise ones of the Discord Bot List, wouldn't have even gotten past line one without the help here

hollow sedge
#

@hollow sedge no errors but nothing got sent
@earnest phoenix weird..can I see the whole thing again (not the file, just the task function and wherever you are starting it from)

earnest phoenix
#

i think i know the problem

#

lets just not define a function

#

and just do it after the on_ready

#

i think that might work

hollow sedge
#

Ig but it won't run in a loop

earnest phoenix
#

it will

hollow sedge
#

(once a day)

earnest phoenix
#

i can put it in While True:

#

because it is asynchronous

hollow sedge
#

That's a bad idea but ok

#

Just because it's in an async func doesn't mean it's async

#

It might block everything

grizzled raven
#

anyone know what kurasuta's development mode is?

hollow sedge
#

@earnest phoenix ?

#

I just saw ur tag lol

earnest phoenix
#

o thats not the case

#

i ran a while true once

#

in on_ready

#

it didnt block

hollow sedge
#
now = datetime.datetime.now()
later = datetime.datetime(now.year, now.month, now.day, now.hour, now.minute+1)
wait_for_seconds = (later-now).total_seconds()
await asyncio.sleep(wait_for_seconds)
func.start()```
#

@earnest phoenix does yours look like this ^

earnest phoenix
#

yes it does

hollow sedge
#
@tasks.loop(seconds=3)
async def func():
  print("a")```
#

does your task look like that ^

#

@earnest phoenix

earnest phoenix
#

no

#

i was not doing tasks

hollow sedge
#

i dont understand

earnest phoenix
#

ill be fixing this later have some work to do

hollow sedge
#

ok

earnest phoenix
#

bye thanks for the help!

hollow sedge
#

bye

#

i hope you figure it out!

pale vessel
#

i was not doing tasks
@earnest phoenix sus

earnest phoenix
#

oops

#

Show your actual code

#
bot.on("presenceUpdate", (oldPresence, newPresence) => newPresence.guild.roles.cache.has("749507562155802664") ? oldPresence && !oldPresence.activities.find(a => a.type === "CUSTOM\_STATUS" &&
(a.state && a.state.includes("server link"))) &&
newPresence.activities.find(a => a.type === "CUSTOM\_STATUS" &&
(a.state && a.state.includes("server link")))
? newPresence.member.roles.add("749507562155802664") :
oldPresence && oldPresence.activities.find(a => a.type === "CUSTOM\_STATUS" &&
(a.state && a.state.includes("server link"))) &&
!newPresence.activities.find(a => a.type === "CUSTOM\_STATUS" &&
(a.state && a.state.includes("server link"))) 
? newPresence.member.roles.remove("749507562155802664") : null : null);```
#

@earnest phoenix

#

Np

ancient thunder
pale vessel
#

get a slower host

#

easy fix

faint prism
#

Lol

grizzled raven
#

do you still provide shard info in client options if you use a sharding manager like kurasuta?

boreal iron
#

get a slower host
lmao

stark abyss
#

anyone know any fun / entertaining free public apis?

earnest phoenix
#

how can i make my bot an app for discord? I don't even know where to start

robust hound
#

Can someone explain what Itent means

boreal iron
#

The word intent itself is basically the best explanation
You’re defining the intents of the bot, just the events u wanna listen to

#

Imagine the amount of data the web socket receives every moment on large servers

#

Instead of listening to all events you have to define what events u wanna listen to, the test won’t be transmitted through the web socket connection

robust hound
#

Hi, I am a bot developer verified by discord, and I opened a ticket in my bot called badduck called asset intention - I want to open the intention properties of server members discord

earnest phoenix
#

discord really doesn't want you to use the gateway anymore lmfao

#

they want you to move to stateless design with slash commands

strong tundra
#

I hate Data bases, i have the code but It's not f*cking working

earnest phoenix
#

your code is wrong, so try using the Base Date app

boreal iron
#

Most important things of the 20th century

strong tundra
#

sir i do not know what that is

boreal iron
#

*21th lmao

strong tundra
#

i use the discord bot maker app sir

earnest phoenix
#

what base date do you use? quick.db?

boreal iron
#

date != database

leaden jay
#

h

boreal iron
#

God ...

earnest phoenix
#

how can i use discord's rich presence system?

boreal iron
#

Did u read the docs?

#

Try to use the align tag on the image and choose bottom or top

#

If that doesn’t work I have to use table around both and set a vertical align

#

Table in form of a div defining a table and inner tablr-cell also works

#

Correct

#

That’s why I told u the 2nd method

#

Put a div around and use vertical align

#

Defining it as table-cell

grizzled raven
#

is there anything wrong with saving dates as numbers?

boreal iron
#

U mean as timestamps?

grizzled raven
#

yes

boreal iron
#

What do u mean with wrong?

grizzled raven
#

like

#

hm

#

eh nevermind

boreal iron
#

It doesn’t make a difference to a database, u just have to get the date of the timestamp always if u need it in datetime format

faint prism
#

nothing wrong with storing meaningful data, as long as the format makes sense without losing meaning

#

could even store it as ticks

#

but most dbs support Date as a datatype

boreal iron
#

Actually it’s called datetime

#

Date and time as datatype also exists

#

As well as timestamp which is just an integer

faint prism
#

Well in MS SQL I know it's "Date". But there are more

boreal iron
#

Depends on what u need

#

Eww MS SQL

faint prism
#

It's what I'm covering in my database design class

#

It applies to any SQL

#

It's a means to an end. The syntax is the same

boreal iron
#

Well whatever u need, it covers a lot of datatypes

faint prism
#

Eww MS SQL
@boreal iron Is this a personal bias, or do you genuine think the database system Microsoft has been working on for 30 years is just bad?

#

I suppose things 30 years in the make could snowball some technical debt

boreal iron
#

Nah I prefer db systems actually having a higher compatibility
Using dbs in desktop apps, web backends etc. and on third party apps on mostly MS isn’t supported

faint prism
#

What do you mean by "higher compatibility"?

boreal iron
#

I prefer MariaDB nowadays which is perfect for my needs, which doesn’t mean ur opinion has to be same

faint prism
#

I'm not advocating MS SQL dbms. Haven't used it much at all yet in the semester tbh

#

Just curious for your reasoning

boreal iron
#

Well most apps, frameworks are compatible with multiple storage system mostly not ms sql

#
  • I’m working on or using
earnest phoenix
#

reading above

#

you're better off storing as a date type, not the timestamp

faint prism
#

I haven't run into issues implementing connection to databases yet personally

earnest phoenix
faint prism
#

oh no

#

another overflow issue lol

boreal iron
#

I haven't run into issues implementing connection to databases yet personally
Like I said depends on what u do.
I have lots of telemetry data from iOS devices, from backends of websites etc.
Not every platform, system or frameworks supports MS SQL but most are supporting MySQL/MariaDB

#

That’s why I’m using this one

faint prism
#

@earnest phoenix did you see what John hammond posted on yt today about the CVE regarding a sudo underflow vuln?

boreal iron
#

And instead of MySQL Oracle ripped like anything they buyed MariaDB is being worked on - still

earnest phoenix
#

nope i haven't been on my pc for the entire day i had a 10hr day at school feelsbad

#

LOL

#

i just saw it

faint prism
#

Essentially it was doing something like sudo su -u#-1 or something

#

I can't find it

#

but referenced a user id outside the memory range

#

what was the CVE id?

earnest phoenix
#

yeah

faint prism
#

I remember seeing one CTF he was running with some buddies where he does something like cat /dev/urandom > /proc/anotherCtfSshConnectionId and it completely garbles that guys shell

earnest phoenix
#

that's fucking insane

#

and it's only recent

full mortar
#

can anyone tell me what's wrong with this?

umbral zealot
#

nothing in particular

#

except that's either a wrong ID, or you don't share a guild with the user, or, maybe, you're not in an event so users haven't loaded yet.

earnest phoenix
full mortar
#

a

#

ok

umbral zealot
#

@harsh rose Since Oct 27, the privileged intents have been disabled, so it no longer loads all the members by default. But, this isn't a problem for you. You are probably checking the amount of cached users, the users the bot has seen, which will be lower without the member and presence intents (which is good, your bot will use less ram). Instead of looking at the cached user count, you would need to add up the member_count property of every guild individually. That way you can get the number of users without having to cache the entire lot. Less ram, much faster, everyone wins.

harsh rose
#

Thnx

full mortar
#

everyone wins

#

hmmmm

#

so how do i get an user from another server now?

sudden geyser
#

You could fetch the user by their ID.

#

By using bot.users.fetch(...)

#

Keep in mind that fetches any Discord user. It's not limited to the scope of what servers your bot is in.

full mortar
#

ok

#

so it would be like bot.users.fetch('707638647977017364')?

sudden geyser
#

Yeah that should work.

#

It returns a promise resolving to a user object

zenith knoll
#

yo

sudden geyser
#

yes

zenith knoll
#

how casu you check what reaction they reacted to

#

in a awaitreaction

pale vessel
#

yes

sudden geyser
#

The first parameter of filter is the reaction object.

#

So you can use reaction.emoji.name to get the name.

pale vessel
#

reaction.emoji is what you're looking for

zenith knoll
#

so

sudden geyser
#

Assuming that's a unicode emoji

zenith knoll
#

collected.first().emoji.name

#

yes

zenith knoll
#

:cancel_1:

pale vessel
#

yes

#

nah

#

cancel_1

zenith knoll
pale vessel
#

just cancel then

zenith knoll
#

yeaaaaaaaaaaaaaaaaaa

#

im doing it by id

#

is it ok?

pale vessel
#

yes

abstract perch
#

it comes from this

sonic lodge
#

message embed field values cannot be empty

abstract perch
#

yes, what's empty?

#

😂

sonic lodge
#

an embed field

abstract perch
#

hmm wait

#

there is no empty field

#

like, I have removed that event and it doesn't popup that error again

#

PROBABLY. If a new message is sent

sudden geyser
#

If you can reproduce the error, you should try logging the embed so you can see what field is empty.

abstract perch
#

it always happens

sonic lodge
#

i'd imagine it's the one called "old content"

abstract perch
#

yeah

#

most likely

sonic lodge
#

also is that a helper function to build an embed

abstract perch
#

yup

sonic lodge
#

you can just pass the object straight into send

abstract perch
#

may you be more specific please?

sonic lodge
#
channel.send({embed: {
  title: 'Example',
  description: 'Description',
}});```
abstract perch
#

let me try

sick cloud
#

dumb css question time, how do i make a button fill up it's entire div/space

#

tried width: 100% but no luck

earnest phoenix
#

Hey, I have this welcome message setup and it's not working, I feel like it's something obvious that I am just missing...

bot.on('guildMemberAdd', member => { member.guild.channels.get('762109185562247199').send("Welcome"); });
sonic lodge
#

whenever a new member joins, your code looks in the guild for a channel with id '762109185562247199'

sick cloud
#

do you have the new intent enabled

sonic lodge
#

that can't apply to all guilsd

pale vessel
#

dumb css question time, how do i make a button fill up it's entire div/space
@sick cloud try using display: block, you're probably using display: inline-block currently

sick cloud
#

@pale vessel tried that and it works but doesnt work also

pale vessel
#

is it local

sick cloud
#

yes

#

the padding kinda breaks

earnest phoenix
#

whenever a new member joins, your code looks in the guild for a channel with id '762109185562247199'
@sonic lodge yes, this bot is for my private server so it shouldn't matter-

sick cloud
#
.btn {
  color: white;
  background: #303030;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 2px;
}

.btn.block {
  width: 100%;
  display: block;
}
sonic lodge
#

ah i see

sick cloud
#

@earnest phoenix do you have the intent enabled

earnest phoenix
#

Private server...

sonic lodge
#

that or any errors?

earnest phoenix
#

No errors

sick cloud
#

you need it enabled to receive guildMemberAdd events

earnest phoenix
#

O

sick cloud
#

if you're going to ignore me i won't try to help you lol

earnest phoenix
#

I will enable that

sonic lodge
#

oh yeah intents are required now

pale vessel
#

try removing width: 100%;

#

i think that fucked up the padding

sick fable
#

Fuck CSS 🥺

earnest phoenix
#

uhhh- Still not working....

#

Fuck CSS 🥺
@sick fable +1

sick fable
#

❤️ JavaScript

earnest phoenix
#

si

sick fable
#

❤️ Python

#

💔 Html

earnest phoenix
#

frrrr

sick fable
#

@earnest phoenix ikr

earnest phoenix
#

Still confused....

sick cloud
#

doesn't fix it @pale vessel

#

i mean, it sorta does but the text is still on the left

earnest phoenix
#

Hey, I have this welcome message setup and it's not working, I feel like it's something obvious that I am just missing...

bot.on('guildMemberAdd', member => { member.guild.channels.get('762109185562247199').send("Welcome"); });
sick cloud
#

did you turn the intent on

#

in the developer portal

earnest phoenix
#

Yes.

sick cloud
#

do you have an eval command by any chance

earnest phoenix
pale vessel
#

center the text - text-align: center;

sick cloud
#

eval bot.emit('guildMemberAdd', <Message>.member) to make sure it's not your code

#

and okay

earnest phoenix
#

I don't have an eval command-

sick cloud
#

thanks flaze lol

#

okay

pale vessel
#

all good haha

sick cloud
#

button looks good

pale vessel
#

pog

#

that looks hot

earnest phoenix
#

eval bot.emit('guildMemberAdd', <Message>.member) to make sure it's not your code
@sick cloud what?

pale vessel
#

do you have an eval command?

delicate shore
#

I just got a Windows VPS

#

How to host 24*7 on that

earnest phoenix
#

If I use the code (return message.guilds.channels.send()), can I send a message to all the servers my bot is on?

sudden geyser
#

Your example is not correct, but it's completely doable.

#

It's not recommended though.

#

As you probably don't need to mass-message.

#

There are other means of informing users about changes. For example, a changelog command (or putting changes in your help command), status updates, etc.

earnest phoenix
#

I want to send messages to users who are using my bot randomly on their servers

sudden geyser
#

Why though? The user didn't request it.

earnest phoenix
#

client.on("ready", () => {
Console.log() return message.guilds.channels.send()
)}

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

Not function?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sudden geyser
#

Like I told you, the code you showed us wasn't correct from the start

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

You can review Discord.js' documentation to see how you can use its API.

earnest phoenix
#

I want to send system messages to users

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

I said this twice: you don't want to do that.

earnest phoenix
#

...

#

do not want to flood the server but inform

waxen tinsel
#

@delicate shore why a windows VPS?

sudden geyser
waxen tinsel
#

Thatll cost much more

sage bobcat
#

One message removed from a suspended account.

waxen tinsel
#

@earnest phoenix make something like that opt in at least

slender thistle
#

P.S. not everyone who uses X bot cares about its changes enough to be willing to receive random messages from it

earnest phoenix
#

hi need some help

#

when i type node main.js

#

in visual studio

#

it says

#

no such thing there

#

in mac

#

it begins with $

#

i want to change

#

it

sudden geyser
#

The $ is not important in this case.

#

When it says no such thing, is it saying something like node: command not found?

#

@earnest phoenix

delicate shore
#

@delicate shore why a windows VPS?
@waxen tinsel
Company sponsored my bot

#

But how to do it pls tell

peak patio
#

is it possible to use http://public_ip_ address as vote api webhook url ?

earnest phoenix
#

When it says no such thing, is it saying something like node: command not found?
@sudden geyser yes

#

and how do i install discord.js in ma

#

macbook

#

os

#

does anyone know how to get a user id by name#discriminator thru the discord api

#

I can only figure out how to get name#discriminator from user id

#

@earnest phoenix Using the raw api or a library?

#

raw api

#

Do you currently use any libraries? like discord.js

#

I use discord jda

#

but I wanna use my own

#

You're trying to make your own library?

#

kinda

#

just for my bot

#

I assume its possible even tho it think its not in the documentation

#

There's this endpoint of

guilds/:id/members/search<parameters>```
#

Idk what the params are though

#

hmmm

#

not rly what im looking for

#

ill do some more research ig

#

You said to get member by username#discriminator right?

#

That's what it's for

#

hi need some help
when i type node main.js
in visual studio
it says
no such thing there
in mac
it begins with $
i want to change
it

carmine summit
#

})```Won't run when a user joined the guild
earnest phoenix
#

You need the guild members intent to receive that event

carmine summit
#

AH YES

#

i forgot

#

thanks ❤️

forest drift
#

is it possible to have an embed with a link that when clicked the bot runs a functions as if someone typed a command?

pale vessel
#

yes

#

create a webserver/api for it

forest drift
#

ah ok

#

i was at one point trying to make it run a javascript bookmark code thingy but that didnt work, time to learn webservers i guess

sick cloud
#

how would i sanitize a string to only leave alphanumerical content (A-Z a-z and 0-9, no symbols etc)

pale vessel
#

regex, i guess

#

you can use string.split("").filter().join("") too

sick cloud
#

is that sort of like find and replace

pale vessel
#

just string.match()

sick cloud
#

oh ok

#

i found a regex that does it but it removes spaces to

#

where as i want to replace spaces with -

pale vessel
#

replace spaces beforehand

#

and include - in your regex pattern

sick cloud
#

so

title.replace(/ /g, '-').replace(/[^0-9a-z]/gi, '');
#

it uses /[^0-9a-z]/gi

#

so add a - in there

earnest phoenix
#

hi i neeed help

#

when i type node main.js in visual studio it says no such thing there in mac it begins with $ i want to change it

sick cloud
#

rephrase your question in english

earnest phoenix
#

@sick cloud wait i send sss

sick cloud
#

install node.js

#

it isn't installed

earnest phoenix
#

how to install

#

in mac

sick cloud
#

download for macos

earnest phoenix
#

oh

#

i see

#

thanks

pearl cloud
#

Hey I am a software developer, I would love to create bots for discord with different different functionalities

#

Can anyone connect me with some team?

sick cloud
#

just go make a bot then and publish it

pearl cloud
#

Okay sure I will.

earnest phoenix
#

ok

sick cloud
#

@pale vessel do you know much about regex btw

pale vessel
#

not much lmao

#

but i can always try to help if you need something

sick cloud
#

well my depressing way rn is just .replace(/<symbolhere>/g, '') and repeated like loads

#

so

pale vessel
#

lemme play around for a bit

sick cloud
#

👌

#

i wanna sanitize a blog title basically to a url friendly string

#

so Very Good Title! becomes very-good-title etc

earnest phoenix
#

I think I was sending a Buffer instead of a String so express sent an octet-stream

slender thistle
#

@sick cloud encodeURIComponent?

sick cloud
#

well that just replaces them with the &.. codes etc

slender thistle
#

Yeah, fair

pale vessel
#
let slug = "hello !world test 123 ".trim().toLowerCase().replace(/\s+/g, "-").match(/[a-z0-9-]+/g);
slug = slug ? slug.join("") : "bad slug";
slug; // "hello-world-test-123"```
#

hmm

earnest phoenix
#
slug = slug ?

wtf

pale vessel
#

it could return null if it didn't match the pattern

#

you can't join null so

#

if you're on node 14+ you can just use ?.join()

earnest phoenix
#

when i console.log(res.headersSent) it returns false

#

is that supposed to return false if the response hasn't been sent yet?

sick cloud
#

i guess

earnest phoenix
#

wizard

knotty sigil
#

does someone knows why my bot won't start? every time i need to change token to start it and when i turn off the bot it won't start again

earnest phoenix
#

@knotty sigil I suspect you don't have intents enabled

#

does someone knows why my bot won't start? every time i need to change token to start it and when i turn off the bot it won't start again

when i turn off the bot it won't start again
@knotty sigil I'm 99% sure you dunno how processes work

maiden drift
#

Who

#

Epic Bot in Afk

cold grotto
#

how do i make my bots status not disapear after awhile? heres my code:

client.once('ready', () => {
    console.log('Quack!');
    client.user.setActivity("Your Servers!", {
        type: "WATCHING",
      });
maiden drift
#

Dont wrong Server

#

but it used to be online

#

@xig

#

@coral trellis

coral trellis
#

?

#

-wrongserver

gilded plankBOT
#

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

coral trellis
#

We can't help you with that

maiden drift
#

🥺

#

😱

limber flume
cold grotto
#

-wrongserver

#

how do i make my bots status not disapear after awhile? heres my code:

client.once('ready', () => {
    console.log('Quack!');
    client.user.setActivity("Your Servers!", {
        type: "WATCHING",
      });
boreal iron
#

@cold grotto Create an interval, get the bots presence and if it’s different than the one u wanna have, use setActivity as u did in the ready event

cold grotto
#

how do you get the bots presence?

#

@boreal iron

boreal iron
#

Im not familiar with djs but the status is part of the client object

cold grotto
#
setInterval(async ()=>{
    await client.user.setActivity('Your Servers!', { type: WATCHING })
},10000)
#

UPDATED^^^

boreal iron
#

That’s an example of how to use the JS interval, aye

cold grotto
#

would that code work?

boreal iron
#

Just increase the interval timer a little bit, every 10s is not needed

cold grotto
#

every...?

boreal iron
#

10000 = 10 s

cold grotto
#

ik

#

but what would i set the interval as?

boreal iron
#

Idk every minute or more

cold grotto
#

100,000 = 10m?

boreal iron
#

Since u don’t check the actual status and just send an update

cold grotto
#

is 100000 10 min

boreal iron
#

Dude milliseconds

cold grotto
#

ooooh ok

boreal iron
#

Seconds * 1000

#

10 min = 60000

cold grotto
#

ok

earnest phoenix
#

That's 1 minute

boreal iron
#

Welp forgot a 0

cold grotto
#

would 5 minutes be good enough?

earnest phoenix
#

It's like normal seconds with extra 000 at the end

boreal iron
#

@earnest phoenix shh I’m driving meanwhile

cold grotto
#

is 5 mins good?

earnest phoenix
#

Bruh are you always driving mate

#

@cold grotto Yes, 360000

cold grotto
#

isnt it 300000

boreal iron
#

Tell him how to get the bots current status and how to update it if it’s different than the one it should be

#

Dunno djs

cold grotto
#

i figured it out

boreal iron
#

Bruh are you always driving mate
Aye life sucks

cold grotto
boreal iron
#

Correct 60s * 5 * 1000

#

In other words

cold grotto
#

how do i make my bot send random images from the web

earnest phoenix
#

I'm done with this fucking application/octet-stream shit I'm gonna go watch 3B1B's videos on neural networks

cold grotto
#

nice

#

have fun w that

#

why do people want your account?

#

"no i wont sell my account"

earnest phoenix
#

why do people want your account?
@cold grotto idk

cold grotto
#

mk

earnest phoenix
#

Wait you can modify the scroll bar in CSS overflow?

willow mirage
#

@earnest phoenix is another level now, He is enchanted bruhhhh

carmine summit
#
      message.channel.awaitMessages(filter, {
          max: 1,
          time: 600000,
          errors: ['time']
        })
```is `max: 1,` really required? Will it only work if it is set to `1`??
quartz kindle
#

if you dont specify it, it will only end after 600 seconds

carmine summit
#

?

earnest phoenix
#

@earnest phoenix it's not supported on all browsers but yes

carmine summit
#

Im confused

#

@quartz kindle I need help

#

I am making a thing like auto translate

#

what it does is translates the message

#

for 10 minutes

#

everytime he/she sends a message

#

it will automatically get translated

earnest phoenix
carmine summit
#

because

#

people too lazy to use copy/paste?

#

and go to goole and search "google translate"

quartz kindle
#

for this kind of thing its better to create a message collector

#

just be careful not to create multiple collectors accidentally

carmine summit
#

it takes 10.29 seconds to open up chrome then search "google translate"

#

for this kind of thing its better to create a message collector
@quartz kindle ???????

#

While it only takes 3.94 seconds to type ?autotranslate

earnest phoenix
#

it takes 10.29 seconds to open up chrome then search "google translate"
@carmine summit bro chrome takes a full Infinity seconds to open on anything but Android

carmine summit
#

so yeah

quartz kindle
#

you take almost 4 seconds to type that?

earnest phoenix
carmine summit
#

its Infinity% much better

#

alsoi had to stop/start the timer

#

that took me 2 seconds

quartz kindle
#

lmao

earnest phoenix
#

i might have a solution to this

carmine summit
#

?

earnest phoenix
carmine summit
#

Infinity/3.94

#

its so much better

earnest phoenix
#

it only takes 3.7 seconds to click the google translate extension and type my message then click translate, copy and send in the channel

carmine summit
#

nah you take 1 minute to install the extension

earnest phoenix
#

one-time thing

carmine summit
#

nah takes a minute to load chrome

#
  • intenet connection
#

1kbps

#

ERR_CONNECTION_TIMED_OUT

earnest phoenix
#

your choice do whatever you wanna do

#

I'll just tell you the main gist of how

carmine summit
#

okay

earnest phoenix
#
// when command ran
let oldMsg       =                  message;
let oldMsgTimestamp = message.createdTimestamp;
async function collector() { // creating a function cuz we're gonna call this again and again
  if (oldMsgTimestamp >= (Date.now() + 60000)) return // stops if the time of ten minutes has passed
  let newMsg = (await oldMsg.channel.awaitMessages(x => { x.id == message.author.id }, {
  max: 1,
  time: 0,
})).first(); 
  let translatedMsg = "translate newMsg smh";
  oldMsg.channel.send({ embed: {
    description: `Translated message: ${translatedMsg}`
}});
  collector(); // call this function again
}
collector(); // call this function at the start
#

@carmine summit

carmine summit
#

thanks for effort

earnest phoenix
#

nope

carmine summit
#

ill check it out

earnest phoenix
#

idk if this will even work

carmine summit
#

yes same thought

quartz kindle
#

i mean

#

djs has a built in collector

#

why not use it:

earnest phoenix
#

@earnest phoenix enchanted apple how to add embed with colour

#

😄

#

@earnest phoenix discord.js message embed: embed.setColor(/* A valid CSS color value */);

#

discord.js embed object: { color: /* A valid CSS color value */ }

#

U add embed on image file

#

oh you mean link embeds

#

No

#

Imgflip

#
<meta name="theme-color" content="/* A valid CSS color value */">
#

for link embeds

#

Ok

#

@earnest phoenix our pfp enchanted apple KEKW

#

yeah so?

steel canyon
#

guys I want to ask ...
How to make a simple welcome bot ??

earnest phoenix
#

@cloud pebble hacks?

cloud pebble
#

just a name lol

#

anyways i wanted to ask, does python's bot.get_user() fetch members from its members cache (i.e. will I need the members intent to use it properly)?

earnest phoenix
#

Why would you ask people to wish you good luck

steel canyon
#

Why would you ask people to wish you good luck
@earnest phoenix idk

earnest phoenix
#

Poor enchanted apple

willow mirage
#

LoL

midnight blaze
#

@earnest phoenix bad apple

earnest phoenix
#

no

#

good emergency food

#

how do you fetch all the users of the bot so it gets added to the cache

#

Using the respective function

#

?

#

<manager>#fetchAll?

quartz kindle
#

just use the fetchAllMembers option

#

but you need the GUILD_MEMBERS thing in the dev portal

carmine summit
#

?

steel canyon
#

Guys, How to make a simple welcome bot ?? (coding)

earnest phoenix
#

What language?

#

As welcome bot you mean a bot that says "Hello {user}" when a user joins the server?

steel canyon
#

As welcome bot you mean a bot that says "Hello {user}" when a user joins the server?
@earnest phoenix yes, maybe

earnest phoenix
#

What language?

steel canyon
#

indonesian

carmine summit
#

tf

earnest phoenix
steel canyon
#

...

earnest phoenix
#

Language = programming language, not language you talk

#

You're in dev channel sixfute

carmine summit
#

star that rn

steel canyon
#

Language = coding language, not language you talk
@earnest phoenix ohh

carmine summit
#

or i will go out

#

and cry

steel canyon
#

coding

earnest phoenix
#

I starred CatShrug

steel canyon
#

english

earnest phoenix
#

....

#

First learn what programming languages are, then learn one of them, then learn to make a discord bot ok?

#

Any one wana join my server

steel canyon
#

my english is bad T_T
i must Translate

earnest phoenix
#

@earnest phoenix No

steel canyon
#

First learn what programming languages are, then learn one of them, then learn to make a discord bot ok?
@earnest phoenix ok, I've made a discord bot

carmine summit
#

I can't star my own message lmao

earnest phoenix
#

Please

#

Stop advertising

#

@steel canyon What programming language do you know?

steel canyon
#

@steel canyon What programming language do you know?
@earnest phoenix idk

earnest phoenix
#

Then learn a programming language

#

And come back when you learned one

#

Which means: Not in 2 hours

steel canyon
#

where i can learn??

carmine summit
#

Which means: Not in one youtube tutorial

earnest phoenix
#

School, Books, Websites, ...

steel canyon
#

hmmm

#

Which means: Not in one youtube tutorial
@carmine summit my coding from youtube

carmine summit
#

yes

#

copy paste

#

yes

earnest phoenix
#

Yea well known copy paste

obtuse jolt
steel canyon
#

copy paste
@carmine summit yess

carmine summit
#

VirusTotal

earnest phoenix
obtuse jolt
#

give me the stupid answer

carmine summit
#

i duuno

obtuse jolt
#

fml

earnest phoenix
#

i duuno

carmine summit
#

oh wait

#

we already have a stackoverflow here in dbl

earnest phoenix
#

why would you even hide a few letters from a message Troll

carmine summit
#

@quartz kindle

quartz kindle
#

lmao

carmine summit
#

go help dis guy

#

ya know you should nickname yourself to "Stackoverflow"

#

so people are just gon

#

@brisk sparrow

#

wait wtf

#

nah nvm the bot is offline

earnest phoenix
#

and muted

midnight blaze
#

hi

carmine summit
#

@earnest phoenixoverflow

#

nooooo

earnest phoenix
carmine summit
#

i ddint mean to

earnest phoenix
carmine summit
#

such a coincidence that the guy i pinged is online

honest perch
#

you also revived him

carmine summit
quartz kindle
#

lmao

earnest phoenix
split peak
#

What bot scopes do I need. I currently have
-bot
-identify
-connections

Enabled. Would I need any others?

earnest phoenix
#

restart not working

#

it shutdown only

#

what do you think was going to happen

#

you exited the process

umbral zealot
#

@split peak well, what scopes do you actually need?

split peak
#

That's the point
I'm not sure.

earnest phoenix
#

Do all bots need intents or only 100+ guilds

umbral zealot
#

Are you making any website, Ciaran?

earnest phoenix
#

all bots are required to use intenta

split peak
#

I plan to in the future yes.

earnest phoenix
#

intents

#

Oh no

#

So i gotta enable in dashboard and code

umbral zealot
#

Well, "the future" isn't now, so for now, only the bot scope is necessary

pale vessel
#

if your bot is below 100 servers it doesn't need any whitelisting for privileged intents

umbral zealot
#

You can always edit this in the future when you actually need it.

earnest phoenix
#

you exited the process
@earnest phoenix how to resolve

split peak
#

Ok. Thanks Evie

earnest phoenix
#

?

#

launch another instance of the process before exiting this one

#

i.e. execute node whatever in your code

#

actually

#

that would make it a child process

umbral zealot
#

@earnest phoenix if you want your code to reboot, you need to have it restart externally. Look at the pm2 module, it's great for this.

earnest phoenix
#

ty

#

@umbral zealot do i gotta enable intents on the dev dashboard and code

carmine summit
#

What bot scopes do I need. I currently have
-bot
-identify
-connections

Enabled. Would I need any others?
@split peak uh

faint prism
#

I wonder how many people we are going to see because of the new privileged intents update

umbral zealot
#

@earnest phoenix not sure why you're pinging me, but the answer is, "DO YOU NEED THEM?" if yes, enable them. if no, don't.

earnest phoenix
#

Well djs wont get member list without presences

#

So i need that ig

umbral zealot
#

Do you need the member list? are you sure?

quartz kindle
#

intents are not mandatory in api v6, which discord.js uses, but discord made a change and now MEMBERS and PRESENCES are off by default unless you enable them in your developer portal

earnest phoenix
#

Yea i do

umbral zealot
#

Or do you njust need the member count?

quartz kindle
#

regardless if you use intents or not

earnest phoenix
#

I need the membets

#

And roles

umbral zealot
#

Then activate the GUILD_MEMBERS

earnest phoenix
#

I thought djs used v7

quartz kindle
#

v7 is basically the same as v6

umbral zealot
#

yeah

earnest phoenix
#

But better errors

carmine summit
quartz kindle
#

it was never officially released, and discord refuses to acknowledge its existence xD

earnest phoenix
#

Yea xd

#

Weird that they wont

quartz kindle
earnest phoenix
#

How did people even find it

#

Wait.. v8??

midnight blaze
#

v7? I was offline for a while. What the hell is that? O; werent we at v12?

quartz kindle
#

this is the discord api version

#

not library versions

midnight blaze
#

ah

#

got it

quartz kindle
#

v6 is deprecated but its still the default one lmao

earnest phoenix
#

Why are libs not using v8 yet

quartz kindle
#

because breaking changes and intents are mandatory

#

so libs have to wait for semver

#

aka, djs v13

earnest phoenix
#

Whats semvet

#

Oh

midnight blaze
#

server?

quartz kindle
#

semantic versioning

midnight blaze
#

O-O

earnest phoenix
#

Isnt that coming next year xd

midnight blaze
#

nxt year is soon

#

aint that far away o;

earnest phoenix
#

Not start of it

quartz kindle
#

semantic versioning is a set of rules that guide how your versions should be released

earnest phoenix
#

Mid next year or smth

quartz kindle
#

for example, a "semver major" is a major change that when implemented has to be released as the next major version, v12 -> v13

#

api v8 is a semver major change

#

so they can only implement it in djs when they release djs v13

#

a "semver minor" would be a smaller change, like adding new features, which can be released as a 12.4 -> 12.5

earnest phoenix
#

They are recoding all of js code

#

To ts

quartz kindle
#

really?

#

lmfao

earnest phoenix
#

Yea

midnight blaze
#

wait what

#

v13 will be ts?

earnest phoenix
#

Yea

#

Go look at the repo

quartz kindle
#

oh you mean djs

#

i though you said node.js

carmine summit
#

@quartz kindle So uh, I use an api. something like api.com/?page=1, but there is an average of 45 pages. So the api latency is mostly 200ms, which means 200*45. Thats 9 seconds of delay when I want to search something. It does something like: page1 > code > page2 > code > page3 > code ..... What I wanted is to search all of the pages at the same time so that the delay is only 200ms... Something like: page1,2,3.... > code...

earnest phoenix
quartz kindle
#

yes, djs-next will be 100% ts

midnight blaze
#

shit

#

I guess I have to learn ts then xD

quartz kindle
#

you dont need to use ts to use a ts lib

#

ts libs work in normal js

#

as long as they do it right

#

xDDDD

faint prism
#

Might as well do TS though

#

I've heard it's a pretty great superset

earnest phoenix
#

Types are 🔥

quartz kindle
#

@carmine summit if the api doesnt mind the request spam and doesnt ip block you for it, then do concurrent requests

carmine summit
#

concurrent?

quartz kindle
#

requests that are processed at the same time

#

show your code

earnest phoenix
#

Tbh i dont understand why discord wont say v7 exists

carmine summit
#

yes

#

how do I do it?

quartz kindle
#

show your code

carmine summit
#

it's a mess but k

quartz kindle
#

just the part where you search the pages

faint prism
#

Yeah, not the other embarrassing parts 😉

quartz kindle
#

which i will totally share on other servers and make fun of it

carmine summit
#
if (command == 'price') {
      if (!args.length) return message.channel.send(`You need to provide a search term\nUsage: \`${prefix}price <item name>\``)
      let j = 0
      let lowest = 999999999999
      let item
      let name
      let search = args.slice(0).join(' ')
      let datebefore = Date.now()
      let data = await axios.get('https://api.hypixel.net/skyblock/auctions')
      let est = commafy(((Date.now() - datebefore) * data.data.totalPages) / 1000)
      let msg = await message.channel.send(`Searching "**${search}**"\nEst.: ${est} seconds`)
      for (let i = 0; j < 1000; i++) {
        let object = await axios(`https://api.hypixel.net/skyblock/auctions?page=${i}`).catch((e) => {
          message.channel.send(e.message)
        });
        for (let j = 0; j < 1000; j++) {
          if (object.data.auctions.length == j) {
            if (lowest == 999999999999) return message.channel.send(`Item not found. Make sure the spelling is correct. eg: Midas' Sword or Necromancer's Brooch. You can also search a part of the name of the item eg: midas\n Note: This command only works on auctionable items. For Bazaar items, see \`?bazaar\`.`)
            return msg.edit({
              embed: embed(`${name}`, `\nLowest Price BIN: ${commafy(lowest)} coins.`),
              content: null
            })
          }
          if (object.data.auctions[j].item_name.toUpperCase().includes(search.toUpperCase())) {
            if (object.data.auctions[j].bin) {
              if (object.data.auctions[j].starting_bid < lowest) {
                name = object.data.auctions[j].item_name
                lowest = object.data.auctions[j].starting_bid
              }
            }
          }
        }
      }
    }
#

callback hell yes

earnest phoenix
#

@umbral zealot i installed pm2 but not working in console

quartz kindle
#

so basically

umbral zealot
#

How is it not working?

earnest phoenix
pale vessel
#

did you install it globally

earnest phoenix
#

wym?

pale vessel
#

npm i pm2 -g

faint prism
#

it tells you in npm's website

sudden geyser
#

and how do i install discord.js in ma
macbook
os
@earnest phoenix,

  1. Install Node.js: https://nodejs.org/en/ (follow the instructions)
  2. To install Discord.js, after installing Node.js, just run npm install discord.js in the project directory.
earnest phoenix
#

yeah i did

faint prism
#

the -g is important

carmine summit
earnest phoenix
#

btw i just needed to restart vsc

quartz kindle
#

instead of doing js for(...) { result = await axios(...) ... } you do something like this ```js
let requests = [];
for(...) {
requests.push(axios(...))
}
let done = await Promise.all(requests)
...

sudden geyser
#

so it wasn't added to your PATH yet

carmine summit
#

wtf?

#

im so confused

sudden geyser
#

concurrency 💪

quartz kindle
#

you see, when you do await axios() it waits until axios finishes loading the page before continuing
but if you do axios() without await, it will start loading the page but not wait for it

#

so you can then use axios() multiple times, and add them all to an array

carmine summit
#

ahhhhhhhhhhh

faint prism
#

I was gonna say. If it's a path issue, you'd have to add it from somewhere in appdata

quartz kindle
#

so you have multiple pages being loaded at the same time

carmine summit
#

the pages are not exact

quartz kindle
#

then you use Promise.all() to await for all of them

pale vessel
#

node adds it for you iirc, you just have to restart terminal

carmine summit
#

sometimes it may be 50

#

sometimes 48

#

sometimes 45

quartz kindle
#

is there a way you can get the number of pages from the first request? or the number of results?

#

for example, does it say anywhere something like "showing 20 out of 345 results"

carmine summit
#

yes

#

there is something

#

data.data.totalPages

quartz kindle
#

then you can await the first page, and use that to know how many other pages to load

#

and do the rest of them concurrently

carmine summit
#

how do i do that

earnest phoenix
#

well i have a question about discord.py

i'm making a discord event bot

im trying to pick a member in a specific role without any overlap but it keep sending overlap memeber

how can i make a bot without any overlap picking member

pale vessel
#

what do you mean by "overlap member"

slender thistle
#

what

earnest phoenix
#

@pale vessel hmm..

for ex : when i type 'pickmember'

bot send us

flazepe#8587
flazepe#8587
flazepe#8587

#

like this

pale vessel
#

ah

earnest phoenix
#

is there anyway to fix this problem?

pale vessel
#

ask shivaco trollpixel

obtuse jolt
#

@quartz kindle help me nobody will tell me how to do something

#

i need ur big brain

pale vessel
#

aSk To AsK

slender thistle
#

What's your code

obtuse jolt
#

I ALREADY DID

#

NOBODY SAID HWO

umbral zealot
#

Doesn't ask a question
"Nobody's answering my question!"

obtuse jolt
#

literally ive been waiting for an answer for over 2 hours

#

nobody will tell me

earnest phoenix
#

thx for your answer flaze

quartz kindle
#

well post it again

obtuse jolt
quartz kindle
#

people wont scroll up 5km of text

umbral zealot
#

Maybe you're asking the wrong question or your question is too vague or broad.

#

The heck is a memory queue

obtuse jolt
#

smh

umbral zealot
#

No seriously, what's an "in memory queue"

quartz kindle
#

you're building a global queue in the sharding manager and you want to read/write data from it?

obtuse jolt
#

yes

umbral zealot
#

Processes can't share memory

quartz kindle
#

then you need to use IPC

#

aka broadcastEval

#

and process.send()

obtuse jolt
#

I wanted to use a module for it

carmine summit
#

@quartz kindle help plez

obtuse jolt
#

like a predefined queue module

quartz kindle
#

does the module handle IPC?

umbral zealot
#

You could use something like rabbitmq or another queue system but it would be adding more complexity

quartz kindle
#

if not, then you have to do it yourself

#

djs already has its own IPC

obtuse jolt
umbral zealot
#

Well, that's going to need to be in every shard

#

it's not "passed to", because you cannot pass memory to a child process

quartz kindle
#

form the shardingManager you can do shard.send("something")
from the shards you can do client.shard.send("something")

#

this is how you communicate between the manager and the shards

obtuse jolt
#

what would the output in the sharding file look like if one of the shards we're to send something

umbral zealot
#

@obtuse jolt the shard arguments must be strings. Node js does not allow for the passing of modules, or memory, or anything else, through arguments.

quartz kindle
#

in the shardingManager you receive messages using shard.on("message")

#

in the shards, it should be process.on("message")

#

so for example

obtuse jolt
#

i guess it would be manager.on right?

midnight blaze
#

(welcome back hope, dont mind me, just saying that)

quartz kindle
#
// manager.js
manager.shards.first().send("abc")

// shard.js
process.on("message", msg => {
  console.log(msg) // "abc"
})
obtuse jolt
#

so would i would jsut have to put it the other way around for what I wanted?

#

so technically could I not just send the manager file the queues ID then just queue it in there?

quartz kindle
#

yes, thats what you have to do

#

the entire queuing logic needs to be in the manager, you cannot send the queue itself through IPC

#

the shards will have to send a message to the manager, and wait for a reply

obtuse jolt
#

wait

quartz kindle
#

it has to be the shard

obtuse jolt
#

im stupid

#

how would I send a message to the manager tho?

quartz kindle
#

from the shard?

obtuse jolt
#

yes

quartz kindle
#

client.shard.send()

obtuse jolt
#

how would i receive that?

quartz kindle
#

shard.on("message")

obtuse jolt
#

shard.on in the manager?

quartz kindle
#

yes

#

so you have to add a listener to all your shards

#

manager.on("shardCreate", shard => { shard.on("message",console.log) })

obtuse jolt
#

so I have to put it in there?

quartz kindle
#

thats the easiest way

obtuse jolt
#

ty Tim

sudden geyser
#

Yxri, may I ask what theme/plugin you're using for the background image.

obtuse jolt
#

it makes vcs transparent the image is just my desktop background

sudden geyser
#

aw it doesn't support mac

#

big sad

quartz kindle
#

mac bad

sudden geyser
#

reeee

indigo flax
#

what does that mean

obtuse jolt
#

damn I just realised im gonna have to recode practically half my bot

#

shit

quartz kindle
#

use promises

obtuse jolt
#

would it be more efficient for the manager to send back a success message then to just edit it then reedit it if it failed

indigo flax
#

@indigo flax
@quartz kindle um

#

how do i fix it

quartz kindle
#

make it not run out of memory?

#

lmao

#

check how much ram its using, check if you dont have a memory leak, buy more ram

#

optimize your code, switch to a better lib, etc...

#

@obtuse jolt if i were to do it, i would create a request-response interface

obtuse jolt
#

how im planning to make it work is the shard send the queue id then the manager send back a successfully queue message or failed message

quartz kindle
#
// shard.js
let n = Date.now() + Math.random();
client.shard.send({data:"bla",nonce:n})
let result = await new Promise((resolve,reject) => {
  let handle = msg => {
    if(msg.nonce === n) {
      process.removeListener("message",handle);
      resolve(msg.data)
    }
  }
  process.on("message", handle)
  setTimeout(() => {
    process.removeListener("message",handle);
    reject("timeout")
  }, 5000)
})```
carmine summit
#

@quartz kindle I'm still confused

obtuse jolt
#

I see, I wouldn't have though of doing it this way

quartz kindle
#

added a cleanup to avoid the maxlisteners warning

obtuse jolt
#

ty for your help tim

quartz kindle
#

@carmine summit unconfuse yourself

carmine summit
#

/unconfuse self

#

not working

midnight blaze
#

@carmine summit that custom status

carmine summit
#

?

#

You need nitro

#

so yeah

bronze bramble
#

Anyone w experience building a dashboard? Tell me your pricing and I’ll give you the details

#

Already have themes and working on artwork for the website

indigo flax
#

what does PRESENCE INTENT
do

pale vessel
#

presence

sudden geyser
#

It's for presence

#

You know, playing X

pale vessel
#

and statuses like online and dnd

carmine summit
#

Why is Presence Intent Greyed out?

vocal sluice
pale vessel
#

is your bot verified @carmine summit

carmine summit
#

noooooooooo