Compare commits

...

218 Commits

Author SHA1 Message Date
Kwoth
b0ac35b82e Updated changelog. Version upped to 4.3.19 2024-01-20 14:15:30 +00:00
Kwoth
367135be6a Merge branch 'v4' of https://gitlab.com/kwoth/nadekobot into v4 2024-01-20 14:06:59 +00:00
Kwoth
f69f8548b0 Added followedStreams.maxCount to searches configx 2024-01-20 14:05:20 +00:00
Kwoth
449dbafff7 Merge branch 'v4' into 'v4'
Update GPT ChatterBot

See merge request Kwoth/nadekobot!313
2024-01-16 09:12:14 +00:00
Alexandra
afba004d85 Update GPT ChatterBot
* Updates endpoint from v1/completions to v1/chat/completions
* Add SharpTokens as a library to calculate input token usage
* Subtract input tokens from max_tokens to ensure the API tokens don't exceed the max specified
* Add Chat history support since this API supports it
* Add a personality prompt to tweak the way the bot behaves
* Add a min_tokens config to increase the quality of chat messages when history is enabled
* Adjust the response function to throw an exception so that a null message isn't added to the list.
2024-01-16 09:12:14 +00:00
Kwoth
ef4d38bc87 Changelog updated, version updated to 4.3.18 2023-12-26 17:10:44 +00:00
Kwoth
96851c7c2d Updated lib, fixed icon_url in .showembed 2023-12-26 17:02:02 +00:00
Kwoth
41ae182373 Removed .revimg and .revav, closes #417 2023-12-24 07:51:42 +00:00
Kwoth
9bf5a5a3cd Merge branch 'force-add' into 'v4'
Implemented command to force users into the database, closes #425

Closes #425

See merge request Kwoth/nadekobot!312
2023-12-21 12:45:34 +00:00
Kaoticz
bab23c25a5 Implemented owner-only command .cacheusers to force users into the database, closes #425 2023-12-21 12:45:34 +00:00
Kwoth
0ba8555f56 Merge branch 'v4' into 'v4'
Potential fix for no-show quoteshow

See merge request Kwoth/nadekobot!311
2023-12-11 23:24:04 +00:00
Cata
340c5b2268 Potential fix for no-show quoteshow 2023-12-11 23:24:04 +00:00
Kwoth
77e8c66b73 Merge branch 'hokutochen-v4-patch-27691' into 'v4'
Notifications will be sent even if dms are off when using .give

See merge request Kwoth/nadekobot!310
2023-11-29 12:26:26 +00:00
Hokuto Chen
9d9f8f7f98 Notifications will be sent even if dms are off when using .give 2023-11-29 12:26:26 +00:00
Kwoth
77358a563d Added .clubreject which lets you reject applications to the club. Updated some dependencies. 2023-10-23 17:48:54 +00:00
Kwoth
82a48b101b Fix for langset ts-ts, closes #419 2023-10-17 18:57:17 +00:00
Kwoth
6ebe321de9 Shouldn't be able to apply to clubs while in a club anymore. Fixes #423 2023-10-17 18:44:47 +00:00
Kwoth
b4fec10ee6 Updated changelog. Version upped to 4.3.17 2023-09-06 04:21:14 +00:00
Kwoth
42b9a01550 ci: osx-64 is the correct runtime identifier for macos 2023-09-06 03:59:56 +00:00
Kwoth
5f94b20015 First attempt at creating arm and x64 releases for all 3 platforms 2023-09-06 03:29:41 +00:00
Kwoth
201aa45c6b Merge branch 'v4' into 'v4'
Fixes for MRs 298 / 303 and 305

See merge request Kwoth/nadekobot!307
2023-09-04 04:08:08 +00:00
Ene
97ae7b5a5b fix to gift being character limited (!302), and fixes UserUpdated and UserPresence not correctly ignoring users that are logignored. 2023-09-04 04:08:07 +00:00
Kwoth
9b09f223d9 Merge branch 'dylan.snijder93-v4-patch-73879' into 'v4'
Install yt-dlp instead of youtube-dl

See merge request Kwoth/nadekobot!300
2023-08-16 07:14:39 +00:00
Clithulhu
2caf406254 Install yt-dlp instead of youtube-dl 2023-08-16 07:14:39 +00:00
Kwoth
ce5e04b398 Merge branch 'Amie-chan-v4-patch-89425' into 'v4'
Added Trim() to activity names since apparently some activities have trailing spaces.

See merge request Kwoth/nadekobot!297
2023-06-30 14:15:16 +00:00
Amie
775487ad47 Added Trim() to activity names since apparently some activities have trailing spaces. 2023-06-30 14:15:15 +00:00
Kwoth
41e4936f52 - Fixed .logevents and .log bugs related to thread logging
- Upped version to 4.3.16
- closes #418
2023-05-24 10:33:45 +02:00
Kwoth
d831a116d9 Merge branch 'hokutochen-v4-patch-63450' into 'v4'
Remove %users%

See merge request Kwoth/nadekobot!296
2023-05-20 22:42:56 +00:00
Hokuto Chen
8f43b44677 Remove %users% placeholder from docs 2023-05-20 22:42:56 +00:00
Kwoth
93df4f3bf3 Upped version to 4.3.15, Updated CHANGELOG.md 2023-05-21 00:37:29 +02:00
Kwoth
073b832065 Fixed .rps 'amount' field, closes #415 2023-05-17 17:39:25 +02:00
Kwoth
a01e580e03 Merge branch 'hokutochen-v4-patch-69027' into 'v4'
%img:stuff% Deprecated

See merge request Kwoth/nadekobot!295
2023-05-07 16:14:48 +00:00
Hokuto Chen
6124e2fab5 %img:stuff% Deprecated 2023-05-07 16:14:48 +00:00
Kwoth
4dd31d6a0b Fixed .showembed, closes #410 2023-05-03 02:23:10 +02:00
Kwoth
e8706d4006 Fixed -w 0 for .trivia which allows for infinite games, closes #413 2023-05-02 09:36:27 +02:00
Kwoth
140cc43c98 Merge branch 'hokutochen-v4-patch-43149' into 'v4'
updated updater link

See merge request Kwoth/nadekobot!292
2023-04-06 00:40:30 +00:00
Hokuto Chen
26b7149435 updated updater link 2023-04-06 00:40:29 +00:00
Kwoth
b354ee7269 Merge branch 'v4' into 'v4'
fixed bank award giving error message instead of checkmark

See merge request Kwoth/nadekobot!294
2023-04-06 00:40:02 +00:00
Kamal Tufekcic
b829ca0109 fixed bank award giving error message instead of checkmark 2023-04-06 00:40:02 +00:00
Kwoth
37acdb81e8 Updated CHANGELOG.md, upped version to 4.3.14 2023-04-02 20:46:54 +02:00
Kwoth
a9aea65134 Possible fix for voice issues, thanks to anonymous contributor 2023-04-02 20:37:12 +02:00
Kwoth
5c03c5ba16 .banktake had ok/error responses flipped. No functional change, closes #409 2023-03-23 16:14:45 +01:00
Kwoth
42f00c08fa PermRole should deny messages in threads too, closes #407 2023-03-23 16:13:20 +01:00
Kwoth
598d3b8967 Merge branch 'v4' into 'v4'
Replaced CN API

See merge request Kwoth/nadekobot!291
2023-03-12 05:50:35 +00:00
Kamal Tufekcic
8df41c749b Replaced CN API 2023-03-12 05:50:35 +00:00
Kwoth
0eaa8be2d2 Merge branch 'v4' into 'v4'
Updated LMGTFY to be more offensive like before

See merge request Kwoth/nadekobot!289
2023-03-03 14:54:47 +00:00
Kamal Tufekcic
bdbe76f9f8 Update file Searches.cs 2023-03-03 14:21:59 +00:00
Kamal Tufekcic
08b609a4b4 Update file JokeCommands.cs 2023-02-28 19:50:52 +00:00
Snake26183
42d13b32b2 Merge branch 'v4' of https://gitlab.com/Kwoth/nadekobot into v4 2023-02-28 21:43:53 +00:00
Kwoth
096ada367f Cleanup 2023-02-28 14:49:50 +01:00
Kwoth
0fed33ebda Fixed .h <customeraction> not working with non-ascii characters 2023-02-28 13:22:44 +01:00
snake
cb9e918681 Merge branch 'v4' of https://gitlab.com/Kwoth/nadekobot into v4 2023-02-25 23:39:51 +02:00
Kwoth
bbf167df4d .logserver will now enable newer log events as well, closes #403 2023-02-22 14:43:29 +01:00
Kwoth
595a2b401c Merge branch 'v4' into 'v4'
Fixed incorrect `gpt.model` values, added ChatGPT to docs

See merge request Kwoth/nadekobot!287
2023-02-22 13:37:39 +00:00
Kamal Tufekcic
5713e8414e Fixed incorrect gpt.model values, added ChatGPT to docs 2023-02-22 13:37:39 +00:00
Kwoth
a551caf0da Merge branch 'hokutochen-v4-patch-39233' into 'v4'
removed 21.04 and 21.10 (EOL)

See merge request Kwoth/nadekobot!288
2023-02-21 20:42:14 +00:00
Hokuto Chen
b13f05c4c0 removed 21.04 and 21.10 (EOL) 2023-02-21 20:42:14 +00:00
Kwoth
6d6a3a811f Upped version to 4.2.13, updated changelog 2023-02-20 21:57:42 +01:00
Kwoth
fb4aac9f0d Fixed .log userpresence, closes #402 2023-02-20 21:53:25 +01:00
Kwoth
a98981de86 Changing the searches.yml ytprovider setting should now properly affect music queueing provider, but will require bot restart, closes #401 2023-02-20 02:12:00 +01:00
Kamal Tufekcic
9ef3646711 Update file config-guide.md 2023-02-13 12:26:21 +00:00
Kamal Tufekcic
9c174b8b6f Update file config-guide.md 2023-02-13 12:24:08 +00:00
Kamal Tufekcic
657c1e461c Update file config-guide.md 2023-02-13 12:01:33 +00:00
Kamal Tufekcic
f5a4a698bd Update file GamesConfig.cs 2023-02-13 11:52:33 +00:00
Kwoth
8112337aaf Merge branch 'hokutochen-v4-patch-25972' into 'v4'
fixed withURL not working

See merge request Kwoth/nadekobot!286
2023-02-12 10:20:22 +00:00
Hokuto Chen
73f7394e31 fixed withURL not working 2023-02-12 09:52:56 +00:00
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
Kwoth
9ffa701742 Updated changelog.md 2022-10-02 15:45:28 +02:00
Kwoth
a4f7df8aee Merge branch 'cmdcd-and-cleanup' into 'v4'
Cmdcd and cleanup

See merge request Kwoth/nadekobot!269
2022-10-02 13:38:51 +00:00
Kwoth
15e6cff14a * Rewrote cmdcd service, prettified and paginated .cmdcds
* Cleaned up/improved some command handler code
* Fixed .yun when channel id has an underscore
2022-10-02 13:38:50 +00:00
Kwoth
e63ac07a52 Fixed typo 2022-10-01 08:54:11 +02:00
Kwoth
a294e3bf8f Fixed -c GlobalNadeko compilation 2022-10-01 08:52:29 +02:00
Kwoth
a5b2fac69c .curtrs may? run a little faster. Uses async, clarified GamblingConfig transactionLifetime field 2022-09-28 07:09:37 +02:00
Kwoth
a8e06a5ae4 Clarified .remind permission requirement 2022-09-26 14:20:26 +02:00
Kwoth
761bdd8610 Merge branch 'hokutochen-v4-patch-16984' into 'v4'
Added VPS hosting requirements

See merge request Kwoth/nadekobot!268
2022-09-24 09:50:20 +00:00
Hokuto Chen
b5904889b0 Added VPS hosting requirements 2022-09-24 09:50:20 +00:00
Kwoth
5b4517cf5c Updated changelog, removed the ability to bet 0 on betdraw 2022-09-23 23:01:11 +02:00
Kwoth
72158c0a2c Added -a / --after <messageid> option to .prune, converted the argument to proper options object 2022-09-17 13:51:03 +02:00
Kwoth
1ca6f6dc5c Added .autopublish command 2022-09-16 21:49:50 +02:00
Kwoth
005fd7b8c6 Possible fix for missing IGuildUser when using guild commands, closes #383 2022-09-15 17:02:53 +02:00
Kwoth
3fc53b0609 Upped version to 4.3.7, updated changelog 2022-09-14 02:46:03 +02:00
Kwoth
62ec2241e4 Added pagination to .reroli 2022-09-14 02:44:31 +02:00
Kwoth
75f8254a8e Removed currencies from units.json as they're pulled from api 2022-09-13 21:50:48 +02:00
Kwoth
f23ffe0c67 Added .shopreq - Shop items can now have a role requirement in order to purchase. Added .shopbuy alias for .buy 2022-09-13 21:33:20 +02:00
Kwoth
d1a818542c Split stream deleter service into a separate file, there will no longer be a viewer count when the stream comes online, as it will (almost?) always show 0 2022-09-12 01:22:58 +02:00
Kwoth
15f67e3a51 more typos 2022-09-11 22:49:46 +02:00
Kwoth
412f346ac8 Fixed some typos in commands.en-US.yml 2022-09-10 22:53:03 +02:00
Kwoth
8107a80c4c Added .exds to complement .exas 2022-09-09 21:02:16 +02:00
Kwoth
f1c7d7437a Upped version to 4.3.6, Updated CHANGELOG.md 2022-09-08 20:41:06 +02:00
Kwoth
9a013db25f Removed some unused usings 2022-09-04 12:19:15 +02:00
Kwoth
6f75161c80 Added .expraddserver (.exas) which will server as a server-only alternative to '.exa' in case users want to override default Admin permissions with .dpo 2022-09-03 17:21:38 +02:00
Kwoth
3f56e5b651 Merge branch 'v4' of https://gitlab.com/kwoth/nadekobot into v4 2022-09-03 10:28:46 +02:00
Kwoth
4875abbe86 Fake joined at for karney on nadeko server 2022-09-03 10:28:38 +02:00
Kwoth
83863f3a6c Update responses.uk-UA.json (POEditor.com) 2022-09-02 12:27:52 +00:00
Kwoth
f07abad1ec Update responses.es-ES.json (POEditor.com) 2022-09-02 12:27:51 +00:00
Kwoth
b6909a4120 Update responses.ru-RU.json (POEditor.com) 2022-09-02 12:27:49 +00:00
Kwoth
aaf7f04216 Update responses.pt-BR.json (POEditor.com) 2022-09-02 12:27:48 +00:00
Kwoth
628871b0da Update responses.pl-PL.json (POEditor.com) 2022-09-02 12:27:47 +00:00
Kwoth
a50ad09c8d Update responses.it-IT.json (POEditor.com) 2022-09-02 12:27:46 +00:00
Kwoth
1358ff50a4 Update responses.id-ID.json (POEditor.com) 2022-09-02 12:27:44 +00:00
Kwoth
ee9fede3b1 Update responses.de-DE.json (POEditor.com) 2022-09-02 12:27:43 +00:00
Kwoth
1d7e9e8471 Update responses.fr-FR.json (POEditor.com) 2022-09-02 12:27:42 +00:00
Kwoth
d2fe7f8d11 Update responses.nl-NL.json (POEditor.com) 2022-09-02 12:27:40 +00:00
Kwoth
75958efe17 Update responses.zh-TW.json (POEditor.com) 2022-09-02 12:27:39 +00:00
Kwoth
7746d2aca1 Update responses.zh-CN.json (POEditor.com) 2022-09-02 12:27:38 +00:00
Kwoth
e631df3326 Update responses.ar.json (POEditor.com) 2022-09-02 12:27:36 +00:00
Kwoth
ba44fdb55f Reminders can now be embeds. But you won't be able to set plaintext 2022-08-31 20:37:58 +02:00
Kwoth
59a1e56dad Added .banprune command which sets how many days worth of messages will be pruned when bot (soft)bans a person either through a command or another punishment feature. Also updated .next usage string. 2022-08-31 17:47:19 +02:00
Kwoth
cd6fe46c2b More user friendly error when parsing of a number fails. 2022-08-31 13:40:41 +02:00
Kwoth
fb4f470b44 Added .qdelauth - Delete all quotes by the specified author on this server. If you target yourself - no permission required 2022-08-30 15:46:10 +02:00
Kwoth
b69e25edf4 Added .timeout command 2022-08-28 16:16:24 +02:00
Kwoth
9eae27bc15 Added an option to award currency based on received xp 2022-08-26 13:41:30 +02:00
Kwoth
bed36f8784 Fixed compilation warning (no functional change) 2022-08-24 17:31:21 +02:00
Kwoth
623f5ccd5e Merge branch 'v4' of https://gitlab.com/kwoth/nadekobot into v4 2022-08-24 09:20:40 +02:00
Kwoth
6da8201c2d Awarded xp is now correctly used in level up calculations, closes #376 2022-08-24 09:18:22 +02:00
Kwoth
d1c24d4721 Merge branch 'hokutochen-v4-patch-63590' into 'v4'
corrected swapped instructions

See merge request Kwoth/nadekobot!266
2022-08-23 01:11:50 +00:00
Hokuto Chen
7e5055268a corrected swapped instructions 2022-08-23 01:11:50 +00:00
Kwoth
e84e33b94f Merge branch 'hokutochen-v4-patch-01854' into 'v4'
Update creds-guide.md

See merge request Kwoth/nadekobot!265
2022-08-21 19:19:40 +00:00
Hokuto Chen
f21c96bdf4 Update creds-guide.md 2022-08-21 10:37:29 +00:00
Kwoth
430daf9b19 Merge branch 'hokutochen-v4-patch-16720' into 'v4'
added auto restart option in docs

See merge request Kwoth/nadekobot!264
2022-08-17 20:16:16 +00:00
Hokuto Chen
948db31384 added auto restart option in docs 2022-08-15 05:47:48 +00:00
279 changed files with 77935 additions and 2286 deletions

View File

@@ -14,8 +14,16 @@ variables:
tests: "NadekoBot.Tests"
LINUX_X64_OUTPUT_DIR: "nadekobot-linux-x64"
LINUX_X64_RELEASE: "$CI_COMMIT_TAG-linux-x64-build.tar"
LINUX_ARM64_OUTPUT_DIR: "nadekobot-linux-arm64"
LINUX_ARM64_RELEASE: "$CI_COMMIT_TAG-linux-arm64-build.tar"
MACOS_X64_OUTPUT_DIR: "nadekobot-osx-x64"
MACOS_X64_RELEASE: "$CI_COMMIT_TAG-osx-x64-build.tar"
MACOS_ARM64_OUTPUT_DIR: "nadekobot-osx-arm64"
MACOS_ARM64_RELEASE: "$CI_COMMIT_TAG-osx-arm64-build.tar"
WIN_X64_OUTPUT_DIR: "nadekobot-windows-x64"
WIN_X64_RELEASE: "$CI_COMMIT_TAG-windows-x64-build.zip"
WIN_ARM64_OUTPUT_DIR: "nadekobot-windows-arm64"
WIN_ARM64_RELEASE: "$CI_COMMIT_TAG-windows-arm64-build.zip"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/NadekoBot-build/${CI_COMMIT_TAG}"
INSTALLER_OUTPUT_DIR: "nadeko-installers/${CI_COMMIT_TAG}"
INSTALLER_FILE_NAME: "nadeko-setup-${CI_COMMIT_TAG}.exe"
@@ -24,11 +32,19 @@ build:
stage: build
script:
- "dotnet publish -c Release -r linux-x64 --self-contained -o $LINUX_X64_OUTPUT_DIR src/NadekoBot/NadekoBot.csproj"
- "dotnet publish -c Release -r linux-arm64 --self-contained -o $LINUX_ARM64_OUTPUT_DIR src/NadekoBot/NadekoBot.csproj"
- "dotnet publish -c Release -r win7-x64 --self-contained -o $WIN_X64_OUTPUT_DIR src/NadekoBot/NadekoBot.csproj"
- "dotnet publish -c Release -r win7-arm64 --self-contained -o $WIN_ARM64_OUTPUT_DIR src/NadekoBot/NadekoBot.csproj"
- "dotnet publish -c Release -r osx-x64 --self-contained -o $MACOS_X64_OUTPUT_DIR src/NadekoBot/NadekoBot.csproj"
- "dotnet publish -c Release -r osx-arm64 --self-contained -o $MACOS_ARM64_OUTPUT_DIR src/NadekoBot/NadekoBot.csproj"
artifacts:
paths:
- "$LINUX_X64_OUTPUT_DIR/"
- "$LINUX_ARM64_OUTPUT_DIR/"
- "$WIN_X64_OUTPUT_DIR/"
- "$WIN_ARM64_OUTPUT_DIR/"
- "$MACOS_X64_OUTPUT_DIR/"
- "$MACOS_ARM64_OUTPUT_DIR/"
upload-builds:
stage: upload-builds
@@ -38,12 +54,23 @@ upload-builds:
script:
- apk add --no-cache curl tar zip
- "tar cvf $LINUX_X64_RELEASE $LINUX_X64_OUTPUT_DIR/*"
- "tar cvf $LINUX_ARM64_RELEASE $LINUX_ARM64_OUTPUT_DIR/*"
- "tar cvf $MACOS_X64_RELEASE $MACOS_X64_OUTPUT_DIR/*"
- "tar cvf $MACOS_ARM64_RELEASE $MACOS_ARM64_OUTPUT_DIR/*"
- "zip -r $WIN_X64_RELEASE $WIN_X64_OUTPUT_DIR/*"
- "zip -r $WIN_ARM64_RELEASE $WIN_ARM64_OUTPUT_DIR/*"
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $LINUX_X64_RELEASE $PACKAGE_REGISTRY_URL/$LINUX_X64_RELEASE
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $LINUX_ARM64_RELEASE $PACKAGE_REGISTRY_URL/$LINUX_ARM64_RELEASE
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $WIN_X64_RELEASE $PACKAGE_REGISTRY_URL/$WIN_X64_RELEASE
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $WIN_ARM64_RELEASE $PACKAGE_REGISTRY_URL/$WIN_ARM64_RELEASE
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $MACOS_X64_RELEASE $PACKAGE_REGISTRY_URL/$MACOS_X64_RELEASE
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $MACOS_ARM64_RELEASE $PACKAGE_REGISTRY_URL/$MACOS_ARM64_RELEASE
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
@@ -53,7 +80,11 @@ release:
- |
release-cli create --name "NadekoBot v$CI_COMMIT_TAG" --description "## [Changelog](https://gitlab.com/Kwoth/nadekobot/-/blob/v4/CHANGELOG.md#$(echo "$CI_COMMIT_TAG" | sed "s/\.//g")-$(date +%d%m%Y))" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"${LINUX_X64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_X64_RELEASE}\"}" \
--assets-link "{\"name\":\"${WIN_X64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WIN_X64_RELEASE}\"}"
--assets-link "{\"name\":\"${LINUX_ARM64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_ARM64_RELEASE}\"}" \
--assets-link "{\"name\":\"${WIN_X64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WIN_X64_RELEASE}\"}" \
--assets-link "{\"name\":\"${WIN_ARM64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WIN_ARM64_RELEASE}\"}" \
--assets-link "{\"name\":\"${MACOS_X64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${MACOS_X64_RELEASE}\"}" \
--assets-link "{\"name\":\"${MACOS_ARM64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${MACOS_ARM64_RELEASE}\"}"
test:
stage: test
@@ -104,7 +135,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,228 @@
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## Unreleased
## [4.3.19] - 20.01.2024
### Added
- Added `followedStreams.maxCount` to `searches.yml` which lets bot owners change the default of 10 per server
### Changed
- Improvements to GPT ChatterBot (thx alexandra)
- Add a personality prompt to tweak the way chatgpt bot behaves
- Added Chat history support to chatgpt ChatterBot
- Chatgpt token usage now correctly calculated
- More chatgpt configs in `games.yml`
## [4.3.18] - 26.12.2023
### Added
- Added `.cacheusers` command (thx Kotz)
- Added `.clubreject` which lets you reject club applications
### Changed
- Updated discord lib, there should be less console errors now
### Fixed
- Fixed `icon_url` when using `.showembed`
- Fixed `.quoteshow` not showing sometimes (thx Cata)
- Notifications will no longer be sent if dms are off when using `.give`
- Users should no longer be able to apply to clubs while in a club already (especially not to the same club they're already in)
### Removed
- `.revimg` and `.revav` as google removed reverse image search
-
## [4.3.17] - 06.09.2023
### Fixed
- Fix to waifu gifts being character limited
- Fixes UserUpdated and UserPresence not correctly ignoring users that are logignored
- Added Trim() to activity names since apparently some activities have trailing spaces.
## [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
### Added
- Added `.autopublish` command which will automatically publish messages posted in the channel.
- Added `--after <messageid>` option to prune which will make prune only delete messages after the specified message id.
### Changed
- `.prune` options `--after` and `--safe` are now proper command options, and will show in .h help
- `.cmdcd` code mostly rewritten, slight QoL improvements.
- Clarified `.remind` permission requirements in help text
- `.cmdcds` looks a little better, and is paginated
### Fixed
- Fixed trivia bugs
- Fixed `.yun` not working with channels with underscore in the name
## [4.3.7] - 14.09.2022
### Added
- Added `.exprdelserv` (.exds) to completement .exas. Deletes an expression on the current server and is susceptible to .dpo, unlike .exd
- Added `.shopreq` which lets you set role requirement for specific shop items
- Added `.shopbuy` alias to `.buy`
### Fixed
- Fixed `.convertlist` showing currencies twice (this may not apply to existing users and it may require you to manually remove all currencies from units.json)
### Removed
- Removed `Viewer` field from stream online notification as it is (almost?) always 0.
## [4.3.6] - 08.09.2022
### Added
- Added `.expraddserver` (.exas) which will server as a server-only alternative to '.exa' in case users want to override default Admin permissions with .dpo
- Added .banprune command which sets how many days worth of messages will be pruned when bot (soft)bans a person either through a command or another punishment feature.
- Added .qdelauth - Delete all quotes by the specified author on this server. If you target yourself - no permission required
- Added `.timeout` command
- Added an option to award currency based on received xp
### Changed
- Reminders now have embed support, but plaintext field is not supported.
- User friendlier errors when parsing a number in a command fails
### Fixed
- Awarded xp is now correctly used in level up calculations
## [4.3.5] - 17.08.2022
@@ -18,7 +239,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
### Changed
- Running a .timely command early now shows a pending color
- .xp system is once again no longer opt in for servers
- .xp system is once again no longer opt in for servers
- It's still opt-in for global and requires users to run .xp at least once in order to start gaining global xp
### Fixed
@@ -42,7 +263,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
### Changed
- Updated position of Username and Club name on the .xp card
- Improved text visibility on the .xp card
- Improved text visibility on the .xp card
### Fixed
@@ -115,7 +336,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
- [dev] No longer using generator and partial methods for commands
### Fixed
- `.slot` will now show correct multipliers if they've been modified
- Fix patron errors showing up even with permissions disabling the command
- Fixed an issue with voice xp breaking xp gain.
@@ -170,14 +391,14 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
### Fixed
- Fixed `.draw` command
- Fixed `.draw` command
## [4.2.10] - 29.06.2022
- Fixed currency generation working only once
## [4.2.9] - 25.06.2022
### Fixed
- Fixed `creds_example.yml` misssing from output directory
@@ -337,7 +558,7 @@ Added `.patron` and `.patronmessage` commands
- `ytdataapi` will use the official google api (requires `GoogleApiKey` specified in `creds.yml`) and YoutubeDataApi enabled in the dev console
- `ytdl` will use `youtube-dl` program from the host machine. It must be downloaded and it's location must be added to path env variable.
- `ytdlp` will use `yt-dlp` program from the host machine. Same as `youtube-dl` - must be in path env variable.
- `invidious` will use one of invidious instances specified in the `invidiousInstances` property. Very good.
- `invidious` will use one of invidious instances specified in the `invidiousInstances` property. Very good.
- `.google`, `.youtube` and `.image` moved to the new Search group
@@ -357,19 +578,19 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- `.feed` urls which error for more than 100 times will be automatically removed.
- `.ve` is now enabled by default
- [dev] nadeko interaction slightly improved to make it less nonsense (they still don't make sense)
- [dev] RewardedUsers table slightly changed to make it more general
- [dev] renamed `// todo`s which aren't planned soon to `// FUTURE`
- [dev] currency rewards have been reimplemented and moved to a separate service
- [dev] nadeko interaction slightly improved to make it less nonsense (they still don't make sense)
- [dev] RewardedUsers table slightly changed to make it more general
- [dev] renamed `// todo`s which aren't planned soon to `// FUTURE`
- [dev] currency rewards have been reimplemented and moved to a separate service
### Fixed
- `.rh` no longer needs quotes for multi word roles
- `.deletexp` will now properly delete server xp too
- Fixed `.crypto` sparklines
- [dev] added support for configs to properly parse enums without case sensitivity (ConfigParsers.InsensitiveEnum)
- [dev] Fixed a bug in .gencmdlist
- [dev] small fixes to creds provider
- [dev] Fixed a bug in .gencmdlist
- [dev] small fixes to creds provider
### Removed
@@ -402,7 +623,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
## [4.1.3] - 06.05.2022
### Added
### Added
- Added support for embed arrays in commands such as .say, .greet, .bye, etc...
- Website to create them is live at eb.nadeko.bot (old one is moved to oldeb.nadeko.bot)
@@ -415,18 +636,18 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Users can deposit, withdraw and check the balance of their currency in the bank.
- Users can't check other user's bank balances.
- Added a button on a .$ command which, when clicked, sends you a message with your bank balance that only you can see.
- Added `.h <command group>`
- Added `.h <command group>`
- Using this command will list all commands in the specified group
- Atm only .bank is a proper group (`.h bank`)
- Added "Bank Accounts" entry to `.economy`
### Changed
- Reaction roles rewritten completely
- Supports multiple exclusivity groups per message
- Reaction roles rewritten completely
- Supports multiple exclusivity groups per message
- Supports level requirements
- However they can only be added one by one
- Use the following commands for more information
- Use the following commands for more information
- `.h .reroa`
- `.h .reroli`
- `.h .rerot`
@@ -457,7 +678,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- To change the db nadeko will use, simply change the `db type` in `creds.yml`
- There is no migration code right now, which means that if you want to switch to another system you'll either have to manually export/import your database or start fresh
- Medusa system
- A massive new feature which allows developers to create custom modules/plugins/cogs
- A massive new feature which allows developers to create custom modules/plugins/cogs
- They can be load/unloaded/updated at runtime without restarting the bot
### Changed
@@ -493,7 +714,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
### Fixed
- Fixed the `id` which shows up when you add a new Expression
- Fixed some strings which were still referring to "CustomReaction(s)" instead of "Expression(s)"
- Fixed some strings which were still referring to "CustomReaction(s)" instead of "Expression(s)"
## [4.0.3] - 04.03.2022
@@ -519,20 +740,20 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
### Added
- Added `.deleteemptyservers` command
- Added `.curtr <id>` which lets you see full information about one of your own transactions with the specified id
- Added trovo.live support for stream notifications (`.stadd`)
- Added trovo.live support for stream notifications (`.stadd`)
- Added unclaimed waifu decay functionality
- Added 3 new settings to `data/gambling.yml` to control it:
- waifu.decay.percent - How much % to subtract from unclaimed waifu
- waifu.decay.hourInterval - How often to decay the price
- waifu.decay.hourInterval - How often to decay the price
- waifu.decay.minPrice - Unclaimed waifus with price lower than the one specified here will not be affected by the decay
- Added `currency.transactionsLifetime` to `data/gambling.yml` Any transaction older than the number of days specified will be automatically deleted
- Added `.stock` command to check stock prices and charts
- Re-added `.qap / .queueautoplay`
- Re-added `.qap / .queueautoplay`
### Changed
- CustomReactions module (and customreactions db table) has been renamed to Expressions.
- This was done to remove confusion about how it relates to discord Reactions (it doesn't, it was created and named before discord reactions existed)
- Expression command now start with ex/expr and end with the name of the action or setting.
- This was done to remove confusion about how it relates to discord Reactions (it doesn't, it was created and named before discord reactions existed)
- Expression command now start with ex/expr and end with the name of the action or setting.
- For example `.exd` (`.dcr`) is expression delete, `.exa` (`.acr`)
- Permissions (`.lp`) be automatically updated with "ACTUALEXPRESSIONS", "EXPRESSIONS" instead of "ACTUALCUSTOMREACTIONS" and "CUSTOMREACTIONS"
- Permissions for `.ecr` (now `.exe`), `.scr` (now `.exs`), `.dcr` (now `.exd`), `.acr` (now `.exa`), `.lcr` (now `.exl`) will be automatically updated
@@ -549,8 +770,8 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- [dev] Added Type, Extra, OtherId fields to the database
- [dev] CommandStrings will now use methodname as the key, and **not** the command name (first entry in aliases.yml)
- In other words aliases.yml and commands.en-US.yml will use the same keys (once again)
- [dev] Reorganized module and submodule folders
- [dev] Permissionv2 db table renamed to Permissions
- [dev] Reorganized module and submodule folders
- [dev] Permissionv2 db table renamed to Permissions
- [dev] Moved FilterWordsChannelId to a separate table
### Fixed
@@ -565,9 +786,9 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Fixed embed color when disabling `.antialt`
### Removed
- Removed `.bce` - use `.config` or `.config bot` specifically for bot config
- Removed obsolete placeholders: %users% %servers% %userfull% %username% %userdiscrim% %useravatar% %id% %uid% %chname% %cid% %sid% %members% %server_time% %shardid% %time% %mention%
- Removed some obsolete commands and strings
- Removed `.bce` - use `.config` or `.config bot` specifically for bot config
- Removed obsolete placeholders: %users% %servers% %userfull% %username% %userdiscrim% %useravatar% %id% %uid% %chname% %cid% %sid% %members% %server_time% %shardid% %time% %mention%
- Removed some obsolete commands and strings
- Removed code which migrated 2.x to v3 credentials, settings, etc...
## [3.0.13] - 14.01.2022
@@ -606,7 +827,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Looks much nicer
- Bot will now reply to user messages with a translation if `del` is disabled
- Bot will make an embed with original and translated text with user avatar and name if `del` is enabled
- If the bot is unable to delete messages while having `del` enabled, it will reset back to the no-del behavior for the current session
- If the bot is unable to delete messages while having `del` enabled, it will reset back to the no-del behavior for the current session
### Fixed
- `.crypto` now supports top 5000 coins
@@ -620,7 +841,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
### Fixed
- `.xprewsreset` now has correct permissions
### Removed
### Removed
- Removed slot.numbers from `images.yml` as they're no longer used
## [3.0.9] - 21.11.2021
@@ -630,7 +851,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
### Added
- Added `.emojiadd` with 3 overloads
- `.ea :customEmoji:` which copies another server's emoji
- `.ea :customEmoji:` which copies another server's emoji
- `.ea newName :customEmoji:` which copies emoji under a different name
- `.ea emojiName <imagelink.png>` which creates a new emoji from the specified image
- Patreon Access and Refresh Tokens should now be automatically updated once a month as long as the user has provided the necessary credentials in creds.yml file:
@@ -644,7 +865,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
## [3.0.8] - 03.11.2021
### Added
### Added
- Created VotesApi project nad re-worked vote rewards handling
- Updated votes entries in creds.yml with explanations on how to set up vote links
@@ -669,10 +890,10 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- They are called negative gifts
- They show up at the end of the `.gifts` page and are marked with a broken heart
- They have a separate multiplier (`waifu.multi.negative_gift_effect` default 0.5, changeable via `.config gambling` or `data/gambling.yml`)
- When gifted, the waifu's price will be reduced by the `price * multiplier`
- When gifted, the waifu's price will be reduced by the `price * multiplier`
- Negative gifts don't show up in `.waifuinfo` nor is the record of them kept in the database
### Fixed
### Fixed
- Fixed `%users%` and `%shard.usercount%` placeholders not showing correct values
## [3.0.6] - 27.09.2021
@@ -713,7 +934,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Possible fix for `.repeat` bug
- Slight adjustment for repeater logic
- Timer should no longer increase on some repeaters
- Repeaters should no longer have periods when they're missing from the list
- Repeaters should no longer have periods when they're missing from the list
- Fixed several commands which used error color for success confirmation messages
## [3.0.3] - 15.09.2021
@@ -774,7 +995,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Explanations on how to get the keys are added as the comments
- Code cleanup
- Command attributes cleaned up
- Removed dummy Remarks and Usages attributes as hey were unused for a few patches but stayed in the code to avoid big git diffsmigration code has ran and it can be safely removed
- Removed dummy Remarks and Usages attributes as hey were unused for a few patches but stayed in the code to avoid big git diffsmigration code has ran and it can be safely removed
- There are 2 projects: NadekoBot and NadekoBot.Coordinator
- You can directly run NadekoBot as the regular bot with one shard
- Run NadekoBot.Coordinator if you want more control over your shards and a grpc api for coordinator with which you can start, restart, kill and see status of shards
@@ -795,7 +1016,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
## [2.46.2] - 14.07.2021
### Fixed
### Fixed
- Fixed .save for local songs
- Fixed .lq for local songs if the song names are too long
@@ -866,7 +1087,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
### Added
- Added `.crsexport` and `.crsimport`
- Added `.crsexport` and `.crsimport`
- Allows for quick export/import of server or global custom reactions
- Requires admin permissions for server crs, and owner for global crs
- Explanation of the fields is in the comment at the top of the `.crsexport` .yml file
@@ -899,7 +1120,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
### Added
- Re-added `%music.playing%` and `%music.queued%` (#290)
- Added `%music.servers%` which shows how many servers have a song queued up to play
- Added `%music.servers%` which shows how many servers have a song queued up to play
^ Only available to `.ropl` / `.adpl` feature atm
- `.autodc` re-added
- `.qrp`, `.vol`, `.smch` `.autodc` will now persist
@@ -919,7 +1140,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Removing last song in the queue will no longer reset queue index
- Having `.rpl` disabled will now correctly stop after the last song, closes #292
### Removed
### Removed
- `.sad` removed. It's more or less useless. Use `.qrp` and `.autodc` now for similar effect
@@ -934,7 +1155,7 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Minor perf improvement for filter checks
### Fixed
### Fixed
- `.qs` result urls are now valid
- Custom reactions with "`-`" as a response should once again disable that custom reaction completely
@@ -950,8 +1171,8 @@ Note: Results of each `.youtube` query will be cached for 1 hour to improve perf
- Much faster starting and skipping once the songs are in the queue
- Higher quality audio (no stuttering too!)
- Local tracks will now have durations if you have ffprobe installed (comes with ffmpeg)
- Bot supports joining a different vc without skipping the song if you use `.j`
- ⚠️ **DO NOT DRAG THE BOT** to another vc, as it's not properly supported atm, and you will have to do `.play` after dragging it)
- Bot supports joining a different vc without skipping the song if you use `.j`
- ⚠️ **DO NOT DRAG THE BOT** to another vc, as it's not properly supported atm, and you will have to do `.play` after dragging it)
- `.j` makes the bot join your voice channel
- `.p` is now alias of play, pause is `.pause`
- `.qs` should work without google api key now for most users as it is using a custom loader

View File

@@ -28,12 +28,11 @@ WORKDIR /app
RUN set -xe; \
useradd -m nadeko; \
apt-get update; \
apt-get install -y --no-install-recommends libopus0 libsodium23 libsqlite3-0 curl ffmpeg python3 python3-pip sudo; \
apt-get install -y --no-install-recommends libopus0 libsodium23 libsqlite3-0 curl ffmpeg python3 sudo; \
update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1; \
echo 'Defaults>nadeko env_keep+="ASPNETCORE_* DOTNET_* NadekoBot_* shard_id total_shards TZ"' > /etc/sudoers.d/nadeko; \
pip3 install --no-cache-dir --upgrade youtube-dl; \
apt-get purge -y python3-pip; \
chmod +x /usr/local/bin/youtube-dl; \
curl -Lo /usr/local/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp; \
chmod a+rx /usr/local/bin/yt-dlp; \
apt-get autoremove -y; \
apt-get autoclean -y

23
docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
version: "3.7"
services:
nadeko:
image: insert-image-name-here:latest
depends_on:
- redis
environment:
TZ: Europe/Paris
NadekoBot_RedisOptions: redis,name=nadeko
#NadekoBot_ShardRunCommand: dotnet
#NadekoBot_ShardRunArguments: /app/NadekoBot.dll {0} {1}
volumes:
- /srv/nadeko/conf:/app/conf:ro
- /srv/nadeko/data:/app/data
redis:
image: redis:4-alpine
sysctls:
- net.core.somaxconn=511
command: redis-server --maxmemory 32M --maxmemory-policy volatile-lru
volumes:
- /srv/nadeko/redis-data:/data

View File

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

View File

@@ -33,17 +33,17 @@ These are required for a number of features to function properly, and all should
For a single owner, it should look like this:
```yml
OwnerIds:
- 105635576866156544
OwnerIds:
- 105635576866156544
```
For multiple owners, it should look like this:
```yml
OwnerIds:
- 105635123466156544
- 145521851676884992
- 341420590009417729
OwnerIds:
- 105635123466156544
- 145521851676884992
- 341420590009417729
```

View File

@@ -1,4 +1,4 @@
# Setting up NadekoBot on Linux
w# Setting up NadekoBot on Linux
| Table of Contents |
| :-------------------------------------------------- |
@@ -15,11 +15,14 @@
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
@@ -160,15 +163,30 @@ If you are presented with the installer main menu, exit it by choosing Option `8
The above command will create a new session named **nadeko** *(you can replace “nadeko” with anything you prefer, it's your session name)*.
2. Navigate to the project's root directory
- Project root directory location example: `cd /home/user/nadekobot/`
3. Enter the `output` directory:
- `cd output`
4. Run the bot using:
- `dotnet NadekoBot.dll`
5. Detatch the tmux session:
2. Run the installer: `bash linuxAIO.sh`
3. There are a few options when it comes to running Nadeko.
- Run `3` to *Run the bot normally*
- Run `4` to *Run the bot with Auto Restart* (This is may or may not work)
4. If option `4` was selected, you have the following options
```
1. Run Auto Restart normally without updating NadekoBot.
2. Run Auto Restart and update NadekoBot.
3. Exit
Choose:
[1] to Run NadekoBot with Auto Restart on "die" command without updating.
[2] to Run with Auto Updating on restart after using "die" command.
```
- Run `1` to update the bot upon restart. (This is done using the `.die` command)
- Run `2` to restart the bot without updating. (This is also done using the `.die` command)
5. That's it! to detatch the tmux session:
- Press `Ctrl` + `B`
- Then press `D`
Now check your Discord server, the bot should be online. Nadeko should now be running in the background of your system.
To re-open the tmux session to either update, restart, or whatever, execute `tmux a -t nadeko`. *(Make sure to replace "nadeko" with your session name. If you didn't change it, leave it as it.)*
@@ -301,6 +319,26 @@ This method is similar to the one above, but requires one extra step, with the a
If you want Nadeko to play music for you 24/7 without having to hosting it on your PC and want to keep it cheap, reliable and convenient as possible, you can try Nadeko on Linux Digital Ocean Droplet using the link [DigitalOcean](http://m.do.co/c/46b4d3d44795/) (by using this link, you will get **$10 credit** and also support Nadeko)
To set up the VPS, please select the options below
```
These are the min requirements you must follow:
OS: Any between Ubuntu, Fedora, and Debian
Plan: Basic
CPU options: regular with SSD
1 GB / 1 CPU
25 GB SSD Disk
1000 GB transfer
Note: You can select the cheapest option with 512 MB /1 CPU but this has been a hit or miss.
Datacenter region: Choose one depending on where you are located.
Authentication: Password or SSH
(Select SSH if you know what you are doing, otherwise choose password)
```
**Setting up NadekoBot**
Assuming you have followed the link above to setup an account and a Droplet with a 64-bit operational system on Digital Ocean and got the `IP address and root password (in your e-mail)` to login, it's time to get started.

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

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

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

@@ -68,12 +68,7 @@ Some features have their own specific placeholders which are noted in that featu
- `%ban.reason%` - Reason for the ban, if provided
- `%ban.duration%` - Duration of the ban in the form Days.Hours:Minutes (6.05:04)
### Bot stats placeholders
- `%servers%` - Server count bot has joined
- `%users%` - Combined user count on servers the bot has joined
### Shard stats placeholders
### Shard stats placeholders
- `%shard.servercount%` - Server count on current shard
- `%shard.usercount%` - Combined user count on current shard
@@ -89,6 +84,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)
![img](https://puu.sh/B7mgI.png)

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

@@ -12,9 +12,12 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Discord.Net.Core" Version="3.103.0" />
<PackageReference Include="Discord.Net.Core" Version="3.104.0" />
<PackageReference Include="Serilog" Version="2.11.0" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
</ItemGroup>
<PropertyGroup Condition=" '$(Version)' == '' ">
<Version>5.0.0</Version>
</PropertyGroup>
</Project>

View File

@@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>
<PropertyGroup>

View File

@@ -3,14 +3,12 @@ using Microsoft.Extensions.DependencyInjection;
using NadekoBot.Common.Configs;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Db;
using NadekoBot.Modules.Administration;
using NadekoBot.Modules.Utility;
using NadekoBot.Services.Database.Models;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Net;
using System.Reflection;
using Nadeko.Common;
using RunMode = Discord.Commands.RunMode;
namespace NadekoBot;
@@ -71,7 +69,7 @@ public sealed class Bot
: GatewayIntents.AllUnprivileged,
LogGatewayIntentWarnings = false,
FormatUsersInBidirectionalUnicode = false,
DefaultRetryMode = RetryMode.AlwaysRetry ^ RetryMode.RetryRatelimit
DefaultRetryMode = RetryMode.Retry502
});
_commandService = new(new()
@@ -118,10 +116,6 @@ public sealed class Bot
// cache
.AddCache(_creds);
// admin
#if GLOBAL_NADEKO
svcs.AddSingleton<ILogCommandService, DummyLogCommandService>();
#endif
svcs.AddHttpClient();
svcs.AddHttpClient("memelist")
@@ -319,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

@@ -38,19 +38,19 @@ public sealed class NadekoInteraction
await msg.ModifyAsync(m => m.Components = new ComponentBuilder().Build());
}
private async Task OnInteraction(SocketInteraction arg)
private Task OnInteraction(SocketInteraction arg)
{
if (arg is not SocketMessageComponent smc)
return;
return Task.CompletedTask;
if (smc.Message.Id != message.Id)
return;
return Task.CompletedTask;
if (_onlyAuthor && smc.User.Id != _authorId)
return;
return Task.CompletedTask;
if (smc.Data.CustomId != _button.CustomId)
return;
return Task.CompletedTask;
_ = Task.Run(async () =>
{
@@ -64,6 +64,8 @@ public sealed class NadekoInteraction
await smc.DeferAsync();
}
});
return Task.CompletedTask;
}

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

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

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
#nullable disable
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace NadekoBot;
@@ -8,6 +9,7 @@ public class SmartTextEmbedAuthor
public string Name { get; set; }
[JsonProperty("icon_url")]
[JsonPropertyName("icon_url")]
public string IconUrl { get; set; }
public string Url { get; set; }

View File

@@ -1,5 +1,6 @@
#nullable disable
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace NadekoBot;
@@ -8,5 +9,6 @@ public class SmartTextEmbedFooter
public string Text { get; set; }
[JsonProperty("icon_url")]
[JsonPropertyName("icon_url")]
public string IconUrl { get; set; }
}

View File

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

View File

@@ -0,0 +1,33 @@
namespace NadekoBot.Common.TypeReaders;
public sealed class GuildUserTypeReader : NadekoTypeReader<IGuildUser>
{
public override async ValueTask<TypeReaderResult<IGuildUser>> ReadAsync(ICommandContext ctx, string input)
{
if (ctx.Guild is null)
return TypeReaderResult.FromError<IGuildUser>(CommandError.Unsuccessful, "Must be in a guild.");
input = input.Trim();
IGuildUser? user = null;
if (MentionUtils.TryParseUser(input, out var id))
user = await ctx.Guild.GetUserAsync(id, CacheMode.AllowDownload);
if (ulong.TryParse(input, out id))
user = await ctx.Guild.GetUserAsync(id, CacheMode.AllowDownload);
if (user is null)
{
var users = await ctx.Guild.GetUsersAsync(CacheMode.CacheOnly);
user = users.FirstOrDefault(x => x.Username == input)
?? users.FirstOrDefault(x =>
string.Equals(x.ToString(), input, StringComparison.InvariantCultureIgnoreCase))
?? users.FirstOrDefault(x =>
string.Equals(x.Username, input, StringComparison.InvariantCultureIgnoreCase));
}
if (user is null)
return TypeReaderResult.FromError<IGuildUser>(CommandError.ObjectNotFound, "User not found.");
return TypeReaderResult.FromSuccess(user);
}
}

View File

@@ -1,4 +1,5 @@
#nullable disable
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database.Models;
@@ -6,12 +7,14 @@ namespace NadekoBot.Db;
public static class CurrencyTransactionExtensions
{
public static List<CurrencyTransaction> GetPageFor(this DbSet<CurrencyTransaction> set, ulong userId, int page)
=> set.AsQueryable()
.AsNoTracking()
.Where(x => x.UserId == userId)
.OrderByDescending(x => x.DateAdded)
.Skip(15 * page)
.Take(15)
.ToList();
public static Task<List<CurrencyTransaction>> GetPageFor(
this DbSet<CurrencyTransaction> set,
ulong userId,
int page)
=> set.ToLinqToDBTable()
.Where(x => x.UserId == userId)
.OrderByDescending(x => x.DateAdded)
.Skip(15 * page)
.Take(15)
.ToListAsyncLinqToDB();
}

View File

@@ -4,11 +4,60 @@ using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Db.Models;
using NadekoBot.Services.Database;
using System.Collections.Immutable;
namespace NadekoBot.Db;
public static class DiscordUserExtensions
{
/// <summary>
/// Adds the specified <paramref name="users"/> to the database. If a database user with placeholder name
/// and discriminator is present in <paramref name="users"/>, their name and discriminator get updated accordingly.
/// </summary>
/// <param name="ctx">This database context.</param>
/// <param name="users">The users to add or update in the database.</param>
/// <returns>A tuple with the amount of new users added and old users updated.</returns>
public static async Task<(long UsersAdded, long UsersUpdated)> RefreshUsersAsync(this NadekoContext ctx, List<IUser> users)
{
var presentDbUsers = await ctx.DiscordUser
.Select(x => new { x.UserId, x.Username, x.Discriminator })
.Where(x => users.Select(y => y.Id).Contains(x.UserId))
.ToArrayAsyncEF();
var usersToAdd = users
.Where(x => !presentDbUsers.Select(x => x.UserId).Contains(x.Id))
.Select(x => new DiscordUser()
{
UserId = x.Id,
AvatarId = x.AvatarId,
Username = x.Username,
Discriminator = x.Discriminator
});
var added = (await ctx.BulkCopyAsync(usersToAdd)).RowsCopied;
var toUpdateUserIds = presentDbUsers
.Where(x => x.Username == "Unknown" && x.Discriminator == "????")
.Select(x => x.UserId)
.ToArray();
foreach (var user in users.Where(x => toUpdateUserIds.Contains(x.Id)))
{
await ctx.DiscordUser
.Where(x => x.UserId == user.Id)
.UpdateAsync(x => new DiscordUser()
{
Username = user.Username,
Discriminator = user.Discriminator,
// .award tends to set AvatarId and DateAdded to NULL, so account for that.
AvatarId = user.AvatarId,
DateAdded = x.DateAdded ?? DateTime.UtcNow
});
}
return (added, toUpdateUserIds.Length);
}
public static Task<DiscordUser> GetByUserIdAsync(
this IQueryable<DiscordUser> set,
ulong userId)

View File

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

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

@@ -0,0 +1,9 @@
using NadekoBot.Services.Database.Models;
namespace NadekoBot.Db.Models;
public class AutoPublishChannel : DbEntity
{
public ulong GuildId { get; set; }
public ulong ChannelId { get; set; }
}

View File

@@ -5,4 +5,5 @@ public class BanTemplate : DbEntity
{
public ulong GuildId { get; set; }
public string Text { get; set; }
public int? PruneDays { get; set; }
}

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

@@ -24,6 +24,7 @@ public class ShopEntry : DbEntity, IIndexed
//list
public HashSet<ShopEntryItem> Items { get; set; } = new();
public ulong? RoleRequirement { get; set; }
}
public class ShopEntryItem : DbEntity

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

@@ -330,6 +330,10 @@ public abstract class NadekoContext : DbContext
#region BanTemplate
modelBuilder.Entity<BanTemplate>().HasIndex(x => x.GuildId).IsUnique();
modelBuilder.Entity<BanTemplate>()
.Property(x => x.PruneDays)
.HasDefaultValue(null)
.IsRequired(false);
#endregion
@@ -460,6 +464,22 @@ public abstract class NadekoContext : DbContext
});
#endregion
#region AutoPublish
modelBuilder.Entity<AutoPublishChannel>(apc => apc
.HasIndex(x => x.GuildId)
.IsUnique());
#endregion
#region GamblingStats
modelBuilder.Entity<GamblingStats>(gs => gs
.HasIndex(x => x.Feature)
.IsUnique());
#endregion
}
#if DEBUG

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.Mysql
{
public partial class banprune : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "prunedays",
table: "bantemplates",
type: "int",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "prunedays",
table: "bantemplates");
}
}
}

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.Mysql
{
public partial class shoprolereq : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<ulong>(
name: "rolerequirement",
table: "shopentry",
type: "bigint unsigned",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "rolerequirement",
table: "shopentry");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations.Mysql
{
public partial class autopub : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "autopublishchannel",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
guildid = table.Column<ulong>(type: "bigint unsigned", nullable: false),
channelid = table.Column<ulong>(type: "bigint unsigned", nullable: false),
dateadded = table.Column<DateTime>(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_autopublishchannel", x => x.id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "ix_autopublishchannel_guildid",
table: "autopublishchannel",
column: "guildid",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "autopublishchannel");
}
}
}

File diff suppressed because it is too large Load Diff

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

@@ -19,6 +19,35 @@ namespace NadekoBot.Migrations.Mysql
.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")
@@ -675,6 +704,10 @@ namespace NadekoBot.Migrations.Mysql
.HasColumnType("bigint unsigned")
.HasColumnName("guildid");
b.Property<int?>("PruneDays")
.HasColumnType("int")
.HasColumnName("prunedays");
b.Property<string>("Text")
.HasColumnType("longtext")
.HasColumnName("text");
@@ -942,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)")
@@ -1068,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")
@@ -1192,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");
@@ -1448,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");
@@ -2232,6 +2314,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");

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