本文整理汇总了Java中org.telegram.tgnet.TLRPC.BotInfo方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.BotInfo方法的具体用法?Java TLRPC.BotInfo怎么用?Java TLRPC.BotInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.BotInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putBotInfo
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void putBotInfo(final TLRPC.BotInfo botInfo) {
if (botInfo == null) {
return;
}
botInfos.put(botInfo.user_id, botInfo);
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
@Override
public void run() {
try {
SQLitePreparedStatement state = MessagesStorage.getInstance().getDatabase().executeFast("REPLACE INTO bot_info(uid, info) VALUES(?, ?)");
state.requery();
NativeByteBuffer data = new NativeByteBuffer(botInfo.getObjectSize());
botInfo.serializeToStream(data);
state.bindInteger(1, botInfo.user_id);
state.bindByteBuffer(2, data);
state.step();
data.reuse();
state.dispose();
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
});
}
示例2: updateBotButtons
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void updateBotButtons() {
if (headerItem == null || currentUser == null || currentEncryptedChat != null || !currentUser.bot) {
return;
}
boolean hasHelp = false;
boolean hasSettings = false;
if (!botInfo.isEmpty()) {
for (HashMap.Entry<Integer, TLRPC.BotInfo> entry : botInfo.entrySet()) {
TLRPC.BotInfo info = entry.getValue();
for (int a = 0; a < info.commands.size(); a++) {
TLRPC.TL_botCommand command = info.commands.get(a);
if (command.command.toLowerCase().equals("help")) {
hasHelp = true;
} else if (command.command.toLowerCase().equals("settings")) {
hasSettings = true;
}
if (hasSettings && hasHelp) {
break;
}
}
}
}
if (hasHelp) {
headerItem.showSubItem(bot_help);
} else {
headerItem.hideSubItem(bot_help);
}
if (hasSettings) {
headerItem.showSubItem(bot_settings);
} else {
headerItem.hideSubItem(bot_settings);
}
}
示例3: updateBotButtons
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateBotButtons() {
if (headerItem == null || currentUser == null || currentEncryptedChat != null || !currentUser.bot) {
return;
}
boolean hasHelp = false;
boolean hasSettings = false;
if (!botInfo.isEmpty()) {
for (HashMap.Entry<Integer, TLRPC.BotInfo> entry : botInfo.entrySet()) {
TLRPC.BotInfo info = entry.getValue();
for (int a = 0; a < info.commands.size(); a++) {
TLRPC.TL_botCommand command = info.commands.get(a);
if (command.command.toLowerCase().equals("help")) {
hasHelp = true;
} else if (command.command.toLowerCase().equals("settings")) {
hasSettings = true;
}
if (hasSettings && hasHelp) {
break;
}
}
}
}
if (hasHelp) {
headerItem.showSubItem(bot_help);
} else {
headerItem.hideSubItem(bot_help);
}
if (hasSettings) {
headerItem.showSubItem(bot_settings);
} else {
headerItem.hideSubItem(bot_settings);
}
}
示例4: setBotInfo
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setBotInfo(HashMap<Integer, TLRPC.BotInfo> info) {
botInfo = info;
}