Skip to content

Instantly share code, notes, and snippets.

@thebecwar
Created November 5, 2015 18:13
Show Gist options
  • Save thebecwar/70bc2d2a456938aa1fc5 to your computer and use it in GitHub Desktop.
Save thebecwar/70bc2d2a456938aa1fc5 to your computer and use it in GitHub Desktop.
Ideas for extending triggers to chat events
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