Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5cd113a
Added appdomain stuff but breaks on complie
Toyz Mar 17, 2015
2002b50
Fixed a bug in plugin loader
Toyz Mar 18, 2015
d042dc9
Fixed the title from SpiffBaot to SpiffBot...
Toyz Mar 18, 2015
f93de38
Added Win32 blocking API idk which one is which :panda_face:
Toyz Mar 18, 2015
29d30eb
Fixed a private to public in Win32 plugin
Toyz Mar 18, 2015
83e7446
Added Managers to handle Viewers
Toyz Mar 18, 2015
ac3bf09
Added Managers for Users and Commands
Toyz Mar 18, 2015
69e8be5
Fixed the test plugin for cross plugin loading
Toyz Mar 18, 2015
4a667f0
Added basic scareystuff plugin
Toyz Mar 18, 2015
06b0f7f
Put events in a task factory
Toyz Mar 18, 2015
ba2a05e
Slight tweak to move certain calls about events xD
Toyz Mar 18, 2015
80ded87
Fixed null error in HelpCommand
Toyz Mar 18, 2015
58d50c5
Added Default Commands to the program
Toyz Mar 19, 2015
7c3d157
Minor tweaks to a few files
Toyz Mar 19, 2015
b25dcd6
Code order clean up
Toyz Mar 19, 2015
edeb4fd
Removed unused usings
Toyz Mar 19, 2015
7f7316f
Fixed bugs in code
Toyz Mar 19, 2015
bf0ff33
Fix minor spelling bug
Toyz Mar 19, 2015
dd219c1
Fixed spelling bugs
Toyz Mar 19, 2015
90ade35
Added Delay writter to Twitch
Toyz Mar 19, 2015
9bf7d5f
Fixed console to reset color instead
Toyz Mar 20, 2015
815ae4c
Redid the logger and added Color extensions to the code!
Toyz Mar 20, 2015
96bedfa
Cleaned up logger
Toyz Mar 20, 2015
de73972
Major code updates
Toyz Mar 20, 2015
f43134e
Changed IRCClient and Writer to use the new system
Toyz Mar 20, 2015
ef55e13
Fixed some stupid threading i did Q_Q
Toyz Mar 20, 2015
daf9a76
Few tweaks to the engine
Toyz Mar 20, 2015
687ef6e
Updated CommandObjects to be cloneable
Toyz Mar 20, 2015
db20551
Tweaks to minor things
Toyz Mar 21, 2015
0554ccb
Minor updates
Toyz Mar 21, 2015
27c29ac
Revert "Minor updates"
Toyz Mar 22, 2015
93a955b
Fixed code errors
Toyz Mar 22, 2015
8d11c75
Added new basic plugin
Toyz Mar 22, 2015
fe33581
Added power to see total seen for censor
Toyz Mar 22, 2015
3e79f6d
Changed stupid things
Toyz Mar 22, 2015
fbb3055
Made logging to file multi threaded
Toyz Mar 22, 2015
d69b4c3
Minor patches to code
Toyz Mar 27, 2015
a7c5254
Fixed few warnings in Ini system
Toyz Mar 27, 2015
d03b59d
Warning clean up
Toyz Mar 27, 2015
735a911
Changed Kick to Timeout
Toyz Mar 27, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ Icon
Network Trash Folder
Temporary Items
.apdisk

*.suo
Spiffbot/Spiffbot.v12.suo
Spiffbot/Spiffbot.v12.suo
Expand Down
5 changes: 3 additions & 2 deletions Spiffbot/CustomCommands/Commands/MouseMouseCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;
using Win32API;

namespace CustomCommands.Commands
Expand All @@ -15,9 +16,9 @@ public override string CommandInfo
get { return "Set the mouse's current location on the screen"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
if (IsOwner(nick))
if (IsOwner(nick.Username))
{
if (parts.Length < 3)
return;
Expand Down
5 changes: 3 additions & 2 deletions Spiffbot/CustomCommands/Commands/ReloadConfigSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace CustomCommands.Commands
{
Expand All @@ -14,9 +15,9 @@ public override string CommandInfo
get { return "Reload the config for the song"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
if (IsOwner(nick))
if (IsOwner(nick.Username))
{
CustomCommands.ConfigSettings.Refresh();
Boardcast(nick + " has reloaded the config");
Expand Down
5 changes: 3 additions & 2 deletions Spiffbot/CustomCommands/Commands/SongCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace CustomCommands.Commands
{
Expand All @@ -15,13 +16,13 @@ public override string CommandInfo
get { return "Get the current playing song"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
var file = CustomCommands.ConfigSettings.GetValue("config", "Song_File", "c:\\Path\\To\\Song");

if (File.Exists(file))
{
Boardcast(string.Format("Hey, {0} the current song is: {1}", nick, File.ReadAllText(file)));
Boardcast(string.Format("Hey, {0} the current song is: {1}", nick.Username, File.ReadAllText(file)));
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions Spiffbot/CustomCommands/Commands/SourceCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace CustomCommands.Commands
{
Expand All @@ -14,9 +15,9 @@ public override string CommandInfo
get { return "This is a link to the source code on github"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
Boardcast(string.Format("Hey, {0} here is a link to the code: https://github.com/Toyz/SpiffBot/tree/master/Spiffbot", nick));
Boardcast(string.Format("Hey, {0} here is a link to the code: https://github.com/Toyz/SpiffBot/tree/master/Spiffbot", nick.Username));
}
}
}
6 changes: 3 additions & 3 deletions Spiffbot/DefaultCommands/Commands/GameCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Spiff.Core;
using Spiff.Core.API.Commands;
using Spiff.Core.API.Commands;
using Spiff.Core.API.Twitch;
using Spiff.Core.Managers.Viewers;

namespace DefaultCommands.Commands
{
Expand All @@ -16,7 +16,7 @@ public override string CommandInfo
get { return "Get's the current game I am playing"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
var game = SiteApi.GetGame(channel);

Expand Down
6 changes: 3 additions & 3 deletions Spiffbot/DefaultCommands/Commands/RandomViewer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Spiff.Core;
using Spiff.Core.API.Commands;
using Spiff.Core.API.Twitch;
using Spiff.Core.Extensions;
using Spiff.Core.Managers.Viewers;

namespace DefaultCommands.Commands
{
Expand All @@ -17,9 +17,9 @@ public override string CommandInfo
get { return "Return a random viewer fom the chat"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
var viewers = SiteApi.GetChatters(channel);
var viewers = SpiffCore.Instance.ViewerManager.AllViewers;

Boardcast("Random User is: " + viewers.PickRandom().Username);
}
Expand Down
7 changes: 2 additions & 5 deletions Spiffbot/DefaultCommands/DefaultCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ public override int Version

public override void Start()
{
Logger.Write("Loading Plugin Commands", Name);
RegisterCommand(new AllCommands());
RegisterCommand(new HelpCommand());
Logger.Write("Loading Plugin LoadedCommands", Name);
RegisterCommand(new GameCommand());
RegisterCommand(new RandomViewer());
RegisterCommand(new PluginsCommand());
}

public override void Destory()
{
Logger.Write("[Default Commands]Stopping", Name);
Logger.Write("[Default LoadedCommands]Stopping", Name);
}
}
}
3 changes: 0 additions & 3 deletions Spiffbot/DefaultCommands/DefaultCommands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\AllCommands.cs" />
<Compile Include="Commands\GameCommand.cs" />
<Compile Include="Commands\HelpCommand.cs" />
<Compile Include="Commands\PluginsCommand.cs" />
<Compile Include="Commands\RandomViewer.cs" />
<Compile Include="DefaultCommands.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
5 changes: 3 additions & 2 deletions Spiffbot/QuizBotPlugin/Commands/EditorInterfaceCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Windows.Forms;
using QuizBotPlugin.Forms;
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace QuizBotPlugin.Commands
{
Expand All @@ -17,9 +18,9 @@ public override string CommandInfo
get { return "This allows the chat owner to add custom quiz/edit current ones"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
if (IsOwner(nick))
if (IsOwner(nick.Username))
{
var t = new Thread(() => { Application.Run(new QuizBuilder()); });

Expand Down
5 changes: 3 additions & 2 deletions Spiffbot/QuizBotPlugin/Commands/StartQuizCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace QuizBotPlugin.Commands
{
Expand All @@ -14,9 +15,9 @@ public override string CommandInfo
get { return "Command to start a give quiz"; }
}

public override void Run(string[] parts, string complete, string channel, string nick)
public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
if (IsOwner(nick))
if (IsOwner(nick.Username))
{
new QuizMaster(parts[1] + ".xml");
}
Expand Down
44 changes: 20 additions & 24 deletions Spiffbot/QuizBotPlugin/QuizMaster.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Timers;
using QuizBotPlugin.ListItems;
using Spiff.Core;
using Spiff.Core.API.Commands;
using Spiff.Core.API.EventArgs;
using Spiff.Core.Utils;

Expand All @@ -15,44 +12,43 @@ namespace QuizBotPlugin
public class QuizMaster
{
private readonly string _file;
private readonly Command _comm;
private List<QuizItem> _quizItems;
private readonly List<QuizItem> _quizItems;
private QuizItem _currentItem;
private Timer Timer;
private int _id = 0;
private bool NoPost = false;
private Timer _timer;
private int _id;
public bool NoPost;

public QuizMaster(string file)
{
_file = file;

NoPost = false;

_quizItems =
Utils.DeserializeFromXml<List<QuizItem>>(
File.ReadAllText(Path.Combine(QuizBot.BotInstance.PluginDirectory, file)));

Timer = new Timer {Interval = 60000};
Timer.Elapsed += TimerOnTick;
_timer = new Timer {Interval = 60000};
_timer.Elapsed += TimerOnTick;

_currentItem = getQuizItem();

SpiffCore.Instance.OnChatHandler += InstanceOnOnChatHandler;
SpiffCore.Instance.OnChatEvent += InstanceOnOnChatEvent;

Timer.Start();
_timer.Start();
}

private void InstanceOnOnChatHandler(object sender, OnChatEvent onChatEvent)
private void InstanceOnOnChatEvent(object sender, OnChatEvent onChatEvent)
{
//Logger.Debug("Fired Message Event:" + onChatEvent.Message, QuizBot.BotInstance.Name);
if (onChatEvent.Message.Trim().Equals(_currentItem.Anwser))
{
//NoPost = true;
Timer.Stop();
_timer.Stop();
//NoPost = false;
SpiffCore.Instance.WriteOut.SendMessage(onChatEvent.User + " got the anwser correct!");
SpiffCore.Instance.WriteOut.SendMessage(onChatEvent.User.Username + " got the anwser correct!");
_currentItem = getQuizItem();
if(Timer != null)
Timer.Start();
if(_timer != null)
_timer.Start();
}
}

Expand All @@ -66,20 +62,20 @@ private void TimerOnTick(object sender, EventArgs eventArgs)
//if (NoPost) return;
SpiffCore.Instance.WriteOut.SendMessage("The anwser for the question was: " + _currentItem.Anwser);
_currentItem = getQuizItem();
if(Timer != null)
Timer.Start();
if(_timer != null)
_timer.Start();
}

private QuizItem getQuizItem()
{
if (_id > _quizItems.Count - 1)
{
_id = 0;
SpiffCore.Instance.OnChatHandler -= InstanceOnOnChatHandler;
SpiffCore.Instance.OnChatEvent -= InstanceOnOnChatEvent;
SpiffCore.Instance.WriteOut.SendMessage("Game Over... Maybe I will load another :D");
Timer.Elapsed -= TimerOnTick;
Timer.Dispose();
Timer = null;
_timer.Elapsed -= TimerOnTick;
_timer.Dispose();
_timer = null;
return null;
}
var item = _quizItems[_id];
Expand Down
32 changes: 32 additions & 0 deletions Spiffbot/ScareyStuff/Commands/ReloadCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace ScareyStuff.Commands
{
public class ReloadCommand : Command
{
private readonly ScareyStuff _scareyStuff;

public override string CommandName
{
get { return "ssreload"; }
}

public override string CommandInfo
{
get { return "Reload the configs for ScareyStuff"; }
}

public ReloadCommand(ScareyStuff scareyStuff)
{
_scareyStuff = scareyStuff;
}

public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
if (!IsOwner(nick.Username)) return;
_scareyStuff.ScareySounds.Refresh();
Boardcast("Reloaded Scarey Sounds");
}
}
}
49 changes: 49 additions & 0 deletions Spiffbot/ScareyStuff/Commands/SoundCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.IO;
using Spiff.Core.API.Commands;
using Spiff.Core.Managers.Viewers;

namespace ScareyStuff.Commands
{
public class SoundCommand : Command
{
private readonly ScareyStuff _scareyStuff;

public override string CommandName
{
get { return "ssound"; }
}

public override string CommandInfo
{
get { return "Play a scarey sound!"; }
}

public SoundCommand(ScareyStuff scareyStuff)
{
_scareyStuff = scareyStuff;
}

public override void Run(string[] parts, string complete, string channel, Viewer nick)
{
if (parts.Length < 2)
{
Boardcast("Usage: !ssound name");
return;
}

var sound = _scareyStuff.ScareySounds.GetValue("Sound", parts[1], string.Empty);

if (string.IsNullOrEmpty(sound))
{
Boardcast("Sound does not exist");
return;
}

if (File.Exists(Path.Combine(_scareyStuff.PluginDirectory, sound)))
{
Utils u = new Utils(Path.Combine(_scareyStuff.PluginDirectory, sound));
u.Play();
}
}
}
}
Loading