Created
April 28, 2017 23:00
-
-
Save DamianRyse/eefe1d17c33663e25542aae67040f51e to your computer and use it in GitHub Desktop.
TwitchBitch Plugin template
This file contains hidden or 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
using System.Linq; | |
using System.Text.RegularExpressions; | |
using TwitchBitch2; | |
namespace TwitchBitch_Plugin_Template | |
{ | |
[PluginDisplayName("Your Plugin name")] // you must provice a display name... | |
[PluginDescription("Description of plugin")] // as well as a description (max 140 chars)... | |
[PluginCopyright("Copyright (c) YourCompany")] // and your copyright declaration. | |
[PluginVersion("1.0.0.0")] | |
public class myClass : IPlugin | |
{ | |
/// <summary> | |
/// Initializing the plugin. Will be executed, when plugin is loaded. | |
/// </summary> | |
public void Init() | |
{ | |
// Loading configurations. | |
// Display some information in the console. | |
// Preparing plugin to work propertly. | |
} | |
/// <summary> | |
/// Will be executed, when TwitchBitch received data from IRC server. | |
/// </summary> | |
/// <param name="ReceivedDataStream">The raw data stream received from Twitch IRC server</param> | |
public void Execute(string ReceivedDataStream) | |
{ | |
if (Regex.IsMatch(ReceivedDataStream, @"^@badges=(.+);color=#(.+);display-name=(.+);emotes=(.+)?;id=(.+);mod=(0|1);room-id=(.+);sent-ts=(.+);subscriber=(0|1);tmi-sent-ts=(.+);turbo=(0|1);user-id=(.+);user-type=(mod|global_mod|admin|staff) :(.+)!(.+)@(.+).tmi.twitch.tv PRIVMSG (.+) :(.+)$")) | |
{ | |
TwitchMessage Message = new TwitchMessage(ReceivedDataStream); | |
if(Message.Message.ToLower() == "!basicCommand") | |
{ | |
// Do something that every user can do. | |
} | |
else if(Message.Message.ToLower() == "!adminCommand" && PluginInfoDevice.ClientConfig.GetAdmininstrators().Contains(Message.Author.UserName)) | |
{ | |
// Do something that only Bot administrator can do... | |
} | |
else if(Message.Message.ToLower() == "!moderatorCommand" && Message.Author.IsMod) | |
{ | |
// Do someting that only moderators can do... | |
} | |
else if(Message.Message.ToLower() == "!subscriberCommand" && Message.Author.IsSubscriber) | |
{ | |
// Do something that only subscribers can do... | |
} | |
else if(Message.Message.ToLower() == "!turboCommand" && Message.Author.IsTurbo) | |
{ | |
// Do something that only Turbo Users can do (and Twitch Prime users)... | |
} | |
else if(Message.Message.ToLower() == "individualCommand" && Message.Author.UserName == "someUsername") | |
{ | |
// Do something that only 'someUsername' can do... | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment