Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #189 from book000/feat/akakese-cmd
Browse files Browse the repository at this point in the history
feat: akakeseコマンドの追加
  • Loading branch information
book000 committed Jan 28, 2022
2 parents ec568ed + 1964720 commit 419f96b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 3 deletions.
64 changes: 64 additions & 0 deletions src/main/java/com/jaoafa/javajaotan2/command/Cmd_Akakese.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* jaoLicense
*
* Copyright (c) 2022 jao Minecraft Server
*
* The following license applies to this project: jaoLicense
*
* Japanese: https://github.com/jaoafa/jao-Minecraft-Server/blob/master/jaoLICENSE.md
* English: https://github.com/jaoafa/jao-Minecraft-Server/blob/master/jaoLICENSE-en.md
*/

package com.jaoafa.javajaotan2.command;

import cloud.commandframework.Command;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.jda.JDACommandSender;
import cloud.commandframework.jda.parsers.UserArgument;
import cloud.commandframework.meta.CommandMeta;
import com.jaoafa.javajaotan2.Main;
import com.jaoafa.javajaotan2.lib.CommandPremise;
import com.jaoafa.javajaotan2.lib.JavajaotanCommand;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.requests.restaction.MessageAction;
import org.jetbrains.annotations.NotNull;

import java.io.InputStream;
import java.util.Arrays;
import java.util.stream.Collectors;

public class Cmd_Akakese implements CommandPremise {
@Override
public JavajaotanCommand.Detail details() {
return new JavajaotanCommand.Detail(
"akakese",
"垢消せ。"
);
}

@Override
public JavajaotanCommand.Cmd register(Command.Builder<JDACommandSender> builder) {
return new JavajaotanCommand.Cmd(
builder
.meta(CommandMeta.DESCRIPTION, "垢消せ。")
.argument(UserArgument.<JDACommandSender>newBuilder("user")
.withParsers(Arrays.stream(UserArgument.ParserMode.values()).collect(Collectors.toSet()))
.withIsolationLevel(UserArgument.Isolation.GUILD)
.asOptionalWithDefault("222018383556771840")
.build())
.handler(context -> execute(context, this::akakese))
.build()
);
}

private void akakese(@NotNull Guild guild, @NotNull MessageChannel channel, @NotNull Member member, @NotNull Message message, @NotNull CommandContext<JDACommandSender> context) {
User user = context.get("user");

MessageAction action = channel.sendMessage(user.getAsMention() + ", なンだおまえ!!!!帰れこのやろう!!!!!!!!人間の分際で!!!!!!!!寄るな触るな近づくな!!!!!!!!垢消せ!!!!垢消せ!!!!!!!! ┗(‘o’≡’o’)┛!!!!!!!!!!!!!!!! https://twitter.com/settings/accounts/confirm_deactivation");
InputStream akakeseStream = Main.class.getResourceAsStream("/images/akakese1_slow.gif");
if (akakeseStream != null) {
action = action.addFile(akakeseStream, "akakese.gif");
}
action.queue();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jaoLicense
*
* Copyright (c) 2021 jao Minecraft Server
* Copyright (c) 2022 jao Minecraft Server
*
* The following license applies to this project: jaoLicense
*
Expand Down Expand Up @@ -100,9 +100,12 @@ public List<Roles> getAllowRoles() {
}
}

public record Cmd(@NonNull Command<JDACommandSender>... commands) {
public static class Cmd {
Command<JDACommandSender>[] commands;

@SafeVarargs
public Cmd {
public Cmd(@NonNull Command<JDACommandSender>... commands) {
this.commands = commands;
}

/**
Expand Down
Binary file added src/main/resources/images/akakese1_slow.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 419f96b

Please sign in to comment.