本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_peerChannel方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_peerChannel方法的具体用法?Java TLRPC.TL_peerChannel怎么用?Java TLRPC.TL_peerChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_peerChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: generateJoinMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void generateJoinMessage(final int chat_id, boolean ignoreLeft) {
TLRPC.Chat chat = getChat(chat_id);
if (chat == null || !ChatObject.isChannel(chat_id) || (chat.left || chat.kicked) && !ignoreLeft) {
return;
}
TLRPC.TL_messageService message = new TLRPC.TL_messageService();
message.flags = TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
message.local_id = message.id = UserConfig.getNewMessageId();
message.date = ConnectionsManager.getInstance().getCurrentTime();
message.from_id = UserConfig.getClientUserId();
message.to_id = new TLRPC.TL_peerChannel();
message.to_id.channel_id = chat_id;
message.dialog_id = -chat_id;
message.post = true;
message.action = new TLRPC.TL_messageActionChatAddUser();
message.action.users.add(UserConfig.getClientUserId());
if (chat.megagroup) {
message.flags |= TLRPC.MESSAGE_FLAG_MEGAGROUP;
}
UserConfig.saveConfig(false);
final ArrayList<MessageObject> pushMessages = new ArrayList<>();
final ArrayList<TLRPC.Message> messagesArr = new ArrayList<>();
messagesArr.add(message);
MessageObject obj = new MessageObject(message, null, true);
pushMessages.add(obj);
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationsController.getInstance().processNewMessages(pushMessages, true);
}
});
}
});
MessagesStorage.getInstance().putMessages(messagesArr, true, true, false, MediaController.getInstance().getAutodownloadMask());
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
updateInterfaceWithMessages(-chat_id, pushMessages);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});
}