-
Notifications
You must be signed in to change notification settings - Fork 4
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 #134 from the-programmers-hangout/develop
release: merge for 2.8.0
- Loading branch information
Showing
9 changed files
with
141 additions
and
22 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
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/me/ddivad/judgebot/dataclasses/MessageDelete.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,10 @@ | ||
package me.ddivad.judgebot.dataclasses | ||
|
||
import java.util.Date | ||
|
||
data class MessageDelete( | ||
val userId: String, | ||
val guildId: String, | ||
val messageLink: String?, | ||
val dateTime: Long = Date().time, | ||
) |
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
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/me/ddivad/judgebot/services/database/MessageDeleteOperations.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,26 @@ | ||
package me.ddivad.judgebot.services.database | ||
|
||
import dev.kord.core.entity.Member | ||
import me.ddivad.judgebot.dataclasses.MessageDelete | ||
import me.jakejmattson.discordkt.annotations.Service | ||
import org.litote.kmongo.and | ||
import org.litote.kmongo.eq | ||
|
||
@Service | ||
class MessageDeleteOperations(connection: ConnectionService) { | ||
private val messageDeleteCollection = connection.db.getCollection<MessageDelete>("MessageDelete") | ||
|
||
suspend fun createMessageDeleteRecord(guildId: String, target: Member, messageLink: String?) { | ||
val record = MessageDelete(target.id.toString(), guildId, messageLink) | ||
messageDeleteCollection.insertOne(record) | ||
} | ||
|
||
suspend fun getMessageDeletesForMember(guildId: String, userId: String): List<MessageDelete> { | ||
return messageDeleteCollection.find( | ||
and( | ||
MessageDelete::guildId eq guildId, | ||
MessageDelete::userId eq userId, | ||
) | ||
).toList() | ||
} | ||
} |