Search in sources :

Example 1 with RequiredRole

use of gg.projecteden.discord.appcommands.annotations.RequiredRole in project Nexus by ProjectEdenGG.

the class DiscordAppCommand method forcelink.

@Verify
@RequiredRole("Staff")
@Command("Force link a Minecraft and Discord account")
void forcelink(@Desc("Minecraft account") DiscordUser player, @Desc("Discord account") Member discordUser) {
    player.setUserId(discordUser.getId());
    new DiscordUserService().save(player);
    Discord.addRole(discordUser.getId(), DiscordId.Role.VERIFIED);
    Discord.staffLog("**%s** Discord account force linked to **%s** by %s via Discord".formatted(player.getNickname(), player.getNameAndDiscrim(), user().getNickname()));
}
Also used : DiscordUserService(gg.projecteden.nexus.models.discord.DiscordUserService) RequiredRole(gg.projecteden.discord.appcommands.annotations.RequiredRole) Command(gg.projecteden.discord.appcommands.annotations.Command) NexusAppCommand(gg.projecteden.nexus.features.discord.appcommands.NexusAppCommand) Verify(gg.projecteden.nexus.features.discord.appcommands.annotations.Verify)

Example 2 with RequiredRole

use of gg.projecteden.discord.appcommands.annotations.RequiredRole in project Nexus by ProjectEdenGG.

the class DiscordAppCommand method lockdown.

@RequiredRole("Staff")
@Command("Toggle lockdown")
void lockdown(@Desc("Lockdown state") @Optional Boolean state) {
    SettingService settingService = new SettingService();
    Setting setting = settingService.get("discord", "lockdown");
    setting.setBoolean(state == null ? !setting.getBoolean() : state);
    settingService.save(setting);
    reply("Discord lockdown " + (setting.getBoolean() ? "enabled by " + nickname() + ", new members will be automatically kicked" : "disabled by " + nickname()));
}
Also used : SettingService(gg.projecteden.nexus.models.setting.SettingService) Setting(gg.projecteden.nexus.models.setting.Setting) RequiredRole(gg.projecteden.discord.appcommands.annotations.RequiredRole) Command(gg.projecteden.discord.appcommands.annotations.Command) NexusAppCommand(gg.projecteden.nexus.features.discord.appcommands.NexusAppCommand)

Aggregations

Command (gg.projecteden.discord.appcommands.annotations.Command)2 RequiredRole (gg.projecteden.discord.appcommands.annotations.RequiredRole)2 NexusAppCommand (gg.projecteden.nexus.features.discord.appcommands.NexusAppCommand)2 Verify (gg.projecteden.nexus.features.discord.appcommands.annotations.Verify)1 DiscordUserService (gg.projecteden.nexus.models.discord.DiscordUserService)1 Setting (gg.projecteden.nexus.models.setting.Setting)1 SettingService (gg.projecteden.nexus.models.setting.SettingService)1