Commit 360c1e88 authored by Fumao Li's avatar Fumao Li

init

parent 697d3c01
Pipeline #236 failed with stages
.vs/
[Oo]bj/
[Bb]in/
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
*.suo
*.user
*.json
*.props
/MatrixOne.RedisLab/Server/logs
/packages/Newtonsoft.Json.13.0.1
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C9C2633D-AEAF-47CA-8BCB-FDF3AC5A5F64}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>BotMonitor</RootNamespace>
<AssemblyName>BotMonitor</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Lib\BaseBot.cs" />
<Compile Include="Lib\GitLabClient.cs" />
<Compile Include="Lib\MaoLogger.cs" />
<Compile Include="Lib\Types.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="riddle.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BotMonitor.Lib
{
public class BaseBot
{
public Guid Guid { get; }
public bool IsRiddling { get; private set; }
private readonly HttpClient httpClient;
private ClientWebSocket webSocket;
private readonly string _api_token;
private readonly string _wss_token;
private readonly MaoLogger Logger;
private readonly string BaseUrl = "https://slack.com/api/";
private readonly List<Riddle> RiddlePool;
private string RiddleChannel;
private int RiddleIndex = -1;
private bool RiddleUnveiled = true;
private Random _random;
private readonly Dictionary<string, string[]> ReplyDic = new Dictionary<string, string[]>
{
{ "right", new string[] {
"对对对,你猜对了~!",
"哇!这么快就猜到了?",
"对,就是这个答案,你是百度出来的吧?",
"恭喜你,猜对了~!",
"大家看看,都是一个群的,为啥人家就这么聪明呢?",
"回答正确!加十分。",
"正确!恭喜你成功达到小学三年级智商了。",
"答对了,就你秀~!"
} },
{ "wrong", new string[] {
"不对,再想想?",
"你不懂就不要乱猜,不是这个~!",
"错,不要误导大家哦,你乱猜的吧。",
"错误,你动动脑子行不行?",
"猜错了,真为你的智商捉急。",
"大错特错,不懂装懂,笨啊你。",
"嘿嘿,你猜错了,给服务器充点钱吧。",
"错误,打手板心~!"
} }
};
public BaseBot(string api_token, string wss_token, MaoLogger logger)
{
_random = new Random(DateTime.Now.Millisecond);
Guid = Guid.NewGuid();
_api_token = api_token;
_wss_token = wss_token;
Logger = logger;
IsRiddling = false;
RiddlePool = new List<Riddle>();
RiddleChannel = "";
httpClient = new HttpClient();
}
public void Test()
{
string EndPoint = "auth.test";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, $"{BaseUrl}{EndPoint}");
string content = "";
req.Content = new StringContent(content, Encoding.UTF8, "application/json");
req.Headers.Add("Authorization", $"Bearer {_api_token}");
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string respStr = resp.Content.ReadAsStringAsync().Result;
Logger.Info("test", this);
Logger.Info($"{resp.StatusCode}", this);
Logger.Info($"{resp.ReasonPhrase}", this);
Logger.Info($"{respStr}", this);
}
public Channel[] GetAllChannel()
{
List<Channel> ret = new List<Channel>();
string EndPoint = "conversations.list";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, $"{BaseUrl}{EndPoint}");
string content = "";
req.Content = new StringContent(content, Encoding.UTF8, "application/x-www-form-urlencoded");
req.Headers.Add("Authorization", $"Bearer {_api_token}");
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string respStr = resp.Content.ReadAsStringAsync().Result;
JObject respJson = JObject.Parse(respStr);
if (respJson["ok"].ToObject<bool>())
{
JArray channels = (JArray)respJson["channels"];
foreach (JObject json in channels)
{
ret.Add(new Channel
{
Id = json["id"].ToString(),
Name = json["name"].ToString()
});
}
}
else
{
Logger.Error($"访问接口 {EndPoint} 返回数据异常", this);
Logger.Error($"{resp.StatusCode}", this);
Logger.Error($"{resp.ReasonPhrase}", this);
Logger.Error($"{respStr}", this);
}
return ret.ToArray();
}
public void Join(string channelId)
{
string EndPoint = "conversations.join";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, $"{BaseUrl}{EndPoint}");
JObject Arguments = new JObject();
Arguments.Add("channel", channelId);
string content = Arguments.ToString();
req.Content = new StringContent(content, Encoding.UTF8, "application/json");
req.Headers.Add("Authorization", $"Bearer {_api_token}");
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string respStr = resp.Content.ReadAsStringAsync().Result;
JObject respJson = JObject.Parse(respStr);
if (respJson["ok"].ToObject<bool>())
{
Logger.Info($"访问接口 {EndPoint} 返回数据成功", this);
}
else
{
Logger.Error($"访问接口 {EndPoint} 返回数据异常", this);
Logger.Error($"{resp.StatusCode}", this);
Logger.Error($"{resp.ReasonPhrase}", this);
Logger.Error($"{respStr}", this);
}
}
public bool Say(string channelId, string msg)
{
string EndPoint = "chat.postMessage";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, $"{BaseUrl}{EndPoint}");
JObject Arguments = new JObject
{
{ "channel", channelId },
{ "text", msg }
};
string content = Arguments.ToString();
req.Content = new StringContent(content, Encoding.UTF8, "application/json");
req.Headers.Add("Authorization", $"Bearer {_api_token}");
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string respStr = resp.Content.ReadAsStringAsync().Result;
JObject respJson = JObject.Parse(respStr);
if (respJson["ok"].ToObject<bool>())
{
Logger.Info($"访问接口 {EndPoint} 返回数据成功", this);
return true;
}
else
{
Logger.Error($"访问接口 {EndPoint} 返回数据异常", this);
Logger.Error($"{resp.StatusCode}", this);
Logger.Error($"{resp.ReasonPhrase}", this);
Logger.Error($"{respStr}", this);
if (respJson["error"].ToString().Equals("not_in_channel"))
{
Join(channelId);
Say(channelId, msg);
}
return false;
}
}
public bool Connect()
{
while (true)
{
try
{
webSocket = new ClientWebSocket();
Uri uri = null;
string EndPoint = "apps.connections.open";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, $"{BaseUrl}{EndPoint}");
string content = "";
req.Content = new StringContent(content, Encoding.UTF8, "application/json");
req.Headers.Add("Authorization", $"Bearer {_wss_token}");
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string respStr = resp.Content.ReadAsStringAsync().Result;
JObject respJson = JObject.Parse(respStr);
if (respJson["ok"].ToObject<bool>())
{
uri = new Uri(respJson["url"].ToString());
Logger.Info($"访问接口 {EndPoint} 返回数据成功", this);
}
else
{
Logger.Error($"访问接口 {EndPoint} 返回数据异常", this);
Logger.Error($"{resp.StatusCode}", this);
Logger.Error($"{resp.ReasonPhrase}", this);
Logger.Error($"{respStr}", this);
return false;
}
webSocket.Options.SetBuffer(512, 512);
webSocket.ConnectAsync(uri, CancellationToken.None).Wait();
if (webSocket.State == WebSocketState.Open)
{
Logger.Info($"连接 WebSocket 成功", this);
var ReceiveTask = new Task(ReceiveProcess);
ReceiveTask.Start();
}
return true;
}
catch (Exception e)
{
Logger.Error($"连接websocket发生异常 {e.Message}", this);
}
Task.Delay(3000).Wait();
}
}
private void ReceiveProcess()
{
try
{
byte[] buff = new byte[1024];
ArraySegment<byte> arraysegment = new ArraySegment<byte>(buff);
List<byte> receviedData = new List<byte>();
while (webSocket.State == WebSocketState.Open)
{
buff.Initialize();
WebSocketReceiveResult res = webSocket.ReceiveAsync(arraysegment, CancellationToken.None).Result;
if (res != null && res.Count > 0)
{
for (int i = 0; i < res.Count; i++)
{
receviedData.Add(buff[i]);
}
if (res.EndOfMessage)
{
ParseData(receviedData.ToArray());
receviedData.Clear();
}
}
}
}
catch (Exception e)
{
Logger.Error($"接受进程发生异常 {e.Message}", this);
Connect();
}
}
private void ParseData(byte[] data)
{
string datastr = Encoding.UTF8.GetString(data);
try
{
Logger.Info($"收到消息 {datastr} ", this);
JObject dataJson = JObject.Parse(datastr);
if (dataJson.ContainsKey("envelope_id"))
{
JObject ackJson = new JObject
{
{ "envelope_id", dataJson["envelope_id"] }
};
webSocket.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(ackJson.ToString())), WebSocketMessageType.Text, true, CancellationToken.None).Wait();
JObject eventJson = (JObject)dataJson["payload"]["event"];
string type = eventJson["type"].ToString();
switch (type)
{
case "app_mention":
{
string content = "";
JArray blocksJson = (JArray)eventJson["blocks"];
foreach (JObject blockJson in blocksJson)
{
JArray elementsJson = (JArray)blockJson["elements"];
foreach (JObject elementJson in elementsJson)
{
if (elementJson["type"].ToString().Equals("rich_text_section"))
{
JArray elesJson = (JArray)elementJson["elements"];
foreach (JObject eleJson in elesJson)
{
if (eleJson["type"].ToString().Equals("text"))
content += eleJson["text"].ToString();
}
}
}
}
if (IsRiddling)
{
bool right = content.Equals(RiddlePool[RiddleIndex].Answer);
if (!right)
{
foreach (string key in RiddlePool[RiddleIndex].keys)
{
if (content.Contains(key))
{
right = true;
break;
}
}
}
if (right)
{
int i = _random.Next(ReplyDic["right"].Length);
string message = ReplyDic["right"][i];
message = $"<@{eventJson["user"]}> " + message;
Say(RiddleChannel, $"{message} 答案就是 {RiddlePool[RiddleIndex].Answer}");
RiddleUnveiled = true;
}
else
{
int i = _random.Next(ReplyDic["wrong"].Length);
string message = ReplyDic["wrong"][i];
message = $"<@{eventJson["user"]}> " + message;
Say(RiddleChannel, $"{message}");
}
}
else
{
string[] s = new string[] {
"收到!",
"嗯",
"干嘛?",
"好吧!",
"我忙,你很闲么?",
};
string reply = $"<@{eventJson["user"]}> {s[_random.Next(s.Length)]}";
Say(eventJson["channel"].ToString(), reply);
}
}
break;
}
}
}
catch (Exception e)
{
Logger.Error($"[websocket] 调用解析方法发生异常 {e.Message}\n{e.StackTrace}", this);
}
}
public bool Riddle(string channelId, List<Riddle> pool)
{
if (!IsRiddling)
{
RiddlePool.Clear();
RiddlePool.AddRange(pool);
RiddleChannel = channelId;
Task.Run(RiddleJob);
}
else
{
IsRiddling = false;
Say(RiddleChannel,$"<!here> 我要去屙粑粑了,谜语的事情下次再说");
}
return true;
}
private void RiddleJob()
{
IsRiddling = true;
DateTime lastRiddleTime = DateTime.MinValue;
DateTime lastTipTime = DateTime.Now;
RiddleIndex = _random.Next(0, RiddlePool.Count);
RiddleUnveiled = true;
Say(RiddleChannel, "<!here> 来来来,我们来猜谜语吧!");
while (IsRiddling)
{
//timeout,new riddle
if (lastRiddleTime.AddMinutes(3) < DateTime.Now)
{
if (!RiddleUnveiled)
{
Say(RiddleChannel, $"算了算了,看来没人能猜到了,答案是 {RiddlePool[RiddleIndex].Answer} !");
RiddleUnveiled = true;
}
else if (lastRiddleTime.AddMinutes(3).AddSeconds(20) < DateTime.Now)
{
if (lastRiddleTime.AddMinutes(10) > DateTime.Now)
{
string[] s = new string[] {
"又要来了哦,你们准备好了没?",
"刚才的谜语有点简单了,现在出个高难度的。",
"有人好像不服气,那再来一个吧……",
"嗯,下一个谜语,预备,开始!"
};
Say(RiddleChannel, s[_random.Next(s.Length)]);
}
RiddleIndex++;
if (RiddleIndex >= RiddlePool.Count) RiddleIndex = 0;
RiddleUnveiled = false;
lastRiddleTime = DateTime.Now;
lastTipTime = DateTime.Now;
Say(RiddleChannel, RiddlePool[RiddleIndex].Question);
Say(RiddleChannel, "猜到了请@我!");
}
}
//tips
else if (!RiddleUnveiled && lastTipTime.AddSeconds(40) < DateTime.Now && (lastRiddleTime.AddMinutes(3) - lastTipTime).TotalSeconds > 20)
{
string[] tips = new string[] {
"大家都来猜猜看哦!猜到的请@我",
"猜到的快点@我,真的没人猜得到吗?",
"不要百度,猜到的可以@我,有人可以猜到吗?",
"不是很难嘛,猜到的请@我",
};
Say(RiddleChannel, "现在的谜语是:" + RiddlePool[RiddleIndex].Question);
Say(RiddleChannel, tips[_random.Next(tips.Length)]);
lastTipTime = DateTime.Now;
}
Task.Delay(1000);
}
RiddleIndex = -1;
}
}
}
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace BotMonitor.Lib
{
public class GitLabClient
{
private readonly string _token;
private readonly string _url;
private readonly HttpClient httpClient;
public GitLabClient(string token, string url)
{
httpClient = new HttpClient();
_token = token;
_url = url;
}
public Project[] LoadProjects()
{
string EndPoint = "/projects";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Get, $"{_url}{EndPoint}");
req.Headers.Add("PRIVATE-TOKEN", _token);
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string content = resp.Content.ReadAsStringAsync().Result;
if (resp.IsSuccessStatusCode)
{
List<Project> ret = new List<Project>();
JArray pArray = JArray.Parse(content);
foreach (JObject p in pArray)
{
ret.Add(new Project
{
Id = p["id"].ToString(),
Name = p["name"].ToString(),
CreateTime = DateTime.Parse(p["created_at"].ToString().Replace("T", " ").Replace("Z", ""))
});
}
return ret.ToArray();
}
return null;
}
public string GetLastCommit(string id, string branch)
{
string EndPoint = $"/projects/{id}/repository/commits/{branch}";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Get, $"{_url}{EndPoint}");
req.Headers.Add("PRIVATE-TOKEN", _token);
HttpResponseMessage resp = httpClient.SendAsync(req).Result;
string content = resp.Content.ReadAsStringAsync().Result;
if (resp.IsSuccessStatusCode)
{
JObject json = JObject.Parse(content);
return json["title"].ToString();
}
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BotMonitor.Lib
{
public class MaoLogger
{
private readonly MainForm _form;
private readonly AddLogProcDelegate AddLogDele;
private readonly TextBox LogTextBox;
public MaoLogger(MainForm form)
{
_form = form;
Control[] controls = _form.Controls.Find("__LogTextBox", true);
LogTextBox = controls[0] as TextBox;
AddLogDele = AddLog;
}
private void AddLog(LogLevel Level, string msg, BaseBot bot)
{
if (string.IsNullOrEmpty(msg)) return;
if (_form.InvokeRequired)
{
_form.Invoke(AddLogDele, Level, msg, bot);
}
else
{
if (LogTextBox != null && !LogTextBox.IsDisposed)
{
string text = LogTextBox.Text;
string botname = (bot != null)?bot.Guid.ToString():"null";
string newtext = $"[{DateTime.Now:HH:mm:ss.fffff}]({botname}) " + msg;
newtext += Environment.NewLine;
text = newtext + text;
while (text.Length > 10000)
{
int idx = text.LastIndexOf(Environment.NewLine);
text = text.Substring(0, idx);
}
LogTextBox.Text = text;
}
}
}
public void Info(string msg, BaseBot bot = null)
{
AddLog(LogLevel.INFO, msg, bot);
}
public void Debug(string msg, BaseBot bot = null)
{
AddLog(LogLevel.DEBUG, msg, bot);
}
public void Error(string msg, BaseBot bot = null)
{
AddLog(LogLevel.ERROR, msg, bot);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BotMonitor.Lib
{
public delegate void AddLogProcDelegate(LogLevel Level, string msg, BaseBot Bot);
public enum LogLevel
{
DEBUG,
INFO,
WARN,
ERROR
}
public class Channel {
public string Id { get; set; }
public string Name { get; set; }
}
public class Riddle
{
public string Question { get; set; }
public string Answer { get; set; }
public string[] keys { get; set; }
}
public class Project {
public string Id { get; set; }
public string Name { get; set; }
public DateTime CreateTime { get; set; }
}
}

namespace BotMonitor
{
partial class MainForm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.@__LogTextBox = new System.Windows.Forms.TextBox();
this.BTN_Channels = new System.Windows.Forms.Button();
this.LIST_Channels = new System.Windows.Forms.ListBox();
this.BTN_Say = new System.Windows.Forms.Button();
this.TEXTBOX_Msg = new System.Windows.Forms.TextBox();
this.BTN_Riddle = new System.Windows.Forms.Button();
this.BTN_Projects = new System.Windows.Forms.Button();
this.LIST_Projects = new System.Windows.Forms.ListBox();
this.BTN_Publish = new System.Windows.Forms.Button();
this.TEXTBOX_Branch = new System.Windows.Forms.TextBox();
this.TEXTBOX_Env = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// __LogTextBox
//
this.@__LogTextBox.AcceptsReturn = true;
this.@__LogTextBox.BackColor = System.Drawing.Color.LightGray;
this.@__LogTextBox.Dock = System.Windows.Forms.DockStyle.Right;
this.@__LogTextBox.ForeColor = System.Drawing.Color.Black;
this.@__LogTextBox.Location = new System.Drawing.Point(718, 0);
this.@__LogTextBox.Multiline = true;
this.@__LogTextBox.Name = "__LogTextBox";
this.@__LogTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.@__LogTextBox.Size = new System.Drawing.Size(416, 619);
this.@__LogTextBox.TabIndex = 0;
//
// BTN_Channels
//
this.BTN_Channels.Location = new System.Drawing.Point(13, 13);
this.BTN_Channels.Name = "BTN_Channels";
this.BTN_Channels.Size = new System.Drawing.Size(75, 23);
this.BTN_Channels.TabIndex = 1;
this.BTN_Channels.Text = "获取频道";
this.BTN_Channels.UseVisualStyleBackColor = true;
this.BTN_Channels.Click += new System.EventHandler(this.BTN_Channels_Click);
//
// LIST_Channels
//
this.LIST_Channels.FormattingEnabled = true;
this.LIST_Channels.ItemHeight = 12;
this.LIST_Channels.Location = new System.Drawing.Point(13, 43);
this.LIST_Channels.Name = "LIST_Channels";
this.LIST_Channels.Size = new System.Drawing.Size(326, 112);
this.LIST_Channels.TabIndex = 2;
//
// BTN_Say
//
this.BTN_Say.Location = new System.Drawing.Point(264, 159);
this.BTN_Say.Name = "BTN_Say";
this.BTN_Say.Size = new System.Drawing.Size(75, 23);
this.BTN_Say.TabIndex = 3;
this.BTN_Say.Text = "说";
this.BTN_Say.UseVisualStyleBackColor = true;
this.BTN_Say.Click += new System.EventHandler(this.BTN_Say_Click);
//
// TEXTBOX_Msg
//
this.TEXTBOX_Msg.Location = new System.Drawing.Point(13, 161);
this.TEXTBOX_Msg.Name = "TEXTBOX_Msg";
this.TEXTBOX_Msg.Size = new System.Drawing.Size(245, 21);
this.TEXTBOX_Msg.TabIndex = 4;
//
// BTN_Riddle
//
this.BTN_Riddle.Location = new System.Drawing.Point(13, 188);
this.BTN_Riddle.Name = "BTN_Riddle";
this.BTN_Riddle.Size = new System.Drawing.Size(75, 23);
this.BTN_Riddle.TabIndex = 5;
this.BTN_Riddle.Text = "谜语";
this.BTN_Riddle.UseVisualStyleBackColor = true;
this.BTN_Riddle.Click += new System.EventHandler(this.BTN_Riddle_Click);
//
// BTN_Projects
//
this.BTN_Projects.Location = new System.Drawing.Point(13, 227);
this.BTN_Projects.Name = "BTN_Projects";
this.BTN_Projects.Size = new System.Drawing.Size(75, 23);
this.BTN_Projects.TabIndex = 6;
this.BTN_Projects.Text = "获取项目";
this.BTN_Projects.UseVisualStyleBackColor = true;
this.BTN_Projects.Click += new System.EventHandler(this.BTN_Projects_Click);
//
// LIST_Projects
//
this.LIST_Projects.FormattingEnabled = true;
this.LIST_Projects.ItemHeight = 12;
this.LIST_Projects.Location = new System.Drawing.Point(13, 257);
this.LIST_Projects.Name = "LIST_Projects";
this.LIST_Projects.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.LIST_Projects.Size = new System.Drawing.Size(326, 280);
this.LIST_Projects.TabIndex = 7;
//
// BTN_Publish
//
this.BTN_Publish.Location = new System.Drawing.Point(264, 543);
this.BTN_Publish.Name = "BTN_Publish";
this.BTN_Publish.Size = new System.Drawing.Size(75, 23);
this.BTN_Publish.TabIndex = 8;
this.BTN_Publish.Text = "请求发布";
this.BTN_Publish.UseVisualStyleBackColor = true;
this.BTN_Publish.Click += new System.EventHandler(this.BTN_Publish_Click);
//
// TEXTBOX_Branch
//
this.TEXTBOX_Branch.Location = new System.Drawing.Point(158, 544);
this.TEXTBOX_Branch.Name = "TEXTBOX_Branch";
this.TEXTBOX_Branch.Size = new System.Drawing.Size(100, 21);
this.TEXTBOX_Branch.TabIndex = 9;
this.TEXTBOX_Branch.Text = "dev";
//
// TEXTBOX_Env
//
this.TEXTBOX_Env.Location = new System.Drawing.Point(47, 544);
this.TEXTBOX_Env.Name = "TEXTBOX_Env";
this.TEXTBOX_Env.Size = new System.Drawing.Size(70, 21);
this.TEXTBOX_Env.TabIndex = 10;
this.TEXTBOX_Env.Text = "test";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 548);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 11;
this.label1.Text = "环境";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(123, 548);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 12;
this.label2.Text = "分支";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1134, 619);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.TEXTBOX_Env);
this.Controls.Add(this.TEXTBOX_Branch);
this.Controls.Add(this.BTN_Publish);
this.Controls.Add(this.LIST_Projects);
this.Controls.Add(this.BTN_Projects);
this.Controls.Add(this.BTN_Riddle);
this.Controls.Add(this.TEXTBOX_Msg);
this.Controls.Add(this.BTN_Say);
this.Controls.Add(this.LIST_Channels);
this.Controls.Add(this.BTN_Channels);
this.Controls.Add(this.@__LogTextBox);
this.Name = "MainForm";
this.Text = "BotMonitor";
this.Load += new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox __LogTextBox;
private System.Windows.Forms.Button BTN_Channels;
private System.Windows.Forms.ListBox LIST_Channels;
private System.Windows.Forms.Button BTN_Say;
private System.Windows.Forms.TextBox TEXTBOX_Msg;
private System.Windows.Forms.Button BTN_Riddle;
private System.Windows.Forms.Button BTN_Projects;
private System.Windows.Forms.ListBox LIST_Projects;
private System.Windows.Forms.Button BTN_Publish;
private System.Windows.Forms.TextBox TEXTBOX_Branch;
private System.Windows.Forms.TextBox TEXTBOX_Env;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}
using BotMonitor.Lib;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
namespace BotMonitor
{
public partial class MainForm : Form
{
private readonly MaoLogger Logger;
private readonly BaseBot _bot;
private readonly GitLabClient _gitLabClient;
public MainForm()
{
InitializeComponent();
Logger = new MaoLogger(this);
_gitLabClient = new GitLabClient("grdmKWTdovyPrdwP8Pwk", "https://gitlab.matrixone.io/api/v4");
_bot = new BaseBot(
"xoxb-2598466373698-2741134858035-g0HeX2zouRM2O7mLdNgyRKF0",
"xapp-1-A02N5LTJGBT-2742085908322-aa899f8bab5388c385744a1b3822852cea7b896ad8acada198135d7a8d23d47b",
Logger);
Logger.Info("nihao chengdu");
}
private void BTN_Channels_Click(object sender, EventArgs e)
{
_bot.Test();
Channel[] chs = _bot.GetAllChannel();
LIST_Channels.Items.Clear();
foreach (Channel ch in chs)
{
LIST_Channels.Items.Add($"{ch.Name}|{ch.Id}");
}
}
private void BTN_Say_Click(object sender, EventArgs e)
{
if (LIST_Channels.SelectedItem != null)
{
string channelId = LIST_Channels.SelectedItem.ToString().Split('|')[1];
string msg = TEXTBOX_Msg.Text;
_bot.Say(channelId, msg);
}
}
private void MainForm_Load(object sender, EventArgs e)
{
_bot.Connect();
}
private void BTN_Riddle_Click(object sender, EventArgs e)
{
if (LIST_Channels.SelectedItem != null)
{
string channelId = LIST_Channels.SelectedItem.ToString().Split('|')[1];
string rstr = File.ReadAllText("riddle.dat");
JArray rJson = JArray.Parse(rstr);
_bot.Riddle(channelId, rJson.ToObject<List<Riddle>>());
}
}
private void BTN_Projects_Click(object sender, EventArgs e)
{
Project[] projects = _gitLabClient.LoadProjects();
LIST_Projects.Items.Clear();
foreach (Project p in projects)
{
LIST_Projects.Items.Add($"{p.Name}|{p.Id}");
}
}
private void BTN_Publish_Click(object sender, EventArgs e)
{
string branch = TEXTBOX_Branch.Text;
string env = TEXTBOX_Env.Text;
if (LIST_Channels.SelectedItem != null)
{
string channelId = LIST_Channels.SelectedItem.ToString().Split('|')[1];
foreach (string item in LIST_Projects.SelectedItems)
{
string pname= item.Split('|')[0];
string commit = _gitLabClient.GetLastCommit(item.Split('|')[1],"dev");
string msg = $"项目:{pname}\n分支:{env}\n环境:{branch}\n{commit}";
_bot.Say(channelId, msg);
}
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BotMonitor
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("BotMonitor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BotMonitor")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("c9c2633d-aeaf-47ca-8bcb-fdf3ac5a5f64")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace BotMonitor.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BotMonitor.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BotMonitor.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
</packages>
\ No newline at end of file
[
{
"Question": "二十路电车驶入北口,铛铛铛铛 --- 猜一个字",
"Answer": "燕",
"keys": [
"燕"
]
},
{
"Question": "玄德在时无祸灾 --- 猜一个成语",
"Answer": "有备无患",
"keys": [
"有备无患"
]
},
{
"Question": "弟兄十个肚里空,有皮无骨爱过冬,不怕风雪不怕寒,越冷它就越猖狂 --- 猜一个物品",
"Answer": "手套",
"keys": [
"手套"
]
},
{
"Question": "兄弟几个真和气,天天并肩坐一起,少时喜爱绿衣裳,老来都穿黄色衣 --- 猜一个水果",
"Answer": "香蕉",
"keys": [
"香蕉",
"芭蕉"
]
},
{
"Question": "小时着黑衣,长大穿绿袍,水里过日子,岸上来睡觉 --- 猜一个动物",
"Answer": "青蛙",
"keys": [
"青蛙",
"蛙"
]
},
{
"Question": "开隧道质量第一 --- 猜一个动物",
"Answer": "穿山甲",
"keys": [
"穿山甲"
]
},
{
"Question": "远看芝麻撒地,近看黑驴运米,不怕山高道路陡,只怕跌进热锅里 --- 猜一个动物",
"Answer": "蚂蚁",
"keys": [
"蚁"
]
},
{
"Question": "一曲高歌夕阳下 --- 猜一个字",
"Answer": "曹",
"keys": [
"曹"
]
},
{
"Question": "一人腰上挂把弓 --- 猜一个字",
"Answer": "夷",
"keys": [
"夷"
]
},
{
"Question": "去有来没有,走有停没有,坐有站没有,地有天没有。 --- 猜一个字",
"Answer": "土",
"keys": [
"土"
]
},
{
"Question": "二十一日有人来。 --- 猜一个字",
"Answer": "借",
"keys": [
"借"
]
},
{
"Question": "三十而立,大有奔头。 --- 猜一个字",
"Answer": "卉",
"keys": [
"卉"
]
},
{
"Question": "老太婆打呵欠。 --- 猜一个成语",
"Answer": "一望无涯",
"keys": [
"一望无涯"
]
},
{
"Question": "两人力大冲破天 --- 猜一个字",
"Answer": "夫",
"keys": [
"夫"
]
},
{
"Question": "一物长得真奇怪,腰里长出胡子来,拨开胡子看一看,露出牙齿一排排 --- 猜一农作物",
"Answer": "玉米",
"keys": [
"玉米",
"包谷",
"玉蜀黍"
]
},
{
"Question": "有洞不见虫,有巢不见蜂,有丝不见蚕,撑伞不见人 --- 猜一植物",
"Answer": "藕",
"keys": [
"藕"
]
}
]
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31911.196
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotMonitor", "BotMonitor\BotMonitor.csproj", "{C9C2633D-AEAF-47CA-8BCB-FDF3AC5A5F64}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9C2633D-AEAF-47CA-8BCB-FDF3AC5A5F64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9C2633D-AEAF-47CA-8BCB-FDF3AC5A5F64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9C2633D-AEAF-47CA-8BCB-FDF3AC5A5F64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9C2633D-AEAF-47CA-8BCB-FDF3AC5A5F64}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94E42100-8D85-4C5A-9DF4-E8308BB58297}
EndGlobalSection
EndGlobal
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment