public final class AbilityUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
addTag(String username) |
static Consumer<MessageContext> |
commitTo(DBContext db)
Commits to DB.
|
static String |
fullName(org.telegram.telegrambots.meta.api.objects.User user)
The full name is identified as the concatenation of the first and last name, separated by a space.
|
static Long |
getChatId(org.telegram.telegrambots.meta.api.objects.Update update)
Fetches the direct chat ID of the specified update.
|
static String |
getLocalizedMessage(String messageCode,
Locale locale,
Object... arguments) |
static String |
getLocalizedMessage(String messageCode,
String languageCode,
Object... arguments) |
static org.telegram.telegrambots.meta.api.objects.User |
getUser(org.telegram.telegrambots.meta.api.objects.Update update)
Fetches the user who caused the update.
|
static boolean |
isGroupUpdate(org.telegram.telegrambots.meta.api.objects.Update update)
A "best-effort" boolean stating whether the update is a group message or not.
|
static Predicate<org.telegram.telegrambots.meta.api.objects.Update> |
isReplyTo(String msg) |
static boolean |
isSuperGroupUpdate(org.telegram.telegrambots.meta.api.objects.Update update)
A "best-effort" boolean stating whether the update is a super-group message or not.
|
static boolean |
isUserMessage(org.telegram.telegrambots.meta.api.objects.Update update) |
static String |
shortName(org.telegram.telegrambots.meta.api.objects.User user)
The short name is one of the following:
First name
Last name
Username
The method will try to return the first valid name in the specified order.
|
static String |
stripTag(String username) |
public static String stripTag(String username)
username - any usernamepublic static Consumer<MessageContext> commitTo(DBContext db)
db - the database to commit onMessageContext, used in post actions for abilitiespublic static org.telegram.telegrambots.meta.api.objects.User getUser(org.telegram.telegrambots.meta.api.objects.Update update)
update - a Telegram UpdateIllegalStateException - if the user could not be foundpublic static boolean isGroupUpdate(org.telegram.telegrambots.meta.api.objects.Update update)
update - a Telegram Updatepublic static boolean isSuperGroupUpdate(org.telegram.telegrambots.meta.api.objects.Update update)
update - a Telegram Updatepublic static Long getChatId(org.telegram.telegrambots.meta.api.objects.Update update)
update - a Telegram UpdateIllegalStateException - if the chat ID could not be foundpublic static boolean isUserMessage(org.telegram.telegrambots.meta.api.objects.Update update)
update - a Telegram Updatepublic static String addTag(String username)
username - the username to add the tag topublic static Predicate<org.telegram.telegrambots.meta.api.objects.Update> isReplyTo(String msg)
msg - the message to be replied topublic static String getLocalizedMessage(String messageCode, Locale locale, Object... arguments)
public static String getLocalizedMessage(String messageCode, String languageCode, Object... arguments)
public static String shortName(org.telegram.telegrambots.meta.api.objects.User user)
public static String fullName(org.telegram.telegrambots.meta.api.objects.User user)
user - Copyright © 2019. All rights reserved.