Example #1
0
        public static async Task <bool> GetHelp(CommandMessage message, Permissions permissions)
        {
            int   page  = 0;
            Embed embed = GetHelp(message.Guild, permissions, 0, out page);

            Discord.Rest.RestUserMessage helpWindow = await message.Channel.SendMessageAsync(null, false, embed, messageReference : message.MessageReference);

            // Add window to list
            activeHelpEmbeds.Add(helpWindow.Id, new ActiveHelp(message.Author.Id, 0));

            // Add reactions
            await helpWindow.AddReactionsAsync(HelpEmotes.ToArray());

            // Begin the clean up task if it's not already running
            if (activeHelpWindowTask == null || !activeHelpWindowTask.Status.Equals(TaskStatus.Running))
            {
                activeHelpWindowTask = Task.Run(async() => await ClearReactionsAfterDelay(message.Channel));
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Sends a new admin task
        /// </summary>
        /// <param name="taskTitle">Title of the task</param>
        /// <param name="taskDescription">Further information</param>
        public static async Task <AdminTaskInteractiveMessage> CreateAdminTaskMessage(string taskTitle, string taskDescription)
        {
            if (GuildChannelHelper.TryGetChannel(GuildChannelHelper.AdminNotificationChannelId, out SocketTextChannel channel))
            {
                EmbedBuilder embed = new EmbedBuilder()
                {
                    Title       = taskTitle,
                    Description = taskDescription,
                    Color       = Red,
                    Footer      = Footer
                };
                Discord.Rest.RestUserMessage message = await channel.SendEmbedAsync(embed);

                AdminTaskInteractiveMessage result = new AdminTaskInteractiveMessage(message as IUserMessage, taskTitle);
                await message.AddReactionsAsync(new IEmote[] { UnicodeEmoteService.Checkmark, UnicodeEmoteService.Cross });

                return(result);
            }
            else
            {
                return(null);
            }
        }