Skip to content

Commit

Permalink
Reply to og message if available
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Apr 23, 2024
1 parent 08830cf commit 00240f3
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 14 deletions.
17 changes: 16 additions & 1 deletion src/commands/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ use crate::{Context, Error};

#[poise::command(prefix_command, slash_command)]
pub async fn discord(ctx: Context<'_>) -> Result<(), Error> {
ctx.reply("https://discord.gg/CsqAfs9CnM").await?;
let message = "https://discord.gg/CsqAfs9CnM";

if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
parent.reply(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
ctx.reply(message).await?;
}
}
} else {
ctx.reply(message).await?;
}

Ok(())
}
19 changes: 16 additions & 3 deletions src/commands/does_my_game_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{Context, Error};

#[poise::command(prefix_command, slash_command, aliases("dmgw"))]
pub async fn does_my_game_work(ctx: Context<'_>) -> Result<(), Error> {
let reply = String::from("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.
let 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.
Can't find your game from those sources? Check here:
<https://www.protondb.com/>
Expand All @@ -13,8 +13,21 @@ 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.");
As a reminder: Most games with EasyAntiCheat and most other anti-cheats will **NOT** work without workarounds.";

if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
parent.reply(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
ctx.reply(message).await?;
}
}
} else {
ctx.reply(message).await?;
}

ctx.reply(reply).await?;
Ok(())
}
22 changes: 16 additions & 6 deletions src/commands/game_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::{Context, Error};
pub async fn game_support(ctx: Context<'_>,
#[description = "Game Name"] game_name: Option<String>) -> Result<(), Error> {
// String containing default response
let mut site = String::from("https://docs.getwhisky.app/game-support/");
let mut message = "https://docs.getwhisky.app/game-support/";

match game_name {
Some(name) => {
site.push_str(&name);
message.push_str(&name);

// TODO: Shuttle blocks us from making requests
// let resp = reqwest::get(site.clone()).await?;
Expand All @@ -22,12 +22,22 @@ pub async fn game_support(ctx: Context<'_>,
// } else {
// ctx.reply("Hmm, seems that game isn't in our docs.").await?;
// }

ctx.reply(site).await?;
},
None => {
ctx.reply(site).await?;
None => {}
}

if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
parent.reply(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
ctx.reply(message).await?;
}
}
} else {
ctx.reply(message).await?;
}

Ok(())
Expand Down
17 changes: 16 additions & 1 deletion src/commands/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ use crate::{Context, Error};

#[poise::command(prefix_command, slash_command)]
pub async fn github(ctx: Context<'_>) -> Result<(), Error> {
ctx.reply("https://github.com/Whisky-App/Whisky").await?;
let message = "https://github.com/Whisky-App/Whisky";

if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
parent.reply(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
ctx.reply(message).await?;
}
}
} else {
ctx.reply(message).await?;
}

Ok(())
}
12 changes: 10 additions & 2 deletions src/commands/say.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
use crate::{Context, Error};

#[poise::command(prefix_command, slash_command, owners_only, guild_only)]
#[poise::command(prefix_command, owners_only, guild_only)]
pub async fn say(ctx: Context<'_>,
#[description = "Message"] message: String) -> Result<(), Error> {
ctx.say(message).await?;

if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
parent.reply(&ctx, message).await?;
},
None => {
ctx.say(message).await?;
}
}

prefix.msg.delete(ctx).await?;
}

Expand Down
17 changes: 16 additions & 1 deletion src/commands/website.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ use crate::{Context, Error};

#[poise::command(prefix_command, slash_command)]
pub async fn website(ctx: Context<'_>) -> Result<(), Error> {
ctx.reply("https://getwhisky.app/").await?;
let message ="https://getwhisky.app/";

if let Context::Prefix(prefix) = ctx {
match prefix.msg.clone().referenced_message {
Some(parent) => {
parent.reply(&ctx, message).await?;
prefix.msg.delete(ctx).await?;
},
None => {
ctx.reply(message).await?;
}
}
} else {
ctx.reply(message).await?;
}

Ok(())
}

0 comments on commit 00240f3

Please sign in to comment.