-
-
Save Allvaa/0320f06ee793dc88e4e209d3ea9f6256 to your computer and use it in GitHub Desktop.
const { APIMessage, Structures } = require("discord.js"); | |
class ExtAPIMessage extends APIMessage { | |
resolveData() { | |
if (this.data) return this; | |
super.resolveData(); | |
const allowedMentions = this.options.allowedMentions || this.target.client.options.allowedMentions || {}; | |
if (allowedMentions.repliedUser !== undefined) { | |
if (this.data.allowed_mentions === undefined) this.data.allowed_mentions = {}; | |
Object.assign(this.data.allowed_mentions, { replied_user: allowedMentions.repliedUser }); | |
} | |
if (this.options.replyTo !== undefined) { | |
Object.assign(this.data, { message_reference: { message_id: this.options.replyTo.id } }); | |
} | |
return this; | |
} | |
} | |
class Message extends Structures.get("Message") { | |
inlineReply(content, options) { | |
return this.channel.send(ExtAPIMessage.create(this, content, options, { replyTo: this }).resolveData()); | |
} | |
edit(content, options) { | |
return super.edit(ExtAPIMessage.create(this, content, options).resolveData()); | |
} | |
} | |
Structures.extend("Message", () => Message); |
const { Client } = require("discord.js"); | |
require("./ExtendedMessage"); | |
const client = new Client({ | |
allowedMentions: { | |
// set repliedUser value to `false` to turn off the mention by default | |
repliedUser: true | |
} | |
}); | |
client.on("message", msg => { | |
if (msg.author.bot) return; | |
if (msg.content === "hi") { | |
msg.inlineReply("hello"); | |
} | |
}); | |
client.login("ur token"); |
Suggestion! Make it so the bots turn 'mention off', I know this is possible cuz Dank Memer haves it, Other than that, thank you very much!
just add
{ allowedMentions: { repliedUser: false } }
in the second parameter likemsg.inlineReply("yo", { allowedMentions: { repliedUser: false } }); // or if you wanna send embed msg.inlineReply({ embed: yourembed, allowedMentions: { repliedUser: false } });or you can make it default by changing the
true
tofalse
in
https://gist.github.com/Allvaa/0320f06ee793dc88e4e209d3ea9f6256#file-extendedmessage-js-L5hi sir how can i send embed messages using this bot as it is working perfectly and giving replies to each command
you just saw it
You're absolutely awesome. Thank you
Version 13 please
you don't need a v13 version, v13 already does this
Version 13 please
you don't need a v13 version, v13 already does this
yeah
When I try to use an embed and buttons, the bot responds with [object Object]
. How can I fix this?
Code:
if (command === 'discord') {
if (!message.content.startsWith(prefix)) return;
message.lineReply(discordEmbed, discordButton);
}
When I try to use an embed and buttons, the bot responds with
[object Object]
. How can I fix this?Code:
if (command === 'discord') { if (!message.content.startsWith(prefix)) return; message.lineReply(discordEmbed, discordButton); }
thats not how to send the message. also use discord.js v13, so you wont need the code snippet anymore
Bug: when replying to a reply the bot displays a SERVER tag next to the user, how can I fix that?
hi sir how can i send embed messages using this bot as it is working perfectly and giving replies to each command