using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace DefaultNameSpace{
public class DefaultClass : Core
{
public static string GetPluginAuthor()
{
return "Syllae";
}
public static string GetPluginVersion()
{
return "1.0.0.0";
}
public static string GetPluginDescription()
{
return "Alert you when you have a PM";
}
//Call on plugin start
public void PluginRun()
{
messageHandler = new CoreInternal.ChatMessage(messageHandler);
onChatMessage += messageHandler;
}
//Call on plugin stop
public void PluginStop()
{
if(messageHandler != null) {
onChatMessage -= messageHandler;
}
}
public CoreInternal.ChatMessage messageHandler = null;
public void onPM(ChatType chatType, string text, string sender) {
if(chatType == ChatType.Whisper) {
MessageBox.Show("PM received from " + sender + ": " + text);
}
}
}
}
edit :
Code:using System; using System.Drawing; using System.Windows.Forms; using System.Threading; using System.Collections.Generic; using System.Linq; using ArcheBuddy.Bot.Classes; namespace DefaultNameSpace{ public class DefaultClass : Core { public static string GetPluginAuthor() { return "Syllae"; } public static string GetPluginVersion() { return "1.0.0.0"; } public static string GetPluginDescription() { return "Alert you when you have a PM"; } //Call on plugin start public void PluginRun() { messageHandler = new CoreInternal.ChatMessage(messageHandler); onChatMessage += messageHandler; } //Call on plugin stop public void PluginStop() { if(messageHandler != null) { onChatMessage -= messageHandler; } } public CoreInternal.ChatMessage messageHandler = null; public void onPM(ChatType chatType, string text, string sender) { if(chatType == ChatType.Whisper) { MessageBox.Show("PM received from " + sender + ": " + text); } } } }
I'm at work so I didn't tried it
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace DefaultNameSpace{
public class DefaultClass : Core
{
public static string GetPluginAuthor()
{
return "Plugin Author";
}
public static string GetPluginVersion()
{
return "1.0.0.0";
}
public static string GetPluginDescription()
{
return "My plugin description";
}
public void MyChatMessage(ChatType chatType,string text,string sender)
{
if(chatType == ChatType.Whisper) MessageBox.Show("PM received from " + sender + ": " + text);
}
//Call on plugin start
public void PluginRun()
{
onChatMessage += MyChatMessage;
while (true)
Thread.Sleep(1000);
}
//Call on plugin stop
public void PluginStop()
{
}
}
}