Skip to content

Commit 0cba7f9

Browse files
committed
Reorganise premium commands
1 parent 23f9b33 commit 0cba7f9

4 files changed

Lines changed: 21 additions & 17 deletions

File tree

tts_commands/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub async fn premium_command_check(ctx: Context<'_>) -> Result<bool> {
5555
Cow::Borrowed("Hey, this is a premium command so it must be run in a server!")
5656
}
5757
Some(FailurePoint::PremiumUser) => Cow::Borrowed(
58-
"Hey, this server isn't premium, please purchase TTS Bot Premium! (`/premium`)",
58+
"Hey, this server isn't premium, please purchase TTS Bot Premium! (`/premium info`)",
5959
),
6060
Some(FailurePoint::NotSubscribed(premium_user_id)) => {
6161
let premium_user = premium_user_id.to_user(serenity_ctx).await?;

tts_commands/src/premium.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ pub async fn premium(ctx: Context<'_>) -> CommandResult {
8888
guild_only,
8989
prefix_command,
9090
slash_command,
91-
aliases("activate"),
9291
required_bot_permissions = "SEND_MESSAGES | EMBED_LINKS"
9392
)]
94-
pub async fn premium_activate(ctx: Context<'_>) -> CommandResult {
93+
pub async fn activate(ctx: Context<'_>) -> CommandResult {
9594
let guild_id = ctx.guild_id().unwrap();
9695
let data = ctx.data();
9796

@@ -168,7 +167,7 @@ pub async fn premium_activate(ctx: Context<'_>) -> CommandResult {
168167
slash_command,
169168
required_bot_permissions = "SEND_MESSAGES | EMBED_LINKS"
170169
)]
171-
pub async fn list_premium(ctx: Context<'_>) -> CommandResult {
170+
pub async fn list(ctx: Context<'_>) -> CommandResult {
172171
let data = ctx.data();
173172
let Some(premium_info) = data.fetch_premium_info(ctx.http(), ctx.author().id).await? else {
174173
ctx.say("I cannot confirm you are subscribed to premium, so you don't have any premium servers!").await?;
@@ -191,7 +190,7 @@ pub async fn list_premium(ctx: Context<'_>) -> CommandResult {
191190
let author = ctx.author();
192191
let remaining_guilds = premium_info.entitled_servers.get() - premium_guilds;
193192
if embed_desc.is_empty() {
194-
embed_desc = Cow::Borrowed("None... set some servers with `/premium_activate`!");
193+
embed_desc = Cow::Borrowed("None... set some servers with `/premium activate`!");
195194
}
196195

197196
let footer = aformat!("You have {remaining_guilds} server(s) remaining for premium activation");
@@ -212,10 +211,9 @@ pub async fn list_premium(ctx: Context<'_>) -> CommandResult {
212211
prefix_command,
213212
slash_command,
214213
guild_only,
215-
aliases("premium_remove", "premium_delete"),
216214
required_bot_permissions = "SEND_MESSAGES | EMBED_LINKS"
217215
)]
218-
pub async fn premium_deactivate(ctx: Context<'_>) -> CommandResult {
216+
pub async fn deactivate(ctx: Context<'_>) -> CommandResult {
219217
let data = ctx.data();
220218
let author = ctx.author();
221219
let guild_id = ctx.guild_id().unwrap();
@@ -240,11 +238,17 @@ pub async fn premium_deactivate(ctx: Context<'_>) -> CommandResult {
240238
Ok(())
241239
}
242240

243-
pub fn commands() -> [Command; 4] {
244-
[
245-
premium(),
246-
premium_activate(),
247-
list_premium(),
248-
premium_deactivate(),
249-
]
241+
pub fn commands() -> [Command; 1] {
242+
[Command {
243+
subcommands: vec![
244+
Command {
245+
name: "info".into(),
246+
..premium()
247+
},
248+
list(),
249+
activate(),
250+
deactivate(),
251+
],
252+
..premium()
253+
}]
250254
}

tts_commands/src/settings/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,10 @@ async fn can_change_mode(
306306
.colour(PREMIUM_NEUTRAL_COLOUR)
307307
.thumbnail(data.premium_avatar_url.as_str())
308308
.footer(CreateEmbedFooter::new(
309-
"If this server has purchased premium, please run the `/premium_activate` command to link yourself to this server!"
309+
"If this server has purchased premium, please run the `/premium activate` command to link yourself to this server!"
310310
))
311311
.description(aformat!("
312-
The `{mode}` TTS Mode is only for TTS Bot Premium subscribers, please check out the `/premium` command!
312+
The `{mode}` TTS Mode is only for TTS Bot Premium subscribers, please check out the `/premium info` command!
313313
").as_str())
314314
)).await?;
315315

tts_core/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub fn random_footer(server_invite: &str, client_id: serenity::UserId) -> Cow<'s
156156
"You can vote for me or review me on top.gg!\nhttps://top.gg/bot/{client_id}"
157157
)),
158158
2 => Cow::Borrowed(
159-
"If you want to support the development and hosting of TTS Bot, check out `/premium`!",
159+
"If you want to support the development and hosting of TTS Bot, check out `/premium info`!",
160160
),
161161
3 => Cow::Borrowed("There are loads of customizable settings, check out `/help set`"),
162162
_ => unreachable!(),

0 commit comments

Comments
 (0)