updates the discord full fat client to use command history hook and SendIM hook

This commit is contained in:
Madpeter 2020-04-26 00:03:54 +01:00
parent 2b1daf6045
commit 8168f334ce

View file

@ -430,14 +430,6 @@ namespace BSB.bottypes
{
status = CommandsInterface.Call(command);
}
if (status == true)
{
_ = SendMessageToChannelAsync("interface", "Command running: " + message.Content + "", "bot", UUID.Zero, myconfig.userName, "bot");
}
else
{
_ = SendMessageToChannelAsync("interface", "Command rejected: " + message.Content + "", "bot", UUID.Zero, myconfig.userName, "bot");
}
}
else
{
@ -553,6 +545,31 @@ namespace BSB.bottypes
await DiscordBotChatControler(message, sender_name, sender_uuid, avatar, group, group_uuid, localchat, fromme);
}
public override void CommandHistoryAdd(string command, string arg, bool status)
{
base.CommandHistoryAdd(command, arg, status);
if (status == true)
{
_ = SendMessageToChannelAsync("interface", "Command running: " + command + " ["+arg+"]", "bot", UUID.Zero, myconfig.userName, "bot");
}
else
{
_ = SendMessageToChannelAsync("interface", "Command rejected: " + command + " [" + arg + "]", "bot", UUID.Zero, myconfig.userName, "bot");
}
}
public async override void sendIM(UUID avatar, string message)
{
base.sendIM(avatar, message);
if(AvatarKey2Name.ContainsKey(avatar) == true)
{
if (DiscordClientConnected == true)
{
await DiscordIMMessage(avatar, AvatarKey2Name[avatar], message).ConfigureAwait(false);
}
}
}
protected async Task DiscordBotChatControler(string message, string sender_name, UUID sender_uuid, bool avatar, bool group, UUID group_uuid, bool localchat, bool fromme)
{
if (myconfig.DiscordFullServer == false)