More permission stuff. MovePerm doesn't work, RemovePerm works, permission fixes.
This commit is contained in:
		
							
								
								
									
										587
									
								
								src/NadekoBot/Migrations/20160926144107_second.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										587
									
								
								src/NadekoBot/Migrations/20160926144107_second.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,587 @@ | ||||
| using System; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Infrastructure; | ||||
| using Microsoft.EntityFrameworkCore.Metadata; | ||||
| using Microsoft.EntityFrameworkCore.Migrations; | ||||
| using NadekoBot.Services.Database.Impl; | ||||
|  | ||||
| namespace NadekoBot.Migrations | ||||
| { | ||||
|     [DbContext(typeof(NadekoSqliteContext))] | ||||
|     [Migration("20160926144107_second")] | ||||
|     partial class second | ||||
|     { | ||||
|         protected override void BuildTargetModel(ModelBuilder modelBuilder) | ||||
|         { | ||||
|             modelBuilder | ||||
|                 .HasAnnotation("ProductVersion", "1.0.0-rtm-21431"); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.BlacklistItem", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int?>("BotConfigId"); | ||||
|  | ||||
|                     b.Property<ulong>("ItemId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("BotConfigId"); | ||||
|  | ||||
|                     b.ToTable("BlacklistItem"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.BotConfig", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("BufferSize"); | ||||
|  | ||||
|                     b.Property<float>("CurrencyGenerationChance"); | ||||
|  | ||||
|                     b.Property<int>("CurrencyGenerationCooldown"); | ||||
|  | ||||
|                     b.Property<string>("CurrencyName"); | ||||
|  | ||||
|                     b.Property<string>("CurrencyPluralName"); | ||||
|  | ||||
|                     b.Property<string>("CurrencySign"); | ||||
|  | ||||
|                     b.Property<bool>("DontJoinServers"); | ||||
|  | ||||
|                     b.Property<bool>("ForwardMessages"); | ||||
|  | ||||
|                     b.Property<bool>("ForwardToAllOwners"); | ||||
|  | ||||
|                     b.Property<string>("RemindMessageFormat"); | ||||
|  | ||||
|                     b.Property<bool>("RotatingStatuses"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("BotConfig"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.ClashCaller", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<bool>("BaseDestroyed"); | ||||
|  | ||||
|                     b.Property<string>("CallUser"); | ||||
|  | ||||
|                     b.Property<int>("ClashWarId"); | ||||
|  | ||||
|                     b.Property<int>("Stars"); | ||||
|  | ||||
|                     b.Property<DateTime>("TimeAdded"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("ClashWarId"); | ||||
|  | ||||
|                     b.ToTable("ClashCallers"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.ClashWar", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<string>("EnemyClan"); | ||||
|  | ||||
|                     b.Property<ulong>("GuildId"); | ||||
|  | ||||
|                     b.Property<int>("Size"); | ||||
|  | ||||
|                     b.Property<DateTime>("StartedAt"); | ||||
|  | ||||
|                     b.Property<int>("WarState"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("ClashOfClans"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.ConvertUnit", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<string>("InternalTrigger"); | ||||
|  | ||||
|                     b.Property<decimal>("Modifier"); | ||||
|  | ||||
|                     b.Property<string>("UnitType"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("ConversionUnits"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Currency", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<long>("Amount"); | ||||
|  | ||||
|                     b.Property<ulong>("UserId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("UserId") | ||||
|                         .IsUnique(); | ||||
|  | ||||
|                     b.ToTable("Currency"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Donator", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int>("Amount"); | ||||
|  | ||||
|                     b.Property<string>("Name"); | ||||
|  | ||||
|                     b.Property<ulong>("UserId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("UserId") | ||||
|                         .IsUnique(); | ||||
|  | ||||
|                     b.ToTable("Donators"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.EightBallResponse", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int?>("BotConfigId"); | ||||
|  | ||||
|                     b.Property<string>("Text"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("BotConfigId"); | ||||
|  | ||||
|                     b.ToTable("EightBallResponses"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.FollowedStream", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<int?>("GuildConfigId"); | ||||
|  | ||||
|                     b.Property<ulong>("GuildId"); | ||||
|  | ||||
|                     b.Property<bool>("LastStatus"); | ||||
|  | ||||
|                     b.Property<int>("Type"); | ||||
|  | ||||
|                     b.Property<string>("Username"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("GuildConfigId"); | ||||
|  | ||||
|                     b.ToTable("FollowedStream"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.GuildConfig", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("AutoAssignRoleId"); | ||||
|  | ||||
|                     b.Property<bool>("AutoDeleteByeMessages"); | ||||
|  | ||||
|                     b.Property<bool>("AutoDeleteGreetMessages"); | ||||
|  | ||||
|                     b.Property<int>("AutoDeleteGreetMessagesTimer"); | ||||
|  | ||||
|                     b.Property<bool>("AutoDeleteSelfAssignedRoleMessages"); | ||||
|  | ||||
|                     b.Property<ulong>("ByeMessageChannelId"); | ||||
|  | ||||
|                     b.Property<string>("ChannelByeMessageText"); | ||||
|  | ||||
|                     b.Property<string>("ChannelGreetMessageText"); | ||||
|  | ||||
|                     b.Property<float>("DefaultMusicVolume"); | ||||
|  | ||||
|                     b.Property<bool>("DeleteMessageOnCommand"); | ||||
|  | ||||
|                     b.Property<string>("DmGreetMessageText"); | ||||
|  | ||||
|                     b.Property<bool>("ExclusiveSelfAssignedRoles"); | ||||
|  | ||||
|                     b.Property<ulong?>("GenerateCurrencyChannelId"); | ||||
|  | ||||
|                     b.Property<ulong>("GreetMessageChannelId"); | ||||
|  | ||||
|                     b.Property<ulong>("GuildId"); | ||||
|  | ||||
|                     b.Property<int?>("LogSettingId"); | ||||
|  | ||||
|                     b.Property<bool>("SendChannelByeMessage"); | ||||
|  | ||||
|                     b.Property<bool>("SendChannelGreetMessage"); | ||||
|  | ||||
|                     b.Property<bool>("SendDmGreetMessage"); | ||||
|  | ||||
|                     b.Property<bool>("VoicePlusTextEnabled"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("GuildId") | ||||
|                         .IsUnique(); | ||||
|  | ||||
|                     b.HasIndex("LogSettingId"); | ||||
|  | ||||
|                     b.ToTable("GuildConfigs"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredLogChannel", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<int?>("LogSettingId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("LogSettingId"); | ||||
|  | ||||
|                     b.ToTable("IgnoredLogChannels"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredVoicePresenceChannel", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<int?>("LogSettingId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("LogSettingId"); | ||||
|  | ||||
|                     b.ToTable("IgnoredVoicePresenceCHannels"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.LogSetting", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<bool>("ChannelCreated"); | ||||
|  | ||||
|                     b.Property<bool>("ChannelDestroyed"); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<bool>("ChannelUpdated"); | ||||
|  | ||||
|                     b.Property<bool>("IsLogging"); | ||||
|  | ||||
|                     b.Property<bool>("LogUserPresence"); | ||||
|  | ||||
|                     b.Property<bool>("LogVoicePresence"); | ||||
|  | ||||
|                     b.Property<bool>("MessageDeleted"); | ||||
|  | ||||
|                     b.Property<bool>("MessageReceived"); | ||||
|  | ||||
|                     b.Property<bool>("MessageUpdated"); | ||||
|  | ||||
|                     b.Property<bool>("UserBanned"); | ||||
|  | ||||
|                     b.Property<bool>("UserJoined"); | ||||
|  | ||||
|                     b.Property<bool>("UserLeft"); | ||||
|  | ||||
|                     b.Property<ulong>("UserPresenceChannelId"); | ||||
|  | ||||
|                     b.Property<bool>("UserUnbanned"); | ||||
|  | ||||
|                     b.Property<bool>("UserUpdated"); | ||||
|  | ||||
|                     b.Property<ulong>("VoicePresenceChannelId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("LogSettings"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.ModulePrefix", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int>("BotConfigId"); | ||||
|  | ||||
|                     b.Property<string>("ModuleName"); | ||||
|  | ||||
|                     b.Property<string>("Prefix"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("BotConfigId"); | ||||
|  | ||||
|                     b.ToTable("ModulePrefixes"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Permission", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int?>("GuildConfigId"); | ||||
|  | ||||
|                     b.Property<int>("PrimaryTarget"); | ||||
|  | ||||
|                     b.Property<ulong>("PrimaryTargetId"); | ||||
|  | ||||
|                     b.Property<int>("SecondaryTarget"); | ||||
|  | ||||
|                     b.Property<string>("SecondaryTargetName"); | ||||
|  | ||||
|                     b.Property<bool>("State"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("GuildConfigId"); | ||||
|  | ||||
|                     b.ToTable("Permission"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.PlayingStatus", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int?>("BotConfigId"); | ||||
|  | ||||
|                     b.Property<string>("Status"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("BotConfigId"); | ||||
|  | ||||
|                     b.ToTable("PlayingStatus"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Quote", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("AuthorId"); | ||||
|  | ||||
|                     b.Property<string>("AuthorName") | ||||
|                         .IsRequired(); | ||||
|  | ||||
|                     b.Property<ulong>("GuildId"); | ||||
|  | ||||
|                     b.Property<string>("Keyword") | ||||
|                         .IsRequired(); | ||||
|  | ||||
|                     b.Property<string>("Text") | ||||
|                         .IsRequired(); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("Quotes"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<int?>("BotConfigId"); | ||||
|  | ||||
|                     b.Property<string>("Icon"); | ||||
|  | ||||
|                     b.Property<string>("Name"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("BotConfigId"); | ||||
|  | ||||
|                     b.ToTable("RaceAnimals"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Reminder", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<bool>("IsPrivate"); | ||||
|  | ||||
|                     b.Property<string>("Message"); | ||||
|  | ||||
|                     b.Property<ulong>("ServerId"); | ||||
|  | ||||
|                     b.Property<ulong>("UserId"); | ||||
|  | ||||
|                     b.Property<DateTime>("When"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("Reminders"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Repeater", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("ChannelId"); | ||||
|  | ||||
|                     b.Property<ulong>("GuildId"); | ||||
|  | ||||
|                     b.Property<TimeSpan>("Interval"); | ||||
|  | ||||
|                     b.Property<string>("Message"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("ChannelId") | ||||
|                         .IsUnique(); | ||||
|  | ||||
|                     b.ToTable("Repeaters"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.SelfAssignedRole", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<ulong>("GuildId"); | ||||
|  | ||||
|                     b.Property<ulong>("RoleId"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.HasIndex("GuildId", "RoleId") | ||||
|                         .IsUnique(); | ||||
|  | ||||
|                     b.ToTable("SelfAssignableRoles"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.TypingArticle", b => | ||||
|                 { | ||||
|                     b.Property<int>("Id") | ||||
|                         .ValueGeneratedOnAdd(); | ||||
|  | ||||
|                     b.Property<string>("Author"); | ||||
|  | ||||
|                     b.Property<string>("Text"); | ||||
|  | ||||
|                     b.HasKey("Id"); | ||||
|  | ||||
|                     b.ToTable("TypingArticles"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.BlacklistItem", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.BotConfig") | ||||
|                         .WithMany("Blacklist") | ||||
|                         .HasForeignKey("BotConfigId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.ClashCaller", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.ClashWar", "ClashWar") | ||||
|                         .WithMany("Bases") | ||||
|                         .HasForeignKey("ClashWarId") | ||||
|                         .OnDelete(DeleteBehavior.Cascade); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.EightBallResponse", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.BotConfig") | ||||
|                         .WithMany("EightBallResponses") | ||||
|                         .HasForeignKey("BotConfigId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.FollowedStream", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.GuildConfig") | ||||
|                         .WithMany("FollowedStreams") | ||||
|                         .HasForeignKey("GuildConfigId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.GuildConfig", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.LogSetting", "LogSetting") | ||||
|                         .WithMany() | ||||
|                         .HasForeignKey("LogSettingId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredLogChannel", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.LogSetting", "LogSetting") | ||||
|                         .WithMany("IgnoredChannels") | ||||
|                         .HasForeignKey("LogSettingId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.IgnoredVoicePresenceChannel", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.LogSetting", "LogSetting") | ||||
|                         .WithMany("IgnoredVoicePresenceChannelIds") | ||||
|                         .HasForeignKey("LogSettingId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.ModulePrefix", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.BotConfig", "BotConfig") | ||||
|                         .WithMany("ModulePrefixes") | ||||
|                         .HasForeignKey("BotConfigId") | ||||
|                         .OnDelete(DeleteBehavior.Cascade); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.Permission", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.GuildConfig") | ||||
|                         .WithMany("Permissions") | ||||
|                         .HasForeignKey("GuildConfigId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.PlayingStatus", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.BotConfig") | ||||
|                         .WithMany("RotatingStatusMessages") | ||||
|                         .HasForeignKey("BotConfigId"); | ||||
|                 }); | ||||
|  | ||||
|             modelBuilder.Entity("NadekoBot.Services.Database.Models.RaceAnimal", b => | ||||
|                 { | ||||
|                     b.HasOne("NadekoBot.Services.Database.Models.BotConfig") | ||||
|                         .WithMany("RaceAnimals") | ||||
|                         .HasForeignKey("BotConfigId"); | ||||
|                 }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								src/NadekoBot/Migrations/20160926144107_second.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/NadekoBot/Migrations/20160926144107_second.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using Microsoft.EntityFrameworkCore.Migrations; | ||||
|  | ||||
| namespace NadekoBot.Migrations | ||||
| { | ||||
|     public partial class second : Migration | ||||
|     { | ||||
|         protected override void Up(MigrationBuilder migrationBuilder) | ||||
|         { | ||||
|  | ||||
|         } | ||||
|  | ||||
|         protected override void Down(MigrationBuilder migrationBuilder) | ||||
|         { | ||||
|  | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Administration | ||||
|                 }, null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)); | ||||
|                  | ||||
|  | ||||
|                 _client.MessageReceived += _client_MessageReceived; | ||||
|                 //_client.MessageReceived += _client_MessageReceived; | ||||
|                 _client.MessageUpdated += _client_MessageUpdated; | ||||
|                 _client.MessageDeleted += _client_MessageDeleted; | ||||
|                 _client.UserBanned += _client_UserBanned; | ||||
| @@ -408,37 +408,37 @@ namespace NadekoBot.Modules.Administration | ||||
|                 return Task.CompletedTask; | ||||
|             } | ||||
|  | ||||
|             private Task _client_MessageReceived(IMessage imsg) | ||||
|             { | ||||
|                 var msg = imsg as IUserMessage; | ||||
|                 if (msg == null || msg.IsAuthor()) | ||||
|                     return Task.CompletedTask; | ||||
| //            private Task _client_MessageReceived(IMessage imsg) | ||||
| //            { | ||||
| //                var msg = imsg as IUserMessage; | ||||
| //                if (msg == null || msg.IsAuthor()) | ||||
| //                    return Task.CompletedTask; | ||||
|  | ||||
|                 var channel = msg.Channel as ITextChannel; | ||||
|                 if (channel == null) | ||||
|                     return Task.CompletedTask; | ||||
| //                var channel = msg.Channel as ITextChannel; | ||||
| //                if (channel == null) | ||||
| //                    return Task.CompletedTask; | ||||
|  | ||||
|                 LogSetting logSetting; | ||||
|                 if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out logSetting)  | ||||
|                     || !logSetting.IsLogging | ||||
|                     || !logSetting.MessageReceived) | ||||
|                     return Task.CompletedTask; | ||||
| //                LogSetting logSetting; | ||||
| //                if (!GuildLogSettings.TryGetValue(channel.Guild.Id, out logSetting)  | ||||
| //                    || !logSetting.IsLogging | ||||
| //                    || !logSetting.MessageReceived) | ||||
| //                    return Task.CompletedTask; | ||||
|  | ||||
|                 ITextChannel logChannel; | ||||
|                 if ((logChannel = TryGetLogChannel(channel.Guild, logSetting)) == null || logChannel.Id == imsg.Channel.Id) | ||||
|                     return Task.CompletedTask; | ||||
| //                ITextChannel logChannel; | ||||
| //                if ((logChannel = TryGetLogChannel(channel.Guild, logSetting)) == null || logChannel.Id == imsg.Channel.Id) | ||||
| //                    return Task.CompletedTask; | ||||
|  | ||||
|                 var task = Task.Run(async () => | ||||
|                 { | ||||
|                     var str = $@"🕔`{prettyCurrentTime}` **New Message** `#{channel.Name}` | ||||
| 👤`{msg.Author.Username}`: {msg.Resolve(userHandling: UserMentionHandling.NameAndDiscriminator)}"; | ||||
|                     if (msg.Attachments.Any()) | ||||
|                         str += $"{Environment.NewLine}`Attachements`: {string.Join(", ", msg.Attachments.Select(a => a.ProxyUrl))}"; | ||||
|                     await logChannel.SendMessageAsync(str).ConfigureAwait(false); | ||||
|                 }); | ||||
| //                var task = Task.Run(async () => | ||||
| //                { | ||||
| //                    var str = $@"🕔`{prettyCurrentTime}` **New Message** `#{channel.Name}` | ||||
| //👤`{msg.Author.Username}`: {msg.Resolve(userHandling: UserMentionHandling.NameAndDiscriminator)}"; | ||||
| //                    if (msg.Attachments.Any()) | ||||
| //                        str += $"{Environment.NewLine}`Attachements`: {string.Join(", ", msg.Attachments.Select(a => a.ProxyUrl))}"; | ||||
| //                    await logChannel.SendMessageAsync(str).ConfigureAwait(false); | ||||
| //                }); | ||||
|                  | ||||
|                 return Task.CompletedTask; | ||||
|             } | ||||
| //                return Task.CompletedTask; | ||||
| //            } | ||||
|  | ||||
|             private enum LogChannelType { Text, Voice, UserPresence }; | ||||
|             private ITextChannel TryGetLogChannel(IGuild guild, LogSetting logSetting, LogChannelType logChannelType = LogChannelType.Text) | ||||
|   | ||||
| @@ -46,6 +46,7 @@ namespace NadekoBot.Modules.Gambling | ||||
|             //todo merge into internallDndRoll and internalRoll | ||||
|             [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [Priority(1)] | ||||
|             public async Task Roll(IUserMessage umsg, string arg) | ||||
|             { | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
| @@ -76,6 +77,7 @@ namespace NadekoBot.Modules.Gambling | ||||
|  | ||||
|             [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             [Priority(2)] | ||||
|             public async Task Roll(IUserMessage umsg, int num) | ||||
|             { | ||||
|                 var channel = (ITextChannel)umsg.Channel; | ||||
|   | ||||
| @@ -20,6 +20,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|  | ||||
|         public static bool CheckPermissions(this IEnumerable<Permission> permsEnumerable, IUserMessage message, Command command, out int permIndex) | ||||
|         { | ||||
|             permsEnumerable = permsEnumerable.Reverse(); | ||||
|             var perms = permsEnumerable as List<Permission> ?? permsEnumerable.ToList(); | ||||
|  | ||||
|             for (int i = 0; i < perms.Count; i++) | ||||
| @@ -107,7 +108,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|                     com = "a" + com + "m"; | ||||
|                     break; | ||||
|             } | ||||
|             com += " " + perm.SecondaryTargetName + " " + (perm.State ? "enable" : "disable") + " "; | ||||
|             com += " " + (perm.SecondaryTargetName != "*" ? perm.SecondaryTargetName + " " : "") + (perm.State ? "enable" : "disable") + " "; | ||||
|  | ||||
|             switch (perm.PrimaryTarget) | ||||
|             { | ||||
|   | ||||
| @@ -10,6 +10,7 @@ using NadekoBot.Services; | ||||
| using Discord; | ||||
| using NadekoBot.Services.Database; | ||||
| using NadekoBot.Services.Database.Models; | ||||
| using Discord.API; | ||||
|  | ||||
| namespace NadekoBot.Modules.Permissions | ||||
| { | ||||
| @@ -29,7 +30,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|             string toSend = ""; | ||||
|             using (var uow = DbHandler.UnitOfWork()) | ||||
|             { | ||||
|                 var perms = uow.GuildConfigs.For(channel.Guild.Id).Permissions; | ||||
|                 var perms = uow.GuildConfigs.For(channel.Guild.Id).Permissions.AsEnumerable().Reverse(); | ||||
|  | ||||
|                 var i = 1; | ||||
|                 toSend = String.Join("\n", perms.Select(p => $"`{(i++)}.` {p.GetCommand()}")); | ||||
| @@ -41,6 +42,61 @@ namespace NadekoBot.Modules.Permissions | ||||
|                 await channel.SendMessageAsync(toSend).ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task RemovePerm(IUserMessage imsg, int index) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             try | ||||
|             { | ||||
|                 Permission p; | ||||
|                 using (var uow = DbHandler.UnitOfWork()) | ||||
|                 { | ||||
|                     var perms = uow.GuildConfigs.For(channel.Guild.Id).Permissions.AsEnumerable().ToList(); | ||||
|                     p = perms[perms.Count - index]; | ||||
|                     perms.RemoveAt(perms.Count - index); | ||||
|                     uow.GuildConfigs.For(channel.Guild.Id).Permissions = perms; | ||||
|                     await uow.CompleteAsync().ConfigureAwait(false); | ||||
|                 } | ||||
|                 await channel.SendMessageAsync($"`Removed permission \"{p.GetCommand()}\" from position #{index}.`").ConfigureAwait(false); | ||||
|             } | ||||
|             catch (ArgumentOutOfRangeException) | ||||
|             { | ||||
|                 await channel.SendMessageAsync("`No command on that index found.`").ConfigureAwait(false); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task MovePerm(IUserMessage imsg, int from, int to) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|             if (!(from == to || from < 1 || to < 1)) | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     Permission toInsert; | ||||
|                     using (var uow = DbHandler.UnitOfWork()) | ||||
|                     { | ||||
|                         var perms = uow.GuildConfigs.For(channel.Guild.Id).Permissions.AsEnumerable().ToList(); | ||||
|                         toInsert = perms[perms.Count - from]; | ||||
|                         perms.RemoveAt(perms.Count - from); | ||||
|                         uow.GuildConfigs.For(channel.Guild.Id).Permissions = perms; | ||||
|                         if (from < to) | ||||
|                             to -= 1; | ||||
|                         perms.Insert(perms.Count - to, toInsert); | ||||
|                         await uow.CompleteAsync().ConfigureAwait(false); | ||||
|                     } | ||||
|                     await channel.SendMessageAsync($"`Moved permission \"{toInsert.GetCommand()}\" from #{from} to #{to}.`").ConfigureAwait(false); | ||||
|                     return; | ||||
|                 } | ||||
|                 catch (Exception e) when (e is ArgumentOutOfRangeException || e is IndexOutOfRangeException) | ||||
|                 { | ||||
|                 } | ||||
|             } | ||||
|             await channel.SendMessageAsync("`Invalid index(es) specified.`").ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task UsrCmd(IUserMessage imsg, Command command, PermissionAction action, IGuildUser user) | ||||
| @@ -211,7 +267,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|  | ||||
|         [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task AllUserMdls(IUserMessage imsg, PermissionAction action, IUser user) | ||||
|         public async Task AllUsrMdls(IUserMessage imsg, PermissionAction action, IUser user) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|  | ||||
| @@ -242,7 +298,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|                 { | ||||
|                     PrimaryTarget = PrimaryPermissionType.Channel, | ||||
|                     PrimaryTargetId = chnl.Id, | ||||
|                     SecondaryTarget = SecondaryPermissionType.Command, | ||||
|                     SecondaryTarget = SecondaryPermissionType.AllCommands, | ||||
|                     SecondaryTargetName = module.Name.ToLowerInvariant(), | ||||
|                     State = action.Value, | ||||
|                 }); | ||||
| @@ -274,7 +330,7 @@ namespace NadekoBot.Modules.Permissions | ||||
|  | ||||
|         [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias] | ||||
|         [RequireContext(ContextType.Guild)] | ||||
|         public async Task AllUserCmds(IUserMessage imsg, Module module, PermissionAction action, IUser user) | ||||
|         public async Task AllUsrCmds(IUserMessage imsg, Module module, PermissionAction action, IUser user) | ||||
|         { | ||||
|             var channel = (ITextChannel)imsg.Channel; | ||||
|  | ||||
|   | ||||
							
								
								
									
										108
									
								
								src/NadekoBot/Resources/CommandStrings.Designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										108
									
								
								src/NadekoBot/Resources/CommandStrings.Designer.cs
									
									
									
										generated
									
									
									
								
							| @@ -383,6 +383,60 @@ namespace NadekoBot.Resources { | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Sets permission for all commands from a module for a specific user.. | ||||
|         /// </summary> | ||||
|         public static string allusrcmds_desc { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("allusrcmds_desc", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to `;auc Searches disable @Someone`. | ||||
|         /// </summary> | ||||
|         public static string allusrcmds_summary { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("allusrcmds_summary", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to allusrcmds auc. | ||||
|         /// </summary> | ||||
|         public static string allusrcmds_text { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("allusrcmds_text", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Sets permission for all modules for a specific user.. | ||||
|         /// </summary> | ||||
|         public static string allusrmdls_desc { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("allusrmdls_desc", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to `;aum enable @someone`. | ||||
|         /// </summary> | ||||
|         public static string allusrmdls_summary { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("allusrmdls_summary", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to allusrmdls aum. | ||||
|         /// </summary> | ||||
|         public static string allusrmdls_text { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("allusrmdls_text", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Queries anilist for an anime and shows the first result.. | ||||
|         /// </summary> | ||||
| @@ -4271,6 +4325,33 @@ namespace NadekoBot.Resources { | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Moves permission from one position to another.. | ||||
|         /// </summary> | ||||
|         public static string moveperm_desc { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("moveperm_desc", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to `;mp 2 4`. | ||||
|         /// </summary> | ||||
|         public static string moveperm_summary { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("moveperm_summary", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to moveperm mp. | ||||
|         /// </summary> | ||||
|         public static string moveperm_text { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("moveperm_text", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Moves a song from one position to another.. | ||||
|         /// </summary> | ||||
| @@ -5108,6 +5189,33 @@ namespace NadekoBot.Resources { | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Removes a permission from a given position. | ||||
|         /// </summary> | ||||
|         public static string removeperm_desc { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("removeperm_desc", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to `;rp 1`. | ||||
|         /// </summary> | ||||
|         public static string removeperm_summary { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("removeperm_summary", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to removeperm rp. | ||||
|         /// </summary> | ||||
|         public static string removeperm_text { | ||||
|             get { | ||||
|                 return ResourceManager.GetString("removeperm_text", resourceCulture); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///    Looks up a localized string similar to Removes a playing string on a given number. **Bot Owner Only!**. | ||||
|         /// </summary> | ||||
|   | ||||
| @@ -2646,4 +2646,40 @@ | ||||
|   <data name="listperms_text" xml:space="preserve"> | ||||
|     <value>listperms lp</value> | ||||
|   </data> | ||||
|   <data name="allusrcmds_desc" xml:space="preserve"> | ||||
|     <value>Sets permission for all commands from a module for a specific user.</value> | ||||
|   </data> | ||||
|   <data name="allusrcmds_summary" xml:space="preserve"> | ||||
|     <value>`;auc Searches disable @Someone`</value> | ||||
|   </data> | ||||
|   <data name="allusrcmds_text" xml:space="preserve"> | ||||
|     <value>allusrcmds auc</value> | ||||
|   </data> | ||||
|   <data name="allusrmdls_desc" xml:space="preserve"> | ||||
|     <value>Sets permission for all modules for a specific user.</value> | ||||
|   </data> | ||||
|   <data name="allusrmdls_summary" xml:space="preserve"> | ||||
|     <value>`;aum enable @someone`</value> | ||||
|   </data> | ||||
|   <data name="allusrmdls_text" xml:space="preserve"> | ||||
|     <value>allusrmdls aum</value> | ||||
|   </data> | ||||
|   <data name="moveperm_desc" xml:space="preserve"> | ||||
|     <value>Moves permission from one position to another.</value> | ||||
|   </data> | ||||
|   <data name="moveperm_summary" xml:space="preserve"> | ||||
|     <value>`;mp 2 4`</value> | ||||
|   </data> | ||||
|   <data name="moveperm_text" xml:space="preserve"> | ||||
|     <value>moveperm mp</value> | ||||
|   </data> | ||||
|   <data name="removeperm_desc" xml:space="preserve"> | ||||
|     <value>Removes a permission from a given position</value> | ||||
|   </data> | ||||
|   <data name="removeperm_summary" xml:space="preserve"> | ||||
|     <value>`;rp 1`</value> | ||||
|   </data> | ||||
|   <data name="removeperm_text" xml:space="preserve"> | ||||
|     <value>removeperm rp</value> | ||||
|   </data> | ||||
| </root> | ||||
| @@ -137,7 +137,7 @@ namespace NadekoBot.Services | ||||
|                     } | ||||
|                     int index; | ||||
|                     if (!perms.CheckPermissions(message, cmd, out index)) | ||||
|                         return new Tuple<Command, IResult>(null, SearchResult.FromError(CommandError.Exception, $"Permission error. Permission number {index} (`{(index != -1 ? perms[index - 1].GetCommand() : "default")}`)")); | ||||
|                         return new Tuple<Command, IResult>(null, SearchResult.FromError(CommandError.Exception, $"Permission error. Permission number {index} (`{(index != -1 ? perms[perms.Count - index].GetCommand() : "default")}`)")); | ||||
|                 } | ||||
|  | ||||
|                 return new Tuple<Command, IResult>(commands[i], await commands[i].Execute(message, parseResult)); | ||||
|   | ||||
| @@ -43,6 +43,6 @@ namespace NadekoBot.Services.Database.Models | ||||
|         public ulong? GenerateCurrencyChannelId { get; set; } | ||||
|  | ||||
|         //permissions | ||||
|         public List<Permission> Permissions { get; set; } | ||||
|         public List<Permission> Permissions { get; set; } = new List<Permission>(); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user