Example #1
0
        public async Task GetRandomQuoteUser(IGuildUser user)
        {
            EntityUser user2 = await GetUser(user.Id);

            Quote q = _qouteRepo.GetRandomByUser(user2.Id);
            await EmbedBuilderFunctions.DisplayQuote(q, GetGuildUsers(q).Result, Context);
        }
Example #2
0
 public async Task GetRandomQuote([Remainder] string x)
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("quote random",
                                                 new string[] { "**user**(optional,must be an @mention)" },
                                                 new string[] { $"{Program.prefix}quote random", $"{Program.prefix}quote random @exurb1a" },
                                                 Context);
 }
Example #3
0
        public async Task GetRandomQuote()
        {
            Quote q = _qouteRepo.GetRandom();

            IGuildUser[] users = await GetGuildUsers(q);

            await EmbedBuilderFunctions.DisplayQuote(q, users, Context);
        }
Example #4
0
        public async Task BanWordHelp()
        {
            EmbedBuilder eb = await EmbedBuilderFunctions.MakeHelp("BanWord command help", "This command is for banning words from being searched (weather not included)",
                                                                   "https://i.imgur.com/Zd5uncM.png", "banword", new string[] { "help", "add", "remove", "list" }, new string[] {
                "banword add This searchterm is bad m'kay", "banword remove cats are despicable", "banword help", "banword list"
            }, Context);

            await Context.Channel.SendMessageAsync(embed : eb.Build());
        }
Example #5
0
        public async Task DisplayHelp()
        {
            EmbedBuilder eb = await EmbedBuilderFunctions.MakeHelp("Quote command help",
                                                                   "A command made for the purposes of quoting",
                                                                   "https://static.thenounproject.com/png/81720-200.png", "quote", new string[] { "help", "get",
                                                                                                                                                  "random", "user", "remove" }, new string[] { "quote help", "quote add \"I wanna be called margret\" @27#2727"
                                                                                                                                                                                               , "quote remove 123456789", "quote random", "quote get 23", "quote user @Margret#0062" }, Context);

            await Context.Channel.SendMessageAsync(embed : eb.Build());
        }
Example #6
0
 public async Task TransferCurrency()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("currency transfer",
                                                 new string[] { "**amount**(required, in case of decimal use a ,)\n",
                                                                "**currency**(required Currency you want to exchange (use -cu c for a list of available currencies))",
                                                                "\n**user**(required, must be an @ mention)" },
                                                 new string[] { "currency transfer 100 entropy @Margret#0027",
                                                                "cu tr 100 e @Margret#0027", "currency transfer 10,2 complexity @Margret#0027",
                                                                "cu tr 10,2 c @Margret#0027" },
                                                 Context);
 }
Example #7
0
 public async Task TradeCurrency()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("currency exchange",
                                                 new string[] { "**amount**(required use a , for comma number) ",
                                                                "**currency**(required Currency you want to exchange (use -cu c for a list of available currencies))",
                                                                "**currency**(required Currency you want to convert to)" },
                                                 new string[] { $"{Program.prefix}currency exchange 0,02 Complexity Entropy",
                                                                $"{Program.prefix}cu e 0,02 C E",
                                                                $"{Program.prefix}cu e 200 E C",
                                                                $"{Program.prefix}currency exchange 200 Entropy Complexity" },
                                                 Context
                                                 );
 }
Example #8
0
        public async Task GetQuote(string qId)
        {
            string qfid = qId.Replace("#", "");

            if (Int32.TryParse(qfid, out int j))
            {
                Quote q = _qouteRepo.GetQuoteById(j);
                await EmbedBuilderFunctions.DisplayQuote(q, GetGuildUsers(q).Result, Context);
            }
            else
            {
                await GetQuote();
            }
        }
Example #9
0
 public async Task RemoveBanWord(string word)
 {
     if (word != null && word.Trim().Length != 0)
     {
         _repo.RemoveBannedWord(word);
         _repo.SaveChanges();
         await Context.Channel.SendMessageAsync($"**{word.RemoveAbuseCharacters()}** removed and is now searchable");
     }
     else
     {
         await EmbedBuilderFunctions.GiveErrorSyntax("banword remove", new string[] { "word(required)" },
                                                     new string[] { "banword remove kitties are now unbanned" }, Context);
     }
 }
Example #10
0
 public async Task AddBanWord(string word)
 {
     if (word != null && word.Trim().Length != 0)
     {
         _repo.AddWord(word.ToLower());
         _repo.SaveChanges();
         await Context.Channel.SendMessageAsync($"**{word.RemoveAbuseCharacters()}** banned from being searched");
     }
     else
     {
         await EmbedBuilderFunctions.GiveErrorSyntax("banword add", new string[] { "word(required)" },
                                                     new string[] { "banword add kitties are now banned" }, Context);
     }
 }
Example #11
0
        private async Task ReactionAdded(Cacheable <IUserMessage, ulong> ch, ISocketMessageChannel chanel, SocketReaction reaction)
        {
            IUserMessage msg = await ch.GetOrDownloadAsync();

            if (msg == null)
            {
                return;
            }

            if (QuoteModule._trackedQuoteList.Keys.Contains(msg.Id) && !reaction.User.Value.IsBot)
            {
                if (reaction.Emote.Name == "✅")
                {
                    await chanel.DeleteMessageAsync(msg.Id);

                    QuoteModule._trackedQuoteList.Remove(msg.Id);
                }
                else
                {
                    //add to file
                    File.AppendAllLines(fileName, new string[] { QuoteModule._trackedQuoteList[msg.Id].Id.ToString() });
                    await chanel.DeleteMessageAsync(msg.Id);

                    QuoteModule._trackedQuoteList.Remove(msg.Id);
                }
            }

            if (reaction.Emote.Name == "💬" && !msg.Author.IsBot)
            {
                try {
                    await QuoteModule.BotAddQuote(_services.GetService <IQouteRepository>(),
                                                  _services.GetService <IScoreRepository>(), _services.GetService <IUserRepository>(),
                                                  chanel, msg.Content, msg.Id, reaction.User.GetValueOrDefault(null) as IGuildUser
                                                  , msg.Author as IGuildUser, msg.Timestamp.DateTime);
                }
                catch (Exception e) {
                    if (e.GetType().Equals(typeof(QuotingYourselfException)))
                    {
                        await msg.Channel.SendMessageAsync("A bit narcissistic to quote yourself, no?");
                    }
                    else
                    {
                        await EmbedBuilderFunctions.UnhandledException(e.Message, msg.Channel as ISocketMessageChannel);
                    }
                }
            }
        }
Example #12
0
        public async Task QuickPoll([Remainder] string question)
        {
            var res = await Context.Channel.SendMessageAsync(
                embed : EmbedBuilderFunctions.MakeEmbedPoll(question, Context).Build()
                );

            IEmote check        = new Emoji("✅");
            IEmote questionMark = new Emoji("❔");
            IEmote indif        = new Emoji("➖");
            IEmote cross        = new Emoji("❌");

            await res.AddReactionsAsync(new IEmote[] { check, cross, indif, questionMark });

            var bot = await Context.Channel.GetUserAsync(Context.Client.CurrentUser.Id) as IGuildUser;

            var permissions = bot.GetPermissions(Context.Guild.GetChannel(Context.Message.Channel.Id));

            if (permissions.ManageMessages)
            {
                await Context.Message.DeleteAsync();
            }
        }
Example #13
0
 public async Task RemoveQuote()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("quote remove",
                                                 new string[] { "**quoteId**(required) " },
                                                 new string[] { $"{Program.prefix}quote remove 5 " }, Context);
 }
Example #14
0
 public async Task GetQuote()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("quote get",
                                                 new string[] { "(#-optional)**quoteId**(required must be a number) " },
                                                 new string[] { $"{Program.prefix}quote get 7", $"{Program.prefix}quote get #7" }, Context);
 }
Example #15
0
 public async Task GetRandomQuoteUser()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("quote user",
                                                 new string[] { "**user**(required must be @mention)" },
                                                 new string[] { $"{Program.prefix}quote user @exurb1a" }, Context);
 }
Example #16
0
 public async Task Commands([Remainder] string _ = "")
 {
     await EmbedBuilderFunctions.GiveAllCommands(_cc, Context);
 }
Example #17
0
 public async Task Mention()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("stream", new string[] { "**name**(required)", "**url**(optional,needs to be from twitch)" },
                                                 new string[] { $"{Program.prefix}stream \"existential despair\"",
                                                                $"{Program.prefix}stream \"existential despair\" \"https://www.twitch.tv/directory/game/Depression%20Quest\"" }, Context);
 }
Example #18
0
 public async Task QuickPoll()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("qp", new string[] { "**name**(required)" },
                                                 new string[] { $"{Program.prefix}qp Is the milk gone?" }, Context);
 }
Example #19
0
 public async Task AddQuote()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("quote add",
                                                 new string[] { "**quote**(required must be between \"\") ", "**user**(required must be @mention)" },
                                                 new string[] { $"{Program.prefix}quote add \"Why is the milk gone\" @exurb1a" }, Context);
 }
Example #20
0
 private async Task ListCommands(ICommandContext context)
 {
     await EmbedBuilderFunctions.GiveAllCommands(_commands, context, "Unkown Command");
 }
Example #21
0
 public async Task SetLocation()
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("weather search", new string[] { "**Location name**(required)" },
                                                 new string[] { $"{Program.prefix}w set Birmingham", $"{Program.prefix}weather set Birmingham" },
                                                 Context);
 }
Example #22
0
 public async Task Insult([Remainder] string s = "")
 {
     await EmbedBuilderFunctions.GiveErrorSyntax("Insult", new string[] { "**name**(@ mention,required)" },
                                                 new string[] { $"{Program.prefix}Insult @Exurb1aBot#0069" }, Context);
 }
Example #23
0
        private async Task SendException(string ex, ISocketMessageChannel channel)
        {
            switch (ex)
            {
            case "There are no quotes in the server, Wow quote more losers":
                await channel.SendMessageAsync(ex);

                break;

            case "Empty Quote":
                await channel.SendMessageAsync("What's the point in adding something empty huh?");

                break;

            case "We couldn't find the user":
                await channel.SendMessageAsync("I couldn't find this user, are you sure it's not an imaginary friend?");

                break;

            case "No quotes found":
                await channel.SendMessageAsync("This user has no quotes, wow talk more loser.");

                break;

            case "we couldn't find the quote":
                await channel.SendMessageAsync("I couldn't find the quote you're looking for.");

                break;

            case "Image not found":
                await channel.SendMessageAsync("I couldn't find any images matching your request, sorry chap...");

                break;

            case "We couldn't find a location":
                await channel.SendMessageAsync("We couldn't find the location, or perhaps you were searching for Birmingham ya drugie.");

                break;

            case "word already banned":
                await channel.SendMessageAsync("Banning a word twice won't unban it ;) ");

                break;

            case "There is no location set":
                await channel.SendMessageAsync("You don't have a location set you dummy, " +
                                               $"use the command `{prefix}weather set`");

                break;

            case "word not banned":
                await channel.SendMessageAsync($"This word is not in the banlist. To view the list use `{prefix}banword list`");

                break;

            case "You're trying to quote yourself":
                await channel.SendMessageAsync("A bit narcissistic to quote yourself, no?");

                break;

            default:
                await EmbedBuilderFunctions.UnhandledException(ex, channel);

                break;
            }
        }
Example #24
0
 public async Task Commands()
 {
     await EmbedBuilderFunctions.GiveAllCommands(_cc, Context);
 }