/// <inheritdoc /> public async Task ProcessGroupMessageAsync(Message message) { #region Initialize Chat chat = message.Chat; // Get the sender of the message User sender = message.From; // Check if group exists Group group = await ManageGroup.GetGroupAsync(chat); #endregion if (group is null) { await ManageGroup.AddGroupAsync(new Group { GroupId = chat.Id, GroupName = chat.Title, Description = chat.Description, InviteLink = chat.InviteLink }); return; } // Return if the sender is a bot if (sender.IsBot) { return; } // Get the sender's details var person = await ManageUser.GetUserAsync(sender); if (person is null) { await BotServices.Client.SendHtmlReplyAsync(chat, $"Hi {sender.FirstName}, you are <strong>required</strong> to send me a message " + "as a standard procedure for this group\n" + $"<a href=\"tg://user?id={BotServices.Client.BotId}\"><em>Click Here</em></a> to begin..."); return; } // Check if the person has been active today if (person.LastSeen.Day != DateTime.Today.Day) { // If the person has not, update their last seen to the current day. person.LastSeen = DateTime.Today; person.GroupId = group.GroupId; await ManageUser.UpdateUserAsync(person); } }
public IActionResult ManageGroup(string groupID) { if (!string.IsNullOrEmpty(groupID)) { string myID = HttpContext.User.FindFirst("UserID").Value.ToString(); ManageGroup users = new ManageGroup(); users = dataBase.ManageGroup(myID, groupID); return(View("managegroup", users)); } return(RedirectToAction("Group")); }