#pragma warning disable CS0618 //Disable Obsolete warning. public BaseMenuResponse(IMenuHandlerObject menuHandlerObject, MessageContext context) { this.Author = context.authorName; this.IconUrl = context.authorAvatarUrl; if (context.wrappedMessage.Author is SocketGuildUser) { IReadOnlyCollection <SocketRole> roles = (context.wrappedMessage.Author as SocketGuildUser).Roles; if (roles.Count > 0) { IEnumerator <SocketRole> enumerator = roles.GetEnumerator(); while (enumerator.MoveNext() && this.Color == 0) { this.Color = enumerator.Current.Color.RawValue; } } } this.Title = menuHandlerObject.Title; this.Description = menuHandlerObject.Description; this.Footer = menuHandlerObject.Footer; this.userId = context.authorId; this.channelId = context.wrappedMessage.Channel.Id; this.menuHandlerObject = menuHandlerObject; }
internal void AddOrReplaceActiveMenu(ulong userId, ulong channelId, IMenuHandlerObject menuHandlerObject) { UserChannelCombo userChannelCombo = new UserChannelCombo(userId, channelId); if (this.activeMenus.ContainsKey(userChannelCombo)) { this.activeMenus[userChannelCombo] = menuHandlerObject; } else { this.activeMenus.Add(new UserChannelCombo(userId, channelId), menuHandlerObject); } }
public BaseMenuResponse(IMenuHandlerObject menuHandlerObject, MessageContext context, EmbedResponse baseEmbed) { this.Author = baseEmbed.Author; this.Color = baseEmbed.Color; this.Description = baseEmbed.Description; this.Footer = baseEmbed.Footer; this.IconUrl = baseEmbed.IconUrl; this.ImageAttachmentFilePath = baseEmbed.ImageAttachmentFilePath; this.ImageUrl = baseEmbed.ImageUrl; this.ThumbnailURL = baseEmbed.ThumbnailURL; this.Title = baseEmbed.Title; this.URL = baseEmbed.URL; this.messages = baseEmbed.messages; }
public object HandleResponse(ulong userId, ulong channelId, MessageContext messageContext) { UserChannelCombo userChannelCombo = new UserChannelCombo(userId, channelId); IMenuHandlerObject menuHandlerObject = activeMenus[userChannelCombo]; object responseObject; if (menuHandlerObject.HandleMenuOperation(out responseObject, messageContext)) { if (menuHandlerObject.DeleteAfterResponse) { menuHandlerObject.ResponseSentArgs.Delete(); } activeMenus.Remove(userChannelCombo); return(responseObject); } else { return(null); } }