-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While I work on the dual NLP and slash-command activation of skills, this will start as a slash command so that it is more prominent.
- Loading branch information
Showing
4 changed files
with
50 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.yttr.glyph.bot.extensions | ||
|
||
import net.dv8tion.jda.api.EmbedBuilder | ||
import net.dv8tion.jda.api.entities.MessageEmbed | ||
|
||
/** | ||
* Shorthand for building an embed | ||
*/ | ||
fun embedBuilder(builder: EmbedBuilder.() -> Unit): MessageEmbed = | ||
EmbedBuilder().also(builder).build() |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.yttr.glyph.bot.messaging | ||
|
||
import net.dv8tion.jda.api.events.ReadyEvent | ||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent | ||
import net.dv8tion.jda.api.hooks.ListenerAdapter | ||
import net.dv8tion.jda.api.interactions.commands.build.CommandData | ||
import org.yttr.glyph.bot.extensions.embedBuilder | ||
import org.yttr.glyph.shared.readMarkdown | ||
|
||
object ThanksListener : ListenerAdapter() { | ||
private const val COMMAND_NAME = "thanks" | ||
|
||
override fun onReady(event: ReadyEvent) { | ||
val commandData = CommandData(COMMAND_NAME, "Special thanks to our sponsors.") | ||
|
||
event.jda.upsertCommand(commandData).queue() | ||
} | ||
|
||
private val content = this::class.java.classLoader.readMarkdown("thanks.md") | ||
|
||
override fun onSlashCommand(event: SlashCommandEvent) { | ||
if (event.commandPath == COMMAND_NAME) { | ||
val embed = embedBuilder { | ||
setTitle("Acknowledgements") | ||
setDescription(content) | ||
} | ||
|
||
event.replyEmbeds(embed).setEphemeral(true).queue() | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*We would like to express our gratitude to our sponsors. Their generous support helps pay for the servers that keep this project running.* | ||
|
||
- **[IBP-0](https://github.com/IBP-0)** | ||
|
||
[Become a GitHub Sponsor](https://github.com/sponsors/yttrian) - [Buy me a Ko-Fi](https://ko-fi.com/throudin) |