Skip to content

Commit 0d8ad43

Browse files
committed
Update message editing logic to fix some bugs and clarify bot setup in README
1 parent ad79101 commit 0d8ad43

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The goal of this Discord bot is to bring users' statistics from different compet
4848
* CodeForces
4949
## Requirements
5050
* Running MongoDB server - you can download it on www.mongodb.com or use free cluster from MongoDB Atlas - https://cloud.mongodb.com
51-
* Discord bot token - you can create it on https://discord.com/developers/applications. The bot needs to be installed to your Guild and need to have scopes `applications.commands`, `bot` and permissions `Manage Channels`, `Send Messages`. You can set them in your dashboard before bot installation to Guild.
51+
* Discord bot token - you can create it on https://discord.com/developers/applications. The bot needs to be installed to your Guild and need to have scopes `applications.commands`, `bot` and permissions `Manage Channels`, `Send Messages`. You also need to enable all Privileged Gateway Intents. You can set all them in your dashboard before bot installation to Guild.
5252
## How to install (traditional)
5353
* Build jars with `./gradlew build` or download already built fat jar from the last release on https://github.com/likespro/cp-programming-stats-bot/releases
5454
* Ensure you have set all necessary environment variables (see the [list](#environment-variables) below)

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group = 'eth.likespro'
6-
version = '1.0.0'
6+
version = '1.0.1'
77

88
repositories {
99
mavenCentral()

src/main/kotlin/Main.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fun main() {
221221

222222
log.debug { "Editing messages..." }
223223
messagesContents.forEachIndexed { index, text ->
224-
if(index < messagesIds.size) channel.editMessageById(messagesIds[index], text).queue()
224+
if(index < messagesIds.size) channel.editMessageById(messagesIds[index], text).complete()
225225
else {
226226
val messageId = channel.sendMessage(text).complete().idLong
227227
Mono.from(sentMessagesCollection.insertOne(Document()
@@ -346,8 +346,8 @@ fun main() {
346346
.append("platform", "codeforces")
347347
.append("discordMessageId", messageId))).block()!!
348348
}
349-
else if(index < messagesIds.size - 1) channel.editMessageById(messagesIds[index], text).queue()
350-
else if(index == messagesIds.size) channel.editMessageById(messagesIds.last(), text).queue()
349+
else if(index < messagesIds.size - 1) channel.editMessageById(messagesIds[index], text).complete()
350+
else if(index == messagesIds.size) channel.editMessageById(messagesIds.last(), text).complete()
351351
i = index
352352
}
353353
if(messagesIds.isEmpty()){

0 commit comments

Comments
 (0)