Discord.js read the thumbail of an embed - discord.js

I am trying to do an optimised bumping-reminder for my bot and I wanna do that with reading the thumbail of an embed. I tried this code and more but I dont get it to work. I read the docs but they didnt help
Code:
message.channel.send("okay")
if (message.embeds[0].thumbnail.url === "https://images-ext-1.discordapp.net/external/-N8TZVFTnkSYClu_Kbvb8KXNn2TvUgyUwLyBYkC7VGg/https/disboard.org/images/bot-command-image-thumbnail-error.png") {
message.channel.send("embed")
}
}

Related

How can I make a discord bot send a certain message in any channel

so I'm trying to make a discord bot (javascript) to ping my friend every time he talks. What I've tried so far are things like this from different websites:
client.on('message', msg => {
if (msg.author.id === '<#ID>') {
msg.channel.send('<#ID>')
}})
I've searched around and I can't find anything that works exept the msg.reply which I don't want to use because it pings the author. If anyone could help me that would be great, thanks

how to make auto reaction discord.js

basically what im trynna do here is if u have used carl bot you may know you can make it so on a message(for example a ping) it would react with message of ur choice, I'm trynna basically do that and heres what ive tried
if (lowerCaseMessage === messagetoReact) {
message.react('🐧')
}
and in my config file
"messagestoReact" : ["<#729795837223501834>"]
something like that, i have declared everything and made it like a on message thing, but it doesnt quite work, any one know a fix and if you need me to specify anything feel free to ask
I'm not sure what you're asking?Here's the way to get your bot to react to a message:
client.on('message', async message => {
if (message.content === '<#729795837223501834>') {
message.react('🐧');
}
})

Discord Unban All User command ( js )

Just a simple unban all users in guild command for my next ban royale in Discord. Any help would be greatly appreciated!
I wrote this based on the fact that you were writing your bot in discord.js as you did not give much information when writing and all i could see was the tags.
Try this-
const member = message.member;
switch(message.content.toLowerCase()){
case (!"unban all"):
if(member.hasPermission('ADMINISTRATOR')){
message.guild.fetchBans().forEach((fB)=>{
message.guild.members.unban(fB.user.id);
})
// All Users get unbanned
} else {
// User does not have permission.
}
}
})
If this does not work please let me know.
P.S. I'm kinda new to coding so if it is wrong please don't be angry with me.

TypeError: channel.send is not a function (Deprecated?)

Im trying to build a discord bot but I need to send a message to a specific channel. I've given it 100 tries but keep getting:
TypeError: bot.channels.fetch(...).send is not a function.
Everywhere I read, I see "use channel.send()" but I cannot find an actual fix for my problem. Is channel.send() deprecated? Heres the line that the error throws an error on:
bot.channels.fetch(id).send(message);
I know channels.get() was depricated and when using .fetch(id), I get the channel object however it wont let me send the message. ANY help will be appreciated as I have spent days on this alone.
Thanks.
Full block of code:
var reportEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('New Report')
.setAuthor(msg.author.tag)
.setDescription(reportMessage)
.setTimestamp();
console.log(bot.channels.fetch('my channel id'));
bot.channels.fetch('my channel id').then(channel => {
channel.send(reportEmbed);
});
When console logged, I get the correct channel object.
Try using:
bot.channels.cache.get(id).send(message)
Instead
As I can see in the documentation, the fetch() method returns a promise. (Link)
So, in order to get the channel, you need to use the current code:
bot.channels.fetch("id").then(channel => {
channel.send(message);
});

Working on discord.js, and my bot keeps spamming the same message

I've been working on a bot in discord.js and have made a basic bot. Whenever I try to use the 'dadjoke' or 'dadpun' command, it just sends the placeholder messages over and over again. Any help?
The code is here:
} else if (message.content.startsWith(`${prefix}joke`)) {
var repl = rand[Math.floor(Math.random()*rand.length)];
message.channel.send(repl);
} else if (message.content.startsWith(`${prefix}pun`)) {
var repl2 = pun[Math.floor(Math.random()*pun.length)];
message.channel.send(repl2);
Thanks in advance!
Try adding this to the top of your client.on("message", ...) code.
if (message.author.bot) return;
This might solve your problem.

Resources