custom module working

This commit is contained in:
haruyuumei 2024-03-28 19:33:06 -03:00
parent f8de595290
commit fda7afb191

View file

@ -1,19 +1,19 @@
use crate::core::botmodules::{ BotActionTrait, BotCommand, BotModule, Listener, ModulesManager};
use crate::core::identity::UserRole::*;
use crate::core::bot_actions::*;
use crate::core::botlog;
use std::sync::Arc;
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager};
use crate::core::identity::UserRole::*;
use rand::Rng;
use std::sync::Arc;
use tokio::time::{sleep, Duration};
//use rand::Rng;
async fn tsg(params: ExecBodyParams) {
if params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase()
|| params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase()
if params.msg.message_text == String::from("anime")
|| params.msg.message_text == String::from("Anime")
{
let phrases: [String; 5] = [
"Aware Weebs...".to_string(),
"Aware oh no! Weebs...".to_string(),
"AYAYA I love anime Girls!!".to_string(),
"I love 2d Girls ILOST ".to_string(),
"UOOHHHHH!!! Anime Girlssss".to_string(),
@ -35,35 +35,34 @@ async fn tsg(params: ExecBodyParams){
botlock
.botmgrs
.chat
.say_in_reply_to(
&params.msg,
a,
params.clone()
).await;
.say_in_reply_to(&params.msg, a, params.clone())
.await;
sleep(Duration::from_secs_f64(0.5)).await;
}
}else {
}
}
pub async fn init(mgr: &Arc<ModulesManager>) {
BotCommand {
module: BotModule(String::from("thisguy")),
command: String::from("anime"),
alias: vec![String::from("Anime")],
exec_body: actions_util::asyncbox(tesst),
help: String::from("test"),
required_roles: vec![
BotAdmin,
],
}.add_to_modmgr(Arc::clone(&mgr)).await;
required_roles: vec![BotAdmin],
}
.add_to_modmgr(Arc::clone(&mgr))
.await;
Listener {
module: BotModule(String::from("thisguy")),
name: String::from("This Guy Listener"),
exec_body: actions_util::asyncbox(tsg),
help: String::from(""),
}.add_to_modmgr(Arc::clone(&mgr)).await;
}
.add_to_modmgr(Arc::clone(&mgr))
.await;
}
async fn tesst(params: ExecBodyParams) {