This commit is contained in:
2022-12-17 12:38:21 +02:00
parent 79731a9704
commit 4a5e0ef2f3

View File

@@ -20,23 +20,9 @@ Plugin Types:
### How to create a plugin ### How to create a plugin
First of all, Create a new project (class library) in Visual Studio. First of all, Create a new project (class library) in Visual Studio.
![Imgur Image](https://i.imgur.com/KUqzKsB.png) Then import the PluginManager.dll as project to your project.
![Imgur Image](https://i.imgur.com/JzpEViR.png) ## 1. Commands
![Imgur Image](https://i.imgur.com/vtoEepX.png)
![Imgur Image](https://i.imgur.com/ceaVR2R.png)
Now, let's add the PluginManager reference. It can be found inside the bot's main folder under
`DiscordBot/bin/Debug/net6.0/PluginManager.dll` or `PluginManager/bin/Debug/net6.0/PluginManager.dll`
after one successfull build.
![Imgur Image](https://i.imgur.com/UMSitk4.png)
![Imgur Image](https://i.imgur.com/GEjShdl.png)
1. Commands
Commands are loaded when all plugins are loaded into memory. When an user executes the command, only then the Execute function is called. Commands are loaded when all plugins are loaded into memory. When an user executes the command, only then the Execute function is called.
Commands are plugins that allow users to interact with them. Commands are plugins that allow users to interact with them.
@@ -103,7 +89,7 @@ From here on, start coding. When your plugin is done, build it as any DLL projec
Then, reload bot and execute command `lp` in bot's console. The plugin should be loaded into memory or an error is thrown if not. If an error is thrown, then Then, reload bot and execute command `lp` in bot's console. The plugin should be loaded into memory or an error is thrown if not. If an error is thrown, then
there is something wrong in your command's code. there is something wrong in your command's code.
2. Events ## 2. Events
Events are loaded when all plugins are loaded. At the moment when they are loaded, the Start function is called. Events are loaded when all plugins are loaded. At the moment when they are loaded, the Start function is called.
Events are used if you want the bot to do something when something happens in server. The following example shows you how to catch when a user joins the server Events are used if you want the bot to do something when something happens in server. The following example shows you how to catch when a user joins the server
@@ -137,7 +123,7 @@ public class OnUserJoin : DBEvent
- client - the discord bot client - client - the discord bot client
3.Slash Commands ## 3. Slash Commands
Slash commands are server based commands. They work the same way as normal commands, but they require the `/` prefix as they are integrated Slash commands are server based commands. They work the same way as normal commands, but they require the `/` prefix as they are integrated