summary refs log tree commit diff
diff options
context:
space:
mode:
authorAshelyn Rose <git@ashen.earth>2025-03-01 18:38:46 -0700
committerAshelyn Rose <git@ashen.earth>2025-03-01 18:38:46 -0700
commitdc69de9e3535e3ca49f6b74c54d2c32d218c2d81 (patch)
treedf97a4452ac0e68c4b73e774d5bab7e4158eef0c
parentdf8e78aded7ce2c8653e81edeaaa026e7c44c713 (diff)
Clean up warnings
-rw-r--r--src/main.rs6
-rw-r--r--src/system/mod.rs5
-rw-r--r--src/system/plugin.rs10
-rw-r--r--src/system/plugin/autoproxy.rs10
-rw-r--r--src/system/plugin/edit.rs9
-rw-r--r--src/system/types.rs1
6 files changed, 19 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs
index 98d4754..b65bb7b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,9 +2,9 @@
 
 mod config;
 mod system;
-use crossterm::{cursor::{self, MoveTo}, terminal::{Clear, ClearType, DisableLineWrap, EnableLineWrap, EnterAlternateScreen, LeaveAlternateScreen}};
+use crossterm::{cursor::MoveTo, terminal::{Clear, ClearType, DisableLineWrap, EnableLineWrap, EnterAlternateScreen, LeaveAlternateScreen}};
 use system::{Manager, SystemThreadCommand};
-use std::{collections::{HashMap, VecDeque}, fs, io::{self, Write}, sync::mpsc, thread::{self, sleep, JoinHandle}, time::Duration};
+use std::{collections::{HashMap, VecDeque}, fs, io, sync::mpsc, thread::{self, sleep, JoinHandle}, time::Duration};
 use tokio::runtime;
 
 pub struct UiState {
@@ -207,7 +207,7 @@ fn spawn_system(system_name : &String, system_config: config::System, waker: mps
         }).unwrap()
 }
 
-fn update_ui(ui_state: &UiState, config: &config::Config) {
+fn update_ui(ui_state: &UiState, _config: &config::Config) {
     crossterm::execute!(io::stdout(), Clear(ClearType::FromCursorUp)).unwrap();
     crossterm::execute!(io::stdout(), MoveTo(0, 0)).unwrap();
 
diff --git a/src/system/mod.rs b/src/system/mod.rs
index cb3f040..c33c481 100644
--- a/src/system/mod.rs
+++ b/src/system/mod.rs
@@ -26,7 +26,6 @@ impl Manager {
             followed_user: NonZeroU64::try_from(system_config.reference_user_id.parse::<u64>().unwrap()).unwrap().into(),
             command_prefix: "!".to_string(),
             members: system_config.members.iter().map(|member| Member {
-                name: member.name.clone(),
                 discord_token: member.discord_token.clone(),
                 user_id: Arc::new(Mutex::new(None)),
                 message_pattern: member.message_pattern.clone(),
@@ -72,8 +71,8 @@ impl Manager {
                                 .unwrap_or_else(|| by_command.get(first_word.get(0..1).unwrap())) {
                                     logger.log_line(None, format!("Handling command: {command:?}")).await;
                                     let args : Vec<_> = match command {
-                                        plugin::PluginCommand::Long(_) => words.collect(),
-                                        plugin::PluginCommand::Short(_) => once(first_word).chain(words).collect(),
+                                        plugin::PluginCommand::Word(_) => words.collect(),
+                                        plugin::PluginCommand::Char(_) => once(first_word).chain(words).collect(),
                                     };
 
                                     plugin.handle_command(&logger, &system, &message, *command, args).await;
diff --git a/src/system/plugin.rs b/src/system/plugin.rs
index 379606d..8e6066f 100644
--- a/src/system/plugin.rs
+++ b/src/system/plugin.rs
@@ -9,7 +9,7 @@ use std::{collections::HashMap, sync::Arc};
 use async_trait::async_trait;
 
 use edit::Edit;
-use twilight_model::{channel::{Channel, Message}, id::{marker::ChannelMarker, Id}};
+use twilight_model::{channel::Message, id::{marker::ChannelMarker, Id}};
 
 use super::log::Logger;
 use crate::system::types::{System, Response};
@@ -19,8 +19,8 @@ pub use autoproxy::Autoproxy;
 
 #[derive(Copy, Clone, Debug)]
 pub enum PluginCommand {
-    Long(&'static str),
-    Short(&'static str),
+    Word(&'static str),
+    Char(&'static str),
 }
 
 #[async_trait]
@@ -46,8 +46,8 @@ pub fn get_plugins<'system>() -> (Vec<Arc<Box<dyn SeancePlugin<'system>>>>, Hash
             let commands = plugin.get_commands();
             commands.into_iter().map(|command| {
                 match command {
-                    PluginCommand::Long(command_word) => (command_word, (command, plugin.clone())),
-                    PluginCommand::Short(command_char) => (command_char, (command, plugin.clone())),
+                    PluginCommand::Word(command_word) => (command_word, (command, plugin.clone())),
+                    PluginCommand::Char(command_char) => (command_char, (command, plugin.clone())),
                 }
             })
         })
diff --git a/src/system/plugin/autoproxy.rs b/src/system/plugin/autoproxy.rs
index 24511c4..d9beaf0 100644
--- a/src/system/plugin/autoproxy.rs
+++ b/src/system/plugin/autoproxy.rs
@@ -1,7 +1,7 @@
 use async_trait::async_trait;
 use std::sync::Arc;
 use tokio::sync::Mutex;
-use twilight_model::{channel::{Channel, Message}, id::{marker::ChannelMarker, Id}, util::Timestamp};
+use twilight_model::{channel::Message, id::{marker::ChannelMarker, Id}, util::Timestamp};
 use crate::system::{plugin::PluginCommand, types::{Member, Response, System}};
 use super::SeancePlugin;
 use tokio::time::sleep;
@@ -31,10 +31,10 @@ impl Autoproxy {
 #[async_trait]
 impl<'system> SeancePlugin<'system> for Autoproxy {
     fn get_commands(&self) -> Vec<PluginCommand> {
-        vec![PluginCommand::Long("auto")]
+        vec![PluginCommand::Word("auto")]
     }
 
-    async fn handle_command<'message>(&self, logger: &'system Logger, system: &'system System, message: &'message Message, _command: PluginCommand, args: Vec<&'message str>) {
+    async fn handle_command<'message>(&self, logger: &'system Logger, system: &'system System, _message: &'message Message, _command: PluginCommand, args: Vec<&'message str>) {
         let mut args = args.iter().map(|r| *r);
         let first_word = args.next();
 
@@ -59,7 +59,7 @@ impl<'system> SeancePlugin<'system> for Autoproxy {
         };
     }
 
-    async fn handle_message<'message>(&self, logger: &'system Logger, system: &'system System, message: &'message Message, response: &'message mut Response) {
+    async fn handle_message<'message>(&self, logger: &'system Logger, _system: &'system System, message: &'message Message, response: &'message mut Response) {
         let starting_state = {self.current_state.lock().await.clone()};
         if message.content.starts_with("\\") {
             logger.log_line(None, "Skipping proxy".to_string()).await;
@@ -104,7 +104,7 @@ impl<'system> SeancePlugin<'system> for Autoproxy {
         }
     }
 
-    async fn post_response<'message>(&self, logger: &'system Logger, system: &'system System, message: &'message Message, channel: Id<ChannelMarker>, response: &'message Response) {
+    async fn post_response<'message>(&self, logger: &'system Logger, _system: &'system System, message: &'message Message, _channel: Id<ChannelMarker>, response: &'message Response) {
         match response {
             Response::Proxy { member, content: _ } => {
                 let current_state = {self.current_state.lock().await.clone()};
diff --git a/src/system/plugin/edit.rs b/src/system/plugin/edit.rs
index bbd5801..2edc504 100644
--- a/src/system/plugin/edit.rs
+++ b/src/system/plugin/edit.rs
@@ -1,6 +1,5 @@
 use async_trait::async_trait;
 use regex::RegexBuilder;
-use twilight_model::channel::message::MessageReference;
 use twilight_model::id::{marker::ChannelMarker, Id};
 use twilight_model::channel::Message;
 use crate::system::{log::Logger, types::{Response, System}};
@@ -19,8 +18,8 @@ impl Edit {
 impl<'system> SeancePlugin<'system> for Edit {
     fn get_commands(&self) -> Vec<PluginCommand> {
         vec![
-            PluginCommand::Long("edit"),
-            PluginCommand::Short("s"),
+            PluginCommand::Word("edit"),
+            PluginCommand::Char("s"),
         ]
     }
 
@@ -37,8 +36,8 @@ impl<'system> SeancePlugin<'system> for Edit {
         } {
             if let Some(authoring_member) = system.get_member_by_id(edit_target.author.id).await {
                 if let Some(edit_contents) = match command {
-                    PluginCommand::Long("edit") => Some(args.join(" ")),
-                    PluginCommand::Short("s") => async {
+                    PluginCommand::Word("edit") => Some(args.join(" ")),
+                    PluginCommand::Char("s") => async {
                         let replacement_command = args.join(" ");
                         let separator = replacement_command.chars().nth(1).unwrap();
                         let parts: Vec<&str> = replacement_command.split(separator).collect();
diff --git a/src/system/types.rs b/src/system/types.rs
index 5aaf59c..4143bfd 100644
--- a/src/system/types.rs
+++ b/src/system/types.rs
@@ -9,7 +9,6 @@ use tokio::sync::Mutex;
 
 #[derive(Clone)]
 pub struct Member {
-    pub name: String,
     pub discord_token: String,
     pub user_id: Arc<Mutex<Option<Id<UserMarker>>>>,
     pub message_pattern: Regex,