custom module update
All checks were successful
ci/woodpecker/pr/cargo-checks Pipeline was successful

This commit is contained in:
haruyuumei 2024-03-28 18:50:28 -03:00
parent 95a9962721
commit f8de595290
6 changed files with 23 additions and 40 deletions

View file

@ -13,6 +13,7 @@ pub use crate::core::botmodules::ModulesManager;
// mod experiments; // mod experiments;
mod experimental; mod experimental;
mod thisguy;
// [ ] init() function that accepts bot instance - this is passed to init() on submodules // [ ] init() function that accepts bot instance - this is passed to init() on submodules
@ -21,5 +22,6 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// this is achieved by calling submodules that also have fn init() defined // this is achieved by calling submodules that also have fn init() defined
// experiments::init(mgr).await // experiments::init(mgr).await
experimental::init(mgr).await; experimental::init(mgr.clone()).await;
thisguy::init(&mgr).await;
} }

View file

@ -105,6 +105,7 @@ async fn good_girl(params : ExecBodyParams) {
if params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() if params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase()
|| params.msg.sender.name.to_lowercase() == "mzNToRi".to_lowercase() || params.msg.sender.name.to_lowercase() == "mzNToRi".to_lowercase()
|| params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase()
{ {
botlog::debug( botlog::debug(
"Good Girl Detected > Pausechamp", "Good Girl Detected > Pausechamp",

View file

@ -3,16 +3,26 @@ use crate::core::identity::UserRole::*;
use crate::core::bot_actions::*; use crate::core::bot_actions::*;
use crate::core::botlog; use crate::core::botlog;
use std::sync::Arc; use std::sync::Arc;
use rand::Rng;
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
//use rand::Rng;
async fn tsg(params: ExecBodyParams){ async fn tsg(params: ExecBodyParams){
if params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase() if params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase()
//|| params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() || params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase()
{ {
let phrases: [String;5] = [
"Aware Weebs...".to_string(),
"AYAYA I love anime Girls!!".to_string(),
"I love 2d Girls ILOST".to_string(),
"UOOHHHHH!!! Anime Girlssss".to_string(),
"Anime girls u say? peepoShy".to_string(),
];
let r = rand::thread_rng().gen_range(0..=4);
let a = phrases[r].clone();
botlog::debug( botlog::debug(
"Oh god I love anime Girls!!", "Oh god I love anime Girls!!",
Some("modules > thisguy()".to_string()), Some("modules > thisguy()".to_string()),
@ -27,7 +37,7 @@ async fn tsg(params: ExecBodyParams){
.chat .chat
.say_in_reply_to( .say_in_reply_to(
&params.msg, &params.msg,
String::from("Oh god I love anime Girls!!"), a,
params.clone() params.clone()
).await; ).await;
sleep(Duration::from_secs_f64(0.5)).await; sleep(Duration::from_secs_f64(0.5)).await;
@ -39,8 +49,8 @@ pub async fn init(mgr:&Arc<ModulesManager>){
BotCommand{ BotCommand{
module:BotModule(String::from("thisguy")), module:BotModule(String::from("thisguy")),
command: String::from("this"), command: String::from("anime"),
alias: vec![String::from("tsg")], alias: vec![String::from("Anime")],
exec_body: actions_util::asyncbox(tesst), exec_body: actions_util::asyncbox(tesst),
help: String::from("test"), help: String::from("test"),
required_roles: vec![ required_roles: vec![
@ -48,8 +58,6 @@ pub async fn init(mgr:&Arc<ModulesManager>){
], ],
}.add_to_modmgr(Arc::clone(&mgr)).await; }.add_to_modmgr(Arc::clone(&mgr)).await;
Listener { Listener {
module: BotModule(String::from("thisguy")), module: BotModule(String::from("thisguy")),
name: String::from("This Guy Listener"), name: String::from("This Guy Listener"),

View file

@ -1,3 +1,2 @@
pub mod core; pub mod core;
pub mod custom; pub mod custom;
pub mod modules;

View file

@ -1,10 +0,0 @@
use std::sync::Arc;
pub use crate::core::botinstance::BotInstance;
pub use crate::core::botmodules::ModulesManager;
mod thisguy;
pub async fn init(mgr:&Arc<ModulesManager>){
thisguy::init(mgr).await;
}

View file

@ -1,17 +0,0 @@
use std::sync::Arc;
// pub use crate::core::botinstance::BotInstance;
pub use crate::core::botmodules::ModulesManager;
// [ ] Load submodules
mod thisguy;
// [ ] init() function that accepts bot instance - this is passed to init() on submodules
pub async fn init(mgr: Arc<ModulesManager>) {
// Modules initializer loads modules into the bot
// this is achieved by calling submodules that also have fn init() defined
thisguy::init(Arc::clone(&mgr)).await;
}