Merge branch 'develop'
This commit is contained in:
@@ -68,22 +68,23 @@ public class CommandBoop extends Command
|
|||||||
{
|
{
|
||||||
if(input.mentions == null)
|
if(input.mentions == null)
|
||||||
{
|
{
|
||||||
|
// No one is booped, just the bot!
|
||||||
boopTracker.applyBoop();
|
boopTracker.applyBoop();
|
||||||
res.send(String.format(LocStrings.stub("BoopStandard"), user.name, boopTracker.howMany()));
|
res.send(String.format(LocStrings.stub("BoopStandard"), user.name, boopTracker.howMany()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// When someone boops one other person
|
||||||
if(input.mentions.length == 1)
|
if(input.mentions.length == 1)
|
||||||
{
|
{
|
||||||
boopTracker.applyBoop();
|
|
||||||
res.send(String.format(LocStrings.stub("BoopPerson"), user.name, input.mentions[0].name));
|
res.send(String.format(LocStrings.stub("BoopPerson"), user.name, input.mentions[0].name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A number of people have been booped
|
||||||
String booped = "";
|
String booped = "";
|
||||||
for(int i = 0; i < input.mentions.length; i++)
|
for(int i = 0; i < input.mentions.length; i++)
|
||||||
{
|
{
|
||||||
boopTracker.applyBoop();
|
|
||||||
if(i < input.mentions.length-1)
|
if(i < input.mentions.length-1)
|
||||||
booped += input.mentions[i].name + ", ";
|
booped += input.mentions[i].name + ", ";
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,13 +6,40 @@ public class NetworkColiru
|
|||||||
{
|
{
|
||||||
public String compileCPlusPlus(String query)
|
public String compileCPlusPlus(String query)
|
||||||
{
|
{
|
||||||
// Escape characters that need escaping.
|
// Escape characters that need escaping - mostly whitespace.
|
||||||
// Primarily types of whitespace.
|
|
||||||
query = query.replace("\\n", "\\\\n");
|
query = query.replace("\\n", "\\\\n");
|
||||||
query = query.replace("\\t", "\\\\t");
|
query = query.replace("\\t", "\\\\t");
|
||||||
query = query.replace("\n", "\\n");
|
query = query.replace("\n", "\\n");
|
||||||
query = query.replace("\"", "\\\"");
|
query = query.replace("\"", "\\\"");
|
||||||
query = query.replace("\t", "\\t");
|
query = query.replace("\t", "\\t");
|
||||||
|
query = query.replace("`", "");
|
||||||
|
|
||||||
|
// // replace backticks on only the edges of the string.
|
||||||
|
// StringBuilder s = new StringBuilder(query);
|
||||||
|
//
|
||||||
|
// for(int i = 0; i < s.length(); ++i)
|
||||||
|
// {
|
||||||
|
// if(s.charAt(i) != '`')
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// s.setCharAt(i, ' ');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for(int i = s.length() - 1; i >= 0; --i)
|
||||||
|
// {
|
||||||
|
// if(s.charAt(i) != '`')
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// s.setCharAt(i, ' ');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// query = s.toString().trim();
|
||||||
|
|
||||||
|
// Determine if the query is effectively empty or not. If it is, don't attempt to compile it.
|
||||||
|
if(query.trim().length() == 0)
|
||||||
|
{
|
||||||
|
return "I can't compile nothing!";
|
||||||
|
}
|
||||||
|
|
||||||
// Send the compilation request!
|
// Send the compilation request!
|
||||||
String result = HTTPUtils.sendPOSTRequest("http://coliru.stacked-crooked.com/compile"
|
String result = HTTPUtils.sendPOSTRequest("http://coliru.stacked-crooked.com/compile"
|
||||||
@@ -21,7 +48,7 @@ public class NetworkColiru
|
|||||||
// If we got a valid response...
|
// If we got a valid response...
|
||||||
if(!result.isEmpty())
|
if(!result.isEmpty())
|
||||||
{
|
{
|
||||||
result = "Here's what happened when I went to compiled that! \n```" + result + "```";
|
result = "Here's what happened when I went to compile that! \n```" + result + "```";
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user