-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to use server-specific bot integration to send DM direct …
…to user This semi-WIP commit allows for future splitting of routes by jamId. Using DMs instead of a ping channel allows any guild to use this bot without undue faff required to integrate.
- Loading branch information
1 parent
5d1a653
commit 89537f4
Showing
14 changed files
with
237 additions
and
163 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
35 changes: 35 additions & 0 deletions
35
api/src/main/kotlin/com/gmtkgamejam/bot/BotMessageBuilder.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.gmtkgamejam.bot | ||
|
||
import com.gmtkgamejam.services.PostService | ||
import org.javacord.api.entity.message.embed.EmbedBuilder | ||
import org.javacord.api.entity.user.User | ||
|
||
object BotMessageBuilder { | ||
|
||
private val postService = PostService() | ||
|
||
fun canBuildEmbedFromUser(sender: User): Boolean = postService.getPostByAuthorId(sender.id.toString()) != null | ||
|
||
fun embedMessage(recipient: User, sender: User): EmbedBuilder { | ||
val postItem = postService.getPostByAuthorId(sender.id.toString())!! | ||
|
||
val shortDescription = if (postItem.description.length > 240) postItem.description.take(237) + "..." else postItem.description | ||
|
||
return EmbedBuilder() | ||
.setTitle("${sender.name} wants to get in contact!") | ||
.setDescription("Hey there ${recipient.name}! Someone wants to get in touch - this is a summary of their current post on the Team Finder!") | ||
.setAuthor("GMTK Team Finder", "https://findyourjam.team/", "https://findyourjam.team/logos/jam-logo-stacked.webp") | ||
.addField("Description", shortDescription) | ||
.addField("${sender.name} is looking for:", postItem.skillsSought.toString()) | ||
.addField("${sender.name} can bring:", postItem.skillsPossessed.toString()) | ||
.addInlineField("Engine(s)", postItem.preferredTools.toString()) | ||
.addInlineField("Timezone(s)", postItem.timezoneOffsets.map { if (it < 0) "UTC-$it" else "UTC+$it" }.toString()) | ||
.addField("Like what you see?", "Check out their full post here to see more! https://findyourjam.team/gmtk/${postItem.id}/") | ||
.setFooter("Feedback? DM @dotwo in the #developing-gtmk-team-finder-app channel") | ||
} | ||
|
||
// TODO: Add a variety of messages to mix things up a bit? | ||
fun basicMessage(recipient: User, sender: User): String { | ||
return "Hey ${recipient.mentionTag}, ${sender.mentionTag} wants to get in contact about your Team Finder post!" | ||
} | ||
} |
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
10 changes: 0 additions & 10 deletions
10
api/src/main/kotlin/com/gmtkgamejam/koin/DiscordBotModule.kt
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
package com.gmtkgamejam.models.bot | ||
|
||
data class BotRecord(val guildId: String, val jamId: String, val botToken: String) |
24 changes: 14 additions & 10 deletions
24
api/src/main/kotlin/com/gmtkgamejam/models/posts/Skills.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,13 +1,17 @@ | ||
package com.gmtkgamejam.models.posts | ||
|
||
enum class Skills { | ||
ART_2D, | ||
ART_3D, | ||
CODE, | ||
DESIGN_PRODUCTION, | ||
SFX, | ||
MUSIC, | ||
TESTING_SUPPORT, | ||
TEAM_LEAD, | ||
OTHER; | ||
enum class Skills(private var readableName: String) { | ||
ART_2D("2D Art"), | ||
ART_3D("3D Art"), | ||
CODE("Code"), | ||
DESIGN_PRODUCTION("Design/Production"), | ||
SFX("SFX"), | ||
MUSIC("Music"), | ||
TESTING_SUPPORT("Testing/Support"), | ||
TEAM_LEAD("Team lead"), | ||
OTHER("Other"); | ||
|
||
override fun toString(): String { | ||
return readableName; | ||
} | ||
} |
26 changes: 15 additions & 11 deletions
26
api/src/main/kotlin/com/gmtkgamejam/models/posts/Tools.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,15 +1,19 @@ | ||
package com.gmtkgamejam.models.posts | ||
|
||
// For the time being, Tool == Engine | ||
enum class Tools { | ||
UNITY, | ||
CONSTRUCT, | ||
GAME_MAKER_STUDIO, | ||
GODOT, | ||
TWINE, | ||
BITSY, | ||
UNREAL, | ||
RPG_MAKER, | ||
PICO_8, | ||
OTHER, | ||
enum class Tools(private var readableName: String) { | ||
UNITY("Unity"), | ||
CONSTRUCT("Construct"), | ||
GAME_MAKER_STUDIO("Game Maker Studio"), | ||
GODOT("Godot"), | ||
TWINE("Twine"), | ||
BITSY("Bitsy"), | ||
UNREAL("Unreal"), | ||
RPG_MAKER("RPG Maker"), | ||
PICO_8("PICO 8"), | ||
OTHER("Other"); | ||
|
||
override fun toString(): String { | ||
return readableName; | ||
} | ||
} |
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
Oops, something went wrong.