mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Compare commits
136 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3f5443dd54 | ||
|
93df4f3bf3 | ||
|
073b832065 | ||
|
a01e580e03 | ||
|
6124e2fab5 | ||
|
4dd31d6a0b | ||
|
e8706d4006 | ||
|
140cc43c98 | ||
|
26b7149435 | ||
|
b354ee7269 | ||
|
b829ca0109 | ||
|
37acdb81e8 | ||
|
a9aea65134 | ||
|
5c03c5ba16 | ||
|
42f00c08fa | ||
|
598d3b8967 | ||
|
8df41c749b | ||
|
0eaa8be2d2 | ||
|
bdbe76f9f8 | ||
|
08b609a4b4 | ||
|
42d13b32b2 | ||
|
096ada367f | ||
|
0fed33ebda | ||
|
cb9e918681 | ||
|
bbf167df4d | ||
|
595a2b401c | ||
|
5713e8414e | ||
|
a551caf0da | ||
|
b13f05c4c0 | ||
|
6d6a3a811f | ||
|
fb4aac9f0d | ||
|
a98981de86 | ||
|
9ef3646711 | ||
|
9c174b8b6f | ||
|
657c1e461c | ||
|
f5a4a698bd | ||
|
8112337aaf | ||
|
73f7394e31 | ||
|
987d88287a | ||
|
9dc783b36f | ||
|
13741b8317 | ||
|
313ca2674e | ||
|
98956481e9 | ||
|
51e887fe04 | ||
|
8ceab64b96 | ||
|
92b8511cf1 | ||
|
a6a052571e | ||
|
699a5e0c8c | ||
|
76fedc5ff1 | ||
|
992aa781fa | ||
|
e52bf798cf | ||
|
710f4f2ed8 | ||
|
dcc27a4a99 | ||
|
032b6bfd57 | ||
|
737bbb8ec1 | ||
|
e71708f5e8 | ||
|
9841d72622 | ||
|
391a3f0513 | ||
|
aa3409a9cf | ||
|
9a80383327 | ||
|
7e61f7fb46 | ||
|
d526a2fac6 | ||
|
80efb954f1 | ||
|
67c156e40f | ||
|
26f76ef7b9 | ||
|
90cee1bfa9 | ||
|
26171a0ff7 | ||
|
59447d7aa8 | ||
|
a4053d0666 | ||
|
fcd016aed3 | ||
|
719f62a0ac | ||
|
9b9fa2f357 | ||
|
823f4731c3 | ||
|
5feff8f4b2 | ||
|
95d20609a8 | ||
|
b416b9f963 | ||
|
a7c48b13a0 | ||
|
003b71ba00 | ||
|
89593dcc2c | ||
|
fa9352d1f8 | ||
|
4a2f7ffc76 | ||
|
fb1555c075 | ||
|
7a0b409d88 | ||
|
c869f2e335 | ||
|
01da7e813e | ||
|
76b7e09905 | ||
|
8dca948224 | ||
|
ffcbfe6467 | ||
|
d5c70def93 | ||
|
34dccab16b | ||
|
2fab61c4f8 | ||
|
9f96edbb46 | ||
|
3c23b58088 | ||
|
e10530bc0e | ||
|
f24692e79b | ||
|
8a6edc17e4 | ||
|
9ce2837f5a | ||
|
e49e3eec69 | ||
|
3992ae392b | ||
|
8f0c5fab47 | ||
|
780a260b88 | ||
|
25692b9585 | ||
|
ed3ce52865 | ||
|
f5f0f1e250 | ||
|
9d9e61fdfb | ||
|
e68e948a80 | ||
|
cb98f4aa15 | ||
|
bfec0cbcbf | ||
|
3e1268f3bb | ||
|
c28f458972 | ||
|
27ac948463 | ||
|
3f9a3c4c18 | ||
|
9a5545a951 | ||
|
584193db18 | ||
|
1a132fd234 | ||
|
fd6a51ac82 | ||
|
eb1fabb2b7 | ||
|
d079e684bd | ||
|
bf817a1436 | ||
|
78f1624aaf | ||
|
793a49fc64 | ||
|
8b6be656b3 | ||
|
89a88304dc | ||
|
a7fe9ae08f | ||
|
0469705037 | ||
|
dc568fe0e2 | ||
|
eb01bb6c08 | ||
|
71a3539d0e | ||
|
c896a0cdb8 | ||
|
8effe817ad | ||
|
eedf6998b6 | ||
|
e6b7c31a72 | ||
|
2f77fd57b0 | ||
|
fda3d92134 | ||
|
fe6f28143b | ||
|
df3909fc55 |
@@ -104,7 +104,7 @@ publish-medusa-package:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG
|
||||
script:
|
||||
- LAST_TAG=$(git describe --tags --abbrev=0)
|
||||
- if [ $CI_COMMIT_TAG ];then MEDUSA_VERSION="$CI_COMMIT_TAG"; else MEDUSA_VERSION="$LAST_TAG-$CI_COMMIT_SHA"; fi
|
||||
- if [ $CI_COMMIT_TAG ];then MEDUSA_VERSION="$CI_COMMIT_TAG"; else MEDUSA_VERSION="$LAST_TAG-$CI_COMMIT_SHORT_SHA"; fi
|
||||
- cd src/Nadeko.Medusa/
|
||||
- dotnet pack -c Release /p:Version=$MEDUSA_VERSION -o bin/Release/packed
|
||||
- dotnet nuget push bin/Release/packed/ --source https://www.myget.org/F/nadeko/api/v2/package --api-key "$MYGET_API_KEY"
|
||||
|
125
CHANGELOG.md
125
CHANGELOG.md
@@ -2,7 +2,130 @@
|
||||
|
||||
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
||||
|
||||
## Unreleased
|
||||
## [4.3.16] - 24.05.2023
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed missing events from `.logevents`
|
||||
- Fixed `.log` thread deleted and thread created events not working properly
|
||||
|
||||
## [4.3.15] - 21.05.2023
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed -w 0 in trivia
|
||||
- Fixed `.rps` amount field in the response
|
||||
- Fixed `.showembed` output
|
||||
- Fixed bank award's incorrect output message
|
||||
|
||||
## [4.3.14] - 02.04.2023
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed voice hearbeat issue
|
||||
- `.banktake` had ok/error responses flipped. No functional change
|
||||
- PermRole should deny messages in threads todo
|
||||
- Fixed chucknorris jokes
|
||||
- `.logserver` will now
|
||||
|
||||
## [4.3.13] - 20.02.2023
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `.log userpresence`
|
||||
- `.q` will now use `yt-dlp` if anything other than `ytProvider: Ytdl` is set in `data/searches.yml`
|
||||
- Fixed Title links on some embeds
|
||||
|
||||
## [4.3.12] - 12.02.2023
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `.betstats` not working on european locales
|
||||
- Timed `.ban` will work on users who are not in the server
|
||||
- Fixed some bugs in the medusa system
|
||||
|
||||
## [4.3.11] - 21.01.2023
|
||||
|
||||
### Added
|
||||
|
||||
- Added `.doas` Bot owner only command
|
||||
- Added `.stickeradd` command
|
||||
|
||||
### Changed
|
||||
|
||||
- `.waifuinfo` optimized
|
||||
- You can now specify an optional custom message in `.feed` and `.yun` which will be posted along with an update
|
||||
- Greet/bye messages will now get disabled if they're set to a deleted/unknown channel
|
||||
- Updated response strings
|
||||
- `.translate` now supports many more languages
|
||||
- `.translangs` prettier output
|
||||
|
||||
### Fixed
|
||||
|
||||
- Added logging for thread events
|
||||
- Fixed a bug for `.quotedeleteauthor` causing the executing user to delete own messages
|
||||
- Fixed TimeOut punishment not alklowing duration
|
||||
- Fixed a nullref in streamrole service
|
||||
- Fixed some potential causes for ratelimit due to default message retry settings
|
||||
- Fixed a patron rewards bug caused by monthly donation checking not accounting for year increase
|
||||
- Fixed a patron rewards bug for users who connected the same discord account with multiple patreon accounts
|
||||
- `.deletecurrency` will now also reset banked currency
|
||||
- Fixed DMHelpText reply
|
||||
- `.h` command show now properly show both channel and server user permission requirements
|
||||
- Many fixes and improvements to medusa system
|
||||
- Fixed trivia --nohint
|
||||
- `.joinrace` will no longer fail if the user isn't in the database yet
|
||||
|
||||
## [4.3.10] - 10.11.2022
|
||||
|
||||
### Added
|
||||
|
||||
- `.filterlist` / `.fl` command which lists link and invite filtering channels and status
|
||||
- Added support for `%target%` placeholder in `.alias` command
|
||||
- Added .forwardtochannel which will forward messages to the current channel. It has lower priority than fwtoall
|
||||
- Added .exprtoggleglobal / .extg which can be used to toggle usage of global expressions on the server
|
||||
|
||||
### Changed
|
||||
|
||||
- .meload and .meunload are now case sensitive. Previously loaded medusae may need to be reloaded or data/medusae/medusa.yml may need to be edited manually
|
||||
- Several club related command have their error messages improved
|
||||
- Updated help text for .antispam and .antiraid
|
||||
- You can now specify time and date (time is optional) in `.remind` command instead of relative time, in the format `HH:mm dd.MM.YYYY`
|
||||
- OwnerId will be automatically added to `creds.yml` at bot startup if it's missing
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed `.cmdcd` console error
|
||||
- Fixed an error when currency is add per xp
|
||||
- Fixed an issue preventing execution of expressions starting with @Bot when cleverbot is enabled on the server
|
||||
- Fixed `.feedadd`
|
||||
- Fixed `.prune @target` not working
|
||||
- Medusa modules (sneks) should now inherit medusa description when listed in .mdls command
|
||||
- Fixed command cooldown calculation
|
||||
|
||||
## [4.3.9] - 12.10.2022
|
||||
|
||||
### Added
|
||||
|
||||
- `.betstats` shows sum of all bets, payouts and the payout rate in %. Updates once an hour
|
||||
|
||||
### Changed
|
||||
|
||||
- `.betstats` looks way better (except on Mac)
|
||||
- `.feedadd` errors clarified and separated in individual error messages for each issue.
|
||||
- `.clubban` and `.clubunban` errors clarified and separated in individual error messages for each issue.
|
||||
- `.clubapply` better error messages
|
||||
|
||||
### Fixed
|
||||
|
||||
- `.timely` 'Remind' button fixed in DMs
|
||||
- `.cmdcd` database bugs fixed
|
||||
- Fixed bugged mysql and postgresql migrations
|
||||
- Fixed issues with lodaing medusae due to strict versioning
|
||||
|
||||
### Removed
|
||||
|
||||
- `.slotstats` Superseded by `.betstats`
|
||||
|
||||
## [4.3.8] - 02.10.2022
|
||||
|
||||
|
@@ -24,6 +24,10 @@ The list below is not complete. Use commands above to see up-to-date list for yo
|
||||
|
||||
`trivia.min_win_req` - Restricts a user's ability to make a trivia game with a win requirement less than the set value.
|
||||
`trivia.currency_reward` - Sets the amount of currency a user will win if they place first in a completed trivia game.
|
||||
`hangman.currency_reward` - Sets the amount of currency a user will win if they win a game of hangman.
|
||||
`chatbot` - Sets which chatbot API the bot should use, values: `gpt3`, `cleverbot`.
|
||||
`gpt.model` - Sets which GPT-3 model the bot should use, values: `ada001`, `babbage001`, `curie001`, `davinci003`.
|
||||
`gpt.max_tokens` - Sets the limit of tokens GPT-3 can use per call. Find out more about tokens [here](https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them).
|
||||
|
||||
*more settings may be available in `data/games.yml` file*
|
||||
|
||||
|
@@ -15,11 +15,14 @@ w# Setting up NadekoBot on Linux
|
||||
|
||||
It is recommended that you use **Ubuntu 20.04**, as there have been nearly no problems with it. Also, **32-bit systems are incompatible**.
|
||||
|
||||
|
||||
### Ubuntu 22.04 is ruled as incompatible so double check which ubuntu version you are using.
|
||||
|
||||
##### Compatible operating systems:
|
||||
|
||||
- Ubuntu: 16.04, 18.04, 20.04, 21.04, 21.10, 22.04
|
||||
- Ubuntu: 16.04, 18.04, 20.04
|
||||
- Mint: 19, 20
|
||||
- Debian: 9, 10
|
||||
- Debian: 10, 11
|
||||
- CentOS: 7
|
||||
- openSUSE
|
||||
- Fedora: 33, 34, 35
|
||||
|
@@ -7,7 +7,7 @@ Open Terminal (if you don't know how to, click on the magnifying glass on the to
|
||||
###### Homebrew/wget
|
||||
*Skip this step if you already have homebrew installed*
|
||||
- Copy and paste this command, then press Enter:
|
||||
- `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
||||
- `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
|
||||
- Install wget
|
||||
- `brew install wget`
|
||||
|
||||
|
@@ -123,7 +123,7 @@ In order to use music commands, you need ffmpeg and youtube-dl installed.
|
||||
- [ffmpeg-32bit] | [ffmpeg-64bit] - Download the **appropriate version** for your system (32 bit if you're running a 32 bit OS, or 64 if you're running a 64bit OS). Unzip it, and move `ffmpeg.exe` to a path that's in your PATH environment variable. If you don't know what that is, just move the `ffmpeg.exe` file to `NadekoBot/output`.
|
||||
- [youtube-dl] - Click to download the file, then move `youtube-dl.exe` to a path that's in your PATH environment variable. If you don't know what that is, just move the `youtube-dl.exe` file to `NadekoBot/system`.
|
||||
|
||||
[Updater]: https://dl.nadeko.bot/
|
||||
[Updater]: https://dl.nadeko.bot/v3/
|
||||
[Notepad++]: https://notepad-plus-plus.org/
|
||||
[.net]: https://dotnet.microsoft.com/download/dotnet/5.0
|
||||
[Redis]: https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi
|
||||
|
@@ -147,6 +147,7 @@ This section will guide you through how to create a simple custom medusa. You ca
|
||||
<!-- Use latest .net features -->
|
||||
<LangVersion>preview</LangVersion>
|
||||
<EnablePreviewFeatures>true</EnablePreviewFeatures>
|
||||
<GenerateRequiresPreviewFeaturesAttribute>true</GenerateRequiresPreviewFeaturesAttribute>
|
||||
|
||||
<!-- tell .net that this library will be used as a plugin -->
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
@@ -155,7 +156,7 @@ This section will guide you through how to create a simple custom medusa. You ca
|
||||
<ItemGroup>
|
||||
<!-- Base medusa package. You MUST reference this in order to have a working medusa -->
|
||||
<!-- Also, this package comes from MyGet, which requires you to have a NuGet.Config file next to your .csproj -->
|
||||
<PackageReference Include="Nadeko.Medusa" Version="1.0.1">
|
||||
<PackageReference Include="Nadeko.Medusa" Version="4.3.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -248,4 +249,4 @@ hello:
|
||||
- Unload it
|
||||
- `.meunload example_medusa`
|
||||
|
||||
- Congrats! You've just made your first medusa!
|
||||
- Congrats! You've just made your first medusa!
|
||||
|
@@ -89,6 +89,5 @@ Some features have their own specific placeholders which are noted in that featu
|
||||
|
||||
- `%rngX-Y%` - Returns a random number between X and Y
|
||||
- `%target%` - Returns anything the user has written after the trigger (only works on Expressions)
|
||||
- `%img:stuff%` - Returns an `imgur.com` search for "stuff" (only works on Expressions)
|
||||
|
||||

|
||||
|
10
src/Nadeko.Medusa/Attributes/MedusaPermAttribute.cs
Normal file
10
src/Nadeko.Medusa/Attributes/MedusaPermAttribute.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Nadeko.Snake;
|
||||
|
||||
/// <summary>
|
||||
/// Used as a marker class for bot_perm and user_perm Attributes
|
||||
/// Has no functionality.
|
||||
/// </summary>
|
||||
public abstract class MedusaPermAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
7
src/Nadeko.Medusa/Attributes/bot_owner_onlyAttribute.cs
Normal file
7
src/Nadeko.Medusa/Attributes/bot_owner_onlyAttribute.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Nadeko.Snake;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class bot_owner_onlyAttribute : MedusaPermAttribute
|
||||
{
|
||||
|
||||
}
|
23
src/Nadeko.Medusa/Attributes/bot_permAttribute.cs
Normal file
23
src/Nadeko.Medusa/Attributes/bot_permAttribute.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public sealed class bot_permAttribute : MedusaPermAttribute
|
||||
{
|
||||
public GuildPermission? GuildPerm { get; }
|
||||
public ChannelPermission? ChannelPerm { get; }
|
||||
|
||||
|
||||
public bot_permAttribute(GuildPermission perm)
|
||||
{
|
||||
GuildPerm = perm;
|
||||
ChannelPerm = null;
|
||||
}
|
||||
|
||||
public bot_permAttribute(ChannelPermission perm)
|
||||
{
|
||||
ChannelPerm = perm;
|
||||
GuildPerm = null;
|
||||
}
|
||||
}
|
22
src/Nadeko.Medusa/Attributes/user_permAttribute.cs
Normal file
22
src/Nadeko.Medusa/Attributes/user_permAttribute.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Discord;
|
||||
|
||||
namespace Nadeko.Snake;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public sealed class user_permAttribute : MedusaPermAttribute
|
||||
{
|
||||
public GuildPermission? GuildPerm { get; }
|
||||
public ChannelPermission? ChannelPerm { get; }
|
||||
|
||||
public user_permAttribute(GuildPermission perm)
|
||||
{
|
||||
GuildPerm = perm;
|
||||
ChannelPerm = null;
|
||||
}
|
||||
|
||||
public user_permAttribute(ChannelPermission perm)
|
||||
{
|
||||
ChannelPerm = perm;
|
||||
GuildPerm = null;
|
||||
}
|
||||
}
|
@@ -22,6 +22,11 @@ public abstract class AnyContext
|
||||
/// The user who invoked the command
|
||||
/// </summary>
|
||||
public abstract IUser User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Bot user
|
||||
/// </summary>
|
||||
public abstract ISelfUser Bot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to strings used by this medusa
|
||||
|
@@ -10,7 +10,7 @@ public static class MedusaExtensions
|
||||
embed: embed.Build(),
|
||||
options: new()
|
||||
{
|
||||
RetryMode = RetryMode.AlwaysRetry
|
||||
RetryMode = RetryMode.Retry502
|
||||
});
|
||||
|
||||
// unlocalized
|
||||
|
@@ -17,4 +17,7 @@
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Version)' == '' ">
|
||||
<Version>5.0.0</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
@@ -69,7 +69,7 @@ public sealed class Bot
|
||||
: GatewayIntents.AllUnprivileged,
|
||||
LogGatewayIntentWarnings = false,
|
||||
FormatUsersInBidirectionalUnicode = false,
|
||||
DefaultRetryMode = RetryMode.AlwaysRetry ^ RetryMode.RetryRatelimit
|
||||
DefaultRetryMode = RetryMode.Retry502
|
||||
});
|
||||
|
||||
_commandService = new(new()
|
||||
@@ -313,10 +313,29 @@ public sealed class Bot
|
||||
await _commandService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||
// await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||
IsReady = true;
|
||||
|
||||
await EnsureBotOwnershipAsync();
|
||||
_ = Task.Run(ExecuteReadySubscriptions);
|
||||
Log.Information("Shard {ShardId} ready", Client.ShardId);
|
||||
}
|
||||
|
||||
private async ValueTask EnsureBotOwnershipAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_creds.OwnerIds.Count != 0)
|
||||
return;
|
||||
|
||||
Log.Information("Initializing Owner Id...");
|
||||
var info = await Client.GetApplicationInfoAsync();
|
||||
_credsProvider.ModifyCredsFile(x => x.OwnerIds = new[] { info.Owner.Id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning("Getting application info failed: {ErrorMessage}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private Task ExecuteReadySubscriptions()
|
||||
{
|
||||
var readyExecutors = Services.GetServices<IReadyExecutor>();
|
||||
|
@@ -3,7 +3,7 @@ using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace Discord;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class UserPermAttribute : RequireUserPermissionAttribute
|
||||
{
|
||||
public UserPermAttribute(GuildPerm permission)
|
||||
|
@@ -12,7 +12,7 @@ namespace NadekoBot.Common.Configs;
|
||||
public sealed partial class BotConfig : ICloneable<BotConfig>
|
||||
{
|
||||
[Comment(@"DO NOT CHANGE")]
|
||||
public int Version { get; set; } = 4;
|
||||
public int Version { get; set; } = 5;
|
||||
|
||||
[Comment(@"Most commands, when executed, have a small colored line
|
||||
next to the response. The color depends whether the command
|
||||
@@ -39,6 +39,10 @@ Allowed values: Simple, Normal, None")]
|
||||
@"Do you want the message to be forwarded only to the first owner specified in the list of owners (in creds.yml),
|
||||
or all owners? (this might cause the bot to lag if there's a lot of owners specified)")]
|
||||
public bool ForwardToAllOwners { get; set; }
|
||||
|
||||
[Comment(@"Any messages sent by users in Bot's DM to be forwarded to the specified channel.
|
||||
This option will only work when ForwardToAllOwners is set to false")]
|
||||
public ulong? ForwardToChannel { get; set; }
|
||||
|
||||
[Comment(@"When a user DMs the bot with a message which is not a command
|
||||
they will receive this message. Leave empty for no response. The string which will be sent whenever someone DMs the bot.
|
||||
|
@@ -53,6 +53,9 @@ go to https://www.patreon.com/portal -> my clients -> create client")]
|
||||
|
||||
[Comment(@"Official cleverbot api key.")]
|
||||
public string CleverbotApiKey { get; set; }
|
||||
|
||||
[Comment(@"Official GPT-3 api key.")]
|
||||
public string Gpt3ApiKey { get; set; }
|
||||
|
||||
[Comment(@"Which cache implementation should bot use.
|
||||
'memory' - Cache will be in memory of the bot's process itself. Only use this on bots with a single shard. When the bot is restarted the cache is reset.
|
||||
@@ -118,7 +121,7 @@ Windows default
|
||||
|
||||
public Creds()
|
||||
{
|
||||
Version = 6;
|
||||
Version = 7;
|
||||
Token = string.Empty;
|
||||
UsePrivilegedIntents = true;
|
||||
OwnerIds = new List<ulong>();
|
||||
@@ -128,6 +131,7 @@ Windows default
|
||||
Patreon = new(string.Empty, string.Empty, string.Empty, string.Empty);
|
||||
BotListToken = string.Empty;
|
||||
CleverbotApiKey = string.Empty;
|
||||
Gpt3ApiKey = string.Empty;
|
||||
BotCache = BotCacheImplemenation.Memory;
|
||||
RedisOptions = "localhost:6379,syncTimeout=30000,responseTimeout=30000,allowAdmin=true,password=";
|
||||
Db = new()
|
||||
|
@@ -14,6 +14,7 @@ public interface IBotCredentials
|
||||
int TotalShards { get; }
|
||||
Creds.PatreonSettings Patreon { get; }
|
||||
string CleverbotApiKey { get; }
|
||||
string Gpt3ApiKey { get; }
|
||||
RestartConfig RestartCommand { get; }
|
||||
Creds.VotesSettings Votes { get; }
|
||||
string BotListToken { get; }
|
||||
|
@@ -29,4 +29,7 @@ public enum LogType
|
||||
VoicePresenceTts,
|
||||
UserMuted,
|
||||
UserWarned,
|
||||
|
||||
ThreadDeleted,
|
||||
ThreadCreated
|
||||
}
|
@@ -5,9 +5,11 @@ public sealed class DmContextAdapter : DmContext
|
||||
public override IMedusaStrings Strings { get; }
|
||||
public override IDMChannel Channel { get; }
|
||||
public override IUserMessage Message { get; }
|
||||
public override ISelfUser Bot { get; }
|
||||
public override IUser User
|
||||
=> Message.Author;
|
||||
|
||||
|
||||
private readonly IServiceProvider _services;
|
||||
private readonly Lazy<IEmbedBuilderService> _ebs;
|
||||
private readonly Lazy<IBotStrings> _botStrings;
|
||||
@@ -26,6 +28,7 @@ public sealed class DmContextAdapter : DmContext
|
||||
|
||||
Channel = ch;
|
||||
Message = ctx.Message;
|
||||
Bot = ctx.Client.CurrentUser;
|
||||
|
||||
|
||||
_ebs = new(_services.GetRequiredService<IEmbedBuilderService>());
|
||||
|
31
src/NadekoBot/Common/Medusa/Adapters/FilterAdapter.cs
Normal file
31
src/NadekoBot/Common/Medusa/Adapters/FilterAdapter.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace Nadeko.Medusa.Adapters;
|
||||
|
||||
public class FilterAdapter : PreconditionAttribute
|
||||
{
|
||||
private readonly FilterAttribute _filterAttribute;
|
||||
private readonly IMedusaStrings _strings;
|
||||
|
||||
public FilterAdapter(FilterAttribute filterAttribute,
|
||||
IMedusaStrings strings)
|
||||
{
|
||||
_filterAttribute = filterAttribute;
|
||||
_strings = strings;
|
||||
}
|
||||
|
||||
public override async Task<PreconditionResult> CheckPermissionsAsync(
|
||||
ICommandContext context,
|
||||
CommandInfo command,
|
||||
IServiceProvider services)
|
||||
{
|
||||
var medusaContext = ContextAdapterFactory.CreateNew(context,
|
||||
_strings,
|
||||
services);
|
||||
|
||||
var result = await _filterAttribute.CheckAsync(medusaContext);
|
||||
|
||||
if (!result)
|
||||
return PreconditionResult.FromError($"Precondition '{_filterAttribute.GetType().Name}' failed.");
|
||||
|
||||
return PreconditionResult.FromSuccess();
|
||||
}
|
||||
}
|
@@ -11,6 +11,7 @@ public sealed class GuildContextAdapter : GuildContext
|
||||
public override IMedusaStrings Strings { get; }
|
||||
public override IGuild Guild { get; }
|
||||
public override ITextChannel Channel { get; }
|
||||
public override ISelfUser Bot { get; }
|
||||
public override IUserMessage Message
|
||||
=> _ctx.Message;
|
||||
|
||||
@@ -28,6 +29,7 @@ public sealed class GuildContextAdapter : GuildContext
|
||||
|
||||
Strings = strings;
|
||||
User = (IGuildUser)ctx.User;
|
||||
Bot = ctx.Client.CurrentUser;
|
||||
|
||||
_services = services;
|
||||
_ebs = new(_services.GetRequiredService<IEmbedBuilderService>());
|
||||
|
@@ -22,8 +22,6 @@ public sealed class MedusaConfigService : ConfigServiceBase<MedusaConfig>, IMedu
|
||||
|
||||
public void AddLoadedMedusa(string name)
|
||||
{
|
||||
name = name.Trim().ToLowerInvariant();
|
||||
|
||||
ModifyConfig(conf =>
|
||||
{
|
||||
if (conf.Loaded is null)
|
||||
@@ -36,8 +34,6 @@ public sealed class MedusaConfigService : ConfigServiceBase<MedusaConfig>, IMedu
|
||||
|
||||
public void RemoveLoadedMedusa(string name)
|
||||
{
|
||||
name = name.Trim().ToLowerInvariant();
|
||||
|
||||
ModifyConfig(conf =>
|
||||
{
|
||||
if (conf.Loaded is null)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Discord.Commands.Builders;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Nadeko.Medusa.Adapters;
|
||||
using NadekoBot.Common.ModuleBehaviors;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -186,7 +187,6 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
return MedusaLoadResult.AlreadyLoaded;
|
||||
|
||||
var safeName = Uri.EscapeDataString(name);
|
||||
name = name.ToLowerInvariant();
|
||||
|
||||
await _lock.WaitAsync();
|
||||
try
|
||||
@@ -383,6 +383,11 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
{
|
||||
var m = mb.WithName(snekInfo.Name);
|
||||
|
||||
foreach (var f in snekInfo.Filters)
|
||||
{
|
||||
m.AddPrecondition(new FilterAdapter(f, strings));
|
||||
}
|
||||
|
||||
foreach (var cmd in snekInfo.Commands)
|
||||
{
|
||||
m.AddCommand(cmd.Aliases.First(),
|
||||
@@ -391,7 +396,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
new(cmd),
|
||||
new(medusaServices),
|
||||
strings),
|
||||
CreateCommandFactory(medusaName, cmd));
|
||||
CreateCommandFactory(medusaName, cmd, strings));
|
||||
}
|
||||
|
||||
foreach (var subInfo in snekInfo.Subsneks)
|
||||
@@ -400,7 +405,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
|
||||
private static readonly RequireContextAttribute _reqGuild = new RequireContextAttribute(ContextType.Guild);
|
||||
private static readonly RequireContextAttribute _reqDm = new RequireContextAttribute(ContextType.DM);
|
||||
private Action<CommandBuilder> CreateCommandFactory(string medusaName, SnekCommandData cmd)
|
||||
private Action<CommandBuilder> CreateCommandFactory(string medusaName, SnekCommandData cmd, IMedusaStrings strings)
|
||||
=> (cb) =>
|
||||
{
|
||||
cb.AddAliases(cmd.Aliases.Skip(1).ToArray());
|
||||
@@ -409,6 +414,31 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
cb.AddPrecondition(_reqGuild);
|
||||
else if (cmd.ContextType == CommandContextType.Dm)
|
||||
cb.AddPrecondition(_reqDm);
|
||||
|
||||
foreach (var f in cmd.Filters)
|
||||
cb.AddPrecondition(new FilterAdapter(f, strings));
|
||||
|
||||
foreach (var ubp in cmd.UserAndBotPerms)
|
||||
{
|
||||
if (ubp is user_permAttribute up)
|
||||
{
|
||||
if (up.GuildPerm is { } gp)
|
||||
cb.AddPrecondition(new UserPermAttribute(gp));
|
||||
else if (up.ChannelPerm is { } cp)
|
||||
cb.AddPrecondition(new UserPermAttribute(cp));
|
||||
}
|
||||
else if (ubp is bot_permAttribute bp)
|
||||
{
|
||||
if (bp.GuildPerm is { } gp)
|
||||
cb.AddPrecondition(new BotPermAttribute(gp));
|
||||
else if (bp.ChannelPerm is { } cp)
|
||||
cb.AddPrecondition(new BotPermAttribute(cp));
|
||||
}
|
||||
else if (ubp is bot_owner_onlyAttribute)
|
||||
{
|
||||
cb.AddPrecondition(new OwnerOnlyAttribute());
|
||||
}
|
||||
}
|
||||
|
||||
cb.WithPriority(cmd.Priority);
|
||||
|
||||
@@ -429,6 +459,9 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
pb.WithIsMultiple(paramData.IsParams)
|
||||
.WithIsOptional(paramData.IsOptional)
|
||||
.WithIsRemainder(paramData.IsLeftover);
|
||||
|
||||
if (paramData.IsOptional)
|
||||
pb.WithDefault(paramData.DefaultValue);
|
||||
};
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
@@ -525,7 +558,6 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private async Task<MedusaUnloadResult> InternalUnloadAsync(string name)
|
||||
{
|
||||
name = name.ToLowerInvariant();
|
||||
if (!_resolved.Remove(name, out var lsi))
|
||||
return MedusaUnloadResult.NotLoaded;
|
||||
|
||||
@@ -752,8 +784,10 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
var cmds = new List<SnekCommandData>();
|
||||
foreach (var method in methodInfos)
|
||||
{
|
||||
var filters = method.GetCustomAttributes<FilterAttribute>().ToArray();
|
||||
var prio = method.GetCustomAttribute<prioAttribute>()?.Priority ?? 0;
|
||||
var filters = method.GetCustomAttributes<FilterAttribute>(true).ToArray();
|
||||
var userAndBotPerms = method.GetCustomAttributes<MedusaPermAttribute>(true)
|
||||
.ToArray();
|
||||
var prio = method.GetCustomAttribute<prioAttribute>(true)?.Priority ?? 0;
|
||||
|
||||
var paramInfos = method.GetParameters();
|
||||
var cmdParams = new List<ParamData>();
|
||||
@@ -769,6 +803,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
|
||||
var leftoverAttribute = pi.GetCustomAttribute<leftoverAttribute>(true);
|
||||
var hasDefaultValue = pi.HasDefaultValue;
|
||||
var defaultValue = pi.DefaultValue;
|
||||
var isLeftover = leftoverAttribute != null;
|
||||
var isParams = pi.GetCustomAttribute<ParamArrayAttribute>() is not null;
|
||||
var paramType = pi.ParameterType;
|
||||
@@ -805,7 +840,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
continue;
|
||||
}
|
||||
|
||||
canInject = false;
|
||||
canInject = false;
|
||||
|
||||
if (isParams)
|
||||
{
|
||||
@@ -826,11 +861,11 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
throw new ArgumentException("Leftover attribute error.");
|
||||
}
|
||||
|
||||
cmdParams.Add(new ParamData(paramType, paramName, hasDefaultValue, isLeftover, isParams));
|
||||
cmdParams.Add(new ParamData(paramType, paramName, hasDefaultValue, defaultValue, isLeftover, isParams));
|
||||
}
|
||||
|
||||
|
||||
var cmdAttribute = method.GetCustomAttribute<cmdAttribute>()!;
|
||||
var cmdAttribute = method.GetCustomAttribute<cmdAttribute>(true)!;
|
||||
var aliases = cmdAttribute.Aliases;
|
||||
if (aliases.Length == 0)
|
||||
aliases = new[] { method.Name.ToLowerInvariant() };
|
||||
@@ -840,6 +875,7 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
||||
method,
|
||||
instance,
|
||||
filters,
|
||||
userAndBotPerms,
|
||||
cmdContext,
|
||||
diParams,
|
||||
cmdParams,
|
||||
|
@@ -4,6 +4,7 @@ public sealed record ParamData(
|
||||
Type Type,
|
||||
string Name,
|
||||
bool IsOptional,
|
||||
object? DefaultValue,
|
||||
bool IsLeftover,
|
||||
bool IsParams
|
||||
);
|
@@ -11,6 +11,7 @@ public sealed class SnekCommandData
|
||||
MethodInfo methodInfo,
|
||||
Snek module,
|
||||
FilterAttribute[] filters,
|
||||
MedusaPermAttribute[] userAndBotPerms,
|
||||
CommandContextType contextType,
|
||||
IReadOnlyList<Type> injectedParams,
|
||||
IReadOnlyList<ParamData> parameters,
|
||||
@@ -21,6 +22,7 @@ public sealed class SnekCommandData
|
||||
MethodInfo = methodInfo;
|
||||
Module = module;
|
||||
Filters = filters;
|
||||
UserAndBotPerms = userAndBotPerms;
|
||||
ContextType = contextType;
|
||||
InjectedParams = injectedParams;
|
||||
Parameters = parameters;
|
||||
@@ -28,6 +30,8 @@ public sealed class SnekCommandData
|
||||
OptionalStrings = strings;
|
||||
}
|
||||
|
||||
public MedusaPermAttribute[] UserAndBotPerms { get; set; }
|
||||
|
||||
public CommandStrings OptionalStrings { get; set; }
|
||||
|
||||
public IReadOnlyCollection<string> Aliases { get; }
|
||||
|
@@ -1,15 +1,14 @@
|
||||
#nullable disable
|
||||
using CommandLine;
|
||||
using CommandLine;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public static class OptionsParser
|
||||
{
|
||||
public static T ParseFrom<T>(string[] args)
|
||||
public static T ParseFrom<T>(string[]? args)
|
||||
where T : INadekoCommandOptions, new()
|
||||
=> ParseFrom(new T(), args).Item1;
|
||||
|
||||
public static (T, bool) ParseFrom<T>(T options, string[] args)
|
||||
public static (T, bool) ParseFrom<T>(T options, string[]? args)
|
||||
where T : INadekoCommandOptions
|
||||
{
|
||||
using var p = new Parser(x =>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#nullable disable warnings
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace NadekoBot;
|
||||
|
||||
@@ -7,14 +8,14 @@ public sealed record SmartEmbedArrayElementText : SmartEmbedTextBase
|
||||
{
|
||||
public string Color { get; init; } = string.Empty;
|
||||
|
||||
public SmartEmbedArrayElementText() : base()
|
||||
public SmartEmbedArrayElementText()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SmartEmbedArrayElementText(IEmbed eb) : base(eb)
|
||||
{
|
||||
|
||||
Color = eb.Color is { } c ? new Rgba32(c.R, c.G, c.B).ToHex() : string.Empty;
|
||||
}
|
||||
|
||||
protected override EmbedBuilder GetEmbedInternal()
|
||||
@@ -63,6 +64,7 @@ public abstract record SmartEmbedTextBase : SmartText
|
||||
public SmartTextEmbedFooter Footer { get; init; }
|
||||
public SmartTextEmbedField[] Fields { get; init; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsValid
|
||||
=> !string.IsNullOrWhiteSpace(Title)
|
||||
|| !string.IsNullOrWhiteSpace(Description)
|
||||
@@ -100,7 +102,7 @@ public abstract record SmartEmbedTextBase : SmartText
|
||||
IconUrl = ef.IconUrl
|
||||
}
|
||||
: null;
|
||||
|
||||
|
||||
if (eb.Fields.Length > 0)
|
||||
{
|
||||
Fields = eb.Fields.Select(field
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#nullable disable
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace NadekoBot;
|
||||
|
||||
public sealed record SmartEmbedTextArray : SmartText
|
||||
@@ -6,6 +8,7 @@ public sealed record SmartEmbedTextArray : SmartText
|
||||
public string Content { get; set; }
|
||||
public SmartEmbedArrayElementText[] Embeds { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsValid
|
||||
=> Embeds?.All(x => x.IsValid) ?? false;
|
||||
|
||||
|
@@ -1,16 +1,20 @@
|
||||
#nullable disable
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace NadekoBot;
|
||||
|
||||
public abstract record SmartText
|
||||
{
|
||||
[JsonIgnore]
|
||||
public bool IsEmbed
|
||||
=> this is SmartEmbedText;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsPlainText
|
||||
=> this is SmartPlainText;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsEmbedArray
|
||||
=> this is SmartEmbedTextArray;
|
||||
|
||||
|
@@ -46,9 +46,7 @@ public sealed class CommandOrExprTypeReader : NadekoTypeReader<CommandOrExprInfo
|
||||
|
||||
public override async ValueTask<TypeReaderResult<CommandOrExprInfo>> ReadAsync(ICommandContext ctx, string input)
|
||||
{
|
||||
input = input.ToUpperInvariant();
|
||||
|
||||
if (_exprs.ExpressionExists(ctx.Guild?.Id, input) || _exprs.ExpressionExists(null, input))
|
||||
if (_exprs.ExpressionExists(ctx.Guild?.Id, input))
|
||||
return TypeReaderResult.FromSuccess(new CommandOrExprInfo(input, CommandOrExprInfo.Type.Custom));
|
||||
|
||||
var cmd = await new CommandTypeReader(_commandHandler, _cmds).ReadAsync(ctx, input);
|
||||
|
@@ -12,10 +12,4 @@ public static class NadekoExpressionExtensions
|
||||
|
||||
public static IEnumerable<NadekoExpression> ForId(this DbSet<NadekoExpression> exprs, ulong id)
|
||||
=> exprs.AsNoTracking().AsQueryable().Where(x => x.GuildId == id).ToList();
|
||||
|
||||
public static NadekoExpression GetByGuildIdAndInput(
|
||||
this DbSet<NadekoExpression> exprs,
|
||||
ulong? guildId,
|
||||
string input)
|
||||
=> exprs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
|
||||
}
|
@@ -10,6 +10,7 @@ namespace NadekoBot.Db;
|
||||
|
||||
public class WaifuInfoStats
|
||||
{
|
||||
public int WaifuId { get; init; }
|
||||
public string FullName { get; init; }
|
||||
public long Price { get; init; }
|
||||
public string ClaimerName { get; init; }
|
||||
@@ -17,9 +18,6 @@ public class WaifuInfoStats
|
||||
public int AffinityCount { get; init; }
|
||||
public int DivorceCount { get; init; }
|
||||
public int ClaimCount { get; init; }
|
||||
public List<WaifuItem> Items { get; init; }
|
||||
public List<string> Claims { get; init; }
|
||||
public List<string> Fans { get; init; }
|
||||
}
|
||||
|
||||
public static class WaifuExtensions
|
||||
@@ -103,6 +101,7 @@ public static class WaifuExtensions
|
||||
.FirstOrDefault())
|
||||
.Select(w => new WaifuInfoStats
|
||||
{
|
||||
WaifuId = w.WaifuId,
|
||||
FullName =
|
||||
ctx.Set<DiscordUser>()
|
||||
.AsQueryable()
|
||||
@@ -135,17 +134,6 @@ public static class WaifuExtensions
|
||||
&& x.NewId == null
|
||||
&& x.UpdateType == WaifuUpdateType.Claimed),
|
||||
Price = w.Price,
|
||||
Claims = ctx.WaifuInfo.AsQueryable()
|
||||
.Include(x => x.Waifu)
|
||||
.Where(x => x.ClaimerId == w.WaifuId)
|
||||
.Select(x => x.Waifu.Username + "#" + x.Waifu.Discriminator)
|
||||
.ToList(),
|
||||
Fans = ctx.WaifuInfo.AsQueryable()
|
||||
.Include(x => x.Waifu)
|
||||
.Where(x => x.AffinityId == w.WaifuId)
|
||||
.Select(x => x.Waifu.Username + "#" + x.Waifu.Discriminator)
|
||||
.ToList(),
|
||||
Items = w.Items
|
||||
})
|
||||
.FirstOrDefault();
|
||||
|
||||
|
@@ -8,6 +8,8 @@ public class FeedSub : DbEntity
|
||||
|
||||
public ulong ChannelId { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
=> Url.GetHashCode(StringComparison.InvariantCulture) ^ GuildConfigId.GetHashCode();
|
||||
|
9
src/NadekoBot/Db/Models/GamblingStats.cs
Normal file
9
src/NadekoBot/Db/Models/GamblingStats.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services.Database.Models;
|
||||
|
||||
public class GamblingStats : DbEntity
|
||||
{
|
||||
public string Feature { get; set; }
|
||||
public decimal Bet { get; set; }
|
||||
public decimal PaidOut { get; set; }
|
||||
}
|
@@ -95,6 +95,8 @@ public class GuildConfig : DbEntity
|
||||
public int WarnExpireHours { get; set; }
|
||||
public WarnExpireAction WarnExpireAction { get; set; } = WarnExpireAction.Clear;
|
||||
|
||||
public bool DisableGlobalExpressions { get; set; } = false;
|
||||
|
||||
#region Boost Message
|
||||
|
||||
public bool SendBoostMessage { get; set; }
|
||||
|
@@ -19,6 +19,10 @@ public class LogSetting : DbEntity
|
||||
public ulong? ChannelCreatedId { get; set; }
|
||||
public ulong? ChannelDestroyedId { get; set; }
|
||||
public ulong? ChannelUpdatedId { get; set; }
|
||||
|
||||
|
||||
public ulong? ThreadDeletedId { get; set; }
|
||||
public ulong? ThreadCreatedId { get; set; }
|
||||
|
||||
public ulong? UserMutedId { get; set; }
|
||||
|
||||
|
@@ -7,7 +7,7 @@ public class WaifuInfo : DbEntity
|
||||
{
|
||||
public int WaifuId { get; set; }
|
||||
public DiscordUser Waifu { get; set; }
|
||||
|
||||
|
||||
public int? ClaimerId { get; set; }
|
||||
public DiscordUser Claimer { get; set; }
|
||||
|
||||
|
@@ -7,4 +7,4 @@ public class WaifuItem : DbEntity
|
||||
public int? WaifuInfoId { get; set; }
|
||||
public string ItemEmoji { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -472,6 +472,14 @@ public abstract class NadekoContext : DbContext
|
||||
.IsUnique());
|
||||
|
||||
#endregion
|
||||
|
||||
#region GamblingStats
|
||||
|
||||
modelBuilder.Entity<GamblingStats>(gs => gs
|
||||
.HasIndex(x => x.Feature)
|
||||
.IsUnique());
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NadekoBot.Services.Database;
|
||||
|
||||
@@ -10,15 +11,45 @@ using NadekoBot.Services.Database;
|
||||
namespace NadekoBot.Migrations.Mysql
|
||||
{
|
||||
[DbContext(typeof(MysqlContext))]
|
||||
partial class MysqlContextModelSnapshot : ModelSnapshot
|
||||
[Migration("20221003175743_gambling-stats")]
|
||||
partial class gamblingstats
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Db.Models.AutoPublishChannel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<ulong>("ChannelId")
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("channelid");
|
||||
|
||||
b.Property<DateTime?>("DateAdded")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnName("dateadded");
|
||||
|
||||
b.Property<ulong>("GuildId")
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("guildid");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_autopublishchannel");
|
||||
|
||||
b.HasIndex("GuildId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_autopublishchannel_guildid");
|
||||
|
||||
b.ToTable("autopublishchannel", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Db.Models.BankUser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1072,6 +1103,39 @@ namespace NadekoBot.Migrations.Mysql
|
||||
b.ToTable("filterwordschannelid", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GamblingStats", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Bet")
|
||||
.HasColumnType("decimal(65,30)")
|
||||
.HasColumnName("bet");
|
||||
|
||||
b.Property<DateTime?>("DateAdded")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnName("dateadded");
|
||||
|
||||
b.Property<string>("Feature")
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("feature");
|
||||
|
||||
b.Property<decimal>("PaidOut")
|
||||
.HasColumnType("decimal(65,30)")
|
||||
.HasColumnName("paidout");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_gamblingstats");
|
||||
|
||||
b.HasIndex("Feature")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_gamblingstats_feature");
|
||||
|
||||
b.ToTable("gamblingstats", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GCChannelId", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -2236,6 +2300,10 @@ namespace NadekoBot.Migrations.Mysql
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("rolename");
|
||||
|
||||
b.Property<ulong?>("RoleRequirement")
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("rolerequirement");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("type");
|
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations.Mysql
|
||||
{
|
||||
public partial class gamblingstats : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "gamblingstats",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
feature = table.Column<string>(type: "varchar(255)", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
bet = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
paidout = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
dateadded = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_gamblingstats", x => x.id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_gamblingstats_feature",
|
||||
table: "gamblingstats",
|
||||
column: "feature",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "gamblingstats");
|
||||
}
|
||||
}
|
||||
}
|
3616
src/NadekoBot/Migrations/Mysql/20221021192758_toggle-global-expressions.Designer.cs
generated
Normal file
3616
src/NadekoBot/Migrations/Mysql/20221021192758_toggle-global-expressions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations.Mysql
|
||||
{
|
||||
public partial class toggleglobalexpressions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "disableglobalexpressions",
|
||||
table: "guildconfigs",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "disableglobalexpressions",
|
||||
table: "guildconfigs");
|
||||
}
|
||||
}
|
||||
}
|
3624
src/NadekoBot/Migrations/Mysql/20221118195208_log-thread.Designer.cs
generated
Normal file
3624
src/NadekoBot/Migrations/Mysql/20221118195208_log-thread.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
35
src/NadekoBot/Migrations/Mysql/20221118195208_log-thread.cs
Normal file
35
src/NadekoBot/Migrations/Mysql/20221118195208_log-thread.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations.Mysql
|
||||
{
|
||||
public partial class logthread : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<ulong>(
|
||||
name: "threadcreatedid",
|
||||
table: "logsettings",
|
||||
type: "bigint unsigned",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<ulong>(
|
||||
name: "threaddeletedid",
|
||||
table: "logsettings",
|
||||
type: "bigint unsigned",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "threadcreatedid",
|
||||
table: "logsettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "threaddeletedid",
|
||||
table: "logsettings");
|
||||
}
|
||||
}
|
||||
}
|
3628
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.Designer.cs
generated
Normal file
3628
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.cs
Normal file
26
src/NadekoBot/Migrations/Mysql/20221122204432_feed-text.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations.Mysql
|
||||
{
|
||||
public partial class feedtext : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "message",
|
||||
table: "feedsub",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "message",
|
||||
table: "feedsub");
|
||||
}
|
||||
}
|
||||
}
|
@@ -975,6 +975,10 @@ namespace NadekoBot.Migrations.Mysql
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("guildconfigid");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(255)")
|
||||
@@ -1101,6 +1105,39 @@ namespace NadekoBot.Migrations.Mysql
|
||||
b.ToTable("filterwordschannelid", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GamblingStats", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Bet")
|
||||
.HasColumnType("decimal(65,30)")
|
||||
.HasColumnName("bet");
|
||||
|
||||
b.Property<DateTime?>("DateAdded")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnName("dateadded");
|
||||
|
||||
b.Property<string>("Feature")
|
||||
.HasColumnType("varchar(255)")
|
||||
.HasColumnName("feature");
|
||||
|
||||
b.Property<decimal>("PaidOut")
|
||||
.HasColumnType("decimal(65,30)")
|
||||
.HasColumnName("paidout");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_gamblingstats");
|
||||
|
||||
b.HasIndex("Feature")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_gamblingstats_feature");
|
||||
|
||||
b.ToTable("gamblingstats", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GCChannelId", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1225,6 +1262,10 @@ namespace NadekoBot.Migrations.Mysql
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("deletestreamonlinemessage");
|
||||
|
||||
b.Property<bool>("DisableGlobalExpressions")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("disableglobalexpressions");
|
||||
|
||||
b.Property<string>("DmGreetMessageText")
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("dmgreetmessagetext");
|
||||
@@ -1481,6 +1522,14 @@ namespace NadekoBot.Migrations.Mysql
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("messageupdatedid");
|
||||
|
||||
b.Property<ulong?>("ThreadCreatedId")
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("threadcreatedid");
|
||||
|
||||
b.Property<ulong?>("ThreadDeletedId")
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("threaddeletedid");
|
||||
|
||||
b.Property<ulong?>("UserBannedId")
|
||||
.HasColumnType("bigint unsigned")
|
||||
.HasColumnName("userbannedid");
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NadekoBot.Services.Database;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
@@ -11,9 +12,10 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace NadekoBot.Migrations.PostgreSql
|
||||
{
|
||||
[DbContext(typeof(PostgreSqlContext))]
|
||||
partial class PostgreSqlContextModelSnapshot : ModelSnapshot
|
||||
[Migration("20221003175752_gambling-stats")]
|
||||
partial class gamblingstats
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
@@ -22,6 +24,37 @@ namespace NadekoBot.Migrations.PostgreSql
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Db.Models.AutoPublishChannel", 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<decimal>("GuildId")
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("guildid");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_autopublishchannel");
|
||||
|
||||
b.HasIndex("GuildId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_autopublishchannel_guildid");
|
||||
|
||||
b.ToTable("autopublishchannel", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Db.Models.BankUser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1126,6 +1159,41 @@ namespace NadekoBot.Migrations.PostgreSql
|
||||
b.ToTable("filterwordschannelid", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GamblingStats", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Bet")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("bet");
|
||||
|
||||
b.Property<DateTime?>("DateAdded")
|
||||
.HasColumnType("timestamp without time zone")
|
||||
.HasColumnName("dateadded");
|
||||
|
||||
b.Property<string>("Feature")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("feature");
|
||||
|
||||
b.Property<decimal>("PaidOut")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("paidout");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_gamblingstats");
|
||||
|
||||
b.HasIndex("Feature")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_gamblingstats_feature");
|
||||
|
||||
b.ToTable("gamblingstats", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.GCChannelId", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -2342,6 +2410,10 @@ namespace NadekoBot.Migrations.PostgreSql
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("rolename");
|
||||
|
||||
b.Property<decimal?>("RoleRequirement")
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("rolerequirement");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("type");
|
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations.PostgreSql
|
||||
{
|
||||
public partial class gamblingstats : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "gamblingstats",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
feature = table.Column<string>(type: "text", nullable: true),
|
||||
bet = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
paidout = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
dateadded = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_gamblingstats", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_gamblingstats_feature",
|
||||
table: "gamblingstats",
|
||||
column: "feature",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "gamblingstats");
|
||||
}
|
||||
}
|
||||
}
|
3764
src/NadekoBot/Migrations/PostgreSql/20221021192807_toggle-global-expressions.Designer.cs
generated
Normal file
3764
src/NadekoBot/Migrations/PostgreSql/20221021192807_toggle-global-expressions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Migrations.PostgreSql
|
||||
{
|
||||
public partial class toggleglobalexpressions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "disableglobalexpressions",
|
||||
table: "guildconfigs",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "disableglobalexpressions",
|
||||
table: "guildconfigs");
|
||||
}
|
||||
}
|
||||
}
|
3772
src/NadekoBot/Migrations/PostgreSql/20221118195200_log-thread.Designer.cs
generated
Normal file
3772
src/NadekoBot/Migrations/PostgreSql/20221118195200_log-thread.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user