mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Add basic chat plugin harness (no plugin loading implemented)
This commit is contained in:
11
rc_plugins/Cargo.toml
Normal file
11
rc_plugins/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "oj_rc_plugins"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
readme.workspace = true
|
||||
|
||||
[dependencies]
|
||||
log.workspace = true
|
||||
2
rc_plugins/src/chat/mod.rs
Normal file
2
rc_plugins/src/chat/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
mod plugin;
|
||||
pub use plugin::{ChatProvider, ChatPlugin};
|
||||
8
rc_plugins/src/chat/plugin.rs
Normal file
8
rc_plugins/src/chat/plugin.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
pub trait ChatPlugin: crate::Plugin {
|
||||
fn set_provider(&self, provider: std::sync::Arc<Box<dyn ChatProvider>>);
|
||||
fn on_message(&self, message: &str, channel: &str, username: &str);
|
||||
}
|
||||
|
||||
pub trait ChatProvider: Send + Sync {
|
||||
fn send_message(&self, message: &str, channel: &str, username: &str);
|
||||
}
|
||||
3
rc_plugins/src/lib.rs
Normal file
3
rc_plugins/src/lib.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod chat;
|
||||
|
||||
pub trait Plugin: Send + Sync {}
|
||||
Reference in New Issue
Block a user