Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variouis Command Fixes #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/commands/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ use crate::{Context, Error};
#[poise::command(prefix_command, slash_command)]
pub async fn discord(ctx: Context<'_>) -> Result<(), Error> {
let mut message = "https://discord.gg/CsqAfs9CnM".to_owned();

let cmd_name = ctx.invoked_command_name();
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "discord");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "discord");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/does_my_game_work.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{Context, Error};

#[poise::command(prefix_command, slash_command, aliases("dmgw"))]
#[poise::command(prefix_command, slash_command, aliases("dmgw", "help"))]
pub async fn does_my_game_work(ctx: Context<'_>) -> Result<(), Error> {
let mut message = "Does your game work? Check https://docs.getwhisky.app/game-support/ first, and search to see if anyone else has this same issue in this Discord or the GitHub repository.

Expand All @@ -14,17 +14,17 @@ Can't find your game from those sources? Check here:
If you've checked all of these places and still can't find an answer, feel free to create a support post in #support !

As a reminder: Most games with EasyAntiCheat and most other anti-cheats will **NOT** work without workarounds.".to_owned();

let cmd_name = ctx.invoked_command_name();
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "does_my_game_work");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "does_my_game_work");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub async fn game_support(ctx: Context<'_>,
#[description = "Game Name"] game_name: Option<String>) -> Result<(), Error> {
// String containing default response
let mut message = String::from("https://docs.getwhisky.app/game-support/");

let cmd_name = ctx.invoked_command_name();
match game_name {
Some(name) => {
let esc_name = name
Expand Down Expand Up @@ -46,13 +46,13 @@ pub async fn game_support(ctx: Context<'_>,
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "game_support");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "game_support");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ use crate::{Context, Error};
#[poise::command(prefix_command, slash_command)]
pub async fn github(ctx: Context<'_>) -> Result<(), Error> {
let mut message = "https://github.com/Whisky-App/Whisky".to_owned();

let cmd_name = ctx.invoked_command_name();
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "github");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "github");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/heroic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ pub async fn heroic(ctx: Context<'_>) -> Result<(), Error> {
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "heroic");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
}
None => {
message += &format!("\n-# This command was invoked using `~{}`", "heroic");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pub mod website;
pub mod discord;
pub mod username;
pub mod heroic;
pub mod whats_where;
pub mod paths;
pub mod msync;
6 changes: 3 additions & 3 deletions src/commands/msync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ pub async fn msync(ctx: Context<'_>) -> Result<(), Error> {
1. Kill All Bottles: Press `Command`⌘ + `Shift`⇧ + `K` or Go to `File` (near the Apple logo) -> `Kill All Bottles`
2. Change MSync to ESync: `Bottle Configuration` -> `Enhanced Sync`
3. Run Steam".to_owned();

let cmd_name = ctx.invoked_command_name();
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "msync");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "msync");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/whats_where.rs → src/commands/paths.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Context, Error};

#[poise::command(prefix_command, slash_command, aliases("whiskywine", "bottles", "logs", "whiskycmd", "whatswhere", "where", "paths", "path"))]
pub async fn whats_where(ctx: Context<'_>) -> Result<(), Error> {
#[poise::command(prefix_command, slash_command, aliases("whiskywine", "bottles", "logs", "whiskycmd", "whats_where", "whatswhere", "where", "path"))]
pub async fn paths(ctx: Context<'_>) -> Result<(), Error> {

let whiskywine = "**WhiskyWine:** `~/Library/Application Support/com.isaacmarovitz.Whisky/Libraries`";
let bottles = "**Bottles:** `~/Library/Containers/com.isaacmarovitz.Whisky/Bottles`";
Expand Down Expand Up @@ -51,13 +51,13 @@ pub async fn whats_where(ctx: Context<'_>) -> Result<(), Error> {
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "whats_where");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "whats_where");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/commands/username.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ pub async fn username(ctx: Context<'_>) -> Result<(), Error> {

Follow this Apple support guide to change your username: https://support.apple.com/en-us/102547".to_owned();

let cmd_name = ctx.invoked_command_name();
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "username");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "username");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/website.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ use crate::{Context, Error};
#[poise::command(prefix_command, slash_command)]
pub async fn website(ctx: Context<'_>) -> Result<(), Error> {
let mut message ="https://getwhisky.app/".to_owned();

let cmd_name = ctx.invoked_command_name();
if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), "website");
message += &format!("\n-# This command was invoked by {} using `~{}`", ctx.author().to_string().as_str(), cmd_name);

parent.reply_ping(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
message += &format!("\n-# This command was invoked using `~{}`", "website");
message += &format!("\n-# This command was invoked using `~{}`", cmd_name);
ctx.reply(message).await?;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::commands::does_my_game_work::*;
use crate::commands::say::*;
use crate::commands::username::*;
use crate::commands::heroic::*;
use crate::commands::whats_where::*;
use crate::commands::paths::*;
use crate::commands::msync::*;

pub mod header;
Expand Down Expand Up @@ -48,7 +48,7 @@ async fn serenity(
say(),
username(),
heroic(),
whats_where(),
paths(),
msync()
],
prefix_options: poise::PrefixFrameworkOptions {
Expand Down