fix: fail-fast if we don't have Send Messages permissions in the current channel
This commit is contained in:
parent
233d0341a2
commit
36e242986d
@ -63,6 +63,8 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
|
|||||||
if (evt.Type != Message.MessageType.Default && evt.Type != Message.MessageType.Reply) return;
|
if (evt.Type != Message.MessageType.Default && evt.Type != Message.MessageType.Reply) return;
|
||||||
if (IsDuplicateMessage(evt)) return;
|
if (IsDuplicateMessage(evt)) return;
|
||||||
|
|
||||||
|
if (!(await _cache.PermissionsIn(evt.ChannelId)).HasFlag(PermissionSet.SendMessages)) return;
|
||||||
|
|
||||||
// spawn off saving the private channel into another thread
|
// spawn off saving the private channel into another thread
|
||||||
// it is not a fatal error if this fails, and it shouldn't block message processing
|
// it is not a fatal error if this fails, and it shouldn't block message processing
|
||||||
_ = _dmCache.TrySavePrivateChannel(evt);
|
_ = _dmCache.TrySavePrivateChannel(evt);
|
||||||
|
Loading…
Reference in New Issue
Block a user