2022-01-31 16:21:09 +08:00
|
|
|
package cc.sukazyo.cono.morny.bot.query;
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2022-05-04 11:41:18 +08:00
|
|
|
import cc.sukazyo.cono.morny.bot.api.InlineQueryUnit;
|
2022-01-31 16:21:09 +08:00
|
|
|
import com.pengrad.telegrambot.model.Update;
|
|
|
|
import com.pengrad.telegrambot.model.request.InlineQueryResultArticle;
|
|
|
|
import com.pengrad.telegrambot.model.request.InputTextMessageContent;
|
|
|
|
import com.pengrad.telegrambot.model.request.ParseMode;
|
|
|
|
|
|
|
|
import cc.sukazyo.cono.morny.util.TelegramUserInformation;
|
|
|
|
|
|
|
|
public class MyInformation implements ITelegramQuery<InlineQueryResultArticle> {
|
|
|
|
|
|
|
|
public static final String ID_PREFIX = "[morny/info/me]";
|
|
|
|
public static final String TITLE = "My Account Information";
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Nullable
|
2022-05-04 11:41:18 +08:00
|
|
|
public InlineQueryUnit<InlineQueryResultArticle> query(Update event) {
|
2022-01-31 16:21:09 +08:00
|
|
|
if (!(event.inlineQuery().query() == null || "".equals(event.inlineQuery().query()))) return null;
|
2022-05-04 11:41:18 +08:00
|
|
|
return new InlineQueryUnit<>(new InlineQueryResultArticle(
|
|
|
|
ID_PREFIX, TITLE,
|
|
|
|
new InputTextMessageContent(
|
|
|
|
TelegramUserInformation.informationOutputHTML(event.inlineQuery().from())
|
|
|
|
).parseMode(ParseMode.HTML)
|
|
|
|
)).isPersonal(true).cacheTime(10);
|
2022-01-31 16:21:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|