Skip to content

Livestream Danmuku Receiver (Currently only Douyu)

Notifications You must be signed in to change notification settings

reitowo/DouyuDanmuSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

douyudm C# implementation

Usage

  1. Add this Project to your Visual Studio Solution. The project uses .NET 5.0, however you probably can port to .Net Framework, etc..

  2. using LivestreamDanmuku.Douyu;

  3. Instantiate DanmukuClient.

    DanmukuClient danmu = new DanmukuClient(74751);
    danmu.Run();

    If you only want to receive chatting, use:

    danmu.OnChatMessage += Danmu_OnChatMessage;

    I'm not yet implement other message types, however it is able to hook these via:

    danmu.Register(new Dictionary<string, MessageHandler> {
        {
            "uenter",
            (msg) => {
                Debug.WriteLine($"用户进入 {msg["nn"]}");
            }
        },
        {
            "loginres",
            (msg) => {
                Debug.WriteLine("登陆成功");
            }
        }
    });

    This will clear the current callback table, and set the new one, to register to existing table, use

    danmu.Register("uenter", (msg) =>
    {
        Debug.WriteLine($"用户进入 {msg["nn"]}");
    });

    The msg parameter is Newtonsoft.Json.Linq.JObject.

About

Livestream Danmuku Receiver (Currently only Douyu)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages