Class: Libfchat::Fchat
- Inherits:
-
Object
- Object
- Libfchat::Fchat
- Defined in:
- lib/libfchat/fchat.rb
Instance Attribute Summary collapse
-
#chat_max ⇒ Object
readonly
Returns the value of attribute chat_max.
-
#clientname ⇒ Object
readonly
Returns the value of attribute clientname.
-
#friends ⇒ Object
readonly
Returns the value of attribute friends.
-
#ignore ⇒ Object
readonly
Returns the value of attribute ignore.
-
#lfrp_flood ⇒ Object
readonly
Returns the value of attribute lfrp_flood.
-
#lfrp_max ⇒ Object
readonly
Returns the value of attribute lfrp_max.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#me ⇒ Object
readonly
Returns the value of attribute me.
-
#msg_flood ⇒ Object
readonly
Returns the value of attribute msg_flood.
-
#ops ⇒ Object
readonly
Returns the value of attribute ops.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
-
#priv_max ⇒ Object
readonly
Returns the value of attribute priv_max.
-
#rooms ⇒ Object
readonly
Returns the value of attribute rooms.
-
#ticket ⇒ Object
readonly
Returns the value of attribute ticket.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#websocket ⇒ Object
readonly
Returns the value of attribute websocket.
Instance Method Summary collapse
-
#ACB(character) ⇒ Object
Performs an account ban against a characters account.
-
#AOP(character) ⇒ Object
Adds a character to the chat operator list.
-
#AWC(character) ⇒ Object
Requests a list of currently connected alts for a characters account.
-
#BRO(message) ⇒ Object
Broadcasts a message to all connections.
-
#CBL(channel) ⇒ Object
Request the channel banlist.
-
#CBU(channel, character) ⇒ Object
Bans a character from a channel.
-
#CCR(channel) ⇒ Object
Create an Ad-hoc Channel.
-
#CDS(channel, description) ⇒ Object
This command is used by an admin or channel owner to set a new channel description.
-
#CHA ⇒ Object
Request a list of all public channels.
-
#CIU(channel, character) ⇒ Object
Sends an invitation for a channel to a user.
-
#CKU(channel, character) ⇒ Object
Kick a user from a channel.
-
#COA(channel, character) ⇒ Object
Op a user in a channel.
-
#COL(channel) ⇒ Object
Request a list of channel ops.
-
#CRC(channel) ⇒ Object
Creates a global channel.
-
#CUB(channel, character) ⇒ Object
Unban a user from a channel.
-
#DOP(character) ⇒ Object
Request that a character be stripped of chatop status.
-
#FKS(kink, genders) ⇒ Object
Do a search for a kink with specific genders.
-
#got_ADL(message) ⇒ Object
Store list of ops.
-
#got_CDS(message) ⇒ Object
Store description for newly joined chatroom.
-
#got_CIU(message) ⇒ Object
Join chatrooms on invite.
-
#got_COL(message) ⇒ Object
Store ops list for room.
-
#got_FLN(message) ⇒ Object
Handle user logging off.
-
#got_FRL(message) ⇒ Object
Store list of friends.
-
#got_ICH(message) ⇒ Object
Store userlist for newly joined chatroom.
-
#got_IDN(message) ⇒ Object
Know thyself.
-
#got_IGN(message) ⇒ Object
Store list of ignored users.
-
#got_JCH(message) ⇒ Object
Store data about newly joined chatroom.
-
#got_LCH(message) ⇒ Object
Handle user leaving chatroom.
-
#got_LIS(message) ⇒ Object
Store list of online users.
-
#got_NLN(message) ⇒ Object
Handle user logging on.
-
#got_PIN(message) ⇒ Object
Respond to keepalive ping messages.
-
#got_STA(message) ⇒ Object
Handle user changing status.
-
#got_VAR(message) ⇒ Object
Store server-side variables.
-
#IDN(account, character, ticket, cname = @clientname, cversion = @version, method = "ticket") ⇒ Object
This command is used to identify with the server.
-
#IGN(action, character) ⇒ Object
Deal with ignoring characters.
-
#initialize(clientname = "libfchat-ruby by Jippen Faddoul ( http://github.com/jippen/libfchat-ruby )", version = Libfchat::VERSION, level = Logger::DEBUG) ⇒ Fchat
constructor
Initialize the object with the name and version.
-
#IPB(character) ⇒ Object
Request that a character be IP banned.
-
#JCH(channel) ⇒ Object
Send a channel join request.
-
#KIK(character) ⇒ Object
Request a character to be kicked.
-
#KIN(character) ⇒ Object
Request a character’s list of kinks.
-
#LCH(channel) ⇒ Object
Leave a channel.
-
#login(server, account, password, character, timeout = 30) ⇒ Object
Login to fchat as a specific user, and start the event machine.
-
#method_missing(method_name, *args, &block) ⇒ Object
Some method_missing magic to make ruby handle just throwing around commands that may or may not exist.
-
#MSG(channel, message) ⇒ Object
Send a message to a channel.
-
#OPP ⇒ Object
List presence of ops in all rooms.
-
#ORS ⇒ Object
Request a list of open private rooms.
-
#parse_message(msg) ⇒ Object
Parse message received from server.
-
#PIN ⇒ Object
Respond to a ping request.
-
#PRI(recipient, message) ⇒ Object
Sends a prive message to another user.
-
#PRO(character) ⇒ Object
Do a profile request.
-
#RAN(channel) ⇒ Object
Advertises the first open private channel owned by the client in the given channel.
-
#RLL(channel, dice) ⇒ Object
Roll dice in a channel.
-
#RST(channel, status) ⇒ Object
Set a private room’s status to closed or open.
-
#RWD(character) ⇒ Object
Reward a user, for instance, for finding a bug.
-
#send_message(type, json) ⇒ Object
Generic message sender.
-
#STA(status, statusmsg) ⇒ Object
Request a new status to be set for your character.
-
#TMO(character, time, reason) ⇒ Object
Admin or chatop command to request a timeout for a user time must be a minimum of one minute, and maximum of 90 minutes.
-
#to_yaml_properties ⇒ Object
Remove useless properties from to_yaml conversion.
-
#TPN(character, status) ⇒ Object
User x is typing/stopped typing/entered text for private messages.
-
#UBN(character) ⇒ Object
Unban a character.
Constructor Details
#initialize(clientname = "libfchat-ruby by Jippen Faddoul ( http://github.com/jippen/libfchat-ruby )", version = Libfchat::VERSION, level = Logger::DEBUG) ⇒ Fchat
Initialize the object with the name and version. Default to just identifying as the library
44 45 46 47 48 49 50 51 |
# File 'lib/libfchat/fchat.rb', line 44 def initialize(clientname="libfchat-ruby by Jippen Faddoul ( http://github.com/jippen/libfchat-ruby )",version=Libfchat::VERSION, level=Logger::DEBUG) @clientname = clientname @version = version @users = InsensitiveHash.new @rooms = InsensitiveHash.new @logger = Logger.new(STDOUT) @logger.level = level end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
Some method_missing magic to make ruby handle just throwing around commands that may or may not exist.
57 58 59 60 61 62 63 64 |
# File 'lib/libfchat/fchat.rb', line 57 def method_missing(method_name, *args, &block) # Try to handle all three-letter strings if method_name.to_s[4,7] =~ /[A-Z]{3}/ return nil else super(method_name,*args,&block) end end |
Instance Attribute Details
#chat_max ⇒ Object (readonly)
Returns the value of attribute chat_max.
26 27 28 |
# File 'lib/libfchat/fchat.rb', line 26 def chat_max @chat_max end |
#clientname ⇒ Object (readonly)
Returns the value of attribute clientname.
23 24 25 |
# File 'lib/libfchat/fchat.rb', line 23 def clientname @clientname end |
#friends ⇒ Object (readonly)
Returns the value of attribute friends.
33 34 35 |
# File 'lib/libfchat/fchat.rb', line 33 def friends @friends end |
#ignore ⇒ Object (readonly)
Returns the value of attribute ignore.
34 35 36 |
# File 'lib/libfchat/fchat.rb', line 34 def ignore @ignore end |
#lfrp_flood ⇒ Object (readonly)
Returns the value of attribute lfrp_flood.
29 30 31 |
# File 'lib/libfchat/fchat.rb', line 29 def lfrp_flood @lfrp_flood end |
#lfrp_max ⇒ Object (readonly)
Returns the value of attribute lfrp_max.
28 29 30 |
# File 'lib/libfchat/fchat.rb', line 28 def lfrp_max @lfrp_max end |
#logger ⇒ Object
Returns the value of attribute logger.
38 39 40 |
# File 'lib/libfchat/fchat.rb', line 38 def logger @logger end |
#me ⇒ Object (readonly)
Returns the value of attribute me.
24 25 26 |
# File 'lib/libfchat/fchat.rb', line 24 def me @me end |
#msg_flood ⇒ Object (readonly)
Returns the value of attribute msg_flood.
30 31 32 |
# File 'lib/libfchat/fchat.rb', line 30 def msg_flood @msg_flood end |
#ops ⇒ Object (readonly)
Returns the value of attribute ops.
35 36 37 |
# File 'lib/libfchat/fchat.rb', line 35 def ops @ops end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
31 32 33 |
# File 'lib/libfchat/fchat.rb', line 31 def @permissions end |
#priv_max ⇒ Object (readonly)
Returns the value of attribute priv_max.
27 28 29 |
# File 'lib/libfchat/fchat.rb', line 27 def priv_max @priv_max end |
#rooms ⇒ Object (readonly)
Returns the value of attribute rooms.
37 38 39 |
# File 'lib/libfchat/fchat.rb', line 37 def rooms @rooms end |
#ticket ⇒ Object (readonly)
Returns the value of attribute ticket.
19 20 21 |
# File 'lib/libfchat/fchat.rb', line 19 def ticket @ticket end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
36 37 38 |
# File 'lib/libfchat/fchat.rb', line 36 def users @users end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
22 23 24 |
# File 'lib/libfchat/fchat.rb', line 22 def version @version end |
#websocket ⇒ Object (readonly)
Returns the value of attribute websocket.
20 21 22 |
# File 'lib/libfchat/fchat.rb', line 20 def websocket @websocket end |
Instance Method Details
#ACB(character) ⇒ Object
Performs an account ban against a characters account.
*This command requires chat op or higher.*
277 278 279 280 |
# File 'lib/libfchat/fchat.rb', line 277 def ACB(character) json = {:character => character} self.('ACB',json) end |
#AOP(character) ⇒ Object
Adds a character to the chat operator list.
*This command is admin only.*
286 287 288 289 |
# File 'lib/libfchat/fchat.rb', line 286 def AOP(character) json = {:character => character} self.('AOP',json) end |
#AWC(character) ⇒ Object
Requests a list of currently connected alts for a characters account.
*This command requires chat op or higher.*
295 296 297 298 |
# File 'lib/libfchat/fchat.rb', line 295 def AWC(character) json = {:character => character} self.('AWC',json) end |
#BRO(message) ⇒ Object
Broadcasts a message to all connections. *This command is admin only.*
303 304 305 306 |
# File 'lib/libfchat/fchat.rb', line 303 def BRO() json = {:message => } self.('AWC',json) end |
#CBL(channel) ⇒ Object
Request the channel banlist.
*This command requires channel op or higher.*
312 313 314 315 |
# File 'lib/libfchat/fchat.rb', line 312 def CBL(channel) json = {:channel => channel} self.('CBL',json) end |
#CBU(channel, character) ⇒ Object
Bans a character from a channel
*This command requires channel op or higher.*
321 322 323 324 325 |
# File 'lib/libfchat/fchat.rb', line 321 def CBU(channel,character) json = {:channel => channel, :character => character} self.('CBU',json) end |
#CCR(channel) ⇒ Object
Create an Ad-hoc Channel
329 330 331 332 |
# File 'lib/libfchat/fchat.rb', line 329 def CCR(channel) json = {:channel => channel} self.('CCR',json) end |
#CDS(channel, description) ⇒ Object
This command is used by an admin or channel owner to set a new channel description.
*This command requires channel op or higher.*
339 340 341 342 343 |
# File 'lib/libfchat/fchat.rb', line 339 def CDS(channel, description) json = {:channel => channel, :description => description} self.('CDS',json) end |
#CHA ⇒ Object
Request a list of all public channels
347 348 349 |
# File 'lib/libfchat/fchat.rb', line 347 def CHA() self.('CHA',{}) end |
#CIU(channel, character) ⇒ Object
Sends an invitation for a channel to a user
353 354 355 356 357 |
# File 'lib/libfchat/fchat.rb', line 353 def CIU(channel,character) json = {:channel => channel, :character => character } self.('CIU',json) end |
#CKU(channel, character) ⇒ Object
Kick a user from a channel
*This command requires channel op or higher*
363 364 365 366 367 |
# File 'lib/libfchat/fchat.rb', line 363 def CKU(channel,character) json = {:channel => channel, :character => character } self.('CKU',json) end |
#COA(channel, character) ⇒ Object
Op a user in a channel
*This command requires channel op or higher*
373 374 375 376 377 |
# File 'lib/libfchat/fchat.rb', line 373 def COA(channel,character) json = {:channel => channel, :character => character } self.('COA',json) end |
#COL(channel) ⇒ Object
Request a list of channel ops
381 382 383 384 |
# File 'lib/libfchat/fchat.rb', line 381 def COL(channel) json = {:channel => channel } self.('COL',json) end |
#CRC(channel) ⇒ Object
Creates a global channel
*This command is admin only*
390 391 392 393 |
# File 'lib/libfchat/fchat.rb', line 390 def CRC(channel) json = {:channel => channel } self.('CRC',json) end |
#CUB(channel, character) ⇒ Object
Unban a user from a channel
*This command requires channel op or higher*
399 400 401 402 403 |
# File 'lib/libfchat/fchat.rb', line 399 def CUB(channel,character) json = {:channel => channel, :character => character } self.('CUB',json) end |
#DOP(character) ⇒ Object
Request that a character be stripped of chatop status
*This command is admin only*
409 410 411 412 |
# File 'lib/libfchat/fchat.rb', line 409 def DOP(character) json = { :character => character } self.('DOP',json) end |
#FKS(kink, genders) ⇒ Object
Do a search for a kink with specific genders
416 417 418 419 420 |
# File 'lib/libfchat/fchat.rb', line 416 def FKS(kink,genders) json = { :kink => kink, :genders => genders } self.('FKS',json) end |
#got_ADL(message) ⇒ Object
Store list of ops
161 162 163 |
# File 'lib/libfchat/fchat.rb', line 161 def got_ADL() @ops = ['ops'] end |
#got_CDS(message) ⇒ Object
Store description for newly joined chatroom
255 256 257 |
# File 'lib/libfchat/fchat.rb', line 255 def got_CDS() @rooms[['channel']]['description'] = ['description'] end |
#got_CIU(message) ⇒ Object
Join chatrooms on invite
260 261 262 263 264 265 |
# File 'lib/libfchat/fchat.rb', line 260 def got_CIU() #Annoyingly, the json for this varies for public and private rooms. #So just try both and call it a day. self.send('JCH',['name']) self.send('JCH',['channel']) end |
#got_COL(message) ⇒ Object
Store ops list for room
235 236 237 |
# File 'lib/libfchat/fchat.rb', line 235 def got_COL() @rooms[['channel']]['ops'] = ['oplist'] end |
#got_FLN(message) ⇒ Object
Handle user logging off
211 212 213 214 215 216 |
# File 'lib/libfchat/fchat.rb', line 211 def got_FLN() @users.delete(['character']) @rooms.each do |room| room['characters'].delete(['character']) end end |
#got_FRL(message) ⇒ Object
Store list of friends
167 168 169 |
# File 'lib/libfchat/fchat.rb', line 167 def got_FRL() @friends = ['characters'] end |
#got_ICH(message) ⇒ Object
Store userlist for newly joined chatroom
241 242 243 244 245 |
# File 'lib/libfchat/fchat.rb', line 241 def got_ICH() ['users'].each do |user| @rooms[['channel']]['characters'].push(user['identity']) end end |
#got_IDN(message) ⇒ Object
Know thyself
135 136 137 |
# File 'lib/libfchat/fchat.rb', line 135 def got_IDN() @me = ['character'] end |
#got_IGN(message) ⇒ Object
Store list of ignored users
173 174 175 |
# File 'lib/libfchat/fchat.rb', line 173 def got_IGN() @ops = ['characters'] end |
#got_JCH(message) ⇒ Object
Store data about newly joined chatroom
220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/libfchat/fchat.rb', line 220 def got_JCH() begin @rooms[['channel']]['characters'].push(['character']['identity']) rescue @rooms[['channel']] = { 'title' => ['title'], 'description' => '', 'characters' => [], 'ops' => [], } end end |
#got_LCH(message) ⇒ Object
Handle user leaving chatroom
249 250 251 |
# File 'lib/libfchat/fchat.rb', line 249 def got_LCH() @rooms[['channel']]['characters'].delete(['character']) end |
#got_LIS(message) ⇒ Object
Store list of online users
179 180 181 182 183 184 185 186 187 |
# File 'lib/libfchat/fchat.rb', line 179 def got_LIS() ['characters'].each do |character| @users[character[0]] = { 'gender' => character[1], 'status' => character[2], 'message' => character[3] } end end |
#got_NLN(message) ⇒ Object
Handle user logging on
191 192 193 194 195 196 197 |
# File 'lib/libfchat/fchat.rb', line 191 def got_NLN() @users[['identity']] = { 'gender' => ['gender'], 'status' => ['status'], 'message' => "" } end |
#got_PIN(message) ⇒ Object
Respond to keepalive ping messages
129 130 131 |
# File 'lib/libfchat/fchat.rb', line 129 def got_PIN() self.send('PIN') end |
#got_STA(message) ⇒ Object
Handle user changing status
201 202 203 204 205 206 207 |
# File 'lib/libfchat/fchat.rb', line 201 def got_STA() @users[['character']] = { 'gender' => @users[['character']]['gender'], 'status' => ['status'], 'message' => ['statusmsg'] } end |
#got_VAR(message) ⇒ Object
Store server-side variables
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/libfchat/fchat.rb', line 141 def got_VAR() if ['variable'] == 'chat_max' @chat_max = ['value'] elsif ['variable'] == 'priv_max' @priv_max = ['value'] elsif ['variable'] == 'lfrp_max' @lfrp_max = ['value'] elsif ['variable'] == 'lfrp_flood' @lfrp_flood = ['value'] elsif ['variable'] == 'msg_flood' @msg_flood = ['value'] elsif ['variable'] == 'permissions' @permissions = ['value'] else raise "ERROR: Do not know how to handle VAR #{}" end end |
#IDN(account, character, ticket, cname = @clientname, cversion = @version, method = "ticket") ⇒ Object
This command is used to identify with the server. NOTE: If you send any commands before identifying, you will be disconnected.
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/libfchat/fchat.rb', line 426 def IDN(account, character, ticket, cname=@clientname, cversion=@version, method="ticket") # Initial identification with the server json = {:account => account, :character => character, :ticket => ticket['ticket'], :cname => cname, :cversion => cversion, :method => 'ticket'} self.('IDN', json) end |
#IGN(action, character) ⇒ Object
Deal with ignoring characters.
Available ‘actions’
notify: send this when someone on the ignore list sends a message to you
add: Add a character to your ignore list
remove: Remove a character from your ignore list
449 450 451 452 453 |
# File 'lib/libfchat/fchat.rb', line 449 def IGN(action,character) json = { :action => action, :character => character } self.('IGN',json) end |
#IPB(character) ⇒ Object
Request that a character be IP banned
*This command is admin only*
459 460 461 462 |
# File 'lib/libfchat/fchat.rb', line 459 def IPB(character) json = { :character => character } self.('IPB',json) end |
#JCH(channel) ⇒ Object
Send a channel join request
466 467 468 469 |
# File 'lib/libfchat/fchat.rb', line 466 def JCH(channel) json = { :channel => channel } self.('JCH',json) end |
#KIK(character) ⇒ Object
Request a character to be kicked
*This command requires channel op or higher*
475 476 477 478 |
# File 'lib/libfchat/fchat.rb', line 475 def KIK(character) json = {:character => character } self.('KIK',json) end |
#KIN(character) ⇒ Object
Request a character’s list of kinks
482 483 484 485 |
# File 'lib/libfchat/fchat.rb', line 482 def KIN(character) json = {:character => character } self.('KIN',json) end |
#LCH(channel) ⇒ Object
Leave a channel
489 490 491 492 |
# File 'lib/libfchat/fchat.rb', line 489 def LCH(channel) json = {:channel => channel } self.('LCH',json) end |
#login(server, account, password, character, timeout = 30) ⇒ Object
Login to fchat as a specific user, and start the event machine
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/libfchat/fchat.rb', line 87 def login(server,account,password,character,timeout=30) webapi = Libfchat::WebAPI.new @ticket = webapi.get_ticket(account,password) @me = character EM.run { @websocket = Faye::WebSocket::Client.new(server) @websocket.onopen = lambda do |event| #When we connect, log in self.IDN(account, character, ticket) end @websocket.onclose = lambda do |event| @websocket = nil end @websocket. = lambda do |event| self.(event.data) end } end |
#MSG(channel, message) ⇒ Object
Send a message to a channel
496 497 498 499 500 |
# File 'lib/libfchat/fchat.rb', line 496 def MSG(channel,) json = {:channel => channel, :message => } self.('MSG',json) end |
#OPP ⇒ Object
List presence of ops in all rooms
504 505 506 |
# File 'lib/libfchat/fchat.rb', line 504 def OPP() self.('OPP',{}) end |
#ORS ⇒ Object
Request a list of open private rooms
510 511 512 |
# File 'lib/libfchat/fchat.rb', line 510 def ORS() self.('ORS',{}) end |
#parse_message(msg) ⇒ Object
Parse message received from server
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/libfchat/fchat.rb', line 68 def (msg) type = msg[0,3] begin data = MultiJson.load(msg[4..-1]) rescue data = MultiJson.load('{}') end @logger.debug("<< #{msg}") begin self.send("got_#{type}",data) rescue end end |
#PIN ⇒ Object
Respond to a ping request
516 517 518 |
# File 'lib/libfchat/fchat.rb', line 516 def PIN() self.('PIN',{}) end |
#PRI(recipient, message) ⇒ Object
Sends a prive message to another user
522 523 524 525 526 |
# File 'lib/libfchat/fchat.rb', line 522 def PRI(recipient,) json = {:recipient => recipient, :message => } self.('PRI',json) end |
#PRO(character) ⇒ Object
Do a profile request
530 531 532 533 |
# File 'lib/libfchat/fchat.rb', line 530 def PRO(character) json = {:character => character } self.('PRO',json) end |
#RAN(channel) ⇒ Object
Advertises the first open private channel owned by the client in the given channel
538 539 540 541 |
# File 'lib/libfchat/fchat.rb', line 538 def RAN(channel) json = {:channel => channel } self.('RAN',json) end |
#RLL(channel, dice) ⇒ Object
Roll dice in a channel
545 546 547 548 549 |
# File 'lib/libfchat/fchat.rb', line 545 def RLL(channel,dice) json = {:channel => channel, :dice => dice } self.('RLL',json) end |
#RST(channel, status) ⇒ Object
Set a private room’s status to closed or open
*This command requires channel op or higher*
555 556 557 558 559 |
# File 'lib/libfchat/fchat.rb', line 555 def RST(channel,status) json = {:channel => channel, :status => status } self.('RST',json) end |
#RWD(character) ⇒ Object
Reward a user, for instance, for finding a bug
*This command is admin only*
565 566 567 568 |
# File 'lib/libfchat/fchat.rb', line 565 def RWD(character) json = {:character => character } self.('RWD',json) end |
#send_message(type, json) ⇒ Object
Generic message sender
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/libfchat/fchat.rb', line 112 def (type, json) jsonstr = ::MultiJson.dump(json) msg = "#{type} #{jsonstr}" if type == 'IDN' json[:ticket] = '[REDACTED]' end filteredjsonstr = ::MultiJson.dump(json) @logger.debug(">> #{type} #{filteredjsonstr}") @websocket.send(msg) end |
#STA(status, statusmsg) ⇒ Object
Request a new status to be set for your character
572 573 574 575 576 |
# File 'lib/libfchat/fchat.rb', line 572 def STA(status,statusmsg) json = {:status => status, :statusmsg => statusmsg } self.('STA',json) end |
#TMO(character, time, reason) ⇒ Object
Admin or chatop command to request a timeout for a user time must be a minimum of one minute, and maximum of 90 minutes
*This command requires channel op or higher*
583 584 585 586 587 588 |
# File 'lib/libfchat/fchat.rb', line 583 def TMO(character,time,reason) json = {:character => character, :time => time, :reason => reason } self.('TMO',json) end |
#to_yaml_properties ⇒ Object
Remove useless properties from to_yaml conversion
611 612 613 |
# File 'lib/libfchat/fchat.rb', line 611 def to_yaml_properties super - ["@logger", "@users", "@rooms"] end |
#TPN(character, status) ⇒ Object
User x is typing/stopped typing/entered text for private messages
Available values for status: clear, paused, typing
594 595 596 597 598 |
# File 'lib/libfchat/fchat.rb', line 594 def TPN(character,status) json = {:character => character, :status => status } self.('TPN',json) end |
#UBN(character) ⇒ Object
Unban a character
*This command requires chat op or higher*
604 605 606 607 |
# File 'lib/libfchat/fchat.rb', line 604 def UBN(character) json = {:character => character } self.('UBN',json) end |