Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

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

Open
Misaka12456 opened this issue May 5, 2022 · 0 comments
Assignees
Labels
bug (°ー°〃) Something isn't working

Comments

@Misaka12456
Copy link
Member

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)
@TheSnowfield TheSnowfield self-assigned this May 5, 2022
@TheSnowfield TheSnowfield added the bug (°ー°〃) Something isn't working label May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug (°ー°〃) Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants