Skip to content

Commit 345abd8

Browse files
moved code to function
1 parent 456f5a5 commit 345abd8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/src/main/kotlin/com/github/livingwithhippos/unchained_bot/BotApplication.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class BotApplication : KoinComponent {
8989
private val torrentsCommandFilter = Filter.Custom { text?.startsWith("/torrents") ?: false }
9090
private val downloadsCommandFilter = Filter.Custom { (text?.startsWith("/downloads") ?: false) }
9191

92-
init {
92+
fun startBot() {
9393

9494
if (botToken.length > 40)
9595
println("Found Telegram Bot Token")
@@ -192,7 +192,8 @@ class BotApplication : KoinComponent {
192192
scope.launch {
193193
val downloadItem = unrestrictLink(args)
194194
if (downloadItem != null) {
195-
val itemMessage: String = formatDownloadItem(downloadItem, allowTranscoding = true)
195+
val itemMessage: String =
196+
formatDownloadItem(downloadItem, allowTranscoding = true)
196197

197198
bot.sendMessage(
198199
chatId = ChatId.fromId(message.chat.id),

app/src/main/kotlin/com/github/livingwithhippos/unchained_bot/Main.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ fun main(args: Array<String>) {
2929
}
3030

3131
val botApp = BotApplication()
32+
botApp.startBot()
3233
}

0 commit comments

Comments
 (0)