summary refs log tree commit diff
path: root/src/system/plugin.rs
blob: d3c6764590fa3edb2bd8114989ae1665dd8380b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod autoproxy;
mod prefixes;

use async_trait::async_trait;

use twilight_model::{channel::{Channel, Message}, id::{marker::ChannelMarker, Id}};

use super::log::Logger;
use crate::system::types::{System, Response};

pub use prefixes::ProxyPrefixes;
pub use autoproxy::Autoproxy;

#[async_trait]
pub trait SeancePlugin {
    async fn handle_command(&self, logger: &Logger, system: &System, message: &Message) -> CommandOutcome;

    async fn handle_message(&self, logger: &Logger, system: &System, message: &Message, response: &mut Response);

    async fn post_response(&self, logger: &Logger, system: &System, message: &Message, channel: Id<ChannelMarker>, response: &Response);
}

pub enum CommandOutcome {
    Skipped,
    Handled,
    Errored {message: String},
}