コード例 #1
0
        public async Task <IActionResult> Channel(ulong serverId, ulong channelId)
        {
            if (!_bot.IsRunning())
            {
                return(RedirectToAction("Authentication", "Bot"));
            }

            var model = new ChatViewModel
            {
                ActiveServer     = Mapper.Map <ServerDetailViewModel>(_bot.GetServerDetailFromId(serverId)),
                ActiveChannel    = Mapper.Map <TextChannelViewModel>(_bot.GetTextChannelDetailFromId(serverId, channelId)),
                AvailableServers = _bot.GetAvailableServers().Select(Mapper.Map <ServerDetailViewModel>),
                MessageBuffer    = (await _bot.GetMessageBufferFor(serverId, channelId)).Select(Mapper.Map <ChatMessageViewModel>)
            };

            return(View(model));
        }