This file contains hidden or 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
| import logging | |
| import textwrap | |
| import google.generativeai as genai | |
| from google.generativeai.types import HarmCategory, HarmBlockThreshold | |
| from config import config | |
| from TelegramUtils import client2 | |
| genai.configure(api_key=config.gemini_api_key) |
This file contains hidden or 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
| package me.centralhardware.znatoki.telegram.statistic | |
| import dev.inmo.tgbotapi.bot.TelegramBot | |
| import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands | |
| import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviour | |
| import dev.inmo.tgbotapi.extensions.behaviour_builder.createSubContext | |
| import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling | |
| import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.* | |
| import dev.inmo.tgbotapi.extensions.utils.updates.flowsUpdatesFilter | |
| import dev.inmo.tgbotapi.types.BotCommand |
This file contains hidden or 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
| package me.centralhardware.znatoki.telegram.statistic.eav.json | |
| import kotlinx.serialization.KSerializer | |
| import kotlinx.serialization.descriptors.PrimitiveKind | |
| import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor | |
| import kotlinx.serialization.descriptors.SerialDescriptor | |
| import kotlinx.serialization.encoding.Decoder | |
| import kotlinx.serialization.encoding.Encoder | |
| import me.centralhardware.znatoki.telegram.statistic.eav.types.* |
This file contains hidden or 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
| package me.centralhardware.znatoki.telegram.statistic.telegram.bulider | |
| import org.telegram.telegrambots.meta.api.methods.send.SendMessage | |
| import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup | |
| import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardButton | |
| import org.telegram.telegrambots.meta.api.objects.webapp.WebAppInfo | |
| import kotlin.properties.Delegates | |
| class InlineKeyboardDsl { |
This file contains hidden or 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
| 16:08:47.254 [DefaultDispatcher-worker-11] WARN ROOT -- | |
| dev.inmo.tgbotapi.bot.exceptions.CommonBotException: Something went wrong | |
| at dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor.execute(DefaultKtorRequestsExecutor.kt:103) | |
| at dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor$execute$1.invokeSuspend(DefaultKtorRequestsExecutor.kt) | |
| at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) | |
| at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:28) | |
| at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99) | |
| at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) | |
| at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:28) | |
| at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99) |
This file contains hidden or 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
| fun getMetar(icao: String): String{ | |
| val metar = metarService.retrieveFromAirport(icao) | |
| return """ | |
| ${getAirport(metar.airport)} | |
| ${metar.day} ${metar.time} | |
| temp: ${metar.temperature}, dew point: ${metar.dewPoint}, ${if (metar.isNosig == true) "nosig" else ""} | |
| ${getWind(metar.wind)} | |
| ${getVisibility(metar.visibility)} | |
| ${getWeatherConditions(metar.weatherConditions)} | |
This file contains hidden or 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
| var list = listOf( | |
| listOf(1, 2, 3), | |
| listOf(4, 1, 5) | |
| ) | |
| var count = 0 | |
| for (i in 0..list[1].size-1){ | |
| for (j in 0..list.size-1){ | |
| println(list[j][i]) | |
| if (list[j][i] == 1) count = count.inc() |
This file contains hidden or 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
| public void send(Object method, User user){ | |
| limiter.limit(() -> { | |
| try { | |
| telegramUtil.logSend(method); | |
| if (method instanceof BotApiMethodMessage botApiMethodMessage){ | |
| absSender.execute(botApiMethodMessage); | |
| } else if (method instanceof SendPhoto sendPhoto){ | |
| absSender.execute(sendPhoto); | |
| } else if (method instanceof DeleteMessage deleteMessage){ | |
| absSender.execute(deleteMessage); |
This file contains hidden or 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
| public void saveStatisticOutcome(Object object){ | |
| String chatId; | |
| String text; | |
| if (object instanceof SendMessage sendMessage){ | |
| chatId = sendMessage.getChatId(); | |
| text = sendMessage.getText(); | |
| } else if (object instanceof SendPhoto sendPhoto){ | |
| chatId = sendPhoto.getChatId(); | |
| text = sendPhoto.getCaption(); | |
| } else if (object instanceof DeleteMessage deleteMessage){ |
This file contains hidden or 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
| repositories { | |
| mavenLocal() | |
| mavenCentral() | |
| } | |
| buildscript { | |
| repositories { | |
| mavenLocal() | |
| mavenCentral() | |
| } | |
| dependencies { |