diff --git a/Core/Commands/Chat.cs b/Core/Commands/Chat.cs index 4802d50..22ae02f 100644 --- a/Core/Commands/Chat.cs +++ b/Core/Commands/Chat.cs @@ -39,19 +39,19 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "chat", "Say", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted"); } - if (helpers.notempty(message) == false) + if (helpers.isempty(message) == true) { - return BasicReply("Message empty"); + return Failure("Message empty"); } if(int.TryParse(channel,out int channelnum) == false) { - return BasicReply("Invaild channel"); + return Failure("Invaild channel"); } if(channelnum < 0) { - return BasicReply("Invaild channel"); + return Failure("Invaild channel"); } bot.GetClient.Self.Chat(message, channelnum, ChatType.Normal); return BasicReply(JsonConvert.SerializeObject(bot.getLocalChatHistory())); @@ -69,16 +69,16 @@ namespace BetterSecondBot.HttpService { if (tokens.Allow(token, "chat", "IM", handleGetClientIP()) == false) { - return BasicReply("Token not accepted"); + return Failure("Token not accepted"); } ProcessAvatar(avatar); if(avataruuid == UUID.Zero) { - return BasicReply("avatar lookup"); + return Failure("avatar lookup"); } - if (helpers.notempty(message) == false) + if (helpers.isempty(message) == true) { - return BasicReply("Message empty"); + return Failure("Message empty"); } bot.SendIM(avataruuid, message); return BasicReply("ok"); diff --git a/Core/Commands/Group.cs b/Core/Commands/Group.cs index 6297677..d1f6b94 100644 --- a/Core/Commands/Group.cs +++ b/Core/Commands/Group.cs @@ -164,11 +164,6 @@ namespace BetterSecondBot.HttpService { return Failure("avatar lookup"); } - bool status = bot.FastCheckInGroup(groupuuid, avataruuid); - if(status == false) - { - return BasicReply("Not in group"); - } bot.GetClient.Groups.EjectUser(groupuuid, avataruuid); return BasicReply("Requested"); } diff --git a/Shared/Staic/Helpers.cs b/Shared/Staic/Helpers.cs index b5682b0..a034397 100644 --- a/Shared/Staic/Helpers.cs +++ b/Shared/Staic/Helpers.cs @@ -246,8 +246,20 @@ namespace BetterSecondBotShared.Static } } return false; - } + + public static bool isempty(string V) + { + if (V != null) + { + if (V.Length > 0) + { + return false; + } + } + return true; + } + public static bool notempty(string[] V) { if (V != null)