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
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 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 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 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 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 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 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 { |
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
{ | |
"test": "test" | |
} |
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
import json | |
import logging | |
import os | |
from json.decoder import JSONDecodeError | |
from aiohttp import web | |
from telethon.sync import TelegramClient | |
def str2bool(boolean_string): |
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
public class InlineKeyboardBuilder { | |
private final List<List<InlineKeyboardButton>> keyboard = new ArrayList<>(); | |
private String text; | |
private List<InlineKeyboardButton> row = null; | |
private InlineKeyboardBuilder() { } | |
public static InlineKeyboardBuilder create() { | |
return new InlineKeyboardBuilder(); |
NewerOlder