예제 #1
0
        public async Task ClearCommand(int num)
        {
            SocketGuildUser user = (SocketGuildUser)Context.User;

            if (!user.GuildPermissions.ManageMessages)
            {
                var items = await Context.Channel.GetMessagesAsync(1).FlattenAsync();

                await((ITextChannel)Context.Channel).DeleteMessagesAsync(items);
                var m = await ReplyAsync(
                    embed : await EmbedHandler.ErrorEmbed("⚠️ You don't have permission to execute this command!"));

                const int delay = 4000;
                await Task.Delay(delay);

                await m.DeleteAsync();
            }
            else
            {
                IEnumerable <IMessage> messages = await Context.Channel.GetMessagesAsync(num + 1).FlattenAsync();

                await((ITextChannel)Context.Channel).DeleteMessagesAsync(messages);
                const int delay = 2000;
                var       m     = await ReplyAsync(
                    embed : await EmbedHandler.BasicEmbed("Cleaning is complete.", $"{num} have been deleted.", Color.Green));

                await LogService.LogInfoAsync("CLEAN", $"{num} messages have been deleted!");

                await Task.Delay(delay);

                await m.DeleteAsync();
            }
        }
예제 #2
0
        public async Task HelpCommand()
        {
            await Context.User.SendMessageAsync(
                embed : await EmbedHandler.BasicEmbed("Commands:",
                                                      "**General:**\n" +
                                                      "help - Shows a list of all commands.\n " +
                                                      "delete, clean - Removes messages in a channel.\n " +
                                                      $"Prefix: {ConfigData.Config.DefaultPrefix}\n\n" +
                                                      "**Music:**\n" +
                                                      "join - Connects a bot to a voice channel.\n " +
                                                      "leave - Disconnects the bot from the voice channel.\n " +
                                                      "play - Plays a song by a given search or url.\n " +
                                                      "pause - Pauses the current track.\n" +
                                                      "resume - Resumes the current track.\n" +
                                                      "stop - Stops playing music and clears the playlist.\n " +
                                                      "skip - Skips the current track.\n" +
                                                      "list -  Outputs a queue of tracks.\n " +
                                                      "nowplaying -  Displays currently playing music.\n " +
                                                      "remove  -  Removes a specific track from the queue.\n" +
                                                      "loop - Loops the current track.\n" +
                                                      "looplist - Loops the entire queue.\n" +
                                                      "volume -  Changes the volume of the bot (from 0 to 150).", ConfigData.Config.Yuna));

            var items = await Context.Channel.GetMessagesAsync(1).FlattenAsync();

            await(Context.Channel as SocketTextChannel).DeleteMessagesAsync(items);
        }