示例#1
0
        public async Task SentHecks(string userm = null)
        {
            if (Context.Message.Author.IsBot)
            {
                return;
            }
            HeckGuild guild = GetContextGuild();
            IUser     dUser = null;

            if (string.IsNullOrWhiteSpace(userm))
            {
                dUser = Context.Message.Author;
            }
            else
            {
                dUser = Context.Message.MentionedUsers.FirstOrDefault();
            }
            if (dUser == null)
            {
                await ReplyAsync("Go heck yourself! You must specify a user.");

                return;
            }
            if (dUser.IsBot)
            {
                await ReplyAsync("Oh heck...That's a bot, bots are immune to hecks.");

                return;
            }
            HeckUser usr = utils.GetHeckUser(dUser.Id.ToString(), guild.ID, dUser.Username, true);
            List <HeckTextRecord> hecks = utils.GetHecksSent(usr.ID);

            if (hecks.Count > 0)
            {
                var builder = new EmbedBuilder();
                int index   = 1;
                builder.WithTitle(dUser.Username + " Hecks Sent");

                foreach (HeckTextRecord heck in hecks)
                {
                    builder.AddField(index.ToString(), heck.Value);
                    index++;
                }
                builder.WithColor(Color.Red);
                Embed embed = builder.Build();
                await Context.Channel.SendMessageAsync("", false, embed);
            }
            else
            {
                await ReplyAsync($"Could not locate hecks sent for user.");
            }
        }
示例#2
0
        public async Task Info(string userm = null)
        {
            if (Context.Message.Author.IsBot)
            {
                return;
            }
            HeckGuild guild = GetContextGuild();
            IUser     dUser = null;

            if (string.IsNullOrWhiteSpace(userm))
            {
                dUser = Context.Message.Author;
            }
            else
            {
                dUser = Context.Message.MentionedUsers.FirstOrDefault();
            }
            if (dUser == null)
            {
                await ReplyAsync("Go heck yourself! You must specify a user.");

                return;
            }
            if (dUser.IsBot)
            {
                await ReplyAsync("Oh heck...That's a bot, bots are immune to hecks.");

                return;
            }
            HeckUser      usr           = utils.GetHeckUser(dUser.Id.ToString(), guild.ID, dUser.Username, true);
            UserHeckTotal userHeckTotal = utils.GetUserHeckTotal(usr.ID);

            if (userHeckTotal != null)
            {
                await ReplyAsync($"Your current heck total weight with buffs is: " + userHeckTotal.HecksWeighted.ToString() +
                                 "\r\nYour current heck weight total is: " + userHeckTotal.WeightTotal.ToString() +
                                 "\r\nYour current heck(s) unweighted is: " + userHeckTotal.HeckTotal.ToString() +
                                 "\r\nYour available heck(s) to heck with is: " + userHeckTotal.AvailableHecks.ToString() +
                                 $"\r\n\r\nGo heck yourself, {dUser.Mention}!");
            }
            else
            {
                await ReplyAsync($"Could not locate info for user.");
            }
        }
示例#3
0
        public HeckUser GetHeckUser(string SnowFlake, int GuildID, string UserName, bool CreateIfNotExists)
        {
            HeckUser      item  = null;
            HeckUserModel model = new HeckUserModel(null);
            DataResponse  resp  = model.GetUserBySnowflakeAndGuildID(SnowFlake, GuildID);

            if (!resp.Result && CreateIfNotExists)
            {
                if (CreateHeckUser(SnowFlake, UserName, GuildID))
                {
                    resp = model.GetUserBySnowflakeAndGuildID(SnowFlake, GuildID);
                }
            }
            if (resp != null)
            {
                item = resp.Item as HeckUser;
            }
            model.Dispose();
            return(item);
        }
示例#4
0
        public async Task Heck(string userm = null, [Remainder] string Name = null)
        {
            if (Context.Message.Author.IsBot)
            {
                return;
            }
            float?Value  = 1;
            IUser dMUser = null;

            if (Context.Message.ReferencedMessage != null)
            {
                dMUser = Context.Message.ReferencedMessage.Author;
                if (Context.Message.Content == "heck u")
                {
                    Name = "For your message: " + Context.Message.ReferencedMessage.Content;
                }
                else
                {
                    string heckReason = Context.Message.Content.Replace("&heck", "");

                    Name = heckReason;
                }
            }
            else
            {
                dMUser = Context.Message.MentionedUsers.FirstOrDefault();
            }
            if (dMUser == null)
            {
                await ReplyAsync("Go heck yourself! You must specify a user.");

                return;
            }
            if (Name == null)
            {
                await ReplyAsync("Get heck'd buddy! You must specify a reason to heck this person.");

                return;
            }
            if (dMUser.IsBot)
            {
                await ReplyAsync("Oh heck...That's a bot, bots are immune to hecks.");

                return;
            }
            HeckGuild guild = GetContextGuild();
            HeckUser  usr   = utils.GetHeckUser(Context.Message.Author.Id.ToString(), guild.ID, Context.Message.Author.Username, true);
            HeckUser  mUsr  = utils.GetHeckUser(dMUser.Id.ToString(), guild.ID, dMUser.Username, true);

            if ((Value ?? 0) == 0)
            {
                Value = 1;
            }
            if ((usr.AvailableHecks - Math.Abs(Value.Value)) < 0)
            {
                await ReplyAsync("Oh heck! You have don't have enough hecks left to give for that amount of heck.");

                return;
            }

            float nnValue = Value.Value;

            if (utils.CreateHeck(usr.ID, mUsr.ID, Name, nnValue))
            {
                await ReplyAsync($"Heck u {dMUser.Mention} \"" + Name + "\". You've received " + nnValue.ToString() + " heck(s).");
            }
            else
            {
                await ReplyAsync("Oh heck that's horrible, something went wrong.");
            }
        }