public async Task View(CommandContext ctx, int ID) { var count = await ManageCharacter.GetCountAsync(Tables.Issues); if (ID > count) { await ctx.RespondAsync("I don't have that many errors asshole-"); return; } var Issue = await ManageCharacter.GetAll(new ManageCharacter.Issues() { Entry = ID }); if (Issue == null) { await ctx.RespondAsync("ID not found..."); return; } string Solved = "Unsolved"; if (Issue.Solved == ManageCharacter.Solved.yes) { Solved = "Solved"; } var Emmy = new DiscordEmbedBuilder() { Description = $"`{Issue.Title}`\n\n{Issue.Desc}" }; Emmy = Emmy.WithFooter("Issue #" + ID + $" [{Solved}]"); await ctx.RespondAsync(embed : Emmy); }
public async Task View(CommandContext ctx) { var count = await ManageCharacter.GetCountAsync(Tables.Issues); Console.WriteLine(count); string Text = "`Issues`"; while (count > 0) { var IssueGet = new ManageCharacter.Issues() { Entry = count - 1 }; var Issue = await ManageCharacter.GetAll(IssueGet); if (Issue != null) { string Solved = "Unsolved"; if (Issue.Solved == ManageCharacter.Solved.yes) { Solved = "Solved"; } Text += $"\n`→ [{Issue.Entry}] - {Issue.Title} - [{Solved}]`"; } count--; } var embed = new DiscordEmbedBuilder(); var inter = ctx.Client.GetInteractivity(); var pages = inter.GeneratePagesInEmbed(Text, SplitType.Line, embed); await inter.SendPaginatedMessageAsync(ctx.Channel, ctx.Member, pages); }
public async Task Suicide(CommandContext ctx) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); await ctx.RespondAsync($"**{Chr.Name}** *Kills themself*"); }
public async Task InvCards(CommandContext ctx) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chrs = await ManageCharacter.GetAll(ChrGet); int i = 0; var sb = new StringBuilder(); sb.Append($"`{Chrs.Name}'s Cards:`"); while (i < await ManageCharacter.GetCountAsync(Tables.Character)) { var Card = new ManageCharacter.Card() { ChrEntry = Chrs.Entry, ChrCode = i }; var Cards = await ManageCharacter.GetAll(Card); if (Cards == null) { i++; } else { var Chr = await ManageCharacter.GetAll(Card); sb.Append($"`Amount[{Chr.ChrAmount}]` **→** **[__{Chr.ChrClass}__ - __{Chr.ChrName}__ - __{Chr.ChrRace}__]**\n"); i++; } } var embed = new DiscordEmbedBuilder(); var inter = ctx.Client.GetInteractivity(); var pages = inter.GeneratePagesInEmbed(sb.ToString(), SplitType.Line, embed); await inter.SendPaginatedMessageAsync(ctx.Channel, ctx.Member, pages); }
public async Task Kiss(CommandContext ctx, DiscordUser Target) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); Accg = new AccountGet() { UID = Target.Id, GID = ctx.Guild.Id }; Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("Target have no characters."); return; } OwnGet = new OwnerGet() { UID = Target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; Own = await ManageCharacter.GetAll(OwnGet); ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr2 = await ManageCharacter.GetAll(ChrGet); await ctx.RespondAsync($"**{Chr.Name}** *kisses* **{Chr2.Name}**"); }
public async Task HealAsync(CommandContext ctx, [Description("Target")] DiscordUser target = null) { target = target ?? ctx.User; var Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("Target has no characters."); return; } var OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); if (Chr.HPC > 0 && await Helpers.Owners.CheckAsync(ctx.User.Id)) { Chr.HPC = Chr.HPM; Chr.ENC = Chr.ENM; await ManageCharacter.UpdateAsync(Chr); await ctx.RespondAsync($"**{Chr.Name} has been healed**"); return; } else if (Chr.HPC < 1) { Chr.HPC = Chr.HPM; Chr.ENC = Chr.ENM; await ManageCharacter.UpdateAsync(Chr); await ctx.RespondAsync($"**{Chr.Name} has been healed**"); return; } else { await ctx.RespondAsync("You can't use this if you aren't dead. Ask an admin for help if needed."); } }
public async Task Bless(CommandContext ctx, [RemainingText] string Target) { var target = ctx.User; var Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); if (Chr.SubClass != SubClasses.Priest) { await ctx.RespondAsync("You are not a priest"); return; } var TChr = await ManageCharacter.GetChrByName(Target); if (TChr == null) { await ctx.RespondAsync("Does not exist."); return; } var Amount = Chr.SubClassAttribute + Chr.MagicEff; await Helpers.Cast.Heal(Amount, TChr); await ctx.RespondAsync($"`{Chr.Name}` blesses `{TChr.Name}`, as they heal for `{Amount} HP`"); await Helpers.TimerChr.AddCooldown(Chr.Entry, ctx.Command.Name, 900); }
public async Task MagicAsync(CommandContext ctx, [RemainingText, Description("Target")] string target) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var Chr2 = await ManageCharacter.GetChrByName(target); if (Chr2 == null) { await ctx.RespondAsync("Does not exist."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Cdr = await Helpers.TimerChr.GetCooldown(Chr.Entry, ctx.Command.Name); if (Cdr != null) { await ctx.RespondAsync($"This is on cooldown, please wait {(Cdr.RemainingTime / 60).ToString() + " m " + (Cdr.RemainingTime - Convert.ToInt32(Cdr.RemainingTime / 60) * 60)} seconds please!"); return; } await Helpers.TimerChr.AddCooldown(Chr.Entry, ctx.Command.Name, 10); var emm = await Helpers.Attack.RollAsync(Chr, Chr2, FightOptions.Magic); await ctx.RespondAsync(embed : emm); }
public async Task HealAsync(CommandContext ctx) { var target = ctx.User; var Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Cdr = await Helpers.TimerChr.GetCooldown(Chr.Entry, ctx.Command.Name); if (Cdr != null) { await ctx.RespondAsync($"This is on cooldown, please wait {(Cdr.RemainingTime / 60).ToString() + " m " + (Cdr.RemainingTime - Convert.ToInt32(Cdr.RemainingTime / 60) * 60)} seconds please!"); return; } await Helpers.TimerChr.AddCooldown(Chr.Entry, ctx.Command.Name, 1200); Chr.HPC = Chr.HPM; Chr.ENC = Chr.ENM; await ManageCharacter.UpdateAsync(Chr); await ctx.RespondAsync($"**{Chr.Name} has been healed**"); return; }
public async Task Getcooldowns(CommandContext ctx) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); string Cdrs = "**Cooldowns:**"; foreach (var ids in Helpers.TimerChr.Cooldowns.Keys) { // Only gets (int ID, string CMD) if (Chr.Entry == ids.ID) { Cdrs += $"\n`{ids.CMD}`: "; var Cdr = await Helpers.TimerChr.GetCooldown(Chr.Entry, ids.CMD); Cdrs += $"{(Cdr.RemainingTime / 60).ToString() + " m " + (Cdr.RemainingTime - Convert.ToInt32(Cdr.RemainingTime / 60) * 60)} seconds"; } } var Embed = new DiscordEmbedBuilder(); Embed = Embed.WithAuthor(Chr.Name, null, Chr.Image); Embed = Embed.WithDescription(Cdrs); await ctx.RespondAsync(embed : Embed); }
public async Task SpeedAsync(CommandContext ctx) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var RollN = Helpers.Tools.RNG.Next(12) + 1; var Bonus = Chr.Speed; var TargetR = Helpers.Tools.RNG.Next(12) + 1 + Bonus / 2; var emmys = new DiscordEmbedBuilder(); emmys = emmys.WithAuthor($"{Chr.Name} rolls {RollN} + (speed){Bonus}\nvs\nTarget: {TargetR}"); if (RollN + Bonus > TargetR) { emmys = emmys.WithDescription("You've succeeded."); } else { emmys = emmys.WithDescription("You've failed."); } await ctx.RespondAsync(embed : emmys); }
public async Task SnapCount(CommandContext ctx, DiscordUser User = null) { User = User ?? ctx.User; var Accg = new AccountGet() { UID = User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync($"`{User.Username}` has no characters or an account."); return; } await ctx.RespondAsync($"`{User.Username}` has " + Check.Snaps + " <:snap:713788866687139913>'s"); }
public async Task AddSnap(CommandContext ctx, DiscordUser user) { var Accg = new AccountGet() { UID = user.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("That person doesn't have an Account here."); return; } Check.Snaps += 1; await ManageCharacter.UpdateAsync(Account : Check); await ctx.RespondAsync($"`{user.Username}` has broken the bot, a <:snap:713788866687139913> has been added to their account."); }
public async Task Kiss(CommandContext ctx, [RemainingText] string Target) { var Accg = new AccountGet() { UID = ctx.User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = ctx.User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Chr2 = await ManageCharacter.GetChrByName(Target); if (Chr2 == null) { await ctx.RespondAsync("No character found by that name."); return; } await ctx.RespondAsync($"**{Chr.Name}** *kisses* **{Chr2.Name}**"); }
public async Task ViewAsync(CommandContext ctx, DiscordUser Target = null) { Target = Target ?? ctx.User; var Accg = new AccountGet() { UID = Target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync($"{Target.Mention} has no characters."); return; } var OwnGet = new OwnerGet() { UID = Target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Embed = new DiscordEmbedBuilder(); Embed = Embed.WithAuthor($"{Chr.Name}"); Embed = Embed.WithThumbnailUrl(Chr.Image); Embed = Embed.WithDescription($"{Chr.Balance} Enzea"); await ctx.RespondAsync(embed : Embed); }
public async Task ViewSelf(CommandContext ctx) { var User = ctx.User; var Accg = new AccountGet() { UID = User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync($"You don't own a character."); return; } var OwnGet = new OwnerGet() { UID = User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Embed = new DiscordEmbedBuilder(); Embed = Embed.WithDescription($"[`Card`] → [__{Chr.Class} - {Chr.Name} - {Chr.Race}__]"); Embed = Embed.WithImageUrl(Chr.Image); Embed = Embed.WithFooter(Chr.Desc); await ctx.RespondAsync(embed : Embed); }
public async Task Solve(CommandContext ctx, int ID) { var count = await ManageCharacter.GetCountAsync(Tables.Issues); if (ID > count) { await ctx.RespondAsync("I don't have that many errors asshole-"); return; } var Issue = await ManageCharacter.GetAll(new ManageCharacter.Issues() { Entry = ID }); if (Issue == null) { await ctx.RespondAsync("ID not found..."); return; } Issue.Solved = ManageCharacter.Solved.yes; var Emmy = new DiscordEmbedBuilder() { Description = $"`[Solved]{Issue.Title}`\n\n{Issue.Desc}" }; Emmy = Emmy.WithFooter("Issue #" + ID); await ctx.RespondAsync(embed : Emmy); await ManageCharacter.UpdateAsync(Issue : Issue); await Task.Delay(1000 * 120); await ManageCharacter.RemoveAsync(Issue); }
public async Task EnergyBall(CommandContext ctx, DiscordUser Target = null) { var target = ctx.User; var Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); if (Chr.SubClass != SubClasses.Wizard) { await ctx.RespondAsync("You are not a Wizard"); return; } target = Target ?? ctx.User; Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("no characters."); return; } OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; Own = await ManageCharacter.GetAll(OwnGet); ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var TChr = await ManageCharacter.GetAll(ChrGet); var Amount = Chr.SubClassAttribute + Chr.MagicEff; await Helpers.Cast.Damage(Amount *2, TChr); await ctx.RespondAsync($"`{Chr.Name}` fires an energy ball at `{TChr.Name}`, as they burn for `{Amount*2} HP`"); await Helpers.TimerChr.AddCooldown(Chr.Entry, ctx.Command.Name, 1900); }
public async Task Bless(CommandContext ctx, DiscordUser Target = null) { var target = ctx.User; var Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("You have no characters."); return; } var OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Cdr = await Helpers.TimerChr.GetCooldown(Chr.Entry, ctx.Command.Name); if (Cdr != null) { await ctx.RespondAsync($"This is on cooldown, please wait {(Cdr.RemainingTime / 60).ToString() + " m " + (Cdr.RemainingTime - Convert.ToInt32(Cdr.RemainingTime / 60) * 60)} seconds please!"); return; } if (Chr.SubClass != SubClasses.Priest) { await ctx.RespondAsync("You are not a priest"); return; } target = Target ?? ctx.User; Accg = new AccountGet() { UID = target.Id, GID = ctx.Guild.Id }; Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync("no characters."); return; } OwnGet = new OwnerGet() { UID = target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; Own = await ManageCharacter.GetAll(OwnGet); ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var TChr = await ManageCharacter.GetAll(ChrGet); var Amount = Chr.SubClassAttribute + Chr.MagicEff; await Helpers.Cast.Heal(Amount, TChr); await ctx.RespondAsync($"`{Chr.Name}` blesses `{TChr.Name}`, as they heal for `{Amount} HP`"); await Helpers.TimerChr.AddCooldown(Chr.Entry, ctx.Command.Name, 900); }
public async Task SummonCard(CommandContext ctx) { var CharEntry = Helpers.Tools.RNG.Next(await ManageCharacter.GetCountAsync(Tables.Character)); var ChrGet = new ChrGet() { Entry = CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Embed = new DiscordEmbedBuilder(); Embed = Embed.WithDescription($"[`.Claim`] → [__{Chr.Class} - {Chr.Name} - {Chr.Race}__]"); Embed = Embed.WithImageUrl(Chr.Image); Embed = Embed.WithFooter(Chr.Desc); await ctx.RespondAsync(embed : Embed); ReAsk: var r = await Interactivity.WaitForStealAsync(ctx, channel : ctx.Channel); if (r == null) { goto ReAsk; } var User = r; var Accg = new AccountGet() { UID = User.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync($"You don't own a character."); goto ReAsk; } var OwnGet = new OwnerGet() { UID = User.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGets = new ChrGet() { Entry = Own.CharEntry, }; var Chrs = await ManageCharacter.GetAll(ChrGets); var Card = new ManageCharacter.Card() { ChrCode = Chr.Entry, ChrEntry = Chrs.Entry, ChrName = Chr.Name, ChrDesc = Chr.Desc, ChrRace = Chr.Race, ChrClass = Chr.Class, ChrAmount = 1, ChrImage = Chr.Image }; var Rs = await ManageCharacter.GetAll(Card); if (Rs == null) { await ctx.RespondAsync("You claimed this card for the first time!"); await ManageCharacter.InsertAsync(Card : Card); return; } Card.ChrAmount += Rs.ChrAmount; await ManageCharacter.UpdateAsync(Card : Card); await ctx.RespondAsync("You claimed this card!"); }
public async Task WorkAsync(CommandContext ctx) { var Target = ctx.User; var Accg = new AccountGet() { UID = Target.Id, GID = ctx.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { await ctx.RespondAsync($"{Target.Mention} has no characters."); return; } var OwnGet = new OwnerGet() { UID = Target.Id, GID = ctx.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Cdr = await Helpers.TimerChr.GetCooldown(Chr.Entry, "work"); if (Cdr != null) { await ctx.RespondAsync($"You have already worked, wait for {(Cdr.RemainingTime/60).ToString() + " m " + (Cdr.RemainingTime - Convert.ToInt32(Cdr.RemainingTime/60)*60)} seconds please!"); return; } var Amount = Helpers.Tools.RNG.Next(300); Chr.Balance += Amount; if (Amount < 1) { await ctx.RespondAsync("Sadly there where no jobs available- try again next time!"); } else if (Amount > 125) { var Embed = new DiscordEmbedBuilder(); Embed = Embed.WithAuthor($"{Chr.Name} worked hard and got a magnificent amount of money!"); Embed = Embed.WithDescription($"{Amount} Enzea"); await ctx.RespondAsync(embed : Embed); } else { var Embed = new DiscordEmbedBuilder(); Embed = Embed.WithAuthor($"{Chr.Name} worked and got some money!"); Embed = Embed.WithDescription($"{Amount} Enzea"); await ctx.RespondAsync(embed : Embed); } await ManageCharacter.UpdateAsync(Chr); await Helpers.TimerChr.AddCooldown(Chr.Entry, "work", 120); }
private void PostInitialize() { this.Client.Ready += (e) => { this.Client.DebugLogger.LogMessage(LogLevel.Info, nameof(this.Client), "Ready", DateTime.Now); return(Task.CompletedTask); }; this.CancellationTokenSource = new CancellationTokenSource(); AppDomain.CurrentDomain.ProcessExit += (s, e) => this.CancellationTokenSource.Cancel(); Console.CancelKeyPress += (s, e) => this.CancellationTokenSource.Cancel(); /* This way you can access the Bot object without globals */ var deps = new ServiceCollection() .AddSingleton <Bot>(f => this) .BuildServiceProvider(); var cnext = this.Client.UseCommandsNext(new CommandsNextConfiguration() { StringPrefixes = this.Config.Prefixes, CaseSensitive = false, IgnoreExtraArguments = true, Services = deps }); /* Basic command handling */ cnext.CommandErrored += async(e) => { var et = e.Exception.GetType(); if (et == typeof(CommandNotFoundException)) { return; } if (et == typeof(UserException)) { await e.Context.RespondAsync(e.Exception.Message); } else { if (et == typeof(ArgumentException) && e.Exception.Message == "Could not find a suitable overload for the command.") { await e.Context.RespondAsync($"Invalid syntax for `{e.Command.QualifiedName}`. See `{e.Context.Prefix}help {e.Command.QualifiedName}` for info on that."); return; } if (e.Exception.Message == "No matching subcommands were found, and this group is not executable.") { await e.Context.RespondAsync($"You either spelled the command wrong or it doesn't exist in specified group."); return; } if (e.Exception.GetType() == typeof(ChecksFailedException)) { var ce = (ChecksFailedException)e.Exception; foreach (var failed in ce.FailedChecks) { if (failed.GetType() == typeof(RequirePermissionsAttribute)) { // permission failed await e.Context.RespondAsync("You do not have permission to use this command."); return; } else if (failed.GetType() == typeof(CooldownAttribute)) { if (e.Exception.Message == "One or more pre-execution checks failed.") { var time = e.Command.GetType().GetCustomAttributes(typeof(CooldownAttribute), true); if (time != null) { await e.Context.RespondAsync($"The command is on cooldown. {((e.Command.ExecutionChecks[0] as CooldownAttribute).GetBucket(e.Context).ResetsAt - DateTimeOffset.UtcNow).TotalSeconds.ToString("N0")} seconds left"); } return; } } } } await e.Context.RespondAsync($"error: ```{e.Exception}```"); } }; cnext.RegisterCommands(System.Reflection.Assembly.GetExecutingAssembly()); this.Client.UseInteractivity(new InteractivityConfiguration() { Timeout = TimeSpan.FromHours(2) }); /* Put Db initialization code here */ this.Db = new Database("./Resources/database.db"); ManageCharacter.Initialize(this.Db); Helpers.Owners.InitCache(); Helpers.TimerChr.Init(this.Db); /*XP System*/ this.Client.MessageCreated += async(e) => { if (e.Guild == null) { return; } if (e.Author.IsBot) { return; } Console.WriteLine($"${e.Guild.Name} | #{e.Channel.Name} | @{e.Author.Username + "#" + e.Author.Discriminator} → {e.Message.Content}"); if (e.Channel.Name.StartsWith("darii")) { if (Helpers.Tools.RNG.Next(5) != 0) { return; } await e.Message.CreateReactionAsync(DiscordEmoji.FromUnicode(client2, "😢")); return; } var CH = await ManageCharacter.GetChannel(e.Channel.Id); if (CH == null) { return; } if (CH.Category != ChannelCategory.Rp) { return; } int XP = e.Message.Content.Count() / 100 + CH.XP; if (XP > 5) { var Accg = new AccountGet() { UID = e.Author.Id, GID = e.Guild.Id }; var Check = await ManageCharacter.GetAll(Acc : Accg); if (Check == null) { return; } var OwnGet = new OwnerGet() { UID = e.Author.Id, GID = e.Guild.Id, Slot = Check.Slot }; var Own = await ManageCharacter.GetAll(OwnGet); var ChrGet = new ChrGet() { Entry = Own.CharEntry, }; var Chr = await ManageCharacter.GetAll(ChrGet); var Cdr = await Helpers.TimerChr.GetCooldown(Chr.Entry, "xp"); if (Cdr != null) { return; } XP += Helpers.Tools.RNG.Next(20) * Chr.Level; XP = XP * 2; Chr.XP += XP; DiscordMember mem = await e.Guild.GetMemberAsync(e.Author.Id); if (Chr.XP >= Convert.ToInt32(Chr.Level * 100.57 / 4.2 * Chr.Level)) { var olvl = Chr.Level; begin: Chr.XP -= Convert.ToInt32(Chr.Level * 100.57 / 4.2 * Chr.Level); Chr.Level += 1; if (Chr.Level > 10 && Chr.Level < 15) { Chr.SP += 4; } else if (Chr.Level > 15 && Chr.Level < 20) { Chr.SP += 3; } else if (Chr.Level > 20) { Chr.SP += 2; } else { Chr.SP += 5; } if (Chr.Level > 10) { Chr.UPoints += 1; } Chr.Balance += 60; if (Chr.XP >= Convert.ToInt32(Chr.Level * 100.57 / 4.2 * Chr.Level)) { goto begin; } await ManageCharacter.UpdateAsync(Chr); await mem.SendMessageAsync($"**{Chr.Name}** Leveled! `{olvl}` → `{Chr.Level}`"); } else { await ManageCharacter.UpdateAsync(Chr); } await mem.SendMessageAsync($"**{Chr.Name}** earned `{XP}` **XP**"); await Helpers.TimerChr.AddCooldown(Chr.Entry, "xp", 120); } }; }