public async Task Poke(CommandContext ctx, params string[] names)
        {
            logger.Info("Poke Command", Useful.GetDiscordName(ctx));

            string result = Basics.PokeRandom(Useful.GetOnlineNames(ctx.Channel.Guild), Useful.GetUsername(ctx));
            await ctx.RespondAsync(result).ConfigureAwait(false);
        }
        public async Task Seen(CommandContext ctx, string userName)
        {
            logger.Info("Seen Command", Useful.GetDiscordName(ctx));

            string message = Commands.Seen.CheckSeen(userName);
            await ctx.Message.RespondAsync(message).ConfigureAwait(false);
        }
        public async Task SquareText(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Square Command", Useful.GetDiscordName(ctx));

            string message = Square.SquareText(args, Useful.GetUsername(ctx));
            await ctx.RespondAsync(message).ConfigureAwait(false);
        }
        public async Task Fortune(CommandContext ctx)
        {
            logger.Info("Fortune Command", Useful.GetDiscordName(ctx));

            string message = Commands.Fortune.GetFortune(ctx.User.Id);
            await ctx.Message.RespondAsync(message).ConfigureAwait(false);
        }
        public async Task Funk(CommandContext ctx)
        {
            logger.Info("Funk Command", Useful.GetDiscordName(ctx));


            await ctx.Message.RespondAsync(Commands.Funk.PrintFunk()).ConfigureAwait(false);
        }
        public async Task Nick(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Nick Command", Useful.GetDiscordName(ctx));

            string result = Commands.Nick.NickGen(args, Useful.GetUsername(ctx));

            await ctx.RespondAsync(result).ConfigureAwait(false);
        }
        public async Task Fact(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Fact Command", Useful.GetDiscordName(ctx));

            string result = Commands.Fact.ShowFact(args, Useful.GetOnlineNames(ctx.Channel.Guild), Useful.GetUsername(ctx));

            await ctx.Message.RespondAsync(result).ConfigureAwait(false);
        }
        public async Task EventUnsubscribe(CommandContext ctx, [RemainingText] string eventName)
        {
            logger.Info("Event Unsubscribe Command", Useful.GetDiscordName(ctx));

            bool result = NotifyEventManager.UnsubscribeUserToEvent(ctx.User.Id, ctx.Guild.Id, eventName);

            string message = result ? "Removed sucessfully from " + eventName : "Error";
            await ctx.Message.RespondAsync(message).ConfigureAwait(false);
        }
        public async Task FunkAsync(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Funk Command Add", Useful.GetDiscordName(ctx));

            if (!string.IsNullOrEmpty(args))
            {
                Commands.Funk.AddFunk(args);
                await ctx.Message.RespondAsync("Funk Added").ConfigureAwait(false);
            }
        }
Beispiel #10
0
        public async Task QuoteAdd(CommandContext ctx, [RemainingText] string arg)
        {
            logger.Info("Quote Add Command", Useful.GetDiscordName(ctx));

            if (!string.IsNullOrWhiteSpace(arg))
            {
                Quotes.AddQuote(arg);
                await ctx.RespondAsync("Quote added").ConfigureAwait(false);
            }
        }
Beispiel #11
0
        public async Task Shuffle(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Shuffle Command", Useful.GetDiscordName(ctx));

            string result = Basics.Shuffle(args);

            if (!string.IsNullOrWhiteSpace(result))
            {
                await ctx.RespondAsync(result).ConfigureAwait(false);
            }
        }
Beispiel #12
0
        public async Task Trivia(CommandContext ctx)
        {
            logger.Info("Trivia Command", Useful.GetDiscordName(ctx));

            try
            {
                await ctx.Message.RespondAsync(Commands.Trivia.GetTrivia()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message, Useful.GetDiscordName(ctx));
            }
        }
Beispiel #13
0
        public async Task YoutubeSearch(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Youtube Command", Useful.GetDiscordName(ctx));

            try
            {
                string result = Youtube.YoutubeSearch(args);
                await ctx.Message.RespondAsync(result).ConfigureAwait(false);
            }
            catch (IndexOutOfRangeException)
            {
                return;
            }
        }
Beispiel #14
0
        [Description("Show or add quotes. Add argument \"add\" after the command to add quote. If a different argument is used it will perform a search. If no arguments are shown, a random quote is shown")]     // this will be displayed to tell users what this command does when they invoke help
        public async Task Quote(CommandContext ctx, [RemainingText] string arg)
        {
            logger.Info("Quote Command", Useful.GetDiscordName(ctx));

            if (arg != null && string.Compare(arg.Split(new char[] { ' ' }, 2)[0], "add", StringComparison.OrdinalIgnoreCase) == 0)  // add
            {
                Quotes.AddQuote(arg);
                await ctx.RespondAsync("Quote added").ConfigureAwait(false);
            }
            else // lookup or random
            {
                await ctx.RespondAsync(Quotes.PrintQuote(arg)).ConfigureAwait(false);
            }
        }
Beispiel #15
0
        public async Task Choose(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Choose Command", Useful.GetDiscordName(ctx));

            try
            {
                string arg    = args.Trim().Replace("  ", " ", StringComparison.OrdinalIgnoreCase);
                string result = Basics.Choose(arg, Useful.GetUsername(ctx));
                await ctx.RespondAsync(result).ConfigureAwait(false);
            }
            catch (IndexOutOfRangeException)
            {
                return;
            }
        }
Beispiel #16
0
        public async Task EventDisable(CommandContext ctx, [RemainingText] string eventName)
        {
            logger.Info("Event Disable Command", Useful.GetDiscordName(ctx));

            try
            {
                NotifyEventManager.DisableEvent(eventName);
                await ctx.Message.RespondAsync("Disabled " + eventName + " sucessfully").ConfigureAwait(false);
            }
            catch (ArgumentException ex)
            {
                await ctx.Message.RespondAsync("Error, event probably not found").ConfigureAwait(false);

                logger.Error("Error disabling event: " + ex.Message, Useful.GetDiscordName(ctx));
            }
        }
Beispiel #17
0
        public async Task RemoveCustomCommand(CommandContext ctx, string commandName)
        {
            logger.Info("removecmd Command", Useful.GetDiscordName(ctx));

            if (Useful.MemberIsBotOperator(ctx.Member) || ctx.Member.IsOwner)
            {
                if (CustomCommand.RemoveCommandByName(commandName))
                {
                    CustomCommand.SaveCustomCommands();
                    await ctx.RespondAsync("Command " + commandName + " removed.").ConfigureAwait(false);
                }
                else
                {
                    await ctx.RespondAsync("Command " + commandName + " not found.").ConfigureAwait(false);
                }
            }
        }
Beispiel #18
0
        public async Task EventDelete(CommandContext ctx, [RemainingText] string eventName)
        {
            logger.Info("Remove Event Command", Useful.GetDiscordName(ctx));

            string message;

            try
            {
                NotifyEventManager.RemoveEvent(eventName);
                message = "Event Removed.";
            }
            catch (Exception ex)
            {
                message = "Event not removed. Error: " + ex.Message;
            }

            await ctx.Message.RespondAsync(message).ConfigureAwait(false);
        }
Beispiel #19
0
        public async Task AddCustomCommand(CommandContext ctx, string commandName, [RemainingText] string format)
        {
            logger.Info("addcmd Command", Useful.GetDiscordName(ctx));

            if (CustomCommand.CommandExists(commandName) == true)
            {
                string message = "Command " + commandName + " already exists.";
                await ctx.RespondAsync(message).ConfigureAwait(false);
            }

            if (string.IsNullOrWhiteSpace(format))
            {
                return;
            }

            CustomCommand.CustomCommands.Add(new CustomCommand(ctx.User.Username, commandName, format));
            CustomCommand.SaveCustomCommands();
        }
Beispiel #20
0
        public async Task EventCreate(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Create Event Command", Useful.GetDiscordName(ctx));

            string message;

            try
            {
                NotifyEventManager.AddEvent(args);
                message = "Event added. Now activate it manually";
            }
            catch (Exception ex)
            {
                message = "Event not created, error: " + ex.Message;
            }

            await ctx.Message.RespondAsync(message).ConfigureAwait(false);
        }
Beispiel #21
0
        public async Task Roll(CommandContext ctx, int max)
        {
            logger.Info("Roll Command", Useful.GetDiscordName(ctx));

            try
            {
                int    number  = Basics.Roll(max);
                string message = Useful.GetUsername(ctx) + " rolled a " + number;
                await ctx.RespondAsync(message).ConfigureAwait(false);
            }
            catch (FormatException)
            {
                await ctx.RespondAsync("Wrong Format").ConfigureAwait(false);
            }
            catch (OverflowException)
            {
                await ctx.RespondAsync("Number too large").ConfigureAwait(false);
            }
        }
Beispiel #22
0
        public async Task Kill(CommandContext ctx, [RemainingText] string arg)
        {
            logger.Info("Kill Command", Useful.GetDiscordName(ctx));

            KillUser.KillResult result = KillUser.Kill(Useful.GetUsername(ctx), Useful.GetOnlineNames(ctx.Channel.Guild), arg);

            switch (result.IsAction)
            {
            case true:
                await ctx.RespondAsync("*" + result.Result + "*").ConfigureAwait(false);

                break;

            case false:
                await ctx.RespondAsync(result.Result).ConfigureAwait(false);

                break;
            }
        }
Beispiel #23
0
        public async Task RandomKill(CommandContext ctx)
        {
            logger.Info("rkill Command", Useful.GetDiscordName(ctx));

            KillUser.KillResult result = KillUser.KillRandom(Useful.GetUsername(ctx), Useful.GetOnlineNames(ctx.Channel.Guild));

            switch (result.IsAction)
            {
            case true:
                await ctx.RespondAsync("*" + result.Result.Trim() + "*").ConfigureAwait(false);

                break;

            case false:
                await ctx.RespondAsync(result.Result).ConfigureAwait(false);

                break;
            }
        }
Beispiel #24
0
        public async Task EventList(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("List Event Command", Useful.GetDiscordName(ctx));

            if (NotifyEventManager.NotifyEventCount() == 0)
            {
                await ctx.Message.RespondAsync("No Events saved").ConfigureAwait(false);

                return;
            }

            string[] events = NotifyEventManager.getNotifyEventDetails(!string.IsNullOrWhiteSpace(args) && args.Trim().ToLower() == "extra");

            StringBuilder builder = new StringBuilder().Append("```");

            foreach (string eventDetail in events)
            {
                builder.AppendLine(eventDetail);
            }

            builder.Append("```");
            await ctx.Message.RespondAsync(builder.ToString()).ConfigureAwait(false);
        }
Beispiel #25
0
        public async Task Ping(CommandContext ctx, string cmd, [RemainingText] string args)
        {
            logger.Info("ping Command", Useful.GetDiscordName(ctx));

            switch (cmd)
            {
            case "add":
                PingUser.PingControlAdd(ctx.Member.Id, args);
                break;

            case "remove":
                PingUser.PingControlRemove(ctx.Member.Id, args);
                break;

            case "info":
                if (ctx.Guild.Members.TryGetValue(ctx.Message.Author.Id, out DiscordMember member))
                {
                    await PingUser.PingControlInfo(member).ConfigureAwait(false);
                }
                break;
            }
            PingUser.SavePings(PingUser.Pings);
        }
Beispiel #26
0
        public async Task QuoteCount(CommandContext ctx)
        {
            logger.Info("Quote Count Command", Useful.GetDiscordName(ctx));

            await ctx.RespondAsync(Quotes.QuoteCount()).ConfigureAwait(false);
        }
Beispiel #27
0
 public async Task Quote(CommandContext ctx)
 {
     logger.Info("Quote Command: Random overload", Useful.GetDiscordName(ctx));
     await ctx.RespondAsync(Quotes.PrintQuote(null)).ConfigureAwait(false);
 }
Beispiel #28
0
        public async Task Version(CommandContext ctx)
        {
            logger.Info("Version Command", Useful.GetDiscordName(ctx));

            await ctx.Message.RespondAsync(Commands.Version.VersionString).ConfigureAwait(false);
        }