class DiscordMiddleware::Prefix

Overview

Middleware that passes if the given message in the context starts with a specified string.

client.on_message_create(Prefix.new("!ping")) do |payload|
  channel_id = payload.channel_id
  client.create_message(channel_id, "pong")
end

Defined in:

discordcr-middleware/middleware/prefix.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(prefix : String | Char) #

[View source]

Instance Method Detail

def call(payload : Discord::Message, context : Discord::Context, &block) #

[View source]