fix: validate number of reactions on message when adding more

This commit is contained in:
Paul Makles
2022-08-13 20:26:09 +02:00
parent fa82be74b5
commit 0e0c6f2c3a

View File

@@ -195,6 +195,11 @@ impl Message {
/// Add a reaction to a message
pub async fn add_reaction(&self, db: &Database, user: &User, emoji: &str) -> Result<()> {
// Check how many reactions are already on the message
if self.reactions.len() >= 20 {
return Err(Error::InvalidOperation);
}
// Check if the emoji is whitelisted
if !self.interactions.can_use(emoji) {
return Err(Error::InvalidOperation);