mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 17:43:30 +01:00
refactor: use optional chaining (#6757)
This commit is contained in:
@@ -92,7 +92,7 @@ const tests = [
|
||||
client.on('messageCreate', async message => {
|
||||
if (message.author.id !== owner) return;
|
||||
const match = message.content.match(/^do (.+)$/);
|
||||
if (match && match[1] === 'it') {
|
||||
if (match?.[1] === 'it') {
|
||||
/* eslint-disable no-await-in-loop */
|
||||
for (const [i, test] of tests.entries()) {
|
||||
await message.channel.send(`**#${i}**\n\`\`\`js\n${test.toString()}\`\`\``);
|
||||
|
||||
@@ -101,7 +101,7 @@ client.on('messageCreate', async message => {
|
||||
{ type: 'TextChannel#fetchWebhooks', hook: await message.channel.fetchWebhooks().then(x => x.first()) },
|
||||
{ type: 'Guild#fetchWebhooks', hook: await message.guild.fetchWebhooks().then(x => x.first()) },
|
||||
];
|
||||
if (match && match[1] === 'it') {
|
||||
if (match?.[1] === 'it') {
|
||||
/* eslint-disable no-await-in-loop */
|
||||
for (const { type, hook } of hooks) {
|
||||
for (const [i, test] of tests.entries()) {
|
||||
|
||||
Reference in New Issue
Block a user