WritheM / Wallace

https://plug.dj/writhem-radio
Other
4 stars 3 forks source link

Migrate to Plugged #44

Closed ylt closed 9 years ago

ylt commented 9 years ago

https://github.com/SooYou/plugged

Much more plug features supported, looks less prone to errors.

Has much less helper methods:

In order to do these actions have to do an expensive HTTP request.

Having these features not implemented is beneficial as it allows us to implement them ourselves in a way much more consistent and useful for Wallace's model.

ylt commented 9 years ago

Implementing this will change how plug is implemented. New classes will be implemented to allow more seamless interaction. This will affect event handling in the rest of the bot a bit.

Not fully planned out yet, but will be along the lines of:

/* mostly to match up with Slack, equivalent to channel */
class PlugChat {
    public PlugMessage[] messages;
    public PlugUser[] members;
    public object[] tokenizeMessage(String message); /* get tokens for the service */
    public sendChat(String message, boolean emote);
}

class PlugMessage {
    public PlugUser user;
    public String message;
    public String command;
    public object[] tokenize(); /* shorthand for above */
    public void reply(String message, boolean emote);
    public void delete();
}

class PlugUser {
    public int userId;
    public String username;
    public PlugRole role; /* wrap rank and allow conversion with */
    public void sendChat(String message, boolean emote);
    public void sendReply(String message, boolean emote);
    public void kick(String reason, callback);
    public void ban(String reason, int duration, callback);
    public void setRole(Role role);
    public void mute(time, reason, callback);
    public void skip(callback); //not 100% sure
    public void addToWaitlist(callback);
    public void removeWaitlist(callback);
    public void moveDJ(position, callback);
    public void removeMessages();
    public boolean isFriend();
    public boolean isCurrentDJ();
    public int getWaitlistPosition();
    public boolean isInWaitlist();
}

Other functionality will be wrapped also, such as the playlists and the overall media support.