#development
1 messages Β· Page 1700 of 1
const Discord = require('discord.js')
modules.exports = {
name: 'record',
run: async (message, args) => {
const avatar = `${message.author.displayAvatarURL({dynamic: true})}`
const embed = new Discord.MessageEmbed()
.setTitle("Voice Recording")
.setColor("RANDOM")
.addField("**How does it work**\n - !record in a voice channel records your voice\n!play-audio plays last aduio from author\nabusing/spaming is forbidden", false)
.setThumbnail(avatar)
.setFooter("play audio")
message.channel.send(embed)
}
}
Now working did I forget something?
oh yea. i didnt read thru the entire docs. clearly. because if i had! I MUST HAVE UNDERSTOOD IT!
OH
yes it does
Lmao.
it is
poggies
bye
wtf is going on
help
Love the Toxicity 
if a book says "A banana is yellow" then you understand the banana is yellow
reading with understanding β¨
its honesty not toxicity
if anyone here would be willing to help me. then tag me. if not then fuck off and leave me alone. im going out of this chat now
yes, you have to learn it if you want to do that. Thats how human brain works
No idea what you're trying to ask, you didn't forget anything as it seems?
When you read something you dont understand it straight away, you know. Everyone is different
So something which may apply to you or other experienced developers may not happen to others
you said that the last time too
you're throwing tantrums in this chat because nobody wants to write code for you
but it's not working at all

im not even experienced. iv been doing this for a year but people treat me like iv done it for 5 decades
Ya
if you don't want to learn then stop crying and yelling at people
How does it not work exactly?
listen, you cant understand something if you dont learn it, you cant read it once and understand
hmm
takes time
so i put the id and hash into the url and then it'll return the image?
sorry im dumb sometimes
lemme just drive this plane fuck tutorial
yes
green means start right?
https://cdn.discordapp.com/avatars/<ID of the user>/<Hash of the user's avatar>

my 'node index.js' doesn't work
That still doesn't answer my question
tip: you don't even need an extension, discord will automatically decide what's the appropriate image format to return
it just doesn't work :|
not responding
yea
show any error or code
Society
hmm..
/avatars/
OH
PepegaBlind moment
Why blind?
IT WORKED!
they followed your old one
but my nitro expired but the gif is still there
I guess
LOL
lol so
discord doesn't actually delete the gif
they just make everyone who's viewing the profile use .png
nope
It works perfectly :D
Also I think you can pass the <InteractionResponse>.member.user to <discord.js>.User() class to make it easier to deal with
thank you so much guys! :DDDD
you cant run anything with node right?
also yes 1st of september is my bday lol
@frigid mountain #development message
yea
v12
Refer to my message I guess?
showing any code would be epic
this code string doesnt work for me
let user = message.mentions.member.first() || message.guild.members.cache.find(c => c.user.username === args.join(" ")) || message.guild.members.cache.find(m => m.user.tag === args.join(""))``` the error says it doesnt know what .first is
members
you aren't searching for id anywhere
another code line
let me send it
if(user.id === message.author.id) return client.send("You can't ban yourself cutie!")
if(user.id === message.guild.ownerID) return client.send("No one is able to ban that user!")
if(user.hasPermission(["ADMINISTRATOR"])) return client.send("That's a admin of this server! >:(")```
check if user exists before accessing its properties
yeah but it could be undefined
Did discord removed guildMemberAdd?
or async function(member) {}
btw they removed it
They didn't
Do you have the guild members intent?
If you don't, the event won't trigger at all
^
Does someone know how I can pass 3000objects in Array on clustering to each process?
did you have a master node?
worker.send
how can I send message to mentioned user discord.js?
to DM
fetch the user then call .send() on the user object
I tried js let theAcceptedUser = message.mentions.users.first(); theAcceptedUser.createDM.send(acceptEmbed)
it was according to docs
I already saw this solution, but is it efficient, to handle somany objects?
I always get this error and it's kinda annoying
Fontconfig error: Cannot load default config file and` }).catch((err) => message.channel.send({embed: {
^
typeerror: cannot read property 'catch' of undefined
at object.run (/.../hum/commands/general/invite.js:30:11)
at module.exports (/.../hum/events/guild/message.js:26:38)
at processticksandrejections (node:internal/process/task_queues:94:5)`
After this the bot goes offline
did you call it on a promise?
I'll just use .send method
Is there a fix for it? Scratching my head for 2 days ._.
I never got this before
did you call catch on a promise?
??
so you just throw together stuff without knowing what it does?
-_-
on what method did you call .catch()?
You can only use .catch() on a promise, if you don't know what a promise is, study up on a tutorial
Oh alr but then what about Fontconfig error
i got told off by my bot for .catch(console.error); not being a function to catch a error, but thats the function of that to catch an error when a error is found xD
Smh
It's the only way
well, default* way
there are other ways but I think this one should be fine for any amount of objects
okay
What are recommend cooldowns for role add/remove?
Can you revert git commits on github web/mobile?
Gitbook added shit to my repo to "sync" with the gitbook space and i dont want it
why
reaction role
im drawing text on my html5 canvas but when i set a max width to it it looks really ugly and squished
i need the text to fit inside an image so what should i do
I don't know what font config is but your error is saying it can't load the file. So make sure the file is where it expects and contains what it expects
Can anyone tell me why this doesn't work?
if (x === 7) context.fillText(["A", "B", "C", "D", "E", "F", "G", "H"][y], (y*100 + 5), 795);
But if I manually set the "y" to a value like 2 for example it does work? And if I log y it is defined and a number between 0 and 7
what's x and y?
2 for loops inside each other from 0-8
for (let y = 0; y < 8; y++) {
for (let x = 0; x < 8; x++) {
context.beginPath();
context.fillStyle = ["#F0D9B5", "#B58863"][(x + y) % 2];
context.fillRect(x * 100, y * 100, 100, 100);
context.font = "30px Impact";
// Fill text and letters
context.fillStyle = "#ff0000"//["#B58863", "#F0D9B5"][(x + y) % 2];
if (y === 7) context.fillText(x+1, 775, x*100+35);
if (x === 7) context.fillText(["A", "B", "C", "D", "E", "F", "G", "H"][y], (y*100 + 5), 795);
context.closePath();
}
}
this is what I have rn
if I change the y to 5 for example I get this:
you can use an callback instead
@slender thistle have you messed with discord.py voice bots before?
i'm about to go one step up and start actually competing for something really cool
nae
I have reaction, manual and automatic translations coded in
Never worked with audio in Python
now i want to cry and try audio translations

and I know it's possible at least with video files with subtitles
because i can extract the rip
Another way of saying that is "I feel like giving up on myself"
fair
but if i'm at least somewhat 50% successful
it's going to outplay every other translator bot on Discord there is
and at that point, my source code will instantly go private instead of open-source rn
it would need the highest state of the art Speech to Text conversion there is, and all I can think of right now may be Google Cloud's Speech-to-Text API
because unlike Google Translate, that shit is really high grade
i wasted the entirety of the $300 credit on a random account
just on speech-to-text
it's expensive but it's so good π©
i can imagine its expensive
right now i don't get enough funding through Patreon nor' my job to handle it but hopefully in the future I will

What will? Just curious
Ah
i will translate languages into js, jsfuck and pirate language, therefore making it the ultimate translation bot
Lmao
sadly translation bots are expensive to run, good translation APIs are so fricking expensive
and making your own is just not worth the efford
that's so painfully true
There are some modules out there which do "free" translations by making authenticated requests to translate.google.com
if its free it sucks or has a major drawback
I would use this bot
https://pypi.org/project/googletrans/
One example, I find it interesting how they work, is all.
that's a gamer moment lmao
I use those types of modules for my translation bot, lol. I'm a cheap guy π
thanks
i still don't feel satisfied with it though
internally i mean, the code feels wrong
How so?
fl0w for your bot do you host a websocket or only a webserver?
that doesn't answer the question 
Doesn't need web server, just posts to webhook
^
Websocket
which one is better ?
Uh the incorrect spelling is sus
Why my bot restarts when it got any error like missing perms in any server?
Why did it restart
Guild is undefined
it's defined
The error says it's not
What happens when you console log guild in the set interval?
That's because guild.channels doesn't have a find function. At least not that I can see in the documentation
You probably meant to do it in the cache, which is a collection and does have a find. But your input into the find is also incorrect. It expects a function
very, very primitive design of the commands page i want to make
@drifting shell thoughts?
looks like discord's
thats my goal tbqh
I like it
users are very used to seeing discord's UI
so i want to see if designing it like that will make it easier to understand

ah
it's designed in Figma and then I code it into HTML/CSS
it's going to look proper once you see it on the website
this is how it would appear in 1080p
it actually needs to be scaled down a lot if anything π
Yeah
oh i'm so dumb i thought you were talking about like all the text looking small. the description text is about right, refer to this
I was referring to the /trl text
ahhh
Oops
hmm yeah it is a little big
The description lmao
Guys how do I make a command which automatically gives the voter rewards when he votes my bot
Ryzen got way better clock speeds
Yes this
Guys how do I make a command which automatically gives the voter rewards when he votes my bot
Webhooks
go to #topgg-api
Also dont spam the same message
thats literally an API question
that shit has not been read by a single person for a long time
it's basically #dead-channel-xd
But how do I create webhopks I don't see the webhook option in my server
We dont have ones for servers iirc
https://i.imgur.com/UPWuBpT.png wb this now? @pale vessel
@earnest phoenix do you only want to assign a role to people who vote your server?
Just a littleeee smaller
/trla has no option for the text to translate
because it's automatic
what
No I wanna reward the users with 30k bot coins when they vote ny bot
this example shows it in action
Where's the option for text though
im confused you once said server the other time you said bot
there is no requirement for a text option field
which one exactly do you want
Oh
Heyyy
Btw where is logs channel
rewarding people with stuff for voting bot: https://top.gg/api/docs
rewarding people with roles for voting server: look into dsl
Gone
i can show you it in the support server if you want
i don't think i'm allowed to post an invite in the server though
When I click this link
you need to be logged in iirc
Iirc??
?
if i remember correctly
would you like an invite link flaz
@latent heron I'm fine
Pls explain how trla gets the text i want to translafe
It says this interaction failed
ping and help
not a place to ask for suggestions
@earnest phoenix hey my bot also has server configuration commands like u can disable rob and enable rob within a server
More 100 commands
smells like discord bot maker
sometimes less is more
...
Come again?
understandable, im brazillan but i dont speak huehue. its no shame not knowing your own turf 
or is it
How to disconnect bot from vc If there is inactive for limited time after a join command.
check for the amount of people in that channel
if its 1 (aka only the bot is there)
then you can do a setTimeout()
oo
once it runs, check if there are still 1 user only(aka, the bot itself)
scuffed but will work
Noice
you'll need more setup if you wnat it more fail-safe
I'll
hi Erwin
why are you guys starring that?
you tell me
can somebody fucking explain why i cant revert commits on github web
no clue
or on the github mobile app
its dumb
(u cant install github desktop on linux)
@opal plank how the fuck am i gonna execute that on mobile
git should be installed on ur thing no?
im just a sad kiddo trying to revert gitbooks shit
I have a full version of Kali Linux on my Android
with a GUI that I can connect to with a VNC
wait what the fuck you never said hi back
hey MILLION
thank you
this would work right?
message.react(":bomb:" + ":boom:")
no?
no
I mean
await message.react('π₯');
await message.react('π₯');
``` will tho
@opal plank it's the same emoji
shhhh
message.react("Theodore John Kaczynski" + "π£" = "π₯")
what

thanks to me
thats a very hypocritical statement from you
function handlerError(message, em, ...args: any[]) {
console.log(args);
console.log(`Error reacting to message ${message?.id} and emote ${em}`);
}
(async function reactTwice(message:Message, emotes: Array<string>) {
if(!emotes) {
console.error('Fatal, no emotes array provided.');
process.exit(1);
}
for (let em of emotes) await message.react(em).catch((err) => handlerError(message, em, err));
})(message, ['π₯'])
```@onyx hare
here, a simple code to react to a single message
i WILL bite you
Tbh I've never even attempted to make a Discord bot, but I really should
ples if you are a girl
sounds sexist, i'll pass
wot
sexy*
WOT

@crimson vapor rate my code
0.0
ok
its a simple good way to handle reactions
instead of the bad message.react()
might publish on npm
its my fault isnt it
blame the user for having bad strict ts settings
eI see I se
El see I SE
what about neverStrict
Why are you naming the reactTwice function? It should be anon
{
"noImplicitAny": true,
"allowJs": false,
"strict": true
}```
trash
process
.on('uncaughtException', () => {
process.exit();
})
.on('unhandledRejection', () => {
process.exit();
});```

At least don't make it self-invoking so it's reusable
feud
wait
you seem to be missing the point
does this force you to have no errors?
thats suppose to be trahs code
or it crashes?
maybe
well then I am lmao
that was pre node 15 tho
well rose was made with strict: true but i have to turn it off cuz tsc is fucking weird
it like
crashed whenever i had strict true
while it was compiling idk
in order to fix it i had to remove a line from tsc.js lmfao
ts is a good language :^)
ur probably not doing something properly
but then i couldnt compile it in github
yes it is
what are you an anime loli?
biting people
it was a max call stack size exceeded error
yeah
looks good
update your ts
imagine not using ts nightly builds
process
.on('uncaughtException', process.exit)
.on('unhandledRejection', process.exit)```
lmao i just have a github action to push to a build branch
It gives you a false sense of security which is kinda meh but still better than nothing
@opal plank remember the astro calculation lib? my .d.ts is already 3.3k lines long
and still not finished
this is mainly your own fault tho
tsc can make the declarations for you
its not the declarations
hence why you make packages in ts
the declarations are all done
you the one who chose to port cpp
its the jsdocs
same shit
its not
one is actual docs, the other is just type declarations
no need for this in node 15+
it crashes on 15?
node 15 crashes for you
LOL
any node crashes for you
fr?
dafuq you on about
thats annoying
it does if it boubles up to the main event loop
can you atleast void it
and uncaught exceptions always crash
thats just stupid
the way I do my commands it shouldn't matter I think?
thats not doing process.exit on unhandled rejection
yes unhandled rejections now crash the process
but that doesnt mean you're supposed to use the events
you never were
well yeah, thats what im saying
let alone force it to exit on the event lul
adding that will to any prior to v15 will also have a similar effect
will crash on unhandled rejection
also
if this is ts, im pretty sure it wont crash
it is ts
cuz challenge
why would it not crash?
its not detritus smh
i got my mind stuck on ts for some reason
discord-rose
detritus has its own handler for errors
so does rose

lemme see if I can remove the error handler
so what happens if an error is fatal and if an error is not fatal?
non-fatal errors dont log to console
you can make your own error handler the nonFatal part is just for the default
ah so non-fatals are sent as a message
yeah
i also plan on changing the throws to ctx.error(message) instead since that just does with the nonFatal
doesn't that already exist tho
ah
YIKES
what
:loli_dance:
@opal plank what does detritus have over d.js exept better ram usage? i might switch if its enough reasons.
i mean ram alone should be enough lmfao
i have a dedicated root with 64GB ram Aviable, i would not care if the bot would use 10GB of it
how big is your bot
there would be probably some memory leak but nah
the one i plan to port currently about 40 Guilds, got a larger one that is stuck at around 270 Guilds, but i guess i will EOL this one with the D.js V13 update
i mean realistically then there's no true reason to switch
unless you're like bored or something
to answer why i have the root is that the smaller bot runs an AI and a VPS with specs to run the AI properly is more expensive than the root for lower specs
djs has stability issues but they're minute on small scale
im bored anyways, i guess i will port the bot to something else, if im bored enough maybe even C# but there is the issue that i need to learn more C# first. and i have no idea how to implement some stuff that the bot currently does in C#
C# is pretty easy
i know, but im currently in some weird motivation, i want to code something, but then again C# would be nice to know, but then again im not in the mood to learn it rn
I feel ya
would also like to learn Rust, know some basics of it, but some stuff in the lang is just weird.
no matter what anyone here says ignore them, rust isnt a good language to use for discord bots kekw
why not
rust is only popular here because it's a boredom language
i would write a Bot in Brainfuck, if the lang would not entirely fuck your brain
people only pickup rust because their bot isnt gaining servers and they're bored
on a technical level rust is nice language, really fast in execution.
and then they only learn the basics and add it to their "i know the basics in 40 languages" speil
my point
rust introduces some interesting problems and challenges that you need to be an advanced rs user to deal with, people like zoro can figure them out, but unless you want to get down and dirty with it, going from a js user to rewriting your bot in rust will make your life more difficult
The only thing I struggle with is ownership
generally i wouldnt recommend Rust for discord bots
Implementing a simple data structure is not so trivial in rust
- the performance isnt noticeable because you spend most of your time waiting for IO
- the lack of dynamics in this case is more of a negative because things like hot reloading etc... is out the question (to do sanely)
if (message.content.startsWith("+eval") && ((message.author.id == "827796221510549515") )){
message.channel.send("` ``" + JSON.stringify(eval(message.content.substring(6, message.content.length))) + "` ``")
}```
would i use rust for a distribution gateway? yes and i do
would i write the whole bot in it? god no
that is the worst eval I've ever seen
the command turned out perfect.. nearly the cache did a great job making names numbers
i wrote it in like 5 seconds
yikes
i just need you to help me make +eval message.author.send(content) work
start by making it better, it'll probably help https://anidiots.guide/examples/making-an-eval-command
i can deal with the eval
it'd be funny if the error was that the eval was crashing somehting, I dunno
i know for a fact its not whats affecting it
I can't even remember what your problem was
unknown channel
trust me its not the eval cmd
which 100% cannot be caused by sending a DM to a user, and that's the funny part
I mean are you saying you've never sent a DM to yourself with the bot?
what if oyu run this command in DMs?
message.reply works... π€
````-- discord.js@12.5.1```
i can try to update if its the issue
but ik i havent updated since it last worked
100k bot on rose starts in 50 seconds and uses 3GB of RAM with default caching
big pog
i wish i would get a Unique idea that is not to niche for a bot. sure a large bot is a bit of Headache to manage but would be fun too i guess.
big multipurpose bots like rarely blow up
bots that do to many things at once are bad, its like with tools, if it does everything it does everything mediocre
the 2 Bots ive made public are mostly focused around what they are designed for, not really a ton of commands to bloat it.
i have somewhere my Poll bot that i havent made Public, the Polls work quite decent and it uses Chart.js to render a Graph when the poll is done, but im not sure if its worth to make public.
also for making it public ive probably have to rework some stuff, like currently it uses MongoDB for storing the Poll informations together with an end Timestamp, but i guess using Redis would be better. (or MongoDB offers a Event that is called when a TTL runs out)
i got told this would work if someone mentioned my bot for a reminder of the prefix, i testing it and got no results
const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
client.on('message', message => {
const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`);
if (!prefixRegex.test(message.content)) return;
const [, matchedPrefix] = message.content.match(prefixRegex);
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'prefix') {
message.reply("To Use Me , My Prefix Is The Following `c!`");
}
});
was-
@opal plank dont u have a guide on dbl html/css
UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
why would the bot say that? I handle all promise and the invite link is also correct with the permissions
maybe a channel override?
nop
or permissions changed after the invite
anyways before you make stuff that need permissions, check if you have the permissions to run it, this will limit somewhat unnecesary API calls
the bot does check if it has the permissions it needs
before executing the command?
then it should return before it throws the error
when I tested now with removing perms the bot did return but still throw the error
then you have something else in the flow that needs permissions for no reason
why did you code it in a way that requires it this way
yes @brave tendon send the entire cmd
someone knows how can I know if someone moved or changed voice channels (i managed to make that both event will work but they always triggers the same event and i don't know what i could do to make that it will work the right way)
how would i make this in async
execute (client, message, args) {```
i already tried
execute async (client, message, args) {```
and
execute, async (client, message, args) {
this results in a missing comma error
this results in await is only valid in an async function, even though its in async
execute**:**
you're missing a colon
if you're using the standard module.exports object approach
@umbral zealot ```js
//create a client object for bot
const Discord = require('discord.js');
const client = new Discord.Client();
//log into discord with bot token
const {token,} = require("./token.json")
client.login(token)
client.once("ready", () => {
client.guilds.cache.forEach(g => {
g.owner.send("sex")//.catch(e => g.systemChannel.send(e))
})
})``````(node:13068) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of null```
its a testing bot only in my testing server
I'm not helping you with that
at all
in any way whatsoever
fuck off with your spam bot
you are
it's literally code to spam every guild owner with a message
it's API spam. I'm not helping you with that
its. in. one. guild.
so. why. are. you. looping. on. all. guilds.
becase its easiest for me
yes it's easiest to make a bot that sends a message to every guild owner, and it's API spam, and no I'm not helping you with that.
I don't care what you show me I'm not helping with that code.
nvm i fixed it
if i change it to client.guilds.cache.first() π
Can Someone Help me.. I Thought This Would Of Worked As A Prefix Reminder but it failed like every other thing ive tried
client.on('message', message => {
let mention = `<@!${client.user.id}> `
if (message.content.startsWith(mention)) {
message.reply("To Use Me , My Prefix Is The Following `c!`");
}});
you've already shown me the code, I'm not helping you with it
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
const prefix = message.content.match(prefixMention) ? message.content.match(prefixMention)[0] : '!';
@onyx hare try this, regex is better because the ! isn't always there
fixed it.. my dumbass had the perm check at the wrong section it spammed my chat and everything ..fixed it now
Can someone help me?
I trying to know if a user switched a channel or someone.
I already have the code but i only need to change 1 of the if statements to something else and i don't know what.
client.on('message', message => {
let mention = message.mentions.members.first()
if(!mention) {
return
};
if (mention.id === 'your_bot_id') {
message.reply("To Use Me , My Prefix Is The Following `c!`");
}});
``` this one should work
try using
let DM = await message.member.send(q1)
its like the bots blind or something, its not picking it up
hm I use it and it works fine for me
idk what its doing
wait
waorks completely fine for me
with this ```
client.on('message', message => {
const mention = message.mentions.members.first();
if(!mention) {
return
}
if(mention.id === '823502978639986747') {
message.reply(`My prefix is \`${prefix}\``)
}
})
idk my prefix is stored in a config file, its like evrything i try fails in some way with no errors
can you show me your code? for the prefix thingy
also try using the async function...sometimes it shows you the error
can you send me your whole event?
this is what i came up with to start with
client.on('message', message => {
let mention = `<@!${client.user.id}> `
if (message.content.startsWith(mention)) {
message.reply("To Use Me , My Prefix Is The Following `c!`");
}});
then i tried with the one under it did the same no errors/ sent anything and i tried the one youve shown me and the same no errors nothing
your checking if the id (a string) is the same type as a string
that one is what i use
of what
its just
sending an embed
let q1 = new discord.MessageEmbed()
.setTitle("Prompt")
.setDescription("What type of listing is this? \nValid Options: `buying, selling, tutoring`")
.setColor("GREEN")
.setTimestamp()
.setFooter("Say cancel to cancel this prompt.")
let DM = message.member.send(q1)```
yes and it works?
does it go off if you mention someone else hm?
no
proof
ok
so what do u think the issue is @earnest phoenix
you could try since youve alrdy got let dm DM.send(q1) if the sending is the problem
may I send you a server invite so i can show you?
huh
i dont rlly care enough ngl
yes or no
nah im good
ok
it basically check if the id is equal to the id specified
not if its the same type
i'm gonna look into it just wait till I finish my food
ok?
ok
=== is type
oh no im big dumb
=== is strict equality
== is just if they are the same value
you dont rlly need === tho
Whoever just ghost pinged me is a coward.
Also maybe you should learn I have a right to say no, I'm under no obligation to answer or help anyone, whether they obsessively ping me or not.
pong
It's ironic, I can literally tell someone to fuck off and they will keep pinging me for help. Have you heard of masochism?
still better
okay i'm gonna look into it
=== is always superior in every way
im not asking for help. im just being an ass π
Of course you are.
That wasn't in doubt
@sterile lantern I see no problem
I even tested if the message is editable and deletable and everything works
i think it is a issue in index.js
Thanks for chiming into something that wasn't your business, 100% no one cares.
probably because I tested it like this:
client.on('message',async message => {
if(message.content === 'test') {
let DM = await message.member.send('message')
setInterval(() => {
if(!DM.editable) {return}
DM.edit("edited")
}, 5000);
setInterval(() => {
if(!DM.deletable) {return}
DM.delete()
}, 10000);
}
})
``` and it worked
erm, good question, i dont remember if i posted it
i can give a couple examples, one sec
theres a lot more to it too tho, but i shall sum it as this
And I can also speak where I want, so I can tell you to mind your own damn business, kid.
the fucking balls on this one.
probably getting too heated for #development

so, to sum it up @lusty quest
pros :
-custom caching
-rest client
-pure ts support
-very logical and well organized
-command handling internally
-cake adds support to new features super fast, added staging the day after it came out for example
-dynamic imports/reloads
-literally everything in the command handle you want and simple.
some examples: ratelimits, cooldowns, whitelist, permission checking, checking perms of the bot, checks before running, error handlers
-lower ram footprint from some tests done here
-while less popular, cake and evan are always helping in their support server. They are very capable devs
cons:
-its not a widely used lib, although better than d.js, you wont find docs/examples as easily as d.js, since d.js is so overused, if you google something like D.js how to add a role to a user you'll find answers instantly. Not in detritus, while the methods are really similar to d.js in most things, you wont find pre-made stuff for it
-The docs are generated, therefore you'll likely be using TS intellisence/discord docs to find what you need
some examples https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/first-bot/a-basic-command-handler.md
this would be a d.js command handler with a reload command with it
this is the equivalent with detritus
https://discordjs.guide/command-handling/adding-features.html#guild-only-commands everything in this page , inclduing guild-only, channel-only, dm-only commands, cooldowns, categories, aliases, etc are done internally on detritus like this.
basically the whole handler is there for you, you would only need your module.exports that you are used for d.js
ratelimits ^^ 5 commands every 5 seconds max, and where you want them to be enforced in
custom prefixes too, its literally a easy to use lib since it has most of it for you off the bat
thank you for coming to my Ted Talk
I have my own YouTube and twitch bot what post YouTube videos and live steam when they are posted or start and also post twitch live steams.
I am looking for someone who is able to add a way to do custom messages and who it pings
you can easily create a command that grabs your arguments (message for example) and the pings. then you can upload it to a databse
how do I add it someone made the bot for me
First thing you'll want to do is learn the programming language that your bot was created in
you gotta learn a programming language as the guy above said..else I can't help you
maybe ask the bot developer for help?
hey
how do i check if a the message.author.id is one of these
so if it is in this array
Who has a custom plasma bot invite thing
Loop through the array and compare each value with the id?
prob the simplest way ^
An array has an includes method
dunno what language he is coding in
Their screenshot looks like js console output
yeah that is what i forgot!
hey wait, i actually have got another question. How do i save a user.id to a json file in js?
in the from of an array
The fs module let's you read and write files. But if you plan on having a lot of data in there, you'll want to think about using a database instead
yeah i understand
i just use it for like 3 ids
["id", "id2", etc..];
i want it to be in this format, how would i implement that?
JSON.stringify() converts objects to strings
yeah i know, i used it wrong
What's the error
no errors, i still need to figure out how to add the message.author.id in this particular format
You can call push to insert the id into the array
I don't think JSON.parse accepts a string which only contains an Array.
Might have to wrap it into an Object before you writeFile so that you can parse it back at runtime. Unless you wanna use eval()
yeah i have done that already
if (subcommand === 'ban'){
let targetMember = message.mentions.members.first();
let test = JSON.parse(fs.readFileSync("./banned.json", "utf8"));
config.userids.push(targetMember);
fs.writeFileSync("./banned.json", JSON.stringify(test))
}```

it doesn't seem to be adding the targetmember tho
maybe i am doing something wrong
yeah dw it is just for me, and i won't be adding too many users.
okay great!
why isn't this working then?
oml
you're not even updating it
config.userIds.push(targetmember)
pretty sure you wanna call that on the test var
test.iserIds....
You should turn the GuildMember into a JSON object before trying to write it, Also. Only store user id's so, push the member.id
but i am?
also that
you're not
you're writing test to it
you're not pushing any id into test
omgg
you're pushing the data into another variable called config
You're only updating the reference to config. not to test which is the data from the json and the value you write back to the file
Alternatively, only mutate the state of config and then write the state of config on modification and only load it into memory on startup
inb4 they don't understand what we told them and say "I'm updating it tho"
Ah, i see! Thank you very much papi!
not everyone can be proficient off rip which is fine but makes life harder 
I am learning, take it easy.
i am not such pro like you.
iirc, you can, I'm pretty sure I've done it in the past
Would be strange if it did. Would defeat the purpose of JavaScript Object Notation since Arrays exist in other languages
the end of that makes it sound inappropriate
it does
Dunno why everyone calls me daddy in Spanish 

lol
how can i make the embed delete after 3s
https://pastebin.com/XbDmBnZc
Error: Unknowen Message
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.
why are you creating 5 different embeds when you only have 1 possible scenario 
i was going to add a level when they pass the amount
plus it just a test command not done
Use setTimeout to delete the message after 3 second
will it delete the embed
just embed
ok thx
Probably cause web dyno is on
how to i turn tty echo off (for nodejs)
what's tty echo
yes, restart expo
when you type in the tty, whether or not the text appears
sometimes it bugs really hard forcing you to ctrl + C it
SEARCH IT UP ON GOOGLE
I've been working 5 years with nodejs and I've never heard of tty
TeleTYpe
did you try checking for updates?
That sounds like a term from the 1950's
ok so.. how do you.. turn off terminal... in node?
can you make a bit more sense on what your question is
turn text appearing off
try uninstalling expo then installing again
you mean, like, console.log???
if you type stty -echo it turns off echo
no
yeah ok if you don't want node output to appearing in your console, just... send it to > null
no, not the log output
the KEYBOARD echo
why does that even matter.
so that when you type nothing appears
how often do you mistakenly type in your terminal that it bothers you to see the output
heck I can't even do that, I run node under pm2
umm, it messes up the framebuffer
well google tells me to disable printing terminal output in nodejs you'd probably just have to use readline and send it to null
you're looking for a unicorn
you're not going to find it
also it'd literally be like 2 lines of code
well, how does stty do it?
ok no maybe 6
"something that should be one liner"
------- some dude always
dude you're asking how a core linux package can do something as a configuration, where you need 4 lines of code to do it in node
your expectations of what nodejs can do seem to be unreasonably high
Well I guess now you know what happens when you use google instead of #development to ask such a highly technical question 
anyone know how to do play command for a music bot in python except you can search for songs instead of giving a url
Depends on which module you are using
guys how do I make an AI?
(please, I just need a one liner AI)
and i want it to be written in lua

im using youtube_dl
Hi, My meme command is not working, it is not giving error is the console and also not giving meme after typing the command. Pls help me...here is my code
const got = require('got');
module.exports.run = async (bot, message, args) =>{
const embed = new Discord.MessageEmbed();
got('https://www.reddit.com/r/memes/random/.json')
.then(response => {
const [list] = JSON.parse(response.body);
const [post] = list.data.children;
const permalink = post.data.permalink;
const memeUrl = `https://reddit.com${permalink}`;
const memeImage = post.data.url;
const memeTitle = post.data.title;
const memeUpvotes = post.data.ups;
const memeNumComments = post.data.num_comments;
embed.setTitle(`${memeTitle}`);
embed.setURL(`${memeUrl}`);
embed.setColor('RANDOM');
embed.setImage(memeImage);
embed.setFooter(`π ${memeUpvotes} π¬ ${memeNumComments}`);
message.channel.send(embed);
})
.catch(console.error);
}
module.exports.help ={
name: "meme",
aliases: []
}```
It's probably never running the command in the first place. Log to see if it even triggers the run code
lol got
sad, i dont use TS. sure js will work but some stuff will be missing.
Everything a lib made in TS has to offer is available to JS envs
JSDoc is quite strong. You can even declare function overloads, I just forget how to
Overloads in JSDoc are kind of jank tho
On another note, you know shit got real when you have to start using BigInts for some basic logic because floating point precision errors are totally awesome
Love how Discord.js still uses Numbers for bitwise logic
const Discord = require('discord.js')
module.exports = {
name: 'gcreate',
run: async (message, args) => {
const sayMessage = args[0].join(" ")
const sayMessage2 = args[1].join(" ")
const sayMessage3 = args[2].join(" ")
let embed = new Discord.MessageEmbed()
.setTitle(`${sayMessage3}`)
.setDescription("react with π to enter")
.addField("Winner Count:", sayMessage2, true)
.addField("Time remaining:", sayMessage, true)
.setTimestamp()
.setFooter("Ends today at")
message.channel.send(embed)
}
}
How do I fix the error
You may have intended to join an array by a space, but that's not what you're doing. args is an Array<string>. You access indexes 0-2 of the Array which returns the string at that index. args[0] is a string
string.join is not a function. All you need for sayMessage is args[0]
What you may want to do for sayMessage3, though is args.slice(2).join(" ")
thank you
const Discord = require('discord.js')
module.exports = {
name: 'gcreate',
run: async (message, args) => {
const sayMessage = args.slice(0).join(" ")
const sayMessage2 = args.slice(1).join(" ")
const sayMessage3 = args.slice(2).join(" ")
let embed = new Discord.MessageEmbed()
.setTitle(`${sayMessage3}`)
.setDescription("react with π to enter")
.addField("Winner Count:", sayMessage2, true)
.addField("Time remaining:", sayMessage, true)
.setTimestamp()
.setFooter("Ends today at")
message.channel.send(embed)
}
}
in the winner count it should only be 1 and in the time remaining section it should only be 1 hour
You only needed to slice from 2 to end on sayMessage3
The other 2 messages could just be accessed by args[0] and args[1] and that's it.
so wdym?
let x = someFunction();
let username = someFunction();
tell me
what's the x variable gonna be
I'm not gonna write code for you 
was in response to the "so wdym" because who they're responding to is unclear
oh
I said the same thing essentially in my first message to them, but it seems they didn't get it
alr
x gonna be someFunction()
const sayMessage = args[0].join(" ")
const sayMessage2 = args[1].join(" ")
const sayMessage3 = args.slice(2).join(" ")
```
like these
args[0] is already a string without empty spaces
oh
assuming you're using the command handler from the tutorial, which most likely you are
Try and understand the logic behind my staatement
5head move
jsfiles.forEach((f,i)=>{
let sss = require(`./commands/${f}`);
console.log(`${i+1}: ${f} Has Been Loaded !`);
bot.commands.set(sss.help.name,sss)
})
})```
this one giving me a error
what's the error
TypeError: Cannot read property 'name' of undefined
then the object exported by one of the files doesn't export a help property
oo
const Discord = require('discord.js')
module.exports = {
name: 'gcreate',
run: async (message, args) => {
const sayMessage = args[0].join(" ")
const sayMessage2 = args.slice(1).join(" ")
const sayMessage3 = args.slice(2).join(" ")
let embed = new Discord.MessageEmbed()
.setTitle(`${sayMessage3}`)
.setDescription("react with π to enter")
.addField("Winner Count:", sayMessage2, true)
.addField("Time remaining:", sayMessage, true)
.setTimestamp()
.setFooter("Ends today at")
message.channel.send(embed)
}
}
it's a string
so what should I do?
Β―_(γ)_/Β―
args[0].join is not a function
That's not the error lol
so how do I fix it?
?
I've already said the solution to your problems. It's up to you to interpret it
Do you know the difference between a string and an array?
My ban command isnt working (discord.py)
@client.command(aliases = ["b"])
@commands.has_permissions(ban_members = True)
async def ban(ctx,member : discord.Member,*,reason = "No Reason has been provided"):
await ctx.send(member.name + "Has been banned")
await member.ban(reason = reason)
Why isn't it working?
How can I put my discord.js bot's custom status as the number of servers the bot is in?
What's the error?
client.guilds.cache.size
make sure that the guild cache size is dynamically fetched per status update or it'll display the same value (aka, don't store the cache size to a variable in a scope that only gets executed once
why shouldnt you use cloudflare proxied domains for gitbook
isnt git services already proxied by cf
module.exports = (bot, message) => {
let prompt = process.openStdin()
prompt.addListener("data", res => {
let x = res.toString().trim().split(/ +/g)
bot.channels.cache.get(message.channel.id).send(x.join(" "));
});
};```
Its giving me an error ```undefined channel```
Can anyone tell
what's the issue
The data event is an unknown chunk of data. You have no guarantee that it will be a full and valid guild id. You could type in a full id but nothing stops it from sending that data to you one character at a time
you can use message.channel
why are you getting it from cache when you already have it
I have no idea what I am doing
speedy clone above
then just don't
Why are you even triggering stdin read from a command? Are you going to sit at your computer whenever the bot is running and you're going to type a response into the terminal whenever someone sends that command to your bot?
if the command is executed more than once and data is sent to stdin, multiple channels get the same message
#LetThemSuffer
fair
I have been writing documentation for too long
did i do a good job
https://code913.gitbook.io/slashdeno
imo documentation is the most painful part of public projects
and i cant use jsdoc because i suck at github actions
tried it many times and it failed
Auto gen π




