Compare commits

..

No commits in common. "master" and "Log-modules-acts" have entirely different histories.

18 changed files with 179 additions and 640 deletions

6
.gitignore vendored
View file

@ -23,9 +23,3 @@ target/
# debug # debug
.vscode/ .vscode/
# nix
result/
# pre-commit
/.pre-commit-config.yaml

View file

@ -1,5 +1,5 @@
when: when:
branch: master branch: main
event: [push, pull_request] event: [push, pull_request]
path: path:
include: include:

View file

@ -37,7 +37,7 @@ steps:
owner: ${CI_REPO_OWNER} owner: ${CI_REPO_OWNER}
repo: ${CI_REPO_NAME} repo: ${CI_REPO_NAME}
branch: flake-lock-update branch: flake-lock-update
base_branch: master base_branch: main
pr_title: "flake.lock: update" pr_title: "flake.lock: update"
pr_body: PR automatically created by Woodpecker CI pr_body: PR automatically created by Woodpecker CI
close_pr_if_empty: true close_pr_if_empty: true

View file

@ -9,10 +9,9 @@ test ModulatingForceBot
``` ```
login_name = <botname> login_name = <botname>
access_token = <oauth token> access_token = <oath token>
bot_channels = <chnl1>,<chnl2> bot_channels = <chnl1>,<chnl2>
prefix = <prefix> prefix = <prefix>
bot_admins = <admins>
``` ```

View file

@ -6,11 +6,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1711952616, "lastModified": 1706768574,
"narHash": "sha256-WJvDdOph001fA1Ap3AyaQtz/afJAe7meSG5uJAdSE+A=", "narHash": "sha256-4o6TMpzBHO659EiJTzd/EGQGUDdbgwKwhqf3u6b23U8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "209048d7c545905c470f6f8c05c5061f391031a8", "rev": "668102037129923cd0fc239d864fce71eabdc6a3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,68 +20,13 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1711703276, "lastModified": 1706550542,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -91,92 +36,36 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable": {
"locked": {
"lastModified": 1710695816,
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1712573573, "lastModified": 1708296515,
"narHash": "sha256-xxon7WwNm4/EadMKg1eF40/5s0O78nXUy2ILZt6vT7E=", "narHash": "sha256-FyF489fYNAUy7b6dkYV6rGPyzp+4tThhr80KNAaF/yY=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0d28066770464d19d637f6e8e42e8688420b6ac6", "rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1710765496,
"narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_3",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1712579741,
"narHash": "sha256-igpsH+pa6yFwYOdah3cFciCk8gw+ytniG9quf5f/q84=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "70f504012f0a132ac33e56988e1028d88a48855c",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix", "fenix": "fenix",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2"
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems_2"
} }
}, },
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1711885694, "lastModified": 1706735270,
"narHash": "sha256-dyezzeSbWMpflma+E9USmvSxuLgGcNGcGw3cOnX36ko=", "narHash": "sha256-IJk+UitcJsxzMQWm9pa1ZbJBriQ4ginXOlPyVq+Cu40=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "e4a405f877efd820bef9c0e77a02494e47c17512", "rev": "42cb1a2bd79af321b0cc503d2960b73f34e2f92b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -185,36 +74,6 @@
"repo": "rust-analyzer", "repo": "rust-analyzer",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -1,80 +1,39 @@
{ {
description = "A basic flake"; description = "forcebot_rs flake";
inputs = { inputs = {
systems.url = "github:nix-systems/default-linux"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix.url = "github:nix-community/fenix/monthly"; fenix.url = "github:nix-community/fenix/monthly";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
}; };
outputs = { outputs = {
self,
systems,
nixpkgs, nixpkgs,
fenix, fenix,
pre-commit-hooks, ...
}: let } @ inputs: let
eachSystem = nixpkgs.lib.genAttrs (import systems); system = "x86_64-linux";
pkgsFor = eachSystem (system: overlays = [fenix.overlays.default];
import nixpkgs { pkgs = import nixpkgs {
localSystem.system = system; inherit system overlays;
overlays = [fenix.overlays.default]; };
});
in { in {
packages = eachSystem (system: let devShells.${system}.default = pkgs.mkShell {
pkgs = nixpkgs.legacyPackages.${system}; name = "forcebot_rs-devenv";
inherit ((builtins.fromTOML (builtins.readFile ./Cargo.toml)).package) version; nativeBuildInputs = [pkgs.pkg-config];
in { buildInputs = with pkgs; [openssl libiconv];
default = pkgsFor.${system}.rustPlatform.buildRustPackage { packages = with pkgs; [
pname = "forcebot_rs"; nil
version = "${version}"; alejandra
rust-analyzer-nightly
src = self; (fenix.packages.${system}.complete.withComponents [
"cargo"
cargoLock = { "clippy"
lockFile = ./Cargo.lock; "rust-src"
}; "rustc"
"rustfmt"
nativeBuildInputs = with pkgs; [pkg-config]; ])
buildInputs = with pkgs; [openssl]; ];
RUST_BACKTRACE = 1;
doCheck = false; RUST_SRC_PATH = "${fenix.packages.${system}.complete.rust-src}/lib/rustlib/src/rust/library";
}; };
});
checks = eachSystem (system: {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
# rust
rustfmt.enable = true;
clippy.enable = true;
# nix
statix.enable = true;
alejandra.enable = true;
deadnix.enable = true;
};
};
});
devShells = eachSystem (system: {
default = pkgsFor.${system}.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
packages = with pkgsFor.${system}; [
nil
alejandra
rust-analyzer-nightly
(fenix.packages.${system}.complete.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
])
];
RUST_BACKTRACE = 1;
RUST_SRC_PATH = "${fenix.packages.${system}.complete.rust-src}/lib/rustlib/src/rust/library";
};
});
nixosModules.default = import ./nix/module.nix {inherit self;};
}; };
} }

View file

@ -1,30 +0,0 @@
{self}: {
pkgs,
config,
lib,
...
}: let
inherit (lib) types;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption;
inherit (pkgs.stdenv.hostPlatform) system;
cfg = config.services.forcebot_rs;
in {
options.services.forcebot_rs = {
enable = mkEnableOption ''
Enable forcebot
'';
package = mkOption {
type = types.package;
inherit (self.packages.${system}) default;
};
};
config = mkIf cfg.enable {
systemd.services.forcebot_rs = {
wantedBy = ["multi-user.target"];
serviceConfig.ExecStart = "${cfg.package}/bin/forcebot_rs";
};
};
}

View file

@ -1,4 +1,5 @@
use twitch_irc::message::{PrivmsgMessage, TwitchUserBasics};
use twitch_irc::message::PrivmsgMessage;
use std::sync::Arc; use std::sync::Arc;
use tokio::sync::RwLock; use tokio::sync::RwLock;
@ -56,68 +57,9 @@ impl ExecBodyParams {
requestor_badge_mut requestor_badge_mut
} }
/// Returns some information about the message that was replied to by the `PrivmsgMessage` contained
/// in the `msg` field of this struct.
///
/// If that message replied to message return that information in form of `Some<ReplyParent>`.
/// Otherwise, return `None`.
pub fn get_parent_reply(&self) -> Option<ReplyParent> {
let map = &self.msg.source.tags.0;
let tags = [
"reply-parent-user-id",
"reply-parent-user-login",
"reply-parent-display-name",
"reply-parent-msg-id",
"reply-parent-msg-body"
];
// filter out all tags that do not have content.
let tag_contents: Vec<String> = tags.iter().filter_map(|tag| {
// if let Some(&Some(ref t)) = map.get(*tag) {
if let Some(Some(t)) = map.get(*tag) {
Some(t.clone())
} else {
None
}
}).collect();
// if no tags got filtered out return the struct.
// else return `None`.
if tag_contents.len() == 5 {
Some(ReplyParent {
sender: TwitchUserBasics {
id: tag_contents[0].clone(),
login: tag_contents[1].clone(),
name: tag_contents[2].clone(),
},
message_id: tag_contents[3].clone(),
message_text: tag_contents[4].clone(),
channel_login: self.msg.channel_login.clone(),
channel_id: self.msg.channel_id.clone(),
})
} else {
None
}
}
} }
/// Represents the message a `PrivmsgMessage` replies to.
/// Similar to a less detailed `PrivmsgMessage`.
///
/// This should not be constructed manually but only from calling `get_parent_reply()` on
/// `ExecBodyParams`.
///
/// Fields that will be the same as the `PrivmsgMessage` this was generated from:
/// - `channel_login`
/// - `channel_id`
#[derive(Debug, Clone, PartialEq)]
pub struct ReplyParent {
pub sender: TwitchUserBasics,
pub message_id: String,
pub message_text: String,
pub channel_login: String,
pub channel_id: String,
}
pub mod actions_util { pub mod actions_util {

View file

@ -24,10 +24,11 @@ debug = "Checking bot actions",
pub fn trace(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) { pub fn trace(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };
@ -44,10 +45,11 @@ pub fn trace(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&Privmsg
pub fn debug(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) { pub fn debug(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };
@ -64,10 +66,11 @@ pub fn debug(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&Privmsg
pub fn info(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) { pub fn info(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };
@ -84,10 +87,11 @@ pub fn info(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgM
pub fn notice(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) { pub fn notice(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };
@ -104,10 +108,11 @@ pub fn notice(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&Privms
pub fn warn(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) { pub fn warn(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };
@ -124,10 +129,11 @@ pub fn warn(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgM
pub fn error(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) { pub fn error(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };
@ -148,10 +154,11 @@ pub fn fatal<'a>(
) -> &'a str { ) -> &'a str {
let (chnl, chatter) = match in_prvmsg { let (chnl, chatter) = match in_prvmsg {
Some(prvmsg) => { Some(prvmsg) => {
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
( (
Some(prvmsg.channel_login.clone()), Some(prvmsg.channel_login.clone()),
Some(prvmsg.sender.name.clone()), Some(prvmsg.sender.name.clone()),
) ) // <-- Clone fine atm while we're just working with Strings
} }
None => (None, None), None => (None, None),
}; };

View file

@ -253,6 +253,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// 2. Add the BotAction to ModulesManager // 2. Add the BotAction to ModulesManager
botc1.add_core_to_modmgr(Arc::clone(&mgr)).await; botc1.add_core_to_modmgr(Arc::clone(&mgr)).await;
// async fn cmd_disable(bot: BotAR, msg: PrivmsgMessage) {
async fn cmd_disable(params : ExecBodyParams) { async fn cmd_disable(params : ExecBodyParams) {
/* /*
There should be additional validation checks There should be additional validation checks

View file

@ -4,7 +4,7 @@ use std::sync::Arc;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use twitch_irc::login::StaticLoginCredentials; use twitch_irc::login::StaticLoginCredentials;
use twitch_irc::message::ReplyToMessage; use twitch_irc::message::PrivmsgMessage;
use twitch_irc::transport::tcp::{TCPTransport, TLS}; use twitch_irc::transport::tcp::{TCPTransport, TLS};
use twitch_irc::TwitchIRCClient; use twitch_irc::TwitchIRCClient;
@ -35,8 +35,8 @@ pub struct Chat {
#[derive(Clone,Debug)] #[derive(Clone,Debug)]
pub enum BotMsgType { pub enum BotMsgType<'a> {
SayInReplyTo(Channel,String,String), // ( Destination Channel , Message ID to reply to , OutMessage ) // https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say_in_reply_to SayInReplyTo(&'a PrivmsgMessage,String),
Say(String,String), Say(String,String),
Notif(String), // For Bot Sent Notifications Notif(String), // For Bot Sent Notifications
} }
@ -59,7 +59,7 @@ impl Chat {
} }
#[async_recursion] #[async_recursion]
pub async fn send_botmsg(&self, msginput: BotMsgType, params : ExecBodyParams) { pub async fn send_botmsg(&self, msginput: BotMsgType<'async_recursion>, params : ExecBodyParams) {
@ -72,18 +72,17 @@ impl Chat {
*/ */
botlog::trace(
botlog::trace(
format!("send_bot_msg params : {:?}",msginput).as_str(), format!("send_bot_msg params : {:?}",msginput).as_str(),
Some("chat.rs > send_botmsg ".to_string()), Some("chat.rs > send_botmsg ".to_string()),
Some(&params.msg), Some(&params.msg),
); );
Log::flush(); Log::flush();
let (channel_login,mut outmsg) = match msginput.clone() { let (channel_login,mut outmsg) = match msginput.clone() {
BotMsgType::SayInReplyTo(chnl, _, outmsg) => { BotMsgType::SayInReplyTo(msg, outmsg) => {
(chnl.0.to_lowercase(), // Desintation Channel (msg.channel_login.clone(),outmsg)
outmsg)
}, },
BotMsgType::Say(a,b ) => { BotMsgType::Say(a,b ) => {
(a.clone(),b.clone()) (a.clone(),b.clone())
@ -114,15 +113,13 @@ impl Chat {
).await; ).await;
if !params.bot.read().await.bot_channels.contains(&Channel(channel_login.clone())) { if !params.bot.read().await.bot_channels.contains(&Channel(channel_login.clone())) {
dbg!("ISSUE : NONJOINED CHANNEL",&params.bot.read().await.bot_channels,Channel(channel_login.clone()));
botlog::warn( botlog::warn(
&format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()), &format!("A message attempted to send for a Non-Joined Channel : {}",channel_login.clone()),
Some("Chat > send_botmsg".to_string()), Some("Chat > send_botmsg".to_string()),
None, None,
); );
if let BotMsgType::SayInReplyTo(_chnl,_msgid, _outmsg) = msginput { if let BotMsgType::SayInReplyTo(_prvmsg,_outmsg) = msginput {
self.send_botmsg(BotMsgType::Notif( self.send_botmsg(BotMsgType::Notif(
"uuh Bot can't send to a channel it isn't joined".to_string(), "uuh Bot can't send to a channel it isn't joined".to_string(),
@ -170,7 +167,7 @@ impl Chat {
match msginput { match msginput {
BotMsgType::Notif(_) => (), // Do nothing with Notif > We'll validate the user later to handle BotMsgType::Notif(_) => (), // Do nothing with Notif > We'll validate the user later to handle
BotMsgType::SayInReplyTo(_, _, _) | BotMsgType::Say(_,_) => { BotMsgType::SayInReplyTo(_, _) | BotMsgType::Say(_,_) => {
botlog::trace( botlog::trace(
"BEFORE potential Async recursion", "BEFORE potential Async recursion",
@ -235,7 +232,7 @@ impl Chat {
let botlock = botclone.read().await; let botlock = botclone.read().await;
let id = botlock.get_identity(); let id = botlock.get_identity();
let id = Arc::clone(&id); let id = Arc::clone(&id);
let idlock = id.read().await; let idlock = id.read().await; // <-- [x] 03.24 - seems to work
let user_roles = idlock.getspecialuserroles( let user_roles = idlock.getspecialuserroles(
params.get_sender(), params.get_sender(),
Some(Channel(channel_login.clone())) Some(Channel(channel_login.clone()))
@ -269,7 +266,7 @@ impl Chat {
return; return;
} }
}, },
BotMsgType::SayInReplyTo(_,_,_ ) | BotMsgType::Say(_,_) => { BotMsgType::SayInReplyTo(_,_ ) | BotMsgType::Say(_,_) => {
// If the BotMsg a Say/SayInReplyTo (from Developer or Chatter) , and the Sender does not have Specific Roles in the Source Channel Sent // If the BotMsg a Say/SayInReplyTo (from Developer or Chatter) , and the Sender does not have Specific Roles in the Source Channel Sent
self.send_botmsg(BotMsgType::Notif( self.send_botmsg(BotMsgType::Notif(
@ -323,6 +320,7 @@ impl Chat {
); );
let contextratelimiter = rllock let contextratelimiter = rllock
// .get_mut()
.get_mut(&Channel(channel_login.to_lowercase().clone())) .get_mut(&Channel(channel_login.to_lowercase().clone()))
.expect("ERROR: Issue with Rate limiters"); .expect("ERROR: Issue with Rate limiters");
@ -341,21 +339,13 @@ impl Chat {
} }
match msginput.clone() { match msginput.clone() {
BotMsgType::SayInReplyTo(chnl,msgid, _) => { BotMsgType::SayInReplyTo(msg, _) => {
self.client.say_in_reply_to(msg, outmsg).await.unwrap();
dbg!(chnl.clone(),msgid.clone(),outmsg.clone());
self.client.say_in_reply_to(&(
chnl.0,
msgid),
outmsg).await.unwrap();
}, },
BotMsgType::Say(a, _) => { BotMsgType::Say(a, _) => {
self.client.say(a, outmsg).await.unwrap(); self.client.say(a, outmsg).await.unwrap();
} }
BotMsgType::Notif(outmsg) => { BotMsgType::Notif(outmsg) => {
dbg!(params.msg.channel_login(),params.msg.message_id());
self.client.say_in_reply_to(&params.msg, outmsg).await.unwrap(); self.client.say_in_reply_to(&params.msg, outmsg).await.unwrap();
} }
} }
@ -367,11 +357,11 @@ impl Chat {
channel_login.clone(), "rate limit counter increase", contextratelimiter channel_login.clone(), "rate limit counter increase", contextratelimiter
); );
if let BotMsgType::SayInReplyTo(_,_,_ ) = msginput { if let BotMsgType::SayInReplyTo(msg,_ ) = msginput {
botlog::trace( botlog::trace(
logstr.as_str(), logstr.as_str(),
Some("Chat > send_botmsg".to_string()), Some("Chat > send_botmsg".to_string()),
None, Some(msg),
); );
} else { } else {
botlog::trace( botlog::trace(
@ -397,49 +387,73 @@ impl Chat {
} }
pub async fn say_in_reply(
&self,
destination_channel : Channel ,
outmsg: String ,
params : ExecBodyParams)
{
self.send_botmsg(BotMsgType::SayInReplyTo( // pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String) {
destination_channel, // #[async_recursion]
params.msg.message_id().to_string(), pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
outmsg) , params).await;
// let params_clone = params.clone();
// let botclone = Arc::clone(&params_clone.bot);
// let botlock = botclone.read().await;
// let id = botlock.get_identity();
// let id = Arc::clone(&id);
// // botlog::trace(
// // "ACQUIRING WRITE LOCK : ID",
// // Some("Chat > send_botmsg".to_string()),
// // Some(&params.msg),
// // );
// // Log::flush();
// botlog::trace(
// "ACQUIRING READ LOCK : ID",
// Some("Chat > send_botmsg".to_string()),
// Some(&params.msg),
// );
// Log::flush();
// // let idlock = id.write().await; // <-- [ ] 03.24 - This is definitely locking it
// let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
// let a = idlock.getspecialuserroles(params.get_sender(), Some(Channel(msg.channel_login.clone()))).await;
// botlog::trace(
// format!("GETSPECIALUSERROLES RESULT : {:?}",a).as_str(),
// Some("Chat > send_botmsg".to_string()),
// Some(&params.msg),
// );
// Log::flush();
// // botlog::trace(
// // "ACQUIRED WRITE LOCK : ID",
// // Some("Chat > send_botmsg".to_string()),
// // Some(&params.msg),
// // );
// // Log::flush();
// botlog::trace(
// "ACQUIRED READ LOCK : ID",
// Some("Chat > send_botmsg".to_string()),
// Some(&params.msg),
// );
// Log::flush();
self.send_botmsg(BotMsgType::SayInReplyTo(msg, outmsg) , params).await;
} }
pub async fn say_in_reply_to( // pub async fn say(&self, channel_login: String, message: String) {
&self,
destination_channel : Channel ,
reply_message_id : String ,
outmsg: String ,
params : ExecBodyParams)
{
self.send_botmsg(BotMsgType::SayInReplyTo(
destination_channel,
reply_message_id,
outmsg) , params).await;
}
pub async fn say(&self, channel_login: String, message: String , params : ExecBodyParams) { pub async fn say(&self, channel_login: String, message: String , params : ExecBodyParams) {
// more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say // more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say
self.send_botmsg(BotMsgType::Say(channel_login.to_lowercase(), message), params).await; self.send_botmsg(BotMsgType::Say(channel_login.to_lowercase(), message), params).await;
} }
async fn _me(&self, _: String, _: String) { async fn _me(&self, _: String, _: String) {
// more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say // more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say

View file

@ -8,7 +8,6 @@ use std::sync::Arc;
use tokio::sync::RwLock; use tokio::sync::RwLock;
use tokio::time::{sleep,Duration};
use twitch_irc::message::PrivmsgMessage; use twitch_irc::message::PrivmsgMessage;
use casual_logger::Log; use casual_logger::Log;
@ -18,24 +17,19 @@ use crate::core::bot_actions::ExecBodyParams;
use crate::core::botinstance::{Channel,ChangeResult}; use crate::core::botinstance::{Channel,ChangeResult};
use crate::core::botlog; use crate::core::botlog;
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
use dotenv::dotenv; use dotenv::dotenv;
use std::env; use std::env;
fn adminvector() -> Vec<String> { fn adminvector() -> Vec<String> {
dotenv().ok(); vec![String::from("ModulatingForce")]
let mut admins = Vec::new(); //vec![]
if let Ok(value) = env::var("bot_admins") {
for admin in value.split(',') {
admins.push(String::from(admin))
}
}
admins
} }
pub fn otherbots_vector() -> Vec<String> { pub fn otherbots_vector() -> Vec<String> {
// vec![String::from("ModulatingForce")]
// //vec![]
dotenv().ok(); dotenv().ok();
let mut other_bots = Vec::new(); let mut other_bots = Vec::new();
@ -68,10 +62,7 @@ pub async fn init(mgr: Arc<ModulesManager>) {
let tempb = BotCommand { let tempb = BotCommand {
module: BotModule(String::from("identity")), module: BotModule(String::from("identity")),
command: String::from("promote"), // command call name command: String::from("promote"), // command call name
alias: vec![ alias: vec![], // String of alternative names
"cucked".to_string(),
"cuck".to_string(),
], // String of alternative names
exec_body: actions_util::asyncbox(cmd_promote), exec_body: actions_util::asyncbox(cmd_promote),
help: String::from("promote"), help: String::from("promote"),
required_roles: vec![ required_roles: vec![
@ -176,7 +167,7 @@ async fn cmd_promote(params : ExecBodyParams) {
let mut argv = params.msg.message_text.split(' '); let mut argv = params.msg.message_text.split(' ');
let cmdname = argv.next(); // Skip the command name argv.next(); // Skip the command name
let arg1 = argv.next(); let arg1 = argv.next();
@ -214,7 +205,7 @@ async fn cmd_promote(params : ExecBodyParams) {
// [x] 1. Get trgusr (regardless of -admin flag) // [x] 1. Get trgusr (regardless of -admin flag)
// let targetusr = if arg1 == Some("-admin") { arg2 } else { arg1 }; // let targetusr = if arg1 == Some("-admin") { arg2 } else { arg1 };
let mut targetusr = if let targetusr = if
arg1 == Some("-admin") arg1 == Some("-admin")
|| arg1 == Some("-v") || arg1 == Some("-v")
|| arg1 == Some("-vip") || arg1 == Some("-vip")
@ -234,50 +225,6 @@ async fn cmd_promote(params : ExecBodyParams) {
} }
else { arg1 }; else { arg1 };
// [x] Check if target is an existing user
targetusr = if let Some(chkusr) = targetusr {
match twitch_irc::validate::validate_login(chkusr.to_lowercase().as_str()) {
Ok(_) => Some(chkusr),
Err(_) => None,
}
} else { None } ;
// [x] Check if cmd passed is cucked, then go through special cucked handling
if let Some(cmd_to_check) = cmdname {
if cmd_to_check.to_lowercase() == String::from(botlock.get_prefix()) + "cucked"
|| cmd_to_check.to_lowercase() == String::from(botlock.get_prefix()) + "cuck"
{
let idlock = botlock.botmgrs.identity.read().await;
let senderroles = idlock.getspecialuserroles(sendername.clone(), Some(Channel(targetchnl.to_lowercase()))).await;
if senderroles.contains(&UserRole::BotAdmin) && targetusr.is_none() {
targetusr = Some(sendername.as_str())
}
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
"uuh ".to_string()
),
params.clone(),
).await;
sleep(Duration::from_secs_f64(2.0)).await;
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
"... chatter getting cucked ...".to_string()
),
params.clone(),
).await;
sleep(Duration::from_secs_f64(1.0)).await;
}
}
// [x] 2. promote trguser // [x] 2. promote trguser
// [x] Get a required lock first // [x] Get a required lock first
@ -328,23 +275,14 @@ async fn cmd_promote(params : ExecBodyParams) {
// [x] 3. Output resulting change // [x] 3. Output resulting change
let outmsg = match rslt { let outmsg = match rslt {
ChangeResult::Success(rsltstr) => { ChangeResult::Success(a) => {
format!("o7 Successfully promoted {} : {}", format!("o7 Successfully promoted : {a}")
targetusr.unwrap(),
rsltstr
)
} }
ChangeResult::Failed(rsltstr) => { ChangeResult::Failed(a) => {
format!("PoroSad failed to promote {} : {}", format!("PoroSad failed to promote : {a}")
targetusr.unwrap(),
rsltstr
)
} }
ChangeResult::NoChange(rsltstr) => { ChangeResult::NoChange(a) => {
format!("uuh No Promotion Change {} : {}", format!("uuh No Promotion Change : {a}")
targetusr.unwrap(),
rsltstr
)
} }
}; };
@ -564,23 +502,14 @@ async fn cmd_demote(params : ExecBodyParams) {
*/ */
let outmsg = match rslt { let outmsg = match rslt {
ChangeResult::Success(rsltstr) => { ChangeResult::Success(a) => {
format!("o7 Successfully demoted {} : {}", format!("o7 Successfully demoted : {a}")
targetusr.unwrap(),
rsltstr
)
} }
ChangeResult::Failed(rsltstr) => { ChangeResult::Failed(a) => {
format!("PoroSad failed to demote {} : {}", format!("PoroSad failed to demote : {a}")
targetusr.unwrap(),
rsltstr
)
} }
ChangeResult::NoChange(rsltstr) => { ChangeResult::NoChange(a) => {
format!("uuh No Demotion Change {} : {}", format!("uuh No Demotion Change : {a}")
targetusr.unwrap(),
rsltstr
)
} }
}; };
@ -616,8 +545,6 @@ async fn getroles(params : ExecBodyParams) {
*/ */
let sendername = params.msg.clone().sender.name;
let mut argv = params.msg.message_text.split(' '); let mut argv = params.msg.message_text.split(' ');
@ -625,17 +552,11 @@ async fn getroles(params : ExecBodyParams) {
let arg1 = argv.next(); let arg1 = argv.next();
let mut targetuser = match arg1 { let targetuser = match arg1 {
// None => return, // exit if no arguments None => return, // exit if no arguments
None => sendername.as_str(), // self-invoke in this case
Some(arg) => arg, Some(arg) => arg,
}; };
targetuser = match twitch_irc::validate::validate_login(targetuser.to_lowercase().as_str()) {
Ok(_) => targetuser,
Err(_) => sendername.as_str(), // self-invoke in this case
};
let arg2 = argv.next(); let arg2 = argv.next();
let targetchnl = arg2; let targetchnl = arg2;
@ -719,9 +640,7 @@ async fn getroles(params : ExecBodyParams) {
params.msg.channel_login.to_lowercase(), params.msg.channel_login.to_lowercase(),
))) || sproles.contains(&UserRole::BotAdmin) ))) || sproles.contains(&UserRole::BotAdmin)
{ {
// targetuser outmsg += format!("Target chatter's user roles are : {:?}", sproles).as_str();
// outmsg += format!("Target chatter's user roles are : {:?}", sproles).as_str();
outmsg += format!("{}'s user roles are : {:?}", targetuser, sproles).as_str();
} }
outmsg outmsg
} else if sproles.contains(&UserRole::Mod(Channel( } else if sproles.contains(&UserRole::Mod(Channel(
@ -730,10 +649,9 @@ async fn getroles(params : ExecBodyParams) {
params.msg.channel_login.to_lowercase(), params.msg.channel_login.to_lowercase(),
))) || sproles.contains(&UserRole::BotAdmin) ))) || sproles.contains(&UserRole::BotAdmin)
{ {
// format!("Target chatter's user roles are : {:?}", sproles) format!("Target chatter's user roles are : {:?}", sproles)
format!("{}'s user roles are : {:?}", targetuser, sproles)
} else { } else {
format!("{} has no special roles LULE ",targetuser) "Target chatter has no special roles LULE ".to_string()
}; };
botlog::debug( botlog::debug(
@ -1549,6 +1467,7 @@ impl IdentityManager {
return ChangeResult::NoChange("Already does not have VIP role".to_string()); return ChangeResult::NoChange("Already does not have VIP role".to_string());
} }
else { else {
// self.affirm_chatter_in_db(trgchatter.clone()).await;
self.remove_role(trgchatter.clone(), UserRole::VIP(channel.clone())).await; self.remove_role(trgchatter.clone(), UserRole::VIP(channel.clone())).await;

View file

@ -13,7 +13,6 @@ 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
@ -22,6 +21,5 @@ 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.clone()).await; experimental::init(mgr).await;
thisguy::init(&mgr).await;
} }

View file

@ -15,7 +15,6 @@ const OF_CMD_CHANNEL:Channel = Channel(String::new());
use rand::Rng; use rand::Rng;
use twitch_irc::message::ReplyToMessage;
use std::sync::Arc; use std::sync::Arc;
use crate::core::bot_actions::ExecBodyParams; use crate::core::bot_actions::ExecBodyParams;
@ -96,65 +95,8 @@ pub async fn init(mgr: Arc<ModulesManager>) {
// 2. Add the BotAction to ModulesManager // 2. Add the BotAction to ModulesManager
botc1.add_to_modmgr(Arc::clone(&mgr)).await; botc1.add_to_modmgr(Arc::clone(&mgr)).await;
let bc1 = BotCommand {
module: BotModule(String::from("experiments001")),
command: String::from("rp1"), // command call name
alias: vec![
String::from("rp2"),
String::from("rp3")], // String of alternative names
exec_body: actions_util::asyncbox(rp),
help: String::from("Test Command tester"),
required_roles: vec![
BotAdmin,
Mod(OF_CMD_CHANNEL),
],
};
bc1.add_core_to_modmgr(Arc::clone(&mgr)).await;
} }
async fn rp(params : ExecBodyParams)
{
//triggers if the message is a reply
if params.get_parent_reply().is_some(){
//getting the channel id where the message was sent
let channel_id = params.get_parent_reply().unwrap().channel_login;
//getting the first message id that was sent
let message_id = params.get_parent_reply().unwrap().message_id;
//just for testing purposes
//print!("{} , {}",channel_id, message_id);
//creating a tuple with the channel id and message id
let answear =
(
channel_id.clone(),
message_id.clone()
);
let bot = Arc::clone(&params.bot);
let botlock = bot.read().await;
// uses chat.say_in_reply_to() for the bot controls for messages
botlock
.botmgrs
.chat
.say_in_reply_to(
//using the tuple as param to the message being replied
Channel(answear.0),
answear.1,
String::from("hey there"),
params.clone()
).await;
}
else
{
println!("no reply")
}
}
async fn good_girl(params : ExecBodyParams) { async fn good_girl(params : ExecBodyParams) {
// [ ] Uses gen_ratio() to output bool based on a ratio probability . // [ ] Uses gen_ratio() to output bool based on a ratio probability .
@ -163,7 +105,6 @@ 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",
@ -181,6 +122,8 @@ async fn good_girl(params : ExecBodyParams) {
); );
let bot = Arc::clone(&params.bot); let bot = Arc::clone(&params.bot);
let botlock = bot.read().await; let botlock = bot.read().await;
// uses chat.say_in_reply_to() for the bot controls for messages // uses chat.say_in_reply_to() for the bot controls for messages
@ -188,11 +131,12 @@ async fn good_girl(params : ExecBodyParams) {
.botmgrs .botmgrs
.chat .chat
.say_in_reply_to( .say_in_reply_to(
Channel(params.clone().msg.channel_login().to_string()), &params.msg,
params.clone().msg.message_id().to_string(),
String::from("GoodGirl xdd "), String::from("GoodGirl xdd "),
params.clone() params.clone()
).await; ).await;
} }
} }
} }
@ -226,8 +170,8 @@ async fn babygirl(params : ExecBodyParams) {
botlock botlock
.botmgrs .botmgrs
.chat .chat
.say_in_reply( .say_in_reply_to(
Channel(params.clone().msg.channel_login().to_string()), &params.msg,
String::from("16:13 notohh: cafdk"), String::from("16:13 notohh: cafdk"),
params.clone() params.clone()
).await; ).await;
@ -238,8 +182,8 @@ async fn babygirl(params : ExecBodyParams) {
botlock botlock
.botmgrs .botmgrs
.chat .chat
.say_in_reply( .say_in_reply_to(
Channel(params.clone().msg.channel_login().to_string()), &params.msg,
String::from("16:13 notohh: have fun eating princess"), String::from("16:13 notohh: have fun eating princess"),
params.clone() params.clone()
).await; ).await;
@ -250,8 +194,8 @@ async fn babygirl(params : ExecBodyParams) {
botlock botlock
.botmgrs .botmgrs
.chat .chat
.say_in_reply( .say_in_reply_to(
Channel(params.clone().msg.channel_login().to_string()), &params.msg,
String::from("16:13 notohh: baby girl"), String::from("16:13 notohh: baby girl"),
params.clone() params.clone()
).await; ).await;

View file

@ -17,7 +17,6 @@ const OF_CMD_CHANNEL:Channel = Channel(String::new());
use std::sync::Arc; use std::sync::Arc;
use chrono::{TimeZone,Local}; use chrono::{TimeZone,Local};
use twitch_irc::message::ReplyToMessage;
use crate::core::bot_actions::ExecBodyParams; use crate::core::bot_actions::ExecBodyParams;
@ -181,8 +180,7 @@ async fn sayout(params : ExecBodyParams) {
.botmgrs .botmgrs
.chat .chat
.say_in_reply_to( .say_in_reply_to(
Channel(params.clone().msg.channel_login().to_string()), &params.msg,
params.clone().msg.message_id().to_string(),
String::from("Invalid arguments"), String::from("Invalid arguments"),
params.clone() params.clone()
).await; ).await;

View file

@ -1,62 +0,0 @@
use crate::core::bot_actions::*;
use crate::core::botinstance::Channel;
use crate::core::botlog;
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
use crate::core::identity::UserRole::*;
use rand::Rng;
use twitch_irc::message::ReplyToMessage;
use std::sync::Arc;
use tokio::time::{sleep, Duration};
const OF_CMD_CHANNEL:Channel = Channel(String::new());
async fn tsg(params: ExecBodyParams) {
let phrases: [String; 6] = [
"Clueless ".to_string(),
"ICANT This guy....".to_string(),
"He is right tho".to_string(),
"KEKW true!".to_string(),
"OMEGALUL wth man...".to_string(),
"PepeLaugh El no sabe".to_string(),
];
let r = rand::thread_rng().gen_range(0..=4);
let a = phrases[r].clone();
botlog::debug(
"This guy works!",
Some("modules > thisguy()".to_string()),
Some(&params.msg),
);
let bot = Arc::clone(&params.bot);
let botlock = bot.read().await;
// uses chat.say_in_reply_to() for the bot controls for messages
botlock
.botmgrs
.chat
.say_in_reply(
Channel(params.clone().msg.channel_login().to_string()),
a,
params.clone()
)
.await;
sleep(Duration::from_secs_f64(0.5)).await;
}
pub async fn init(mgr: &Arc<ModulesManager>) {
BotCommand {
module: BotModule(String::from("thisguy")),
command: String::from("thisguy"),
alias: vec![String::from("Thisguy")],
exec_body: actions_util::asyncbox(tsg),
help: String::from("test"),
required_roles: vec![
BotAdmin,
Mod(OF_CMD_CHANNEL),
Broadcaster
],
}
.add_to_modmgr(Arc::clone(mgr))
.await;
}

View file

@ -1,3 +0,0 @@
disabled = []
nix_version = '2.4'
ignore = ['.direnv']