GithubHelp home page GithubHelp logo

pilky / twitchmata Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 3.0 1.13 MB

A set of files to help simplify integrating Twitch with an Animata VIPO stream built in Unity

License: MIT License

C# 100.00%

twitchmata's People

Contributors

megalon avatar pilky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dinozor megalon

twitchmata's Issues

Add dedicated User type

Add a dedicated type to hold user information coalesced from subs, raids, followers, chatters, mods and broadcasters

Add dedicated Raid type

Add a dedicated type to hold info on a Raid and send via the notification function of the RaidManager

Add ChatCommand registration to ChatCommandManager

Add ability to register a chat command name, permissions, and call back with ChatCommandManager. On receiving a chat command, these should be checked for the name, that the permissions match, and then call the callback

Add comprehensive RegisterReward convenience

Add a convenience method for RegisterReward that lets you skip the step of creating the reward and adding to a group and instead does it all in one line, returning a newly created ManagedReward

Add Message Listeners

Add ability to listen for certain things in messages. This should take the form of message listeners that can be created to either exactly match, contain, or regex match messages

Implement lurk/unlurk command support

Add support for built-in lurk/unlurk. This should respond to any !lurk or !unlurk command, send an optional message to the chat, and add the user to a list of lurkers in the chat (sending appropriate notifications)

Fetch channel ID on initialisation

Rather than requiring people to find their channel ID before starting the overlay, fetch prior to connecting to the client or PubSub.

Also cache the channel ID and channel name in the secrets directory so that they can be re-loaded later without needing to fetch

Need to handle user names prefixed with @

Many commands will use an @ prefix for usernames to allow for completion. We need to ensure these are taken out. This is probably best done in the UserManager when fetching by user name so that it works everywhere

Implement Reward registration

Implement the ability to register a reward and callback with the ChannelPointManager. This should store the rewards, which may be in an incomplete state, until they can be matched up with the rewards from the API.

Once rewards have been matched up any missing rewards should be created in the API

Improve setup and fetching of feature managers

Improve the setting up of feature managers, allowing feature managers to be created on the fly for internal user if the user hasn't created for their own use.

Also add the ability to fetch a feature manager of a type

Store follower stats

Keep a list of all people who have followed this stream. Persistence will be handled in a future issue

Add Bits Stats

Keep a list of bits received this stream. Persistence will be handled in a future ticket.

Keep list of Moderators in chat

Keep a list of moderators currently in chat. This should forward OnModeratorJoined and OnModeratorLeft notifications from the Client

Keep a list of active chatters

Keep a list of active chatters in ViewersManager. This should call ChatterJoined() when a chatter that isn't already active sends a message. Chatters should be removed when OnUserLeft is received

Rename ChatManagers

Rename ChatManager to ChatParticipantManager and rename ChatCommandManager to ChatMessageManager. Move chat message commands from former to latter

Decoupling/Framework agnostic approach

Is your feature request related to a problem? Please describe.
Active code requires user to code his way for each and every required feature. Hard to adopt and reuse coded features later. Every new feature requires reload.

Describe the solution you'd like
More decoupled agnostic approach allowing to have reusable "drag&dropable" element. Best scenario to have API/Framework loosely coupled with unity and twitch. Main core will be basic models and set of prebuild commands, validators and builders.

Describe alternatives you've considered
To rewrite active for more dynamic approach or start new independent repository/org.

Additional context
Below is approximate design. Not the greatest, but should help to illustrate the idea and easier navigate it.
Animata

Model act like database. With exposed interface they can be mapped to any storage. Regardless of platform (Twitch, Youtube, Discord etc.) users have common variables and can be stored , linked and monitored cross platform. Act as somewhat aggregator.
Provide set of adapters. Current one is for unity using TwitchAPI.Unity. Basically adapter/proxy class.

Adapter or adapters are injected to Managers (bad naming :( ) Managers provide active basic functionality of monitoring chat and platform events. Should be controlled by something Kernel like. Kernel will also sync and populate models using adapters.

Each manager accepts list of specific Interfaces. In unity should be ScriptableObjects. Every Object should have list of strategies knowing how to react on managers call when specific requirements are matched.

Example:
class CommandController (Manager). Has list of Commands that have Execute(data) method.

[CreateAssetMenu(fileName = "New Chat Command", menuName = "Twitchmata/Chat Command")]
public class ChatCommand : ScriptableObject
{
    [SerializeField]
    private string _command;
    [SerializeField]
    private string _description;
    
    [SerializeField]
    private Permissions _permissions; 
    [SerializeField]
    private CommandStrategy[] _strategies; 

    public string Command => _command;
    public string Description => _description;

    // can be moved out and replaced by list of Validators 
    // following same principal as CommandStrategy
    public Permissions Permissions => _permissions;
}
public abstract class CommandStrategy : ScriptableObject
{
    public abstract void Execute(User user, Message message, Callable finished);
}
[CreateAssetMenu(fileName = "CommandStrategy", menuName = "Mata/Command")]
public class SendResponceStrategy : CommandStrategy
{
    [SerializedField]
    private string _template;
    public override void Execute(User user, Message message, Callable finished)
    {
            Mata.SendMessage(_template);
    }
}

This code allows to precreate all basic commands to be created and configured by clicking UI and drag&drop.
Same strategies later can easily be reused or be more specific like "Call my character ability".

Below are screenshots of same for Channel Point rewards.
image
image

Having code this way would also allow later to constantly increate amount of possible options and even exchange them between users (even runtime, between streamer interaction). Or have a portal, git with just a list of them as snippets.
In addition more users would be able to contribute to projects. Even regardless of the platform as having those components would allow easy adaptation via adapters.
And as extra benefit can allow cross platform user interaction (games, channel points etc.).

Hope this provides some perspective of what and how I see "endgame" of this tool.

ManagedReward Groups

Add a ManagedRewardGroup type that holds a collection of rewards, allowing them to be enabled/disable en masse (also requires Enable/DisableRewardGroup() methods

Keep a list of VIPs in chat

Keep a list of VIPs that are currently in chat. This should appear when the VIP joins and disappear when they leave calling the appropriate notification methods

Fetch rewards from API

When ChannelPointManager is initialised, get all rewards from the API. These should be stored in Reward objects that can be filled out with additional details and synced up with registered rewards later.

FeatureManager auto-detect

Change TwitchManager to auto-detect feature managers either on the same game object or on a child game object

Add Start/CancelRaid functionality to RaidManager

Add functionality to start raiding a channel. This involves multiple steps:

  1. Start raiding via the API
  2. Allow cancelling the raid via the API
  3. Respond to PubSub notifications about the raid (this should be OnRaidUpdateV2 and OnRaidGo but these are undocumented)

Implement stat persistence and reset

Add the ability to store stat info to disk and re-load when the overlay starts. Add options to either reset manually, on overlay start, or on stream start

Authentication UI

Build a UI to walk users through getting their client ID, client secret, and authenticating their bot and broadcaster accounts, including selecting the appropriate permissions

Add UI for invoking debug commands

Look into adding a UI for invoking a debug command on a feature manager. This will probably be a separate window, but could be in an inspector. Should allow for customisation of debug inputs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.