#development
1 messages · Page 690 of 1
or DV
whoever can pls
im stupid
so it doesnt work
there is link to code
its not handling my aliases
lol
I may have infinite iq but I cant tell the difference between java and js
If you can't tell the difference between js and Java you shouldn't be allowed to code
c++ and c makes sense
Not java and js
@topaz fjord apologies for the extra ping, but may you please help?
@inner jewel cn you help ?
Link to code^
don't randomly ping people
pinging multiple people doesn't warrant help
Its not random technically 
bot.aliases.set(pull, pull.config.alias);
yes
you're setting the key to the command
?
jsfile.forEach((f, i) => {
let pull = require(`./commands/${f}`);
bot.commands.set(pull.config.name, pull);
pull.config.alias.forEach(alias => {
if(alias !== "") {
bot.aliases.set(pull, pull.config.alias);
}
});
});```
think about the types there a bit
bot.commands.set(pull.config.name
vs
bot.aliases.set(pull
think about what you want to do
think a bit more
pull.config.alias, alias?
😂
...
idk
oh im behind sorry
are you even trying?
this isn't language specific
it's just logic
you want to have each alias (a name) point to the command
Yeah 
bot.aliases.set(pull, pull.config.alias);
this points the command to it's list of aliases
pull.config.alias, pull.config.name ?
ghost ping?
(pull.config.alias, pull)
this sets the list of aliases to point to the command
oh
@west raptor I'll pull your aliases owo
yeah nvm i thought about it
so the input is pull
and i want pull to point to the aliases 
so bot.aliases.set(pull, pull.config.alias)
no

you have a string, which is the command name
you need to get the command from that
bot.commands.set(pull.config.name, pull); is correct
if the input is the same as the name, you get the command
yeah
pull.config.alias, alias?
pull.config.alias is not a string
and what would setting the value to be the alias help with?
i dont know, im totally lost
i know i want to take the input
and change it to the command name
so
...

the first value should be pull
because that takes the string no?
the first value is what identifies the entry
which will be a string if it's the command name
yeah
so f
cause thats the cmd name

so the second value should be what i want the input to be translated to
what you want is to have each alias (a string) map to eg the command
but pull wont get anything because it only looks for a file with the same name
so how do i get a cmd from an alias if the cmd filename is different
you already know the aliases
Yeah
you just need to make them point to the same command
Yeah
setting the name already works
so you just need to do the exact same thing but for each alias instead of name
no
oops
no
WHY AM I DUMB
the name doesn't point to the aliases
the aliases point to the name
or, even better, directly to the command
yes
seriously?
alias, pull
lets test
it didnt work

@inner jewel i just dont get it
@orchid raft thats the code
but its not recognizing my aliases
np lol
what are you having trouble with? just do the exact same thing you did with the name, with each of the aliases
how did you try it?
bot.aliases.set(alias, pull.config.alias);
thats pointing an alias to a list of aliases
think about it
imagine this
pull = {
config: {
name: "something"
alias: ["alias1","alias2"]
},
run: function(){}
}```
this is more or less how your command looks like, right?
so if you do aliases.set(alias,pull.config.name) you get ["alias1","alias2"] pointing to "something"
yeah
oh
you want the user to type an alias, to get a command
or the entire file by the looks of it
yeah
your entire file is contained in the pull variable, so you need to point whatever it is to it, for starters
.set(anything,pull)
pull is always the result you want
ok
so it should always be the second argument
now the first argument is the key, the name the user needs to use to access the result
oh shit its an array
you already did it with pull.config.name
no, you need to loop over the array
oh
and for each item, set it as a the name
yeah
you cant use it as a key
ok
you need to take each of them and use each of them as a key separately
yes, that should do it
bot.aliases.set(alias, pull);
well
pull.config.alias.forEach(alias => {
if(alias !== "") {
bot.aliases.set(alias, pull);
}
});
could be anything
the error im getting is
``cannot find module './commands/b.js'`
b is one of the aliases for ban
then you did something wrong
ok
how are you checking the command when a user types one?
um
lemme copy-paste the code rq
bot.on('message', async(message) => {
if(!message.guild) return;
if(message.author.bot) return;
if(message.content.startsWith(`<@${bot.user.id}>`)) {
let embed = new Discord.RichEmbed()
.setTitle(`${message.guild.name}`)
.setDescription(`My prefix is \`p!\`.\nTry running the commands \`p!help\``)
.setColor(`RANDOM`)
.setTimestamp();
message.channel.send(embed);
return;
}
let prefi = false;
for(const thisPrefix of bot.config.prefix) {
if(message.content.startsWith(thisPrefix)) prefi = thisPrefix;
}
const prefixMention = new RegExp(`^<@!?${bot.user.id}> `);
const prefix = message.content.match(prefixMention) ? message.content.match(prefixMention)[0] : prefi;
if(!message.content.startsWith(prefix)) return;
if(bot.working && !bot.config.admins.includes(message.author.id)) return message.channel.send(`The bot is currently under maintenance!\nPlease check back later.`);
let args = message.content.slice(prefix.length).trim().split(' ');
let cmd = args.shift().toLowerCase();
try {
//alias handler
if(cmd === "") cmd = '';
delete require.cache[require.resolve(`./commands/${cmd}.js`)];
let ops = {
ownerID: ownerID,
active: breep
}
let messageArray = message.content.split(" "); //args but whatever it works easier this way
let cm = messageArray[0];
//return console.log(bot.aliases.get(bot.commands.get(cm.slice(prefix.length))));
let commandFile = bot.commands.get(cm.slice(prefix.length)) || bot.commands.get(bot.aliases.get(cm.slice(prefix.length)));
if(commandFile) commandFile.run(bot, message, args, ops, tools);
} catch (e) {
console.log(e.stack);
}
});
wait a tic
i have inconsistent variables
nvm
quick question, you know how you use "node ." to run node.js files in visual studio code?
Is there an equivalent for .c files ?
why are you deleting a require cache before validating the command?
i dont know, a guy told me to put that in there to avoid problems
you delete it before any validation, so your code will attempt to delete anything you write to it, even invalid commands
deleting the require cache is used for reloading commands without restarting the bot
it should not be used blindly like that
and you dont want to reload a command every single time you use it
it will spam your machine with disk reads
yes
ok
if(cmd === "") cmd = ''; does nothing
also the delete of the require cache doesn't really matter since it doesn't call require
but its not doing anything anyway
also let commandFile = bot.commands.get(cm.slice(prefix.length)) || bot.commands.get(bot.aliases.get(cm.slice(prefix.length)));
bot.aliases.get is already the command
i dont understand
Is it just me
or did the server crash
@quartz kindle so uh, im not getting the error anymore, but now it wont run the command
WAIT
NO
IT WORKED
OMG
@inner jewel @quartz kindle THANK YOU GUYS SOOO MUCH
you have no idea how long ive been trying to figure that out
thanks a load for helping me
richembed not working
}
const mapjoin = new Discord.RichEmbed()
.setColor(0x008B)
.setTitle(Here are some tips for joining MAP-Projects, ${message.author}! )
.setDescription( 1. Check the Open MAP-Project playlist run by TrailTracker. It usually has every open Warriorcat MAP in it. https://www.youtube.com/playlist?list=PL32DNLXWzFRH0FZx_pnPMZDFiam-qO28H 2. Ask for multiple parts. If the part that you want is already taken, the host will be able to offer you your second, third, or even fourth preferece! 3. Don't comment asking for a part multiple times. This can be frustrating for the host. Unless they ask you to, don't comment again. 4. Apply with the right additude! If you think, or comment "I'm not going to get the part" chances are, you won't. It's best to go in with a positive outlook! 5. Keep in touch with the host. This way, you'll be able to provide a WIP when needed, or update the host on the status of your part! Communicate through discord, twitter, skype, email, or anything!)
.setFooter("**Those are all of the tips I have for today! If you have any suggestions, DM @earnest phoenix!")
if (message.content === 'mapjoin')
channel.send (mapjoin)
})
@earnest phoenix whats not working about it?
@earnest phoenix please use code blocks, i cant understand your code
sorry i dont know how do code blocks
code here
``` ```
gtg
}
const mapjoin = new Discord.RichEmbed()
.setColor(0x008B)
.setTitle(`Here are some tips for joining MAP-Projects, ${message.author}!`)
.setDescription(`1. Check the Open MAP-Project playlist run by TrailTracker. It usually has every open Warriorcat MAP in it. https://www.youtube.com/playlist?list=PL32DNLXWzFRH0FZx_pnPMZDFiam-qO28H
2. Ask for multiple parts. If the part that you want is already taken, the host will be able to offer you your second, third, or even fourth preferece!
3. Don't comment asking for a part multiple times. This can be frustrating for the host. Unless they ask you to, don't comment again.
4. Apply with the right additude! If you think, or comment "I'm not going to get the part" chances are, you won't. It's best to go in with a positive outlook!
5. Keep in touch with the host. This way, you'll be able to provide a WIP when needed, or update the host on the status of your part! Communicate through discord, twitter, skype, email, or anything!`)
.setFooter("**Those are all of the tips I have for today! If you have any suggestions, DM @semi hiatus!")
if (message.content === 'mapjoin')
channel.send (mapjoin)
})
``` @modern elm
hey
im trying to make a giveaway system and i need to fetch all the members that reacted thats my code and its returning a error that fetch users is undefind
You have to use the unicode emoji
how?
Not 🎉
whats the unicode emoji
You can copy it out of the block
ok
is there a way to change what a users current chat is? For example if I was looking in #development something happens and my chat changes to #topgg-api
no
That would be like, really abusable
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Wait what
Where are you even logging anything to the console in that
does the bot have permission to send
One message removed from a suspended account.
One message removed from a suspended account.
Mk
One message removed from a suspended account.
Get a debugger 
One message removed from a suspended account.
What
One message removed from a suspended account.
Gotta know how to use it
vsc debugger is fucking great
One message removed from a suspended account.
One message removed from a suspended account.
He just doesn’t know how to use it
One message removed from a suspended account.
she it
One message removed from a suspended account.
Anyway back to the problem
Are the other commands working?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
You have something like client.commands? Right?
One message removed from a suspended account.
It will
It will
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
send is a function on the channel object, requiring discord won't change anything
Anywaayyy
You have something like client.commands? Right?
Isn’t async(blah, blah) a function
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Yeah you can eval it but he/she/it only has a help command (I think)?
One message removed from a suspended account.
One message removed from a suspended account.
Yeah I guess
I have to use Object.entries(client.commands)
One message removed from a suspended account.
because client is actually bot
Oh you named it bot
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Nonono
One message removed from a suspended account.
One message removed from a suspended account.
It doesn’t matter what you name it in the command file
One message removed from a suspended account.
👀
One message removed from a suspended account.
One message removed from a suspended account.
In the command file you can have it as shithead because it’s just a param
At least that’s what I was told
😂
One message removed from a suspended account.
One message removed from a suspended account.
And if u do <prefix>roll nothing happens?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Weird
this is weird
One message removed from a suspended account.
One message removed from a suspended account.
Set a breakpoint at the rand calculation and then press the second button (next step shitty button) as soon as it triggers
@sage bobcat
One message removed from a suspended account.
amazing
Mmm wonderful embed
One message removed from a suspended account.
Stop shitting, we all started small
no i mean code
One message removed from a suspended account.
I’m not
no how the actual command looks
I’m being serious
Yes me too, good night
I literally did worse then that when I first made an embed
One message removed from a suspended account.
static help commands 🤢
One message removed from a suspended account.
One message removed from a suspended account.
Lol
basically you add all the commands yourself
When you hardcode in the list of commands
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
other bots filter through their commands and generate the help embed that way
One message removed from a suspended account.
You hardcoded the help.
But it's not the problem here
One message removed from a suspended account.
One message removed from a suspended account.
Some people loop through their commands and list them in an embed
Well you actually have to code that functionality
Which is what I do and it’s a simple for loop as well
One message removed from a suspended account.
One message removed from a suspended account.
Use a for loop.
If you wanna do it my method
Probably other methods.
As for your problem with the message send I don’t know
It’s confusing me as well
^
Instead of only exporting a name property, you have multiple properties (like example, description, category).
And in the help command you get all commands and filter trough their properties
Requires some work to setup
One message removed from a suspended account.
I just have a help command that just spits out the name splitting them up in their correct modules. Then have another function inside the help command that gives you more info on the command
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Wdym?
weird
@sage bobcat if you use message.channel.send("hi") does it work
One message removed from a suspended account.
It’s rand
I’m guessing at least
Try sending just rand like message.channel.send(rand)
@sage bobcat
One message removed from a suspended account.
Just try I’m trying to see if it is indeed rand
One message removed from a suspended account.
Hm
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Try this:
message.channel.send('You rolled a ' + rand)
im wondering why `` isn't working tho
One message removed from a suspended account.
One message removed from a suspended account.
${rand} doesnt work?
Nope
Yea
One message removed from a suspended account.
Np
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I forgot try/catch was a thing
👀
How can I sweep my db monthly for users that have left a guild so I can erase their entry for that guild
I have a question about Pollmaster. Hopefully this is the right place. I'm admin of a server and am conducting an anonymous poll with no live results and i'm wondering if there's a way for me, as overseer of the poll, so see the progress/results at any time other than when the election ends?
go to the bot's support server
Ah I see that link now, thanks!
@lusty dew make a persistent scheduler with your database
or use something that does it for you, like node-schedule
Oh?
Well fuck didn’t know that existed
Okay next question
How would I know which people to erase from the database
get all user ids by filtering through guilds, get all user ids stored in db, if the ones stored in db aren't contained in the array full of ids gotten from guild
Cause it could be multiple people not just 1 or 2
delet
That’d be api spammy no?
you aren't doing anything with the api except requesting all members
it's not spammy
True.
what about uncached members?
Yea
you will mistakenly delete them from the db that way
Yea
yeah, you should request all members for that reason
rip ram
i would do something like this
you can fetch individual members by id
that works too
that's even more spammy
you're going to get yourself ratelimited by the time you fetch every user in the database
Fetching 25k+ members individually
fetch only the ones not cached
let ids = await getAllIdsFromDatabase()
for(let i = 0; i < ids.length; i++) {
if(client.users.get(ids[i])) continue;
let fetched = await client.users.fetch(ids[i]);
if(!fetched) delete from database
}
i mean
you'd still be filling up the cache and using more and more ram
so why not request all users at once and avoid the risk of a ratelimit
i forgot if d.js handles ratelimits
it does
you're only caching users for which you have an entry in the db, not all of them
all libs that have a channel in dapi handle ratelimits
also it's something done once a month
discord won't care about the users you'll fetch
yeah that's the concern
Okay now to figure out how to use node-schedule
if you fetch all of them at once it's one request, you send a payload to the gateway saying "hey send me all members in chunks"
this way you'd individually be making a request for each uncached user
one request per guild
and then you get spammed with every single member
if you get the data
which you might not get because discord is discord
I’d have to optimize this one day won’t I?
there might be guilds where none of its users are in your database because they never used your commands
True.
I’m making it so on guild join they get an entry
iirc it caches on PRESENCE_UPDATE
yes, but im saying creating an entry in the database for them
should only be done on command usage
Why?
why create entries for people who will not use it?
Eh but it’s pointless keeping them in the db if they aren’t in the guild anymore.
when i had a public bot i usually deleted user data from my db 48 hours after the user left the guild
i'd clean a database like that maybe once a year
Only reason I’m sweeping on a one month interval is because some people get too aggravated
And leave the guild but come back but eh
log a time stamp for last time they interacted with your bot
and delete them if they havent done so for over a year
lul
I could increase the time limit on the sweep
i've never cleared it and it's small enough i don't need to worry about cleaning it
although i only create data when needed
Same.
it also depends on how much data you store
my database is like 2mb
but my user-generated image folder is 600mb lul
Yea only entry I’ll create for table will be for guilds.
Guild and Economy.
I have a separate table for Economy functions.
But users get a balance written to them
TimToday at 1:24 AM
but my user-generated image folder is 600mb lul
relatable, except i kept my images stored in memory in a byte array so i hit around 1.8 gigs ram usage once
why
Hm, I wonder where I’d get the images from for my api
i think it was mainly because it was served from a web server
Really?
ye
its not cool
json db cool
Usually my data corrupts after 1h
it hardly works
that's about how much data i store
1.1k guilds and 7k users
- some oauth data
yeah i have 5k users in the db
Any suggestions on how to get/store images for an image gen api
the users i show are only those who interacted with the bot and have a db entry
lul
there's also oauth and starboard data
but those are a pain to count because of how they're stored
i believe it
tfw you can't be bothered with refresh tokens so you make your sessions expire after a week instead
lmao
just store their ids in localstorage huehue
Any suggestions on how to get/store images for an image gen api
no
@quartz kindle that's what i do (kinda)
but i keep the tokens so i can fetch the user's guilds
Uhm discord bot list disappeared from my server list
Had to go to the website to get the invite again to view the server
discord's servers casually having a stroke
Kek
Discord bot list in general gets shortages
const mapjoin = new Discord.RichEmbed()
.setColor(0x008B)
.setTitle(`Here are some tips for joining MAP-Projects, ${message.author}! `)
.setDescription(`
1. Check the Open MAP-Project playlist run by TrailTracker. It usually has every open Warriorcat MAP in it. https://www.youtube.com/playlist?list=PL32DNLXWzFRH0FZx_pnPMZDFiam-qO28H
2. Ask for multiple parts. If the part that you want is already taken, the host will be able to offer you your second, third, or even fourth preferece!
3. Don't comment asking for a part multiple times. This can be frustrating for the host. Unless they ask you to, don't comment again.
4. Apply with the right additude! If you think, or comment "I'm not going to get the part" chances are, you won't. It's best to go in with a positive outlook!
5. Keep in touch with the host. This way, you'll be able to provide a WIP when needed, or update the host on the status of your part! Communicate through discord, twitter, skype, email, or anything!
`)
.setFooter("**Those are all of the tips I have for today! If you have any suggestions, DM @semi hiatus#5641!")
if (message.content === 'mapjoin')
channel.send (mapjoin)
})```
richembed not working
what is not working
the command. just doesnt work
how are you invoking the command
just typing mapjoin
fixed it
I love getting ratelimited and having to wait 3h to get my beta bot back online
How did you manage to get rate limited that much
Apparently something caused an error and made my bot login over and over
It wasted all your identifies?
Owie
The bot was offline though so idk how it got ratelimited
Yea lel
The production bot still up and working properly
Just noticed it stopped posting to dbl for some odd reason
why are you sending a message instead of logging it to your console 💀
Eh
I don’t wanna check console every single time
Kek
If it isn’t working I can look at that channel and tell bc it isn’t sending
My bot has the mute role ... why ...?
I see ... Thank you for telling me.
you can ask a unmute to a mod, just ping a mod and explain your problem
I got a quick question regarding a role assignment I added then tried to remove but the reaction is still there. Is this the appropriate place to ask?
for Zira bot
lol thanks
how can i fix that when i leave vc but my bot keeps playing music, and when rejoin it still plays?
@warm marsh @amber fractal sorry for being a little mean yesterday, been stuck at that issue for long :c
Hi guys, do you think you could add Runescape Patch news to your bot? Would be much appreciated
@ivory vessel this iant a support server for a bot
Join the bot's server and ask there.
ah sorry, alright. thanks
:+1:
Code: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Yukki</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="wrapper"> <h1>Page</h1> <img class="img" src="img/img.png" alt="img"> </div> </body> </html>
im new to html and css
Are u asking for help?
yea...
Where’s this file located and where’s the image that you want
in my folder
its on my desktop
Use /img/img.png instead
ok
its still just "img"
Screenshot the folder for me
fml
:P
What’s the code now
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Yukki</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<h1>Page</h1>
<img class="img" src="/img/img.jpg" alt="img">
</div>
</body>
</html>
DiD yOu ReLoAd ThE pAgE
...ofc i did
Try and remove the beginning / again then
kk
Yes ik big yoke
Lol
thx
how can i fetch the last ban in audit log
🤔
(discord.js)
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=fetchAuditLogs see options.type, and options.limit
guild.fetchAuditLogs({ type: "MEMBER_BAN_ADD" }).then(logs => console.log(logs.first()));
TypeError: logs.first is not a function

Just read what the person above said and use options.limit
logs.entries.first()
that also
hmmm
limit would still return a collection so you'd need to do .first() still anyways
But yeah if you're trying to get 1 fetching other stuff isnt needed anyways 
Alright lets retry
i need to find a way
to match lets say two lists
[a, b, c, f, g, l, n]
and [f, l, a, c]
if [a, b, c, f, g, l, n] contains ALL values in [f, l, a, c]
which it does
then it passes
current dbfiddle: https://www.db-fiddle.com/f/susZ1iBDiBbZvEJRUKT54i/4
An online SQL database playground for testing, debugging and sharing SQL snippets.
The guy who solves this issue is bigbrain of the year smh
hey im trying to build a invites command, thats my code, its returning me invites_.find(...).catch is not a function error
does somebody knows whats wrong?
thats the code in the ready functions thats backsup all the old invites
because its not a function
so how to do it?
.catch is used to catch an error generated inside a promise
.find is not a promise
so i need to remove the .catch?
.find doesnt return a promise, so .catch
Also returning in a .catch will just return, the rest of the function will continue I believe
yes, returning in a catch does nothing
i did it because if the bot doesnt have perms to look at the invites so itll just return
it wont, it will error anyway
so if ill remove the catch itll work?
try it
ei.get() is not finding anything
so what should i do?
Tim refer me to a PostgreSQL specialist or smth
idk any lol
dammet, my problems are too difficult 
thats the code in the .on ready
so its backing up all the invites
i need to do like a interval that updates it?
returning inside a catch doesnt do anything, you could simply have .catch() and it would do the same thing
but thats not your problem
for your problem you need to console.log(ei) to see what it looks like
you can also console.log(i) inside the find, to see if i is what you expect it to be
and remove the other catches?
when something isnt working, just console.log all variables, and you will probably find some of them do not have the values you think they do
99% of programming problems can be solved that way
ill try it
but
lets pretent
that someone
making a new invite link
after the bot is already ready
so the invites variable wont update
so
i need to do like a interval that updates it?
you should update it when the user creates it
theres any listener on discord.js to when a new update link is generated?
Even better than console.logs are breakpoints (or even conditional breakpoints)
a interval can solve it too?
cuz i tied to use guild update and i didnt got how to capture new invites links
just do every time that the guild is updated
just to update the invites var automaticly?
or i need to see if any invite link has been added
You could do some testing to see if guildUpdate actually fires for new invites
If it does
You can fetch the invites on each guild update and replace the ones you have saved ig
But that would also fire a lot for other reasons

discord.js need to make a new listener for that
but ill try it
is the order good?
cuz i need the new guild and the old guild
the first one is the old guild or the new one?
do i need to perform extra steps to get server count and online check on the discord bot list website?
or it just takes some time?
the guild update isnt fired when a new invite is generated
theres another method of doing that?
maybe raw?
guildCreate
guild create is when the bot joining a server
ah
well i guess you can try listening to any and see what pops up when you create the invite
yeah but its just i think useless
somebody else maybe?
ill ask in discord.js's server
i asked in theire server
and i didnt got it
thats why they said
the usual option is to force invite creation to go through the bot so it can track it
they also said that theres no event that fired when a new invite is created
i know
i just asked if there is one
i didnt asked them to add
did someone know what they ment>
discord.js need to make a new listener for that
i ment discord
theres also the ugly ass way of just checking invite lists and comparing them in intervals
can bot mute member in voice channel?
If it has perms
thx
how to play an audio (discord.py) with .play? I tried bot.play / channel.play / ctx.channel.play.......... but nothing

@earnest phoenix try getting audit logs, however idk should it be periodic or what
margin: 0;
padding: 0;
}
.img {
width: 2500px;
height: auto;
}
body {
width: 100%;
height: auto;
overflow: hidden;
}
.content-wrapper {
width: 80%;
margin: 4% 10% 5% 10%
}
.content-wrapper img {
width: 100%
}
.text-wrapper {
width: 100%;
position: relative;
margin-top: -40%
}
.text-wrapper h1 {
text-align: center;
color: #ffffff;
font-size: 10vw;
font-family: "manjari", "cursive"
}```
help
how do i get it in center
pls
Have you tried https://css-tricks.com/almanac/properties/v/vertical-align/
how can i communicate between the ShardingManager and the shards it spawns in d.js master?
trying to create sort of a "global cache" system, where the shard would retrieve a value from the ShardingManager, so the shards can stay consistent
(i know redis is made for that, and i also did it with a webserver solution before, but wouldnt this be signifcantly faster?)
client.shard.send
tbh its kinda cancer, I would use veza, and on start the master process sends his ipc port to the shards, and then they connect
cuzz veza allows request => response and more
Where do i put the code of the bot that makes the bot do the things?
are you talking about https://www.npmjs.com/package/veza ?
i ended up using pm2's own functions for my IPC system
yeah
since im making it heavily pm2 based
@jade thistle read #502193464054644737
I mean, its just how I would do it, you are free to use what you want
@loud salmon thanks
I already use veza for all my shit and I really like it
i will look into it, thanks
Basically like this:
- Master forks child
- Master sends the child his IPC port
- Child connects to given IPC port
- woho, the server can now emit events, respond to requests from children, etc
is it compatible with what d.js already does with ShardingManager?
You dont need the d.js sharding manager to communicate with your childs (only once after you forked a child)
aight, thanks
i normally use flex to center
great tool
I'm running into some issues installing erlpack@discordapp/erlpack please tell me what to do to fix it. I tried running it as root as well.
Doing 'npm install discord.js` doesn't do anything either
Lemme try getting a better view
A dependency discord.js needs
Lemme give the error in text
You don't have to manually install the dependencies of your dependencies
Oh ok
:P
I feel dumb now
For my bot?
K gimme a sec to get it up
const client = new Discord.Client()
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
client.on('ready', () => {
var generalChannel = client.channels.get("619559849264676864") // Replace with known channel ID
var message = readline.question("Please type your message")
generalChannel.send(message)
console.log(`Your message has been sent. Your message was :`message`)
readline.close()
})
})
bot_secret_token = "This is my token I am not gonna reveal it lel"
client.login(bot_secret_token)```
I'm trying to get user input working
Yeah
No
Not yet
I was about to do that for the guide
It's just a general userinput guide for nodejs
Is the end user going to be typing in the console?
Other wise I'm following this guide: https://www.digitaltrends.com/gaming/how-to-make-a-discord-bot/?amp
How to Make a Discord Bot | Digital Trends
Nah only me
Wait wrong guide
Eh
Idc
I would recommend the guide made by the devs of djs https://discordjs.guide/
A guide made by the community of discord.js for its users.
Ok thanks!
Btw I'm following the guide at https://www.devdungeon.com/content/javascript-discord-bot-tutorial
But I'm tryna get userinput mahself
erlpack is an optional library that can make discord.js slightly faster and/or use less resources
im making progress bar for level
using canvas contructor :
so i make a rectangle
then
?
i can do the math
but idk how to make the color go across the screen
make another rectangle
and make its width equivalent to the width you got from your math
ok
Can someone help install erlpack then?
If it makes it faster that would be a huge boost
the current version is outdated and not compatible with node v12
you can try using a fork made by someone else
Oh ok thanks
the installation process is different for v12
Oh how do I do it?
you need to have git installed, then npm install discordjs/discord.js
Do I do npm install zlib-sync or something else?
yes
im using mobaxterm
For Android?
idk about android
nvm , idk how to do the math :/
calculate the percentage of completed xp and then cover that amount of percentage in the width of your xp bar
hm
get current xp
get xp needed for next level
convert both into percentages
make a rectangle with a specific width, that width represents 100%
make another rectangle with the width equal to the percentage of the xp needed
so i get percentage
what will i put in rect
.addRect( , , , ,)
has to be numbers in?
the first rect you decide
its the rect for the 100%
the second rect is the width that is equivalent to the percentage
for example, if you make a rect with 400 width
and someone has 50% exp
the second rect should be 50% of the max with
or 200
hm
ok
ill come back if i need help
ima get
percenttage
.addRect(169, 500, 500, 30) // bar 1 base```
i calcualted
percenttage
now?
@quartz kindle
did you draw them? what do they look like?
const output = await dl.Fetch(message.author.id)
var xpDifferenceBetweenLevels = (100*output.level);
var pxp = ((output.xp - output.level) / xpDifferenceBetweenLevels)
console.log(Math.floor(pxp*100))
var barsize = Math.floor(pxp * 100);
if ((barsize <= 0) == false) {
barsize = (barsize - 1);
}
const fsn = require('fs-nextra');
const image = await fsn.readFile('./profile/profile.jpg');
return new Canvas(1010, 750)
.setColor("#2C2F33")
.addRect(169, 500,pxp*100, 30)
.setShadowColor('rgba(22, 22, 22, 0.8)')
.setShadowOffsetY(5)
.setShadowBlur(30)
//.setColor("rgba(10,10,0.1,0.2)")
.save()
.fill()
.restore()
.setTextAlign('center')
.setTextFont('24px Impact')
.setColor('#FFFFFF')
.addRect(169, 500, 400, 30)
oh
so
what should i use?
Canvas
?
@earnest phoenix if you cant use canvas-constructor you wont be able to use canvas lol, its much harder
try removing those save fill restore lines
idk why you have them there
also, how are you sending the drawing to discord?
No
Nope
Test it on another bot
How do I input a message into the terminal and make it output a message to my desired channel
you need an i/o interface in your terminal
How would I set that up... 😅
look for a library that does something like that
or use node's inner libs if you're using node
Ok thanks
the problem is
@quartz kindle does node have a console input by default?
to use an interface like that, you need to set up your program to await user input
meaning you need to be manually running it
and if you close it, your bot will go offline
to do something like that reliably, your bot would need to run a service or a server that is listening to something
and have another application send messages to it



