Kaynağa Gözat

Fixed issue where long results would cause Combot to flood.

tags/3.0.5^0
Teknikode 4 yıl önce
ebeveyn
işleme
fcdcc5ba1c

+ 6
- 1
Modules/Wolfram Alpha/Module.Default.json Dosyayı Görüntüle

@@ -49,7 +49,12 @@
{
"Name": "API",
"Description": "The API key for Wolfram Alpha.",
"Value": "892JG5-XVQVU5JUEW"
"Value": ""
},
{
"Name": "Max Response Length",
"Description": "The maximum length for the response to be.",
"Value": 400
}
]
}

+ 7
- 1
Modules/Wolfram Alpha/Wolfram_Alpha.cs Dosyayı Görüntüle

@@ -1,4 +1,5 @@
using System.Net;
using System;
using System.Net;
using System.Text;
using System.Web;
using System.Xml;
@@ -45,6 +46,11 @@ namespace Combot.Modules.Plugins
{
string queryMessage = string.Format("Result for: {0}", xnList[0]["subpod"]["plaintext"].InnerText);
string resultMessage = xnList[1]["subpod"]["plaintext"].InnerText;
int maxResults = Convert.ToInt32(GetOptionValue("Max Response Length"));
if (resultMessage.Length > (int)maxResults)
{
resultMessage = string.Format("{0}...", resultMessage.Substring(0, (int)maxResults));
}
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, queryMessage);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, resultMessage);
}

Loading…
İptal
Kaydet