Browse Source

add "real" field to Vrobot4::Server::Message

master
Alison Watson 2 years ago
parent
commit
9c20aabb84
2 changed files with 5 additions and 1 deletions
  1. +2
    -1
      source/backends/discord.rb
  2. +3
    -0
      source/server.rb

+ 2
- 1
source/backends/discord.rb View File

@@ -170,7 +170,8 @@ module Backend_Discord
serv: serv,
bot: self,
reply: -> (text) {evt.channel.send text},
reply_b: -> (text) {evt.channel.send "```\n#{text}```"}
reply_b: -> (text) {evt.channel.send "```\n#{text}```"},
real: evt.message

serv.handle_text_cmd m
end


+ 3
- 0
source/server.rb View File

@@ -22,6 +22,7 @@ module Vrobot4::Server
attr_reader :chan # @return [Channel] channel this message was sent to
attr_reader :serv # @return [Server] server this message was sent to
attr_reader :bot # @return [Vrobot4::Robots::Bot] bot this was sent to
attr_reader :real # @return the original message, if any

# @param info [Hash] A hash containing message info. Keys may be omitted.
# [:msg] Plaintext of message.
@@ -31,6 +32,7 @@ module Vrobot4::Server
# [:bot] Bot this message was sent to.
# [:reply] Method that sends a message to the specified channel.
# [:reply_b] Method that sends a large message to the specified channel.
# [:real] The original message, if any.
def initialize(**info)
@msg = info[:msg]
@user = info[:user]
@@ -39,6 +41,7 @@ module Vrobot4::Server
@bot = info[:bot]
@reply = info[:reply]
@reply_b = info[:reply_b]
@real = info[:real]
end

# Sends a message to the originating channel.


Loading…
Cancel
Save