refactor(actions): use optional chaining (#7460)

This commit is contained in:
muchnameless
2022-02-15 18:31:29 +01:00
committed by GitHub
parent 36173590a7
commit d1bb36256f
4 changed files with 4 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ class MessageReactionAdd extends Action {
// Verify channel
const channel = this.getChannel(data);
if (!channel || !channel.isTextBased()) return false;
if (!channel?.isTextBased()) return false;
// Verify message
const message = this.getMessage(data, channel);

View File

@@ -20,7 +20,7 @@ class MessageReactionRemove extends Action {
// Verify channel
const channel = this.getChannel(data);
if (!channel || !channel.isTextBased()) return false;
if (!channel?.isTextBased()) return false;
// Verify message
const message = this.getMessage(data, channel);

View File

@@ -7,7 +7,7 @@ class MessageReactionRemoveAll extends Action {
handle(data) {
// Verify channel
const channel = this.getChannel(data);
if (!channel || !channel.isTextBased()) return false;
if (!channel?.isTextBased()) return false;
// Verify message
const message = this.getMessage(data, channel);

View File

@@ -6,7 +6,7 @@ const Events = require('../../util/Events');
class MessageReactionRemoveEmoji extends Action {
handle(data) {
const channel = this.getChannel(data);
if (!channel || !channel.isTextBased()) return false;
if (!channel?.isTextBased()) return false;
const message = this.getMessage(data, channel);
if (!message) return false;