-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from hahayupgit/main
Adds new "Does My Game Work" command and functionality in ~gs command to return URL of inputted argument
- Loading branch information
Showing
6 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
# uisuki | ||
Whisky's Discord Log Bot | ||
|
||
## Instructions for running locally | ||
You'll need to have a Discord application created, and a bot under that application added to a server. You can create that [here](https://discord.com/developers/applications). Ensure the bot has the proper "Privileged Gateway Intents" enabled. | ||
|
||
After you have completed the above steps, do the following: | ||
``` | ||
// Clone into the uisuki repository | ||
git clone https://github.com/Whisky-App/uisuki.git | ||
// cd to the uisuki directory | ||
cd uisuki | ||
/* | ||
Inside the uisuki directory, create a Secrets.toml file, and add the following line, | ||
replacing <token> with the private token of the bot: | ||
DISCORD_TOKEN="<token>" | ||
*/ | ||
// Start the bot | ||
cargo shuttle run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
created by hahayupgit 2024/4/16 | ||
desc: command for if someone asks "does x game work?" | ||
*/ | ||
use serenity::all::EditMessage; | ||
use serenity::futures::StreamExt; | ||
use serenity::framework::standard::macros::command; | ||
use serenity::framework::standard::CommandResult; | ||
use serenity::model::prelude::*; | ||
use serenity::prelude::*; | ||
use std::time::Duration; | ||
|
||
#[command] | ||
#[aliases("dmgw")] | ||
async fn does_my_game_work(ctx: &Context, msg: &Message) -> CommandResult { | ||
|
||
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. | ||
Can't find your game from those sources? Check here: | ||
https://www.protondb.com/ | ||
https://appdb.winehq.org/ | ||
https://www.codeweavers.com/compatibility | ||
https://www.applegamingwiki.com/wiki/Home | ||
https://www.pcgamingwiki.com/wiki/Home | ||
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."); | ||
|
||
let mut reply_msg = msg.reply(&ctx, reply).await?; | ||
|
||
// below code pulled directly from serenity-rs documentation | ||
// can be found here: https://docs.rs/serenity/latest/serenity/builder/struct.EditMessage.html#method.suppress_embeds | ||
|
||
// When the embed appears, a MessageUpdate event is sent and we suppress | ||
// the embed. No MessageUpdate event is sent if the message contains no | ||
// embeddable link or if the link has been posted before and is still | ||
// cached in Discord's servers (in which case the embed appears | ||
// immediately), no MessageUpdate event is sent. To not wait forever in | ||
// those cases, a timeout of 2000ms was added. | ||
let msg_id = reply_msg.id; | ||
let mut message_updates = serenity::collector::collect(&ctx.shard, move |ev| match ev { | ||
Event::MessageUpdate(x) if x.id == msg_id => Some(()), | ||
_ => None, | ||
}); | ||
let _ = tokio::time::timeout(Duration::from_millis(2000), message_updates.next()).await; | ||
reply_msg.edit(&ctx, EditMessage::new().suppress_embeds(true)).await?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod ping; | ||
pub mod say; | ||
pub mod does_my_game_work; | ||
pub mod game_support; | ||
pub mod github; | ||
pub mod website; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters