Compare commits

..

29 Commits
5.0.7 ... 5.0.8

Author SHA1 Message Date
Kwoth
28a9f5682e docs: Updated changelog 2024-05-21 12:27:09 +00:00
Kwoth
06321380ee add: Added .quteedit command
add: Added an edit button to .quoteshow and .exprshow commands that opens a modal which lets you edit the quote or expr in question
2024-05-21 00:53:42 +00:00
Kwoth
b51ce34190 Merge branch 'v5' of https://gitlab.com/kwoth/nadekobot into v5 2024-05-21 00:17:10 +00:00
Kwoth
317c94979a fix: .langset and .langsetd should no longer allow unsupported languages and nonsense to be typed in 2024-05-21 00:16:57 +00:00
Kwoth
df2fd1b3f1 Merge branch 'v5' into 'v5'
Docs: update supported versions

See merge request Kwoth/nadekobot!329
2024-05-20 16:23:37 +00:00
Cata
35f0228986 docs: update supported versions 2024-05-20 16:23:36 +00:00
Kwoth
f391027c8c docs: Updated changelog 2024-05-20 00:48:35 +00:00
Kwoth
4e570475df add: Added dropdown menu for .cmds help and group help (part of cmds). Group help will no longer be on .h
fix: paginated response replies will no longer ping the author
2024-05-20 00:37:29 +00:00
Kwoth
e2066f433f fix: Fixed .h not working on some commands
add: Added select menu for the .mdls command
dev: Reworked the way interactions are created and sent. It is much better but far from perfect
2024-05-19 23:24:52 +00:00
Kwoth
78b328dc18 dev: added aliases to fix ci 2024-05-19 11:39:33 +00:00
Kwoth
f0cbacd01a Merge branch 'v5' of https://gitlab.com/kwoth/nadekobot into v5 2024-05-19 11:23:04 +00:00
Kwoth
d45c39a5fe fix: .pick command will now show the name of the user who picked the currency 2024-05-18 23:28:55 +00:00
Kwoth
a6010716e8 add: You can now check commands for submodules, for example '.h quote' the same way you can do for command groups like '.h bank' 2024-05-18 23:00:00 +00:00
Kwoth
d2c7563c5c change: Quotes will now use easier to write, alphanumerical ids (same as expressions) 2024-05-18 22:47:25 +00:00
Kwoth
0c167a9382 add: Added .cleanupguilddata command which will delete all guildconfigs, xp stats and other data related to any guild the bot is no longer in. This is a highly destructive and irreversible command.
dev: Added cascade deletes to any tables which have guildconfigs FK, as well as to some other missing places
2024-05-18 22:34:34 +00:00
Kwoth
b9d2e4baf1 Merge branch 'v5' into 'v5'
Missing botperms for setserver commands

See merge request Kwoth/nadekobot!328
2024-05-18 21:42:47 +00:00
Cata
82e230010b fix: added missing botperms for set* commands 2024-05-18 21:42:47 +00:00
Kwoth
03fb1a5ca2 fix: .verbose will now also be respected for expressions 2024-05-18 15:34:16 +00:00
Kwoth
8ac07ce6d7 Merge branch 'v5' of https://gitlab.com/kwoth/nadekobot into v5 2024-05-17 11:30:14 +00:00
Kwoth
12da9f3178 Merge branch 'v5' into 'v5'
setserverbanner and setservericon commands

See merge request Kwoth/nadekobot!327
2024-05-17 11:29:51 +00:00
Cata
ae45329d2b add: setserverbanner and setservericon commands 2024-05-17 11:29:51 +00:00
Kwoth
f499380fe8 dev: Updated tests package 2024-05-17 11:20:46 +00:00
Kwoth
0083e9ef68 dev: Don't run docker build on mrs as it will always fail
dev: Fixed remove-migration.ps1 script
2024-05-17 11:19:02 +00:00
Kwoth
22b7cf5e6c Merge branch 'v5' into 'v5'
docs: Rewritten Docker guide

See merge request Kwoth/nadekobot!326
2024-05-16 20:52:58 +00:00
Plarpoon
f973766c73 docs: Rewritten Docker guide 2024-05-16 20:52:58 +00:00
Kwoth
0efdd3300d Merge branch 'UpdateDocsYtdlp' into 'v5'
Docs: Replaced youtube-dl with yt-dlp

See merge request Kwoth/nadekobot!325
2024-05-16 15:51:23 +00:00
Cata
5016377dd1 docs: Replaced youtube-dl with yt-dlp 2024-05-16 15:51:22 +00:00
Kwoth
2d40a35112 Merge branch 'v5' into 'v5'
dev: move template creds.yml file into docker

See merge request Kwoth/nadekobot!323
2024-05-15 19:57:32 +00:00
Plarpoon
9ea6cd0b32 dev: creds_example.yml will now be in the docker's data dir/volume 2024-05-15 19:57:32 +00:00
64 changed files with 14360 additions and 725 deletions

View File

@@ -123,6 +123,8 @@ publish-medusa-package:
stage: publish-medusa-package
allow_failure: true
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG
script:
- LAST_TAG=$(git describe --tags --abbrev=0)

View File

@@ -2,6 +2,28 @@
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## [5.0.8] - 21.05.2024
### Added
- Added `.setserverbanner` and `.setservericon` commands (thx cata)
- Added overloads section to `.h command` which will show you all versions of command usage with param names
- You can now check commands for submodules, for example `.cmds SelfAssignedRoles` will show brief help for each of the commands in that submodule
- Added dropdown menus for .mdls and .cmds (both module and group versions) which will give you the option to see more detailed help for each specific module, group or command respectively
- Self-Hosters only:
- Added a dangerous cleanup command that you don't have to know about
### Changed
- Quotes will now use alphanumerical ids (like expressions)
### Fixed
- `.verbose` will now be respected for expression errors
- Using `.pick` will now correctly show the name of the user who picked the currency
- Fixed `.h` not working on some commands
- `.langset` and `.langsetd` should no longer allow unsupported languages and nonsense to be typed in
## [5.0.7] - 15.05.2024
### Fixed

View File

@@ -1,46 +1,76 @@
# Setting up NadekoBot with Docker
# Deploying NadekoBot with Docker: A Comprehensive Guide
# WORK IN PROGRESS
## Getting Started
### Installation
Ensure Docker and Docker Compose are installed on your system. If not, follow the official Docker guides for your specific operating system:
- [Docker Installation Guide](https://docs.docker.com/engine/install/)
- [Docker Compose Installation Guide](https://docs.docker.com/compose/install/)
## Step-by-Step Installation
1. **Choose Your Workspace:** Select a directory where you'll set up your NadekoBot stack. Use your terminal to navigate to this directory. For the purpose of this guide, we'll use `/opt/stacks/nadekobot/` as an example, but you can choose any directory that suits your needs.
2. **Create a Docker Compose File:** In this directory, create a Docker Compose file named `docker-compose.yml`. You can use any text editor for this task. For instance, to use the `nano` editor, type `nano docker-compose.yml`.
3. **Configure Your Docker Compose File:** Populate your Docker Compose file with the following configuration:
1. Create a `/srv/nadeko` folder
- `mkdir -p /srv/nadeko`
2. Create a `docker-compose.yml`
- nano `docker-compose.yml`
- copy the following contents into it:
##### docker-compose.yml
```yml
version: "3.7"
services:
nadeko:
image: registry.gitlab.com/kwoth/nadekobot:latest
depends_on:
- redis
container_name: nadeko
restart: unless-stopped
environment:
TZ: Europe/Paris
NadekoBot_RedisOptions: redis,name=nadeko
#NadekoBot_ShardRunCommand: dotnet
#NadekoBot_ShardRunArguments: /app/NadekoBot.dll {0} {1}
TZ: Europe/Rome
volumes:
- /srv/nadeko/conf/creds.yml:/app/creds.yml:ro
- /srv/nadeko/data:/app/data
redis:
image: redis:4-alpine
sysctls:
- net.core.somaxconn=511
command: redis-server --maxmemory 32M --maxmemory-policy volatile-lru
volumes:
- /srv/nadeko/redis-data:/data
- /opt/stacks/nadekobot/conf/creds.yml:/app/data/creds.yml
- /opt/stacks/nadekobot/data:/app/data
networks: {}
```
3. Save your file and run docker compose
- `docker-compose up`
4. Edit creds in `/srv/nadeko/conf/creds.yml`
5. Run it again with
- `docker-compose up`
### Updating
- `cd /srv/nadeko`
- `docker-compose pull`
- `docker-compose up -d`
4. **Prepare Your Credentials File:** Before running Docker Compose, ensure the `creds.yml` file exists in the `/opt/stacks/nadekobot/conf/` directory. If it's missing, create it using `touch /opt/stacks/nadekobot/conf/creds.yml`. You may need to use `sudo`. Remember to replace `/opt/stacks/nadekobot/` with your chosen directory.
5. **Edit Your Credentials File:** Populate the `creds.yml` file in `/opt/stacks/nadekobot/conf/creds.yml` with your bot's credentials. You can use any text editor for this task. For instance, to use the `nano` editor, type `nano /opt/stacks/nadekobot/conf/creds.yml`. You may need to use `sudo`. Again, replace `/opt/stacks/nadekobot/` with your chosen directory.
6. **Launch Your Bot:** Now, you're ready to run Docker Compose. Use the following command: `docker-compose up -d`.
## Keeping Your Bot Up-to-Date
There are two methods to update your NadekoBot:
### Manual Update
1. **Navigate to Your Directory:** Use `cd /path/to/your/directory` to go to the directory containing your Docker Compose file.
2. **Pull the Latest Images:** Use `docker-compose pull` to fetch the latest images.
3. **Restart Your Containers:** Use `docker-compose up -d` to restart the containers.
### Automatic Update with Watchtower
If you prefer an automated update process, consider using Watchtower. Watchtower automatically updates your Docker containers to the latest versions.
To use Watchtower with NadekoBot, you need to add a specific label to the service in your Docker Compose file. Here's how your Docker Compose file should look:
```yml
services:
nadeko:
image: registry.gitlab.com/kwoth/nadekobot:latest
container_name: nadeko
restart: unless-stopped
labels:
- com.centurylinklabs.watchtower.enable=true
environment:
TZ: Europe/Rome
volumes:
- /opt/stacks/nadekobot/conf/creds.yml:/app/data/creds.yml
- /opt/stacks/nadekobot/data:/app/data
networks: {}
```
Remember to replace `/opt/stacks/nadekobot/` with your chosen directory in the Docker Compose file.
To install and run Watchtower, follow the guide provided by Containrrr:
- [Watchtower Installation and Usage Guide](https://containrrr.dev/watchtower/)

View File

@@ -15,8 +15,8 @@
##### Compatible operating systems:
- Ubuntu: 20.04, 21.04, 21.10, 22.04
- Mint: 19, 20
- Ubuntu: 20.04, 22.04, 24.04
- Mint: 19, 20, 21
- Debian: 10, 11, 12
- RockyLinux: 8, 9
- AlmaLinux: 8, 9
@@ -70,11 +70,11 @@ Open Terminal (if you're on an installation with a window manager) and navigate
1. (Optional) Installing Redis
- ubuntu installation command: `sudo apt-get install redis-server`
2. Playing music requires `ffmpeg`, `libopus`, `libsodium` and `youtube-dl` (which in turn requires python3)
- ubuntu installation command: `sudo apt-get install ffmpeg libopus0 opus-tools libopus-dev libsodium-dev -y`
2. Playing music requires `ffmpeg`, `libopus`, `libsodium` and `yt-dlp` (which in turn requires python3)
- Ubuntu installation command: `sudo apt-get install ffmpeg libopus0 opus-tools libopus-dev libsodium-dev -y`
- yt-dlp installation command: `sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp && sudo chmod a+rx /usr/local/bin/yt-dlp`
3. Make sure your python is version 3+ with `python --version`
- if it's not, you can install python 3 and make it the default with: `sudo apt-get install python3.8 python-is-python3`
*You can use nadeko bash script [prerequisites installer](https://gitlab.com/kwoth/nadeko-bash-installer/-/blob/v5/n-prereq.sh) as a reference*
##### Installation Instructions
@@ -268,7 +268,7 @@ This method is similar to the one above, but requires one extra step, with the a
echo '#!/bin/bash'
echo ""
echo "echo \"Running NadekoBot in the background with auto restart\"
youtube-dl -U
yt-dlp -U
# If you want Nadeko to be compiled prior to every startup, uncomment the lines
# below. Note that it's not necessary unless you are personally modifying the
@@ -300,7 +300,7 @@ This method is similar to the one above, but requires one extra step, with the a
echo \"Waiting for 5 seconds...\"
sleep 5
youtube-dl -U
yt-dlp -U
echo \"Restarting NadekoBot...\"
done

View File

@@ -1,4 +1,4 @@
dotnet ef migrations remove -c SqliteContext -f
dotnet ef migrations remove -c PostgreSqlContext -f
dotnet ef migrations remove -c MysqlContext -f
dotnet ef migrations remove -c SqliteContext -f -p src/NadekoBot/NadekoBot.csproj
dotnet ef migrations remove -c PostgreSqlContext -f -p src/NadekoBot/NadekoBot.csproj
dotnet ef migrations remove -c MysqlContext -f -p src/NadekoBot/NadekoBot.csproj

View File

@@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
</ItemGroup>

View File

@@ -3,6 +3,8 @@ namespace NadekoBot.Db.Models;
public class DelMsgOnCmdChannel : DbEntity
{
public int GuildConfigId { get; set; }
public ulong ChannelId { get; set; }
public bool State { get; set; }

View File

@@ -1,8 +0,0 @@
#nullable disable
namespace NadekoBot.Db.Models;
public class IgnoredVoicePresenceChannel : DbEntity
{
public LogSetting LogSetting { get; set; }
public ulong ChannelId { get; set; }
}

View File

@@ -40,6 +40,9 @@ public class StreamRoleSettings : DbEntity
public class StreamRoleBlacklistedUser : DbEntity
{
public int StreamRoleSettingsId { get; set; }
public StreamRoleSettings StreamRoleSettings { get; set; }
public ulong UserId { get; set; }
public string Username { get; set; }
@@ -57,6 +60,9 @@ public class StreamRoleBlacklistedUser : DbEntity
public class StreamRoleWhitelistedUser : DbEntity
{
public int StreamRoleSettingsId { get; set; }
public StreamRoleSettings StreamRoleSettings { get; set; }
public ulong UserId { get; set; }
public string Username { get; set; }

View File

@@ -2,8 +2,9 @@
public class AntiAltSetting
{
public int Id { get; set; }
public int GuildConfigId { get; set; }
public int Id { get; set; }
public TimeSpan MinAge { get; set; }
public PunishmentAction Action { get; set; }
public int ActionDurationMinutes { get; set; }

View File

@@ -1,12 +1,13 @@
#nullable disable
using System.ComponentModel.DataAnnotations.Schema;
namespace NadekoBot.Db.Models;
public class AntiRaidSetting : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public int UserThreshold { get; set; }
public int Seconds { get; set; }
public PunishmentAction Action { get; set; }

View File

@@ -4,8 +4,7 @@
public class AntiSpamSetting : DbEntity
{
public int GuildConfigId { get; set; }
public GuildConfig GuildConfig { get; set; }
public PunishmentAction Action { get; set; }
public int MessageThreshold { get; set; } = 3;
public int MuteTime { get; set; }

View File

@@ -14,17 +14,3 @@ public class FilterChannelId : DbEntity
public override int GetHashCode()
=> ChannelId.GetHashCode();
}
public class FilterWordsChannelId : DbEntity
{
public ulong ChannelId { get; set; }
public bool Equals(FilterWordsChannelId other)
=> ChannelId == other.ChannelId;
public override bool Equals(object obj)
=> obj is FilterWordsChannelId fci && Equals(fci);
public override int GetHashCode()
=> ChannelId.GetHashCode();
}

View File

@@ -0,0 +1,17 @@
#nullable disable
namespace NadekoBot.Db.Models;
public class FilterWordsChannelId : DbEntity
{
public int? GuildConfigId { get; set; }
public ulong ChannelId { get; set; }
public bool Equals(FilterWordsChannelId other)
=> ChannelId == other.ChannelId;
public override bool Equals(object obj)
=> obj is FilterWordsChannelId fci && Equals(fci);
public override int GetHashCode()
=> ChannelId.GetHashCode();
}

View File

@@ -51,6 +51,8 @@ public class XpCurrencyReward : DbEntity
public class ExcludedItem : DbEntity
{
public XpSettings XpSettings { get; set; }
public ulong ItemId { get; set; }
public ExcludedItemType ItemType { get; set; }

View File

@@ -28,7 +28,6 @@ public abstract class NadekoContext : DbContext
//logging
public DbSet<LogSetting> LogSettings { get; set; }
public DbSet<IgnoredVoicePresenceChannel> IgnoredVoicePresenceCHannels { get; set; }
public DbSet<IgnoredLogItem> IgnoredLogChannels { get; set; }
public DbSet<RotatingPlayingStatus> RotatingStatus { get; set; }
@@ -55,14 +54,14 @@ public abstract class NadekoContext : DbContext
public DbSet<PatronUser> Patrons { get; set; }
public DbSet<PatronQuota> PatronQuotas { get; set; }
public DbSet<StreamOnlineMessage> StreamOnlineMessages { get; set; }
public DbSet<StickyRole> StickyRoles { get; set; }
public DbSet<TodoModel> Todos { get; set; }
public DbSet<ArchivedTodoListModel> TodosArchive { get; set; }
// todo add guild colors
// public DbSet<GuildColors> GuildColors { get; set; }
@@ -86,15 +85,84 @@ public abstract class NadekoContext : DbContext
#region GuildConfig
var configEntity = modelBuilder.Entity<GuildConfig>();
configEntity.HasIndex(c => c.GuildId)
.IsUnique();
configEntity.Property(x => x.VerboseErrors)
.HasDefaultValue(true);
modelBuilder.Entity<AntiSpamSetting>().HasOne(x => x.GuildConfig).WithOne(x => x.AntiSpamSetting);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.DelMsgOnCmdChannels)
.WithOne()
.HasForeignKey(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<AntiRaidSetting>().HasOne(x => x.GuildConfig).WithOne(x => x.AntiRaidSetting);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.FollowedStreams)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.GenerateCurrencyChannelIds)
.WithOne(x => x.GuildConfig)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.Permissions)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.CommandCooldowns)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.FilterInvitesChannelIds)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.FilterLinksChannelIds)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.FilteredWords)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.FilterWordsChannelIds)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.MutedUsers)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasOne(x => x.AntiRaidSetting)
.WithOne()
.HasForeignKey<AntiRaidSetting>(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
// start antispam
modelBuilder.Entity<GuildConfig>()
.HasOne(x => x.AntiSpamSetting)
.WithOne()
.HasForeignKey<AntiSpamSetting>(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<AntiSpamSetting>()
.HasMany(x => x.IgnoredChannels)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
// end antispam
modelBuilder.Entity<GuildConfig>()
.HasOne(x => x.AntiAltSetting)
@@ -102,6 +170,98 @@ public abstract class NadekoContext : DbContext
.HasForeignKey<AntiAltSetting>(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.UnmuteTimers)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.UnbanTimer)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.UnroleTimer)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.VcRoleInfos)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.CommandAliases)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.WarnPunishments)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.SlowmodeIgnoredRoles)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.SlowmodeIgnoredUsers)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
// start shop
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.ShopEntries)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<ShopEntry>()
.HasMany(x => x.Items)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
// end shop
// start streamrole
modelBuilder.Entity<GuildConfig>()
.HasOne(x => x.StreamRole)
.WithOne(x => x.GuildConfig)
.HasForeignKey<StreamRoleSettings>(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<StreamRoleSettings>()
.HasMany(x => x.Whitelist)
.WithOne(x => x.StreamRoleSettings)
.HasForeignKey(x => x.StreamRoleSettingsId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<StreamRoleSettings>()
.HasMany(x => x.Blacklist)
.WithOne(x => x.StreamRoleSettings)
.HasForeignKey(x => x.StreamRoleSettingsId)
.OnDelete(DeleteBehavior.Cascade);
// end streamrole
modelBuilder.Entity<GuildConfig>()
.HasOne(x => x.XpSettings)
.WithOne(x => x.GuildConfig)
.HasForeignKey<XpSettings>(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.FeedSubs)
.WithOne(x => x.GuildConfig)
.HasForeignKey(x => x.GuildConfigId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GuildConfig>()
.HasMany(x => x.SelfAssignableRoleGroupNames)
.WithOne()
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<FeedSub>()
.HasAlternateKey(x => new
{
@@ -117,11 +277,6 @@ public abstract class NadekoContext : DbContext
#endregion
#region streamrole
modelBuilder.Entity<StreamRoleSettings>().HasOne(x => x.GuildConfig).WithOne(x => x.StreamRole);
#endregion
#region Self Assignable Roles
@@ -217,12 +372,6 @@ public abstract class NadekoContext : DbContext
#endregion
#region XpSettings
modelBuilder.Entity<XpSettings>().HasOne(x => x.GuildConfig).WithOne(x => x.XpSettings);
#endregion
#region XpRoleReward
modelBuilder.Entity<XpRoleReward>()
@@ -233,6 +382,21 @@ public abstract class NadekoContext : DbContext
})
.IsUnique();
modelBuilder.Entity<XpSettings>()
.HasMany(x => x.RoleRewards)
.WithOne(x => x.XpSettings)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<XpSettings>()
.HasMany(x => x.CurrencyRewards)
.WithOne(x => x.XpSettings)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<XpSettings>()
.HasMany(x => x.ExclusionList)
.WithOne(x => x.XpSettings)
.OnDelete(DeleteBehavior.Cascade);
#endregion
#region Club
@@ -331,9 +495,9 @@ public abstract class NadekoContext : DbContext
modelBuilder.Entity<BanTemplate>().HasIndex(x => x.GuildId).IsUnique();
modelBuilder.Entity<BanTemplate>()
.Property(x => x.PruneDays)
.HasDefaultValue(null)
.IsRequired(false);
.Property(x => x.PruneDays)
.HasDefaultValue(null)
.IsRequired(false);
#endregion
@@ -445,7 +609,7 @@ public abstract class NadekoContext : DbContext
});
#endregion
#region Xp Item Shop
modelBuilder.Entity<XpShopOwnedItem>(
@@ -453,76 +617,77 @@ public abstract class NadekoContext : DbContext
{
// user can own only one of each item
x.HasIndex(model => new
{
model.UserId,
model.ItemType,
model.ItemKey
})
.IsUnique();
{
model.UserId,
model.ItemType,
model.ItemKey
})
.IsUnique();
});
#endregion
#region AutoPublish
modelBuilder.Entity<AutoPublishChannel>(apc => apc
.HasIndex(x => x.GuildId)
.IsUnique());
.HasIndex(x => x.GuildId)
.IsUnique());
#endregion
#region GamblingStats
modelBuilder.Entity<GamblingStats>(gs => gs
.HasIndex(x => x.Feature)
.IsUnique());
.HasIndex(x => x.Feature)
.IsUnique());
#endregion
#region Sticky Roles
modelBuilder.Entity<StickyRole>(sr => sr.HasIndex(x => new
{
x.GuildId,
x.UserId
}).IsUnique());
{
x.GuildId,
x.UserId
})
.IsUnique());
#endregion
#region Giveaway
modelBuilder.Entity<GiveawayModel>()
.HasMany(x => x.Participants)
.WithOne()
.HasForeignKey(x => x.GiveawayId)
.OnDelete(DeleteBehavior.Cascade);
.HasMany(x => x.Participants)
.WithOne()
.HasForeignKey(x => x.GiveawayId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<GiveawayUser>(gu => gu
.HasIndex(x => new
{
x.GiveawayId,
x.UserId
})
.IsUnique());
.HasIndex(x => new
{
x.GiveawayId,
x.UserId
})
.IsUnique());
#endregion
#region Todo
modelBuilder.Entity<TodoModel>()
.HasKey(x => x.Id);
modelBuilder.Entity<TodoModel>()
.HasIndex(x => x.UserId)
.IsUnique(false);
.HasIndex(x => x.UserId)
.IsUnique(false);
modelBuilder.Entity<ArchivedTodoListModel>()
.HasMany(x => x.Items)
.WithOne()
.HasForeignKey(x => x.ArchiveId)
.OnDelete(DeleteBehavior.Cascade);
.HasMany(x => x.Items)
.WithOne()
.HasForeignKey(x => x.ArchiveId)
.OnDelete(DeleteBehavior.Cascade);
#endregion
}

View File

@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations;
using NadekoBot.Db.Models;
namespace NadekoBot.Migrations;
@@ -39,4 +40,15 @@ left join guildconfigs on reactionrolemessage.guildconfigid = guildconfigs.id;")
throw new NotSupportedException("This database provider doesn't have an implementation for MigrateRero");
}
}
public static void GuildConfigCleanup(MigrationBuilder builder)
{
builder.Sql($"""
DELETE FROM "StreamRoleBlacklistedUser" WHERE "StreamRoleSettingsId" is NULL;
""");
builder.Sql($"""
DELETE FROM "DelMsgOnCmdChannel" WHERE "GuildConfigId" is NULL;
""");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,703 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations.Mysql
{
/// <inheritdoc />
public partial class guidlconfigcleanup : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting");
migrationBuilder.DropForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore");
migrationBuilder.DropForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting");
migrationBuilder.DropForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias");
migrationBuilder.DropForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown");
migrationBuilder.DropForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel");
migrationBuilder.DropForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem");
migrationBuilder.DropForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid");
migrationBuilder.DropForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword");
migrationBuilder.DropForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid");
migrationBuilder.DropForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid");
migrationBuilder.DropForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream");
migrationBuilder.DropForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid");
migrationBuilder.DropForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid");
migrationBuilder.DropForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions");
migrationBuilder.DropForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry");
migrationBuilder.DropForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser");
migrationBuilder.DropForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesetti~",
table: "streamroleblacklisteduser");
migrationBuilder.DropForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesetti~",
table: "streamrolewhitelisteduser");
migrationBuilder.DropForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer");
migrationBuilder.DropForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer");
migrationBuilder.DropForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer");
migrationBuilder.DropForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo");
migrationBuilder.DropForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment");
migrationBuilder.DropTable(
name: "ignoredvoicepresencechannels");
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamrolewhitelisteduser",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamroleblacklisteduser",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "guildconfigid",
table: "delmsgoncmdchannel",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore",
column: "antispamsettingid",
principalTable: "antispamsetting",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem",
column: "xpsettingsid",
principalTable: "xpsettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem",
column: "shopentryid",
principalTable: "shopentry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesetti~",
table: "streamroleblacklisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesetti~",
table: "streamrolewhitelisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting");
migrationBuilder.DropForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore");
migrationBuilder.DropForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting");
migrationBuilder.DropForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias");
migrationBuilder.DropForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown");
migrationBuilder.DropForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel");
migrationBuilder.DropForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem");
migrationBuilder.DropForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid");
migrationBuilder.DropForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword");
migrationBuilder.DropForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid");
migrationBuilder.DropForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid");
migrationBuilder.DropForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream");
migrationBuilder.DropForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid");
migrationBuilder.DropForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid");
migrationBuilder.DropForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions");
migrationBuilder.DropForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry");
migrationBuilder.DropForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser");
migrationBuilder.DropForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesetti~",
table: "streamroleblacklisteduser");
migrationBuilder.DropForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesetti~",
table: "streamrolewhitelisteduser");
migrationBuilder.DropForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer");
migrationBuilder.DropForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer");
migrationBuilder.DropForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer");
migrationBuilder.DropForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo");
migrationBuilder.DropForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment");
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamrolewhitelisteduser",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamroleblacklisteduser",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<int>(
name: "guildconfigid",
table: "delmsgoncmdchannel",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.CreateTable(
name: "ignoredvoicepresencechannels",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
logsettingid = table.Column<int>(type: "int", nullable: true),
channelid = table.Column<ulong>(type: "bigint unsigned", nullable: false),
dateadded = table.Column<DateTime>(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_ignoredvoicepresencechannels", x => x.id);
table.ForeignKey(
name: "fk_ignoredvoicepresencechannels_logsettings_logsettingid",
column: x => x.logsettingid,
principalTable: "logsettings",
principalColumn: "id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "ix_ignoredvoicepresencechannels_logsettingid",
table: "ignoredvoicepresencechannels",
column: "logsettingid");
migrationBuilder.AddForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore",
column: "antispamsettingid",
principalTable: "antispamsetting",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem",
column: "xpsettingsid",
principalTable: "xpsettings",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem",
column: "shopentryid",
principalTable: "shopentry",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesetti~",
table: "streamroleblacklisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesetti~",
table: "streamrolewhitelisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
}
}
}

View File

@@ -673,7 +673,7 @@ namespace NadekoBot.Migrations.Mysql
.HasColumnType("datetime(6)")
.HasColumnName("dateadded");
b.Property<int?>("GuildConfigId")
b.Property<int>("GuildConfigId")
.HasColumnType("int")
.HasColumnName("guildconfigid");
@@ -1423,36 +1423,6 @@ namespace NadekoBot.Migrations.Mysql
b.ToTable("ignoredlogchannels", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<ulong>("ChannelId")
.HasColumnType("bigint unsigned")
.HasColumnName("channelid");
b.Property<DateTime?>("DateAdded")
.HasColumnType("datetime(6)")
.HasColumnName("dateadded");
b.Property<int?>("LogSettingId")
.HasColumnType("int")
.HasColumnName("logsettingid");
b.HasKey("Id")
.HasName("pk_ignoredvoicepresencechannels");
b.HasIndex("LogSettingId")
.HasDatabaseName("ix_ignoredvoicepresencechannels_logsettingid");
b.ToTable("ignoredvoicepresencechannels", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.ImageOnlyChannel", b =>
{
b.Property<int>("Id")
@@ -2510,7 +2480,7 @@ namespace NadekoBot.Migrations.Mysql
.HasColumnType("datetime(6)")
.HasColumnName("dateadded");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("int")
.HasColumnName("streamrolesettingsid");
@@ -2587,7 +2557,7 @@ namespace NadekoBot.Migrations.Mysql
.HasColumnType("datetime(6)")
.HasColumnName("dateadded");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("int")
.HasColumnName("streamrolesettingsid");
@@ -3226,14 +3196,12 @@ namespace NadekoBot.Migrations.Mysql
modelBuilder.Entity("NadekoBot.Db.Models.AntiRaidSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiRaidSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiRaidSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_antiraidsetting_guildconfigs_guildconfigid");
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamIgnore", b =>
@@ -3241,19 +3209,18 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.AntiSpamSetting", null)
.WithMany("IgnoredChannels")
.HasForeignKey("AntiSpamSettingId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_antispamignore_antispamsetting_antispamsettingid");
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiSpamSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiSpamSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_antispamsetting_guildconfigs_guildconfigid");
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AutoTranslateUser", b =>
@@ -3326,6 +3293,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandAliases")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_commandalias_guildconfigs_guildconfigid");
});
@@ -3334,6 +3302,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandCooldowns")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_commandcooldown_guildconfigs_guildconfigid");
});
@@ -3342,6 +3311,8 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("DelMsgOnCmdChannels")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_delmsgoncmdchannel_guildconfigs_guildconfigid");
});
@@ -3358,10 +3329,13 @@ namespace NadekoBot.Migrations.Mysql
modelBuilder.Entity("NadekoBot.Db.Models.ExcludedItem", b =>
{
b.HasOne("NadekoBot.Db.Models.XpSettings", null)
b.HasOne("NadekoBot.Db.Models.XpSettings", "XpSettings")
.WithMany("ExclusionList")
.HasForeignKey("XpSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_excludeditem_xpsettings_xpsettingsid");
b.Navigation("XpSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.FeedSub", b =>
@@ -3381,6 +3355,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterInvitesChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filterchannelid_guildconfigs_guildconfigid");
});
@@ -3389,6 +3364,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterLinksChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filterlinkschannelid_guildconfigs_guildconfigid");
});
@@ -3397,6 +3373,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterWordsChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filterwordschannelid_guildconfigs_guildconfigid");
});
@@ -3405,6 +3382,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilteredWords")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filteredword_guildconfigs_guildconfigid");
});
@@ -3413,6 +3391,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FollowedStreams")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_followedstream_guildconfigs_guildconfigid");
});
@@ -3421,6 +3400,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
.WithMany("GenerateCurrencyChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_gcchannelid_guildconfigs_guildconfigid");
b.Navigation("GuildConfig");
@@ -3460,21 +3440,12 @@ namespace NadekoBot.Migrations.Mysql
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.HasOne("NadekoBot.Db.Models.LogSetting", "LogSetting")
.WithMany()
.HasForeignKey("LogSettingId")
.HasConstraintName("fk_ignoredvoicepresencechannels_logsettings_logsettingid");
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.MutedUserId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("MutedUsers")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_muteduserid_guildconfigs_guildconfigid");
});
@@ -3483,6 +3454,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("Permissions")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_permissions_guildconfigs_guildconfigid");
});
@@ -3500,6 +3472,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("ShopEntries")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_shopentry_guildconfigs_guildconfigid");
});
@@ -3508,6 +3481,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.ShopEntry", null)
.WithMany("Items")
.HasForeignKey("ShopEntryId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_shopentryitem_shopentry_shopentryid");
});
@@ -3516,6 +3490,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredRoles")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_slowmodeignoredrole_guildconfigs_guildconfigid");
});
@@ -3524,15 +3499,20 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredUsers")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_slowmodeignoreduser_guildconfigs_guildconfigid");
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleBlacklistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Blacklist")
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_streamroleblacklisteduser_streamrolesettings_streamrolesetti~");
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleSettings", b =>
@@ -3549,10 +3529,14 @@ namespace NadekoBot.Migrations.Mysql
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleWhitelistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Whitelist")
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_streamrolewhitelisteduser_streamrolesettings_streamrolesetti~");
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.TodoModel", b =>
@@ -3569,6 +3553,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnbanTimer")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_unbantimer_guildconfigs_guildconfigid");
});
@@ -3577,6 +3562,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnmuteTimers")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_unmutetimer_guildconfigs_guildconfigid");
});
@@ -3585,6 +3571,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnroleTimer")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_unroletimer_guildconfigs_guildconfigid");
});
@@ -3593,6 +3580,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("VcRoleInfos")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_vcroleinfo_guildconfigs_guildconfigid");
});
@@ -3663,6 +3651,7 @@ namespace NadekoBot.Migrations.Mysql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("WarnPunishments")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_warningpunishment_guildconfigs_guildconfigid");
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,702 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace NadekoBot.Migrations.PostgreSql
{
/// <inheritdoc />
public partial class guidlconfigcleanup : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting");
migrationBuilder.DropForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore");
migrationBuilder.DropForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting");
migrationBuilder.DropForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias");
migrationBuilder.DropForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown");
migrationBuilder.DropForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel");
migrationBuilder.DropForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem");
migrationBuilder.DropForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid");
migrationBuilder.DropForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword");
migrationBuilder.DropForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid");
migrationBuilder.DropForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid");
migrationBuilder.DropForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream");
migrationBuilder.DropForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid");
migrationBuilder.DropForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid");
migrationBuilder.DropForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions");
migrationBuilder.DropForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry");
migrationBuilder.DropForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser");
migrationBuilder.DropForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesett~",
table: "streamroleblacklisteduser");
migrationBuilder.DropForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesett~",
table: "streamrolewhitelisteduser");
migrationBuilder.DropForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer");
migrationBuilder.DropForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer");
migrationBuilder.DropForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer");
migrationBuilder.DropForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo");
migrationBuilder.DropForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment");
migrationBuilder.DropTable(
name: "ignoredvoicepresencechannels");
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamrolewhitelisteduser",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamroleblacklisteduser",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "guildconfigid",
table: "delmsgoncmdchannel",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore",
column: "antispamsettingid",
principalTable: "antispamsetting",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem",
column: "xpsettingsid",
principalTable: "xpsettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem",
column: "shopentryid",
principalTable: "shopentry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesett~",
table: "streamroleblacklisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesett~",
table: "streamrolewhitelisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting");
migrationBuilder.DropForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore");
migrationBuilder.DropForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting");
migrationBuilder.DropForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias");
migrationBuilder.DropForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown");
migrationBuilder.DropForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel");
migrationBuilder.DropForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem");
migrationBuilder.DropForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid");
migrationBuilder.DropForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword");
migrationBuilder.DropForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid");
migrationBuilder.DropForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid");
migrationBuilder.DropForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream");
migrationBuilder.DropForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid");
migrationBuilder.DropForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid");
migrationBuilder.DropForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions");
migrationBuilder.DropForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry");
migrationBuilder.DropForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole");
migrationBuilder.DropForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser");
migrationBuilder.DropForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesett~",
table: "streamroleblacklisteduser");
migrationBuilder.DropForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesett~",
table: "streamrolewhitelisteduser");
migrationBuilder.DropForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer");
migrationBuilder.DropForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer");
migrationBuilder.DropForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer");
migrationBuilder.DropForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo");
migrationBuilder.DropForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment");
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamrolewhitelisteduser",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<int>(
name: "streamrolesettingsid",
table: "streamroleblacklisteduser",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<int>(
name: "guildconfigid",
table: "delmsgoncmdchannel",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.CreateTable(
name: "ignoredvoicepresencechannels",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
logsettingid = table.Column<int>(type: "integer", nullable: true),
channelid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
dateadded = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_ignoredvoicepresencechannels", x => x.id);
table.ForeignKey(
name: "fk_ignoredvoicepresencechannels_logsettings_logsettingid",
column: x => x.logsettingid,
principalTable: "logsettings",
principalColumn: "id");
});
migrationBuilder.CreateIndex(
name: "ix_ignoredvoicepresencechannels_logsettingid",
table: "ignoredvoicepresencechannels",
column: "logsettingid");
migrationBuilder.AddForeignKey(
name: "fk_antiraidsetting_guildconfigs_guildconfigid",
table: "antiraidsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_antispamignore_antispamsetting_antispamsettingid",
table: "antispamignore",
column: "antispamsettingid",
principalTable: "antispamsetting",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_antispamsetting_guildconfigs_guildconfigid",
table: "antispamsetting",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_commandalias_guildconfigs_guildconfigid",
table: "commandalias",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_commandcooldown_guildconfigs_guildconfigid",
table: "commandcooldown",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_delmsgoncmdchannel_guildconfigs_guildconfigid",
table: "delmsgoncmdchannel",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_excludeditem_xpsettings_xpsettingsid",
table: "excludeditem",
column: "xpsettingsid",
principalTable: "xpsettings",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filterchannelid_guildconfigs_guildconfigid",
table: "filterchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filteredword_guildconfigs_guildconfigid",
table: "filteredword",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filterlinkschannelid_guildconfigs_guildconfigid",
table: "filterlinkschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_filterwordschannelid_guildconfigs_guildconfigid",
table: "filterwordschannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_followedstream_guildconfigs_guildconfigid",
table: "followedstream",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_gcchannelid_guildconfigs_guildconfigid",
table: "gcchannelid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_muteduserid_guildconfigs_guildconfigid",
table: "muteduserid",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_permissions_guildconfigs_guildconfigid",
table: "permissions",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_shopentry_guildconfigs_guildconfigid",
table: "shopentry",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_shopentryitem_shopentry_shopentryid",
table: "shopentryitem",
column: "shopentryid",
principalTable: "shopentry",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoredrole_guildconfigs_guildconfigid",
table: "slowmodeignoredrole",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_slowmodeignoreduser_guildconfigs_guildconfigid",
table: "slowmodeignoreduser",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_streamroleblacklisteduser_streamrolesettings_streamrolesett~",
table: "streamroleblacklisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_streamrolewhitelisteduser_streamrolesettings_streamrolesett~",
table: "streamrolewhitelisteduser",
column: "streamrolesettingsid",
principalTable: "streamrolesettings",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_unbantimer_guildconfigs_guildconfigid",
table: "unbantimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_unmutetimer_guildconfigs_guildconfigid",
table: "unmutetimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_unroletimer_guildconfigs_guildconfigid",
table: "unroletimer",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_vcroleinfo_guildconfigs_guildconfigid",
table: "vcroleinfo",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_warningpunishment_guildconfigs_guildconfigid",
table: "warningpunishment",
column: "guildconfigid",
principalTable: "guildconfigs",
principalColumn: "id");
}
}
}

View File

@@ -672,7 +672,7 @@ namespace NadekoBot.Migrations.PostgreSql
.HasColumnType("timestamp without time zone")
.HasColumnName("dateadded");
b.Property<int?>("GuildConfigId")
b.Property<int>("GuildConfigId")
.HasColumnType("integer")
.HasColumnName("guildconfigid");
@@ -1422,36 +1422,6 @@ namespace NadekoBot.Migrations.PostgreSql
b.ToTable("ignoredlogchannels", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<decimal>("ChannelId")
.HasColumnType("numeric(20,0)")
.HasColumnName("channelid");
b.Property<DateTime?>("DateAdded")
.HasColumnType("timestamp without time zone")
.HasColumnName("dateadded");
b.Property<int?>("LogSettingId")
.HasColumnType("integer")
.HasColumnName("logsettingid");
b.HasKey("Id")
.HasName("pk_ignoredvoicepresencechannels");
b.HasIndex("LogSettingId")
.HasDatabaseName("ix_ignoredvoicepresencechannels_logsettingid");
b.ToTable("ignoredvoicepresencechannels", (string)null);
});
modelBuilder.Entity("NadekoBot.Db.Models.ImageOnlyChannel", b =>
{
b.Property<int>("Id")
@@ -2507,7 +2477,7 @@ namespace NadekoBot.Migrations.PostgreSql
.HasColumnType("timestamp without time zone")
.HasColumnName("dateadded");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("integer")
.HasColumnName("streamrolesettingsid");
@@ -2584,7 +2554,7 @@ namespace NadekoBot.Migrations.PostgreSql
.HasColumnType("timestamp without time zone")
.HasColumnName("dateadded");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("integer")
.HasColumnName("streamrolesettingsid");
@@ -3223,14 +3193,12 @@ namespace NadekoBot.Migrations.PostgreSql
modelBuilder.Entity("NadekoBot.Db.Models.AntiRaidSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiRaidSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiRaidSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_antiraidsetting_guildconfigs_guildconfigid");
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamIgnore", b =>
@@ -3238,19 +3206,18 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.AntiSpamSetting", null)
.WithMany("IgnoredChannels")
.HasForeignKey("AntiSpamSettingId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_antispamignore_antispamsetting_antispamsettingid");
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiSpamSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiSpamSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_antispamsetting_guildconfigs_guildconfigid");
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AutoTranslateUser", b =>
@@ -3323,6 +3290,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandAliases")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_commandalias_guildconfigs_guildconfigid");
});
@@ -3331,6 +3299,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandCooldowns")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_commandcooldown_guildconfigs_guildconfigid");
});
@@ -3339,6 +3308,8 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("DelMsgOnCmdChannels")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_delmsgoncmdchannel_guildconfigs_guildconfigid");
});
@@ -3355,10 +3326,13 @@ namespace NadekoBot.Migrations.PostgreSql
modelBuilder.Entity("NadekoBot.Db.Models.ExcludedItem", b =>
{
b.HasOne("NadekoBot.Db.Models.XpSettings", null)
b.HasOne("NadekoBot.Db.Models.XpSettings", "XpSettings")
.WithMany("ExclusionList")
.HasForeignKey("XpSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_excludeditem_xpsettings_xpsettingsid");
b.Navigation("XpSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.FeedSub", b =>
@@ -3378,6 +3352,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterInvitesChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filterchannelid_guildconfigs_guildconfigid");
});
@@ -3386,6 +3361,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterLinksChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filterlinkschannelid_guildconfigs_guildconfigid");
});
@@ -3394,6 +3370,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterWordsChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filterwordschannelid_guildconfigs_guildconfigid");
});
@@ -3402,6 +3379,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilteredWords")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_filteredword_guildconfigs_guildconfigid");
});
@@ -3410,6 +3388,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FollowedStreams")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_followedstream_guildconfigs_guildconfigid");
});
@@ -3418,6 +3397,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
.WithMany("GenerateCurrencyChannelIds")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_gcchannelid_guildconfigs_guildconfigid");
b.Navigation("GuildConfig");
@@ -3457,21 +3437,12 @@ namespace NadekoBot.Migrations.PostgreSql
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.HasOne("NadekoBot.Db.Models.LogSetting", "LogSetting")
.WithMany()
.HasForeignKey("LogSettingId")
.HasConstraintName("fk_ignoredvoicepresencechannels_logsettings_logsettingid");
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.MutedUserId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("MutedUsers")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_muteduserid_guildconfigs_guildconfigid");
});
@@ -3480,6 +3451,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("Permissions")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_permissions_guildconfigs_guildconfigid");
});
@@ -3497,6 +3469,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("ShopEntries")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_shopentry_guildconfigs_guildconfigid");
});
@@ -3505,6 +3478,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.ShopEntry", null)
.WithMany("Items")
.HasForeignKey("ShopEntryId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_shopentryitem_shopentry_shopentryid");
});
@@ -3513,6 +3487,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredRoles")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_slowmodeignoredrole_guildconfigs_guildconfigid");
});
@@ -3521,15 +3496,20 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredUsers")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_slowmodeignoreduser_guildconfigs_guildconfigid");
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleBlacklistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Blacklist")
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_streamroleblacklisteduser_streamrolesettings_streamrolesett~");
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleSettings", b =>
@@ -3546,10 +3526,14 @@ namespace NadekoBot.Migrations.PostgreSql
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleWhitelistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Whitelist")
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_streamrolewhitelisteduser_streamrolesettings_streamrolesett~");
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.TodoModel", b =>
@@ -3566,6 +3550,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnbanTimer")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_unbantimer_guildconfigs_guildconfigid");
});
@@ -3574,6 +3559,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnmuteTimers")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_unmutetimer_guildconfigs_guildconfigid");
});
@@ -3582,6 +3568,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnroleTimer")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_unroletimer_guildconfigs_guildconfigid");
});
@@ -3590,6 +3577,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("VcRoleInfos")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_vcroleinfo_guildconfigs_guildconfigid");
});
@@ -3660,6 +3648,7 @@ namespace NadekoBot.Migrations.PostgreSql
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("WarnPunishments")
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_warningpunishment_guildconfigs_guildconfigid");
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,701 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
/// <inheritdoc />
public partial class guidlconfigcleanup : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting");
migrationBuilder.DropForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias");
migrationBuilder.DropForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown");
migrationBuilder.DropForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel");
migrationBuilder.DropForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem");
migrationBuilder.DropForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord");
migrationBuilder.DropForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream");
migrationBuilder.DropForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId");
migrationBuilder.DropForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId");
migrationBuilder.DropForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser");
migrationBuilder.DropForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer");
migrationBuilder.DropForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo");
migrationBuilder.DropForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment");
migrationBuilder.DropTable(
name: "IgnoredVoicePresenceCHannels");
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "GuildConfigId",
table: "DelMsgOnCmdChannel",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore",
column: "AntiSpamSettingId",
principalTable: "AntiSpamSetting",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem",
column: "XpSettingsId",
principalTable: "XpSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem",
column: "ShopEntryId",
principalTable: "ShopEntry",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting");
migrationBuilder.DropForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias");
migrationBuilder.DropForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown");
migrationBuilder.DropForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel");
migrationBuilder.DropForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem");
migrationBuilder.DropForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord");
migrationBuilder.DropForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream");
migrationBuilder.DropForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId");
migrationBuilder.DropForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId");
migrationBuilder.DropForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser");
migrationBuilder.DropForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer");
migrationBuilder.DropForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo");
migrationBuilder.DropForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment");
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn<int>(
name: "GuildConfigId",
table: "DelMsgOnCmdChannel",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.CreateTable(
name: "IgnoredVoicePresenceCHannels",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
LogSettingId = table.Column<int>(type: "INTEGER", nullable: true),
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IgnoredVoicePresenceCHannels", x => x.Id);
table.ForeignKey(
name: "FK_IgnoredVoicePresenceCHannels_LogSettings_LogSettingId",
column: x => x.LogSettingId,
principalTable: "LogSettings",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_IgnoredVoicePresenceCHannels_LogSettingId",
table: "IgnoredVoicePresenceCHannels",
column: "LogSettingId");
migrationBuilder.AddForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore",
column: "AntiSpamSettingId",
principalTable: "AntiSpamSetting",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem",
column: "XpSettingsId",
principalTable: "XpSettings",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem",
column: "ShopEntryId",
principalTable: "ShopEntry",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
}
}
}

View File

@@ -501,7 +501,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("GuildConfigId")
b.Property<int>("GuildConfigId")
.HasColumnType("INTEGER");
b.Property<bool>("State")
@@ -1059,28 +1059,6 @@ namespace NadekoBot.Migrations
b.ToTable("IgnoredLogChannels");
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("ChannelId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("LogSettingId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("LogSettingId");
b.ToTable("IgnoredVoicePresenceCHannels");
});
modelBuilder.Entity("NadekoBot.Db.Models.ImageOnlyChannel", b =>
{
b.Property<int>("Id")
@@ -1867,7 +1845,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("INTEGER");
b.Property<ulong>("UserId")
@@ -1924,7 +1902,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("INTEGER");
b.Property<ulong>("UserId")
@@ -2397,31 +2375,28 @@ namespace NadekoBot.Migrations
modelBuilder.Entity("NadekoBot.Db.Models.AntiRaidSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiRaidSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiRaidSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamIgnore", b =>
{
b.HasOne("NadekoBot.Db.Models.AntiSpamSetting", null)
.WithMany("IgnoredChannels")
.HasForeignKey("AntiSpamSettingId");
.HasForeignKey("AntiSpamSettingId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiSpamSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiSpamSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AutoTranslateUser", b =>
@@ -2487,21 +2462,25 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandAliases")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.CommandCooldown", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandCooldowns")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.DelMsgOnCmdChannel", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("DelMsgOnCmdChannels")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("NadekoBot.Db.Models.DiscordUser", b =>
@@ -2516,9 +2495,12 @@ namespace NadekoBot.Migrations
modelBuilder.Entity("NadekoBot.Db.Models.ExcludedItem", b =>
{
b.HasOne("NadekoBot.Db.Models.XpSettings", null)
b.HasOne("NadekoBot.Db.Models.XpSettings", "XpSettings")
.WithMany("ExclusionList")
.HasForeignKey("XpSettingsId");
.HasForeignKey("XpSettingsId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("XpSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.FeedSub", b =>
@@ -2536,42 +2518,48 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterInvitesChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FilterLinksChannelId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterLinksChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FilterWordsChannelId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterWordsChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FilteredWord", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilteredWords")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FollowedStream", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FollowedStreams")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.GCChannelId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
.WithMany("GenerateCurrencyChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("GuildConfig");
});
@@ -2607,27 +2595,20 @@ namespace NadekoBot.Migrations
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.HasOne("NadekoBot.Db.Models.LogSetting", "LogSetting")
.WithMany()
.HasForeignKey("LogSettingId");
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.MutedUserId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("MutedUsers")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.Permissionv2", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("Permissions")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.PlaylistSong", b =>
@@ -2642,35 +2623,43 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("ShopEntries")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.ShopEntryItem", b =>
{
b.HasOne("NadekoBot.Db.Models.ShopEntry", null)
.WithMany("Items")
.HasForeignKey("ShopEntryId");
.HasForeignKey("ShopEntryId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.SlowmodeIgnoredRole", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredRoles")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.SlowmodeIgnoredUser", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredUsers")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleBlacklistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Blacklist")
.HasForeignKey("StreamRoleSettingsId");
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleSettings", b =>
@@ -2686,9 +2675,13 @@ namespace NadekoBot.Migrations
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleWhitelistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Whitelist")
.HasForeignKey("StreamRoleSettingsId");
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.TodoModel", b =>
@@ -2703,28 +2696,32 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnbanTimer")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.UnmuteTimer", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnmuteTimers")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.UnroleTimer", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnroleTimer")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.VcRoleInfo", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("VcRoleInfos")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.WaifuInfo", b =>
@@ -2786,7 +2783,8 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("WarnPunishments")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.XpCurrencyReward", b =>

View File

@@ -1,5 +1,6 @@
#nullable disable
using NadekoBot.Common.TypeReaders.Models;
using NadekoBot.Modules.Administration._common.results;
using NadekoBot.Modules.Administration.Services;
namespace NadekoBot.Modules.Administration;
@@ -405,4 +406,94 @@ public partial class Administration : NadekoModule<AdministrationService>
await Response().Confirm(strs.autopublish_disable).SendAsync();
}
}
[Cmd]
[UserPerm(GuildPerm.ManageNicknames)]
[BotPerm(GuildPerm.ChangeNickname)]
[Priority(0)]
public async Task SetNick([Leftover] string newNick = null)
{
if (string.IsNullOrWhiteSpace(newNick))
return;
var curUser = await ctx.Guild.GetCurrentUserAsync();
await curUser.ModifyAsync(u => u.Nickname = newNick);
await Response().Confirm(strs.bot_nick(Format.Bold(newNick) ?? "-")).SendAsync();
}
[Cmd]
[BotPerm(GuildPerm.ManageNicknames)]
[UserPerm(GuildPerm.ManageNicknames)]
[Priority(1)]
public async Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
{
var sg = (SocketGuild)ctx.Guild;
if (sg.OwnerId == gu.Id
|| gu.GetRoles().Max(r => r.Position) >= sg.CurrentUser.GetRoles().Max(r => r.Position))
{
await Response().Error(strs.insuf_perms_i).SendAsync();
return;
}
await gu.ModifyAsync(u => u.Nickname = newNick);
await Response()
.Confirm(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"))
.SendAsync();
}
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPermission.ManageGuild)]
[BotPerm(GuildPermission.ManageGuild)]
public async Task SetServerBanner([Leftover] string img = null)
{
// Tier2 or higher is required to set a banner.
if (ctx.Guild.PremiumTier is PremiumTier.Tier1 or PremiumTier.None) return;
var result = await _service.SetServerBannerAsync(ctx.Guild, img);
switch (result)
{
case SetServerBannerResult.Success:
await Response().Confirm(strs.set_srvr_banner).SendAsync();
break;
case SetServerBannerResult.InvalidFileType:
await Response().Error(strs.srvr_banner_invalid).SendAsync();
break;
case SetServerBannerResult.Toolarge:
await Response().Error(strs.srvr_banner_too_large).SendAsync();
break;
case SetServerBannerResult.InvalidURL:
await Response().Error(strs.srvr_banner_invalid_url).SendAsync();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPermission.ManageGuild)]
[BotPerm(GuildPermission.ManageGuild)]
public async Task SetServerIcon([Leftover] string img = null)
{
var result = await _service.SetServerIconAsync(ctx.Guild, img);
switch (result)
{
case SetServerIconResult.Success:
await Response().Confirm(strs.set_srvr_icon).SendAsync();
break;
case SetServerIconResult.InvalidFileType:
await Response().Error(strs.srvr_banner_invalid).SendAsync();
break;
case SetServerIconResult.InvalidURL:
await Response().Error(strs.srvr_banner_invalid_url).SendAsync();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}

View File

@@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore;
using NadekoBot.Db;
using NadekoBot.Db.Models;
using NadekoBot.Modules.Administration._common.results;
namespace NadekoBot.Modules.Administration.Services;
@@ -13,17 +14,20 @@ public class AdministrationService : INService
private readonly DbService _db;
private readonly IReplacementService _repSvc;
private readonly ILogCommandService _logService;
private readonly IHttpClientFactory _httpFactory;
public AdministrationService(
IBot bot,
CommandHandler cmdHandler,
DbService db,
IReplacementService repSvc,
ILogCommandService logService)
ILogCommandService logService,
IHttpClientFactory factory)
{
_db = db;
_repSvc = repSvc;
_logService = logService;
_httpFactory = factory;
DeleteMessagesOnCommand = new(bot.AllGuildConfigs.Where(g => g.DeleteMessageOnCommand).Select(g => g.GuildId));
@@ -158,4 +162,45 @@ public class AdministrationService : INService
await umsg.EditAsync(text);
}
public async Task<SetServerBannerResult> SetServerBannerAsync(IGuild guild, string img)
{
if (!IsValidUri(img)) return SetServerBannerResult.InvalidURL;
var uri = new Uri(img);
using var http = _httpFactory.CreateClient();
using var sr = await http.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead);
if (!sr.IsImage()) return SetServerBannerResult.InvalidFileType;
if (sr.GetContentLength() > 8.Megabytes())
{
return SetServerBannerResult.Toolarge;
}
await using var imageStream = await sr.Content.ReadAsStreamAsync();
await guild.ModifyAsync(x => x.Banner = new Image(imageStream));
return SetServerBannerResult.Success;
}
public async Task<SetServerIconResult> SetServerIconAsync(IGuild guild, string img)
{
if (!IsValidUri(img)) return SetServerIconResult.InvalidURL;
var uri = new Uri(img);
using var http = _httpFactory.CreateClient();
using var sr = await http.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead);
if (!sr.IsImage()) return SetServerIconResult.InvalidFileType;
await using var imageStream = await sr.Content.ReadAsStreamAsync();
await guild.ModifyAsync(x => x.Icon = new Image(imageStream));
return SetServerIconResult.Success;
}
private bool IsValidUri(string img) => !string.IsNullOrWhiteSpace(img) && Uri.IsWellFormedUriString(img, UriKind.Absolute);
}

View File

@@ -0,0 +1,31 @@
namespace NadekoBot.Modules.Administration.DangerousCommands;
public partial class Administration
{
[Group]
public class CleanupCommands : CleanupModuleBase
{
private readonly ICleanupService _svc;
public CleanupCommands(ICleanupService svc)
=> _svc = svc;
[Cmd]
[OwnerOnly]
[RequireContext(ContextType.DM)]
public async Task CleanupGuildData()
{
var result = await _svc.DeleteMissingGuildDataAsync();
if (result is null)
{
await ctx.ErrorAsync();
return;
}
await Response()
.Confirm($"{result.GuildCount} guilds' data remain in the database.")
.SendAsync();
}
}
}

View File

@@ -0,0 +1,106 @@
using LinqToDB;
using LinqToDB.Data;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Db.Models;
namespace NadekoBot.Modules.Administration.DangerousCommands;
public sealed class CleanupService : ICleanupService, IReadyExecutor, INService
{
private readonly IPubSub _pubSub;
private TypedKey<KeepReport> _keepReportKey = new("cleanup:report");
private TypedKey<bool> _keepTriggerKey = new("cleanup:trigger");
private readonly DiscordSocketClient _client;
private ConcurrentDictionary<int, ulong[]> guildIds = new();
private readonly IBotCredsProvider _creds;
private readonly DbService _db;
public CleanupService(
IPubSub pubSub,
DiscordSocketClient client,
IBotCredsProvider creds,
DbService db)
{
_pubSub = pubSub;
_client = client;
_creds = creds;
_db = db;
}
public async Task<KeepResult?> DeleteMissingGuildDataAsync()
{
guildIds = new();
var totalShards = _creds.GetCreds().TotalShards;
await _pubSub.Pub(_keepTriggerKey, true);
var counter = 0;
while (guildIds.Keys.Count < totalShards)
{
await Task.Delay(1000);
counter++;
if (counter >= 5)
break;
}
if (guildIds.Keys.Count < totalShards)
return default;
var allIds = guildIds.SelectMany(x => x.Value)
.ToArray();
await using var ctx = _db.GetDbContext();
await using var linqCtx = ctx.CreateLinqToDBContext();
await using var tempTable = linqCtx.CreateTempTable<CleanupId>();
foreach (var chunk in allIds.Chunk(20000))
{
await tempTable.BulkCopyAsync(chunk.Select(x => new CleanupId()
{
GuildId = x
}));
}
await ctx.GetTable<GuildConfig>()
.Where(x => !tempTable.Select(x => x.GuildId)
.Contains(x.GuildId))
.DeleteAsync();
await ctx.GetTable<UserXpStats>()
.Where(x => !tempTable.Select(x => x.GuildId)
.Contains(x.GuildId))
.DeleteAsync();
return new()
{
GuildCount = guildIds.Keys.Count,
};
}
private ValueTask OnKeepReport(KeepReport report)
{
guildIds[report.ShardId] = report.GuildIds;
return default;
}
public async Task OnReadyAsync()
{
await _pubSub.Sub(_keepTriggerKey, OnKeepTrigger);
if (_client.ShardId == 0)
await _pubSub.Sub(_keepReportKey, OnKeepReport);
}
private ValueTask OnKeepTrigger(bool arg)
{
_pubSub.Pub(_keepReportKey,
new KeepReport()
{
ShardId = _client.ShardId,
GuildIds = _client.GetGuildIds(),
});
return default;
}
}

View File

@@ -0,0 +1,9 @@
using System.ComponentModel.DataAnnotations;
namespace NadekoBot.Modules.Administration.DangerousCommands;
public sealed class CleanupId
{
[Key]
public ulong GuildId { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace NadekoBot.Modules.Administration.DangerousCommands;
public interface ICleanupService
{
Task<KeepResult?> DeleteMissingGuildDataAsync();
}

View File

@@ -0,0 +1,7 @@
namespace NadekoBot.Modules.Administration.DangerousCommands;
public sealed class KeepReport
{
public required int ShardId { get; init; }
public required ulong[] GuildIds { get; init; }
}

View File

@@ -0,0 +1,6 @@
namespace NadekoBot.Modules.Administration.DangerousCommands;
public sealed class KeepResult
{
public required int GuildCount { get; init; }
}

View File

@@ -61,7 +61,13 @@ public partial class Administration
}
else
{
ci = new(name);
ci = new CultureInfo(name);
if (!_supportedLocales.ContainsKey(ci.Name))
{
await LanguagesList();
return;
}
_localization.SetGuildCulture(ctx.Guild, ci);
}
@@ -97,7 +103,12 @@ public partial class Administration
}
else
{
ci = new(name);
ci = new CultureInfo(name);
if (!_supportedLocales.ContainsKey(ci.Name))
{
await LanguagesList();
return;
}
_localization.SetDefaultCulture(ci);
}

View File

@@ -459,42 +459,7 @@ public partial class Administration
await Response().Confirm(strs.bot_name(Format.Bold(newName))).SendAsync();
}
[Cmd]
[UserPerm(GuildPerm.ManageNicknames)]
[BotPerm(GuildPerm.ChangeNickname)]
[Priority(0)]
public async Task SetNick([Leftover] string newNick = null)
{
if (string.IsNullOrWhiteSpace(newNick))
return;
var curUser = await ctx.Guild.GetCurrentUserAsync();
await curUser.ModifyAsync(u => u.Nickname = newNick);
await Response().Confirm(strs.bot_nick(Format.Bold(newNick) ?? "-")).SendAsync();
}
[Cmd]
[BotPerm(GuildPerm.ManageNicknames)]
[UserPerm(GuildPerm.ManageNicknames)]
[Priority(1)]
public async Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
{
var sg = (SocketGuild)ctx.Guild;
if (sg.OwnerId == gu.Id
|| gu.GetRoles().Max(r => r.Position) >= sg.CurrentUser.GetRoles().Max(r => r.Position))
{
await Response().Error(strs.insuf_perms_i).SendAsync();
return;
}
await gu.ModifyAsync(u => u.Nickname = newNick);
await Response()
.Confirm(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"))
.SendAsync();
}
[Cmd]
[OwnerOnly]
public async Task SetStatus([Leftover] SettableUserStatus status)

View File

@@ -0,0 +1,9 @@
namespace NadekoBot.Modules.Administration._common.results;
public enum SetServerBannerResult
{
Success,
InvalidFileType,
Toolarge,
InvalidURL
}

View File

@@ -0,0 +1,8 @@
namespace NadekoBot.Modules.Administration._common.results;
public enum SetServerIconResult
{
Success,
InvalidFileType,
InvalidURL
}

View File

@@ -1,5 +1,7 @@
#nullable disable
using NadekoBot.Db.Models;
namespace NadekoBot.Modules.NadekoExpressions;
[Name("Expressions")]
@@ -34,12 +36,12 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
await Response()
.Embed(_sender.CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.expr_new))
.WithDescription($"#{new kwum(ex.Id)}")
.AddField(GetText(strs.trigger), key)
.AddField(GetText(strs.response),
message.Length > 1024 ? GetText(strs.redacted_too_long) : message))
.WithOkColor()
.WithTitle(GetText(strs.expr_new))
.WithDescription($"#{new kwum(ex.Id)}")
.AddField(GetText(strs.trigger), key)
.AddField(GetText(strs.response),
message.Length > 1024 ? GetText(strs.redacted_too_long) : message))
.SendAsync();
}
@@ -68,9 +70,9 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
[Cmd]
public async Task ExprAdd(string key, [Leftover] string message)
public async Task ExprAdd(string trigger, [Leftover] string response)
{
if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key))
if (string.IsNullOrWhiteSpace(response) || string.IsNullOrWhiteSpace(trigger))
{
return;
}
@@ -81,7 +83,7 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
return;
}
await ExprAddInternalAsync(key, message);
await ExprAddInternalAsync(trigger, response);
}
[Cmd]
@@ -93,8 +95,7 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
return;
}
if ((channel is null && !_creds.IsOwner(ctx.User))
|| (channel is not null && !((IGuildUser)ctx.User).GuildPermissions.Administrator))
if (!IsValidExprEditor())
{
await Response().Error(strs.expr_insuff_perms).SendAsync();
return;
@@ -105,12 +106,12 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
{
await Response()
.Embed(_sender.CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.expr_edited))
.WithDescription($"#{id}")
.AddField(GetText(strs.trigger), ex.Trigger)
.AddField(GetText(strs.response),
message.Length > 1024 ? GetText(strs.redacted_too_long) : message))
.WithOkColor()
.WithTitle(GetText(strs.expr_edited))
.WithDescription($"#{id}")
.AddField(GetText(strs.trigger), ex.Trigger)
.AddField(GetText(strs.response),
message.Length > 1024 ? GetText(strs.redacted_too_long) : message))
.SendAsync();
}
else
@@ -119,6 +120,10 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
}
}
private bool IsValidExprEditor()
=> (ctx.Guild is not null && ((IGuildUser)ctx.User).GuildPermissions.Administrator)
|| (ctx.Guild is null && _creds.IsOwner(ctx.User));
[Cmd]
[Priority(1)]
public async Task ExprList(int page = 1)
@@ -132,7 +137,7 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
.OrderBy(x => x.Trigger)
.ToArray();
if (allExpressions is null || !allExpressions.Any())
if (!allExpressions.Any())
{
await Response().Error(strs.expr_no_found).SendAsync();
return;
@@ -171,16 +176,48 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
return;
}
var inter = CreateEditInteraction(id, found);
await Response()
.Interaction(IsValidExprEditor() ? inter : null)
.Embed(_sender.CreateEmbed()
.WithOkColor()
.WithDescription($"#{id}")
.AddField(GetText(strs.trigger), found.Trigger.TrimTo(1024))
.AddField(GetText(strs.response),
found.Response.TrimTo(1000).Replace("](", "]\\(")))
.WithOkColor()
.WithDescription($"#{id}")
.AddField(GetText(strs.trigger), found.Trigger.TrimTo(1024))
.AddField(GetText(strs.response),
found.Response.TrimTo(1000).Replace("](", "]\\(")))
.SendAsync();
}
private NadekoInteractionBase CreateEditInteraction(kwum id, NadekoExpression found)
{
var modal = new ModalBuilder()
.WithCustomId("expr:edit_modal")
.WithTitle($"Edit expression {id}")
.AddTextInput(new TextInputBuilder()
.WithLabel(GetText(strs.response))
.WithValue(found.Response)
.WithMinLength(1)
.WithCustomId("expr:edit_modal:response")
.WithStyle(TextInputStyle.Paragraph));
var inter = _inter.Create(ctx.User.Id,
new ButtonBuilder()
.WithEmote(Emoji.Parse("📝"))
.WithLabel("Edit")
.WithStyle(ButtonStyle.Primary)
.WithCustomId("test"),
modal,
async (sm) =>
{
var msg = sm.Data.Components.FirstOrDefault()?.Value;
await ExprEdit(id, msg);
}
);
return inter;
}
public async Task ExprDeleteInternalAsync(kwum id)
{
var ex = await _service.DeleteAsync(ctx.Guild?.Id, id);
@@ -189,11 +226,11 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
{
await Response()
.Embed(_sender.CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.expr_deleted))
.WithDescription($"#{id}")
.AddField(GetText(strs.trigger), ex.Trigger.TrimTo(1024))
.AddField(GetText(strs.response), ex.Response.TrimTo(1024)))
.WithOkColor()
.WithTitle(GetText(strs.expr_deleted))
.WithDescription($"#{id}")
.AddField(GetText(strs.trigger), ex.Trigger.TrimTo(1024))
.AddField(GetText(strs.response), ex.Response.TrimTo(1024)))
.SendAsync();
}
else
@@ -340,8 +377,8 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
public async Task ExprClear()
{
if (await PromptUserConfirmAsync(_sender.CreateEmbed()
.WithTitle("Expression clear")
.WithDescription("This will delete all expressions on this server.")))
.WithTitle("Expression clear")
.WithDescription("This will delete all expressions on this server.")))
{
var count = _service.DeleteAllExpressions(ctx.Guild.Id);
await Response().Confirm(strs.exprs_cleared(count)).SendAsync();

View File

@@ -6,6 +6,7 @@ using NadekoBot.Db;
using NadekoBot.Db.Models;
using System.Runtime.CompilerServices;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Modules.Permissions.Services;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
@@ -77,6 +78,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
private bool ready;
private ConcurrentHashSet<ulong> _disabledGlobalExpressionGuilds;
private readonly PermissionService _pc;
public NadekoExpressionsService(
DbService db,
@@ -87,7 +89,8 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
IPubSub pubSub,
IMessageSenderService sender,
IReplacementService repSvc,
IPermissionChecker permChecker)
IPermissionChecker permChecker,
PermissionService pc)
{
_db = db;
_client = client;
@@ -98,6 +101,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
_sender = sender;
_repSvc = repSvc;
_permChecker = permChecker;
_pc = pc;
_rng = new NadekoRandom();
_pubSub.Sub(_exprsReloadedKey, OnExprsShouldReload);
@@ -138,6 +142,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
var globalItems = uow.Set<NadekoExpression>()
.AsNoTracking()
.Where(x => x.GuildId == null || x.GuildId == 0)
.Where(x => x.Trigger != null)
.AsEnumerable()
.Select(x =>
{
@@ -254,26 +259,30 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
"ACTUALEXPRESSIONS",
expr.Trigger
);
if (!result.IsAllowed)
{
if (result.TryPickT3(out var disallowed, out _))
var cache = _pc.GetCacheFor(guild.Id);
if (cache.Verbose)
{
var permissionMessage = _strings.GetText(strs.perm_prevent(disallowed.PermIndex + 1,
Format.Bold(disallowed.PermText)),
sg.Id);
try
if (result.TryPickT3(out var disallowed, out _))
{
await _sender.Response(msg.Channel)
.Error(permissionMessage)
.SendAsync();
}
catch
{
}
var permissionMessage = _strings.GetText(strs.perm_prevent(disallowed.PermIndex + 1,
Format.Bold(disallowed.PermText)),
sg.Id);
Log.Information("{PermissionMessage}", permissionMessage);
try
{
await _sender.Response(msg.Channel)
.Error(permissionMessage)
.SendAsync();
}
catch
{
}
Log.Information("{PermissionMessage}", permissionMessage);
}
}
return true;

View File

@@ -74,7 +74,7 @@ public partial class Gambling : GamblingModule<GamblingService>
var stats = await _gamblingTxTracker.GetAllAsync();
var eb = _sender.CreateEmbed()
.WithOkColor();
.WithOkColor();
var str = "` Feature `` Bet ``Paid Out`` RoI `\n";
str += "――――――――――――――――――――\n";
@@ -119,15 +119,15 @@ public partial class Gambling : GamblingModule<GamblingService>
// [21:03] Bob Page: Kinda remids me of US economy
var embed = _sender.CreateEmbed()
.WithTitle(GetText(strs.economy_state))
.AddField(GetText(strs.currency_owned), N(ec.Cash - ec.Bot))
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
.AddField(GetText(strs.currency_planted), N(ec.Planted))
.AddField(GetText(strs.owned_waifus_total), N(ec.Waifus))
.AddField(GetText(strs.bot_currency), N(ec.Bot))
.AddField(GetText(strs.bank_accounts), N(ec.Bank))
.AddField(GetText(strs.total), N(ec.Cash + ec.Planted + ec.Waifus + ec.Bank))
.WithOkColor();
.WithTitle(GetText(strs.economy_state))
.AddField(GetText(strs.currency_owned), N(ec.Cash - ec.Bot))
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
.AddField(GetText(strs.currency_planted), N(ec.Planted))
.AddField(GetText(strs.owned_waifus_total), N(ec.Waifus))
.AddField(GetText(strs.bot_currency), N(ec.Bot))
.AddField(GetText(strs.bank_accounts), N(ec.Bank))
.AddField(GetText(strs.total), N(ec.Cash + ec.Planted + ec.Waifus + ec.Bank))
.WithOkColor();
// ec.Cash already contains ec.Bot as it's the total of all values in the CurrencyAmount column of the DiscordUser table
await Response().Embed(embed).SendAsync();
@@ -154,18 +154,15 @@ public partial class Gambling : GamblingModule<GamblingService>
await smc.RespondConfirmAsync(_sender, GetText(strs.remind_timely(tt)), ephemeral: true);
}
private NadekoInteraction CreateRemindMeInteraction(int period)
{
return _inter
private NadekoInteractionBase CreateRemindMeInteraction(int period)
=> _inter
.Create(ctx.User.Id,
new SimpleInteraction<DateTime>(
new ButtonBuilder(
label: "Remind me",
emote: Emoji.Parse("⏰"),
customId: "timely:remind_me"),
RemindTimelyAction,
DateTime.UtcNow.Add(TimeSpan.FromHours(period))));
}
new ButtonBuilder(
label: "Remind me",
emote: Emoji.Parse("⏰"),
customId: "timely:remind_me"),
(smc) => RemindTimelyAction(smc, DateTime.UtcNow.Add(TimeSpan.FromHours(period)))
);
[Cmd]
public async Task Timely()
@@ -311,9 +308,9 @@ public partial class Gambling : GamblingModule<GamblingService>
}
var embed = _sender.CreateEmbed()
.WithTitle(GetText(strs.transactions(((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString()
?? $"{userId}")))
.WithOkColor();
.WithTitle(GetText(strs.transactions(((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString()
?? $"{userId}")))
.WithOkColor();
var sb = new StringBuilder();
foreach (var tr in trs)
@@ -408,7 +405,7 @@ public partial class Gambling : GamblingModule<GamblingService>
await Response().Confirm(strs.has(Format.Code(userId.ToString()), cur)).SendAsync();
}
private async Task BankAction(SocketMessageComponent smc, object _)
private async Task BankAction(SocketMessageComponent smc)
{
var balance = await _bank.GetBalanceAsync(ctx.User.Id);
@@ -418,12 +415,12 @@ public partial class Gambling : GamblingModule<GamblingService>
.Pipe(text => smc.RespondConfirmAsync(_sender, text, ephemeral: true));
}
private NadekoInteraction CreateCashInteraction()
=> _inter.Create<object>(ctx.User.Id,
new(new(
customId: "cash:bank_show_balance",
emote: new Emoji("🏦")),
BankAction));
private NadekoInteractionBase CreateCashInteraction()
=> _inter.Create(ctx.User.Id,
new ButtonBuilder(
customId: "cash:bank_show_balance",
emote: new Emoji("🏦")),
BankAction);
[Cmd]
[Priority(1)]
@@ -732,10 +729,10 @@ public partial class Gambling : GamblingModule<GamblingService>
}
var eb = _sender.CreateEmbed()
.WithAuthor(ctx.User)
.WithDescription(Format.Bold(str))
.AddField(GetText(strs.roll2), result.Roll.ToString(CultureInfo.InvariantCulture))
.WithOkColor();
.WithAuthor(ctx.User)
.WithDescription(Format.Bold(str))
.AddField(GetText(strs.roll2), result.Roll.ToString(CultureInfo.InvariantCulture))
.WithOkColor();
await Response().Embed(eb).SendAsync();
}
@@ -787,7 +784,7 @@ public partial class Gambling : GamblingModule<GamblingService>
return await uow.Set<DiscordUser>().GetTopRichest(_client.CurrentUser.Id, curPage);
}
}
var res = Response()
.Paginated();
@@ -799,8 +796,9 @@ public partial class Gambling : GamblingModule<GamblingService>
.CurrentPage(page)
.Page((toSend, curPage) =>
{
var embed = _sender.CreateEmbed().WithOkColor()
.WithTitle(CurrencySign + " " + GetText(strs.leaderboard));
var embed = _sender.CreateEmbed()
.WithOkColor()
.WithTitle(CurrencySign + " " + GetText(strs.leaderboard));
if (!toSend.Any())
{
@@ -923,11 +921,11 @@ public partial class Gambling : GamblingModule<GamblingService>
}
var eb = _sender.CreateEmbed()
.WithOkColor()
.WithDescription(sb.ToString())
.AddField(GetText(strs.multiplier), $"{result.Multiplier:0.##}x", true)
.AddField(GetText(strs.won), $"{(long)result.Won}", true)
.WithAuthor(ctx.User);
.WithOkColor()
.WithDescription(sb.ToString())
.AddField(GetText(strs.multiplier), $"{result.Multiplier:0.##}x", true)
.AddField(GetText(strs.won), $"{(long)result.Won}", true)
.WithAuthor(ctx.User);
await Response().Embed(eb).SendAsync();

View File

@@ -27,7 +27,7 @@ public partial class Gambling
if (picked > 0)
{
var msg = await Response().NoReply().Confirm(strs.picked(N(picked))).SendAsync();
var msg = await Response().NoReply().Confirm(strs.picked(N(picked), ctx.User)).SendAsync();
msg.DeleteAfter(10);
}

View File

@@ -76,9 +76,12 @@ public partial class Gambling
.WithOkColor();
var bb = new ButtonBuilder(emote: Emoji.Parse("🔁"), customId: "slot:again", label: "Pull Again");
var si = new SimpleInteraction<long>(bb, (_, amount) => Slot(amount), amount);
var inter = _inter.Create(ctx.User.Id, bb, smc =>
{
smc.DeferAsync();
return Slot(amount);
});
var inter = _inter.Create(ctx.User.Id, si);
var msg = await ctx.Channel.SendFileAsync(imgStream,
"result.png",
embed: eb.Build(),

View File

@@ -86,11 +86,31 @@ public sealed partial class Help : NadekoModule<HelpService>
topLevelModules.Add(m);
}
var menu = new SelectMenuBuilder()
.WithPlaceholder("Select a module to see its commands")
.WithCustomId("cmds:modules_select");
foreach (var m in topLevelModules)
menu.AddOption(m.Name, m.Name, GetModuleEmoji(m.Name));
var inter = _inter.Create(ctx.User.Id,
menu,
async (smc) =>
{
await smc.DeferAsync();
var val = smc.Data.Values.FirstOrDefault();
if (val is null)
return;
await Commands(val);
});
await Response()
.Paginated()
.Items(topLevelModules)
.PageSize(12)
.CurrentPage(page)
.Interaction(inter)
.AddFooter(false)
.Page((items, _) =>
{
@@ -221,10 +241,28 @@ public sealed partial class Help : NadekoModule<HelpService>
// order by name
var allowed = new List<CommandInfo>();
foreach (var cmd in _cmds.Commands
.Where(c => c.Module.GetTopLevelModule()
.Name
.StartsWith(module, StringComparison.InvariantCultureIgnoreCase)))
var mdls = _cmds.Commands
.Where(c => c.Module.GetTopLevelModule()
.Name
.StartsWith(module, StringComparison.InvariantCultureIgnoreCase))
.ToArray();
if (mdls.Length == 0)
{
var group = _cmds.Modules
.Where(x => x.Parent is not null)
.FirstOrDefault(x => string.Equals(x.Name.Replace("Commands", ""),
module,
StringComparison.InvariantCultureIgnoreCase));
if (group is not null)
{
await Group(group);
return;
}
}
foreach (var cmd in mdls)
{
var result = await _perms.CheckPermsAsync(ctx.Guild,
ctx.Channel,
@@ -236,6 +274,7 @@ public sealed partial class Help : NadekoModule<HelpService>
allowed.Add(cmd);
}
var cmds = allowed.OrderBy(c => c.Aliases[0])
.DistinctBy(x => x.Aliases[0])
.ToList();
@@ -275,55 +314,97 @@ public sealed partial class Help : NadekoModule<HelpService>
return;
}
var cnt = 0;
var groups = cmdsWithGroup.GroupBy(_ => cnt++ / 48).ToArray();
var sb = new SelectMenuBuilder()
.WithCustomId("cmds:submodule_select")
.WithPlaceholder("Select a submodule to see detailed commands");
var groups = cmdsWithGroup.ToArray();
var embed = _sender.CreateEmbed().WithOkColor();
foreach (var g in groups)
{
var last = g.Count();
for (var i = 0; i < last; i++)
{
var transformed = g.ElementAt(i)
.Select(x =>
{
//if cross is specified, and the command doesn't satisfy the requirements, cross it out
if (opts.View == CommandsOptions.ViewType.Cross)
{
return $"{(succ.Contains(x) ? "" : "")} {prefix + x.Aliases[0]}";
}
sb.AddOption(g.Key, g.Key);
var transformed = g
.Select(x =>
{
//if cross is specified, and the command doesn't satisfy the requirements, cross it out
if (opts.View == CommandsOptions.ViewType.Cross)
{
return $"{(succ.Contains(x) ? "" : "")} {prefix + x.Aliases[0]}";
}
if (x.Aliases.Count == 1)
return prefix + x.Aliases[0];
return prefix + x.Aliases[0] + " | " + prefix + x.Aliases[1];
});
if (x.Aliases.Count == 1)
return prefix + x.Aliases[0];
embed.AddField(g.ElementAt(i).Key, "" + string.Join("\n", transformed) + "", true);
}
return prefix + x.Aliases[0] + " | " + prefix + x.Aliases[1];
});
embed.AddField(g.Key, "" + string.Join("\n", transformed) + "", true);
}
embed.WithFooter(GetText(strs.commands_instr(prefix)));
await Response().Embed(embed).SendAsync();
var inter = _inter.Create(ctx.User.Id,
sb,
async (smc) =>
{
var groupName = smc.Data.Values.FirstOrDefault();
var mdl = _cmds.Modules.FirstOrDefault(x
=> string.Equals(x.Name.Replace("Commands", ""), groupName, StringComparison.InvariantCultureIgnoreCase));
await smc.DeferAsync();
await Group(mdl);
}
);
await Response().Embed(embed).Interaction(inter).SendAsync();
}
private async Task Group(ModuleInfo group)
{
var eb = _sender.CreateEmbed()
.WithTitle(GetText(strs.cmd_group_commands(group.Name)))
.WithOkColor();
var menu = new SelectMenuBuilder()
.WithCustomId("cmds:group_select")
.WithPlaceholder("Select a command to see its details");
foreach (var cmd in group.Commands.DistinctBy(x => x.Aliases[0]))
{
string cmdName;
if (cmd.Aliases.Count > 1)
cmdName = Format.Code(prefix + cmd.Aliases[0]) + " | " + Format.Code(prefix + cmd.Aliases[1]);
else
cmdName = Format.Code(prefix + cmd.Aliases.First());
eb.AddField(cmdName, cmd.RealSummary(_strings, _medusae, Culture, prefix));
menu.AddOption(prefix + cmd.Aliases[0], cmd.Aliases[0]);
}
await Response().Embed(eb).SendAsync();
var inter = _inter.Create(ctx.User.Id,
menu,
async (smc) =>
{
await smc.DeferAsync();
await H(smc.Data.Values.FirstOrDefault());
});
await Response()
.Paginated()
.Items(group.Commands.DistinctBy(x => x.Aliases[0]).ToArray())
.PageSize(25)
.Interaction(inter)
.Page((items, _) =>
{
var eb = _sender.CreateEmbed()
.WithTitle(GetText(strs.cmd_group_commands(group.Name)))
.WithOkColor();
foreach (var cmd in items)
{
string cmdName;
if (cmd.Aliases.Count > 1)
cmdName = Format.Code(prefix + cmd.Aliases[0]) + " | " + Format.Code(prefix + cmd.Aliases[1]);
else
cmdName = Format.Code(prefix + cmd.Aliases.First());
eb.AddField(cmdName, cmd.RealSummary(_strings, _medusae, Culture, prefix));
}
return eb;
})
.SendAsync();
}
[Cmd]
@@ -343,8 +424,9 @@ public sealed partial class Help : NadekoModule<HelpService>
var group = _cmds.Modules
.SelectMany(x => x.Submodules)
.Where(x => !string.IsNullOrWhiteSpace(x.Group))
.FirstOrDefault(x => x.Group.Equals(fail, StringComparison.InvariantCultureIgnoreCase));
.FirstOrDefault(x => string.Equals(x.Group,
fail,
StringComparison.InvariantCultureIgnoreCase));
if (group is not null)
{
@@ -424,7 +506,7 @@ public sealed partial class Help : NadekoModule<HelpService>
.ToList());
var readableData = JsonConvert.SerializeObject(cmdData, Formatting.Indented);
// send the indented file to chat
await using var rDataStream = new MemoryStream(Encoding.ASCII.GetBytes(readableData));
await ctx.Channel.SendFileAsync(rDataStream, "cmds.json", GetText(strs.commandlist_regen));
@@ -438,7 +520,7 @@ public sealed partial class Help : NadekoModule<HelpService>
.SendAsync();
private Task SelfhostAction(SocketMessageComponent smc, object _)
private Task SelfhostAction(SocketMessageComponent smc)
=> smc.RespondConfirmAsync(_sender,
"""
- In case you don't want or cannot Donate to NadekoBot project, but you
@@ -456,11 +538,11 @@ public sealed partial class Help : NadekoModule<HelpService>
public async Task Donate()
{
var selfhostInter = _inter.Create(ctx.User.Id,
new SimpleInteraction<object>(new ButtonBuilder(
emote: new Emoji("🖥️"),
customId: "donate:selfhosting",
label: "Selfhosting"),
SelfhostAction));
new ButtonBuilder(
emote: new Emoji("🖥️"),
customId: "donate:selfhosting",
label: "Selfhosting"),
SelfhostAction);
var eb = _sender.CreateEmbed()
.WithOkColor()
@@ -489,17 +571,9 @@ public sealed partial class Help : NadekoModule<HelpService>
**Step 3** ⏰ Wait a short while (usually 1-3 minutes) ⏰
Nadeko will DM you the welcome instructions, and you may will receive your rewards!
Nadeko will DM you the welcome instructions, and you will receive your rewards!
🎉 **Enjoy!** 🎉
""")
.AddField("Troubleshooting",
"""
*In case you didn't receive the rewards within 5 minutes:*
`1.` Make sure your DMs are open to everyone. Maybe your pledge was processed successfully but the bot was unable to DM you. Use the `.patron` command to check your status.
`2.` Make sure you've connected the CORRECT Discord account. Quite often users log in to different Discord accounts in their browser. You may also try disconnecting and reconnecting your account.
`3.` Make sure your payment has been processed and not declined by Patreon.
`4.` If any of the previous steps don't help, you can join the nadeko support server <https://discord.nadeko.bot> and ask for help in the #help channel
""");
""");
try
{

View File

@@ -1,4 +1,6 @@
#nullable disable warnings
#nullable disable warnings
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.Yml;
using NadekoBot.Db;
using NadekoBot.Db.Models;
@@ -71,7 +73,7 @@ public partial class Utility
.Confirm(GetText(strs.quotes_page(page + 1)),
string.Join("\n",
quotes.Select(q
=> $"`#{q.Id}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}")))
=> $"`{new kwum(q.Id)}` {Format.Bold(q.Keyword.SanitizeAllMentions()),-20} by {q.AuthorName.SanitizeAllMentions()}")))
.SendAsync();
}
else
@@ -107,19 +109,19 @@ public partial class Utility
text = await repSvc.ReplaceAsync(text, repCtx);
await Response()
.Text($"`#{quote.Id}` 📣 " + text)
.Text($"`{new kwum(quote.Id)}` 📣 " + text)
.Sanitize()
.SendAsync();
}
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task QuoteShow(int id)
public async Task QuoteShow(kwum quoteId)
{
Quote? quote;
await using (var uow = _db.GetDbContext())
{
quote = uow.Set<Quote>().GetById(id);
quote = uow.Set<Quote>().GetById(quoteId);
if (quote?.GuildId != ctx.Guild.Id)
quote = null;
}
@@ -133,23 +135,54 @@ public partial class Utility
await ShowQuoteData(quote);
}
private async Task ShowQuoteData(Quote data)
private NadekoInteractionBase CreateEditInteraction(kwum id, Quote found)
{
var modal = new ModalBuilder()
.WithCustomId("quote:edit_modal")
.WithTitle($"Edit expression {id}")
.AddTextInput(new TextInputBuilder()
.WithLabel(GetText(strs.response))
.WithValue(found.Text)
.WithMinLength(1)
.WithCustomId("quote:edit_modal:response")
.WithStyle(TextInputStyle.Paragraph));
var inter = _inter.Create(ctx.User.Id,
new ButtonBuilder()
.WithEmote(Emoji.Parse("📝"))
.WithLabel("Edit")
.WithStyle(ButtonStyle.Primary)
.WithCustomId("test"),
modal,
async (sm) =>
{
var msg = sm.Data.Components.FirstOrDefault()?.Value;
if(!string.IsNullOrWhiteSpace(msg))
await QuoteEdit(id, msg);
}
);
return inter;
}
private async Task ShowQuoteData(Quote quote)
{
var inter = CreateEditInteraction(quote.Id, quote);
var eb = _sender.CreateEmbed()
.WithOkColor()
.WithTitle($"{GetText(strs.quote_id($"#{data.Id}"))} | {GetText(strs.response)}:")
.WithDescription(Format.Sanitize(data.Text).Replace("](", "]\\(").TrimTo(4096))
.AddField(GetText(strs.trigger), data.Keyword)
.WithTitle($"{GetText(strs.quote_id($"`{new kwum(quote.Id)}"))}`")
.WithDescription(Format.Sanitize(quote.Text).Replace("](", "]\\(").TrimTo(4096))
.AddField(GetText(strs.trigger), quote.Keyword)
.WithFooter(
GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})")));
GetText(strs.created_by($"{quote.AuthorName} ({quote.AuthorId})")));
if (!(data.Text.Length > 4096))
if (!(quote.Text.Length > 4096))
{
await Response().Embed(eb).SendAsync();
await Response().Embed(eb).Interaction(quote.AuthorId == ctx.User.Id ? inter : null).SendAsync();
return;
}
await using var textStream = await data.Text.ToStream();
await using var textStream = await quote.Text.ToStream();
await Response()
.Embed(eb)
@@ -174,7 +207,7 @@ public partial class Utility
return;
await Response()
.Confirm($"`#{quote.Id}` 💬 ",
.Confirm($"`{new kwum(quote.Id)}` 💬 ",
quote.Keyword.ToLowerInvariant()
+ ": "
+ quote.Text.SanitizeAllMentions())
@@ -195,9 +228,9 @@ public partial class Utility
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task QuoteId(int id)
public async Task QuoteId(kwum quoteId)
{
if (id < 0)
if (quoteId < 0)
return;
Quote quote;
@@ -206,7 +239,7 @@ public partial class Utility
await using (var uow = _db.GetDbContext())
{
quote = uow.Set<Quote>().GetById(id);
quote = uow.Set<Quote>().GetById(quoteId);
}
if (quote is null || quote.GuildId != ctx.Guild.Id)
@@ -215,7 +248,7 @@ public partial class Utility
return;
}
var infoText = $"`#{quote.Id} added by {quote.AuthorName.SanitizeAllMentions()}` 🗯️ "
var infoText = $"*`{new kwum(quote.Id)}` added by {quote.AuthorName.SanitizeAllMentions()}* 🗯️ "
+ quote.Keyword.ToLowerInvariant().SanitizeAllMentions()
+ ":\n";
@@ -252,12 +285,53 @@ public partial class Utility
await uow.SaveChangesAsync();
}
await Response().Confirm(strs.quote_added_new(Format.Code(q.Id.ToString()))).SendAsync();
await Response().Confirm(strs.quote_added_new(Format.Code(new kwum(q.Id).ToString()))).SendAsync();
}
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task QuoteDelete(int id)
public async Task QuoteEdit(kwum quoteId, [Leftover] string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return;
}
Quote q;
await using (var uow = _db.GetDbContext())
{
var intId = (int)quoteId;
var result = await uow.GetTable<Quote>()
.Where(x => x.Id == intId && x.AuthorId == ctx.User.Id)
.Set(x => x.Text, text)
.UpdateWithOutputAsync((del, ins) => ins);
q = result.FirstOrDefault();
await uow.SaveChangesAsync();
}
if (q is not null)
{
await Response()
.Embed(_sender.CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.quote_edited))
.WithDescription($"#{quoteId}")
.AddField(GetText(strs.trigger), q.Keyword)
.AddField(GetText(strs.response),
text.Length > 1024 ? GetText(strs.redacted_too_long) : text))
.SendAsync();
}
else
{
await Response().Error(strs.expr_no_found_id).SendAsync();
}
}
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task QuoteDelete(kwum quoteId)
{
var hasManageMessages = ((IGuildUser)ctx.Message.Author).GuildPermissions.ManageMessages;
@@ -265,7 +339,7 @@ public partial class Utility
string response;
await using (var uow = _db.GetDbContext())
{
var q = uow.Set<Quote>().GetById(id);
var q = uow.Set<Quote>().GetById(quoteId);
if (q?.GuildId != ctx.Guild.Id || (!hasManageMessages && q.AuthorId != ctx.Message.Author.Id))
response = GetText(strs.quotes_remove_none);
@@ -274,7 +348,7 @@ public partial class Utility
uow.Set<Quote>().Remove(q);
await uow.SaveChangesAsync();
success = true;
response = GetText(strs.quote_deleted(id));
response = GetText(strs.quote_deleted(new kwum(quoteId)));
}
}

View File

@@ -117,35 +117,35 @@ public partial class Utility
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(0)]
public Task Repeat(ITextChannel ch, StoopidTime interval, [Leftover] string message)
=> Repeat(ch, null, interval, message);
public Task Repeat(ITextChannel channel, StoopidTime interval, [Leftover] string message)
=> Repeat(channel, null, interval, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(1)]
public Task Repeat(GuildDateTime dt, [Leftover] string message)
=> Repeat(dt, null, message);
public Task Repeat(GuildDateTime timeOfDay, [Leftover] string message)
=> Repeat(timeOfDay, null, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(1)]
public Task Repeat(ITextChannel channel, GuildDateTime dt, [Leftover] string message)
=> Repeat(channel, dt, null, message);
public Task Repeat(ITextChannel channel, GuildDateTime timeOfDay, [Leftover] string message)
=> Repeat(channel, timeOfDay, null, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(2)]
public Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
=> Repeat(ctx.Channel, dt, interval, message);
public Task Repeat(GuildDateTime? timeOfDay, StoopidTime? interval, [Leftover] string message)
=> Repeat(ctx.Channel, timeOfDay, interval, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(3)]
public async Task Repeat(IMessageChannel channel, GuildDateTime? dt, StoopidTime? interval,
public async Task Repeat(IMessageChannel channel, GuildDateTime? timeOfDay, StoopidTime? interval,
[Leftover] string message)
{
if (channel is not ITextChannel txtCh || txtCh.GuildId != ctx.Guild.Id)
@@ -155,7 +155,7 @@ public partial class Utility
if (!perms.SendMessages)
return;
var startTimeOfDay = dt?.InputTimeUtc.TimeOfDay;
var startTimeOfDay = timeOfDay?.InputTimeUtc.TimeOfDay;
// if interval not null, that means user specified it (don't change it)
// if interval is null set the default to:

View File

@@ -475,7 +475,8 @@ public partial class Xp : NadekoModule<XpService>
emote: Emoji.Parse("👐"),
isDisabled: ownedItem.IsUsing);
var inter = new SimpleInteraction<(string key, XpShopItemType type)?>(
var inter = _inter.Create(
ctx.User.Id,
button,
OnShopUse,
(key, itemType));
@@ -488,7 +489,8 @@ public partial class Xp : NadekoModule<XpService>
"xpshop:buy",
emote: Emoji.Parse("💰"));
var inter = new SimpleInteraction<(string key, XpShopItemType type)?>(
var inter = _inter.Create(
ctx.User.Id,
button,
OnShopBuy,
(key, itemType));
@@ -504,13 +506,13 @@ public partial class Xp : NadekoModule<XpService>
{
var result = await _service.BuyShopItemAsync(ctx.User.Id, (XpShopItemType)type, key);
NadekoInteraction GetUseInteraction()
NadekoInteractionBase GetUseInteraction()
{
return _inter.Create(ctx.User.Id,
new SimpleInteraction<object>(
new ButtonBuilder(label: "Use", customId: "xpshop:use_item", emote: Emoji.Parse("👐")),
async (smc, _) => await XpShopUse(type, key)
));
new(label: "Use", customId: "xpshop:use_item", emote: Emoji.Parse("👐")),
async (_, state) => await XpShopUse(state.type, state.key),
(type, key)
);
}
if (result != BuyResult.Success)
@@ -551,11 +553,8 @@ public partial class Xp : NadekoModule<XpService>
await ctx.OkAsync();
}
private async Task OnShopUse(SocketMessageComponent smc, (string? key, XpShopItemType type)? maybeState)
private async Task OnShopUse(SocketMessageComponent smc, (string key, XpShopItemType type) state)
{
if (maybeState is not { } state)
return;
var (key, type) = state;
var result = await _service.UseShopItemAsync(ctx.User.Id, type, key);
@@ -567,11 +566,8 @@ public partial class Xp : NadekoModule<XpService>
}
}
private async Task OnShopBuy(SocketMessageComponent smc, (string? key, XpShopItemType type)? maybeState)
private async Task OnShopBuy(SocketMessageComponent smc, (string key, XpShopItemType type) state)
{
if (maybeState is not { } state)
return;
var (key, type) = state;
var result = await _service.BuyShopItemAsync(ctx.User.Id, type, key);

View File

@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
@@ -31,9 +30,9 @@
<PackageReference Include="CodeHollow.FeedReader" Version="1.2.6"/>
<PackageReference Include="CommandLineParser" Version="2.9.1"/>
<PackageReference Include="Discord.Net" Version="3.204.0"/>
<PackageReference Include="CoreCLR-NCalc" Version="3.1.246" />
<PackageReference Include="CoreCLR-NCalc" Version="3.1.246"/>
<PackageReference Include="Google.Apis.Urlshortener.v1" Version="1.41.1.138"/>
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.68.0.3414" />
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.68.0.3414"/>
<PackageReference Include="Google.Apis.Customsearch.v1" Version="1.49.0.2084"/>
<!-- <PackageReference Include="Grpc.AspNetCore" Version="2.62.0" />-->
<PackageReference Include="Google.Protobuf" Version="3.26.1"/>
@@ -52,11 +51,11 @@
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0"/>
<!-- DI -->
<!-- <PackageReference Include="Ninject" Version="3.3.6"/>-->
<!-- <PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0"/>-->
<!-- <PackageReference Include="Ninject" Version="3.3.6"/>-->
<!-- <PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0"/>-->
<!-- <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />-->
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1"/>
<PackageReference Include="DryIoc.dll" Version="5.4.3" />
<PackageReference Include="DryIoc.dll" Version="5.4.3"/>
<!-- <PackageReference Include="Scrutor" Version="4.2.0" />-->
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0"/>
@@ -68,14 +67,14 @@
<PackageReference Include="OneOf" Version="3.0.263"/>
<PackageReference Include="OneOf.SourceGenerator" Version="3.0.263"/>
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1"/>
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.1"/>
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta17"/>
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.8"/>
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14"/>
<PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009"/>
<PackageReference Include="StackExchange.Redis" Version="2.7.33"/>
<PackageReference Include="YamlDotNet" Version="15.1.4" />
<PackageReference Include="YamlDotNet" Version="15.1.4"/>
<PackageReference Include="SharpToken" Version="2.0.2"/>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
@@ -100,7 +99,7 @@
<PackageReference Include="TwitchLib.Api" Version="3.4.1"/>
<!-- sqlselectcsv and stock -->
<PackageReference Include="CsvHelper" Version="32.0.3" />
<PackageReference Include="CsvHelper" Version="32.0.3"/>
</ItemGroup>
@@ -109,6 +108,8 @@
<ProjectReference Include="..\NadekoBot.Voice\NadekoBot.Voice.csproj"/>
<ProjectReference Include="..\NadekoBot.Generators\NadekoBot.Generators.csproj" OutputItemType="Analyzer"/>
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="data\strings\responses\responses.en-US.json"/>
</ItemGroup>
@@ -131,10 +132,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Modules\Utility\GuildColors\" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'GlobalNadeko' ">
<!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)-->
<DefineTrace>false</DefineTrace>

View File

@@ -2,7 +2,30 @@
public interface INadekoInteractionService
{
public NadekoInteraction Create<T>(
public NadekoInteractionBase Create(
ulong userId,
SimpleInteraction<T> inter);
ButtonBuilder button,
Func<SocketMessageComponent, Task> onTrigger,
bool singleUse = true);
public NadekoInteractionBase Create<T>(
ulong userId,
ButtonBuilder button,
Func<SocketMessageComponent, T, Task> onTrigger,
in T state,
bool singleUse = true);
NadekoInteractionBase Create(
ulong userId,
SelectMenuBuilder menu,
Func<SocketMessageComponent, Task> onTrigger,
bool singleUse = true);
NadekoInteractionBase Create(
ulong userId,
ButtonBuilder button,
ModalBuilder modal,
Func<SocketModal, Task> onTrigger,
bool singleUse = true);
}

View File

@@ -0,0 +1,7 @@
namespace NadekoBot;
public static class InteractionHelpers
{
public static readonly IEmote ArrowLeft = Emote.Parse("<:x:1232256519844790302>");
public static readonly IEmote ArrowRight = Emote.Parse("<:x:1232256515298295838>");
}

View File

@@ -0,0 +1,21 @@
namespace NadekoBot;
public sealed class NadekoButtonInteractionHandler : NadekoInteractionBase
{
public NadekoButtonInteractionHandler(
DiscordSocketClient client,
ulong authorId,
ButtonBuilder button,
Func<SocketMessageComponent, Task> onAction,
bool onlyAuthor,
bool singleUse = true)
: base(client, authorId, button.CustomId, onAction, onlyAuthor, singleUse)
{
Button = button;
}
public ButtonBuilder Button { get; }
public override void AddTo(ComponentBuilder cb)
=> cb.WithButton(Button);
}

View File

@@ -0,0 +1,15 @@
namespace NadekoBot;
public static class NadekoInteractionExtensions
{
public static MessageComponent CreateComponent(
this NadekoInteractionBase nadekoInteractionBase
)
{
var cb = new ComponentBuilder();
nadekoInteractionBase.AddTo(cb);
return cb.Build();
}
}

View File

@@ -0,0 +1,21 @@
namespace NadekoBot;
public sealed class NadekoButtonSelectInteractionHandler : NadekoInteractionBase
{
public NadekoButtonSelectInteractionHandler(
DiscordSocketClient client,
ulong authorId,
SelectMenuBuilder menu,
Func<SocketMessageComponent, Task> onAction,
bool onlyAuthor,
bool singleUse = true)
: base(client, authorId, menu.CustomId, onAction, onlyAuthor, singleUse)
{
Menu = menu;
}
public SelectMenuBuilder Menu { get; }
public override void AddTo(ComponentBuilder cb)
=> cb.WithSelectMenu(Menu);
}

View File

@@ -1,29 +1,33 @@
namespace NadekoBot;
public sealed class NadekoInteraction
public abstract class NadekoInteractionBase
{
private readonly ulong _authorId;
private readonly ButtonBuilder _button;
private readonly Func<SocketMessageComponent, Task> _onClick;
private readonly Func<SocketMessageComponent, Task> _onAction;
private readonly bool _onlyAuthor;
public DiscordSocketClient Client { get; }
private readonly TaskCompletionSource<bool> _interactionCompletedSource;
private IUserMessage message = null!;
private readonly string _customId;
private readonly bool _singleUse;
public NadekoInteraction(DiscordSocketClient client,
public NadekoInteractionBase(
DiscordSocketClient client,
ulong authorId,
ButtonBuilder button,
Func<SocketMessageComponent, Task> onClick,
bool onlyAuthor)
string customId,
Func<SocketMessageComponent, Task> onAction,
bool onlyAuthor,
bool singleUse = true)
{
_authorId = authorId;
_button = button;
_onClick = onClick;
_customId = customId;
_onAction = onAction;
_onlyAuthor = onlyAuthor;
_singleUse = singleUse;
_interactionCompletedSource = new(TaskCreationOptions.RunContinuationsAsynchronously);
Client = client;
}
@@ -32,12 +36,15 @@ public sealed class NadekoInteraction
message = msg;
Client.InteractionCreated += OnInteraction;
await Task.WhenAny(Task.Delay(15_000), _interactionCompletedSource.Task);
if (_singleUse)
await Task.WhenAny(Task.Delay(30_000), _interactionCompletedSource.Task);
else
await Task.Delay(30_000);
Client.InteractionCreated -= OnInteraction;
await msg.ModifyAsync(m => m.Components = new ComponentBuilder().Build());
}
private Task OnInteraction(SocketInteraction arg)
{
if (arg is not SocketMessageComponent smc)
@@ -49,34 +56,109 @@ public sealed class NadekoInteraction
if (_onlyAuthor && smc.User.Id != _authorId)
return Task.CompletedTask;
if (smc.Data.CustomId != _button.CustomId)
if (smc.Data.CustomId != _customId)
return Task.CompletedTask;
_ = Task.Run(async () =>
{
await ExecuteOnActionAsync(smc);
// this should only be a thing on single-response buttons
_interactionCompletedSource.TrySetResult(true);
if (!smc.HasResponded)
try
{
await smc.DeferAsync();
_interactionCompletedSource.TrySetResult(true);
await ExecuteOnActionAsync(smc);
if (!smc.HasResponded)
{
await smc.DeferAsync();
}
}
catch (Exception ex)
{
Log.Warning(ex, "An exception occured while handling an interaction: {Message}", ex.Message);
}
});
return Task.CompletedTask;
}
public MessageComponent CreateComponent()
{
var comp = new ComponentBuilder()
.WithButton(_button);
return comp.Build();
}
public abstract void AddTo(ComponentBuilder cb);
public Task ExecuteOnActionAsync(SocketMessageComponent smc)
=> _onClick(smc);
=> _onAction(smc);
}
public sealed class NadekoModalSubmitHandler
{
private readonly ulong _authorId;
private readonly Func<SocketModal, Task> _onAction;
private readonly bool _onlyAuthor;
public DiscordSocketClient Client { get; }
private readonly TaskCompletionSource<bool> _interactionCompletedSource;
private IUserMessage message = null!;
private readonly string _customId;
public NadekoModalSubmitHandler(
DiscordSocketClient client,
ulong authorId,
string customId,
Func<SocketModal, Task> onAction,
bool onlyAuthor)
{
_authorId = authorId;
_customId = customId;
_onAction = onAction;
_onlyAuthor = onlyAuthor;
_interactionCompletedSource = new(TaskCreationOptions.RunContinuationsAsynchronously);
Client = client;
}
public async Task RunAsync(IUserMessage msg)
{
message = msg;
Client.ModalSubmitted += OnInteraction;
await Task.WhenAny(Task.Delay(300_000), _interactionCompletedSource.Task);
Client.ModalSubmitted -= OnInteraction;
await msg.ModifyAsync(m => m.Components = new ComponentBuilder().Build());
}
private Task OnInteraction(SocketModal sm)
{
if (sm.Message.Id != message.Id)
return Task.CompletedTask;
if (_onlyAuthor && sm.User.Id != _authorId)
return Task.CompletedTask;
if (sm.Data.CustomId != _customId)
return Task.CompletedTask;
_ = Task.Run(async () =>
{
try
{
_interactionCompletedSource.TrySetResult(true);
await ExecuteOnActionAsync(sm);
if (!sm.HasResponded)
{
await sm.DeferAsync();
}
}
catch (Exception ex)
{
Log.Warning(ex, "An exception occured while handling a: {Message}", ex.Message);
}
});
return Task.CompletedTask;
}
public Task ExecuteOnActionAsync(SocketModal smd)
=> _onAction(smd);
}

View File

@@ -1,8 +0,0 @@
namespace NadekoBot;
/// <summary>
/// Represents essential interacation data
/// </summary>
/// <param name="Emote">Emote which will show on a button</param>
/// <param name="CustomId">Custom interaction id</param>
public record NadekoInteractionData(IEmote Emote, string CustomId, string? Text = null);

View File

@@ -9,12 +9,69 @@ public class NadekoInteractionService : INadekoInteractionService, INService
_client = client;
}
public NadekoInteraction Create<T>(
public NadekoInteractionBase Create(
ulong userId,
SimpleInteraction<T> inter)
=> new NadekoInteraction(_client,
ButtonBuilder button,
Func<SocketMessageComponent, Task> onTrigger,
bool singleUse = true)
=> new NadekoButtonInteractionHandler(_client,
userId,
inter.Button,
inter.TriggerAsync,
onlyAuthor: true);
button,
onTrigger,
onlyAuthor: true,
singleUse: singleUse);
public NadekoInteractionBase Create<T>(
ulong userId,
ButtonBuilder button,
Func<SocketMessageComponent, T, Task> onTrigger,
in T state,
bool singleUse = true)
=> Create(userId,
button,
((Func<T, Func<SocketMessageComponent, Task>>)((data)
=> smc => onTrigger(smc, data)))(state),
singleUse);
public NadekoInteractionBase Create(
ulong userId,
SelectMenuBuilder menu,
Func<SocketMessageComponent, Task> onTrigger,
bool singleUse = true)
=> new NadekoButtonSelectInteractionHandler(_client,
userId,
menu,
onTrigger,
onlyAuthor: true,
singleUse: singleUse);
/// <summary>
/// Create an interaction which opens a modal
/// </summary>
/// <param name="userId">Id of the author</param>
/// <param name="button">Button builder for the button that will open the modal</param>
/// <param name="modal">Modal</param>
/// <param name="onTrigger">The function that will be called when the modal is submitted</param>
/// <param name="singleUse">Whether the button is single use</param>
/// <returns></returns>
public NadekoInteractionBase Create(
ulong userId,
ButtonBuilder button,
ModalBuilder modal,
Func<SocketModal, Task> onTrigger,
bool singleUse = true)
=> Create(userId,
button,
async (smc) =>
{
await smc.RespondWithModalAsync(modal.Build());
var modalHandler = new NadekoModalSubmitHandler(_client,
userId,
modal.CustomId,
onTrigger,
true);
await modalHandler.RunAsync(smc.Message);
},
singleUse: singleUse);
}

View File

@@ -1,32 +0,0 @@
namespace NadekoBot;
public static class InteractionHelpers
{
public static readonly IEmote ArrowLeft = Emote.Parse("<:x:1232256519844790302>");
public static readonly IEmote ArrowRight = Emote.Parse("<:x:1232256515298295838>");
}
public abstract class SimpleInteractionBase
{
public abstract Task TriggerAsync(SocketMessageComponent smc);
public abstract ButtonBuilder Button { get; }
}
public class SimpleInteraction<T> : SimpleInteractionBase
{
public override ButtonBuilder Button { get; }
private readonly Func<SocketMessageComponent, T, Task> _onClick;
private readonly T? _state;
public SimpleInteraction(ButtonBuilder button, Func<SocketMessageComponent, T?, Task> onClick, T? state = default)
{
Button = button;
_onClick = onClick;
_state = state;
}
public override async Task TriggerAsync(SocketMessageComponent smc)
{
await _onClick(smc, _state!);
}
}

View File

@@ -34,34 +34,77 @@ public partial class ResponseBuilder
if (_paginationBuilder.AddPaginatedFooter)
embed.AddPaginatedFooter(currentPage, lastPage);
SimpleInteractionBase? maybeInter = null;
NadekoInteractionBase? maybeInter = null;
async Task<ComponentBuilder> GetComponentBuilder()
var model = await _builder.BuildAsync(ephemeral);
async Task<(NadekoButtonInteractionHandler left, NadekoInteractionBase? extra, NadekoButtonInteractionHandler right)>
GetInteractions()
{
var cb = new ComponentBuilder();
var leftButton = new ButtonBuilder()
.WithStyle(ButtonStyle.Primary)
.WithCustomId(BUTTON_LEFT)
.WithEmote(InteractionHelpers.ArrowLeft)
.WithDisabled(lastPage == 0 || currentPage <= 0);
cb.WithButton(new ButtonBuilder()
.WithStyle(ButtonStyle.Primary)
.WithCustomId(BUTTON_LEFT)
.WithDisabled(lastPage == 0)
.WithEmote(InteractionHelpers.ArrowLeft)
.WithDisabled(currentPage <= 0));
var leftBtnInter = new NadekoButtonInteractionHandler(_client,
model.User?.Id ?? 0,
leftButton,
(smc) =>
{
try
{
if (currentPage > 0)
currentPage--;
_ = UpdatePageAsync(smc);
}
catch (Exception ex)
{
Log.Error(ex, "Error in pagination: {ErrorMessage}", ex.Message);
}
return Task.CompletedTask;
},
true,
singleUse: false);
if (_paginationBuilder.InteractionFunc is not null)
{
maybeInter = await _paginationBuilder.InteractionFunc(currentPage);
if (maybeInter is not null)
cb.WithButton(maybeInter.Button);
}
cb.WithButton(new ButtonBuilder()
.WithStyle(ButtonStyle.Primary)
.WithCustomId(BUTTON_RIGHT)
.WithDisabled(lastPage is not null && (lastPage == 0 || currentPage >= lastPage))
.WithEmote(InteractionHelpers.ArrowRight));
var rightButton = new ButtonBuilder()
.WithStyle(ButtonStyle.Primary)
.WithCustomId(BUTTON_RIGHT)
.WithEmote(InteractionHelpers.ArrowRight)
.WithDisabled(lastPage == 0 || currentPage >= lastPage);
return cb;
var rightBtnInter = new NadekoButtonInteractionHandler(_client,
model.User?.Id ?? 0,
rightButton,
(smc) =>
{
try
{
if (currentPage >= lastPage)
return Task.CompletedTask;
currentPage++;
_ = UpdatePageAsync(smc);
}
catch (Exception ex)
{
Log.Error(ex, "Error in pagination: {ErrorMessage}", ex.Message);
}
return Task.CompletedTask;
},
true,
singleUse: false);
return (leftBtnInter, maybeInter, rightBtnInter);
}
async Task UpdatePageAsync(SocketMessageComponent smc)
@@ -71,75 +114,38 @@ public partial class ResponseBuilder
if (_paginationBuilder.AddPaginatedFooter)
toSend.AddPaginatedFooter(currentPage, lastPage);
var component = (await GetComponentBuilder()).Build();
var (left, extra, right) = (await GetInteractions());
var cb = new ComponentBuilder();
left.AddTo(cb);
right.AddTo(cb);
extra?.AddTo(cb);
await smc.ModifyOriginalResponseAsync(x =>
{
x.Embed = toSend.Build();
x.Components = component;
x.Components = cb.Build();
});
}
var model = await _builder.BuildAsync(ephemeral);
var (left, extra, right) = await GetInteractions();
var cb = new ComponentBuilder();
left.AddTo(cb);
right.AddTo(cb);
extra?.AddTo(cb);
var component = (await GetComponentBuilder()).Build();
var msg = await model.TargetChannel
.SendMessageAsync(model.Text,
embed: embed.Build(),
components: component,
components: cb.Build(),
allowedMentions: model.SanitizeMentions,
messageReference: model.MessageReference);
async Task OnInteractionAsync(SocketInteraction si)
{
try
{
if (si is not SocketMessageComponent smc)
return;
if (smc.Message.Id != msg.Id)
return;
await si.DeferAsync();
if (smc.User.Id != model.User?.Id)
return;
if (smc.Data.CustomId == BUTTON_LEFT)
{
if (currentPage == 0)
return;
--currentPage;
_ = UpdatePageAsync(smc);
}
else if (smc.Data.CustomId == BUTTON_RIGHT)
{
if (currentPage >= lastPage)
return;
++currentPage;
_ = UpdatePageAsync(smc);
}
else if (maybeInter is { } inter && inter.Button.CustomId == smc.Data.CustomId)
{
await inter.TriggerAsync(smc);
_ = UpdatePageAsync(smc);
}
}
catch (Exception ex)
{
Log.Error(ex, "Error in pagination: {ErrorMessage}", ex.Message);
}
}
if (lastPage == 0 && _paginationBuilder.InteractionFunc is null)
return;
_client.InteractionCreated += OnInteractionAsync;
await Task.Delay(30_000);
_client.InteractionCreated -= OnInteractionAsync;
await Task.WhenAll(left.RunAsync(msg), extra?.RunAsync(msg) ?? Task.CompletedTask, right.RunAsync(msg));
await msg.ModifyAsync(mp => mp.Components = new ComponentBuilder().Build());
}

View File

@@ -19,7 +19,7 @@ public sealed partial class ResponseBuilder
private readonly IBotStrings _bs;
private readonly BotConfigService _bcs;
private EmbedBuilder? embedBuilder;
private NadekoInteraction? inter;
private NadekoInteractionBase? inter;
private Stream? fileStream;
private string? fileName;
private EmbedColor color = EmbedColor.Ok;
@@ -340,7 +340,7 @@ public sealed partial class ResponseBuilder
return this;
}
public ResponseBuilder Interaction(NadekoInteraction? interaction)
public ResponseBuilder Interaction(NadekoInteractionBase? interaction)
{
inter = interaction;
return this;
@@ -395,7 +395,7 @@ public sealed class SourcedPaginatedResponseBuilder<T> : PaginatedResponseBuilde
return Task.FromResult<IReadOnlyCollection<T>>(ReadOnlyCollection<T>.Empty);
};
public Func<int, Task<SimpleInteractionBase>>? InteractionFunc { get; private set; }
public Func<int, Task<NadekoInteractionBase>>? InteractionFunc { get; private set; }
public int? Elems { get; private set; } = 1;
public int ItemsPerPage { get; private set; } = 9;
@@ -478,13 +478,13 @@ public sealed class SourcedPaginatedResponseBuilder<T> : PaginatedResponseBuilde
return paginationSender.SendAsync(IsEphemeral);
}
public SourcedPaginatedResponseBuilder<T> Interaction(Func<int, Task<SimpleInteractionBase>> func)
public SourcedPaginatedResponseBuilder<T> Interaction(Func<int, Task<NadekoInteractionBase>> func)
{
InteractionFunc = func; //async (i) => await func(i);
return this;
}
public SourcedPaginatedResponseBuilder<T> Interaction(SimpleInteractionBase inter)
public SourcedPaginatedResponseBuilder<T> Interaction(NadekoInteractionBase inter)
{
InteractionFunc = _ => Task.FromResult(inter);
return this;

View File

@@ -8,5 +8,5 @@
public required AllowedMentions SanitizeMentions { get; set; }
public IUser? User { get; set; }
public bool Ephemeral { get; set; }
public NadekoInteraction? Interaction { get; set; }
public NadekoInteractionBase? Interaction { get; set; }
}

View File

@@ -40,19 +40,29 @@ public sealed class CommandsUtilityService : ICommandsUtilityService, INService
var culture = _loc.GetCultureInfo(guild);
var em = _sender.CreateEmbed()
.AddField(str, $"{com.RealSummary(_strings, _medusae, culture, prefix)}", true);
.AddField(str, $"{com.RealSummary(_strings, _medusae, culture, prefix)}", true);
_dpos.TryGetOverrides(guild?.Id ?? 0, com.Name, out var overrides);
var reqs = GetCommandRequirements(com, (GuildPermission?)overrides);
if (reqs.Any())
em.AddField(GetText(strs.requires, guild), string.Join("\n", reqs));
var paramList = _strings.GetCommandStrings(com.Name, culture)?.Params;
em
.WithOkColor()
.AddField(_strings.GetText(strs.usage),
string.Join("\n", com.RealRemarksArr(_strings, _medusae, culture, prefix).Map(arg => Format.Code(arg))))
.WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild));
if (paramList is not null and not [])
{
var pl = paramList
.Select(x => Format.Code($"{prefix}{com.Name} {x.Keys.Select(y => $"<{y}>").Join(' ')}"))
.Join('\n');
em.AddField(GetText(strs.overloads, guild), pl);
}
var opt = GetNadekoOptionType(com.Attributes);
if (opt is not null)
{

View File

@@ -1,6 +1,6 @@
h:
- help
- h
- help
gencmdlist:
- gencmdlist
donate:
@@ -37,7 +37,7 @@ boost:
boostmsg:
- boostmsg
boostdel:
- boostde
- boostdel
logserver:
- logserver
logignore:
@@ -195,6 +195,12 @@ setname:
- newnm
setnick:
- setnick
setserverbanner:
- setserverbanner
- serverbanner
setservericon:
- setservericon
- servericon
setavatar:
- setavatar
- setav
@@ -335,6 +341,9 @@ allcmdcooldowns:
quoteadd:
- quoteadd
- .
quoteedit:
- quoteedit
- qedit
quoteprint:
- quoteprint
- ..
@@ -1396,3 +1405,5 @@ todoshow:
- see
stickyroles:
- stickyroles
cleanupguilddata:
- cleanupguilddata

View File

@@ -211,23 +211,23 @@ repeat:
desc: "The amount of time between each repetition."
message:
desc: "The text to be repeated at the specified intervals or times."
- ch:
- channel:
desc: "The channel where the message will be sent."
interval:
desc: "The amount of time between each repetition."
message:
desc: "The text to be repeated at the specified intervals or times."
- dt:
- timeOfDay:
desc: "The time at which the message should be repeated, either once every specified amount of time or at a specific time of day."
message:
desc: "The text to be repeated at the specified intervals or times."
- channel:
desc: "The channel where the message will be repeated."
dt:
timeOfDay:
desc: "The time at which the message should be repeated, either once every specified amount of time or at a specific time of day."
message:
desc: "The text to be repeated at the specified intervals or times."
- dt:
- timeOfDay:
desc: "The time at which the message should be repeated, either once every specified amount of time or at a specific time of day."
interval:
desc: "The amount of time between each repetition."
@@ -235,7 +235,7 @@ repeat:
desc: "The text to be repeated at the specified intervals or times."
- channel:
desc: "The channel where the message will be repeated."
dt:
timeOfDay:
desc: "The time at which the message should be repeated, either once every specified amount of time or at a specific time of day."
interval:
desc: "The amount of time between each repetition."
@@ -370,10 +370,10 @@ expradd:
ex:
- '"hello" Hi there %user.mention%'
params:
- key:
- trigger:
desc: "The trigger word that sets off the response when typed by a user."
message:
desc: "The text of the message that triggers the response when typed by a user."
response:
desc: "The text of the message that shows up when a user types the trigger word."
expraddserver:
desc: 'Add an expression with a trigger and a response in this server. Bot will post a response whenever someone types the trigger word. Guide here: <https://nadekobot.readthedocs.io/en/latest/custom-reactions/>'
ex:
@@ -809,6 +809,20 @@ setgame:
desc: "The activity type determines whether the bot is engaged in a game, listening to audio, or watching a video."
game:
desc: "The current state of the bot's activity in the game."
setserverbanner:
desc: Sets a new banner image for the current server. Parameter is a direct link to an image.
ex:
- https://i.imgur.com/xTG3a1I.jpg
params:
- img:
desc: "The URL of the image file to be displayed as the bot's banner."
setservericon:
desc: Sets a new icon image for the current server. Parameter is a direct link to an image.
ex:
- https://i.imgur.com/xTG3a1I.jpg
params:
- img:
desc: "The URL of the image file to be displayed as the bot's banner."
send:
desc: 'Sends a message to a channel or user. Channel or user can be '
ex:
@@ -1231,6 +1245,15 @@ quoteadd:
desc: "The name of the quote used to retrieve the quote."
text:
desc: "The message of the quote."
quoteedit:
desc: Edits a quote with the specified ID.
ex:
- 55 This is the new response.
params:
- quoteId:
desc: "The ID of the quote being edited."
text:
desc: "The new message of the quote."
quoteprint:
desc: Prints a random quote with a specified name.
ex:
@@ -1243,7 +1266,7 @@ quoteshow:
ex:
- 123
params:
- id:
- quoteId:
desc: "The unique identifier for the quote being queried."
quotesearch:
desc: 'Shows a random quote given a search query. Partially matches in several ways: 1) Only content of any quote, 2) only by author, 3) keyword and content, 3) or keyword and author'
@@ -1264,14 +1287,14 @@ quoteid:
ex:
- 123456
params:
- id:
- quoteId:
desc: "The unique identifier for the quote to be displayed."
quotedelete:
desc: Deletes a quote with the specified ID. You have to either have the Manage Messages permission or be the creator of the quote to delete it.
ex:
- 123456
params:
- id:
- quoteId:
desc: "The unique identifier for the quote being deleted."
quotedeleteauthor:
desc: Deletes all quotes by the specified author. If the author is not you, then ManageMessage server permission is required.
@@ -4426,3 +4449,11 @@ todoarchivedelete:
params:
- todoId:
desc: "The identifier for the archived todo item to be deleted."
cleanupguilddata:
desc: |-
Deletes data for all servers bot is no longer a member of from the database.
This is a highly destructive and irreversible command.
ex:
- ''
params:
- {}

View File

@@ -188,6 +188,11 @@
"setrole_err": "Failed to add role. I have insufficient permissions.",
"set_avatar": "New avatar set!",
"set_banner": "New banner set!",
"set_srvr_icon": "New server icon set!",
"set_srvr_banner": "New server banner set!",
"srvr_banner_invalid": "Specified image has an invalid filetype. Make sure you're specifying a direct image url.",
"srvr_banner_too_large": "Specified image is too large! Maximum size is 8MB.",
"srvr_banner_invalid_url": "Specified url is not valid. Make sure you're specifying a direct image url.",
"set_channel_name": "New channel name set.",
"set_game": "New game set!",
"set_stream": "New stream set!",
@@ -351,7 +356,7 @@
"hangman_running": "Hangman game already running on this channel.",
"hangman_types": "List of \"{0}hangman\" term types:",
"leaderboard": "Leaderboard",
"picked": "picked {0}",
"picked": "{1} picked {0}",
"planted": "{0} planted {1}",
"trivia_already_running": "Trivia game is already running on this server.",
"trivia_game": "Trivia Game",
@@ -612,6 +617,7 @@
"quotes_remove_none": "No quotes found which you can remove.",
"quote_added_new": "Quote #{0} added.",
"quote_deleted": "Quote #{0} deleted.",
"quote_edited": "Quote Edited",
"region": "Region",
"remind": "I will remind {0} to {1} in {2} `({3:d.M.yyyy.} at {4:HH:mm})`",
"remind_timely": "I will remind you about your timely reward {0}",
@@ -875,7 +881,7 @@
"club_disband_error": "Error. You are either not in a club, or you are not the owner of your club.",
"club_icon_too_large": "Image is too large.",
"club_icon_invalid_filetype": "Specified image has an invalid filetype. Make sure you're specifying a direct image url.",
"club_icon_url_format": "You must specify an absolute image url/.",
"club_icon_url_format": "You must specify an absolute image url.",
"club_icon_set": "New club icon set.",
"club_bans_for": "Bans for {0} club",
"club_apps_for": "Applicants for {0} club",
@@ -1094,5 +1100,6 @@
"todo_archive_not_found": "Archived todo list not found.",
"todo_archived_list": "Archived Todo List",
"search_results": "Search results",
"queue_search_results": "Type the number of the search result to queue up that track."
"queue_search_results": "Type the number of the search result to queue up that track.",
"overloads": "Overloads"
}