Plugin
public protocol Plugin : _Plugin
A Plugin contains Commands and Listeners, usually grouped by purpose and can be registered to the main SwiftHooks class.
class MyPlugin: Plugin {
var commands: some Commands {
Command("ping")
.execute { (hooks, event) in
event.message.reply("Pong!")
}
}
var listeners: some EventListeners {
Listener(Global.messageCreate) { event, message in
print("Message: \(message.content)")
}
}
}
-
Declaration
Swift
associatedtype C : Commands -
Declaration
Swift
associatedtype L : EventListeners -
commandsDefault implementation -
listenersDefault implementation
View on GitHub
Plugin Protocol Reference