Add all possible notifications.

This commit is contained in:
Paul Makles
2020-04-13 17:47:48 +01:00
parent 0f793f84a2
commit 8043690d38
12 changed files with 435 additions and 96 deletions

View File

@@ -1,3 +1,5 @@
use crate::guards::channel::ChannelRef;
use once_cell::sync::OnceCell;
use std::sync::mpsc::{channel, Sender};
use std::thread;
@@ -62,3 +64,11 @@ pub fn send_message_threaded<U: Into<Option<Vec<String>>>, G: Into<Option<String
.is_ok()
}
}
pub fn send_message_given_channel(data: events::Notification, channel: &ChannelRef) {
match channel.channel_type {
0..=1 => send_message_threaded(channel.recipients.clone(), None, data),
2 => send_message_threaded(None, channel.guild.clone(), data),
_ => unreachable!(),
};
}