Skip to content

Commit

Permalink
Adjust bot module visibility and decrease interval duration
Browse files Browse the repository at this point in the history
The bot module within the 'discord' directory is now private, but its Handler is publicly accessible. This restructuring improves encapsulation and keeps implementation detail away from the public interface. Additionally, the bot's processing loop interval has been reduced from 1200 to 900 milliseconds, potentially increasing response time.
  • Loading branch information
kasugamirai committed Feb 22, 2024
1 parent de8e531 commit 7d26f63
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bin/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use tokio;

use dotenv;

use gpt_discord_bot::bot::Handler;
use gpt_discord_bot::Handler;

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/discord/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl EventHandler for Handler {
};

let mut result = String::new();
let mut interval = interval(Duration::from_millis(1200));
let mut interval = interval(Duration::from_millis(900));

loop {
select! {
Expand Down
3 changes: 2 additions & 1 deletion src/discord/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod bot;
mod bot;
pub use bot::Handler;
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mod discord;
pub use crate::discord::bot;
pub use crate::discord::Handler;

0 comments on commit 7d26f63

Please sign in to comment.