Compare commits

...

98 Commits

Author SHA1 Message Date
Kwoth
987d88287a Revert update to .net 7 by mistake 2023-02-12 04:36:03 +01:00
Kwoth
9dc783b36f Fixed .betstats not working on european locales.
- Upped version to 4.3.12
2023-02-11 23:04:31 +01:00
Kwoth
13741b8317 Use ytdlp instead of ytdl by default, not retroactive, only new users affected 2023-02-11 22:35:07 +01:00
Kwoth
313ca2674e timed ban should now work with userids (users who are not in the server yet), closes #400 2023-02-11 22:32:36 +01:00
Kwoth
98956481e9 Nhentai removed as it's currently unfixable, closes #396 2023-02-11 22:17:39 +01:00
Kwoth
51e887fe04 Merge branch 'v4' of https://gitlab.com/Kwoth/nadekobot into v4 2023-02-10 20:17:20 +01:00
Kwoth
8ceab64b96 Added default value support to medusa system, thanks to kotz 2023-02-10 20:17:13 +01:00
Kwoth
92b8511cf1 Merge branch 'gpt' into 'v4'
Added GPT-3

See merge request Kwoth/nadekobot!284
2023-02-10 13:10:45 +00:00
Alan Beatty
a6a052571e Added GPT-3 as an alternative to cleverbot in .config games and data/games.yml 2023-02-10 13:10:45 +00:00
Kwoth
699a5e0c8c Added bot_owner_only attribute to medusa system. Upped version to 4..3.11 2023-01-21 00:33:07 +01:00
Kwoth
76fedc5ff1 .jr will no longer fail if the user isn't in the database yet, fixes #399 2023-01-20 22:36:57 +01:00
Kwoth
992aa781fa .translangs title is now a response string 2023-01-20 06:51:29 +01:00
Kwoth
e52bf798cf Added full list of supported languages for .trans command, improved .translangs output 2023-01-20 05:28:13 +01:00
Kwoth
710f4f2ed8 Updated .translangs, it looks better now and makes it clear which shortcode is for which language 2023-01-20 04:43:25 +01:00
Kwoth
dcc27a4a99 Fixed trivia --nohint, fixes #398 2023-01-19 06:55:33 +01:00
Kwoth
032b6bfd57 Added Bot propety for easy access to the ISelfUser to all medusa *Context types 2023-01-15 04:15:51 +01:00
Kwoth
737bbb8ec1 Added bot_perm support to medusa system 2023-01-15 04:07:04 +01:00
Kwoth
e71708f5e8 .h command show now properly show both channel and server user permission requirements 2023-01-15 00:50:25 +01:00
Kwoth
9841d72622 allow multiple [user_perm] attributes on snek commands 2023-01-15 00:15:27 +01:00
Kwoth
391a3f0513 Medusae names should now be case sensitive and will be saved in the config with the proper capitalization 2023-01-15 00:01:42 +01:00
Kwoth
aa3409a9cf Added [user_perm()] support to medusa system 2023-01-14 22:43:13 +01:00
Kwoth
9a80383327 Added filter support to medusa system 2023-01-14 00:37:38 +01:00
Kwoth
7e61f7fb46 Improved how stickeradd works. Optional parameters will be a hidden feature as it's hard to explain. Tags are now also optional. 2023-01-13 22:55:09 +01:00
Kwoth
d526a2fac6 Merge branch 'stickeradd' into 'v4'
See merge request Kwoth/nadekobot!276
2023-01-11 23:39:14 +00:00
Kwoth
80efb954f1 Added .stickeradd command
Updated docs for medusa
2023-01-11 23:39:14 +00:00
Kwoth
67c156e40f Merge branch 'hokutochen-v4-patch-11221' into 'v4'
Fix for DMHelpText

See merge request Kwoth/nadekobot!283
2023-01-10 14:39:24 +00:00
Hokuto Chen
26f76ef7b9 Fix for DMHelpText 2023-01-10 14:39:23 +00:00
Kwoth
90cee1bfa9 Merge branch 'hokutochen-v4-patch-97342' into 'v4'
Removed Debian 9 support. Added debian 11 support

See merge request Kwoth/nadekobot!282
2023-01-10 14:38:21 +00:00
Hokuto Chen
26171a0ff7 Removed Debian 9 support. Added debian 11 support 2023-01-10 14:38:21 +00:00
Kwoth
59447d7aa8 .deletecurrency will now also reset banked currency, closes #395 2023-01-09 02:59:41 +01:00
Kwoth
a4053d0666 Removed Id property from patronuser 2023-01-09 02:48:11 +01:00
Kwoth
fcd016aed3 Reverted PK fix for patron as it's causing migration to fail 2023-01-09 02:43:18 +01:00
Kwoth
719f62a0ac Merge branch 'v4' of https://gitlab.com/Kwoth/nadekobot into v4 2023-01-09 02:05:54 +01:00
Kwoth
9b9fa2f357 - 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
2023-01-09 02:05:33 +01:00
Kwoth
823f4731c3 Update responses.uk-UA.json (POEditor.com) 2022-12-29 14:38:57 +00:00
Kwoth
5feff8f4b2 Update responses.es-ES.json (POEditor.com) 2022-12-29 14:38:56 +00:00
Kwoth
95d20609a8 Update responses.ru-RU.json (POEditor.com) 2022-12-29 14:38:55 +00:00
Kwoth
b416b9f963 Update responses.pt-BR.json (POEditor.com) 2022-12-29 14:38:53 +00:00
Kwoth
a7c48b13a0 Update responses.pl-PL.json (POEditor.com) 2022-12-29 14:38:52 +00:00
Kwoth
003b71ba00 Update responses.it-IT.json (POEditor.com) 2022-12-29 14:38:51 +00:00
Kwoth
89593dcc2c Update responses.id-ID.json (POEditor.com) 2022-12-29 14:38:50 +00:00
Kwoth
fa9352d1f8 Update responses.de-DE.json (POEditor.com) 2022-12-29 14:38:49 +00:00
Kwoth
4a2f7ffc76 Update responses.fr-FR.json (POEditor.com) 2022-12-29 14:38:48 +00:00
Kwoth
fb1555c075 Update responses.nl-NL.json (POEditor.com) 2022-12-29 14:38:47 +00:00
Kwoth
7a0b409d88 Update responses.zh-TW.json (POEditor.com) 2022-12-29 14:38:46 +00:00
Kwoth
c869f2e335 More nullref fixes in streamrole, ref #392 2022-12-23 17:08:13 +01:00
Kwoth
01da7e813e Fixed a nullref in streamrole service 2022-12-23 17:04:08 +01:00
Kwoth
76b7e09905 Greet/bye messages will now get disabled if they're set to a deleted/unknown channel 2022-12-22 21:37:01 +01:00
Kwoth
8dca948224 Fixed some build warnings. Fixed TimeOut punishment not allowing duration 2022-12-22 21:18:26 +01:00
Kwoth
ffcbfe6467 Fixed a bug for .quotedeleteauthor causing the executing user to delete own messages 2022-12-22 21:11:21 +01:00
Kwoth
d5c70def93 Merge branch 'hokutochen-v4-patch-86494' into 'v4'
added 22.04 warning

See merge request Kwoth/nadekobot!277
2022-12-09 03:06:32 +00:00
Hokuto Chen
34dccab16b added 22.04 warning 2022-12-08 19:43:33 +00:00
Kwoth
2fab61c4f8 Merge branch 'feeds' into 'v4'
Feeds custom message

See merge request Kwoth/nadekobot!273
2022-11-22 21:08:42 +00:00
Kwoth
9f96edbb46 You can now specify an optional custom message in .feed and .yun which will be posted along with an update 2022-11-22 21:08:42 +00:00
Kwoth
3c23b58088 Merge branch 'thread_log' into 'v4'
Thread log

See merge request Kwoth/nadekobot!274
2022-11-22 20:41:57 +00:00
Kwoth
e10530bc0e Thread log 2022-11-22 20:41:57 +00:00
Kwoth
f24692e79b Added .doas command which executes the command as if you were the target user 2022-11-19 22:36:18 +01:00
Kwoth
8a6edc17e4 Optimized .waifuinfo 2022-11-15 22:45:00 +01:00
Kwoth
9ce2837f5a Possible optimization for .waifuinfo 2022-11-13 20:40:37 +01:00
Kwoth
e49e3eec69 Version upped to 4.3.10, CHANGELOG.md updated 2022-11-10 22:42:34 +01:00
Kwoth
3992ae392b Fixed nullref in xploop 2022-11-10 22:32:27 +01:00
Kwoth
8f0c5fab47 Fixed nullref in cmdcd 2022-11-08 07:51:29 +01:00
Kwoth
780a260b88 If cleverbot is disabled through permissions, let other things execute 2022-11-08 07:51:20 +01:00
Kwoth
25692b9585 Fixed .feedadd for real 2022-11-04 17:21:05 +01:00
Kwoth
ed3ce52865 Fixed .feedadd, closes #388 2022-11-04 05:08:22 +01:00
Kwoth
f5f0f1e250 Fixed .prune @Target not working bug 2022-10-25 02:07:05 +02:00
Kwoth
9d9e61fdfb Fixed command cooldown calculation. Closes #387 2022-10-25 01:57:58 +02:00
Kwoth
e68e948a80 Aliases now support %target% placeholder. For example 'alias .bft .bf %target% t' 2022-10-22 23:33:42 +02:00
Kwoth
cb98f4aa15 Added .exprtoggleglobal / .extg which can be used to toggle usage of global expressions on the server 2022-10-21 21:31:59 +02:00
Kwoth
bfec0cbcbf OwnerId will be autofilled in creds.yml if it's missing at startup 2022-10-19 23:43:44 +02:00
Kwoth
3e1268f3bb You can now specify time+date (time is optional) in remind instead of relative time, in the format HH:mm dd.MM.YYYY 2022-10-18 23:31:34 +02:00
Kwoth
c28f458972 Updated help text for .antispam and .antiraid 2022-10-18 01:45:00 +02:00
Kwoth
27ac948463 Added .forwardtochannel which will forward messages to the current channel. It has lower priority than fwtoall 2022-10-17 22:20:48 +02:00
Kwoth
3f9a3c4c18 Merge branch 'hokutochen-v4-patch-12507' into 'v4'
upped medusa version and updated brew command

See merge request Kwoth/nadekobot!271
2022-10-17 11:11:37 +00:00
Hokuto Chen
9a5545a951 docs: upped medusa version and updated brew command 2022-10-17 11:11:37 +00:00
Kwoth
584193db18 Added .filterlist command 2022-10-16 22:57:36 +02:00
Kwoth
1a132fd234 Added a missing return 2022-10-15 13:17:30 +02:00
Kwoth
fd6a51ac82 Added appropriate error messages for every club related command. Removed obsolete error messages. 2022-10-15 13:13:31 +02:00
Kwoth
eb1fabb2b7 Prepared several more enums to clarify club related action results 2022-10-14 23:02:43 +02:00
Kwoth
d079e684bd Clubleave errors clarified. Moved enum results to their own files 2022-10-13 22:27:12 +02:00
Kwoth
bf817a1436 Medusa modules (sneks) should now inherit medusa description when listed in .mdls command 2022-10-12 23:29:48 +02:00
Kwoth
78f1624aaf .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 2022-10-12 20:59:04 +02:00
Kwoth
793a49fc64 Updated version to 4.3.9 2022-10-12 20:20:05 +02:00
Kwoth
8b6be656b3 Updated CHANGELOG.md 2022-10-12 20:19:33 +02:00
Kwoth
89a88304dc If version is not specified, Nadeko.Medusa will default to 5.0.0 to allow for full compatibility for from-source-selfhosters 2022-10-12 20:10:55 +02:00
Kwoth
a7fe9ae08f .betstats now looks uwu 2022-10-11 19:59:58 +02:00
Kwoth
0469705037 Clarified .feedadd errors 2022-10-11 19:14:16 +02:00
Kwoth
dc568fe0e2 Removed a duplicate string key 2022-10-11 18:29:53 +02:00
Kwoth
eb01bb6c08 Removed ambiguity in clubban and clubunban error messages 2022-10-11 18:21:45 +02:00
Kwoth
71a3539d0e Possible fix for Remind .timely button 2022-10-10 18:39:49 +02:00
Kwoth
c896a0cdb8 Added better error messages to .clubapply 2022-10-09 16:25:28 +02:00
Kwoth
8effe817ad Fixed a bug with postgresql and mysql migration folders as well as compilation warning related to it 2022-10-08 09:05:31 +02:00
Kwoth
eedf6998b6 Fixed a bug in cmdcd not modifying the database. Added total stats to .betstats 2022-10-07 11:01:26 +02:00
Kwoth
e6b7c31a72 Gambling Tracker will only track successful removes 2022-10-06 10:55:12 +02:00
Kwoth
2f77fd57b0 Improved .betstats formatting 2022-10-04 16:27:19 +02:00
Kwoth
fda3d92134 Added gambling stats migrations for postgres and mysql 2022-10-03 19:58:08 +02:00
Kwoth
fe6f28143b Updated changelog 2022-10-03 13:52:17 +02:00
Kwoth
df3909fc55 Added .betstats command, shows statistics for multiple gambling commands, .slotstats removed as it is obsolete 2022-10-03 13:49:52 +02:00
195 changed files with 37169 additions and 1297 deletions

View File

@@ -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"

View File

@@ -2,7 +2,96 @@
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## Unreleased
## [4.3.12] - 11.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

View 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, 21.04, 21.10
- Mint: 19, 20
- Debian: 9, 10
- Debian: 10, 11
- CentOS: 7
- openSUSE
- Fedora: 33, 34, 35

View File

@@ -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`

View File

@@ -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!

View 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
{
}

View File

@@ -0,0 +1,7 @@
namespace Nadeko.Snake;
[AttributeUsage(AttributeTargets.Method)]
public sealed class bot_owner_onlyAttribute : MedusaPermAttribute
{
}

View 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;
}
}

View 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;
}
}

View File

@@ -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

View File

@@ -10,7 +10,7 @@ public static class MedusaExtensions
embed: embed.Build(),
options: new()
{
RetryMode = RetryMode.AlwaysRetry
RetryMode = RetryMode.Retry502
});
// unlocalized

View File

@@ -17,4 +17,7 @@
<PackageReference Include="YamlDotNet" Version="11.2.1" />
</ItemGroup>
<PropertyGroup Condition=" '$(Version)' == '' ">
<Version>5.0.0</Version>
</PropertyGroup>
</Project>

View File

@@ -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>();

View File

@@ -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)

View File

@@ -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.

View File

@@ -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()

View File

@@ -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; }

View File

@@ -29,4 +29,7 @@ public enum LogType
VoicePresenceTts,
UserMuted,
UserWarned,
ThreadDeleted,
ThreadCreated
}

View File

@@ -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>());

View 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();
}
}

View File

@@ -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>());

View File

@@ -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)

View File

@@ -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,

View File

@@ -4,6 +4,7 @@ public sealed record ParamData(
Type Type,
string Name,
bool IsOptional,
object? DefaultValue,
bool IsLeftover,
bool IsParams
);

View File

@@ -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; }

View File

@@ -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 =>

View File

@@ -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();

View File

@@ -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();

View 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; }
}

View File

@@ -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; }

View File

@@ -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; }

View File

@@ -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; }

View File

@@ -7,4 +7,4 @@ public class WaifuItem : DbEntity
public int? WaifuInfoId { get; set; }
public string ItemEmoji { get; set; }
public string Name { get; set; }
}
}

View File

@@ -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

View File

@@ -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");

View File

@@ -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");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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");
}
}
}

File diff suppressed because it is too large Load Diff

View 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");
}
}
}

File diff suppressed because it is too large Load Diff

View 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");
}
}
}

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations.PostgreSql
{
public partial class logthread : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "threadcreatedid",
table: "logsettings",
type: "numeric(20,0)",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "threaddeletedid",
table: "logsettings",
type: "numeric(20,0)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "threadcreatedid",
table: "logsettings");
migrationBuilder.DropColumn(
name: "threaddeletedid",
table: "logsettings");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations.PostgreSql
{
public partial class feedtext : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "message",
table: "feedsub",
type: "text",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "message",
table: "feedsub");
}
}
}

View File

@@ -1023,6 +1023,10 @@ namespace NadekoBot.Migrations.PostgreSql
.HasColumnType("integer")
.HasColumnName("guildconfigid");
b.Property<string>("Message")
.HasColumnType("text")
.HasColumnName("message");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text")
@@ -1157,6 +1161,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")
@@ -1287,6 +1326,10 @@ namespace NadekoBot.Migrations.PostgreSql
.HasColumnType("boolean")
.HasColumnName("deletestreamonlinemessage");
b.Property<bool>("DisableGlobalExpressions")
.HasColumnType("boolean")
.HasColumnName("disableglobalexpressions");
b.Property<string>("DmGreetMessageText")
.HasColumnType("text")
.HasColumnName("dmgreetmessagetext");
@@ -1551,6 +1594,14 @@ namespace NadekoBot.Migrations.PostgreSql
.HasColumnType("numeric(20,0)")
.HasColumnName("messageupdatedid");
b.Property<decimal?>("ThreadCreatedId")
.HasColumnType("numeric(20,0)")
.HasColumnName("threadcreatedid");
b.Property<decimal?>("ThreadDeletedId")
.HasColumnType("numeric(20,0)")
.HasColumnName("threaddeletedid");
b.Property<decimal?>("UserBannedId")
.HasColumnType("numeric(20,0)")
.HasColumnName("userbannedid");

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
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("Sqlite:Autoincrement", true),
Feature = table.Column<string>(type: "TEXT", nullable: true),
Bet = table.Column<decimal>(type: "TEXT", nullable: false),
PaidOut = table.Column<decimal>(type: "TEXT", nullable: false),
DateAdded = table.Column<DateTime>(type: "TEXT", 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");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
public partial class toggleglobalexpressions : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "DisableGlobalExpressions",
table: "GuildConfigs",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DisableGlobalExpressions",
table: "GuildConfigs");
}
}
}

Some files were not shown because too many files have changed in this diff Show More