本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_peerUser方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_peerUser方法的具体用法?Java TLRPC.TL_peerUser怎么用?Java TLRPC.TL_peerUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_peerUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPeer
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static TLRPC.Peer getPeer(int id) {
TLRPC.Peer inputPeer;
if (id < 0) {
TLRPC.Chat chat = getInstance().getChat(-id);
if (chat instanceof TLRPC.TL_channel || chat instanceof TLRPC.TL_channelForbidden) {
inputPeer = new TLRPC.TL_peerChannel();
inputPeer.channel_id = -id;
} else {
inputPeer = new TLRPC.TL_peerChat();
inputPeer.chat_id = -id;
}
} else {
TLRPC.User user = getInstance().getUser(id);
inputPeer = new TLRPC.TL_peerUser();
inputPeer.user_id = id;
}
return inputPeer;
}
示例2: createDeleteMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private TLRPC.Message createDeleteMessage(int mid, int seq_out, int seq_in, long random_id, TLRPC.EncryptedChat encryptedChat) {
TLRPC.TL_messageService newMsg = new TLRPC.TL_messageService();
newMsg.action = new TLRPC.TL_messageEncryptedAction();
newMsg.action.encryptedAction = new TLRPC.TL_decryptedMessageActionDeleteMessages();
newMsg.action.encryptedAction.random_ids.add(random_id);
newMsg.local_id = newMsg.id = mid;
newMsg.from_id = UserConfig.getClientUserId();
newMsg.unread = true;
newMsg.out = true;
newMsg.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
newMsg.dialog_id = ((long) encryptedChat.id) << 32;
newMsg.to_id = new TLRPC.TL_peerUser();
newMsg.send_state = MessageObject.MESSAGE_SEND_STATE_SENDING;
newMsg.seq_in = seq_in;
newMsg.seq_out = seq_out;
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
newMsg.to_id.user_id = encryptedChat.admin_id;
} else {
newMsg.to_id.user_id = encryptedChat.participant_id;
}
newMsg.date = 0;
newMsg.random_id = random_id;
return newMsg;
}
示例3: createServiceSecretMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private TLRPC.TL_messageService createServiceSecretMessage(final TLRPC.EncryptedChat encryptedChat, TLRPC.DecryptedMessageAction decryptedMessage) {
TLRPC.TL_messageService newMsg = new TLRPC.TL_messageService();
newMsg.action = new TLRPC.TL_messageEncryptedAction();
newMsg.action.encryptedAction = decryptedMessage;
newMsg.local_id = newMsg.id = UserConfig.getNewMessageId();
newMsg.from_id = UserConfig.getClientUserId();
newMsg.unread = true;
newMsg.out = true;
newMsg.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
newMsg.dialog_id = ((long) encryptedChat.id) << 32;
newMsg.to_id = new TLRPC.TL_peerUser();
newMsg.send_state = MessageObject.MESSAGE_SEND_STATE_SENDING;
if (encryptedChat.participant_id == UserConfig.getClientUserId()) {
newMsg.to_id.user_id = encryptedChat.admin_id;
} else {
newMsg.to_id.user_id = encryptedChat.participant_id;
}
if (decryptedMessage instanceof TLRPC.TL_decryptedMessageActionScreenshotMessages || decryptedMessage instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) {
newMsg.date = ConnectionsManager.getInstance().getCurrentTime();
} else {
newMsg.date = 0;
}
newMsg.random_id = SendMessagesHelper.getInstance().getNextRandomId();
UserConfig.saveConfig(false);
ArrayList<TLRPC.Message> arr = new ArrayList<>();
arr.add(newMsg);
MessagesStorage.getInstance().putMessages(arr, false, true, true, 0);
return newMsg;
}
示例4: increaseInlineRaiting
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static void increaseInlineRaiting(final int uid) {
Integer time = inlineDates.get(uid);
int dt;
if (time != null) {
dt = Math.max(1, ((int) (System.currentTimeMillis() / 1000)) - time);
} else {
dt = 60;
}
TLRPC.TL_topPeer peer = null;
for (int a = 0; a < inlineBots.size(); a++) {
TLRPC.TL_topPeer p = inlineBots.get(a);
if (p.peer.user_id == uid) {
peer = p;
break;
}
}
if (peer == null) {
peer = new TLRPC.TL_topPeer();
peer.peer = new TLRPC.TL_peerUser();
peer.peer.user_id = uid;
inlineBots.add(peer);
}
peer.rating += Math.exp(dt / MessagesController.getInstance().ratingDecay);
Collections.sort(inlineBots, new Comparator<TLRPC.TL_topPeer>() {
@Override
public int compare(TLRPC.TL_topPeer lhs, TLRPC.TL_topPeer rhs) {
if (lhs.rating > rhs.rating) {
return -1;
} else if (lhs.rating < rhs.rating) {
return 1;
}
return 0;
}
});
if (inlineBots.size() > 20) {
inlineBots.remove(inlineBots.size() - 1);
}
savePeer(uid, 1, peer.rating);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.reloadInlineHints);
}