Class: ESM::Event::SendToChannel
- Inherits:
-
Object
- Object
- ESM::Event::SendToChannel
- Defined in:
- lib/esm/event/send_to_channel.rb
Instance Method Summary collapse
-
#initialize(server, message) ⇒ SendToChannel
constructor
A new instance of SendToChannel.
- #run! ⇒ Object
Constructor Details
#initialize(server, message) ⇒ SendToChannel
Returns a new instance of SendToChannel.
6 7 8 9 |
# File 'lib/esm/event/send_to_channel.rb', line 6 def initialize(server, ) @server = server @message = end |
Instance Method Details
#run! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/esm/event/send_to_channel.rb', line 11 def run! check_for_access! # If the content is a hashmap, the data is for an embed content = @message.data.content = if ( = ESM::Arma::HashMap.from(content)) && .present? () else "*Sent from `#{@server.server_id}`*\n#{content}" end ESM.bot.deliver(, to: @channel) rescue ESM::Exception::CheckFailure => e @server.log_error(e.) end |