#this
1 messages · Page 1 of 1 (latest)
okay thanks
for (let i = 0; i != reactions.length; ++i) {
// we use the index to calculate the time we want to wait: 750 * 0, 750 * 1, ... for each index.
// that way we can ensure the `message.react` calls are separated 750 ms
setTimeout(() => message.react(reactions[i]), 750 * i);
}
}
module.exports = async (client, id, text, reactions = []) => {
const channel = await client.channels.fetch(id)
channel.messages.fetch().then((messages) => {
if (messages.size === 0) {
// Send a new message
channel.send(text).then((message) => {
addReactions(message, reactions)
})
} else {
// Edit the existing message
for (const message of messages) {
message[1].edit(text)
addReactions(message[1], reactions)
}
}
})
}```
okay !
const addReactions = (message, reactions) => {
for (let i = 0; i != reactions.length; ++i) {
// we use the index to calculate the time we want to wait: 750 * 0, 750 * 1, ... for each index.
// that way we can ensure the `message.react` calls are separated 750 ms
setTimeout(() => message.react(reactions[i]), 750 * i);
}
}
module.exports = async (client, id, text, reactions = []) => {
const channel = await client.channels.fetch(id)
channel.messages.fetch().then((messages) => {
if (messages.size === 0) {
// Send a new message
channel.send(text).then((message) => {
addReactions(message, reactions)
})
} else {
// Edit the existing message
for (const message of messages) {
message[1].edit(text)
addReactions(message[1], reactions)
}
}
})
}
what is your issue again
this
ah right
basically you fetched the channel
now in that channel you got a bunch of messages
wait
i think you sent the wrong file
I dont see this in the file you gave
console.log("The LS-Bot is Online")
//START OF THE MESSAGE SEND by ITSELF
//Get the channel
const channel = await client.channels.fetch('969790950220132462');
const sendMessage = await channel.send({
content: '@.everyone',
embeds: [{
title: 'Embed Title',
description: 'The Description',
color: '#000000',
image: {url: ''},
footer: { text: 'This is a footer' } ,
author: ({ name: `${member.user.username}`, iconURL: member.user.avatarURL({ dynamic: true }) })
}]
})
//TO EDIT BOTS OWN MESSAGE
//.then(x => x.edit('content'));
sendMessage.react('💞')
//END HERE```
that was added by me from my old bot and it seems to not work
wait but it is
this is in index.js
are you sure
and this is in first-message.js
is that bad ?
why ?
because why would you want to run that code when the bot starts
thats kinda true. the code works tho. can i makle this lets say if i write !send in a specific private channel and this thing is sent to lets say #News?
To be honest I have no idea what you want to do
try to explain in detail what you are trying to do
this script makes the bot send the message when its turned on
here is how it looks like :
now i am asking this
- can i make the script to be sent when i want to? and not when the bot is turned on?
-so like this, i write !Send in a private text channel that only the admins see, then the bot will function on my !send words and send the message in a public text channel
make a send command
and when you run it the command should send a message in your channel
can you please help with that ?
if (message.content === "!send") {```
something like this ?
and write this on the top ?
yeah
in it make sure that the person running the command isnt a random person
aka make sure that the message author is you or smth
how do i do that ?
ah ok
make sure that message.author.id is equal to your discord id(which is 392436251820687360)
okay lets do that a little later because i have this problem
I think you didnt make this yourself
before modifying the code
figure out what the current code does
and how everything works
if you dont why are you even trying to do this stuff
i watched the video by wornoff keys for 2 hours, i rewrote it myself and i modified it
and i understand it
seems like you dont considering you are trying to make a command inside of ready
what do you want me to do?
I want you to find your event where you listen for new messages
and then copy paste your current code for making the command there
it is? (
yeah
if you want a framework that does a ton of stuff for you and makes dev life actually easy I reccomending looking at the offical docs for their template or use sapphireJS
can you send me a link please
https://www.sapphirejs.com/ (note: I have some bias as I made the HMR module for this)
@brazen warren is this like a frame ? where i wuld install things in it ?
its a framework
should i make a new file and start from 0? and ,aybe it will be better ?
@brazen warren
make a new folder and start from 0
itll be much easier
alright
if you need help ping me
you are using normal nodejs right
how do i check that
are you using import/export or require/module.exports
the second i think
but what about this ?
looks correct tome
so i shoukd not add
here is what its telling me
?
nothing
@brazen warren