Skip to content

Commit 887e55e

Browse files
committed
Shortcut for pr-add/issue-add
1 parent 1e2437a commit 887e55e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ use crate::utils::write_json;
7070
#[derive(BotCommands, Clone, Debug)]
7171
#[command(rename_rule = "lowercase", description = "Supported commands:")]
7272
enum BCommand {
73-
#[command(description = "main and the only command.")]
73+
#[command(description = "main command.")]
7474
Notifier(String),
75+
#[command(description = "shortcut for/notifier pr-add/issue-add.")]
76+
Add(String),
7577
}
7678

7779
#[tokio::main]
@@ -186,8 +188,11 @@ async fn version_check() -> Result<(), Error> {
186188
async fn answer(bot: Bot, msg: Message, bc: BCommand) -> ResponseResult<()> {
187189
log::trace!("message: {msg:?}");
188190
log::trace!("bot command: {bc:?}");
189-
let BCommand::Notifier(input) = bc;
190-
let result = match command::parse(input) {
191+
let cmd_str = match bc {
192+
BCommand::Notifier(input) => input,
193+
BCommand::Add(input) => format!("pr-add {input}"),
194+
};
195+
let result = match command::parse(cmd_str) {
191196
Ok(command) => {
192197
log::debug!("command: {command:?}");
193198
let (bot, msg) = (bot.clone(), msg.clone());

0 commit comments

Comments
 (0)