mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
chore: consistency/prettier (#3852)
* chore: consistency/prettier * chore: rebase * chore: rebase * chore: include typings * fix: include typings file in prettier lint-staged
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const { token, prefix } = require('./auth');
|
||||
const Discord = require('../src');
|
||||
const { Util } = Discord;
|
||||
const { token, prefix } = require('./auth');
|
||||
|
||||
const client = new Discord.Client({
|
||||
// To see a difference, comment out disableMentions and run the same tests using disableEveryone
|
||||
@@ -10,38 +12,33 @@ const client = new Discord.Client({
|
||||
});
|
||||
|
||||
const tests = [
|
||||
// Test 1
|
||||
// See https://github.com/discordapp/discord-api-docs/issues/1189
|
||||
'@\u202eeveryone @\u202ehere',
|
||||
// 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 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',
|
||||
// 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(''));
|
||||
// Check if message starts with prefix
|
||||
if (!message.content.startsWith(prefix)) return;
|
||||
const [command, ...args] = message.content.substr(prefix.length).split(' ');
|
||||
|
||||
if (command === 'test1')
|
||||
message.reply(tests[0]);
|
||||
else if (command === 'test2')
|
||||
message.reply(tests[1]);
|
||||
else if (command === 'test3')
|
||||
message.reply(tests[2]);
|
||||
// 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]);
|
||||
});
|
||||
|
||||
client.login(token).catch(console.error);
|
||||
|
||||
Reference in New Issue
Block a user