mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(*): enforce strings (#4880)
BREAKING CHANGE: Removes all Resolvables for only string inputs Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
@@ -9,7 +9,6 @@ const { Client, Intents, MessageAttachment, MessageEmbed, WebhookClient } = requ
|
||||
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
|
||||
|
||||
const fill = c => Array(4).fill(c.repeat(1000));
|
||||
const buffer = l => fetch(l).then(res => res.buffer());
|
||||
const read = util.promisify(fs.readFile);
|
||||
const readStream = fs.createReadStream;
|
||||
@@ -24,16 +23,10 @@ const attach = (attachment, name) => new MessageAttachment(attachment, name);
|
||||
|
||||
const tests = [
|
||||
(m, hook) => hook.send('x'),
|
||||
(m, hook) => hook.send(['x', 'y']),
|
||||
|
||||
(m, hook) => hook.send('x', { code: true }),
|
||||
(m, hook) => hook.send('1', { code: 'js' }),
|
||||
(m, hook) => hook.send('x', { code: '' }),
|
||||
|
||||
(m, hook) => hook.send(fill('x'), { split: true }),
|
||||
(m, hook) => hook.send(fill('1'), { code: 'js', split: true }),
|
||||
(m, hook) => hook.send(fill('xyz '), { split: { char: ' ' } }),
|
||||
|
||||
(m, hook) => hook.send({ embeds: [{ description: 'a' }] }),
|
||||
(m, hook) => hook.send({ files: [{ attachment: linkA }] }),
|
||||
(m, hook) =>
|
||||
@@ -61,8 +54,8 @@ const tests = [
|
||||
(m, hook) => hook.send({ embeds: [{ description: 'a' }] }),
|
||||
(m, hook) => hook.send(embed().setDescription('a')),
|
||||
|
||||
(m, hook) => hook.send(['x', 'y'], [embed().setDescription('a'), attach(linkB)]),
|
||||
(m, hook) => hook.send(['x', 'y'], [attach(linkA), attach(linkB)]),
|
||||
(m, hook) => hook.send('x', [embed().setDescription('a'), attach(linkB)]),
|
||||
(m, hook) => hook.send('x', [attach(linkA), attach(linkB)]),
|
||||
|
||||
(m, hook) => hook.send([embed().setDescription('a'), attach(linkB)]),
|
||||
(m, hook) =>
|
||||
@@ -93,25 +86,10 @@ const tests = [
|
||||
(m, hook) => hook.send({ files: [fileA] }),
|
||||
(m, hook) => hook.send(attach(fileA)),
|
||||
async (m, hook) => hook.send({ files: [await read(fileA)] }),
|
||||
async (m, hook) =>
|
||||
hook.send(fill('x'), {
|
||||
code: 'js',
|
||||
split: true,
|
||||
embeds: [embed().setImage('attachment://zero.png')],
|
||||
files: [attach(await buffer(linkA), 'zero.png')],
|
||||
}),
|
||||
|
||||
(m, hook) => hook.send('x', attach(readStream(fileA))),
|
||||
(m, hook) => hook.send({ files: [readStream(fileA)] }),
|
||||
(m, hook) => hook.send({ files: [{ attachment: readStream(fileA) }] }),
|
||||
async (m, hook) =>
|
||||
hook.send(fill('xyz '), {
|
||||
code: 'js',
|
||||
split: { char: ' ', prepend: 'hello! ', append: '!!!' },
|
||||
embeds: [embed().setImage('attachment://zero.png')],
|
||||
files: [linkB, attach(await buffer(linkA), 'zero.png'), readStream(fileA)],
|
||||
}),
|
||||
|
||||
(m, hook) => hook.send('Done!'),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user