fix interactions in DMs

This commit is contained in:
spiral 2021-07-28 01:55:06 -04:00
parent a8727f474b
commit def39b7bc5
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
3 changed files with 5 additions and 4 deletions

View File

@ -14,7 +14,8 @@
public ApplicationCommandInteractionData? Data { get; init; }
public ulong GuildId { get; init; }
public ulong ChannelId { get; init; }
public GuildMember Member { get; init; }
public GuildMember? Member { get; init; }
public User? User { get; init; }
public string Token { get; init; }
public Message? Message { get; init; }
}

View File

@ -22,8 +22,8 @@ namespace PluralKit.Bot
public ulong ChannelId => _evt.ChannelId;
public ulong? MessageId => _evt.Message?.Id;
public GuildMember Member => _evt.Member;
public User User => _evt.Member.User;
public GuildMember? Member => _evt.Member;
public User User => _evt.Member?.User ?? _evt.User;
public string Token => _evt.Token;
public string? CustomId => _evt.Data?.CustomId;
public InteractionCreateEvent Event => _evt;

View File

@ -80,7 +80,7 @@ namespace PluralKit.Bot
MessageUpdateEvent e => e.Author.HasValue ? e.Author.Value.Id : null,
MessageReactionAddEvent e => e.UserId,
MessageReactionRemoveEvent e => e.UserId,
InteractionCreateEvent e => e.Member.User.Id,
InteractionCreateEvent e => e.User?.Id ?? e.Member.User.Id,
_ => null,
};