HaoYue.Personality/AkiragestuProject/akLanguage.cs

89 lines
2.1 KiB
C#
Raw Normal View History

2018-10-11 20:53:13 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace AkiragestuProject
{
class akLanguage
{
akMood akm = new akMood();
//判读按语法先
public int GetlanguageType(string MsgStr)
{
if (MsgStr.Substring(0, 1).Contains('/'))
{
//确定是命令
return 2;
}
else
return 1;
}
/// <summary>
/// 获取方法
/// </summary>
public string GetCommand(string CommandStr)
{
int commHeadIndex = CommandStr.IndexOf(" ");
string CommFirst = CommandStr;
//空格多命令
if (commHeadIndex > 0)
{
CommFirst = CommandStr.Substring(0, commHeadIndex);
}
switch (CommFirst.ToLower())
{
case "help":
return com_help();
break;
case "hentai":
return com_hentai();
break;
case "addqa":
if (commHeadIndex > 0)
{
return com_AddQA(CommandStr.Substring(commHeadIndex));
}
else
return "QA参数错误";
break;
}
return null;
}
public string com_help()
{
return "基本命令: /help /hentai /akiragatsu";
}
public string com_hentai()
{
return "变态有什么错";
}
public string com_AddQA(string QA)
{
try
{
string[] strArr = QA.Split('^');
if (akm.AddQA(strArr[0], strArr[1]))
return "增加成功 o(^▽^)o";
else
return "增加失败";
}
catch (Exception ex)
{
return ex.ToString();
}
}
}
}