Skip to content

Commit ebd03ef

Browse files
committed
get bottoken from cmdline
1 parent 7dae649 commit ebd03ef

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/kotlin/Config.kt.example

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/main/kotlin/Main.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ data class JoinRequest(
2525
suspend fun main(vararg args: String) {
2626
val map = HashMap<ChatIdentifier, JoinRequest>()
2727

28-
telegramBotWithBehaviourAndLongPolling(Config.botToken, CoroutineScope(Dispatchers.IO)) {
28+
if (args.size != 1){
29+
println("Invalid BotToken")
30+
return
31+
}
32+
33+
println("BotToken: ${args[0]}")
34+
35+
telegramBotWithBehaviourAndLongPolling(args[0], CoroutineScope(Dispatchers.IO)) {
2936
onChatJoinRequest {
3037
val model = getModel(it.from?.asCommonUser()?.ietfLanguageCode?.code)
3138
val password = abs(it.chat.id.chatId).toString()

0 commit comments

Comments
 (0)