aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-08-31 20:24:26 -0400
committerCara Salter <cara@devcara.com>2022-08-31 20:24:26 -0400
commit05b291adf3c056614eec622174fe36a37367c576 (patch)
tree27588df9fa305cfef21de49a8192b942c2b03b96
parent0eb1cf37e249ca5d3efcd410b08c6b5c5223a664 (diff)
downloadglitch-ng-05b291adf3c056614eec622174fe36a37367c576.tar.gz
glitch-ng-05b291adf3c056614eec622174fe36a37367c576.zip
Add playing status w/ link to site and owner command to update
-rw-r--r--src/commands/meta.rs13
-rw-r--r--src/main.rs6
2 files changed, 17 insertions, 2 deletions
diff --git a/src/commands/meta.rs b/src/commands/meta.rs
index 681d5a5..c77f048 100644
--- a/src/commands/meta.rs
+++ b/src/commands/meta.rs
@@ -1,5 +1,5 @@
use crate::{Context, Error};
-use poise::serenity_prelude as serenity;
+use poise::serenity_prelude::{self as serenity, Activity};
/// Pings the bot
#[poise::command(prefix_command, slash_command)]
@@ -45,3 +45,14 @@ pub async fn userinfo(
) -> Result<(), Error> {
Ok(())
}
+
+#[poise::command(prefix_command, slash_command, owners_only, hide_in_help)]
+pub async fn set_status(
+ ctx: Context<'_>,
+ #[description = "Custom game to play"]
+ game: String,
+ ) -> Result<(), Error> {
+ ctx.discord().set_activity(Activity::playing(game)).await;
+
+ Ok(())
+}
diff --git a/src/main.rs b/src/main.rs
index 2a3a4fd..7956898 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -13,7 +13,7 @@ use dotenv::dotenv;
use sqlx::{postgres::PgPoolOptions, PgPool};
use tracing::{info, instrument};
-use poise::serenity_prelude as serenity;
+use poise::serenity_prelude::{self as serenity, Activity};
use ::serenity::model::gateway::GatewayIntents;
type Error = Box<dyn std::error::Error + Send + Sync>;
@@ -86,6 +86,7 @@ async fn main() {
commands::meta::ping(),
commands::meta::about(),
commands::meta::userinfo(),
+ commands::meta::set_status(),
commands::actions::boop(), commands::actions::hug(), commands::pony::randpony(), commands::pony::tpony(), commands::pony::ponybyid(),
commands::osu::osup(),
commands::osu::osubm(),
@@ -168,6 +169,9 @@ async fn main() {
sqlx::migrate!("./migrations")
.run(&pool)
.await.unwrap();
+
+ // Since this has context access, we can change the game activity here
+ _ctx.set_activity(Activity::playing(String::from("~help | https://glitchbot.net"))).await;
Ok(Data {
pg: Mutex::new(pool),
})