Skip to content

Commit b6be575

Browse files
committed
refactor: make command modules public
1 parent 9dcf8e6 commit b6be575

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/commands/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use crate::Context;
22

3-
mod ping;
4-
mod pomelo;
5-
mod presence;
6-
mod say;
7-
mod self_timeout;
8-
mod shiggy;
9-
mod translate;
3+
pub mod ping;
4+
pub mod pomelo;
5+
pub mod presence;
6+
pub mod say;
7+
pub mod self_timeout;
8+
pub mod shiggy;
9+
pub mod translate;
1010

11-
pub fn vec() -> Vec<
11+
pub fn to_vec() -> Vec<
1212
::poise::Command<
1313
<Context<'static> as poise::_GetGenerics>::U,
1414
<Context<'static> as poise::_GetGenerics>::E,
@@ -24,5 +24,3 @@ pub fn vec() -> Vec<
2424
translate::translate(),
2525
]
2626
}
27-
28-
pub use presence::restore_presence;

src/commands/presence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub async fn presence(
105105
Ok(())
106106
}
107107

108-
pub async fn restore_presence(ctx: &serenity::Context, redis_client: &redis::Client) -> Result<()> {
108+
pub async fn restore(ctx: &serenity::Context, redis_client: &redis::Client) -> Result<()> {
109109
let mut conn = redis_client.get_async_connection().await?;
110110
let data: Option<String> = conn.get("presence-v1").await?;
111111

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async fn main() -> Result<()> {
2727
let mut client = Client::builder(std::env::var("DISCORD_TOKEN")?, GatewayIntents::all())
2828
.framework(Framework::new(
2929
FrameworkOptions {
30-
commands: commands::vec(),
30+
commands: commands::to_vec(),
3131
event_handler: |ev, _, _| {
3232
Box::pin(async move {
3333
match ev {
@@ -79,7 +79,7 @@ async fn main() -> Result<()> {
7979
if let Ok(redis_url) = std::env::var("REDIS_URL") {
8080
let client = redis::Client::open(redis_url)?;
8181

82-
if let Err(err) = commands::restore_presence(&ctx, &client).await {
82+
if let Err(err) = commands::presence::restore(&ctx, &client).await {
8383
eprintln!("{}", err);
8484
};
8585

0 commit comments

Comments
 (0)