示例#1
0
 private async Task defaultavatar(params string[] args)
 {
     if (args.Length == 0)
     {
         await ReplyAsync($"Heres your default avatar! {Context.User.GetDefaultAvatarUrl()}");
     }
     if (args.Length == 1) //Makes sure that there isn't an @everyone or a @here to prevent a mass-ping through the bot.
     {
         if (args[0].Contains("@everyone") | args[0].Contains("@here"))
         {
             await ReplyAsync("Tsk Tsk");
         }
         else
         {
             if (args[0].Contains("@")) //Checks to see if there was any ping by looking to see if there was an @
             {
                 ulong      userid = MentionUtils.ParseUser(args[0]);
                 SocketUser user   = Program._client.GetUser(userid);
                 await ReplyAsync($"{Program._client.GetUser(userid).Username}'s avatar is {user.GetDefaultAvatarUrl()}");
             }
             else
             {
                 await ReplyAsync("You have to mention someone to get their avatar!");
             }
         }
     }
     if (args.Length == 2 | args.Length > 2)
     {
         await ReplyAsync("Mention only one user!");
     }
 }
示例#2
0
 private async Task slap(params string[] args)
 {
     if (args.Length > 2 | args.Length == 2)
     {
         await ReplyAsync("Only mention one user!");
     }
     if (args.Length == 0)
     {
         await ReplyAsync($"<@{Context.User.Id}>... Slapped themself?");
     }
     if (args.Length == 1)
     {
         if (args[0].Contains("@everyone") | args[0].Contains("@here"))
         {
             await ReplyAsync("Tsk Tsk");
         }
         else
         {
             if (args[0].Contains("@"))
             {
                 ulong    CLIENTID    = MentionUtils.ParseUser(args[0]);
                 string[] listofslaps = { $"<@{Context.User.Id}> just slapped {Program._client.GetUser(CLIENTID)}!", $"<@{Context.User.Id}> slaps {Program._client.GetUser(CLIENTID)} around with a large trout!" };
                 Random   rand        = new Random();
                 int      index       = rand.Next(listofslaps.Length);
                 await ReplyAsync($"{listofslaps[index]}");
             }
             else
             {
                 await ReplyAsync("You need to mention someone to slap them!");
             }
         }
     }
 }
示例#3
0
        public async Task AvatarAsyc(string id)
        {
            SocketGuildUser user;
            var             stopwatch = new Stopwatch();

            stopwatch.Start();
            try
            {
                var b = MentionUtils.ParseUser(id);
                user = Context.Guild.GetUser(b);
            }
            catch (Exception)
            {
                user = Context.Guild.GetUser(Convert.ToUInt64(id));
            }

            await ReplyAsync(embed : new EmbedBuilder()
            {
                Title    = user.Username + "'s Avatar!",
                ImageUrl = user.GetAvatarUrl(),
                Footer   = new EmbedFooterBuilder()
                {
                    Text    = $" - Requested by {Context.User.Username} - Done in 0.{stopwatch.ElapsedMilliseconds}s!",
                    IconUrl = Context.User.GetAvatarUrl()
                }
            }.Build());

            stopwatch.Stop();
        }
示例#4
0
 private async Task defaultavatar(params string[] args)
 {
     if (args.Length == 0)
     {
         await ReplyAsync($"Heres your default avatar! {Context.User.GetDefaultAvatarUrl()}");
     }
     if (args.Length == 1)
     {
         if (args[0].Contains("@everyone") | args[0].Contains("@here"))
         {
             await ReplyAsync("Tsk Tsk");
         }
         else
         {
             if (args[0].Contains("@"))
             {
                 ulong      userid = MentionUtils.ParseUser(args[0]);
                 SocketUser user   = Program._client.GetUser(userid);
                 await ReplyAsync($"{Program._client.GetUser(userid)}'s avatar is {user.GetDefaultAvatarUrl()}");
             }
             else
             {
                 await ReplyAsync("You have to mention someone to get their avatar!");
             }
         }
     }
     if (args.Length == 2 | args.Length > 2)
     {
         await ReplyAsync("Mention only one user!");
     }
 }
示例#5
0
        public async Task FakeSniperAsyc(string id, [Remainder] string msg)
        {
            SocketGuildUser user;

            try
            {
                var b = MentionUtils.ParseUser(id);
                user = Context.Guild.GetUser(b);
            }
            catch (Exception)
            {
                user = Context.Guild.GetUser(Convert.ToUInt64(id));
            }
            await ReplyAsync(embed : new EmbedBuilder()
            {
                Author = new EmbedAuthorBuilder()
                {
                    Name    = user.Username,
                    IconUrl = user.GetAvatarUrl()
                },
                Description = msg,
                Footer      = new EmbedFooterBuilder()
                {
                    Text = "1/10 • Today at " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "!"
                }
            }.Build());
        }
示例#6
0
        /// <summary>
        /// Transfers credits from sender to target receiver
        /// </summary>
        /// <param name="context">Sender, typically the one who initiated the command</param>
        /// <param name="targetUser">A @mention of the receiver</param>
        /// <param name="amount">Amount to send to the receiver</param>
        /// <returns></returns>
        public static async Task TransferCredits(SocketCommandContext context, string targetUser, long amount)
        {
            if (amount <= 0)
            {
                await context.Message.Author.SendMessageAsync(UserInteraction.BoldUserName(context) + ", you must send **1 or more** Credits**");
            }
            else if (GetUserCredits(context) - amount < 0)
            {
                await context.Message.Author.SendMessageAsync(UserInteraction.BoldUserName(context) + ", you do not have enough money to send || **" + UserBankingHandler.CreditCurrencyFormatter(GetUserCredits(context)) + " Credits**");
            }
            else
            {
                long taxAmount = UserCreditsTaxHandler.TaxCollector(amount);

                var recipient = context.Guild.GetUser(MentionUtils.ParseUser(targetUser));

                //Check if recipient has a profile
                UserBankingHandler.CheckIfUserCreditProfileExists(recipient);

                //Subtract money from sender
                AddCredits(context, -amount);

                //AddCredits credits to receiver
                AddCredits(context, MentionUtils.ParseUser(targetUser), amount - taxAmount);

                //Send receipts to both parties
                var embedBuilder = new EmbedBuilder()
                                   .WithTitle("Transaction Receipt")
                                   .WithDescription("​")
                                   .WithColor(new Color(68, 199, 40))
                                   .WithFooter(footer => {
                })
                                   .WithAuthor(author => {
                    author
                    .WithName("Duck Banking Inc.")
                    .WithIconUrl("https://freeiconshop.com/wp-content/uploads/edd/bank-flat.png");
                })
                                   .AddInlineField("Sender", context.Message.Author.ToString().Substring(0, context.Message.Author.ToString().Length - 5))
                                   .AddInlineField("Id", context.Message.Author.Id)
                                   .AddInlineField("Total Amount", $"-{UserBankingHandler.CreditCurrencyFormatter(amount)}")

                                   .AddInlineField("Recipient", recipient.ToString().Substring(0, recipient.ToString().Length - 5))
                                   .AddInlineField("​", recipient.Id)
                                   .AddInlineField("​", UserBankingHandler.CreditCurrencyFormatter(amount))

                                   .AddInlineField("​", "​")
                                   .AddInlineField("​", "​")
                                   .AddInlineField("Deductions", $"{UserBankingHandler.CreditCurrencyFormatter(taxAmount)} ({double.Parse(SettingsManager.RetrieveFromConfigFile("taxRate")) * 100}% Tax) \n \n -------------- \n {UserBankingHandler.CreditCurrencyFormatter(amount - taxAmount)}");

                var embed = embedBuilder.Build();

                await context.Message.Author.SendMessageAsync("", embed : embed).ConfigureAwait(false);

                await recipient.SendMessageAsync("", embed : embed).ConfigureAwait(false);
            }
        }
示例#7
0
        public static ulong ExtractUserMention(ref string message)
        {
            Match match = new Regex("<@!\\d+>").Match(message);

            if (match.Success)
            {
                message = string.Join(' ', message.Split(match.Value).Select(x => x.Trim())).Trim();
                return(MentionUtils.ParseUser(match.Value));
            }

            return(0);
        }
示例#8
0
        private async Task penis(params string[] args)
        {
            //State config.disabledpenis
            bool setpenison = true;

            config = JsonConvert.DeserializeObject <BotConfig>(File.ReadAllText("config.json"));
            string disabledpenis = config.disabledpenis;

            if (config.disabledpenis == "1" && Context.Guild.Id == 687875961995132973)
            {
                // If pp command is disabled, and the guild is Unlimited it will return.
                await ReplyAsync("Penis commands have been disabled, sorry!");

                return;
            }

            var pp = JsonConvert.DeserializeObject <PPSize>(File.ReadAllText("ppsize.json"));

            //just generate random number and set that num to ppnum
            string[] penisquotes = { "8D", "8=D", "8==D", "8===D", "8====D", "8=====D", "8======D", "8=======D", "8========D", "8=========D", "8=========D", "8==========D" }; //All the different penises that it can send.
            Random   rand        = new Random();                                                                                                                               //Creates a random veriable
            int      RandomID    = rand.Next(1, 11);                                                                                                                           //Select one of the two options that it can pick from
            int      ppnum       = RandomID;                                                                                                                                   //Saves the RandomID to ppnum.

            ulong ppUserId;

            switch (args.Length)
            {
            case 0:
                ppUserId = Context.User.Id;
                break;

            case 1:
                ppUserId = MentionUtils.ParseUser(args[0]);     //Takes the UserID from mention and saves it to ClientID
                break;

            default:
                await ReplyAsync($"Only have one input argument, you currently have {args.Length}, you're only supposed to have 1!");

                return;
            }

            if (pp.ppsize.ContainsKey(ppUserId))
            {
                ppnum = pp.ppsize[ppUserId];
            }
            else
            {
                pp.ppsize.Add(ppUserId, ppnum);
                File.WriteAllText("ppsize.json", JsonConvert.SerializeObject(pp));
            }
            await ReplyAsync($"<@{ppUserId}>'s penis size is {penisquotes[ppnum]}");
        }
示例#9
0
        public async Task KickUserAsync(string mention = null, [Remainder] string reason = null)
        {
            IGuildUser user;

            user = Context.Guild.GetUser(MentionUtils.ParseUser(mention));
            var b = new Discord.EmbedBuilder();

            b.WithTitle("User Kicked");
            b.WithDescription(user.Username + "was kicked.");
            await Context.Channel.SendMessageAsync("", false, b.Build());

            await user.KickAsync();
        }
示例#10
0
            public async Task CleanMessagesAsync(int messageAmount, string deleteAuthorTarget = null)
            {
                //Get messages of n amount
                var messages = await Context.Channel.GetMessagesAsync(messageAmount).Flatten();

                //If delete author target is not assigned, delete n messages, if assigned, delete n messages from author
                if (!string.IsNullOrEmpty(deleteAuthorTarget))
                {
                    ulong deleteAuthorID   = MentionUtils.ParseUser(deleteAuthorTarget);
                    var   selectedMessages = messages.Where(p => p.Author.Id == deleteAuthorID);
                    await Context.Channel.DeleteMessagesAsync(selectedMessages);
                }
                else
                {
                    await Context.Channel.DeleteMessagesAsync(messages);
                }
            }
示例#11
0
        public async Task TimeBanAsync(string user, int day, int hour, int minutes, int seconds)
        {
            var id  = MentionUtils.ParseUser(user);
            var ban = Context.Guild.GetUser(id);
            await Context.Message.AddReactionAsync(new Emoji("✅"));

            var ts = new TimeSpan(day, hour, minutes, seconds);
            await Task.Run(async() =>
            {
                try
                {
                    await Task.Delay((int)ts.TotalMilliseconds);
                }
                catch (Exception e)
                {
                    await ReplyAsync(e.Message);
                }
                await ReplyAsync("DONE");
            });
        }
示例#12
0
        public async Task UserAvatarAsync(string mention = null)
        {
            IUser user;

            if (mention == null)
            {
                user = Context.User;
            }
            else
            {
                user = Context.Guild.GetUser(MentionUtils.ParseUser(mention));
            }

            var b = new Discord.EmbedBuilder();

            b.WithTitle(user.Username + "'s Avatar");
            b.WithImageUrl(user.GetAvatarUrl());
            await Context.Channel.SendMessageAsync("", false, b.Build());

            //await Context.Channel.SendMessageAsync(user.Username);
        }
示例#13
0
 private async Task avatar(params string[] args)
 {
     if (args.Length == 0)
     {
         string avatarurl = Context.User.GetAvatarUrl();
         await ReplyAsync($"Heres your avatar! {avatarurl}");
     }
     if (args.Length == 1)
     {
         if (args[0].Contains("@everyone") | args[0].Contains("@here")) //Makes sure that there isn't an @everyone or a @here to prevent a mass-ping through the bot.
         {
             await ReplyAsync("Tsk Tsk");
         }
         else
         {
             if (args[0].Contains("@"))                               //Checks to see if there was any ping by looking to see if there was an @
             {
                 ulong      userid = MentionUtils.ParseUser(args[0]); //Parses the mention to get a userid
                 SocketUser user   = Program._client.GetUser(userid); //Defines a SocketUser based on that userid
                 if (user.GetAvatarUrl() == null)                     //If the user doesn't have an avatar
                 {
                     await ReplyAsync($"{Program._client.GetUser(userid).Username}'s avatar is {user.GetDefaultAvatarUrl()}");
                 }
                 else //If the user *does* have an avatar
                 {
                     await ReplyAsync($"{Program._client.GetUser(userid).Username}'s avatar is {user.GetAvatarUrl()}");
                 }
             }
             else //If there was *not* an @
             {
                 await ReplyAsync("You have to mention someone to get their avatar!");
             }
         }
     }
     if (args.Length == 2 | args.Length > 2)
     {
         await ReplyAsync("Mention only one user!");
     }
 }
示例#14
0
        public async Task KickAsync(string user, [Remainder] string reason)
        {
            var id  = MentionUtils.ParseUser(user);
            var ban = Context.Guild.GetUser(id);
            await Context.Message.AddReactionAsync(new Emoji("✅"));

            var loading = new LoadingUtils();
            await Task.Run(async() =>  //Task.Run automatically unwraps nested Task types!
            {
                await Task.Delay(2000);
                var w = await ReplyAsync(embed: new EmbedBuilder()
                {
                    Title    = "Processing!",
                    ImageUrl = loading.FetchRandomGIF()
                }.Build());
                await Task.Delay(3000);
                await w.DeleteAsync();
                try
                {
                    await ban.KickAsync(reason);
                    await ReplyAsync(embed: new EmbedBuilder()
                    {
                        Title       = "Success!",
                        Description = "Kicked User: "******" because " + reason + "!",
                        ImageUrl    = "https://thumbs.gfycat.com/QuaintLikelyFlyingfish-size_restricted.gif"
                    }.Build());
                }
                catch (Exception e)
                {
                    await ReplyAsync(embed: new EmbedBuilder()
                    {
                        Title       = "ERROR!",
                        Description = e.Message,
                        ImageUrl    = "https://media.tenor.com/images/21aa6ef4312e1abcd50ffca5e1d4dd75/tenor.gif"
                    }.Build());
                }
            });
        }
示例#15
0
        public async Task UserInfoAsync(string mention = null)
        {
            IUser user;

            if (mention == null)
            {
                user = Context.User;
            }
            else
            {
                user = Context.Guild.GetUser(MentionUtils.ParseUser(mention));
            }

            var b = new Discord.EmbedBuilder();

            b.WithTitle("User Info");
            b.WithDescription("Name: " + user.Username + "\n" +
                              "ID: " + user.ToString() + "\n" +
                              "UID: " + user.Id + "\n" +
                              "Status: " + user.Status + "\n" +
                              "Current Activity: " + user.Activity + "\n");
            await Context.Channel.SendMessageAsync("", false, b.Build());
        }
示例#16
0
        public async Task UserInfoAsync(string id = null)
        {
            try
            {
                SocketGuildUser user;
                var             stpwatch = new Stopwatch();
                stpwatch.Start();
                if (id == null)
                {
                    user = Context.Guild.GetUser(Context.User.Id);
                }
                else
                {
                    try
                    {
                        var b = MentionUtils.ParseUser(id);
                        user = Context.Guild.GetUser(b);
                    }
                    catch (Exception)
                    {
                        user = Context.Guild.GetUser(Convert.ToUInt64(id));
                    }
                }
                var joinspan        = DateTime.Now.Subtract(user.JoinedAt.HasValue ? user.JoinedAt.Value.Date : DateTime.Now);
                var premiumspan     = DateTime.Now.Subtract(user.PremiumSince.HasValue ? user.PremiumSince.Value.Date : DateTime.Now);
                var discordjoinspan = DateTime.Now.Subtract(user.CreatedAt.DateTime.Date);;
                await ReplyAsync(embed : new EmbedBuilder()
                {
                    Author = new EmbedAuthorBuilder()
                    {
                        Name    = Context.User.Username,
                        IconUrl = Context.User.GetAvatarUrl()
                    },
                    Color        = Color.Blue,
                    ThumbnailUrl = user.GetAvatarUrl(),
                    Footer       = new EmbedFooterBuilder()
                    {
                        Text    = $" - Requested By {Context.User.Username} - Done in 0.{stpwatch.ElapsedMilliseconds}s",
                        IconUrl = Context.User.GetAvatarUrl()
                    },
                    Timestamp = DateTimeOffset.Now
                }
                                 .AddField("**Joined Server at: **", user.JoinedAt.HasValue ? user.JoinedAt.Value.Date + $" - ({joinspan.Days} days ago)" : "Date Not Found")
                                 .AddField("**Account Created At: **", user.CreatedAt.DateTime.Date + $" - ({discordjoinspan.Days} days ago)")
                                 .AddField("**Username: **", user.Username)
                                 .AddField("**Discriminator: **", user.Discriminator)
                                 .AddField("**ID: **", user.Id)
                                 .AddField("**Nickname: **", user.Nickname ?? "None")
                                 .AddField("**User type: **", user.IsBot ? "Human" : "Bot")
                                 .AddField("**Roles[" + user.Roles.Count + "]: **", string.Join(", ", user.Roles))
                                 .Build());

                stpwatch.Stop();
            }
            catch (Exception e)
            {
                await ReplyAsync(embed : new EmbedBuilder()
                {
                    Title       = "An Error Occured!",
                    Description = e.Message
                }.Build());
            }
        }
示例#17
0
        public async Task SexAsync(string f****r, string victom)
        {
            var fuckerid = MentionUtils.ParseUser(f****r);
            var victomid = MentionUtils.ParseUser(victom);
            var v        = Context.Guild.GetUser(victomid);
            var f        = Context.Guild.GetUser(fuckerid);
            var sexscore = rnd.Next(100);

            if (sexscore == 0)
            {
                await ReplyAsync(
                    embed : new EmbedBuilder()
                {
                    Title = f.Username + " Absolutley Wanged the bang and " + v.Username +
                            " Ran as he tried to get her back!",
                    ImageUrl = SexUtils.FetchRandom(),
                    Footer   = new EmbedFooterBuilder()
                    {
                        Text    = "Sex Score of " + sexscore + " out of 100 || " + sexscore + "/100!",
                        IconUrl = f.GetAvatarUrl()
                    }
                }.Build()
                    );

                return;
            }
            if (sexscore == 100)
            {
                await ReplyAsync(
                    embed : new EmbedBuilder()
                {
                    Title = f.Username + " F*****g laid a whole train of pipe on " + v.Username + " For " + sexscore +
                            " Hours!",
                    ImageUrl = SexUtils.FetchRandom(),
                    Footer   = new EmbedFooterBuilder()
                    {
                        Text    = "Sex Score of " + sexscore + " out of 100 || " + sexscore + "/100!",
                        IconUrl = f.GetAvatarUrl()
                    }
                }.Build()
                    );

                return;
            }
            if (sexscore < 50)
            {
                await ReplyAsync(
                    embed : new EmbedBuilder()
                {
                    Title    = f.Username + " Laid a small salamander on " + v.Username + "!",
                    ImageUrl = SexUtils.FetchRandom(),
                    Footer   = new EmbedFooterBuilder()
                    {
                        Text    = "Sex Score of " + sexscore + " out of 100 || " + sexscore + "/100!",
                        IconUrl = f.GetAvatarUrl()
                    }
                }.Build()
                    );

                return;
            }
            if (sexscore == 50)
            {
                await ReplyAsync(
                    embed : new EmbedBuilder()
                {
                    Title = f.Username + " Hit the perfect Middle with his little wiener on " + v.Username + " For " +
                            sexscore + " Minutes!",
                    ImageUrl = SexUtils.FetchRandom(),
                    Footer   = new EmbedFooterBuilder()
                    {
                        Text    = "Sex Score of " + sexscore + " out of 100 || " + sexscore + "/100!",
                        IconUrl = f.GetAvatarUrl()
                    }
                }.Build()
                    );

                return;
            }
            await ReplyAsync(
                embed : new EmbedBuilder()
            {
                Title    = f.Username + " almost hit a home run on " + v.Username + "!",
                ImageUrl = SexUtils.FetchRandom(),
                Footer   = new EmbedFooterBuilder()
                {
                    Text    = "Sex Score of " + sexscore + " out of 100 || " + sexscore + "/100!",
                    IconUrl = f.GetAvatarUrl()
                }
            }.Build()
                );
        }
示例#18
0
        private async Task penis(params string[] args)
        {
            //State config.disabledpenis
            bool runpeniscommand;

            config = JsonConvert.DeserializeObject <BotConfig>(File.ReadAllText("config.json"));
            //string disabledpenis = config.disabledpenis;

            //Checks to see if penis command is disabled
            if (config.disabledpenis == "1")
            {
                //Checks if it's Unlimited
                if (!Context.IsPrivate && Context.Guild.Id == 687875961995132973)
                {
                    await ReplyAsync("Penis commands have been disabled, sorry!");

                    runpeniscommand = false;
                }
                //If it isn't unlimited, it'll let you through
                else
                {
                    runpeniscommand = true;
                }
            }
            else //If off in configs, send it through.
            {
                runpeniscommand = true;
            }

            //If the checks went through, and
            if (runpeniscommand == true)
            {
                /*string[] penisquotes = { "8=D", "8==D", "8===D", "8====D", "8=====D", "8======D", "8=======D", "8========D", "8=========D", "8=========D"};
                 * Random rand = new Random();
                 * int index = rand.Next(penisquotes.Length);
                 * await ReplyAsync($"{args}'s penis length is {penisquotes[index]}");*/

                var pp = JsonConvert.DeserializeObject <PPSize>(File.ReadAllText("ppsize.json"));

                //just generate random number and set that num to ppnum
                string[] penisquotes = { "8D", "8=D", "8==D", "8===D", "8====D", "8=====D", "8======D", "8=======D", "8========D", "8=========D", "8=========D", "8==========D" }; //All the different penises that it can send.
                Random   rand        = new Random();                                                                                                                               //Creates a random veriable
                int      RandomID    = rand.Next(1, 11);                                                                                                                           //Select one of the two options that it can pick from
                int      ppnum       = RandomID;                                                                                                                                   //Saves the RandomID to ppnum.
                if (args.Length == 0)                                                                                                                                              // If there isn't any mentioned users.
                {
                    ulong authorid = Context.User.Id;
                    if (pp.ppsize.ContainsKey(authorid))
                    {
                        ppnum = pp.ppsize[authorid];
                    }
                    else
                    {
                        pp.ppsize.Add(authorid, ppnum);
                        File.WriteAllText("ppsize.json", JsonConvert.SerializeObject(pp));
                    }
                    await ReplyAsync($"<@{authorid}>'s penis size is {penisquotes[ppnum]}");
                }
                if (args.Length == 1)                                              //If theres one mentioned user.
                {
                    if (args[0].Contains("@everyone") | args[0].Contains("@here")) //Checking for any everyone or here pings.
                    {
                        await ReplyAsync("Tsk Tsk");
                    }
                    else
                    {
                        ulong UserID = MentionUtils.ParseUser(args[0]); //Takes the UserID from mention and saves it to UserID
                        if (pp.ppsize.ContainsKey(UserID))
                        {
                            ppnum = pp.ppsize[UserID];
                        }
                        else
                        {
                            pp.ppsize.Add(UserID, ppnum);
                            File.WriteAllText("ppsize.json", JsonConvert.SerializeObject(pp));
                        }
                        await ReplyAsync($"{Program._client.GetUser(UserID).Username}'s penis size is {penisquotes[ppnum]}");
                    }
                }
                if (args.Length > 2 | args.Length == 2) //If theres more than one argument
                {
                    await ReplyAsync($"Only have one input argument, you currently have {args.Length}, you're only supposed to have 1!");
                }
            }
        }
示例#19
0
        private async Task penis(params string[] args)
        {
            //Defining config
            config = JsonConvert.DeserializeObject <BotConfig>(File.ReadAllText("config.json"));

            //Checks to see if penis command is disabled
            switch (config.disabledpenis)
            {
            case "1":     //If it's one, consider it disabled.
                //Checks if it's Unlimited, if it is, don't allow the penis command to run.
                if (!Context.IsPrivate && Context.Guild.Id == 687875961995132973)
                {
                    return;
                }
                break;
            }
            var pp = JsonConvert.DeserializeObject <PPSize>(File.ReadAllText("ppsize.json"));

            //just generate random number and set that num to ppnum
            string[] penisquotes = { "8D", "8=D", "8==D", "8===D", "8====D", "8=====D", "8======D", "8=======D", "8========D", "8=========D", "8=========D", "8==========D" }; //All the different penises that it can send.
            Random   rand        = new Random();                                                                                                                               //Creates a random veriable
            int      RandomID    = rand.Next(1, 11);                                                                                                                           //Select one of the two options that it can pick from
            int      ppnum       = RandomID;                                                                                                                                   //Saves the RandomID to ppnum.

            switch (args.Length)
            {
            case 0:
                ulong authorid = Context.User.Id;
                if (pp.ppsize.ContainsKey(authorid))
                {
                    ppnum = pp.ppsize[authorid];
                }
                else
                {
                    pp.ppsize.Add(authorid, ppnum);
                    File.WriteAllText("ppsize.json", JsonConvert.SerializeObject(pp));
                }
                await ReplyAsync($"<@{authorid}>'s penis size is {penisquotes[ppnum]}");

                break;

            case 1:
                if (args[0].Contains("@everyone") | args[0].Contains("@here"))     //Checking for any everyone or here pings.
                {
                    await ReplyAsync("Tsk Tsk");
                }
                else
                {
                    ulong UserID = MentionUtils.ParseUser(args[0]);     //Takes the UserID from mention and saves it to UserID
                    if (pp.ppsize.ContainsKey(UserID))
                    {
                        ppnum = pp.ppsize[UserID];
                    }
                    else
                    {
                        pp.ppsize.Add(UserID, ppnum);
                        File.WriteAllText("ppsize.json", JsonConvert.SerializeObject(pp));
                    }
                    await ReplyAsync($"{Program._client.GetUser(UserID).Username}'s penis size is {penisquotes[ppnum]}");
                }
                break;

            default:
                await ReplyAsync($"Only have one input argument, you currently have {args.Length}, you're only supposed to have 1!");

                break;
            }
        }
示例#20
0
 public async Task HandleAssignCommandAsync(IMessage message, string discordUser, string characterName)
 {
     var userId = MentionUtils.ParseUser(discordUser);
     var result = AssignCharacter(userId, characterName);
     await message.Channel.SendMessageAsync(result);
 }
示例#21
0
        public async Task UserInfoAsync(string id = null)
        {
            try
            {
                SocketGuildUser user;
                var             stpwatch = new Stopwatch();
                stpwatch.Start();
                if (id == null)
                {
                    user = Context.Guild.GetUser(Context.User.Id);
                }
                else
                {
                    try
                    {
                        var b = MentionUtils.ParseUser(id);
                        user = Context.Guild.GetUser(b);
                    }
                    catch (Exception)
                    {
                        user = Context.Guild.GetUser(Convert.ToUInt64(id));
                    }
                }
                var joinspan        = DateTime.Now.Subtract(user.JoinedAt.HasValue ? user.JoinedAt.Value.Date: DateTime.Now);
                var premiumspan     = DateTime.Now.Subtract(user.PremiumSince.HasValue ? user.PremiumSince.Value.Date: DateTime.Now);
                var discordjoinspan = DateTime.Now.Subtract(user.CreatedAt.DateTime.Date);;
                await ReplyAsync(embed : new EmbedBuilder()
                {
                    Title        = "User Info On " + user.Username,
                    Color        = _colorUtils.ColorRand(),
                    ThumbnailUrl = user.GetAvatarUrl(),
                    Footer       = new EmbedFooterBuilder()
                    {
                        Text    = $" - Requested By {Context.User.Username} - Done in 0.{stpwatch.ElapsedMilliseconds}s",
                        IconUrl = Context.User.GetAvatarUrl()
                    },
                    Timestamp = DateTimeOffset.Now
                }.AddField("Username: "******"Nickname: ", user.Nickname ?? "None")
                                 .AddField("Bot? ", user.IsBot ?":green_circle:":":red_circle:")
                                 .AddField("WebHook? ", user.IsWebhook?":green_circle:":":red_circle:")
                                 .AddField("Deafened? ", user.IsDeafened?":green_circle:":":red_circle:")
                                 .AddField("Muted? ", user.IsMuted?":green_circle:":":red_circle:")
                                 .AddField("Premium? ", user.PremiumSince.HasValue? user.Username + " Has been Premium since " + user.PremiumSince.Value + $" - ({premiumspan.Days} days ago!)":user.Username + " Is Not Premium!")
                                 .AddField("Permissions Count: ", user.Username + " Has " + user.GuildPermissions.ToList().Count + " Permissions!")
                                 .AddField("Roles Count: ", user.Username + " Has " + user.Roles.Count + " Roles!")
                                 .AddField("Hierarchy Level: ", user.Hierarchy == 2147483647 ? user.Hierarchy + " Owner/Highest Role!": user.Hierarchy.ToString())
                                 .AddField("Status: ", user.Status.ToString() == "Online" ?":green_circle:":":red_circle:")
                                 .AddField("Joined This Server at: ", user.JoinedAt.HasValue ? user.JoinedAt.Value.Date + $" - ({joinspan.Days} days ago!)" : "Date Not Found")
                                 .AddField("Joined Discord on: ", user.CreatedAt.DateTime.Date + $" - ({discordjoinspan.Days} days ago!)")
                                 .AddField("Roles: ", string.Join(", ", user.Roles))
                                 .AddField("Permissions: ", string.Join(", ", user.GuildPermissions.ToList()))
                                 .Build());

                stpwatch.Stop();
            }
            catch (Exception e)
            {
                await ReplyAsync(embed : new EmbedBuilder()
                {
                    Title       = "ERROR!",
                    Description = e.Message
                }.Build());
            }
        }