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:
@@ -36,9 +36,9 @@ client.on('message', message => {
|
||||
// Clean content and log each character
|
||||
console.log(Util.cleanContent(args.join(' '), message).split(''));
|
||||
|
||||
if (command === 'test1') message.reply(tests[0]);
|
||||
else if (command === 'test2') message.reply(tests[1]);
|
||||
else if (command === 'test3') message.reply(tests[2]);
|
||||
if (command === 'test1') message.channel.send(tests[0]);
|
||||
else if (command === 'test2') message.channel.send(tests[1]);
|
||||
else if (command === 'test3') message.channel.send(tests[2]);
|
||||
});
|
||||
|
||||
client.login(token).catch(console.error);
|
||||
|
||||
@@ -135,7 +135,7 @@ client.on('message', message => {
|
||||
}
|
||||
message.channel.send('last one...').then(m => {
|
||||
const diff = Date.now() - start;
|
||||
m.reply(`Each message took ${diff / 21}ms to send`);
|
||||
m.channel.send(`Each message took ${diff / 21}ms to send`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ client.on('message', msg => {
|
||||
.join()
|
||||
.then(conn => {
|
||||
con = conn;
|
||||
msg.reply('done');
|
||||
msg.channel.send('done');
|
||||
const s = ytdl(song, { filter: 'audioonly' }, { passes: 3 });
|
||||
s.on('error', e => console.log(`e w stream 2 ${e}`));
|
||||
disp = conn.playStream(s);
|
||||
|
||||
@@ -32,7 +32,6 @@ const tests = [
|
||||
|
||||
m => m.channel.send(fill('x'), { split: true }),
|
||||
m => m.channel.send(fill('1'), { code: 'js', split: true }),
|
||||
m => m.channel.send(fill('x'), { reply: m.author, code: 'js', split: true }),
|
||||
m => m.channel.send(fill('xyz '), { split: { char: ' ' } }),
|
||||
|
||||
m => m.channel.send('x', { embed: { description: 'a' } }),
|
||||
@@ -99,7 +98,6 @@ const tests = [
|
||||
async m => m.channel.send({ files: [await read(fileA)] }),
|
||||
async m =>
|
||||
m.channel.send(fill('x'), {
|
||||
reply: m.author,
|
||||
code: 'js',
|
||||
split: true,
|
||||
embed: embed().setImage('attachment://zero.png'),
|
||||
@@ -111,7 +109,6 @@ const tests = [
|
||||
m => m.channel.send({ files: [{ attachment: readStream(fileA) }] }),
|
||||
async m =>
|
||||
m.channel.send(fill('xyz '), {
|
||||
reply: m.author,
|
||||
code: 'js',
|
||||
split: { char: ' ', prepend: 'hello! ', append: '!!!' },
|
||||
embed: embed().setImage('attachment://zero.png'),
|
||||
|
||||
@@ -31,16 +31,13 @@ const commands = {
|
||||
}
|
||||
message.channel.send(res, { code: 'js' });
|
||||
},
|
||||
ping: message => message.reply('pong'),
|
||||
ping: message => message.channel.send('pong'),
|
||||
};
|
||||
|
||||
client.on('message', message => {
|
||||
if (!message.content.startsWith(prefix) || message.author.bot) return;
|
||||
|
||||
message.content = message.content
|
||||
.replace(prefix, '')
|
||||
.trim()
|
||||
.split(' ');
|
||||
message.content = message.content.replace(prefix, '').trim().split(' ');
|
||||
const command = message.content.shift();
|
||||
message.content = message.content.join(' ');
|
||||
|
||||
|
||||
@@ -43,20 +43,15 @@ client.on('message', m => {
|
||||
conn.receiver.createStream(m.author, true).on('data', b => console.log(b.toString()));
|
||||
conn.player.on('error', (...e) => console.log('player', ...e));
|
||||
if (!connections.has(m.guild.id)) connections.set(m.guild.id, { conn, queue: [] });
|
||||
m.reply('ok!');
|
||||
m.channel.send('ok!');
|
||||
conn.play(ytdl('https://www.youtube.com/watch?v=_XXOSf0s2nk', { filter: 'audioonly' }, { passes: 3 }));
|
||||
});
|
||||
} else {
|
||||
m.reply('Specify a voice channel!');
|
||||
m.channel.send('Specify a voice channel!');
|
||||
}
|
||||
} else if (m.content.startsWith('#eval') && m.author.id === '66564597481480192') {
|
||||
try {
|
||||
const com = eval(
|
||||
m.content
|
||||
.split(' ')
|
||||
.slice(1)
|
||||
.join(' '),
|
||||
);
|
||||
const com = eval(m.content.split(' ').slice(1).join(' '));
|
||||
m.channel.send(com, { code: true });
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
@@ -32,7 +32,6 @@ const tests = [
|
||||
|
||||
(m, hook) => hook.send(fill('x'), { split: true }),
|
||||
(m, hook) => hook.send(fill('1'), { code: 'js', split: true }),
|
||||
(m, hook) => hook.send(fill('x'), { reply: m.author, code: 'js', split: true }),
|
||||
(m, hook) => hook.send(fill('xyz '), { split: { char: ' ' } }),
|
||||
|
||||
(m, hook) => hook.send({ embeds: [{ description: 'a' }] }),
|
||||
@@ -96,7 +95,6 @@ const tests = [
|
||||
async (m, hook) => hook.send({ files: [await read(fileA)] }),
|
||||
async (m, hook) =>
|
||||
hook.send(fill('x'), {
|
||||
reply: m.author,
|
||||
code: 'js',
|
||||
split: true,
|
||||
embeds: [embed().setImage('attachment://zero.png')],
|
||||
@@ -108,7 +106,6 @@ const tests = [
|
||||
(m, hook) => hook.send({ files: [{ attachment: readStream(fileA) }] }),
|
||||
async (m, hook) =>
|
||||
hook.send(fill('xyz '), {
|
||||
reply: m.author,
|
||||
code: 'js',
|
||||
split: { char: ' ', prepend: 'hello! ', append: '!!!' },
|
||||
embeds: [embed().setImage('attachment://zero.png')],
|
||||
|
||||
Reference in New Issue
Block a user