Created
November 5, 2015 18:13
-
-
Save thebecwar/70bc2d2a456938aa1fc5 to your computer and use it in GitHub Desktop.
Ideas for extending triggers to chat events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ITrigger | |
{ | |
void ProcessMessage(Message msg, ref Room rm); | |
bool HandleChatEvent(EventType type, object EventData); | |
} | |
//OR | |
interface Hatman.Events.IChatEventHandler | |
{ | |
/// <summary>Raw data (string) has been received via the WebSocket (as JSON).</summary> | |
bool OnDataReceived(string rawData, Room rm); | |
/// <summary>A new message has been posted.</summary> | |
bool OnMessagePosted(Message msg, Room rm); | |
/// <summary>A message has been edited.</summary> | |
bool OnMessageEdited(Message msg, Room rm); | |
/// <summary>A user has entered the room.</summary> | |
bool OnUserEntered(User usr, Room rm); | |
/// <summary>A user has left the room.</summary> | |
bool OnUserLeft(User usr, Room rm); | |
/// <summary>Someone has (un)starred a message.</summary> | |
bool OnMessageStarToggled(Message msg, Room rm); | |
/// <summary>You have been mentioned (@Username) in a message.</summary> | |
bool OnUserMentioned(Message msg, Room rm); | |
/// <summary>A message has been deleted.</summary> | |
bool OnMessageDeleted(Message msg, Room rm); | |
/// <summary>A user's room access level has been changed.</summary> | |
bool UserAccessLevelChanged(User usr, Room rm); | |
/// <summary>Someone has posted a reply to one of your messages.</summary> | |
bool OnMessageReply(Message msg, Room rm); | |
} | |
//OR | |
class SomeTriggerThing | |
{ | |
[UserEventHandler(EventType.UserEntered)] | |
public bool OnUserEntered(/* Some event data struct */); | |
} | |
//OR | |
interface ITrigger | |
{ | |
void ProcessMessage(Message msg, ref Room rm); | |
void RegisterEvents(EventManager mgr); | |
void UnregisterEvents(EventManager mgr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment