Skip to content

Commit

Permalink
MarkusKgit#244 refactored announcements => changed naming to reminders
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex authored and Alex committed Oct 5, 2021
1 parent 609f933 commit ebbe55a
Show file tree
Hide file tree
Showing 9 changed files with 491 additions and 463 deletions.
15 changes: 8 additions & 7 deletions MonkeyBot/Database/MonkeyDBContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using NLog.Extensions.Logging;
using System;
using System.IO;
using MonkeyBot.Modules.Reminders;

namespace MonkeyBot.Database
{
Expand All @@ -12,7 +13,7 @@ public class MonkeyDBContext : DbContext
public DbSet<BenzenFact> BenzenFacts { get; set; }
public DbSet<GuildConfig> GuildConfigs { get; set; }
public DbSet<TriviaScore> TriviaScores { get; set; }
public DbSet<Announcement> Announcements { get; set; }
public DbSet<Reminder> Reminder { get; set; }
public DbSet<Feed> Feeds { get; set; }
public DbSet<GameServer> GameServers { get; set; }
public DbSet<RoleButtonLink> RoleButtonLinks { get; set; }
Expand Down Expand Up @@ -92,12 +93,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<RoleButtonLink>().Property(x => x.MessageID).IsRequired();

//RoleButtonlinks
modelBuilder.Entity<Announcement>().HasKey(x => x.ID);
modelBuilder.Entity<Announcement>().Property(x => x.GuildID).IsRequired();
modelBuilder.Entity<Announcement>().Property(x => x.ChannelID).IsRequired();
modelBuilder.Entity<Announcement>().Property(x => x.Type).IsRequired().HasConversion<string>();
modelBuilder.Entity<Announcement>().Property(x => x.Message).IsRequired();
modelBuilder.Entity<Announcement>().Property(x => x.Name).IsRequired();
modelBuilder.Entity<Reminder>().HasKey(x => x.Id);
modelBuilder.Entity<Reminder>().Property(x => x.GuildId).IsRequired();
modelBuilder.Entity<Reminder>().Property(x => x.ChannelId).IsRequired();
modelBuilder.Entity<Reminder>().Property(x => x.Type).IsRequired().HasConversion<string>();
modelBuilder.Entity<Reminder>().Property(x => x.Message).IsRequired();
modelBuilder.Entity<Reminder>().Property(x => x.Name).IsRequired();

//Polls
modelBuilder.Entity<Poll>().HasKey(x => x.Id);
Expand Down
7 changes: 4 additions & 3 deletions MonkeyBot/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using MonkeyBot.Modules.Reminders;

namespace MonkeyBot
{
Expand Down Expand Up @@ -116,7 +117,7 @@ private static IServiceProvider ConfigureServices(DiscordClient discordClient, L
.AddSingleton(discordClient)
.AddSingleton<IGuildService, GuildService>()
.AddSingleton<ISchedulingService, SchedulingService>()
.AddSingleton<IAnnouncementService, AnnouncementService>()
.AddSingleton<IReminderService, ReminderService>()
.AddSingleton<IFeedService, FeedService>()
.AddSingleton<IBattlefieldNewsService, BattlefieldNewsService>()
.AddSingleton<IGiveAwaysService, GiveAwaysService>()
Expand Down Expand Up @@ -144,8 +145,8 @@ private static async Task StartServicesAsync(IServiceProvider services)
MonkeyDBContext dbContext = services.GetRequiredService<MonkeyDBContext>();
await DBInitializer.InitializeAsync(dbContext);

IAnnouncementService announcements = services.GetService<IAnnouncementService>();
await announcements.InitializeAsync();
IReminderService reminders = services.GetService<IReminderService>();
await reminders.InitializeAsync();

SteamGameServerService steamGameServerService = services.GetService<SteamGameServerService>();
steamGameServerService.Initialize();
Expand Down
189 changes: 0 additions & 189 deletions MonkeyBot/Modules/Announcements/AnnouncementService.cs

This file was deleted.

Loading

0 comments on commit ebbe55a

Please sign in to comment.