# Changelog

Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o

## \[4.3.22] - 25.04.2024

### Added

* Added `.setbanner` command (thx cata)

### Fixed

* Fixed pagination error due to a missing emoji

## \[4.3.21] - 19.04.2024

### Fixed

* Possible fix for a duplicate in `.h bank`
* Fixed `.stock` command
* Fixed `.clubapply` and `.clubaccept`
* Removed some redundant discriminators

## \[4.3.20] - 22.01.2024

### Fixed

* Fixed `.config searches followedStreams.maxCount` not working

## \[4.3.19] - 22.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] - 28.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] - 07.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] - 27.05.2023

### Fixed

* Fixed missing events from `.logevents`
* Fixed `.log` thread deleted and thread created events not working properly

## \[4.3.15] - 24.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 allowing 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 loading 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

### Added

* Added a 'Use' button when a user already owns an item
* Added a 'Pull Again' button to slots
* Added `.roleinfo` command
* Added `.emojiremove` command
* Added `.threadcreate` and `.threaddelete` commands
* Added `.bank seize` / `.bank award` owner only commands

### Changed

* Running a .timely command early now shows a pending color
* .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

* Fixed users not getting club xp

## \[4.3.4] - 07.08.2022

### Fixed

* Fixed users getting XP out of nowhere while voice xp is enabled

## \[4.3.3] - 06.08.2022

### Added

* Added `betroll` option to `.bettest` command
* Added `.xpshopbuy` and `.xpshopuse` convenience commands
* Added an optional preview url to teh xp shop item config model which will be shown instead of the real Url

### Changed

* Updated position of Username and Club name on the .xp card
* Improved text visibility on the .xp card

### Fixed

* Possibly fixed .trivia not stopping bug
* Fixed very low payout rate on `.betroll`
* Fixed an issue with youtube song resolver which caused invalid data to be cached
* Added client id to the cache key as a potential fix for VoiceXp 'bug'. The solution may be to use different redis instances for each bot, or to switch from botCache: from 'redis' to 'memory' in creds.yml
* Bot owner should now be able to buy items from the xpshop when patron requirement is set
* Fixed youtube-dl caching invalid data. Please use yt-dlp instead

## \[4.3.2] - 28.07.2022

### Fixed

* Fixed Reaction Roles not working properly with animated emojis
* Fixed `.slot` alignment
* Fixed `mysql` and `postgresql` reactionrole migration
* Fixed repeat loop with `postgresql` db provider
* Fixed `.bank withdraw <expression>` will now correctly use bank amount for calculation
* \[dev] Fixed medusa Reply\*LocalizedAsync not working with placeholders

## \[4.3.1] - 27.07.2022

### Changed

* Check for updates will run once per hour as it was supposed to

## \[4.3.0] - 27.07.2022

### Added

* Added `.bettest` command which lets you test many gambling commands
  * Better than .slottest
  * Counts win/loss streaks too
  * Doesn't count 1x returns as neither wins nor losses
  * multipliers < 1 are considered losses, > 1 considered wins
* Added `.betdraw` command which lets you guess red/black and/or high/low for a random card
  * They payouts are very good, but seven always loses
* Added `.lula` command. Plays the same as `.wof` but looks much nicer, and is easily customizable from gambling.yml without any changes to the sourcecode needed.
* Added `.repeatskip` command which makes the next repeat trigger not post anything
* Added `.linkonly` which will make the bot only allow link posts in the channel. Exclusive with `.imageonly`
* Added release notifications. Bot owners will now receive new release notifications in dms if they have `checkForUpdates` set to `true` in data/bot.yml
  * You can also configure it via \`.conf bot checkfor
  * updates \<true/false>\`
* Added `.xpshop` which lets bot owners add xp backgrounds and xp frames for sale by configuring `data/xp.yml`
  * You can also toggle xpshop feature via `.conf xp shop.is_enabled`

### Changed

* `.t` Trivia code cleaned up, added ALL pokemon generations
* `.xpadd` will now work on roles too. It will add the specified xp to each user (visible to the bot) in the role
* Improved / cleaned up / modernized how most gambling commands look
  * `.roll`
  * `.rolluo`
  * `.draw`
  * `.flip`
  * `.slot`
  * `.betroll`
  * `.betflip`
  * Try them out!
* `.draw`, `.betdraw` and some other card commands (not all) will use the new, rewritten deck system
* Error will be printed to the console if there's a problem in `.plant`
* \[dev] Split Wiz.Common into a separate project
  * \[dev] It will contain classes/utilities which can be shared across different WizBot related projects
* \[dev] Split Wiz.Econ into a separate project
  * \[dev] It should be home for the backend any gambling/currency/economy feature
  * \[dev] It will contain most gambling games and any shared logic
* \[dev] Compliation should take less time and RAM
  * \[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.

### Removed

* Removed `.slottest`, replaced by `.bettest`
* Removed `.wof`, replaced by `.lula`
* \[dev] Removed a lot of unused methods
* \[dev] Removed several unused response strings

## \[4.2.15] - 12.07.2022

### Fixed

* Fixed `.nh*ntai` nsfw command
* Xp Freezes may have been fixed
* `data/images.yml` should once again support local file paths
* Fixed multiword aliases

## \[4.2.14] - 03.07.2022

### Added

* Added `.log userwarned` (Logging user warnings)
* Claiming `.timely` will now show a button which you can click to set a reminder
* Added `%server.icon%` placeholder
* Added `warn` punishment action for protection commands (it won't work with `.warnp`)

### Changed

* `.log userbanned` will now have a ban reason
* When `.die` is used, bot will try to update it's status to `Invisible`

### Fixed

* Fixed elipsis character issue with aliases/quotes. You should now be able to set an elipsis to be an alias of `.quoteprint`

## \[4.2.13] - 30.06.2022

### Fixed

* Fixed `.cash` bank interaction not being ephemeral anymore

## \[4.2.12] - 30.06.2022

### Fixed

* Fixed `.trivia --pokemon` showing incorrect pokemons

## \[4.2.11] - 29.06.2022

### Fixed

* 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

## \[4.2.8] - 24.06.2022

### Fixed

* `.timely` should be fixed

## \[4.2.7] - 24.06.2022

### Changed

* New cache abstraction added
  * 2 implemenations: redis and memory
  * All current bots will stay on redis cache, all new bots will use **in-process memory cache by default**
  * This change removes bot's hard dependency on redis
  * Configurable in `creds.yml` (please read the comments)
  * You **MUST** use 'redis' if your bot runs on more than 1 shard (2000+ servers)
* \[dev] Using new non-locking ConcurrentDictionary

### Fixed

* `.xp` will now show default user avatars too

### Removed

* Removed `.imagesreload` as images are now lazily loaded on request and then cached

## \[4.2.6] - 22.06.2022

### Fixed

* Patron system should now properly by disabled on selfhosts by default.

## \[4.2.5] - 18.06.2022

### Fixed

* Fixed `.crypto`, you will still need coinmarketcapApiKey in `creds.yml` in order to make it run consistently as the key is shared

## \[4.2.3] - 17.06.2022

### Fixed

* Fixed `.timely` nullref bug and made it nicer
* Fixed `.streamrole` not updating in real time!
* Disabling specific Global Expressions should now work with `.sc` (and other permission commands)

## \[4.2.2] - 15.06.2022

### Fixed

* Added missing Patron Tiers and fixed Patron pledge update bugs
* Prevented creds\_example.yml error in docker containers from crashing it

### Changed

* Rss feeds will now show error counter before deletion

## \[4.2.1] - 14.06.2022

### Added

* Localized strings updated

### Fixed

* Fixed `.exexport`, `.savechat`, and `.quoteexport`
* Fixed plaintext-only embeds
* Fixed greet message footer not showing origin server

## \[4.2.0] - 14.06.2022

### Added

* Added `data/searches.yml` file which configures some of the new search functionality The file comments explaining what each property does. Explained briefly here:

  ```yml
  # what will be used for .google command. Either google (official api) or searx
  webSearchEngine: Google
  # what will be used for .img command. Either google (official api) or searx
  imgSearchEngine: Google
  # how will yt results be retrieved: ytdataapi or ytdl or ytdlp
  ytProvider: YtDataApiv3
  # in case web or img search is set to searx, the following instances will be used:
  searxInstances: []
  # in case ytProvider is set to invidious, the following instances will be used
  invidiousInstances: []
  ```
* Added new properties to `creds.yml`. google -> searchId and google -> searchImageId.
* These properties are used as `cx` (google api query parameter) in case you've setup your `data/searches.yml` to use the official google api. `searchId` is used for web search `searchimageId` is used for image search

  ```yml
  google:
      searchId: ""
      searchImageId: ""
  ```
* Check `creds_example.yml` for comments explaining how to obtain them.

#### Patronage system added

* Added `data/patron.yml` for configuration
* Implemented only for patreon so far
* Patreon subscription code completely rewritten
* Users who pledge on patreon get benefits based on the amount they pledged
* Public wizbot only. But selfhosters can adapt it to their own patreon pages by configuring their patreon credentials in `creds.yml` and enabling the system in `data/patron.yml` file.
  * Most of the patronage system strings are hardcoded atm, so if you wish to use this system on selfhosts, you will have to modify the source
* Pledge amounts are split into tiers. This is not configurable atm.
  * Tier I - 1$ - 4.99$ a month
  * Tier V - 5$ - 9.99$ a month
  * Tier X - 10$ - 19.99$ a month
  * Tier XX - 20$ - 49.99$ a month
  * Tier L - 50$ - 99.99$ a month
  * Tier C - 100$+ a month
* Rewards and command quotas for each of the tiers are configurable
* Limitations to certain features are also configurable. ex:

```yml
quotas:
    features:
        "rero:max_count":
            x: 50
```

* ^ this setting would set the maximum number of reaction roles to be 50 for a user who is in Patron Tier X
* Read the comments in the .yml file for (much) more info
* Quota system allows the owner to set up hourly, daily and monthly quota usage for each tier
* Quota system applies to entire server owner by a patron
  * Patron spends own quota by using the commands on any server
  * Any user on *any* server owned by a patron spends that patron's quota
* When users subscribe to patreon they will receive a welcome message
  * If you're enabling patron system for a selfhost, you will want to edit it

Added `.patron` and `.patronmessage` commands

* `.patron` checks your patronage status, and quotas. Requires patron system to be enabled.
* `.patronmessage` (owner only) sends message to all patrons with the specified tier or higher. Supports embeds
* Added a fake `.cmdcd` command `cleverbot:response` which can be used to limit how often users can talk to the cleverbot.

### Changed

* CurrencyReward now support adding additional flowers to patrons.
* `.donate` command completely reworked.
  * Works only on public bot (OnlyPublicBotAttribute)
  * Guides user on how to donate to support the project
  * Added interaction explaining selfhosting
* `.google` reimplemented. It now has 2 modes configurable in `data/searches.yml` under the `webSearchengine` property
  * If set to `google`, official custom search api will be used. You will need to set googleapikey and google.searchId in `creds.yml`
  * if set to `searx` one of the instances specified in the `searxInstances:` property will be randomly chosen for each request
    * instances must have `format=json` allowed (public ones usually don't allow it)
    * instances are specified as a fully qualified url, example: `https://my.cool.searx.instance.io`
* `.image` reimplemented. Same as `.google` - it uses either `google` official api (in which case it uses `google.searchImageId` from `creds.yml`) or `searx`
* `.youtube` reimplemented. It will use a `ytProvider:` property from `data/searches.yml` to determine how to retrieve results
  * `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.
* `.google`, `.youtube` and `.image` moved to the new Search group

Note: Results of each `.youtube` query will be cached for 1 hour to improve perfomance

* Removed 30 second `.ping` ratelimit on public wizbot
* xp image generation changes
  * In case you have default settings, your xp image will look slightly different
  * If you've modified xp\_template.json, your xp image might look broken. Your old template will be saved in xp\_template.json.old
  * Xp number outline is now slightly thicker
  * Xp number will now have Center vertical and horizontal alignment
  * LastLevelUp no longer supported
* Some commands will now use timestamp tags for better user experience
* `.prune` was slightly slowed down to avoid ratelimits
* `.wof` moved from it's own group to the default Gambling group
* `.feed` urls which error for more than 100 times will be automatically removed.
* `.ve` is now enabled by default
* \[dev] wizbot 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

### Removed

* `.ddg` removed.
* \[dev] removed some dead code and comments

## \[4.1.6] - 14.05.2022

### Fixed

* Fixed windows release and updated packages

## \[4.1.5] - 11.05.2022

### Changed

* `.clubdesc <msg>` will now have a nicer response

### Fixed

* `.give` DM will once again show an amount
* Fixed an issue with filters not working and with custom reactions no longer being able to override commands.
* Fixed `.stock` command

## \[4.1.4] - 06.05.2022

### Fixed

* Fixed `.yun`

## \[4.1.3] - 06.05.2022

### Added

* Added support for embed arrays in commands such as .say, .greet, .bye, etc...
  * Website to create them is live at wizbot.cc/embedbuilder (old one is moved to wizbot.cc/old-embedbuilder)
  * Embed arrays don't have a plainText property (it's renamed to 'content')
  * Embed arrays use color hex values instead of an integer
  * Old embed format will still work
  * There shouldn't be any breaking changes
* Added `.stondel` command which, when toggled, will make the bot delete online stream messages on the server when the stream goes offline
* Added a simple bank system.
  * 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>`
  * 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
  * Supports level requirements
  * However they can only be added one by one
  * Use the following commands for more information
    * `.h .reroa`
    * `.h .reroli`
    * `.h .rerot`
    * `.h .rerorm`
    * `.h .rerodela`
* Pagination is now using buttons instead of reactions
* Bot will now support much higher XP values for global and server levels
* \[dev] Small change and generation perf improvement for the localized response strings

### Fixed

* Fixed `.deletexp` command
* `.give` command should send DMs again
* `.modules` command now has a medusa module description

## \[4.1.2] - 18.04.2022

### Fixed

* Fixed an issue with missing `.dll` files in release versions

## \[4.1.0] - 18.04.2022

### Added

* WizBot now supports mysql, postgresql and sqlite
  * To change the db wizbot 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
    * They can be load/unloaded/updated at runtime without restarting the bot

### Changed

* Minor club rework
  * Clubs names are now case sensitive (owo and OwO can be 2 different clubs)
  * Removed discriminators
    * Current discriminators which are greater than 1 are appended to clubnames to avoid duplicates, you can rename your club with `.clubrename` to remove it
    * Most of the clubs with #1 discriminator no longer have it (For example MyClub#1 will now just be MyClub)
* \[dev] A lot of refactoring and slight functionality changes within WizBot's behavior system and command handler which were required in order to support the medusa system

### Removed

* Removed `.clublevelreq` command as it doesn't serve much purpose

## \[4.0.6] - 21.03.2022

### Fixed

* Fixed voice presence logging
* Fixed .clubaccept, .clubban, .clubkick and .clubunban commands

## \[4.0.5] - 21.03.2022

### Fixed

* Fixed several bugs in the currency code
* Fixed some potential memory leaks
* Fixed some response strings

## \[4.0.4] - 04.03.2022

### 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)"

## \[4.0.3] - 04.03.2022

### Fixed

* Console should no longer spam numbers when `.antispam` is enabled

## \[4.0.2] - 03.03.2022

### Fixed

* Fixed `.rero` not working due to a bug introduced in 4.0

## \[4.0.1] - 03.03.2022

### Added

* Added `usePrivilegedIntents` to creds.yml if you don't have or don't want (?) to use them
* Added a human-readable, detailed error message if logging in fails due to missing privileged intents

## \[4.0.0] - 02.03.2022

### 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 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.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`

### 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.
  * 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
  * If you have custom permissions for other CustomReaction commands
  * Some of the old aliases like `.acr` `.dcr` `.lcr` and a few others have been kept
* Currency output format improvement (will use guild locale now for some commands)
* `.crypto` will now also show CoinMarketCap rank
* Waifus can now be claimed for much higher prices (int -> long)
* Several strings and commands related to music have been changed
  * Changed `.ms / .movesong` to `.tm / .trackmove` but kept old aliases
  * Changed ~~song~~ -> `track` throughout music module strings
* Improved .curtrs (It will now have a lot more useful data in the database, show Tx ids, and be partially localized)
  * \[dev] Reason renamed to Note
  * \[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] Moved FilterWordsChannelId to a separate table

### Fixed

* Fixed twitch stream notifications (rewrote it to use the new api)
* Fixed an extra whitespace in usage part of command help if the command has no arguments
* Possible small fix for `.prune` ratelimiting
* `.gvc` should now properly trigger when a user is already in a gvc and changes his activity
* `.gvc` should now properly detect multiple activities
* Fixed reference to non-existent command in bot.yml
* Comment indentation in .yml files should now make more sense
* Fixed `.warn` punishments not being applied properly when using weighted warnings
* 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 code which migrated 2.x to v3 credentials, settings, etc...

## \[3.0.13] - 14.01.2022

### Fixed

* Fixed `.greetdm` causing ratelimits during raids
* Fixed `.gelbooru`

## \[3.0.12] - 06.01.2022

### Fixed

* `.smch` Fixed
* `.trans` command will now work properly with capitilized language names
* Ban message color with plain text fixed
* Fixed some grpc coordinator bugs
* Fixed a string in `.xpex`
* Google version of .img will now have safe search enabled
* Fixed a small bug in `.hangman`

## \[3.0.11] - 17.12.2021

### Added

* `.remindl` and `.remindrm` commands now supports optional 'server' parameter for Administrators which allows them to delete any reminder created on the server
* Added slots.currencyFontColor to gambling.yml
* Added `.qexport` and `.qimport` commands which allow you to export and import quotes just like `.crsexport`
* Added `.showembed <msgid>` and `.showembed #channel <msgid>` which will show you embed json from the specified message

### Changed

* `.at` and `.atl` commands reworked
  * Persist restarts
  * Will now only translate non-commands
  * You can switch between `.at del` and `.at` without clearing the user language registrations
  * Disabling `.at` will clear all user language registrations on that channel
  * Users can't register languages if the `.at` is not enabled
  * 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

### Fixed

* `.crypto` now supports top 5000 coins

## \[3.0.10] - 01.12.2021

### Changed

* `.warn` now supports weighted warnings
* `.warnlog` will now show current amount and total amount of warnings

### Fixed

* `.xprewsreset` now has correct permissions

### Removed

* Removed slot.numbers from `images.yml` as they're no longer used

## \[3.0.9] - 21.11.2021

### Changed

* `.ea` will now use an image attachments if you omit imageUrl

### Added

* Added `.emojiadd` with 3 overloads
  * `.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:
  * `Patreon.ClientId`
  * `Patreon.RefreshToken` (will also get updated once a month but needs an initial value)
  * `Patreon.ClientSecret`
  * `Patreon.CampaignId`

### Fixed

* Fixed an error that would show up in the console when a club image couldn't be drawn in certain circumstances

## \[3.0.8] - 03.11.2021

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

### Fixed

* Fixed adding currency to users who don't exist in the database
* Memory used by the bot is now correct (thanks to kotz)
* Ban/kick will no longer fail due to too long reasons
* Fixed some fields not preserving inline after string replacements

### Changed

* `images.json` moved to `images.yml`
  * Links will use the new cdn url
  * Heads and Tails images will be updated if you haven't changed them already
* `.slot` redesigned (and updated entries in `images.yml`)
* Reduced required permissions for .qdel (thanks to tbodt)

## \[3.0.7] - 05.10.2021

### Added

* `.streamsclear` re-added. It will remove all followed streams on the server.
* `.gifts` now have 3 new ✂️ Haircut 🧻 ToiletPaper and 🥀 WiltedRose which **reduce** waifu's value
  * 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`
  * Negative gifts don't show up in `.waifuinfo` nor is the record of them kept in the database

### Fixed

* Fixed `%users%` and `%shard.usercount%` placeholders not showing correct values

## \[3.0.6] - 27.09.2021

### Added

* .logignore now supports ignoring users and channels. Use without parameters to see the ignore list

### Changed

* Hangman rewrite
  * Hangman categories are now held in separate .yml files in data/hangman/XYZ.yml where XYZ is the category name

### Fixed

* Fixed an exception which caused repeater queue to break
* Fixed url field not working in embeds

## \[3.0.5] - 20.09.2021

### Fixed

* Fixed images not automatically reloading on startup if the keys don't exist
* Fixed `.logserver` - it should no longer throw an exception if you had no logsettings previously

## \[3.0.4] - 16.09.2021

### Added

* Fully translated to Brazilian Portuguese 🎉
* Added `%server.boosters%` and `%server.boost_level%` placeholders
* Added `DmHelpTextKeywords` to `data/bot.yml`
  * Bot now sends dm help text ONLY if the message contains one of the keywords specified
  * If no keywords are specified, bot will reply to every DM (like before)

### Fixed

* 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
* Fixed several commands which used error color for success confirmation messages

## \[3.0.3] - 15.09.2021

### Added

* Added `.massban` to ban multiple people at once. 30 second cooldown
* Added `.youtubeuploadnotif` / `.yun` as a shortcut for subscribing to a youtube channel's rss feed
* Added `.imageonlychannel` / `.imageonly` to prevent users from posting anything but images in the channel
* Added `.config games hangman.currency_reward` and a property with the same name in games.yml
  * If set, users will gain the specified amount of currency for each hangman win
* Fully translated to Spanish, Russian and Ukrainian 🎉

### Changed

* Ban `.warnp` will now prune user's messages

### Fixed

* `.boostmsg` will now properly show boost, and not greet message

## \[3.0.2] - 12.09.2021

### Added

* `.rero` now optionally takes a message id to which to attach the reaction roles
* Fully translated to German 🎉
* Added `.boost`, `.boostmsg` and `.boostdel` commands which allow you to have customizable messages when someone boosts your server, with auto-deletion support

### Changed

* Updated `.greetmsg` and `.byemsg` command help to match the new `.boost` command help
* Updated response embed colors in greet commands
  * Success -> green
  * Warning or Disable -> yellow.

### Fixed

* `.timely` will now correctly use `Ok` color
* Fixed `.log` commands

### Removed

* Removed `.novel` command as it no longer works

## \[3.0.1] - 10.09.2021

### Fixed

* Fixed some issues with the embeds not showing the correct data

## \[3.0.0] - 06.09.2021

### Changed

* Renamed `credentials.json` to `creds.yml` (example in `creds_example.yml`)
  * Most of the credentials from 2.x will be automatically migrated
  * 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
  * There are 2 projects: WizBot and WizBot.Coordinator
    * You can directly run WizBot as the regular bot with one shard
    * Run WizBot.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
  * Small performance improvements
  * Db Migrations squashed
  * A lot of cleanup all around
* Many guides reworked
  * Guides now instruct users to set build output to wizbot/output instead of running from wizbot/src/WizBot

### Fixed

* Fixed many response strings which were formatted or used incorrectly

### Removed

* Removed All database migrations and data (json file) migrations
  * As updating to the latest 2.x version before switching over to v3 is mandated (or fresh v3 install), that means all

## \[2.46.2] - 14.07.2021

### Fixed

* Fixed .save for local songs
* Fixed .lq for local songs if the song names are too long
* Fixed hierarchy check for .warnpunish with role argument

## \[2.46.1] - 21.06.2021

### Fixed

* Fixed some response strings (thx Ala)
* Fixed repeaters having 5 global limit, instead of 5 server limit (thx cata)

## \[2.46.0] - 17.06.2021

### Added

* Added some nsfw commands

### Changed

* `.aar` reworked. Now supports multiple roles, up to 3.
  * Toggle roles that are added to newly joined users with `.aar RoleName`
  * Use `.aar` to list roles which will be added
  * Roles which are deleted are automatically cleaned up from `.aar`
* `.inrole` now also shows user ids
* Blacklist commands (owner only) `.ubl` `.sbl` and `.cbl` will now list blacklisted items when no argument (or a page number) is provided
* `.cmdcd` now works with customreactions too
* `.xprr` usage changed. It now takes add/rm parameter to add/remove a role ex. You can only take or remove a single role, adding and removing a role at the same level doesn't work (yet?)
  * example: `.xprr 5 add Member` or `.xprr 1 rm Newbie`

## \[2.45.2] - 14.06.2021

### Added

* Added `.duckduckgo / .ddg` search

### Changed

* `.invlist` shows expire time and is slightly prettier

### Fixed

* `.antialt` will be properly cleaned up when the bot leaves the server

## \[2.45.1] - 12.06.2021

### Added

* Added many new aliases to custom reaction commands in the format ex + "action" to prepare for the future rename from CustomReactions to Expressions
* You can now `.divorce` via username#discrim even if the user no longer exists

### Changed

* DmHelpText should now have %prefix% and %bot.prefix% placeholders available
* Added squares which show enabled features for each cr in `.lcr`
* Changed CustomReactions' IDs to show, and accept base 32 unambigous characters instead of the normal database IDs (this will result in much shorter cr IDs in case you have a lot of them)
* Improved `.lcr` helptext to explain what's shown in the output
* `.rolecolor <color> <role>` changed to take color, then the role, to make it easier to set color for roles with multiple words without mentioning the role
* `.acmdcds` alias chanaged to `.cmdcds`
* `.8ball` will now cache results for a day
* `.chatmute` and `.voicemute` now support timed mutes

### Fixed

* Fixed `.config <conf> <prop>` exceeding embed field character limit

## \[2.45.0] - 10.06.2021

### Added

* 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
* Added `.mquality` / `.musicquality` - Set encoding quality. Has 4 presets - Low, Medium, High, Highest. Default is Highest
* Added `.xprewsreset` which resets all currently set xp level up rewards
* Added `.purgeuser @User` which will remove the specified from the database completely. Removed settings include: Xp, clubs, waifu, currency, etc...
* Added `.config xp txt.per_image` and xpFromImage to xp.yml - Change this config to allow xp gain from posting images. Images must be 128x128 or greater in size
* Added `.take <amount> <role>` to complement `.award <amount> role`
* Added **Fans** list to `.waifuinfo` which shows how many people have their affinity set to you
* Added `.antialt` which will punish any user whose account is younger than specified threshold

### Changed

* `.warne` with no args will now show current state
* .inrole\` will now lists users with no roles if no role is provided
* Music suttering fixed on some systems
* `.say` moved to utility module
* Re-created GuildRepeaters table and renamed to Repeaters
* confirmation prompts will now use pending color from bot config, instead of okcolor
* `.mute` can now have up to 49 days mute to match .warnp
* `.warnlog` now has proper pagination (with reactions) and checking your own warnings past page 1 works correctly now with `.warnlog 2`

### Fixed

* obsolete\_use string fixed
* Fixed `.crreact`

## \[2.44.4] - 06.06.2021

### Added

* Re-added `%music.playing%` and `%music.queued%` (#290)
* 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

### Changed

* Using `.commands` / `.cmds` without a module will now list modules
* `.qrp` / `.queuerepeat` will now accept one of 3 values
  * `none` - don't repeat queue
  * `track` - repeat single track
  * `queue` (or ommit) - repeat entire queue
* your old `.defvol` and `.smch` settings will be reset

### Fixed

* Fixed `.google` / `.g` command
* 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

* `.sad` removed. It's more or less useless. Use `.qrp` and `.autodc` now for similar effect

### Obsolete

* `.rcs` is obsolete, use `.qrp s` or `.qrp song`
* `.defvol` is obsolete, use `.vol`

## \[2.44.3] - 04.06.2021

### Changed

* Minor perf improvement for filter checks

### Fixed

* `.qs` result urls are now valid
* Custom reactions with "`-`" as a response should once again disable that custom reaction completely
* Fixed `.acrm` out of range string
* Fixed `.sclist` and `.aclist` not showing correct indexes past page 1

## \[2.44.2] - 02.06.2021

### Added

* Music related commands reimplemented with custom code, **considered alpha state**
* Song and playlist caching (faster song queue after first time)
* 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)
* `.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
* Added `.clubs` alias for `.clublb`

### Changed

* `.ms` no longer takes `>` between arguments (`.ms 1 5` now, was `.ms 1>5` before)
* FlowerShop renamed to Shop

### Fixed

* Fixed decay bug giving everyone 1 flower every 24h
* Fixed feeds which have rss media items without a type
* Fixed `.acrm` index not working
* Fixed and error reply when a waifu item doesn't exist
* Disabled colored console on windows as they were causing issues for some users
* Fixed/Updated some strings and several minor bugfixes

### Removed

* Removed admin requirement on `.scrm` as it didn't make sense
* Some Music commands are removed because of the complexity they bring in with little value (if you *really* want them back, you can open an issue and specify your *good* reason)


# LICENSE

Copyright 2021 WizNet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


# WizBot v4

## Repo Status

[![pipeline status](https://gitlab.com/WizNet/WizBot/badges/v4/pipeline.svg)](https://gitlab.com/WizNet/WizBot/commits/v4) [![Documentation Status](https://readthedocs.org/projects/wizbot/badge/?version=v4)](http://wizbot.readthedocs.io/en/v4/?badge=v4) [![CodeFactor](https://www.codefactor.io/repository/github/wizkiller96/wizbot/badge)](https://www.codefactor.io/repository/github/wizkiller96/wizbot) ![WizBot Website](https://img.shields.io/website-up-down-green-red/https/wizbot.cc.svg?label=wizbot.cc) [![Discord](https://discordapp.com/api/guilds/99273784988557312/widget.png)](https://discord.gg/0YNaDOYuD5QOpeNI)

## For Updates, Help and Guidelines

| [![twitter](https://cdn.discordapp.com/attachments/155726317222887425/252192520094613504/twiter_banner.JPG)](https://twitter.com/WizBot_Dev) | [![Wiki](https://cdn.discordapp.com/attachments/266240393639755778/281920793330581506/datcord.png)](http://wizbot.readthedocs.io/en/v4/) |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Follow me on Twitter.**                                                                                                                    | **Read the Docs for self-hosting.**                                                                                                      |


# Privacy Policy

## Profile Information

WizBot stores userids, avatars, usernames, discriminators and nicknames of users who were targeted by or have used commands which require Xp, Clubs or Waifu features (not limited to these, as other features may be added over time).

## Other

WizBot doesn't do analytics, doesn't store messages, doesn't track users, doesn't store their emails etc.\
WizBot only stores user settings and states as the result of executed commands or as the effect of administration tools (for example warnings or protection commands).

## Sensitive Information

WizBot doesn't store sensitive information, and users are strongly discouraged from adding their passwords, keys, or other important information as quotes or expressions.


# docs


# Readme for Commands List

## Bot Owner Only

* *Bot Owner Only* commands refer to the commands only the **owner** of the bot can use.
* *Bot Owner Only* commands do **not** refer to the owner of the **server**, just the owner of the **bot**.
* *Owner of the bot* is a person who is **hosting** their own bot, and their **ID** is inside of **creds.yml** file.
* You are **not** the bot **owner** if you invited the bot using **Carbonitex** or other invitation links.

## Music on the public WizBot

* In case you got WizBot in your server by the invitation from **Carbonitex**, our **GitLab** invite or **help (.h)**, music is disabled.
* Music is **disabled** due to large maintenance expenses
* If you want to have music module on your server, you will have to **host** the bot on your PC, or any of the external servers.
* How to **host** the bot, check the **guides** on the left side.

## Cherry Blossoms

* Cherry Blossoms is the **currency** of the public WizBot.
* Cherry Blossoms can be `.pick`ed after WizBot plants a flower randomly after `.gc` has been enabled on a channel
* You can give Cherry Blossoms to other users, using the command `.give X @person`.
* You can only give flowers you **own**.
* If you want to have **unlimited** number of flowers, you will have to **host** the bot.
* Commands `.award X @person` and `.take X @person` can only be used by the *bot owner*.
* If you `.plant` the flower, flower will be avaliable for everyone to `.pick` it. In that case you will **lose** the flower.


# Config

`.config` is the new `.bce`, it gives you a fast and easy way to edit most bot settings/values. Use `.h .config` for explanation.

Use `.config` to see the list of editable config files\
Use `.config <config-name>` to see the list of settable properties on that config\
Use `.config <config-name> <setting>` to see the current value and description\
Use `.config <config-name> <setting> value` to set a new value

All settings are only available if you edit `data/[config-name].yml` files manually.\
If you edit the files manually, you can reload configuration with `.configreload <config-name>`

The list below is not complete. Use commands above to see up-to-date list for your version.

## XP

`txt.cooldown` - Sets a timeout value in which a user cannot gain any more xp from sent messages. ( Value is in minutes )\
`txt.per_msg` - Sets a value for the amount of xp a user will receive from sending a message.\
`voice.per_minute` - Sets how much xp a user will receive from being active in a voice channel.\
`voice.max_minutes` - Restricts a users xp gain to a certain amount of time spent in a voice channel.

*more settings may be available in `data/xp.yml` file*

## Games

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

## Bot

`color.ok` - Sets a hex color that will be shown on the side bar of a successful command.\
`color.error` - Sets a hex color that will be shown on the side bar of an unsuccessful command.\
`color.pending` - Sets a hex color that will be shown on the side bar of a command that is currently in progress.\
`help.text` - The text a user is DM'd when they invoke the `.h` command.\
`help.dmtext` - The text a user will receive when they DM the bot directly.\
`console.type` - Sets the style in which commands will show up in your console, values: `Simple`, `Normal`, `None`.\
`locale` - Sets your native bot language, run the `.langli` command in a Discord channel for a full list of language options.\
`prefix` - Sets default prefix for your bot.

*more settings may be available in `data/bot.yml` file*

## Gambling

`currency.name` - Sets the name for your bot's currency.\
`currency.sign` - Sets the icon for your currency.\
`minbet` - Minimum amount users can bet\
`maxbet` - Maximum amount users can bet. Set 0 for unlimited\
`gen.min` - Sets the minimum amount that can be spawned with `.gc` active.\
`gen.max` - Sets the maximum amount that can be spawned with `.gc` active.\
`gen.cd` - Sets a cooldown on how often a flower can spawn with `.gc` active ( Value is in seconds ).\
`gen.chance` - Sets the likelihood that flowers will spawn with `.gc`. Value: ( 0.02 = 2% | 1 + 100% ).\
`gen.has_pw` - Toggles wether the generated flowers will have a password at the top left of the image. Value: `true` or `false`\
`bf.multi` - Sets the amount fo currency a user will win off of a winning a bet flip.\
`waifu.min_price` - Sets the minimum price a user must pay to claim a user as their waifu.\
`waifu.multi.reset` - Sets a multiplier for the `.waifureset` command.\
`waifu.multi.crush_claim` - Sets a discount for a user that is claiming another user that has their affinity set to them.\
`waifu.multi.normal_claim` - Amount a user would have to spend to claim a waifu with no affinity set.\
`waifu.multi.divorce_value` - Sets how much a user would get if they divorce a waifu.\
`waifu.multi.all_gifts` - Sets how much of a gifts value will be added to the value of the gifted waifu.\
`waifu.multi.gift_effect` - Sets a bonus amount that a waifu will receive if they have their affinity set to the gifter.\
`decay.percent` - Sets the percentage to decay all users currency daily.\
`decay.maxdecay` - Sets the maximum a amount that a user's currency can decay in a day.\
`decay.threshold` - Sets the minimum amount that a user must have to be eligible to receive a decay.

*more settings may be available in `data/gambling.yml` file*


# How to contribute

1. Make Merge Requests to the [**v4 branch**](https://gitlab.com/WizNet/WizBot/tree/v4)
2. Keep a single Merge Request to a single feature
3. Fill out the MR template

Thanks for all your help ^\_^


# Creds Guide

This document aims to guide you through the process of creating a Discord account for your bot (the Discord Bot application), and inviting that account into your Discord server.

![Create a bot application and copy token to creds.yml file](https://cdn.nadeko.bot/tutorial/bot-creds-guide.gif)

* Go to [the Discord developer application page](https://discordapp.com/developers/applications/me).
* Log in with your Discord account.
* Click **New Application**.
* Fill out the `Name` field however you like.
* Go to the **Bot** tab on the left sidebar.
* Click on the `Add a Bot` button and confirm that you do want to add a bot to this app.
* **Optional:** Add bot's avatar and description.
* Copy your Token to `creds.yml` as shown above.
* Scroll down to the **`Privileged Gateway Intents`** section
  * **Enable the following:**
    * **PRESENCE INTENT**
    * **SERVER MEMBERS INTENT**
    * **MESSAGE CONTENT INTENT**

These are required for a number of features to function properly, and all should be on.

#### Getting Owner ID\*(s)\*:

* Go to your Discord server and attempt to mention yourself, but put a backslash at the start *(to make it slightly easier, add the backslash after the mention has been typed)*.
* For example, the message `\@fearnlj01#3535` will appear as `<@145521851676884992>` after you send the message.
* The message will appear as a mention if done correctly. Copy the numbers from it **`145521851676884992`** and replace the big number on the `OwnerIds` section with your user ID.
* Save the `creds.yml` file.
* If done correctly, you should now be the bot owner. You can add multiple owners by adding them below the first one. Indentation matters.

For a single owner, it should look like this:

```yml
OwnerIds:
  - 105635576866156544
```

For multiple owners, it should look like this:

```yml
OwnerIds:
  - 105635123466156544
  - 145521851676884992
  - 341420590009417729
```

### Inviting your bot to your server

![Invite the bot to your server](https://cdn.nadeko.bot/tutorial/bot-invite-guide.gif)

* On the **General Information** tab, copy your `Application ID` from your [applications page](https://discordapp.com/developers/applications/me).
* Replace the `YOUR_CLIENT_ID_HERE` in this link: `https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID_HERE&scope=bot&permissions=66186303` with your `Client ID`
* The link should now look something like this: `https://discordapp.com/oauth2/authorize?client_id=123123123123&scope=bot&permissions=66186303`
* Access that newly created link, pick your Discord server, click `Authorize` and confirm with the captcha at the end
* The bot should now be in your server

That's it! You may now go back to the installation guide you were following before 🎉


# Donate

WizBot is an [open-source project](https://gitlab.com/WizNet/WizBot), and we rely on your help to develop the bot, pay hosting fees, maintain our website and more. Donations go a long way in helping us keep the project alive, and we appreciate every single one of them.

## Perks

Donating to us also gives you the following benefits:

* A hoisted **Donators role** in our [Discord server](https://wizbot.cc/discord)
* Access to exclusive **#noticed** text and voice channels
* **1000 flowers** on the public bot per dollar donated (after fees)
* **Expressions** on the public bot for [Patreon pledges](https://www.patreon.com/WizNet) of $5 or higher

## Patreon

You can set up a monthly pledge on [Patreon](https://www.patreon.com/WizNet) and support the project's growth, and also get flower rewards for every month you donate!

!!! Note Connect your Discord account on Patreon to receive your flowers automatically

[![img](/files/-MbDPrpEyZ3Gy4_SkgtH)](https://www.patreon.com/WizNet)

## PayPal

You can also donate to us through [PayPal](https://paypal.me/Wizkiller96Network) for one-time donations using the button below.

!!! Note Mention your Discord tag (Username#1234) in the payment note to receive flower rewards.

[![img](/files/g1eovNWpwKYamUVcFLZF)](https://paypal.me/Wizkiller96Network)


# expressions

#### Important

* For modifying **global** expressions, the ones which will work across all the servers your bot is connected to, you **must** be a Bot Owner.\
  You must also use the commands for adding, deleting and listing these expressions in a direct message with the bot.
* For modifying **local** expressions, the ones which will only work on the server that they are added on, it is required to have the **Administrator** permission.\
  You must also use the commands for adding, deleting and listing these expressions in the server you want the expressions to work on.

#### Commands and Their Use

| Command Name | Description                                                                                                                                                                                                   | Example                            |
| :----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
|    `.exa`    | Add an expression with a trigger and a response. Running this command in a server requries the Administrator permission. Running this command in DM is Bot Owner only, and adds a new global expression.      | `.exadd "hello" Hi there, %user%!` |
|     `exl`    | Lists a page of global or server expression(15 expressions per page). Running this command in a DM will list the global expression, while running it in a server will list that server's expression.          | `.exl 1`                           |
|    `.exd`    | Deletes an expression based on the provided index. Running this command in a server requires the Administrator permission. Running this command in DM is Bot Owner only, and will delete a global expression. | `.exd 5`                           |

**Now that we know the commands let's take a look at an example of adding a command with `.exa`,**

`.exadd "Nice Weather" It sure is, %user%!`

This command can be split into two different arguments:

* The trigger, `"Nice Weather"`
* And the response, `It sure is, %user%!`

An important thing to note about the triger is that, to be more than one word, we had to wrap it with quotation marks, `"Like this"` otherwise, only the first word would have been recognised as the trigger, and the second word would have been recognised as part of the response.

There's no special requirement for the formatting of the response, so we could just write it in exactly the same way we want it to respond, albeit with a placeholder - which will be explained in this next section.

Now, if that command was ran in a server, anyone on that server can make the bot mention them, saying `It sure is, @Username` anytime they say "Nice Weather". If the command is ran in a direct message with the bot, then the expression can be used on every server the bot is connected to.

#### Block global Expressions

If you want to disable a global expression which you do not like, and you do not want to remove it, or you are not the bot owner, you can do so by adding a new expression with the same trigger on your server, and set the response to `-`.

For example: `.exa /o/ -`

Now if you try to trigger `/o/`, it won't print anything even if there is a global expression with the same name.

#### Placeholders!

To learn about placeholders, go [here](/docs/placeholders)


# WizBot Documentation

## Inviting WizBot

There are two versions of WizBot, a public bot and a self-hostable bot.

To invite public WizBot to your server or to view its commands, click on the buttons below:

[:material-plus: Add WizBot to your server](https://wizbot.cc/botinvite){ .md-button .md-button--primary } [:material-format-list-text: View commands](https://commands.wizbot.cc){ .md-button }

To self-host your own WizBot, use the guides below:

* [:material-microsoft-windows: Windows guide](/docs/guides/windows-guide)
* [:material-linux: Linux guide](/docs/guides/linux-guide)
* [:material-apple: Mac OS guide](/docs/guides/osx-guide)

In case you need any help, join our [Discord server](https://discord.wizbot.cc/) where we may provide support.

***

## About WizBot

WizBot is an [open source project](https://gitlab.com/WizNet/WizBot). Any issues with the bot may be filed [here](https://gitlab.com/WizNet/WizBot/issues).

If you're unsure whether something is an issue, ask in our support server first.

[Donations are welcome](/docs/donate), and we rely on your contributions to help keep the project alive.


# jsons-explained

### Setting up your API keys

This part is completely optional, **however it's necessary for music and a few other features to work properly**.

* **GoogleAPIKey**
  * Required for Youtube Song Search, Playlist queuing, and a few more things.
  * Follow these steps on how to setup Google API keys:

    * Go to [Google Console](https://console.developers.google.com) and log in.
    * Create a new project (name does not matter).
    * Once the project is created, go into `Library`
    * Under the `YouTube APIs` section
      * Select `YouTube Data API v3`,
      * Click enable.
    * Search for `Custom Search API`
      * Select `Custom Search API`,
      * Click enable.
    * Open up the `Navigation menu` on the top right with the three lines.
    * select `APIs & Services`, then select `Credentials`,
      * Click `Create Credentials` button,
      * Click on `API Key`
      * A new window will appear with your `Google API key`\
        *NOTE: You don't really need to click on `RESTRICT KEY`, just click on `CLOSE` when you are done.*
      * Copy the key.
    * Open up `creds.yml` and look for `GoogleAPIKey`, paste your API key after the `:`.
    * It should look like this:

    ```yml
    GoogleApiKey: 'AIzaSyDSci1sdlWQOWNVj1vlXxxxxxbk0oWMEzM'
    ```
* **MashapeKey**
  * Required for Hearthstone cards.
  * Api key obtained on <https://rapidapi.com> (register -> go to MyApps -> Add New App -> Enter Name -> Application key)
  * Copy the key and paste it into `creds.yml`
* **OsuApiKey**
  * Required for Osu commands
  * You can get this key [here](https://osu.ppy.sh/p/api).
* **CleverbotApiKey**
  * Required if you want to use Cleverbot. It's currently a paid service.
  * You can get this key [here](http://www.cleverbot.com/api/).
* **PatreonAccessToken**
  * For Patreon creators only.
* **PatreonCampaignId**
  * For Patreon creators only. Id of your campaign.
* **TwitchClientId and TwitchClientSecret**
  * Mandatory for following twitch streams with `.twitch` (or `.stadd` with twitch link)
  * Go to [apps page](https://dev.twitch.tv/console) on twitch and register your application.

    * You need 2FA enabled on twitch in order to create an application
    * You can set `http://localhost` as the OAuth Redirect URL (and press Add button)
    * Select `Chat Bot` from the Category dropdown
    * Once created, `click Manage`
    * Click `New Secret` and select `OK` in the popup **Note: You will need to generate a new Client Secret everytime you exit the page**
    * Copy both to your creds.yml as shown below

    ```yml
        twitchClientId: 516tr61tr1qweqwe86trg3g
        twitchClientSecret: 16tr61tr1q86tweqwe
    ```
* **LocationIqApiKey**
  * Optional. Used only for the `.time` command. <https://locationiq.com> api key (register and you will receive the token in the email).
* **TimezoneDbApiKey**
  * Optional. Used only for the `.time` command. <https://timezonedb.com> api key (register and you will receive the token in the email **YOU HAVE TO ACTIVEATE IT AFTER YOU GET IT**).
* **CoinmarketcapApiKey**
  * Optional. Used only for the `.crypto` command. You can use crypto command without it, but you might get ratelimited from time to time, as all self-hosters share the default api key. <https://pro.coinmarketcap.com/>

**Additional Settings**

* **TotalShards**
  * Required if the bot will be connected to more than 2500 servers.
  * Most likely unnecessary to change until your bot is added to more than 2500 servers.
* **RedisOptions**
  * Required if the Redis instance is not on localhost or on non-default port.
  * You can find all available options [here](https://stackexchange.github.io/StackExchange.Redis/Configuration.html).
* **RestartCommand**
  * Required if you want to be able to use the `.restart` command
  * If you're using the CLI installer or Linux/OSX, it's easier and more reliable setup WizBot with auto-restart and just use `.die`

For Windows (Updater), add this to your `creds.yml`

```yml
RestartCommand:
    Cmd: "WizBot.exe"
    args: "{0}"
```

For Windows (Source), Linux or OSX, add this to your `creds.yml`

```yml
RestartCommand:
    Cmd: dotnet
    Args: "WizBot.dll -- {0}"
```

***

**End Result**

**This is an example of how the `creds.yml` looks like with multiple owners, the restart command (optional) and some of the API keys (also optional):**

```yml
# DO NOT CHANGE
version: 4
# Bot token. Do not share with anyone ever -> https://discordapp.com/developers/applications/
token: 'MTE5Nzc3MDIxMzE5NTc3NjEw.VlhNCw.BuqJFyzdIUAK1PRf1eK1Cu89Jew'
# List of Ids of the users who have bot owner permissions
# **DO NOT ADD PEOPLE YOU DON'T TRUST**
ownerIds: 
    - 105635123466156544
    - 145521851676884992
    - 341420590009417729
# List of Ids of the users who have bot admin permissions
# **DO NOT ADD PEOPLE YOU DON'T TRUST**
adminIds:
  - 125633124465126246
  - 243531851646742944
  - 123420512312455232
# The number of shards that the bot will running on.
# Leave at 1 if you don't know what you're doing.
totalShards: 1
# Login to https://console.cloud.google.com, create a new project, go to APIs & Services -> Library -> YouTube Data API and enable it.
# Then, go to APIs and Services -> Credentials and click Create credentials -> API key.
# Used only for Youtube Data Api (at the moment).
googleApiKey: 'AIzaSyDScfdfdfi1sdlWQOWxxxxxbk0oWMEzM'
# Settings for voting system for discordbots. Meant for use on global WizBot.
votes:
  url: ''
  key: ''
# Patreon auto reward system settings.
# go to https://www.patreon.com/portal -> my clients -> create client
patreon:
# Access token. You have to manually update this 1st of each month by refreshing the token on https://patreon.com/portal
  accessToken: ''
  # Unused atm
  refreshToken: ''
  # Unused atm
  clientSecret: ''
  # Campaign ID of your patreon page. Go to your patreon page (make sure you're logged in) and type "prompt('Campaign ID', window.patreon.bootstrap.creator.data.id);" in the console. (ctrl + shift + i)
  campaignId: ''
# Api key for sending stats to DiscordBotList.
botListToken: ''
# Official cleverbot api key.
cleverbotApiKey: ''
# Redis connection string. Don't change if you don't know what you're doing.
redisOptions: localhost:6379,syncTimeout=30000,responseTimeout=30000,allowAdmin=true,password=
# Database options. Don't change if you don't know what you're doing. Leave null for default values
db:
# Database type. Only sqlite supported atm
  type: sqlite
  # Connection string. Will default to "Data Source=data/WizBot.db"
  connectionString: Data Source=data/WizBot.db
# Address and port of the coordinator endpoint. Leave empty for default.
# Change only if you've changed the coordinator address or port.
coordinatorUrl: http://localhost:3442
# Api key obtained on https://rapidapi.com (go to MyApps -> Add New App -> Enter Name -> Application key)
rapidApiKey: 4UrKpcWXcxxxxxxxxxxxxxxp1Q8kI6jsn32xxxoVWiY7
# https://locationiq.com api key (register and you will receive the token in the email).
# Used only for .time command.
locationIqApiKey: 
# https://timezonedb.com api key (register and you will receive the token in the email).
# Used only for .time command
timezoneDbApiKey: 
# https://pro.coinmarketcap.com/account/ api key. There is a free plan for personal use.
# Used for cryptocurrency related commands.
coinmarketcapApiKey: 
# Api key used for Osu related commands. Obtain this key at https://osu.ppy.sh/p/api
osuApiKey: 4c8c8fdffdsfdsfsdfsfa33f3f3140a7d93320d6
# Optional Trovo client id.
# You should use this if Trovo stream notifications stopped working or you're getting ratelimit errors.
trovoClientId:
# Obtain by creating an application at https://dev.twitch.tv/console/apps
twitchClientId: jf2w6kkyrlzfl6mp1b4k25h4jr6b2o
# Obtain by creating an application at https://dev.twitch.tv/console/apps
twitchClientSecret: 16tr61tr1q86tweqwe
# Command and args which will be used to restart the bot.
# Only used if bot is executed directly (NOT through the coordinator)
# placeholders: 
#     {0} -> shard id 
#     {1} -> total shards
# Linux default
#     cmd: dotnet
#     args: "WizBot.dll -- {0}"
# Windows default
#     cmd: "WizBot.exe"
#     args: "{0}"
restartCommand:
  cmd: 
  args: 
```

***

### Database

WizBot saves all settings and data in the database file `WizBot.db`, located in:

* Windows (Updater): `system/data` (can be easily accessed through the `Data` button on the updater)
* Windows (Source), Linux and OSX: `wizbot/output/data/WizBot.db`

In order to open it you will need [SQLite Browser](http://sqlitebrowser.org/).

*NOTE: You don't have to worry if you don't have the `WizBot.db` file, it gets automatically created once you successfully run the bot for the first time.*

**To make changes to the database on windows:**

* Shut your bot down.
* Copy the `WizBot.db` file to someplace safe. (Back up)
* Open it with SQLite Browser.
* Go to the **Browse Data** tab.
* Click on the **Table** drop-down list.
* Choose the table you want to edit.
* Click on the cell you want to edit.
* Edit it on the right-hand side.
* Click on **Apply**.
* Click on **Write Changes**.

![wizbotdb](https://cdn.discordapp.com/attachments/251504306010849280/254067055240806400/nadekodb.gif)

***

### Sharding your bot

To run a sharded bot, you will want to run `src/WizBot.Coordinator` project. Shards communicate with the coordinator using gRPC To configure your Coordinator, you will need to edit the `src/WizBot.Coordinator/coord.yml` file

```yml
# total number of shards
TotalShards: 3
# How often do shards ping their state back to the coordinator
RecheckIntervalMs: 5000
# Command to run the shard
ShardStartCommand: dotnet
# Arguments to run the shard
# {0} = shard id
# {1} = total number of shards
ShardStartArgs: ../../output/WizBot.dll -- {0} {1}
# How long does it take for the shard to be forcefully restarted once it stops reporting its state
UnresponsiveSec: 30
```


# Permissions Overview

Have you ever felt confused or even overwhelmed when trying to set WizBot's permissions? In this guide we will be explaining **how to use the permission commands correctly** and even **cover a few common questions**! Every command we discuss here can be found in the [Commands List](https://commands.wizbot.cc).

## Why do we use the Permissions Commands?

Permissions are very handy at setting who can use what commands in a server. All commands and modules are enabled by default. If something is a bot owner only command, it can only be ran by the bot owner, the person who is running the bot, or has their ID in the [creds.yml](/docs/creds-guide) file.

Several commands still require that you have the correct permissions on Discord to be able to use them, so for users to be able to use commands like `.kick` and `.voicemute`, they need **Kick** and **Mute Members** server permissions, respectively.

With the permissions system it possible to restrict who can skip the current song, pick Cherry Blossoms or use the NSFW module.

## First Time Setup

To change permissions you **must** meet the following requirements:

**Have Administrator Server Permission.**

**If you are NOT the server owner or an admin, get the role set to `.permrole` (there is no permission role by default).**

## Basics & Hierarchy

The [Commands List](https://commands.wizbot.cc) is a great tool which lists **all** available commands, however we'll go over a few of them here.

First, let's explain how the permissions system works - It's simple once you figure out how each command works! The permissions system works as a chain. Everytime a command is used, the permissions chain is checked. Starting from the top of it, the command is compared to a rule, if it isn't either allowed or disallowed by that rule it proceeds to check the next rule all the way till it reaches the bottom rule, which allows all commands.

To view this permissions chain, do `.lp`. The rule at the top of the chain takes priority over all rules below it.

If you want to remove a permission from the chain of permissions, do `.rp X` to remove rule number X and similarly, do `.mp X Y` to move rule number X to number Y (moving, not swapping!).

If you want the bot to notify users why they can't use a command or module, use `.verbose true` and WizBot will tell you what rule is preventing the command from being used.

## Commonly Asked Questions

#### How do I restrict all commands to a single channel?

To allow users to only use commands in a specific text channel, follow these steps:

1. `.asm disable`
   * Disables all modules on the entire server
2. `.acm enable #bot-spammerino`
   * Enables all modules in the #bot-spammerino channel

#### How do I allow only one module to be used in a specific channel?

To allow users to only use commands from a certain module, let's say **gambling**, in a specific text channel, follow these steps:

1. `.acm disable #gamblers-den`
   * Disables all modules in the #gamblers-den channel
2. `.cm Gambling enable #gamblers-den`
   * Enables usage of the Gambling module in the #gamblers-den channel

#### How do I create a music DJ?

To allow users to only see the current song and have a DJ role for queuing follow these steps:

1. `.sm Music disable`
   * Disables music commands for everybody
2. `.sc .nowplaying enable`
   * Enables the "nowplaying" command for everyone
3. `.sc .listqueue enable`
   * Enables the "listqueue" command for everyone
4. `.rm Music enable DJ`
   * Enables all music commands only for the DJ role

#### How do I create a NSFW role?

Say you want to only enable NSFW commands for a specific role, just do the following two steps.

1. `.sm NSFW disable`
   * Disables the NSFW module from being used
2. `.rm NSFW enable Lewd`
   * Enables usage of the NSFW module for the Lewd role

#### How do I disable Expressions from triggering?

If you don't want server or global Expressions, just block the module that controls their usage:

1. `.sm ActualExpressions disable`
   * Disables the ActualExpression module from being used

**Note**: The `Expressions` module controls the usage of Expressions. The `Expressions` module controls commands related to Expressions (such as `.acr`, `.lcr`, `.crca`, etc).

#### I've broken permissions and am stuck, can I reset permissions?

Yes, there is a way, in one easy command!

1. `.resetperms`
   * This resets the permission chain back to default

*-- Thanks to @applemac for providing the template for this guide*


# Placeholders

Placeholders are used in Quotes, Expressions, Greet/Bye messages, playing statuses, and a few other places.

They can be used to make the message more user friendly, generate random numbers or pictures, etc.

Some features have their own specific placeholders which are noted in that feature's command help. Some placeholders are not available in certain features because they don't make sense there.

## Usual placeholders

!!! Note If you're using placeholders in embeds, don't use %user.mention% and %bot.mention% in titles, footers and field names. They will not show properly.

### Bot placeholders

* `%bot.status%` - Bot's status (Online, Idle, DoNotDisturb, Invisible)
* `%bot.latency%` - Bot latency
* `%bot.name%` - Bot username
* `%bot.mention%` - Bot mention (clickable)
* `%bot.fullname%` - Bot username#discriminator
* `%bot.time%` - Bot time (usually the time of the server it's hosted on)
* `%bot.discrim%` - Bot's discriminator
* `%bot.id%` - Bot's user ID
* `%bot.avatar%` - Bot's avatar url

### Server placeholders

* `%server.id%` - Server ID
* `%server.name%` - Server name
* `%server.members%` - Member count
* `%server.boosters%` - Number of users boosting the server
* `%server.boost_level%` - Server Boost level
* `%server.time%` - Server time (requires `.timezone` to be set)

### Channel placeholders

* `%channel.mention%` - Channel mention (clickable)
* `%channel.name%` - Channel name
* `%channel.id%` - Channel ID
* `%channel.created%` - Channel creation date
* `%channel.nsfw%` - Returns either `True` or `False`, depending on if the channel is designated as NSFW using discord
* `%channel.topic%` - Channel topic

### User placeholders

* `%user.mention%` - User mention
* `%user.fullname%` - Username#discriminator
* `%user.name%` - Username
* `%user.discrim%` - Discriminator
* `%user.avatar%` - User's avatar url
* `%user.id%` - User ID
* `%user.created_time%` - Account creation time (local time)
* `%user.created_date%` - Account creation date
* `%user.joined_time%` - Account join time (local time)
* `%user.joined_date%` - Account join date

### Ban message placeholders

* `%ban.mod%` - Full name of the moderator who performed the ban
* `%ban.mod.fullname%` - Full name of the moderator who performed the ban
* `%ban.mod.mention%` - Moderator's mention
* `%ban.mod.name%` - Name of the moderator - Admin
* `%ban.mod.discrim%` - Discriminator of the moderator - 1234
* `%ban.user%` - Full name of the banned user
* `%ban.user.fullname%` - Full name of the banned user
* `%ban.user.name%` - Name of the banned user
* `%ban.user.discrim%` - Discriminator of the banned user
* `%ban.reason%` - Reason for the ban, if provided
* `%ban.duration%` - Duration of the ban in the form Days.Hours:Minutes (6.05:04)

### Shard stats placeholders

* `%shard.servercount%` - Server count on current shard
* `%shard.usercount%` - Combined user count on current shard
* `%shard.id%` - Shard ID

### Music placeholders

* `%music.queued%` - Number of songs currently queued
* `%music.playing%` - Current song name (random playing song if bot is playing on multiple servers)
* `%music.servers%` - Number of servers currently listening to music

### Miscellaneous placeholders

* `%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](https://i.imgur.com/yp0RORk.jpg)


# guides


# docker-guide

## Setting up WizBot with Docker

## WORK IN PROGRESS

#### Installation

1. Create a `/srv/wizbot` folder

* `mkdir -p /srv/wizbot`

2. Create a `docker-compose.yml`

* nano `docker-compose.yml`
* copy the following contents into it:

**docker-compose.yml**

```yml
version: "3.7"
services:
  wizbot:
    image: registry.gitlab.com/wiznet/wizbot:latest
    depends_on:
      - redis
    environment:
      TZ: Europe/Paris
      WizBot_RedisOptions: redis,name=wizbot
      #WizBot_ShardRunCommand: dotnet
      #WizBot_ShardRunArguments: /app/WizBot.dll {0} {1}
    volumes:
      - /srv/wizbot/conf/creds.yml:/app/creds.yml:ro
      - /srv/wizbot/data:/app/data

  redis:
    image: redis:4-alpine
    sysctls:
      - net.core.somaxconn=511
    command: redis-server --maxmemory 32M --maxmemory-policy volatile-lru
    volumes:
      - /srv/wizbot/redis-data:/data
```

3. Save your file and run docker compose

* `docker-compose up`

4. Edit creds in `/srv/wizbot/conf/creds.yml`
5. Run it again with

* `docker-compose up`

#### Updating

* `cd /srv/wizbot`
* `docker-compose pull`
* `docker-compose up -d`


# Setting up WizBot on Linux

| Table of Contents                                                                                     |
| ----------------------------------------------------------------------------------------------------- |
| [Linux From Source](#linux-from-source)                                                               |
| [Source Update Instructions](#source-update-instructions)                                             |
| [Linux Release](#linux-release)                                                                       |
| [Release Update Instructions](#release-update-instructions)                                           |
| [Tmux (Preferred Method)](#tmux-preferred-method)                                                     |
| [Systemd](#systemd)                                                                                   |
| [Systemd + Script](#systemd-script)                                                                   |
| [Setting up WizBot on a VPS (Digital Ocean)](#setting-up-wizbot-on-a-linux-vps-digital-ocean-droplet) |

#### Operating System Compatibility

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

## Linux From Source

**Migration from v3 -> v4**

Follow the following few steps only if you're migrating from v3. If not, skip to installation instructions.

Use the new installer script: `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/-/raw/v4/linuxAIO.sh && bash linuxAIO.sh`

> * Install prerequisites (type `1` and press `enter`)
> * Download (type `2` and press `enter`)
> * Run (type `3` and press `enter`)
> * Done

**Installation Instructions**

Open Terminal (if you're on an installation with a window manager) and navigate to the location where you want to install the bot (for example `cd ~`)

1. Download and run the **new** installer script `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
2. Install prerequisites (type `1` and press enter)
3. Download the bot (type `2` and press enter)
4. Exit the installer (type `6` and press enter)
5. Copy the creds.yml template `cp wizbot/output/creds_example.yml wizbot/output/creds.yml`
6. Open `wizbot/output/creds.yml` with your favorite text editor. We will use nano here
   * `nano wizbot/output/creds.yml`
7. [Click here to follow creds guide](https://github.com/Wizkiller96/WizBot/blob/v4/creds-guide/README.md)
   * After you're done, you can close nano (and save the file) by inputting, in order
     * `CTRL` + `X`
     * `Y`
     * `Enter`
8. Run the installer script again `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
9. Run the bot (type `3` and press enter)

**Source Update Instructions**

1. ⚠ Stop the bot ⚠
2. Update and run the **new** installer script `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
3. Update the bot (type `2` and press enter)
4. Run the bot (type `3` and press enter)
5. 🎉

## **⚠ IF YOU ARE FOLLOWING THE GUIDE ABOVE, IGNORE THIS SECTION ⚠**

## Linux Release

**Prerequisites**

1. (Optional) Installing Redis
   * ubuntu installation command: `sudo apt-get install redis-server`
2. Playing music requires `ffmpeg`, `libopus`, `libsodium` and `youtube-dl` (which in turn requires python3)
   * ubuntu installation command: `sudo apt-get install ffmpeg libopus0 opus-tools libopus-dev libsodium-dev -y`
3. Make sure your python is version 3+ with `python --version`
   * if it's not, you can install python 3 and make it the default with: `sudo apt-get install python3.8 python-is-python3`

*You can use wizbot bash script* [*prerequisites installer*](https://github.com/Wizkiller96/wizbot-bash-installer/blob/v4/w-prereq.sh) *as a reference*

**Installation Instructions**

1. Download the latest release from <https://gitlab.com/WizNet/wizbot/-/releases>
   * Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
2. Untar it
   * ⚠ Make sure that you change X.XX.X to the same series of numbers as in step 1!
   * `tar xf X.XX.X-linux-x64-build.tar`
3. Rename the `wizbot-linux-x64` to `wizbot`
   * `mv wizbot-linux-x64 wizbot`
4. Move into wizbot directory and make WizBot executable
   * `cd wizbot && chmod +x WizBot`
5. Copy the creds.yml template
   * `cp creds_example.yml creds.yml`
6. Open `creds.yml` with your favorite text editor. We will use nano here
   * `nano wizbot/output/creds.yml`
7. [Click here to follow creds guide](https://github.com/Wizkiller96/WizBot/blob/v4/creds-guide/README.md)
   * After you're done, you can close nano (and save the file) by inputting, in order
     * `CTRL` + `X`
     * `Y`
     * `Enter`
8. Run the bot
   * `./WizBot`

**Release Update Instructions**

1. Stop the bot
2. Download the latest release from <https://gitlab.com/WizNet/WizBot/-/releases>
   * Look for the file called "x.x.x-linux-x64-build.tar" (where `X.X.X` is a version, for example 3.0.4) and download it
3. Untar it
   * ⚠ Make sure that you change `X.X.X` to the same series of numbers as in step 2!
   * `tar xf x.x.x-linux-x64-build.tar`
4. Rename the old wizbot directory to wizbot-old (remove your old backup first if you have one, or back it up under a different name)
   * `rm -rf wizbot-old 2>/dev/null`
   * `mv wizbot wizbot-old`
5. Rename the new wizbot directory to wizbot
   * `mv wizbot-linux-x64 wizbot`
6. Remove old strings and aliases to avoid overwriting the updated versions of those files
   * ⚠ If you've modified said files, back them up instead
   * `rm wizbot-old/data/aliases.yml`
   * `rm -r wizbot-old/data/strings`
7. Copy old data
   * `cp -RT wizbot-old/data/ wizbot/data`
8. Copy creds.yml
   * `cp wizbot-old/creds.yml wizbot/`
9. Move into wizbot directory and make the WizBot executable
   * `cd wizbot && chmod +x WizBot`
10. Run the bot
    * `./WizBot`

🎉 Enjoy

**Steps 3 - 9 as a single command**

Don't forget to change X.XX.X to match step 2.

```sh
tar xf X.XX.X-linux-x64-build.tar && \
rm -rf wizbot-old 2>/dev/null && \
mv wizbot wizbot-old && \
mv wizbot-linux-x64 wizbot && \
rm wizbot-old/data/aliases.yml && \
rm -r wizbot-old/data/strings && \
cp -RT wizbot-old/data/ wizbot/data && \
cp wizbot-old/creds.yml wizbot/ && \
cd wizbot && chmod +x WizBot
```

## Running WizBot

While there are two run modes built into the installer, these options only run WizBot within the current session. Below are 3 methods of running WizBot as a background process.

### Tmux Method (Preferred)

Using `tmux` is the simplest method, and is therefore recommended for most users.

1. Start a tmux session:
   * `tmux`
2. Run the installer: `bash linuxAIO.sh`
3. There are a few options when it comes to running WizBot.
   * 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 WizBot.
2. Run Auto Restart and update WizBot.
3. Exit

Choose:
[1] to Run WizBot with Auto Restart on "die" command without updating.
[2] to Run with Auto Updating on restart after using "die" command.
```

* Run `1` to restart the bot without updating. (This is done using the `.die` command)
* Run `2` to update the bot upon restart. (This is also done using the `.die` command)

5. That's it! to detatch the tmux session:
   * Press `Ctrl` + `B`
   * Then press `D`

WizBot 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`.

### Systemd

Compared to using tmux, this method requires a little bit more work to set up, but has the benefit of allowing WizBot to automatically start back up after a system reboot or the execution of the `.die` command.

1. Navigate to the project's root directory
   * Project root directory location example: `/home/user/wizbot/`
2. Use the following command to create a service that will be used to start WizBot:

   ```bash
   echo "[Unit]
   Description=WizBot service
   After=network.target
   StartLimitIntervalSec=60
   StartLimitBurst=2

   [Service]
   Type=simple
   User=$USER
   WorkingDirectory=$PWD/output
   # If you want WizBot to be compiled prior to every startup, uncomment the lines
   # below. Note  that it's not neccessary unless you are personally modifying the
   # source code.
   #ExecStartPre=/usr/bin/dotnet build ../src/WizBot/WizBot.csproj -c Release -o output/
   ExecStart=/usr/bin/dotnet WizBot.dll
   Restart=on-failure
   RestartSec=5
   StandardOutput=syslog
   StandardError=syslog
   SyslogIdentifier=WizBot

   [Install]
   WantedBy=multi-user.target" | sudo tee /etc/systemd/system/wizbot.service
   ```
3. Make the new service available:
   * `sudo systemctl daemon-reload`
4. Start WizBot:
   * `sudo systemctl start wizbot.service && sudo systemctl enable wizbot.service`

### Systemd + Script

This method is similar to the one above, but requires one extra step, with the added benefit of better error logging and control over what happens before and after the startup of WizBot.

1. Locate the project and move to its parent directory
   * Project location example: `/home/user/wizbot/`
   * Parent directory example: `/home/user/`
2. Use the following command to create a service that will be used to execute `WizBotRun.sh`:

   ```bash
   echo "[Unit]
   Description=WizBot service
   After=network.target
   StartLimitIntervalSec=60
   StartLimitBurst=2

   [Service]
   Type=simple
   User=$USER
   WorkingDirectory=$_WORKING_DIR
   ExecStart=/bin/bash WizBotRun.sh
   Restart=on-failure
   RestartSec=5
   StandardOutput=syslog
   StandardError=syslog
   SyslogIdentifier=WizBot

   [Install]
   WantedBy=multi-user.target" | sudo tee /etc/systemd/system/wizbot.service
   ```
3. Make the new service available:
   * `sudo systemctl daemon-reload`
4. Use the following command to create a script that will be used to start WizBot:

   ```bash
   {
   echo '#!/bin/bash'
   echo ""
   echo "echo \"Running WizBot in the background with auto restart\"
   youtube-dl -U

   # If you want WizBot to be compiled prior to every startup, uncomment the lines
   # below. Note  that it's not necessary unless you are personally modifying the
   # source code.
   #echo \"Compiling WizBot...\"
   #cd \"$PWD\"/wizbot
   #dotnet build src/WizBot/WizBot.csproj -c Release -o output/

   echo \"Starting WizBot...\"

   while true; do
       if [[ -d $PWD/wizbot/output ]]; then
           cd $PWD/wizbot/output || {
               echo \"Failed to change working directory to $PWD/wizbot/output\" >&2
               echo \"Ensure that the working directory inside of '/etc/systemd/system/wizbot.service' is correct\"
               echo \"Exiting...\"
               exit 1
           }
       else
           echo \"$PWD/wizbot/output doesn't exist\"
           exit 1
       fi
       
       dotnet WizBot.dll || {
           echo \"An error occurred when trying to start NadekBot\"
           echo \"Exiting...\"
           exit 1
       }
       
       echo \"Waiting for 5 seconds...\"
       sleep 5
       youtube-dl -U
       echo \"Restarting WizBot...\"
   done

   echo \"Stopping WizBot...\""
   } > WizBotRun.sh
   ```
5. Start WizBot:
   * `sudo systemctl start wizbot.service && sudo systemctl enable wizbot.service`

### Setting up WizBot on a Linux VPS (Digital Ocean Droplet)

If you want WizBot 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 WizBot on Linux Digital Ocean Droplet using the link [DigitalOcean](https://m.do.co/c/7290047d0c84) (by using this link, you will get **$10 credit** and also support WizBot)

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 WizBot** 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.

**This section is only relevant to those who want to host WizBot on DigitalOcean. Go through this whole section before setting the bot up.**

#### Prerequisites

* Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
* Download [WinSCP](https://winscp.net/eng/download.php) *(optional)*
* [Create and invite the bot](https://github.com/Wizkiller96/WizBot/blob/v4/creds-guide/README.md).

#### Starting up

* **Open PuTTY** and paste or enter your `IP address` and then click **Open**.\
  If you entered your Droplets IP address correctly, it should show **login as:** in a newly opened window.
* Now for **login as:**, type `root` and press enter.
* It should then ask for a password. Type the `root password` you have received in your e-mail address, then press Enter.

If you are running your droplet for the first time, it will most likely ask you to change your root password. To do that, copy the **password you've received by e-mail** and paste it on PuTTY.

* To paste, just right-click the window (it won't show any changes on the screen), then press Enter.
* Type a **new password** somewhere, copy and paste it on PuTTY. Press Enter then paste it again.

**Save the new password somewhere safe.**

After that, your droplet should be ready for use. [Follow the guide from the beginning](#linux-from-source) to set WizBot up on your newly created VPS.


# osx-guide

### MacOS From Source

Open Terminal (if you don't know how to, click on the magnifying glass on the top right corner of your screen and type **Terminal** on the window that pops up) and navigate to the location where you want to install the bot (for example `cd ~`)

**Installing Homebrew, wget and dotnet**

**Homebrew/wget**

*Skip this step if you already have homebrew installed*

* Copy and paste this command, then press Enter:\
  `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
* Install wget
  * `brew install wget`

**Dotnet**

* Download [.net6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0)
* Open the `.pkg` file you've downloaded and install it.
* Run this command in Terminal. There might be output. If there is, disregard it. (copy-paste the entire block)

```bash
sudo mkdir /usr/local/bin

sudo mkdir /usr/local/lib
```

* Run this command in Terminal. There won't be any output. (copy-paste the entire block):

```bash
sudo ln -s /usr/local/share/dotnet/dotnet /usr/local/bin

sudo ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/

sudo ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
```

**Installation Instructions**

1. Download and run the **new** installer script `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
2. Install prerequisites (type `1` and press enter)
3. Download the bot (type `2` and press enter)
4. Exit the installer in order to set up your `creds.yml`
5. Copy the creds.yml template `cp wizbot/output/creds_example.yml wizbot/output/creds.yml`
6. Open `wizbot/output/creds.yml` with your favorite text editor. We will use nano here
   * `nano wizbot/output/creds.yml`
7. [Enter your bot's token](#creds-guide)
   * After you're done, you can close nano (and save the file) by inputting, in order
     * `CTRL`+`X`
     * `Y`
     * `Enter`
8. Run the bot (type `3` and press enter)

**Update Instructions**

1. ⚠ Stop the bot
2. Update and run the **new** installer script `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
3. Update the bot (type `2` and press enter)
4. Run the bot (type `3` and press enter)
5. 🎉

### MacOS Manual Release installation instructions

⚠ IF YOU ARE FOLLOWING THE GUIDE ABOVE, IGNORE THIS SECTION ⚠

**Installation Instructions**

1. Download the latest release from <https://gitlab.com/WizNet/WizBot/-/releases>
   * Look for the file called "X.XX.X-osx-x64-build.tar" (where X.XX.X is a series of numbers) and download it
2. Untar it ⚠ Make sure that you change X.XX.X to the same series of numbers as in step 1!
   * `tar xf X.XX.X-osx-x64-build.tar`
3. Rename the `wizbot-osx-x64` to `wizbot`
   * `mv wizbot-osx-x64 wizbot`
4. Move into wizbot directory and make WizBot executable
   * `cd wizbot && chmod +x WizBot`
5. Copy the creds.yml template
   * `cp creds_example.yml creds.yml`
6. Open `creds.yml` with your favorite text editor. We will use nano here
   * `nano wizbot/output/creds.yml`
7. [Enter your bot's token](#creds-guide)
   * After you're done, you can close nano (and save the file) by inputting, in order
     * `CTRL`+`X`
     * `Y`
     * `Enter`
8. Run the bot
   * `./WizBot`

**Update Instructions**

1. Stop the bot
2. Download the latest release from <https://gitlab.com/WizNet/WizBot/-/releases>
   * Look for the file called "X.XX.X-osx-x64-build.tar" (where X.XX.X is a series of numbers) and download it
3. Untar it ⚠ Make sure that you change X.XX.X to the same series of numbers as in step 2!
   * `tar xf 2.99.8-osx-x64-build.tar`
4. Rename the old wizbot directory to wizbot-old (remove your old backup first if you have one, or back it up under a different name)
   * `rm -rf wizbot-old 2>/dev/null`
   * `mv wizbot wizbot-old`
5. Rename the new wizbot directory to wizbot
   * `mv wizbot-osx-x64 wizbot`
6. Remove old strings and aliases to avoid overwriting the updated versions of those files\
   ⚠ If you've modified said files, back them up instead
   * `rm wizbot-old/data/aliases.yml`
   * `rm -r wizbot-old/data/strings`
7. Copy old data
   * `cp -RT wizbot-old/data/ wizbot/data/`
8. Copy creds.yml
   * `cp wizbot-old/creds.yml wizbot/`
9. Move into wizbot directory and make the WizBot executable
   * `cd wizbot && chmod +x WizBot`
10. Run the bot
    * `./WizBot`

🎉 Enjoy

**Steps 3 - 9 as a single command**

Don't forget to change X.XX.X to match step 2.

```sh
tar xf X.XX.X-osx-x64-build.tar && \
rm -rf wizbot-old 2>/dev/null && \
mv wizbot wizbot-old && \
mv wizbot-osx-x64 wizbot && \
rm wizbot-old/data/aliases.yml && \
rm -r wizbot-old/data/strings && \
cp -RT wizbot-old/data/ wizbot/data/ && \
cp wizbot-old/creds.yml wizbot/ && \
cd wizbot && chmod +x WizBot
```


# windows-guide

### Setting Up WizBot on Windows With the Updater

| Table of Contents                                                              |
| ------------------------------------------------------------------------------ |
| [Prerequisites](#prerequisites)                                                |
| [Setup](#setup)                                                                |
| [Starting the Bot](#starting-the-bot)                                          |
| [Updating WizBot](#updating-wizbot)                                            |
| [Manually Installing the Prerequisites from the Updater](#music-prerequisites) |

*Note: If you want to make changes to Wiz's source code, please follow the* [*From Source*](#windows-from-source) *guide instead.*

*If you have Windows 7 or a 32-bit system, please refer to the* [*From Source*](#windows-from-source)*) guide.*

**Prerequisites**

* Windows 8 or later (64-bit)
* [Create a Discord Bot application and invite the bot to your server](/docs/creds-guide)

**Optional**

* [Visual Studio Code](https://code.visualstudio.com/Download) (Highly suggested if you plan on editing files)
* [Visual C++ 2010 (x86)](https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe) and [Visual C++ 2017 (x64)](https://aka.ms/vs/15/release/vc_redist.x64.exe) (both are required if you want WizBot to play music - restart Windows after installation)

**Setup**

* Download and run the [WizBot v3 Updater](https://dl.wizbot.cc/).
* Click on the + at the top left to create a new bot.
* Give your bot a name and then click **`Go to setup`** at the lower right.
* Click on **`DOWNLOAD`** at the lower right
* Click on **`Install`** next to **`Redis`**.
* **(Note: Redis is optional unless you are are using the bot on 2000+ servers)**
* Note: If Redis fails to install, install Redis manually here: [Redis Installer](https://github.com/MicrosoftArchive/redis/releases/tag/win-3.0.504) Download and run the **`.msi`** file.
* If you will use the music module, click on **`Install`** next to **`FFMPEG`** and **`Youtube-DL`**.
* If any dependencies fail to install, you can temporarily disable your Windows Defender/AV until you install them. If you don't want to, then read [the last section of this guide](#Manual-Prerequisite-Installation).
* When installation is finished, click on **`CREDS`** to the left of **`RUN`** at the lower right.
* Follow the guide on how to [Set up the creds.yml](https://github.com/Wizkiller96/WizBot/blob/v4/creds-guide/README.md) file.

**Starting the bot**

* Either click on **`RUN`** button in the updater or run the bot via its desktop shortcut.

#### If you get a "No owner channels created..." message. Please follow the creds guide again [**HERE**](https://github.com/Wizkiller96/WizBot/blob/v4/creds-guide/README.md).

**Updating WizBot**

* Make sure WizBot is closed and not running\
  (Run `.die` in a connected server to ensure it's not running).
* Open WizBot Updater
* Click on your bot at the upper left (looks like a spy).
* Click on **`Check for updates`**.
* If updates are available, you will be able to click on the Update button.
* Launch the bot
* You've updated and are running again, easy as that!

**Manual Prerequisite Installation**

You can still install them manually:

* [Redis Installer](https://github.com/MicrosoftArchive/redis/releases/tag/win-3.0.504) - Download and run the **`.msi`** file
* [ffmpeg-32bit](https://cdn.wizbot.cc/dl/ffmpeg-32.zip) | [ffmpeg-64bit](https://cdn.wizbot.cc/dl/ffmpeg-64.zip) - 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, then just move the `ffmpeg.exe` file to WizBot/system
* [youtube-dl](https://yt-dl.org/downloads/latest/youtube-dl.exe) - Click to download the file. Then put `youtube-dl.exe` in a path that's in your PATH environment variable. If you don't know what that is, then just move the `youtube-dl.exe` file to WizBot/system

### **⚠ IF YOU ARE FOLLOWING THE GUIDE ABOVE, IGNORE THIS SECTION ⚠**

#### Windows From Source

**Prerequisites**

**Install these before proceeding or your bot will not work!**

* [.net 6](https://dotnet.microsoft.com/download/dotnet/6.0) - needed to compile and run the bot
* [git](https://git-scm.com/downloads) - needed to clone the repository (you can also download the zip manually and extract it, but this guide assumes you're using git)
* [redis](https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.msi) - to cache things needed by some features and persist through restarts

**Installation Instructions**

Open PowerShell (press windows button on your keyboard and type powershell, it should show up; alternatively, right click the start menu and select Windows PowerShell), and navigate to the location where you want to install the bot (for example `cd ~/Desktop/`)

1. `git clone https://gitlab.com/WizNet/WizBot -b v4 --depth 1`
2. `cd wizbot`
3. `dotnet publish -c Release -o output/ src/WizBot/`
4. `cd output`
5. `cp creds_example.yml creds.yml`
6. Open `creds.yml` with your favorite text editor (Please don't use Notepad or WordPad. You can use Notepad++, VSCode, Atom, Sublime, or something similar)
7. [Enter your bot's token](#creds-guide)
8. Run the bot `dotnet WizBot.dll`
9. 🎉

**Update Instructions**

Open PowerShell as described above and run the following commands:

1. Stop the bot

* ⚠️ Make sure you don't have your database, credentials or any other wizbot folder open in some application, this might prevent some of the steps from executing succesfully

2. Navigate to your bot's folder, example:
   * `cd ~/Desktop/wizbot`
3. Pull the new version
   * `git pull`
   * ⚠️ If this fails, you may want to stash or remove your code changes if you don't know how to resolve merge conflicts
4. **Backup** old output in case your data is overwritten
   * `cp -r -fo output/ output-old`
5. Build the bot again
   * `dotnet publish -c Release -o output/ src/WizBot/`
6. Remove old strings and aliases to avoid overwriting the updated versions of those files
   * ⚠ If you've modified said files, back them up instead
   * `rm output-old/data/aliases.yml`
   * `rm -r output-old/data/strings`
7. Copy old data
   * `cp -Recurse .\output-old\data\ .\output\ -Force`
8. Copy creds.yml
   * `cp output-old/creds.yml output/`
9. Run the bot
   * `cd output`
   * `dotnet WizBot.dll`

🎉 Enjoy

**Music prerequisites**

In order to use music commands, you need ffmpeg and youtube-dl installed.

* [ffmpeg-32bit](https://cdn.wizbot.cc/dl/ffmpeg-32.zip) | [ffmpeg-64bit](https://cdn.wizbot.cc/dl/ffmpeg-64.zip) - 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 `WizBot/output`.
* [youtube-dl](https://yt-dl.org/downloads/latest/youtube-dl.exe) - 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 `WizBot/system`.


# medusa


# Creating A Medusa

## Theory

### Introduction

Medusa system allows you to write independent medusae (known as "modules", "cogs" or "plugins" in other software) which you can then load, unload and update at will without restarting the bot.

The system itself borrows some design from the current way WizBot's Modules are written but mostly from never-released `Ayu.Commands` system which was designed to be used for a full WizBot v3 rewrite.

The medusa base classes used for development are open source [here](https://gitlab.com/WizNet/WizBot/-/tree/v4/src/WizBot.Medusa) in case you need reference, as there is no generated documentation at the moment.

### Term list

#### Medusa

* The project itself which compiles to a single `.dll` (and some optional auxiliary files), it can contain multiple [Sneks](#snek), [Services](#service), and [ParamParsers](#param-parser)

#### Snek

* A class which will be added as a single Module to WizBot on load. It also acts as a [lifecycle handler](/docs/medusa/snek-lifecycle) and as a singleton service with the support for initialize and cleanup.
* It can contain a Snek (called SubSnek) but only 1 level of nesting is supported (you can only have a snek contain a subsnek, but a subsnek can't contain any other sneks)
* Sneks can have their own prefix
  * For example if you set this to 'test' then a command called 'cmd' will have to be invoked by using `.test cmd` instead of `.cmd`

#### Snek Command

* Acts as a normal command
* Has context injected as a first argument which controls where the command can be executed
  * `AnyContext` the command can be executed in both DMs and Servers
  * `GuildContext` the command can only be executed in Servers
  * `DmContext` the command can only be executed in DMs
* Support the usual features such as default values, leftover, params, etc.
* It also supports dependency injection via `[inject]` attribute. These dependencies must come after the context and before any input parameters
* Supports `ValueTask`, `Task`, `Task<T>` and `void` return types

#### Param Parser

* Allows custom parsing of command arguments into your own types.
* Overriding existing parsers (for example for IGuildUser, etc...) can cause issues.

#### Service

* Usually not needed.
* They are marked with a `[svc]` attribute, and offer a way to inject dependencies to different parts of your medusa.
* Transient and Singleton lifetimes are supported.

### Localization

Response and command strings can be kept in one of three different places based on whether you plan to allow support for localization

option 1) `res.yml` and `cmds.yml`

If you don't plan on having your app localized, but you just *may* in the future, you should keep your strings in the `res.yml` and `cmds.yml` file the root folder of your project, and they will be automatically copied to the output whenever you build your medusa.

**Example project folder structure:**

```
- uwu/
    - uwu.csproj
    - uwu.cs
    - res.yml
    - cmds.yml  
```

**Example output folder structure:**

```
- medusae/uwu/  
    - uwu.dll  
    - res.yml  
    - cmds.yml
```

option 2) `strings` folder

If you plan on having your app localized (or want to allow your consumers to easily add languages themselves), you should keep your response strings in the `strings/res/en-us.yml` and your command strings in `strings/cmds/en-us.yml` file. This will be your base file, and from there you can make support for additional languages, for example `strings/res/ru-ru.yml` and `strings/cmds/ru-ru.yml`

**Example project folder structure:**

```
- uwu/
    - uwu.csproj
    - uwu.cs
    - strings/
        - res/
            - en-us.yml
            - ru-ru.yml
        - cmds/
            - en-us.yml
            - ru-ru.yml
```

**Example output folder structure:**

```
- medusae/uwu/
    - uwu.dll
    - strings/
        - res/
            - en-us.yml
            - ru-ru.yml
        - cmds/
            - en-us.yml
            - ru-ru.yml
```

option 3) In the code

If you don't want any auxiliary files, and you don't want to bother making new .yml files to keep your strings in, you can specify the command strings directly in the `[cmd]` attribute itself, and use non-localized methods for message sending in your commands.

If you update your response strings .yml file(s) while the medusa is loaded and running, running `.stringsreload` will reload the responses without the need to reload the medusa or restart the bot.

#### Config

* Medusa config is kept in `medusae/medusa.yml` file
* At the moment this config only keeps track of which medusae are currently loaded (they will also be always loaded at startup)
* If a medusa is causing issues and you're unable to unload it, you can remove it from the `loaded:` list in this config file and restart the bot. It won't be loaded next time the bot is started up

#### Unloadability issues

To make sure your medusa can be properly unloaded/reloaded you must:

* Make sure that none of your types and objects are referenced by the Bot or Bot's services after the DisposeAsync is called on your Snek instances.
* Make sure that all of your commands execute quickly and don't have any long running tasks, as they will hold a reference to a type from your assembly
* If you are still having issues, you can always run `.meunload` followed by a bot restart, or if you want to find what is causing the medusa unloadability issues, you can check the [microsoft's assembly unloadability debugging guide](https://docs.microsoft.com/en-us/dotnet/standard/assembly/unloadability)

## Practice

This section will guide you through how to create a simple custom medusa. You can find the entirety of this code hosted [here](https://gitlab.com/WizNet/example_medusa)

#### Prerequisite

* [.net6 sdk](https://dotnet.microsoft.com/en-us/download) installed
* Optional: use [vscode](https://code.visualstudio.com/download) to write code

#### Guide

* Open your favorite terminal and navigate to a folder where you will keep your project .
* Create a new folder
  * `mkdir example_medusa`
* Create a new .net class library
  * `dotnet new classlib`
* Open the current folder with your favorite editor/IDE. In this case we'll use VsCode
  * `code .`
* Remove the `Class1.cs` file
* Replace the contents of the `.csproj` file with the following contents

```xml
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        
        <!-- Reduces some boilerplate in your .cs files -->
        <ImplicitUsings>enable</ImplicitUsings>
        
        <!-- 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>
    </PropertyGroup>
    
    <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="WizBot.Medusa" Version="4.3.9">
            <PrivateAssets>all</PrivateAssets>
        </PackageReference>

        <!-- Note: If you want to use WizBot services etc... You will have to manually clone 
          the gitlab.com/WizNet/WizBot repo locally and reference the WizBot.csproj because there is no WizBot package atm.
          It is strongly recommended that you checkout a specific tag which matches your version of wizbot,
          as there could be breaking changes even between minor versions of WizBot.
          For example if you're running WizBot 4.1.0 locally for which you want to create a medusa for,
          you should do "git checkout 4.1.0" in your WizBot solution and then reference the WizBot.csproj
        -->
    </ItemGroup>
    
    <!-- Copy shortcut and full strings to output (if they exist) -->
    <ItemGroup>
        <None Update="res.yml;cmds.yml;strings/**">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>
</Project>

```

* Create a `MySnek.cs` file and add the following contents

```cs
using WizBot.Snake;
using WizBot;
using Discord;

public sealed class MySnek : Snek
{
    [cmd]
    public async Task Hello(AnyContext ctx)
    {
        await ctx.Channel.SendMessageAsync($"Hello everyone!");
    }

    [cmd]
    public async Task Hello(AnyContext ctx, IUser target)
    {
        await ctx.ConfirmLocalizedAsync("hello", target);
    }
}
```

* Create `res.yml` and `cmds.yml` files with the following contents `res.yml`

```yml
medusa.description: "This is my medusa's description"
hello: "Hello {0}, from res.yml!"
```

`cmds.yml`

```yml
hello: 
  desc: "This is a basic hello command"
  args:
    - ""
    - "@Someone"
```

* Add `NuGet.Config` file which will let you use the base WizBot.Medusa package. This file should always look like this and you shouldn't change it

```xml
<configuration>
    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="wizbot.cc" value="https://www.myget.org/F/wizbot/api/v3/index.json" protocolVersion="3" />
    </packageSources>
</configuration>
```

### Build it

* Build your Medusa into a dll that WizBot can load. In your terminal, type:
  * `dotnet publish -o bin/medusae/example_medusa /p:DebugType=embedded`
* Done. You can now try it out in action.

### Try it out

* Copy the `bin/medusae/example_medusa` folder into your WizBot's `data/medusae/` folder. (WizBot version 4.1.0+)
* Load it with `.meload example_medusa`
* In the channel your bot can see, run the following commands to try it out
  * `.hello` and
  * `.hello @<someone>`
* Check its information with
  * `.meinfo example_medusa`
* Unload it
  * `.meunload example_medusa`
* Congrats! You've just made your first medusa!


# Getting Started

## What is the Medusa system?

* It is a dynamic module/plugin/cog system for WizBot introduced in **WizBot 4.1.0**
* Allows developers to add custom functionality to WizBot without modifying the original code
* Allows for those custom features to be updated during bot runtime (if properly written), without the need for bot restart.
* They are added to `data/medusae` folder and are loaded, unloaded and handled through discord commands.
  * `.meload` Loads the specified medusa (see `.h .meload`)
  * `.meunload` Unloads the specified medusa (see `.h .meunload`)
  * `.meinfo` Checks medusae information (see `.h .meinfo`)
  * `.melist` Lists the available medusae (see `.h .melist`)

## How to make one?

Medusae are written in [C#](https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/) programming language, so you will need at least low-intermediate knowledge of it in order to make a useful Medusa.

Follow the [creating a medusa guide](/docs/medusa/creating-a-medusa)

## Where to get medusae other people made?

⚠ *It is EXTREMELY, and I repeat **EXTREMELY** dangerous to run medusae of strangers or people you don't FULLY trust.* ⚠\
⚠ *It can not only lead to your bot being stolen, but it also puts your entire computer and personal files in jeopardy.* ⚠

**It is strongly recommended to run only the medusae you yourself wrote, and only on a hosted VPS or dedicated server which ONLY hosts your bot, to minimize the potential damage caused by bad actors.**

No easy way at the moment.


# Snek Lifecycle

*You can override several methods to hook into command handler's lifecycle.*\
*These methods start with `Exec*`*

* `ExecOnMessageAsync` runs first right after any message was received
* `ExecInputTransformAsync` runs after ExecOnMessageAsync and allows you to transform the message content before the bot looks for the matching command
* `ExecPreCommandAsync` runs after a command was found but not executed, allowing you to potentially prevent command execution
* `ExecPostCommandAsync` runs if the command was successfully executed
* `ExecOnNoCommandAsync` runs instead of ExecPostCommandAsync if no command was found for a message

*Besides that, sneks have 2 methods with which you can initialize and cleanup your snek*

* `InitializeAsync` Runs when the medusa which contains this snek is being loaded
* `DisposeAsync` Runs when the medusa which contains this snek is being unloaded


# .gitlab


# issue\_templates


# Bug

#### Description

Write here a summary of the issue you're having.

#### Version

* Write here whether you're using public WizBot or hosting one yourself.
* If you are hosting, write down:
  * The bot version (run the command .stats on Discord).
  * Your operating system and its version.
    * If you are on Windows, tell us whether you're using the updater version or the source version.
    * If you are on Linux or OSX, tell us if you're hosting with tmux or pm2 or any other solution for managing processes.

#### Reproduction Steps

* Describe, in detail, the steps necessary to consistently reproduce the issue.
* Preferably write the entire procedure in step-by-step instructions.

#### Expected Behavior

Write here the behavior you were expecting to get from the bot.

#### Actual Behavior

Write here the behavior you actually got from the bot.

#### Screenshots

Include here any relevant screenshot that illustrates the issue you're having or that might help pinpoint the cause of the bug.

#### Notes

Write here anything else you want to say that wasn't covered on the previous topics.


# Feature\_Request

GitLab is for bug reports only.\
Please, head over to <https://wizbot.cc/discord> to make feature requests.


# Question

GitLab is for bug reports only.\
Please, head over to our support server at <https://wizbot.com/discord> and ask your question in the #help channel.


# merge\_request\_templates


# Merge\_Request

#### Description

Write here a summary of the change(s) you're proposing and why this merge request would be a necessary or a nice addition to the project.

#### Changes Proposed

Describe, item by item, all changes you'd like to propose. Write them in a list, one proposition per line. For example:

* Adds `DoStuff()` method to service X.
* Changes `SomeMethod()` on service Y, so it can handle situation Z better.
* Added a try/catch *somewhere*, so an exception is not thrown on the console when *something* happens.
* Replaced `AMethod()` by `AnotherMethod()` in *some command* for performance reasons.

#### Details

Elaborate on the major and minor changes you've made to the source code. Try to explain why you've done something in a certain way.

#### Screenshots

If applicable, send us screenshots of the result of your changes.

#### Notes

Write here additional considerations that weren't covered on the previous topics.


# src


# Coordinator project

Grpc-based coordinator useful for sharded WizBot. Its purpose is controlling the lifetime and checking status of the shards it creates.

### Supports

* Checking status
* Individual shard restarts
* Full shard restarts
* Graceful coordinator restarts (restart/update coordinator without killing shards)
* Kill/Stop


# Generators

Project which contains source generators required for WizBot project

***

## 1) Localized Strings Generator

```
-- Why --
Type safe response strings access, and enforces correct usage of response strings.

-- How it works --
Creates a file "strs.cs" containing a class called "strs" in "WizBot" namespace.

Loads "data/strings/responses.en-US.json" and creates a property or a function for each key in the responses json file based on whether the value has string format placeholders or not.

- If a value has no placeholders, it creates a property in the strs class which returns an instance of a LocStr struct containing only the key and no replacement parameters

- If a value has placeholders, it creates a function with the same number of arguments as the number of placeholders, and passes those arguments to the LocStr instance

-- How to use --
1. Add a new key to responses.en-US.json "greet_me": "Hello, {0}"
2. You now have access to a function strs.greet_me(obj p1)
3. Using "GetText(strs.greet_me("Me"))" will return "Hello, Me"
```


# WizBot.Medusa

This is the library which is the base of any medusa.


# WizBot.Tests

Project which contains tests. Self explanatory


# Votes Api

This api is used if you want your bot to be able to reward users who vote for it on discords.com or top.gg

### \[GET] `/discords/new`

```
Get the discords votes received after previous call to this endpoint.
Input full url of this endpoint in your creds.yml file under Discords url field.
For example "https://api.my.cool.bot/discords/new"
```

### \[GET] `/topgg/new`

```
Get the topgg votes received after previous call to this endpoint.
Input full url of this endpoint in your creds.yml file under Topgg url field.
For example "https://api.my.cool.bot/topgg/new"
```

### \[POST] `/discordswebhook`

```
Input this endpoint as the webhook on discords.com bot edit page
model: https://docs.botsfordiscord.com/methods/receiving-votes
For example "https://api.my.cool.bot/topggwebhook"
```

### \[POST] `/topggwebhook`

```
Input this endpoint as the webhook https://top.gg/bot/:your-bot-id/webhooks (replace :your-bot-id with your bot's id)
model: https://docs.top.gg/resources/webhooks/#schema
For example "https://api.my.cool.bot/discordswebhook"
```

Input your super-secret header value in appsettings.json's DiscordsKey and TopGGKey fields They must match your DiscordsKey and TopGG key respectively, as well as your secrets in the discords.com and top.gg webhook setup pages

Full Example:

⚠ Change TopggKey and DiscordsKey to a secure long string\
⚠ You can use <https://www.random.org/strings/?num=1\\&len=20\\&digits=on\\&upperalpha=on\\&loweralpha=on\\&unique=on\\&format=html\\&rnd=new> to generate it

`creds.yml`

```yml
votes:
    TopggServiceUrl: "https://api.my.cool.bot/topgg"
    TopggKey: "my_topgg_key"
    DiscordsServiceUrl: "https://api.my.cool.bot/discords"
    DiscordsKey: "my_discords_key"
```

`appsettings.json`

```json
...
  "DiscordsKey": "my_discords_key",
  "TopGGKey": "my_topgg_key",
...
```


