KonataDev / Konata.Core

Android QQ protocol core implementation written in C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug report] Cannot enable all-mute mode by giving argument 'memberUin' Zero & Cannot unmute member by giving argument 'muteSeconds' Zero

Misaka12456 opened this issue · comments

Environment / 环境
Konata.Core 1.3.1
Microsoft Windows Server 2022 x64

Expected behavior / 预期行为

  1. memberUin == 0时对Konata.Core.Interfaces.Api.GroupExt.GroupMuteMember()方法的执行效果变成启用/禁用全员禁言
  2. memberUin != 0muteSeconds == 0时对Konata.Core.Interfaces.Api.GroupExt.GroupMuteMember()方法的执行效果变成解禁指定成员

To Reproduce / 复现

  1. 尝试使用以下代码启用全员禁言
if (targetUin == 0)
{
	if (!Convert.ToBoolean(group.Muted))
	{
		bool r = await Bot.GroupMuteMember(group.Uin, 0, 43200 * 60);
		if (r)
		{
			sb.Append("处理完成");
		}
		else
		{
			sb.Append("处理失败");
		}
	}
	else
	{
		sb.Append("执行失败: 当前群聊已处于全员禁言状态");
	}
}
  1. 尝试使用以下代码取消某个成员的禁言
if (targetUin != 0)
{
	if (targetUin != Bot.Uin)
	{
		bool r = await Bot.GroupMuteMember(group.Uin, targetUin, 0);
		if (r)
		{
			sb.Append("处理完成");
		}
		else
		{
			sb.Append("处理失败");
		}
	}	
	else
	{
		sb.Append("执行失败: 无法对Bot执行自解禁操作");
	}
}

Stack trace / 堆栈信息

  1. 对于全员禁言:
System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Konata.Core.Components.ConfigComponent.GetMemberInfo(UInt32 groupUin, UInt32 memberUin)
   at Konata.Core.Components.Logics.Model.OperationLogic.GroupMuteMember(UInt32 groupUin, UInt32 memberUin, UInt32 timeSeconds)
  1. 对于解禁成员:
Konata.Core.Exceptions.Model.OperationFailedException: Failed to mute member: Assert failed. Ret => 203
   at Konata.Core.Components.Logics.Model.OperationLogic.GroupMuteMember(UInt32 groupUin, UInt32 memberUin, UInt32 timeSeconds)