RLV patch for version commands, now if you dont define a channel it will default to zero

This commit is contained in:
Madpeter 2020-09-07 00:00:23 +01:00
parent 93e95c98d0
commit 39359368f6
3 changed files with 30 additions and 9 deletions

View file

@ -4,17 +4,24 @@ using System.Text;
namespace BSB.RLV.Version namespace BSB.RLV.Version
{ {
public class Version : RLV_command_1arg public class Version : RLV_command
{ {
public override bool CallFunction(string[] args) public override bool CallFunction(string[] args)
{ {
_ = int.TryParse(args[0], out int channel); int channel = 0;
if (args.Length == 1)
{
_ = int.TryParse(args[0], out channel);
}
if (channel >= 0) if (channel >= 0)
{ {
bot.GetClient.Self.Chat("RestrainedLife BOT (RLVa 2.9)", channel, OpenMetaverse.ChatType.Normal); bot.GetClient.Self.Chat("RestrainedLife BOT (RLVa 2.9)", channel, OpenMetaverse.ChatType.Normal);
return true; return true;
} }
return Failed("Invaild channel given"); else
{
return Failed("Invaild channel given");
}
} }
} }
} }

View file

@ -4,17 +4,24 @@ using System.Text;
namespace BSB.RLV.Version namespace BSB.RLV.Version
{ {
public class VersionNew : RLV_command_1arg public class VersionNew : RLV_command
{ {
public override bool CallFunction(string[] args) public override bool CallFunction(string[] args)
{ {
_ = int.TryParse(args[0], out int channel); int channel = 0;
if (args.Length == 1)
{
_ = int.TryParse(args[0], out channel);
}
if (channel >= 0) if (channel >= 0)
{ {
bot.GetClient.Self.Chat("RestrainedLove BOT (RLVa 2.9)", channel, OpenMetaverse.ChatType.Normal); bot.GetClient.Self.Chat("RestrainedLove BOT (RLVa 2.9)", channel, OpenMetaverse.ChatType.Normal);
return true; return true;
} }
return Failed("Invaild channel given"); else
{
return Failed("Invaild channel given");
}
} }
} }
} }

View file

@ -4,17 +4,24 @@ using System.Text;
namespace BSB.RLV.Version namespace BSB.RLV.Version
{ {
public class VersionNum : RLV_command_1arg public class VersionNum : RLV_command
{ {
public override bool CallFunction(string[] args) public override bool CallFunction(string[] args)
{ {
_ = int.TryParse(args[0], out int channel); int channel = 0;
if (args.Length == 1)
{
_ = int.TryParse(args[0], out channel);
}
if (channel >= 0) if (channel >= 0)
{ {
bot.GetClient.Self.Chat("209000", channel, OpenMetaverse.ChatType.Normal); bot.GetClient.Self.Chat("209000", channel, OpenMetaverse.ChatType.Normal);
return true; return true;
} }
return Failed("Invaild channel given"); else
{
return Failed("Invaild channel given");
}
} }
} }
} }