Answer the question
In order to leave comments, you need to log in
How do I send a message to the first mentioned account?
Good day, my problem is that I can't send a message to the first mentioned channel. There is an example that works, here it is:
client.channels.cache.find(e=>e.name == "bugs")
.send(embed).then( bug =>
db.set(`${GetLastMID}`, {realid: `${bug.id}`, type: "bugs", channelid:`${message.channel.id}`, color: `${Color}`, title: `${dbTitle}`, bug: `${dbBug}`,
po: `${dbPO}`, launcher: `${dbLauncher}`, version: `${dbVersion}`, server: `${dbServer}`, url: `${dbUrl}`})
);
const Mchannel = message.mentions.channels.first().name;
client.channels.cache.find(e=>e.name == `${Mchannel}`)
.send(embed).then( repeat =>
db.set(`${ID}`, {realid: `${repeat.id}`, type: "repeated", channelid:`${message.channel.id}`, rname:`${repeatname}`, rtext: `${textrepeat}`})
);
TypeError: client.channels.cache.find(...).send is not a function
Answer the question
In order to leave comments, you need to log in
If you want to use a specific channel, then instead of
const Mchannel = message.mentions.channels.first().name;
client.channels.cache.find(e=>e.name == `${Mchannel}`)
.send(embed).then( repeat =>
db.set(`${ID}`, {realid: `${repeat.id}`, type: "repeated", channelid:`${message.channel.id}`, rname:`${repeatname}`, rtext: `${textrepeat}`})
);
useconst Mchannel = message.mentions.channels.first().id;
client.channels.cache.get(Mchannel)
.send(embed).then( repeat =>
db.set(`${ID}`, {realid: `${repeat.id}`, type: "repeated", channelid:`${message.channel.id}`, rname:`${repeatname}`, rtext: `${textrepeat}`})
);
client.channels.cache.find(e=>e.name == `${Mchannel}`) - apparently returns undefined
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question