private async Task HandleMessageAsync(SocketMessage arg) { CurrentChannel = arg.Channel; if ((Myself as DCUser)?.Native != Client.CurrentUser && Client.CurrentUser != null) { Myself = new DCUser(Client.CurrentUser); } else if (Client.CurrentUser == null) { logger.Error("CurrentUser is null"); } if (arg is IDMChannel dm) { await Core.HandleDmAsync(new DCPost(arg)); } else if (arg.MentionedUsers?.Any(m => m.Id == (Myself as DCUser).Native.Id) ?? false) { await Core.HandleMentionAsync(new DCPost(arg)); } else { await Core.HandleTimelineAsync(new DCPost(arg)); } }
public DCPost(IMessage mes, IPost reply = null) { Native = mes; Id = mes.GetJumpUrl(); User = new DCUser(mes.Author); Text = TrimMentions(mes.Content); Reply = reply; Via = mes.Application?.Name ?? ""; Attachments = mes.Attachments?.Select(a => new DCAttachment(a) as C.IAttachment).ToList(); }