#development
1 messages · Page 1833 of 1
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
You gotta replace timestamp with a timestamp, lol
READ WHAT I WROTE
click on the link
???
I DONT KNOW WHAT THAT IS
<t:T:d>
If I were to change an open source project (mine specifically) from MIT to something else, would that force everyone to follow the new license, or am I not allowed to change it?
well
you're allowed to change it
however
you can't retrospectively force users to update to the new license
if they have a version of the project with the older license, they're obliged to follow that one
in other words, the new license is only effective once the user pulls it
It is something to do with overload
I somehow prefer that style
EZ FIX
const args = [interaction.options.get('guess', true).value, interaction.options.get('bet').value]
instead of calling the damn embedcreator method always
Embed creator is better imo
well, the default format the API accepts won't change anyways
so it's just less code
Yeah. MessageEmbed() didn't change in v13
So it's not an issue
Just if you want to attach files
doesn't bother me, as I'm creating my embed as obj anyways (manually)
But most embeds are easy to transfer
hmm, never needed to send attachments yet tbh
I have and it was always a pain in my use-case so I'm not looking forward to doing it again...
well yeah, makes sense then
and I'm yet again asking discord to FUCKIN ALLOW SENDING EPHEMERALS DIRECTLY
who cares about interactions smh
direct ephemerals + files would be perfect for me
idk, like normal messages but supply an user
it's good how it is tho
or like user.sendMessage
interacting with something means they have to expect a result
Alright 2 slash commands down... 103 to go...
lmao
ETA November 2053
i cant even begin moving mine without attachments
without attachments?
Hii
yes
wdym?
Oh you can't send attachments?
You can send attachments via followup messages
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
they said they are working on it
well by the time i get there... 
how do i parse a custom emoji in discord?
like this emoji: 
i want to get the id how would i do that?
To get the ID of an Animated emoji, I use the Emoji bot
copy the emoji link then you'll find the ID there https://i.imgur.com/3mkIvbC.png
wdym emoji link 
right click on the emoji then you'll see copy link
it would be something like this: <a:emoji.name:emoji.id> i think
yes, if its animated
what i mean is i want to get the emojis in a message content like:

and retrieve the emoji id
how would i do that??
im confused on what ur talking about
@worthy ivy
try putting this before your callback function
/**
* @param {import('discord.js').Message} message
*/
that actually worked, huh.
yeah
idk about that
for example this emoji would be <a:stomp:866113062494404698:>
text ? interaction.editReply({ content: text, files:[image] }) : interaction.editReply({ content: image }); It can send from editReply too. but not ephemeral as now
Hi everyone
Collection [Map] {
'872835212990631996' => Message {
channel: DMChannel {
type: 'dm',
deleted: false,
id: '607478773906145292',
recipient: [User],
lastMessageID: '872835212990631996',
lastPinTimestamp: null,
messages: [MessageManager],
_typing: Map {}
},
deleted: false,
id: '872835212990631996',
type: 'DEFAULT',
system: false,
content: 'w',```
how to get content
message.content isn't working
that's a map btw
console.log what message is then
i got that from console
you logged the map not the message
thats from console
why is it logging the map then
Collection [Map] {
'872835212990631996' => Message {
channel: DMChannel {
type: 'dm',
deleted: false,
id: '607478773906145292',
recipient: [User],
lastMessageID: '872835212990631996',
lastPinTimestamp: null,
messages: [MessageManager],
_typing: Map {}
},
deleted: false,
id: '872835212990631996',
type: 'DEFAULT',
system: false,
content: 'w',
author: User {
id: '269132764576481282',
system: null,
locale: null,
flags: [UserFlags],
username: 'Zyad',
bot: false,
discriminator: '1273',
avatar: '12900bbbc63c0852aaf14e8b6523167d',
lastMessageID: '872835212990631996',
lastMessageChannelID: '607478773906145292'
},
pinned: false,
tts: false,
nonce: '872835159643127808',
embeds: [],
attachments: Collection [Map] {},
createdTimestamp: 1628170531271,
editedTimestamp: 0,
reactions: ReactionManager {
cacheType: [Function: Collection],
cache: Collection [Map] {},
message: [Circular]
},
mentions: MessageMentions {
everyone: false,
users: Collection [Map] {},
roles: Collection [Map] {},
_members: null,
_channels: null,
crosspostedChannels: Collection [Map] {}
},
webhookID: null,
application: null,
activity: null,
_edits: [],
flags: MessageFlags { bitfield: 0 },
reference: null
}
}
full log
you're acessing the map not the message
maps don't have "content"
for example
<map>.get(the id).content works
<map>.content don't
its a collection, you have to chose 1 of the items inside the collection, using either .get(id) or .first() if your collection only has 1 item
oh yeah, get
ok ty btw that message is map because i get the message with this => message.channel.awaitMessages(filter, {...
^
wtf?! someone know why i always get "file not found"?!
@bot.command()
async def wget(ctx, arg1):
url = arg1
r = requests.get(url, allow_redirects=True)
if url.find('/'):
with open(url.rsplit('/', 1)[1], "rb") as f:
downloaded = discord.File(f)
await ctx.send(file=downloaded)
👀
not from files in server. from online. urls, requests, etc....
ah, sure
there even is "url.split"...
I don't think you can do that anyway
=[
I mean, remote files are just a text page unless downloaded
ik
and u aint downloading it before opening
anyways - i have a dumb idea
what are you trying to make?
command for bot to "download" and send files online. yea, same. bot based on linux =p
ooh
ye but for discord
inb4, your bot won't last long before you remove most cmds
means? im gonna verify =p
cmd is cmd. and hosted not at me but replit =p
you're assigning the downloaded file to a variable
ye
another stupid question about that map
what should i add in the id
<map>.get(the id).content
the id of the desired message
Collection [Map] {
'872835212990631996' => Message {```
maps are collections of key-values
i got undefined
the id would be that big number
if you don't know the id, convert the map to a list and get by index
ik
itd be a user mind to take lighter files =p it'll block giants later
but you need to download the file to know whether it's big or small
I can easily fake content-size header
nope. check for size remotely
i use let mId = message.id;
then let reason = message.get(mId).content;
and make your request think it's a small file
how?
look...message is a map in this case
you can't get the id of something that doesn't have an id yet
mId is real id because its from normal message not map
most sites provide a Content-Size header which tells the size of the file
but that means you can easily deceive the request by sending a fake content-size header
like
file is 1TB, I set the content-size to 1B
ik. but there is way with counting size
no
yes
to find the size you NEED to download the file
nope
ok then, tell me how you'd do it
remember: if you READ the file you've already downloaded it
idk yet. now im a little unfocused and u know... tons to do
here
i logged mid
then awaited message
872839586743738398 Collection [Map] { '872839586743738398' => Message {...
if you don't know why are you even arguing then?
I'm telling u, there's no way to be 100% sure about the remote file size
i was just asking for downloads. not other things. u started
wait
yes, and I'm saying your bot WILL die let someone have this idea
1 malicious user is all it needs
that a maaaaaaap
sure, just don't come complaining when the snowball gets too big
ik. and bye. im not a retard
if you say so
bye
@hot sleet you need to get the message before you try to access its properties
i got it
as I said, if you know the id beforehand use it to get the entry
what file size thing?
making a wget cmd for a discord bot and downloading the file without checking the source
bruh. stop talkin bout this. ok?
well, that's bcuz we know how it'll end
shut
you can stream the file
idk how it works in python but pretty sure it supports file streams
so you can pipe the download stream into the discord upload stream
i also know and now shut. i try yet another method =p
is there a speed difference between stdio and socket files?
discord still only allows 8mb if im not wrong

downloading to actual file before uploading in his case
stdio is direct file access isn't it?
On UNIX-like platforms, using stdin/stdout is a socket, so there's no difference
did you ended that alr?
I know you didn't
so, im trying to re create the Balance command used in dank memer, but when I try running the command, It works when i dont mention a user, but when i mention a user, this pops up
member in your case is a string
This site can’t be reached 127.0.0.1 refused to connect.
I get this error
When I try and connect to the localhost
You'll need to convert it to a Member, I assume. Use typehints for the member parameter, member: discord.Member = None
Also, could make a oneliner, member = member if member or ctx.author
show server code
dont tell me python throws errors for undefined object properties
It does
from flask import Flask
app = Flask(name)
@app.route
def home():
return render_template(index.html)
if name == "main":
app.run(debug=True)
why
Because you're accessing what doesn't exist
the actual question is "why javascript doesn't"
^
wouldn't that add extra error handling
well, yeah
Vastly more convenient than having to figure out where and what is undefined
At least it makes sure your code is clean
but also means the compiler knows EXACTLY what are the properties of the object beforehand
making it faster
and technically better to debug
considering i access undefined properties on every line of my code 😅

Most of the time you won't get that issue if you write proper code and handle shit properly
@clear marlin You gotta be fucking kidding me LMAO
0.7.0 druid::WindowDesc takes a Fn that returns a widget
0.8.0 just straight up demands a widget
this just seems... better
function (props) {
if (!props.bruh) {
return <bruh />;
}
return <bruh />;
};
than this
function props() {
try {
props.bruh;
return <bruh />;
} catch (_) {
return <bruh />;
}
};
Or just
Check for the object's type before accessing crap
aka make sure it is what you want it to be
models
Models?
Ok so my problem is fixed.
thanks Shivaco and neuroframe! (didnt wanna ping outta nowhere)
idk how they call in other langs, but basically classes that represent a type of object
Isn't that what a class basically is?
classes can be extended with extra stuff
djs uses Base classes and adds other things on top of it
>>> x = 5
>>> type(5), isinstance(x, int)
(<class 'int'>, True)
That's all I can think of by reading that sentence
we call em models in java at least
classes that have the sole purpose of representing an object
what's >>>
Input for a Python command in the Python interpreter (REPL), essentially
Is there any host, which offers 4gb ram under 8$ and has a good uptime?
contabo
👏 lol
$6.99, full SSD, haven't had downtime yet (they tell if it's planned to happen), 8GB ram, 5vCPU
they are cheap
You use it?
ye
I use the second plan
they used to have even cheaper plans, but they were semi-ssd
like, mixed with hdd
and were quite shitty
since last year they remodeled their entire infra and solved many issues regarding service
and the website now is less sketchy-lookin than before
As said druid is in hard development.
7$ for 8gb ram, thats fair
PFFFT
though it's not guaranteed to be ram
Honestly, still not comfortable using them.
If I ever used them it would be for less important things.
ye, lots of swap
Only for potato hardware ,some host overload their own dedis
You should have chosen a more stabler one.
Hey! I made a txt command to autodeploy my slash commands, and this is the source code to it: https://pastebin.com/ReBgKKzL
When I try running it, discord returns this error: https://pastebin.com/3q2ku2ZH
I have narrowed down the file whichs options give an error, but I dont exactly see an error with it... This is the files options: https://pastebin.com/SHqSvzqW
Can someone help me with figuring out why this is happening? I have been trying to fix it for awhile now... This is all in JavaScript btw
DiscordAPIError: Invalid Form Body
embeds[0].fields[0].value: Must be 1024 or fewer in length.
How can I split the message in two parts. So the first part is 1020 characters long and I can avoid the error.
I mean instead of:
Here is a text which is longer || than 1024 character
"|" is the border where the message is longer than 1024 and I want to split it to this
Here is a text which is longer
So only the text till 1024 is shown
I never had any issue since the rework, except issues we done on our own
I prefer to live dangerously
cad or usd?
Euro, but we pay with usd
you can avoid, but you'll hit the embed char limit if u don't use pagination
use substring to split the string
Oop it seems like I will have to use threads after all. My main thread decided to just hang and my program stopped responding
but im switching to a my own thing soon because im buying another pc to host stuff on
thats nearly the price of digital ocean lol
galaxy gate is more expensive but at least they offer real hardware
its much cheaper than do, as all the extra features cost money on DO.
digital ocean offers 1gb ram for 5$, GalaxyGate does it for 3$
I'm on the $5 plan because it's just a test server open to the public lol
its worth it
there support is ass but service is good
whats a vcpu
virtual cpu
no idea
same as cpu basically
multiple vms are on a cpu
my bot only uses 1% of it so i dont pay mind
and they share those cpu cores all it means
Opposite of dedicated cpu
"A vCPU (virtual CPU) represents a portion or share of a physical CPU that is assigned to a virtual machine (VM). A vCPU is also known as a virtual processor. In many virtualization systems, hardware elements are partitioned off into different virtual machines that can provide the same functionality as traditional physical computer workstations."
I love it when I have 99% free cpu usage
lol
ty
lol
don't ask me wtf happened there
chart sus
the cpu undoes an operation
sorry language barrier so I don't know what you guys are talking about :((((((
cpus that undoes operations
about hosting->price->cpu->negative cpu usage on a chart
👀 i just passed $100 on my host from affilate codes 
no
how do i get that
oh grats
Only 1 time for students for 1 y
ah
Normal customers get 200$ for 29 days and some free things for 1y
I've been meaning to get the free stuff from google for awhile.
i should do that soon.
they'll never know
assuming client.slashcommands; is discord collection you can do directly await message.client.application.commands.set(SlashCommands); instead making them into array provided it have all the neccesary thing to be registered to discord
when I get a job part of that money will go towards cloud hosting
Ok, thank you! Will try now
hey how can we choose a random member who reacted to a message in a guild by specifying these [reaction emoji] message-id, channel-id, guild-id using eval?

akio ty for redirecting me 
I don't have a job but still part of my money goes towards cloud hosting
how can i delete that border that appears when i select the text box in html/css https://cdn.discordapp.com/attachments/864829959185104896/872851339552641134/unknown.png
nice
fetch message>reaction get all with the specific one > random user
It still gives me the same error...
This is what my structure look like when registering with .set
Also you'll need GUILD_MEMBERS intent
This is mine https://pastebin.com/hGeaVcjF
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
someone know?
display: none;
with css will hide it.
LOL
Plus I have to divide my commands into txt and slash commands
ez fix smh
@earnest phoenix try this
const getReactedUsers = async(msg, channelID, messageID, emoji) => {
let cacheChannel = msg.guild.channels.cache.get(channelID);
if(cacheChannel){
cacheChannel.messages.fetch(messageID).then(reactionMessage => {
reactionMessage.reactions.resolve(emoji).users.fetch().then(userList => {
return userList.map((user) => user.id)
});
});
}
}
that just deletes all the block
not the border
He was trolling
thats the joke yeah
selector:focus or selector:active { border: 0; }
ty akio
just add both
:hover{
border: 0px solid black;
}
nope, :hover is not active
nvm
So nobody knows how to fix this?
on the css?
you need to specify the type
how¿¿¿¿
selector {
&:focus &:active &:hover {
border: 0;
}
}
Everything specifies the type
aaah okok
Epic embed fail

Shhh!! we're talking about css
Unless I mispelt something, it should be all correct https://pastebin.com/hGeaVcjF
selector:focus selector:active selector:hover {
border: 0;
}
enjoy
aktually
selector:focus, selector:active, selector:hover
{
border: 0;
}
my css is css .dashfill { background-color: #ac77fe; color: #ffffff; border: none; padding: 8px 18px; text-align: center; font-weight: bold; font-size: 0.9em; border-radius: 15px; position: fixed; top: 50%; left: 50%; }, how do i add that then
.dashfill:focus, .dashfill:active, .dashfill:hover
{
border: 0;
}
yeah, but still does nothing
all of the elements incl. their style is cached by any browser by default
waht is testguild? id?
still nothin wtf
you sure it's not browser default ?
Its a guilds id, but im 100000% sure that isnt the issue
nope, i tryed it in 3 browsers
I'm collecting what wrong here, so I need to know what is what
That might be the issue
then try
border: 0px solid black;
same
Tbf I fixed it, I have no idea what was the issue... d.js says that number is supposed to be an option for slash, but apparently not, so I switched it to integer
lemme check real quick...
Its a really dumb issue
mean it either djs commit still an old version? or djs not implement it yet
lemme try changing it from int to numbers on mine
Im using main branch, and its in discordjs.guide
So I assumed it was implemented
Because that guide is from discord.js iirc
"discord.js": "^13.0.0-dev.t1628124537.3eb4140", this commit?
My package says this "discord.js": "github:discordjs/discord.js"
npm i discord.js@dev
Ill run that again
I mean like tbf I can work with integer, just didnt know that number was the issue
bc at that point ill just use integer
We were missing the outline property
.dashfill:focus, .dashfill:active, .dashfill:hover
{
border: 0;
outline: none;
}
@near stratus
But, thanks for your time <3
Yep, can do with NUMBER
it does, however at the end it sends message multiple times
ok lemme see
and gives "cant send empty message"

msg.channel.send(msg.channel.send
you're not the only one who uses stackoverflow
New error! Funsies
yessss+
d e e p f r i e d
thank yu man)))
👍
@long crow Have you seen this error before?
it happen during when you re deploy command
test it again, should be gone
I abuse it with pinging websocket to get immediate slash command on global command
The deploy command deploys to a guild. So it is supposed to be instant...
now it works... Bruh this is so confusing
it's a cache problem
imagine discord trying to inform 1000 guild member devices that a slash command was updated all at the same time
for setting guild command <message>.guild.commands.set(guildCommands); is much more simpler
heres the actual problem, it works fine but.. it doesnt wait and just spams this code several times
because the setTimeouts are run every few milliseconds so they all wait 3 seconds then run super quickly
If you have an async function as your exports.main then you can use this to stop anything from happening for a few seconds:
await new Promise(res => setTimeout(res, interval));
.. but why does it send this message several times
and then deletes channel after 3 seconds
Hey.
because the setTimeouts are run every few milliseconds so they all wait 3 seconds then run super quickly
How can I make it give the role to the author afterwards?
// Create a new role with data and a reason
guild.roles.create({
data: {
name: 'Super Cool People',
color: 'BLUE',
},
reason: 'we needed a role for Super Cool People',
})
.then(console.log)
.catch(console.error);
the role is passed as the first argument to .then
assign to the role to the user inside that
from the code above, it should send twice. how many times is it being sent?
.then(user.roles.add(role))
like that?
@quartz kindle
creating an interval calling a function, let's call it damnHelpMe()
I'm importing something from a file inside the function, for example const { something } = require("./hello.json");
(something is an array)
At the next iteration, AFTER I removed one element of the array, the script still has all elements in the array something
Do I need to load the file over and over again with fs?
depends on how many channels it deletes
if it deletes 5 channels it will repeat 5 times
yeah, just remember to use a guild member instead of user
@vast crown
that's what you want though
show where you call the main() function
This is what I saw after I re-deploy the duckduckgo command because of the cache. So your error is kinda expected
code?
im confused, wdym
Ah, just a temp issue then
use message.member instead of a normal user
a single user can have different roles in different servers
its not actually sending multiple messages, its just sending 1 message, but with multiple lines of text
because you did .join(" line of text here")
so i joined everything not just a list
yes, but they'll get ratelimited by the improper setTimeout
hey there @quartz kindle
you joined the list using the entire sentence as the separator
why my is my localhost not running :c
so for each item, there will be an entire sentence in the middle
message.guild.roles.create({
data: {
name: 'Chill',
color: '#7289DA',
},
reason: 'A role for Chill',
})
.then(message.member.roles.add(role))
.catch(console.error);
This didn't work...
why does vscode have a cartoon teenager in a bra in the corner
hai
you need to pass a function to then
OH
why not :#
hiii
:3 *
.then(message.member.roles.add)
or
.then(role => message.member.roles.add(role))
its ishtar from fate
message.guild.roles.create({
data: {
name: 'Chill',
color: '#7289DA',
},
reason: 'A role for Chill',
})
.then(role => message.member.roles.add(role))
.catch(console.error);
like this?
Errr.. nothing more to show than what I explained:
timer_test = setInterval(() => { app.test(); }, 5000);
test()
{
const { something } = require("./hello.json");
}
// hello.json
{
"something":
[
"default"
]
}
Adding an element the array something and saving the file will not update the var inside my function.
Even if I'm requiring it again.
so im just gonna leave this here. currently unpicking a really bad bit of code for work with the aim of rewriting it. its full of stuff like this.
$today = date('Y-m-d', strtotime("+" . $dayPlus . " day"));```
comments anyone?
delete require.cache before importing
im beginner at developing discord bots, and i want idea for bots that can i start with it???
Might work, try again
start with moderation i feel its the easiest
yikes, didnt
oof
Oh... node has a require cache, damn didn't know that
i mean, how are you modifying something?
just by going into the file, adding an element, pressing save?!
You were supposed to use roles.cache i just remembered

outside of the program?
pls can u explain ???
yes
it created the role
require caches the file in memory
Yeah as code said, so I'm forced to delete it's cache then
or use fs
cool
fs.readFile would be better if you dont want caching
weird tho, never heard of a cache of the required files
start with ban and kick commands and make like a lil moderation bot
do dynamic imports in es6 cache the file?
yeah might be an easier solution
does json even work with that though
@green kestrel you dont happen to use local hosts or anything do you :3
ohh okeey thanks
yww
you can literally console.log(require.cache) xD
local hosts?
i swear to god if there's a command in the bot for too many CAPS-
i mean, if it didnt have a cache, then everyone would be constantly re-reading their dependencies all the time, whch would be stuipd
nodejs and express local hosts
Now I know it exists, yes I can, didn't know it does even exist
not sure what you mean by local hosts, you dont mean like localhost as in 127.0.0.1 yes?
i dont even use node.js 😛
THIS WAS THE REASON WHY I SAID instead of requiring the files over and over again, pass all the arguments to your files
And you replied with something NOT nice 
Because I wasn't aware of the cache
yea like mine is 127.0.0.1:1027
imagine
// index.js
module.exports = require("./index.js");
you dont use node?
lmfao
oh :3
i use this: https://dpp.brainbox.cc
🔌
At least we could figure that out right now...
Makes things easier for me right now tbh 
hmm that plug emoji is THE worst. it doesnt show right on dark mode
good thing i use light mode
why is tupper offline?
ask him
https://gist.github.com/spiralw/091714718718379b6efcdbcaf807a024 transcript of message.content Q&A if anyone interested into it
One last question regarding that.
Importing methods of classes is okay but what if the method relies on a different method within the class?
const config = require("./src/config.json");
const utilities = require("./src/utilities.js");
const database = require("./src/database.js");
const application = require("./src/application.js");
const utils = new utilities();
const sql = new database(utils);
const app = new application(utils, sql);
// utilities.js
class Utilities
{
test()
{
// not important
}
whatEver()
{
this.test();
}
}
// application.js
const { whatEver } = require("./utilities.js");
// OR
class Application
{
#utils;
#sql;
constructor(utils, sql)
{
this.#utils = utils;
this.#sql = sql;
}
}
Would that be the recommended way?
Actually... what would you recommend?
i'd put unitilies in the constructors
I'm passing the initiated classes to the classes
const sql = new database(utils);
const app = new application(utils, sql);
const Utilities = require("./Utilities.js");
class Application {
constructor() {
this.utilities = new Utilities()
}
}
hmm... so an initialization again
yes
Is there a benefit or contra vs mine and this version?
you have a self-contained instance of Utilities that belongs to Application only, and its not shared with anything else
keeps all the state in the same place
if all utilities methods are stateless then you can do something else
you can create something similar to an interface for example, for classes that have the exact same methods
i did this in one of my libs, there i have a client and a server class that share methods
it keeps telling me its missing "canvas.node"
i tried searching it everywhere on npmjs.com but didnt find it
(ping in replies)
const interfaces = {
method1() {}
method2() {}
}
class A {}
class B {}
for(const [name, method] of Object.entries(interfaces)) {
A.prototype[name] = method;
B.prototype[name] = method;
}
thats a way to create functions once, and add them as methods to multiple classes
that means its not installed correctly
Yeah I mean I could extend the classes and init it once like I do in PHP but I want to split it up in a few files for a better overview
so i should re-install it?
which package are you installing?
canvas
Anyway, I got what you mean, thanks for the explanation tho
canvas directly? or something that needs canvas to work?
ye you can also have a base class and extend it, thats a better way to do it
@clashperk/quickchart
it just sucks that js doesnt support inheriting from multiple classes at once
oh wait one second, I haven't mentioned something
can you show the install logs ?
im using a host and it doesnt show it, but in dependencies its this:
"@clashperk/quickchart": "github:clashperk/quickchart"
In my example above I init const sql = new database(utils);
The constructor within the database class is calling the function this.#openConnection();
Initing the database in application.js again for example, would open another connection
which host?
ah its one of those pterodactly shit
you should have access to a terminal no?
it should have logs there somewhere
ya i got terminal..
Oh
wait there are logs in settings...
ill copy paste em here
time do download the internet
the install logs should show in the terminaç
Go download the entirety of YouTube to show those fools what a bad idea it is to give you an unmetered connection
there is no log of today..
It gives the logs of yesterday so i think they will show todays log tommorow... :/
if a single application contains a single database, then i would instantiate the database inside the application
but if you have multiple applications accessing a single database, then yes, pass it as an argument
there has to be npm install logs somewhere. if you cant find it, then ask their support
download a 8k uncompressed shrek movie

ty and enjoy my gift 
The only guess I have for my app stopping responding is my Mutex being locked at the time of being used, but I'm not sure why that could be the case
no problemo... it's not the first time you helped out a lot
:)
oh JS doesn't require to declare the var inside a class before assigning a value to it in the constructor()
?
js doesn't require anything tbf
lol
just throw it all somewhere, mix a bit and it somehow works
class Application
{
#utils;
#sql;
constructor(sql)
{
this.#utils = new utilities();
this.#sql = sql;
}
...
well PHP requires to declare the vars before using them, which makes sense I mean
as in this example above
weird I thought I need the declaration, too (const var or let)
yeah I agree JS is weird sometimes
anytime
typescript does it like that
pure js doesnt require anything since everything is dynamic
// @ts-expect-error go Brrrr
n.help
client.on("message", (message) => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'help'){
client.commands.get('help').execute(embed, args);
}
});
this is my trigger code
name: 'help',
description: "send help embed",
execute(message, args){
const embed = new Discord.MessageEmbed()
.setTitle("COMMANDS")
.setDescription("list of commands")
.setColor('#40E0D0')
.addField("savetag","Tells you how to save your shiny-hunt ping tag ")
.addField("retag","Tells you how to change you shiny-hunt ping tag")
.addField("deltag","Tells you how to delete your tag ")
.setFooter("use my commands by alice <command>")
message.channel.send(embed);
}
};``` this is the "help" command code
can any one help why is it arrising this error (||i am new to coding , i will be grateful if you help||)
Yes , but not an already existing command I just shifted this command from base command handler to advanced one and now this is the error
// @ts-ignore
well, you need to fix loose points
it's trying to execute "help" at index line 207
For some reason top.gg is messing up my alignment?
Also the colors...
The text color seems to be a darker on top.gg
they probably changed something that messed up your css
Ahhh I just did display: flexbox; for the images.... Seems to work now...
flexbox the cause and savour of our issues
Hi, I'm new to bot development, made couple of easy bots. I want to create a bot which tracks vote for server cast by users and award them role.
Can someone show me some docs or open source code for tracking votes on top.gg for server ?
@lunar cove the dsl bot already does that
woah, that's great but I want to assign roles on the basis of votes and dsl won't do that so I was thinking of creating a separate bot, am I going the wrong way ?
it is possible
there are api endpoints to see how many votes the user gave
you can also use webhooks to fire events when a user votes
Documentation: https://docs.top.gg
Well I read this but it was a bit confusing, can I see some code utilizing all this?, I would be really grateful to that as it might help me in understanding this
You can see other people's (suffering) code in #topgg-api
Ohh thanks that is helping me understand better.
Also how to get your webhook auth in
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("your webhook auth")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)```
btw you're ignoring your prefix lol
if message content starts with prefix, return
ah
How do you add a color list to your server?
@rustic nova#development message
Wdym?
When i was on my server color chan said you need to add a color list
ask in its support server
Lol
rip
fill all dem ports
Hey, how do I add some ads to my site? to all pages and to the vote section so I can make some money
I need vote thx code
u can either use carbon ads or google adsense, they r the two i know which are actually pretty decent. although im not too familiar on the requirements
God save the PiHole
wut
sus
You can just use adguard DNS too. No ads ez
I don’t think so… not gonna route my traffic through an unknown service provider
Gotta love it when your bot decides to throw a fatal error and continue to make multiple instances of itself (somehow) until your VPS runs out of ram and kills the process...
Fun
It's more fun getting rate-limited by Discord for 72h because of an unavailable guild that caused a crash loop overnight.
Attack of the clones
There should've been no reason for it either
No commands were run that caused the error
No reason for my bot to try to add files
Was already online for a few days
No logs for a restart of the bot
Happened literally out of the blue
AI is enveloping trying to devastate human life!! 
0|npm star | Loaded with:
0|npm star | commands: 17
0|npm star | cached users: 1457
0|npm star | total users: 1704
0|npm star | cached channels: 408
0|npm star | cached members: 1521
0|npm star | cached guilds: 17
``` kept caching more and more users till it was out of ram. There should only be about 300 users cached right there
1.5k cached users is baby cache
Yeah, I know
But it was also caching those users over multiple instances of itself (I think)
So like 1500 cached users in tons of instances of itself
Not something that my 1gb RAM vps was prepared for 
Hmm well 1GB isn’t really much at all
Small bot and/or cache management?
Small bot + detritus clusterclient
you can easily fit a decent bot in 1gb if you cache well
It fits perfectly fine
This just randomly happened
Hasn't happened since
Happened about 6 hours ago, PM2 killed the process when it ran out of memory and started a new one. No errors.
(And the bot was up for a few days before this event)
memory leak?
Nope
0|npm star | [
0|npm star | ImportedCommandsError: Error while importing multiple commands
0|npm star | at CommandClient.addMultipleIn (/home/opc/wafflebot-detritus/node_modules/detritus-client/lib/commandclient.js:248:19)
0|npm star | at Object.execute (/home/opc/wafflebot-detritus/src/events/clusterClient/gatewayReady.ts:14:7) {
0|npm star | errors: {
0|npm star | '/home/opc/wafflebot-detritus/src/commands/admin/listguilds.ts': Error: Alias/name `listguilds` already exists.
0|npm star | at CommandClient.add (/home/opc/wafflebot-detritus/node_modules/detritus-client/lib/commandclient.js:182:23)
0|npm star | at addCommand (/home/opc/wafflebot-detritus/node_modules/detritus-client/lib/commandclient.js:212:22)
0|npm star | at CommandClient.addMultipleIn (/home/opc/wafflebot-detritus/node_modules/detritus-client/lib/commandclient.js:241:17)
0|npm star | at Object.execute (/home/opc/wafflebot-detritus/src/events/clusterClient/gatewayReady.ts:14:7),
Did this error for EVERY command and alias
And I assume it decided to create more instances of itself because it had more cached users than usual (normally <300, it had 1700)
Oh, apparently a larger discord server added my bot, so I have 1500 total users now. Shot my ram usage up from 8mb to 41mb
Seems rather large for a measly 1500 users, though
Do Gateway intents eat up RAM?
Yes
Makes sense
I have a lot of the gateway intents enabled, should probably disable the ones I don't use
intents: [
GatewayIntents.GUILDS,
GatewayIntents.GUILD_MEMBERS,
GatewayIntents.GUILD_MESSAGES,
GatewayIntents.GUILD_PRESENCES,
GatewayIntents.GUILD_MESSAGE_REACTIONS,
GatewayIntents.DIRECT_MESSAGES,
GatewayIntents.DIRECT_MESSAGE_REACTIONS,
GatewayIntents.GUILD_VOICE_STATES,
]
``` lol
I suppose it'll eat up a lot less ram whenever I migrate to slash commands though
Not sure, just monitoring using the basic stuff PM2 gives me for my process
the only way i can see pm2 reporting 15mb for a node.js process would be if the OS is swapping it out and putting half of it in the page file lul
well, there is top/htop
but usually pm2 does a good enough job, since most servers are not configured with heavy swappiness
132mb sounds reasonable
So estimate that node itself uses ~80mb
yes, anywhere between 40-80 is considered normal for node
Not terrible I guess, long term I'll likely have to upgrade if my bot continues to grow
it can go as low as 25 if its idle for a long time
Half of the usage I have is probably from gateway events that I don't even need to receive
If I get approved how to know that
Ohh
With a message showing either your bot getting approved or declined
Also I believe @livid jackal will send you a dm
i have a couple node processes running web servers that are rarely accessed
they are sitting around 25-30mb
(RES is what matters)
nice
I'll look into removing as many gateway intents as possible to reduce my ram usage
not nearly as much
GUILD_MEMBERS used to
but not anymore after discord's changes
I also need to remove it anyways as I don't feel like applying for a gateway intent I don't even need (in the future)
disabling PRESENCES now automatically disables 90% of MEMBERS anyway
disabling those two will reduce your cpu usage by like 90% lol
CPU usage is only at like 2% for me anyways
But I guess it'll get heavier as I cache more users
it gets heavier with more guilds
without presences, your cpu should go from 2% to 0.5% lol
I'll do that rn to see the difference
If I disable presences, I assume I would need to fetch the members instead of trying to grab them from the cache?
ye
If I'm not caching the users, how would I tell how many total users there are? Loop through cached guilds' member count?
Currently using this: ```ts
let guildCount = 0;
let userCount = 0;
let memberCount = 0;
let totalUsers = 0;
let channelCount = 0;
for (const shard of (client.client as ClusterClient).shards.values()) {
guildCount += shard.guilds.size;
userCount += shard.users.size;
for (const guild of shard.guilds.values()) {
memberCount += guild.members.size;
totalUsers += guild.memberCount;
}
channelCount += shard.channels.size;
}
Nevermind, was a bug
member doesnt exist on webhooks
check for message.webhookID (webhookId in v13) or check for message.member
checking for message.member works for both dms and webhooks at once
the pointless breaking changes of discordjs
did you see the last commit?
they bumped required node.js version to 16.6+
like wtf
yes it should
for fucks sake
cant they just not use the latest syntax there is
there is 95% of the time an alternative
16 isnt even fucking stable
they're having a laugh
can i just take master branch and feed it to tsc and then have output that is compatible with older versions?
i was thinking something similar
but it seems rather annoying
youd have to modify some things and maintain your own copy
ya, jsut saw it
i haven't done that before but it theoretically that should work right?
also on last day they change defer() to deferReply() lolzer
i wouldn't mind
it would probably work
one thing i've learnt is theres no reasoning with the djs community
evie was right lol
tsc wont work, but maybe babel will
ohh im not familiar with babel
maybe have a shell file which runs babel on node_modules/discord.js ?
dont know how it works exactly
you still have to edit their package.json
tbh idk if node respects the engines field
pretty sure it doesnt care
npm only warns you when you do that
i swear every time someone says something that the lets say "djs fanboys" dont like they dont listen lol
sadly its the only frequently maintained library
its frequently maintained because of how chaotic it is lel
just do if(!message.member)
Most of my work is based on interaction/slash now. Someday with the only https request needed for interaction, maybe I start slowly make my own
i'd be using d++ if my bot was in c++ lol since brain actively maintains it
i already did xd
will put on githunb soon
Confidence Tim, the confidence is the lacking factor
other factor is not a factor as now to make my own
i'd totally use a lib that has methods/props very close to djs
because i have a massive codebase
ye plus they are much more stable
and a lib based on them doesnt even need updates to support new featuyres
though if the time comes and theres a lib that doesnt have frequent breaking changes, annoying updates and performant i might put in the effort to completely switch
since it would be better in the long run
in npm is it possible to trigger script of a module when another module is being installed?
like what
i'll play around with babel a bit and see if its possible to directly mutate node modules with backwards compatible code
god i love linux
when i install a npm package.
i dont actually think so
pip does
but i never saw npm do that
except when building node gyp
i do npm i and then a js file from another module executes
like what kind of script do you need
do you have an example?
do you mean the discordjs babel thing
nvm
haha
time to get to business with code .
what you can do is have a script in module 1 that runs npm i module2 then does something
so you would run module1 instead of npm
close enough
lel
well oke
[1,2,3].at(1)
ah yes at
saw it on v8 twitter
i dont really see the point of it
cant you just do arr[0] or something
its made to suppport negative indexes
anyway i'm going to try this idea if it works
i really need to install nvm on my system
so you can do .at(-1) for the last item
arr[arr.length - 1] go brr
ye
or even -2!
did double ended iteration get through haha
dont think so
Hmmmm... My node is taking 150mb for only 17 cached guilds, and about 40 cached users & members
Is that normal?
doesnt look nomal
I doubt I have a memory leak but I guess it's a possibility
femboy vibes does the job
45mb with 72 guilds here, so something might be wrong somewhere
owo
this uwu was sponsored by Arch Linux
This is my cache/intents: ```ts
const commandClient = new CommandClient(process.env.BOT_TOKEN as string, {
useClusterClient: true,
shardCount: config.shards,
cache: {
presences: { enabled: false },
emojis: { enabled: false },
messages: { enabled: true, expire: 60 * 60 * 1000 },
},
gateway: {
loadAllMembers: false,
intents: [
GatewayIntents.GUILDS,
GatewayIntents.GUILD_MESSAGES,
GatewayIntents.GUILD_MESSAGE_REACTIONS,
GatewayIntents.DIRECT_MESSAGES,
GatewayIntents.DIRECT_MESSAGE_REACTIONS,
] /* 'ALL'*/,
},
by raid shadow legends
funnily enough i've never used babel
nextjs abstracts it to the point of me never seeing it so im diving in first
how many shards? just 1?
what does process.memoryUsage() say?
Is there a way to run that using PM2, or do I have to edit a file to log that?
Or does pm2 monit do the job
edit file or eval comand
shit, always knew I should've made an eval command
lel
lol
Making one for the next update I push to it, but still haven't started on that yet
pm2 monit says the process is using 42mb of RAM
where did you read 150mb?
top
under RES?
Yup
you know theres no hope when babel itself doesnt understand the syntax
put it in the ready event
rip
does babel seriously not support optional chaining
it says on the babel site to install a plugin for it
what lmao
for a tiny feature
kekw
lmao
assign if not null/undefined
thought so
basically same like ?.
no?

not me