Skip to content

Commit

Permalink
fix(Action): Don't crash when partials are disabled (#4822)
Browse files Browse the repository at this point in the history
  • Loading branch information
wasdennnoch committed Sep 15, 2020
1 parent 9c76129 commit 8fa3a89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/client/actions/Action.js
Expand Up @@ -93,7 +93,8 @@ class GenericAction {
if (data.guild_id) {
const guild = this.client.guilds.cache.get(data.guild_id);
if (guild) {
return this.getMember(data.member, guild).user;
const member = this.getMember(data.member, guild);
return member ? member.user : undefined;
}
}
return this.getUser(data);
Expand Down
3 changes: 3 additions & 0 deletions src/client/actions/TypingStart.js
Expand Up @@ -7,6 +7,9 @@ const textBasedChannelTypes = ['dm', 'text', 'news'];
class TypingStart extends Action {
handle(data) {
const channel = this.getChannel(data);
if (!channel) {
return;
}
if (!textBasedChannelTypes.includes(channel.type)) {
this.client.emit(Events.WARN, `Discord sent a typing packet to a ${channel.type} channel ${channel.id}`);
return;
Expand Down

0 comments on commit 8fa3a89

Please sign in to comment.