-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from ddivad195/feat/slash-updates
feat: update dkt snapshot version
- Loading branch information
Showing
12 changed files
with
94 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 30 additions & 36 deletions
66
src/main/kotlin/me/ddivad/keeper/commands/GuildConfigurationCommands.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,63 @@ | ||
package me.ddivad.keeper.commands | ||
|
||
import me.ddivad.keeper.conversations.ConfigurationConversation | ||
import me.ddivad.keeper.dataclasses.Configuration | ||
import me.ddivad.keeper.dataclasses.Permissions | ||
import me.jakejmattson.discordkt.arguments.* | ||
import me.jakejmattson.discordkt.commands.commands | ||
import java.lang.Compiler.command | ||
|
||
@Suppress("unused") | ||
fun guildConfigurationCommands(configuration: Configuration) = commands("Configuration", Permissions.STAFF) { | ||
command("configure") { | ||
slash("configure") { | ||
description = "Configure a guild to use Keeper." | ||
execute { | ||
execute(UnicodeEmojiArg("Reaction", "The reaction that will be used to bookmark messages")) { | ||
if (configuration.hasGuildConfig(guild.id)) { | ||
respond("Guild configuration exists. To modify it use the commands to set values.") | ||
respond("Guild configuration already exists. To modify it use the commands to set values.") | ||
return@execute | ||
} | ||
ConfigurationConversation(configuration) | ||
.createConfigurationConversation(guild) | ||
.startPublicly(discord, author, channel) | ||
configuration.setup(guild, args.first.unicode) | ||
respond("Guild Setup") | ||
|
||
} | ||
} | ||
|
||
slash("setPrefix") { | ||
description = "Set the prefix required for the bot to register a command." | ||
execute(AnyArg("Prefix")) { | ||
slash("setReaction") { | ||
description = "Set the reaction used to save messages" | ||
execute(UnicodeEmojiArg("Reaction", "The reaction that will be used to bookmark messages")) { | ||
if (!configuration.hasGuildConfig(guild.id)) { | ||
respond("Guild configuration exists. To modify it use the commands to set values.") | ||
respond("Guild configuration does not exist. Run `/configure` first.") | ||
return@execute | ||
} | ||
|
||
val prefix = args.first | ||
configuration[guild.id]?.prefix = prefix | ||
val reaction = args.first | ||
configuration[guild.id]?.bookmarkReaction = reaction.unicode | ||
configuration.save() | ||
respondPublic("Prefix set to: $prefix") | ||
respondPublic("Reaction set to: $reaction") | ||
} | ||
} | ||
|
||
slash("setRole") { | ||
description = "Set the role required to use this bot." | ||
execute(RoleArg) { | ||
slash("enable") { | ||
description = "Enable the bot reactions" | ||
execute { | ||
if (!configuration.hasGuildConfig(guild.id)) { | ||
respondPublic("Guild configuration exists. To modify it use the commands to set values.") | ||
respond("Guild configuration does not exist. Run `/configure` first.") | ||
return@execute | ||
} | ||
|
||
val requiredRole = args.first | ||
configuration[guild.id]?.requiredRoleId = requiredRole.id | ||
configuration[guild.id]?.enabled = true | ||
configuration.save() | ||
respondPublic("Required role set to: ${requiredRole.name}") | ||
respondPublic("Reactions enabled") | ||
} | ||
} | ||
|
||
slash("setReaction") { | ||
description = "Set the reaction used to save messages" | ||
execute(UnicodeEmojiArg) { | ||
if (!configuration.hasGuildConfig(guild.id)) { | ||
respond("Guild configuration exists. To modify it use the commands to set values.") | ||
return@execute | ||
} | ||
|
||
val reaction = args.first | ||
configuration[guild.id]?.bookmarkReaction = reaction.unicode | ||
configuration.save() | ||
respondPublic("Reaction set to: $reaction") | ||
slash("disable") { | ||
description = "Disable the bot reactions" | ||
execute { | ||
if (!configuration.hasGuildConfig(guild.id)) { | ||
respond("Guild configuration does not exist. Run `/configure` first.") | ||
return@execute | ||
} | ||
configuration[guild.id]?.enabled = false | ||
configuration.save() | ||
respondPublic("Reactions disabled") | ||
} | ||
} | ||
} | ||
} |
45 changes: 0 additions & 45 deletions
45
src/main/kotlin/me/ddivad/keeper/commands/OperationCommands.kt
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/main/kotlin/me/ddivad/keeper/conversations/ConfigurationConversation.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.