1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-04 02:17:51 +01:00
Telegram/Watch/Bridge/TGBridgeBotInfo+TGBotInfo.m
2015-10-01 19:19:52 +03:00

28 lines
973 B
Objective-C

#import "TGBridgeBotInfo+TGBotInfo.h"
#import "TGBotInfo.h"
#import "TGBridgeBotCommandInfo+TGBotCommandInfo.h"
@implementation TGBridgeBotInfo (TGBotInfo)
+ (TGBridgeBotInfo *)botInfoWithTGBotInfo:(TGBotInfo *)botInfo userId:(int32_t)userId
{
TGBridgeBotInfo *bridgeBotInfo = [[TGBridgeBotInfo alloc] init];
bridgeBotInfo->_version = botInfo.version;
bridgeBotInfo->_userId = userId;
bridgeBotInfo->_shortDescription = botInfo.shortDescription;
bridgeBotInfo->_botDescription = botInfo.botDescription;
NSMutableArray *commandList = [[NSMutableArray alloc] init];
for (TGBotComandInfo *commandInfo in botInfo.commandList)
{
TGBridgeBotCommandInfo *bridgeCommandInfo = [TGBridgeBotCommandInfo botCommandInfoWithTGBotCommandInfo:commandInfo];
if (bridgeCommandInfo != nil)
[commandList addObject:bridgeCommandInfo];
}
bridgeBotInfo->_commandList = commandList;
return bridgeBotInfo;
}
@end