From 7bbe75a522d5b3ad6bb125c26a8964683782a702 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Tue, 8 Mar 2022 20:26:10 +0800 Subject: [PATCH] feature fix #28 --- gradle.properties | 2 +- .../cono/morny/GradleProjectConfigures.java | 4 +- .../cono/morny/bot/command/MornyCommands.java | 3 +- .../cono/morny/bot/command/私わね.java | 38 +++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 src/main/java/cc/sukazyo/cono/morny/bot/command/私わね.java diff --git a/gradle.properties b/gradle.properties index 0aad69a..a1972de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.5.1.1 +VERSION = 0.5.2.0 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index fd967ea..6718b5e 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.5.1.1"; - public static final long COMPILE_TIMESTAMP = 1644381533694L; + public static final String VERSION = "0.5.2.0"; + public static final long COMPILE_TIMESTAMP = 1646742061976L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java index fa4c7f8..9b53ac1 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/MornyCommands.java @@ -76,7 +76,8 @@ public class MornyCommands { new 喵呜.抱抱(), new 喵呜.揉揉(), new 喵呜.蹭蹭(), - new 喵呜.贴贴() + new 喵呜.贴贴(), + new 私わね() ); } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/私わね.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/私わね.java new file mode 100644 index 0000000..e06f66a --- /dev/null +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/私わね.java @@ -0,0 +1,38 @@ +package cc.sukazyo.cono.morny.bot.command; + +import cc.sukazyo.cono.morny.MornyCoeur; +import cc.sukazyo.untitled.util.telegram.object.InputCommand; +import com.pengrad.telegrambot.model.Update; +import com.pengrad.telegrambot.request.SendMessage; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.concurrent.ThreadLocalRandom; + +@SuppressWarnings("NonAsciiCharacters") +public class 私わね implements ISimpleCommand { + + @Nonnull + @Override public String getName () { return "/me"; } + + @Nullable + @Override public String[] getAliases () { return null; } + + @Override + public void execute (@Nonnull InputCommand command, @Nonnull Update event) { + if (ThreadLocalRandom.current().nextInt(521) == 0) { + // 可以接入未来的心情系统(如果有的话) + final String text = switch (ThreadLocalRandom.current().nextInt(11)) { + case 0,7,8,9,10 -> "才不是"; + case 1,2,3,6 -> "才不是!"; + case 4,5 -> "才不是.."; + default -> throw new IllegalStateException("Unexpected random value in 私わね command."); + }; + MornyCoeur.extra().exec(new SendMessage( + event.message().chat().id(), + text + ).replyToMessageId(event.message().messageId())); + } + } + +}