Protocols
The following protocols are available globally.
-
Check if the given user has the permission to execute the command.
See morelet checker = MyChecker() guard checker.check(user, canUse: command, on: event) else { throw CommandError.InvalidPermissions }
Declaration
Swift
public protocol CommandPermissionChecker
-
Declaration
Swift
public protocol AnyFuture
-
Marks a type as
CommandArgumentConvertible
.These types can be created from one or more arguments passed into a command.
See moreDeclaration
Swift
public protocol CommandArgumentConvertible
-
Marks a type as both
CommandArgumentConvertible
andConsuming
.ConsumingCommandArgumentConvertible
types will not take a single arguments, but rather[x...]
, consuming the entire list of arguments. Examples of arguments that support consuming areArray
andString.Consuming
Declaration
Swift
public protocol ConsumingCommandArgumentConvertible : AnyConsuming, CommandArgumentConvertible
-
A representation of an unresolved argument
See moreDeclaration
Swift
public protocol CommandArgument : CustomStringConvertible
-
Any type capable of consuming.
See also
ConsumingCommandArgumentConvertible
Declaration
Swift
public protocol AnyConsuming
-
Declaration
Swift
public protocol Commands
-
Declaration
Swift
public protocol _ExecutableCommand : Commands
-
Base
See moreExecutableCommand
Declaration
Swift
public protocol ExecutableCommand : _ExecutableCommand
-
A Hook within
See moreSwiftHooks
is a backend implementation emitting events. For example Discord, Slack or GitHubDeclaration
Swift
public protocol Hook : _Hook
-
Declaration
Swift
public protocol _Hook
-
Declaration
Swift
public protocol HookOptions
-
Declaration
Swift
public protocol EventListeners
-
Base plugin type. Used for array storage.
Declaration
Swift
public protocol _Plugin
-
A
Plugin
containsCommands
andListeners
, usually grouped by purpose and can be registered to the mainSwiftHooks
class.
See moreclass 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
public protocol Plugin : _Plugin
-
A generic channel used in
See moreGlobalEvent
s.Declaration
Swift
public protocol Channelable : PayloadType
-
Declaration
Swift
public protocol EventDispatch
-
Declaration
Swift
public protocol EventType : Hashable
-
Declaration
Swift
public protocol PayloadType : Decodable
-
Declaration
Swift
public protocol _Event : Hashable
-
Declaration
Swift
public protocol _GEvent : Hashable
-
A generic message used in
See moreGlobalEvent
s.Declaration
Swift
public protocol Messageable : PayloadType
-
A generic user used in
See moreGlobalEvent
s.Declaration
Swift
public protocol Userable : PayloadType