diff --git a/Kehyeedra3/Bot.cs b/Kehyeedra3/Bot.cs index f3d2b37..2c68425 100644 --- a/Kehyeedra3/Bot.cs +++ b/Kehyeedra3/Bot.cs @@ -57,14 +57,15 @@ namespace Kehyeedra3 //Clockboy = new System.Timers.Timer(); WeebClient = new WebClient(); - + _bot = new DiscordSocketClient(new DiscordSocketConfig() { LogLevel = LogSeverity.Verbose, DefaultRetryMode = RetryMode.AlwaysRetry, HandlerTimeout = 10000, - ConnectionTimeout = 10000 - }); + ConnectionTimeout = 10000, + GatewayIntents = GatewayIntents.AllUnprivileged | GatewayIntents.GuildMembers | GatewayIntents.GuildMessages + }) ; AudioService = new AudioService(); diff --git a/Kehyeedra3/Commands/Admin.cs b/Kehyeedra3/Commands/Admin.cs index dc13570..797ee6d 100644 --- a/Kehyeedra3/Commands/Admin.cs +++ b/Kehyeedra3/Commands/Admin.cs @@ -201,6 +201,11 @@ namespace Kehyeedra3.Commands guild.Changenick = true; } break; + case "schizogame": + { + guild.Schizogame = true; + } + break; } await Database.SaveChangesAsync(); await ReplyAsync($"{Context.User.Mention}\nEnabled {feature}"); @@ -228,7 +233,12 @@ namespace Kehyeedra3.Commands guild.Changenick = false; } break; - } + case "schizogame": + { + guild.Schizogame = false; + } + break; + } await Database.SaveChangesAsync(); await ReplyAsync($"{Context.User.Mention}\nDisabled {feature}"); } @@ -395,7 +405,7 @@ namespace Kehyeedra3.Commands public async Task ButtonTest() // button testing { var components = new ComponentBuilder().WithButton("cum", "cum").WithButton("piss", "piss"); - await Context.Channel.SendMessageAsync($"Greetings traveler, I've potions for you to purchase, what'd you like to have?",component:components.Build()); + await Context.Channel.SendMessageAsync($"Greetings traveler, I've potions for you to purchase, what'd you like to have?",components:components.Build()); } [RequireRolePrecondition(AccessLevel.ServerAdmin)] @@ -597,7 +607,7 @@ namespace Kehyeedra3.Commands if (fish == null) { - await Context.Channel.SendMessageAsync("No fish with that name retarb, chenk input and try again, or cry to mommy"); + await Context.Channel.SendMessageAsync("No fish with that name retarb, chenk input and try again, or cry to mmomijji (CHRISMAS IN JUYLL!!!!!)"); return; } } @@ -611,5 +621,30 @@ namespace Kehyeedra3.Commands outputStream.Position = 0; await Context.Channel.SendFileAsync(outputStream, $"card.{outFormat}"); } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] + [Command("szconfig"),Summary("szsetlogchannel, szsetchannel, szsetwitchrole")] + public async Task ConfigureServerSpecific(string command, string option = null) + { + command = command.ToLowerInvariant(); + var Database = new ApplicationDbContextFactory().CreateDbContext(); + var guild = Database.Guilds.FirstOrDefault(x => x.Id == Context.Guild.Id); + if (command == "setlogchannel") + { + guild.SchizoLogChannel = Context.Channel.Id; + await ReplyAsync($"Set current channel as schizo log channel."); + } + if (command == "setchannel") + { + guild.SchizoChannel = Context.Channel.Id; + await ReplyAsync($"Set current channel as schizo bot channel."); + } + if (command == "setwitchrole") + { + guild.WitchRole = Convert.ToUInt64(option); + await ReplyAsync($"Set <@&{option}> as witch role."); + } + await Database.SaveChangesAsync(); + } + } } diff --git a/Kehyeedra3/Commands/Stuff.cs b/Kehyeedra3/Commands/Stuff.cs index c2afe3e..db21dfc 100644 --- a/Kehyeedra3/Commands/Stuff.cs +++ b/Kehyeedra3/Commands/Stuff.cs @@ -410,6 +410,84 @@ namespace Kehyeedra3.Commands } } + [Command("schizo"),Alias("sz"), Summary("Replaces your message with a red or blue variant, for use with funny seacat schizo game. There's also an orange for posting the 'original story'")] + public async Task SchizoGame(string colour, [Remainder]string message) + { + using var Database = new ApplicationDbContextFactory().CreateDbContext(); + var guild = Database.Guilds.FirstOrDefault(x => x.Id == Context.Guild.Id); + string msg = ""; + if (guild == null) + { + guild = new Guild + { + Id = Context.Guild.Id + }; + Database.Guilds.Add(guild); + } + if (!guild.Schizogame) + { + await ReplyAsync($"{Context.User.Mention}\nThis command can be enabled by an admin on the server."); + return; + } + if (Context.Channel.Id == 0) + { + await ReplyAsync($"{Context.User.Mention}\nYou gots to set the schizo channel??"); + return; + } + if (Context.Channel.Id != guild.SchizoChannel) + { + await ReplyAsync($"{Context.User.Mention}\nWrong channel??"); + return; + } + colour = colour.ToLowerInvariant(); + + if (colour == "red" || colour == "r") + { + var guser = Context.User as IGuildUser; + if (guser.RoleIds.Contains(guild.WitchRole)) + { + msg = $"```diff\n- {message} ```"; + await ReplyAsync(msg); + } + else + { + await ReplyAsync($"{Context.User.Mention}\nYOU are not the WITCH! YOU are a BITCH!"); + return; + } + + } + else if (colour == "blue" || colour == "b") + { + msg = $"```ini\n[ {message} ]```"; + await ReplyAsync(msg); + } + else if (colour == "orange" || colour == "o") + { + var guser = Context.User as IGuildUser; + if (guser.RoleIds.Contains(guild.WitchRole)) + { + msg = $"```css\n[ {msg} ]```"; + await ReplyAsync(msg); + } + else + { + await ReplyAsync($"{Context.User.Mention}\nYOU are not the WITCH! YOU are a BITCH!"); + return; + } + } + else + { + await ReplyAsync($"bruH! you gotta use red or blue! BRUH! r or b works also! bruh! ong WITH cap! MID AF!"); + return; + } + if (guild.SchizoLogChannel > 0) + { + await Context.Guild.GetTextChannel(guild.SchizoLogChannel).SendMessageAsync(msg); + } + + await Context.Message.DeleteAsync(); + } + diff --git a/Kehyeedra3/Kehyeedra3.csproj b/Kehyeedra3/Kehyeedra3.csproj index 5eb8cf1..53f1e98 100644 --- a/Kehyeedra3/Kehyeedra3.csproj +++ b/Kehyeedra3/Kehyeedra3.csproj @@ -8,11 +8,7 @@ - - - - - + diff --git a/Kehyeedra3/Migrations/20220618191051_Schizogayme.Designer.cs b/Kehyeedra3/Migrations/20220618191051_Schizogayme.Designer.cs new file mode 100644 index 0000000..d914b08 --- /dev/null +++ b/Kehyeedra3/Migrations/20220618191051_Schizogayme.Designer.cs @@ -0,0 +1,320 @@ +// +using System; +using Kehyeedra3; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace Kehyeedra3.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20220618191051_Schizogayme")] + partial class Schizogayme + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Kehyeedra3.Services.Models.Farming", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("CropInventory") + .HasColumnType("LONGTEXT"); + + b.Property("EmployeeCount") + .HasColumnType("int"); + + b.Property("FXp") + .HasColumnType("bigint unsigned"); + + b.Property("Lvl") + .HasColumnType("bigint unsigned"); + + b.Property("PlotInventory") + .HasColumnType("LONGTEXT"); + + b.Property("TXp") + .HasColumnType("bigint unsigned"); + + b.Property("Tier") + .HasColumnType("int"); + + b.Property("Xp") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.ToTable("Farming"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("FXp") + .HasColumnType("bigint unsigned"); + + b.Property("Inventory") + .HasColumnType("LONGTEXT"); + + b.Property("LastFish") + .HasColumnType("bigint unsigned"); + + b.Property("Lvl") + .HasColumnType("bigint unsigned"); + + b.Property("Prestige") + .HasColumnType("int"); + + b.Property("RodOwned") + .HasColumnType("tinyint unsigned"); + + b.Property("RodUsed") + .HasColumnType("tinyint unsigned"); + + b.Property("TXp") + .HasColumnType("bigint unsigned"); + + b.Property("Xp") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.ToTable("Fishing"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.Guild", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("Changenick") + .HasColumnType("tinyint(1)"); + + b.Property("SchizoChannel") + .HasColumnType("bigint unsigned"); + + b.Property("SchizoLogChannel") + .HasColumnType("bigint unsigned"); + + b.Property("Schizogame") + .HasColumnType("tinyint(1)"); + + b.Property("WitchRole") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.ToTable("Guilds"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b => + { + b.Property("OfferId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("Amount") + .HasColumnType("int"); + + b.Property("BuyerId") + .HasColumnType("bigint unsigned"); + + b.Property("IsPurchaseFromStore") + .HasColumnType("tinyint(1)"); + + b.Property("IsSellOffer") + .HasColumnType("tinyint(1)"); + + b.Property("ItemId") + .HasColumnType("bigint unsigned"); + + b.Property("OfferAmount") + .HasColumnType("int"); + + b.Property("StoreFrontId") + .HasColumnType("bigint unsigned"); + + b.Property("StoreId") + .HasColumnType("bigint unsigned"); + + b.HasKey("OfferId"); + + b.HasIndex("StoreFrontId"); + + b.ToTable("ItemOffer"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.Mining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("LastMine") + .HasColumnType("bigint unsigned"); + + b.Property("Lvl") + .HasColumnType("bigint unsigned"); + + b.Property("TXp") + .HasColumnType("bigint unsigned"); + + b.Property("Xp") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.ToTable("Mining"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.Reminder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("Created") + .HasColumnType("bigint unsigned"); + + b.Property("Message") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Send") + .HasColumnType("bigint unsigned"); + + b.Property("UserId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.ToTable("Reminders"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.StoreFront", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("StoreItemType") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.ToTable("StoreFronts"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.StoreInventory", b => + { + b.Property("InvId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("Amount") + .HasColumnType("int"); + + b.Property("Item") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Price") + .HasColumnType("int"); + + b.Property("StoreFrontId") + .HasColumnType("bigint unsigned"); + + b.HasKey("InvId"); + + b.HasIndex("StoreFrontId"); + + b.ToTable("StoreInventory"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("Avatar") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("CurrentBattlefish") + .HasColumnType("TINYINT"); + + b.Property("GeneralInventory") + .HasColumnType("LONGTEXT"); + + b.Property("Money") + .HasColumnType("bigint"); + + b.Property("OwnerId") + .HasColumnType("bigint unsigned"); + + b.Property("Username") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.User+BattleFishObject", b => + { + b.Property("FishId") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + b.Property("FishType") + .HasColumnType("TINYINT"); + + b.Property("Lvl") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("NextXp") + .HasColumnType("bigint unsigned"); + + b.Property("UserId") + .HasColumnType("bigint unsigned"); + + b.Property("Xp") + .HasColumnType("bigint unsigned"); + + b.HasKey("FishId"); + + b.ToTable("Battlefish"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b => + { + b.HasOne("Kehyeedra3.Services.Models.StoreFront", null) + .WithMany("Offers") + .HasForeignKey("StoreFrontId"); + }); + + modelBuilder.Entity("Kehyeedra3.Services.Models.StoreInventory", b => + { + b.HasOne("Kehyeedra3.Services.Models.StoreFront", null) + .WithMany("Items") + .HasForeignKey("StoreFrontId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Kehyeedra3/Migrations/20220618191051_Schizogayme.cs b/Kehyeedra3/Migrations/20220618191051_Schizogayme.cs new file mode 100644 index 0000000..41b07a7 --- /dev/null +++ b/Kehyeedra3/Migrations/20220618191051_Schizogayme.cs @@ -0,0 +1,53 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Kehyeedra3.Migrations +{ + public partial class Schizogayme : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SchizoChannel", + table: "Guilds", + nullable: false, + defaultValue: 0ul); + + migrationBuilder.AddColumn( + name: "SchizoLogChannel", + table: "Guilds", + nullable: false, + defaultValue: 0ul); + + migrationBuilder.AddColumn( + name: "Schizogame", + table: "Guilds", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "WitchRole", + table: "Guilds", + nullable: false, + defaultValue: 0ul); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "SchizoChannel", + table: "Guilds"); + + migrationBuilder.DropColumn( + name: "SchizoLogChannel", + table: "Guilds"); + + migrationBuilder.DropColumn( + name: "Schizogame", + table: "Guilds"); + + migrationBuilder.DropColumn( + name: "WitchRole", + table: "Guilds"); + } + } +} diff --git a/Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs b/Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs index d2dcf6a..deca27b 100644 --- a/Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs @@ -99,6 +99,18 @@ namespace Kehyeedra3.Migrations b.Property("Changenick") .HasColumnType("tinyint(1)"); + b.Property("SchizoChannel") + .HasColumnType("bigint unsigned"); + + b.Property("SchizoLogChannel") + .HasColumnType("bigint unsigned"); + + b.Property("Schizogame") + .HasColumnType("tinyint(1)"); + + b.Property("WitchRole") + .HasColumnType("bigint unsigned"); + b.HasKey("Id"); b.ToTable("Guilds"); diff --git a/Kehyeedra3/Services/Models/Guild.cs b/Kehyeedra3/Services/Models/Guild.cs index c4a31b1..14eca3d 100644 --- a/Kehyeedra3/Services/Models/Guild.cs +++ b/Kehyeedra3/Services/Models/Guild.cs @@ -13,5 +13,9 @@ namespace Kehyeedra3.Services.Models [Key] public ulong Id { get; set; } = 0; public bool Changenick { get; set; } = false; + public bool Schizogame { get; set; } = false; + public ulong SchizoChannel { get; set; } = 0; + public ulong WitchRole { get; set; } = 0; + public ulong SchizoLogChannel { get; set; } = 0; } }