Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Net;
- using SKYPE4COMLib;
- namespace oSkype_BOT {
- public partial class Form1 : Form {
- Skype skype = new Skype();
- public const string trigger = "#";
- public const string nick = "/me oSkype";
- public Form1() {
- InitializeComponent();
- }
- public void Form1_Load(object sender, EventArgs e) {
- skype.Attach(7, false);
- skype.MessageStatus +=
- new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus);
- }
- public void skype_MessageStatus (ChatMessage msg,
- TChatMessageStatus status) {
- if (msg.Body.IndexOf(trigger) == 0) {
- string command = msg.Body.Remove(0, trigger.Length).ToLower();
- skype.SendMessage(msg.Sender.Handle, nick + " Says: " +
- ProcessCommand(command));
- }
- }
- public string ProcessCommand(string str) {
- string result;
- switch (str) {
- case "hello":
- result = "Hello!";
- break;
- case "date":
- result = "Time is:" +
- DateTime.Now.ToString();
- break;
- case "help":
- result = "/me ------------------Help-Menu------------------ \n #hello \n #date \n #helper";
- break;
- case "helper":
- result = "Add me on skype for help!\n skype:dieformodz1?add";
- break;
- default:
- result = "Sorry you command is not reconized! do #help for a list of commands";
- break;
- return "";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment