-
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.
Notify users of fallback contact via DM first
Fall back to server channel ping as the last resort
- Loading branch information
1 parent
5d1a653
commit 1f4fadb
Showing
6 changed files
with
123 additions
and
23 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
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,52 @@ | ||
package com.gmtkgamejam.bot | ||
|
||
import com.gmtkgamejam.services.PostService | ||
import org.javacord.api.entity.message.embed.EmbedBuilder | ||
import org.javacord.api.entity.user.User | ||
|
||
class BotMessageBuilder { | ||
|
||
private val postService = PostService() | ||
|
||
fun canBuildEmbedFromUser(sender: User): Boolean = postService.getPostByAuthorId(sender.id.toString()) != null | ||
|
||
fun embedMessage(recipient: User, sender: User): EmbedBuilder { | ||
val post = postService.getPostByAuthorId(sender.id.toString())!! | ||
|
||
val shortDescription = if (post.description.length > 240) post.description.take(237) + "..." else post.description | ||
|
||
val embed = EmbedBuilder() | ||
.setTitle("${sender.name} wants to get in contact!") | ||
.setDescription("Hey there ${recipient.name}! ${sender.name} 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) | ||
|
||
// Add optional fields - turns out this includes timezones | ||
if (post.skillsSought?.isNotEmpty() == true) { | ||
embed.addField("${sender.name} is looking for:", post.skillsSought.toString()) | ||
} | ||
if (post.skillsPossessed?.isNotEmpty() == true) { | ||
embed.addField("${sender.name} can bring:", post.skillsPossessed.toString()) | ||
} | ||
if (post.preferredTools?.isNotEmpty() == true) { | ||
embed.addField("Engine(s)", post.preferredTools.toString()) | ||
} | ||
if (post.timezoneOffsets.isNotEmpty()) { | ||
embed.addField("Timezone(s)", post.timezoneOffsets.map { if (it < 0) "UTC-$it" else "UTC+$it" }.toString()) | ||
} | ||
|
||
embed | ||
.addField("Like what you see?", "Check out their full post here to see more! https://findyourjam.team/gmtk/${post.id}/") | ||
.setFooter("Feedback? DM @dotwo in the #developing-gtmk-team-finder-app channel") | ||
|
||
return embed | ||
} | ||
|
||
// 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!" | ||
They don't have a post on the Team Finder yet, so why not drop them a message and find out more? | ||
""".trimIndent() | ||
} | ||
} |
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
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
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