Compare commits
2 Commits
eaea7f6c3a
...
3b929bfc3c
Author | SHA1 | Date | |
---|---|---|---|
|
3b929bfc3c | ||
|
df3c5be437 |
@ -18,7 +18,7 @@ colored = "2"
|
|||||||
tokio-socks = "0.5.1"
|
tokio-socks = "0.5.1"
|
||||||
socks = "0.3.4"
|
socks = "0.3.4"
|
||||||
random_word = "0.3.0"
|
random_word = "0.3.0"
|
||||||
#leetspeak = "0.2.0"
|
leetspeak = "0.2.0"
|
||||||
irc = "0.15.0"
|
irc = "0.15.0"
|
||||||
futures = "0.3.27"
|
futures = "0.3.27"
|
||||||
futures-util = "0.3.27"
|
futures-util = "0.3.27"
|
@ -53,7 +53,7 @@ async fn ai(user_message: &str, username: &str, channel: &str, config: &Config)
|
|||||||
.messages([
|
.messages([
|
||||||
ChatCompletionRequestMessageArgs::default()
|
ChatCompletionRequestMessageArgs::default()
|
||||||
.role(Role::System)
|
.role(Role::System)
|
||||||
.content(format!("Respond {} as you are chatting as {}, The following is a chat message to you from {} dont mention that you are who you are they can see that:", config.accents, config.personalities, username))
|
.content(format!("Respond {} as you are chatting as {}, {} sent you a message, dont respond for them:", config.accents, config.personalities, username))
|
||||||
.build()
|
.build()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
ChatCompletionRequestMessageArgs::default()
|
ChatCompletionRequestMessageArgs::default()
|
||||||
@ -69,8 +69,11 @@ async fn ai(user_message: &str, username: &str, channel: &str, config: &Config)
|
|||||||
let response = client.chat().create(request).await.unwrap();
|
let response = client.chat().create(request).await.unwrap();
|
||||||
let response_text = response.choices.first().unwrap().message.content.trim().to_string();
|
let response_text = response.choices.first().unwrap().message.content.trim().to_string();
|
||||||
let regex = Regex::new(r#""|[gG][1iI][rR]\s"#).unwrap(); // THIS IS FUCKING UP EVERYTHING
|
let regex = Regex::new(r#""|[gG][1iI][rR]\s"#).unwrap(); // THIS IS FUCKING UP EVERYTHING
|
||||||
|
let regex2 = Regex::new(r#""|[gG][1iI][rR]:\s"#).unwrap(); // THIS IS FUCKING UP EVERYTHING
|
||||||
|
|
||||||
let response_text = regex.replace_all(&response_text, "").trim().to_string();
|
let response_text = regex.replace_all(&response_text, "").trim().to_string();
|
||||||
|
let response_text = regex2.replace_all(&response_text, "").trim().to_string();
|
||||||
|
|
||||||
println!("{}", response_text);
|
println!("{}", response_text);
|
||||||
let response_lines = response_text.split("\n").filter(|line| !line.trim().is_empty());
|
let response_lines = response_text.split("\n").filter(|line| !line.trim().is_empty());
|
||||||
let mut responses = Vec::new();
|
let mut responses = Vec::new();
|
||||||
|
@ -6,6 +6,8 @@ use openssl::ssl::{SslConnector, SslMethod};
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use toml::{Value, to_string};
|
use toml::{Value, to_string};
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
use leetspeak;
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
//use anyhow::Result;
|
//use anyhow::Result;
|
||||||
//use socks5_proxy::{client, Addr};
|
//use socks5_proxy::{client, Addr};
|
||||||
@ -20,10 +22,6 @@ struct Config {
|
|||||||
//invaders: Vec<String>,
|
//invaders: Vec<String>,
|
||||||
server: String,
|
server: String,
|
||||||
port: u16,
|
port: u16,
|
||||||
|
|
||||||
proxy_server: String,
|
|
||||||
proxy_port: u16,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct InvadeCommand;
|
pub struct InvadeCommand;
|
||||||
@ -33,6 +31,7 @@ impl Command for InvadeCommand {
|
|||||||
let mut response = vec![];
|
let mut response = vec![];
|
||||||
|
|
||||||
if message.contains("PRIVMSG") && message.contains(":%invade") {
|
if message.contains("PRIVMSG") && message.contains(":%invade") {
|
||||||
|
|
||||||
let parts: Vec<&str> = message.split_whitespace().collect();
|
let parts: Vec<&str> = message.split_whitespace().collect();
|
||||||
let num_invaders = parts[4].parse::<u32>().unwrap_or(1) as usize;
|
let num_invaders = parts[4].parse::<u32>().unwrap_or(1) as usize;
|
||||||
let channel = parts[2];
|
let channel = parts[2];
|
||||||
@ -50,6 +49,7 @@ impl Command for InvadeCommand {
|
|||||||
let config_clone = config.clone();
|
let config_clone = config.clone();
|
||||||
let screaming = scream.to_string();
|
let screaming = scream.to_string();
|
||||||
let command_channel = channel.to_string();
|
let command_channel = channel.to_string();
|
||||||
|
|
||||||
let thread_invader = random_word::gen(); // change to leetspeak on nick collision
|
let thread_invader = random_word::gen(); // change to leetspeak on nick collision
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
@ -88,6 +88,11 @@ impl Command for InvadeCommand {
|
|||||||
println!("{} {}","[%] PONG:".bold().green(), thread_invader.blue());
|
println!("{} {}","[%] PONG:".bold().green(), thread_invader.blue());
|
||||||
ssl_stream.write_all(response.as_bytes()).unwrap();
|
ssl_stream.write_all(response.as_bytes()).unwrap();
|
||||||
}
|
}
|
||||||
|
if message.starts_with("433") { // Numeric reply for nickname in use
|
||||||
|
let leet_nick = leetspeak::translate(&thread_invader);
|
||||||
|
let nick_command = format!("NICK {}\r\n", leet_nick);
|
||||||
|
ssl_stream.write_all(nick_command.as_bytes()).unwrap();
|
||||||
|
}
|
||||||
// turn to mods
|
// turn to mods
|
||||||
// setup so these will only run from the server admin to avoid handle/host conflicts
|
// setup so these will only run from the server admin to avoid handle/host conflicts
|
||||||
let commandi = format!("PRIVMSG {} :%%",command_channel); // & check for admin and verify with server
|
let commandi = format!("PRIVMSG {} :%%",command_channel); // & check for admin and verify with server
|
||||||
@ -106,10 +111,10 @@ impl Command for InvadeCommand {
|
|||||||
ssl_stream.write_all(response.as_bytes()).unwrap();
|
ssl_stream.write_all(response.as_bytes()).unwrap();
|
||||||
}
|
}
|
||||||
if message.contains("PRIVMSG") && message.contains(":%%scream") {
|
if message.contains("PRIVMSG") && message.contains(":%%scream") {
|
||||||
let parts: Vec<&str> = message.splitn(3, ":%%scream ").collect();
|
let re = Regex::new(r#"%%scream\s+([^"]+?)\s+"([^"]*?)"\s*"#).unwrap();
|
||||||
let invade_channel = parts[1];
|
if let Some(captures) = re.captures(message) {
|
||||||
if parts.len() == 2 {
|
let invade_channel = captures.get(1).map_or("", |m| m.as_str());
|
||||||
let scream = parts[1];
|
let scream = captures.get(2).map_or("", |m| m.as_str());
|
||||||
let response = format!("PRIVMSG {} :{}\r\n", invade_channel, scream);
|
let response = format!("PRIVMSG {} :{}\r\n", invade_channel, scream);
|
||||||
ssl_stream.write_all(response.as_bytes()).unwrap();
|
ssl_stream.write_all(response.as_bytes()).unwrap();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user