mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
* 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>
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const { token, prefix } = require('./auth');
|
|
const Discord = require('../src');
|
|
const { Util } = Discord;
|
|
|
|
const client = new Discord.Client({
|
|
// To see a difference, comment out disableMentions and run the same tests using disableEveryone
|
|
// You will notice that all messages will mention @everyone
|
|
// disableEveryone: true
|
|
disableMentions: 'everyone',
|
|
});
|
|
|
|
const tests = [
|
|
// Test 1
|
|
// See https://github.com/discordapp/discord-api-docs/issues/1189
|
|
'@\u202eeveryone @\u202ehere',
|
|
|
|
// Test 2
|
|
// See https://github.com/discordapp/discord-api-docs/issues/1241
|
|
// TL;DR: Characters like \u0300 will only be stripped if more than 299 are present
|
|
`${'\u0300@'.repeat(150)}@\u0300everyone @\u0300here`,
|
|
|
|
// Test 3
|
|
// Normal @everyone/@here mention
|
|
'@everyone @here',
|
|
];
|
|
|
|
client.on('ready', () => console.log('Ready!'));
|
|
|
|
client.on('message', message => {
|
|
// Check if message starts with prefix
|
|
if (!message.content.startsWith(prefix)) return;
|
|
const [command, ...args] = message.content.substr(prefix.length).split(' ');
|
|
|
|
// Clean content and log each character
|
|
console.log(Util.cleanContent(args.join(' '), message).split(''));
|
|
|
|
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);
|