#development
1 messages · Page 1355 of 1
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
func.start()
kk
thx
I just typed "reboot" in my ssh client
and now i cant acces my vps anymore
@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)
}
});
})
@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
yeah got it thanks!
You may want to see the documentation, as you can't use .get directly on .roles: https://discord.js.org/#/docs/main/stable/class/RoleManager
@earnest phoenix let me know if it works
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?
@cloud pebble no some users have dms turned off
@earnest phoenix sorry replace roles.get with roles.resolve
DMs are definitely not turned off, the same users that could receive a DM yesterday can't today after I updated the bot library
how are you getting the user to send the dm to?
sharding weirdness maybe?
using ctx.author and then sending a DM with user.send()
wait resolve is synchronous oops
@cloud pebble you mean ctx.author.send(message)?
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)
}
})
actually I just double checked:
user = bot.get_user(USER_ID)
await user.send(message)```
i think you need to enable the members intent to use bot.get_user
hmm that was my guess, wanted to get a second opinion first
wtf
are you sure the error is in that code
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
@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?
Maybe add some goddamn spaces to this code >.<
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)});
@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.
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`);
)
});```
cool thanks evie
@dark grove else if(message.channel.send()) isn't a valid condition
you probably were looking for just else, not else if
you don't even need else since you return from the if
You could also shorten this to if(message.content !== 'pog')
Thanks!
i must make it shorter
bot.on('message',m=>m.content!='pog'&&m.channel.send`HOW DARE YOU NOT FOLLOW MY RULES`);
@umbral zealot do you know what to enter to get the member count in the code
it's similar but it does a lot of unnecessary tests
Depends on the language and library, but you literally just have to add up the member counts of each guild.
do you know what to enter to get the member count in the code
@strange raven is it notmessage.guild.memberCountin node.js?
or sorry just MemberCount
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?
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 commandwithif (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?
let embedcommand = new MessageEmbed()
_my embed stuff goes here_
message.channel.send(embedcommand)
} ```
send the whole execute() if possible
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
how do you do a reaction collecter with multiple emojis?
@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...
that is quite messy
@earnest phoenix Do oldPresence && oldPresence // whatever else
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?
what i mean:
Unused variables are no threat to the actual code
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
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
You could set up a .eslintrc.json file to change it from displaying as an error to a warning.
@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 There is an error:
basically it is saying thatnow.yearis not valid
@earnest phoenix donow = datetime.datetime.now()
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);
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?
You can't set custom statuses as a bot user.
Bots can't have a custom status
You can read them, but you can't create them.
You can set playing, watching, streaming, listening and competing activities
WATCHING DISCORD BOTS
That's just a regular status.
You an use <Client>.user.setActivity to accomplish that.
<client>.user.setActivity("status", {
type: "PLAYING or STREAMING or LISTENING or WATCHING or COMPETING"
});```
And can it only be one of those? Or are those just examples?
Thank you wise ones of the Discord Bot List, wouldn't have even gotten past line one without the help here
@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)
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
Ig but it won't run in a loop
it will
(once a day)
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
anyone know what kurasuta's development mode is?
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 ^
yes it does
@tasks.loop(seconds=3)
async def func():
print("a")```
does your task look like that ^
@earnest phoenix
i dont understand
ill be fixing this later have some work to do
ok
bye thanks for the help!
i was not doing tasks
@earnest phoenix sus
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
help my bot has -17 ping
Lol
do you still provide shard info in client options if you use a sharding manager like kurasuta?
get a slower host
lmao
anyone know any fun / entertaining free public apis?
how can i make my bot an app for discord? I don't even know where to start
Can someone explain what Itent means
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
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
discord really doesn't want you to use the gateway anymore lmfao
they want you to move to stateless design with slash commands

I hate Data bases, i have the code but It's not f*cking working
your code is wrong, so try using the Base Date app
Most important things of the 20th century
sir i do not know what that is
*21th lmao
i use the discord bot maker app sir
what base date do you use? quick.db?
date != database
h
God ...
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
is there anything wrong with saving dates as numbers?
U mean as timestamps?
yes
What do u mean with wrong?
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
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
Actually it’s called datetime
Date and time as datatype also exists
As well as timestamp which is just an integer
Well in MS SQL I know it's "Date". But there are more
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
Well whatever u need, it covers a lot of datatypes
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
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
What do you mean by "higher compatibility"?
I prefer MariaDB nowadays which is perfect for my needs, which doesn’t mean ur opinion has to be same
I'm not advocating MS SQL dbms. Haven't used it much at all yet in the semester tbh
Just curious for your reasoning
Well most apps, frameworks are compatible with multiple storage system mostly not ms sql
- I’m working on or using
I haven't run into issues implementing connection to databases yet personally
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
@earnest phoenix did you see what John hammond posted on yt today about the CVE regarding a sudo underflow vuln?
And instead of MySQL Oracle ripped like anything they buyed MariaDB is being worked on - still
nope i haven't been on my pc for the entire day i had a 10hr day at school 
LOL
i just saw it
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?
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
I was like, damn gonna have to remember that one for kicking out ssh users
Somewhere in this vid https://www.youtube.com/watch?v=JA8UcVKkNwY&ab_channel=JohnHammond
@earnest phoenix found it lol
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.
read #discord-news
@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.
Thnx
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.
yo
yes
yes
The first parameter of filter is the reaction object.
So you can use reaction.emoji.name to get the name.
reaction.emoji is what you're looking for
so
Assuming that's a unicode emoji
:cancel_1:
just cancel then
yes
message embed field values cannot be empty
an embed field
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
If you can reproduce the error, you should try logging the embed so you can see what field is empty.
it always happens
i'd imagine it's the one called "old content"
also is that a helper function to build an embed
yup
you can just pass the object straight into send
may you be more specific please?
channel.send({embed: {
title: 'Example',
description: 'Description',
}});```
let me try
dumb css question time, how do i make a button fill up it's entire div/space
tried width: 100% but no luck
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"); });
whenever a new member joins, your code looks in the guild for a channel with id '762109185562247199'
do you have the new intent enabled
that can't apply to all guilsd
dumb css question time, how do i make a button fill up it's entire div/space
@sick cloud try usingdisplay: block, you're probably usingdisplay: inline-blockcurrently
is it local
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-
.btn {
color: white;
background: #303030;
text-decoration: none;
padding: 8px 20px;
border-radius: 2px;
}
.btn.block {
width: 100%;
display: block;
}
ah i see
@earnest phoenix do you have the intent enabled
Private server...
that or any errors?
No errors
you need it enabled to receive guildMemberAdd events
O
if you're going to ignore me i won't try to help you lol
I will enable that
oh yeah intents are required now
Fuck CSS 🥺
❤️ JavaScript
si
frrrr
@earnest phoenix ikr
Still confused....
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"); });
Yes.
do you have an eval command by any chance
center the text - text-align: center;
eval bot.emit('guildMemberAdd', <Message>.member) to make sure it's not your code
and okay
I don't have an eval command-
eval
bot.emit('guildMemberAdd', <Message>.member)to make sure it's not your code
@sick cloud what?
do you have an eval command?
If I use the code (return message.guilds.channels.send()), can I send a message to all the servers my bot is on?
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.
I want to send messages to users who are using my bot randomly on their servers
Why though? The user didn't request it.
client.on("ready", () => {
Console.log() return message.guilds.channels.send()
)}
One message removed from a suspended account.
One message removed from a suspended account.
Not function?
One message removed from a suspended account.
One message removed from a suspended account.
Like I told you, the code you showed us wasn't correct from the start
One message removed from a suspended account.
You can review Discord.js' documentation to see how you can use its API.
I want to send system messages to users
One message removed from a suspended account.
I said this twice: you don't want to do that.
@delicate shore why a windows VPS?
There are other ways of informing your users: #development message
Thatll cost much more
One message removed from a suspended account.
@earnest phoenix make something like that opt in at least
P.S. not everyone who uses X bot cares about its changes enough to be willing to receive random messages from it
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
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 why a windows VPS?
@waxen tinsel
Company sponsored my bot
But how to do it pls tell
is it possible to use http://public_ip_ address as vote api webhook url ?
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
})```Won't run when a user joined the guild
You need the guild members intent to receive that event
is it possible to have an embed with a link that when clicked the bot runs a functions as if someone typed a command?
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
how would i sanitize a string to only leave alphanumerical content (A-Z a-z and 0-9, no symbols etc)
is that sort of like find and replace
just string.match()
oh ok
i found a regex that does it but it removes spaces to
where as i want to replace spaces with -
so
title.replace(/ /g, '-').replace(/[^0-9a-z]/gi, '');
it uses /[^0-9a-z]/gi
so add a - in there
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
rephrase your question in english
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?
just go make a bot then and publish it
Okay sure I will.
ok
@pale vessel do you know much about regex btw
well my depressing way rn is just .replace(/<symbolhere>/g, '') and repeated like loads
so
lemme play around for a bit
👌
i wanna sanitize a blog title basically to a url friendly string
so Very Good Title! becomes very-good-title etc
I think I was sending a Buffer instead of a String so express sent an octet-stream
@sick cloud encodeURIComponent?
well that just replaces them with the &.. codes etc
Yeah, fair
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
slug = slug ?
wtf
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()
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 Isn't this what you want?
i guess
wizard
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
@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
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",
});
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 :(
We can't help you with that

-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",
});
@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
Im not familiar with djs but the status is part of the client object
setInterval(async ()=>{
await client.user.setActivity('Your Servers!', { type: WATCHING })
},10000)
UPDATED^^^
That’s an example of how to use the JS interval, aye
would that code work?
Just increase the interval timer a little bit, every 10s is not needed
every...?
10000 = 10 s
Idk every minute or more
100,000 = 10m?
Since u don’t check the actual status and just send an update
is 100000 10 min
Dude milliseconds
ooooh ok
ok
That's 1 minute
Welp forgot a 0
would 5 minutes be good enough?
It's like normal seconds with extra 000 at the end
@earnest phoenix shh I’m driving meanwhile
is 5 mins good?
isnt it 300000
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
i figured it out
Bruh are you always driving mate
Aye life sucks
how do i make my bot send random images from the web
I'm done with this fucking application/octet-stream shit I'm gonna go watch 3B1B's videos on neural networks
nice
have fun w that
why do people want your account?
"no i wont sell my account"
why do people want your account?
@cold grotto idk
mk
Wait you can modify the scroll bar in CSS overflow?
@earnest phoenix is another level now, He is enchanted bruhhhh
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`??
if you dont specify it, it will only end after 600 seconds
?
@earnest phoenix it's not supported on all browsers but yes
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

because
people too lazy to use copy/paste?
and go to goole and search "google translate"
for this kind of thing its better to create a message collector
just be careful not to create multiple collectors accidentally
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
it takes 10.29 seconds to open up chrome then search "google translate"
@carmine summit bro chrome takes a fullInfinityseconds to open on anything but Android
so yeah
you take almost 4 seconds to type that?

its Infinity% much better
alsoi had to stop/start the timer
that took me 2 seconds
lmao
i might have a solution to this
?

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
nah you take 1 minute to install the extension
one-time thing
nah takes a minute to load chrome
- intenet connection
1kbps
ERR_CONNECTION_TIMED_OUT
okay
// 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
thanks for effort
nope
ill check it out
idk if this will even work
yes same thought
@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 
yeah so?
guys I want to ask ...
How to make a simple welcome bot ??
@cloud pebble hacks?

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)?
I'm doing this course on scrimba: https://scrimba.com/learn/neuralnetworks
wish me good luck that i don't give up

Why would you ask people to wish you good luck

Why would you ask people to wish you good luck
@earnest phoenix idk
Poor enchanted apple
LoL
@earnest phoenix bad apple
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?
just use the fetchAllMembers option
but you need the GUILD_MEMBERS thing in the dev portal
?
Guys, How to make a simple welcome bot ?? (coding)
What language?
As welcome bot you mean a bot that says "Hello {user}" when a user joins the server?
As welcome bot you mean a bot that says "Hello {user}" when a user joins the server?
@earnest phoenix yes, maybe
What language?
indonesian

...
star that rn
Language = coding language, not language you talk
@earnest phoenix ohh
coding
I starred 
english
....
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
my english is bad T_T
i must Translate
@earnest phoenix No
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
I can't star my own message lmao
Please

Stop advertising
@steel canyon What programming language do you know?
@steel canyon What programming language do you know?
@earnest phoenix idk
Then learn a programming language
And come back when you learned one
Which means: Not in 2 hours
where i can learn??
Which means: Not in one youtube tutorial
School, Books, Websites, ...
hmmm
Which means: Not in one youtube tutorial
@carmine summit my coding from youtube
Yea well known copy paste
how would I go about accessing something like a in memory queue in the shard managers file https://cdn.yxridev.com/u/ZQOEHg1F.png
copy paste
@carmine summit yess

give me the stupid answer
i duuno
fml
i duuno
oh wait
we already have a stackoverflow here in dbl
why would you even hide a few letters from a message 
@quartz kindle
lmao
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
and muted
hi
i ddint mean to

such a coincidence that the guy i pinged is online

lmao

What bot scopes do I need. I currently have
-bot
-identify
-connections
Enabled. Would I need any others?
restart not working
it shutdown only
what do you think was going to happen
you exited the process
@split peak well, what scopes do you actually need?
That's the point
I'm not sure.
Do all bots need intents or only 100+ guilds
Are you making any website, Ciaran?
all bots are required to use intenta
I plan to in the future yes.
Well, "the future" isn't now, so for now, only the bot scope is necessary
if your bot is below 100 servers it doesn't need any whitelisting for privileged intents
You can always edit this in the future when you actually need it.
you exited the process
@earnest phoenix how to resolve
Ok. Thanks Evie
?
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
@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.
What bot scopes do I need. I currently have
-bot
-identify
-connectionsEnabled. Would I need any others?
@split peak uh
I wonder how many people we are going to see because of the new privileged intents update
@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.
Do you need the member list? are you sure?
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
Yea i do
Or do you njust need the member count?
regardless if you use intents or not
Then activate the GUILD_MEMBERS
I thought djs used v7
v7 is basically the same as v6
yeah
But better errors

it was never officially released, and discord refuses to acknowledge its existence xD
v7? I was offline for a while. What the hell is that? O; werent we at v12?
v6 is deprecated but its still the default one lmao
Why are libs not using v8 yet
because breaking changes and intents are mandatory
so libs have to wait for semver
aka, djs v13
server?
semantic versioning
O-O
Isnt that coming next year xd
Not start of it
semantic versioning is a set of rules that guide how your versions should be released
Mid next year or smth
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
Yea
@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...
yes, djs-next will be 100% ts
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
Types are 🔥
@carmine summit if the api doesnt mind the request spam and doesnt ip block you for it, then do concurrent requests
concurrent?
Tbh i dont understand why discord wont say v7 exists
show your code
it's a mess but k
just the part where you search the pages
Yeah, not the other embarrassing parts 😉
which i will totally share on other servers and make fun of it
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
@umbral zealot i installed pm2 but not working in console
so basically
How is it not working?
did you install it globally
wym?
npm i pm2 -g
it tells you in npm's website
and how do i install discord.js in ma
macbook
os
@earnest phoenix,
- Install Node.js: https://nodejs.org/en/ (follow the instructions)
- To install Discord.js, after installing Node.js, just run
npm install discord.jsin the project directory.
yeah i did
the -g is important
btw i just needed to restart vsc
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)
...
so it wasn't added to your PATH yet
concurrency 💪
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
ahhhhhhhhhhh
I was gonna say. If it's a path issue, you'd have to add it from somewhere in appdata
so you have multiple pages being loaded at the same time
the pages are not exact
then you use Promise.all() to await for all of them
node adds it for you iirc, you just have to restart terminal
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"
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
how do i do that
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
what do you mean by "overlap member"
what
@pale vessel hmm..
for ex : when i type 'pickmember'
bot send us
flazepe#8587
flazepe#8587
flazepe#8587
like this
ah
is there anyway to fix this problem?
ask shivaco 
aSk To AsK
What's your code
Doesn't ask a question
"Nobody's answering my question!"
thx for your answer flaze
well post it again
how would I go about accessing something like a in memory queue in the shard managers file https://cdn.yxridev.com/u/ZQOEHg1F.png
people wont scroll up 5km of text
Maybe you're asking the wrong question or your question is too vague or broad.
The heck is a memory queue
smh
No seriously, what's an "in memory queue"
you're building a global queue in the sharding manager and you want to read/write data from it?
yes
Processes can't share memory
I wanted to use a module for it
@quartz kindle help plez
like a predefined queue module
does the module handle IPC?
You could use something like rabbitmq or another queue system but it would be adding more complexity
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
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
what would the output in the sharding file look like if one of the shards we're to send something
@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.
in the shardingManager you receive messages using shard.on("message")
in the shards, it should be process.on("message")
so for example
like this? https://cdn.yxridev.com/u/VOMZdp3f.png
i guess it would be manager.on right?
(welcome back hope, dont mind me, just saying that)
// manager.js
manager.shards.first().send("abc")
// shard.js
process.on("message", msg => {
console.log(msg) // "abc"
})
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?
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
it has to be the shard
from the shard?
yes
client.shard.send()
how would i receive that?
shard.on("message")
shard.on in the manager?
yes
so you have to add a listener to all your shards
manager.on("shardCreate", shard => { shard.on("message",console.log) })
so I have to put it in there?
thats the easiest way
Yxri, may I ask what theme/plugin you're using for the background image.
@sudden geyser I use this https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit
Extension for Visual Studio Code - VS Code Extension to set window to transparent on Windows and Linux platforms.
it makes vcs transparent the image is just my desktop background
mac bad
reeee
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
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
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
// 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)
})```
@quartz kindle I'm still confused
I see, I wouldn't have though of doing it this way
added a cleanup to avoid the maxlisteners warning
ty for your help tim
@carmine summit unconfuse yourself
@carmine summit that custom status
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
what does PRESENCE INTENT
do
presence
and statuses like online and dnd
Why is Presence Intent Greyed out?
is your bot verified @carmine summit
noooooooooo




