From b6fca155e824a546e2a9efcaa51e58d831cf3068 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Tue, 11 Jun 2019 16:03:11 +0200 Subject: [PATCH] Add setverified command --- .../commands/management/SetVerifiedCommand.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/kotlin/nl/voidcorp/discord/commands/management/SetVerifiedCommand.kt diff --git a/src/main/kotlin/nl/voidcorp/discord/commands/management/SetVerifiedCommand.kt b/src/main/kotlin/nl/voidcorp/discord/commands/management/SetVerifiedCommand.kt new file mode 100644 index 0000000..e476576 --- /dev/null +++ b/src/main/kotlin/nl/voidcorp/discord/commands/management/SetVerifiedCommand.kt @@ -0,0 +1,16 @@ +package nl.voidcorp.discord.commands.management + +import nl.voidcorp.discord.command.* +import nl.voidcorp.discord.storage.GuildStore +import org.springframework.stereotype.Service + +@Service +class SetVerifiedCommand : Command("verify", location = CommandSource.GUILD, commandLevel = CommandLevel.ADMIN) { + override fun handle(event: CommandMessage): CommandResult { + val store = repo.findByGuildId(event.guild!!.idLong) ?: GuildStore(event.guild.idLong) + store.defaultVerified = !store.defaultVerified + repo.save(store) + event.reply("Set defaultverified to ${store.defaultVerified}!") + return CommandResult.SUCCESS + } +} \ No newline at end of file