public async Task BalanceCommand() { if (await UserDb.CheckIfRecordExist(Context.User.Id)) { await UserDb.CreateUserProfile(new UserObject() { Id = Context.User.Id, }); } UserObject user = await UserDb.GetUserProfile(Context.User.Id); var embed = new EmbedBuilder() { Color = new Color(0xffd1dc), Title = $"{Context.User.Username}'s Flower Garden", Description = $"You currently have {user.Balance} <a:FLflower2:678622764080431114> flowers in your garden!" }; await Context.Channel.SendMessageAsync(embed : embed.Build()); }
public async Task SetBirthday(string birthday) { if (!await UserDb.CheckIfRecordExist(Context.User.Id)) { await UserDb.CreateUserProfile(new UserObject() { Id = Context.User.Id }); } UserObject user = await UserDb.GetUserProfile(Context.User.Id); user.Birthday = birthday; await UserDb.UpdateUserProfile(user); await Context.Channel.SendMessageAsync($"Updated your birthday to {birthday}"); }
public async Task BuyBackground(string id) { if (await UserDb.CheckIfRecordExist(Context.User.Id)) { await UserDb.CreateUserProfile(new UserObject { Id = Context.User.Id }); } UserObject user = await UserDb.GetUserProfile(Context.User.Id); List <BackgroundObject> backgrounds = await shop.GetBackgrounds(); int _id = Convert.ToInt32(id) - 1; if (_id == 0 || _id > (backgrounds.Count - 1)) { await Context.Channel.SendMessageAsync($"Sorry, but it looks like there is no background under the id of {_id}"); return; } var _user = Context.User as SocketGuildUser; BackgroundObject background = backgrounds[_id]; if (user.OwnBgNames.Split(" ").Contains(background.Name)) { await Context.Channel.SendMessageAsync($"It looks like you already own this background."); return; } if (background.Dev) { SocketRole role = Context.Guild.GetRole(673572050945966130); if (!_user.Roles.Contains(role)) { await Context.Channel.SendMessageAsync($"Sorry, but this is Bot Developer exclusives."); return; } user.OwnBgNames += " " + background.Name; user.OwnBgUrl += " " + background.Url; await UserDb.UpdateUserProfile(user); } else if (background.Nitro) { SocketRole role = Context.Guild.GetRole(586439609085329429); if (!_user.Roles.Contains(role)) { await Context.Channel.SendMessageAsync($"Sorry, but this is a Nitro Booster's exclusives. You must boost the server to gain access to this background."); return; } user.OwnBgNames += " " + background.Name; user.OwnBgUrl += " " + background.Url; await UserDb.UpdateUserProfile(user); } else { if (user.Balance < background.Price) { await Context.Channel.SendMessageAsync($"Sorry, but it looks like you do not have enough flowers to make this purchase. you need {background.Price - user.Balance} flowers more."); return; } user.Balance -= background.Price; user.OwnBgNames += " " + background.Name; user.OwnBgUrl += " " + background.Url; await UserDb.UpdateUserProfile(user); } await Context.Channel.SendMessageAsync($"You successfully bought {background.Name}"); }