当前位置: 首页>>代码示例>>C#>>正文


C# DiscordClient.RaiseOnDebugMessage方法代码示例

本文整理汇总了C#中Discord.DiscordClient.RaiseOnDebugMessage方法的典型用法代码示例。如果您正苦于以下问题:C# DiscordClient.RaiseOnDebugMessage方法的具体用法?C# DiscordClient.RaiseOnDebugMessage怎么用?C# DiscordClient.RaiseOnDebugMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Discord.DiscordClient的用法示例。


在下文中一共展示了DiscordClient.RaiseOnDebugMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Server

		internal Server(string id, DiscordClient client)
		{
			Id = id;
			_client = client;
			_bans = new ConcurrentDictionary<string, bool>();
			_members = new AsyncCache<Membership, API.Models.MemberInfo>(
				(key, parentKey) =>
				{
					if (_client.IsDebugMode)
						_client.RaiseOnDebugMessage(DebugMessageType.Cache, $"Created user {key} in server {parentKey}.");
                    return new Membership(parentKey, key, _client);
				},
				(member, model) =>
				{
					if (model is API.Models.PresenceMemberInfo)
					{
						var extendedModel = model as API.Models.PresenceMemberInfo;
						member.Status = extendedModel.Status;
						member.GameId = extendedModel.GameId;
					}
					if (model is API.Models.VoiceMemberInfo)
					{
						var extendedModel = model as API.Models.VoiceMemberInfo;
						member.VoiceChannelId = extendedModel.ChannelId;
						member.IsDeafened = extendedModel.IsDeafened;
						member.IsMuted = extendedModel.IsMuted;
						if (extendedModel.IsSelfDeafened.HasValue)
							member.IsSelfDeafened = extendedModel.IsSelfDeafened.Value;
						if (extendedModel.IsSelfMuted.HasValue)
							member.IsSelfMuted = extendedModel.IsSelfMuted.Value;
						member.IsSuppressed = extendedModel.IsSuppressed;
						member.SessionId = extendedModel.SessionId;
						member.Token = extendedModel.Token;
					}
					if (model is API.Models.RoleMemberInfo)
					{
						var extendedModel = model as API.Models.RoleMemberInfo;
						member.RoleIds = extendedModel.Roles;
						if (extendedModel.JoinedAt.HasValue)
							member.JoinedAt = extendedModel.JoinedAt.Value;
					}
					if (model is API.Models.InitialMemberInfo)
					{
						var extendedModel = model as API.Models.InitialMemberInfo;
						member.IsDeafened = extendedModel.IsDeafened;
						member.IsMuted = extendedModel.IsMuted;
					}
					if (_client.IsDebugMode)
						_client.RaiseOnDebugMessage(DebugMessageType.Cache, $"Updated user {member.User?.Name} ({member.UserId}) in server {member.Server?.Name} ({member.ServerId}).");
				},
				(member) =>
				{
					if (_client.IsDebugMode)
						_client.RaiseOnDebugMessage(DebugMessageType.Cache, $"Destroyed user {member.User?.Name} ({member.UserId}) in server {member.Server?.Name} ({member.ServerId}).");
				}
			);
		}
开发者ID:Mercurial,项目名称:Discord.Net,代码行数:57,代码来源:Server.cs


注:本文中的Discord.DiscordClient.RaiseOnDebugMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。