mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(Message|TextChannel): Inline replies (#4874)
* feat(Message): remove reply functionality * feat(InlineReplies): add INLINE_REPLY constant/typing * feat(InlineReplies): add Message#replyReference property * feat(InlineReplies): add typings for sending inline replies * feat(InlineReplies): provide support for inline-replying to messages * feat(Message): add referencedMessage getter * fix: check that Message#reference is defined in referencedMessage * refactor(InlineReplies): rename property, rework Message resolution * docs: update jsdoc for inline replies * feat(Message): inline reply method * fix(ApiMessage): finish renaming replyTo * fix: jsdocs for Message#referencedMessage Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com> * fix: restore reply typings * fix: dont pass channel_id to API when replying * chore: update jsdocs * chore: more jsdoc updates * feat(AllowedMentions): add typings for replied_user * fix: naming conventions * fix(Message): referenced_message is null, not undefined * fix(MessageMentionOptions): repliedUser should be optional * chore: get this back to the right state * fix(ApiMessage): pass allowed_mentions when replying without content * fix(ApiMessage): prevent mutation of client options Co-authored-by: almostSouji <timoqueezle@gmail.com> Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,7 @@ client.on('message', message => {
|
||||
// If the message is "what is my avatar"
|
||||
if (message.content === 'what is my avatar') {
|
||||
// Send the user's avatar URL
|
||||
message.reply(message.author.displayAvatarURL());
|
||||
message.channel.send(message.author.displayAvatarURL());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -45,23 +45,23 @@ client.on('message', message => {
|
||||
.kick('Optional reason that will display in the audit logs')
|
||||
.then(() => {
|
||||
// We let the message author know we were able to kick the person
|
||||
message.reply(`Successfully kicked ${user.tag}`);
|
||||
message.channel.send(`Successfully kicked ${user.tag}`);
|
||||
})
|
||||
.catch(err => {
|
||||
// An error happened
|
||||
// This is generally due to the bot not being able to kick the member,
|
||||
// either due to missing permissions or role hierarchy
|
||||
message.reply('I was unable to kick the member');
|
||||
message.channel.send('I was unable to kick the member');
|
||||
// Log the error
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
// The mentioned user isn't in this guild
|
||||
message.reply("That user isn't in this guild!");
|
||||
message.channel.send("That user isn't in this guild!");
|
||||
}
|
||||
// Otherwise, if no user was mentioned
|
||||
} else {
|
||||
message.reply("You didn't mention the user to kick!");
|
||||
message.channel.send("You didn't mention the user to kick!");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -121,23 +121,23 @@ client.on('message', message => {
|
||||
})
|
||||
.then(() => {
|
||||
// We let the message author know we were able to ban the person
|
||||
message.reply(`Successfully banned ${user.tag}`);
|
||||
message.channel.send(`Successfully banned ${user.tag}`);
|
||||
})
|
||||
.catch(err => {
|
||||
// An error happened
|
||||
// This is generally due to the bot not being able to ban the member,
|
||||
// either due to missing permissions or role hierarchy
|
||||
message.reply('I was unable to ban the member');
|
||||
message.channel.send('I was unable to ban the member');
|
||||
// Log the error
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
// The mentioned user isn't in this guild
|
||||
message.reply("That user isn't in this guild!");
|
||||
message.channel.send("That user isn't in this guild!");
|
||||
}
|
||||
} else {
|
||||
// Otherwise, if no user was mentioned
|
||||
message.reply("You didn't mention the user to ban!");
|
||||
message.channel.send("You didn't mention the user to ban!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ client.on('ready', () => {
|
||||
|
||||
client.on('message', msg => {
|
||||
if (msg.content === 'ping') {
|
||||
msg.reply('pong');
|
||||
msg.channel.send('pong');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ client.on('message', async message => {
|
||||
if (message.member.voice.channel) {
|
||||
const connection = await message.member.voice.channel.join();
|
||||
} else {
|
||||
message.reply('You need to join a voice channel first!');
|
||||
message.channel.send('You need to join a voice channel first!');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user