<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[samp | open.mp 联机社区论坛 - 插件]]></title>
		<link>https://open-mp.cn/</link>
		<description><![CDATA[samp | open.mp 联机社区论坛 - https://open-mp.cn]]></description>
		<pubDate>Mon, 04 May 2026 12:32:57 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[[插件] kook-connect]]></title>
			<link>https://open-mp.cn/showthread.php?tid=33</link>
			<pubDate>Fri, 01 May 2026 01:07:22 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://open-mp.cn/member.php?action=profile&uid=1">siwode</a>]]></dc:creator>
			<guid isPermaLink="false">https://open-mp.cn/showthread.php?tid=33</guid>
			<description><![CDATA[<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">samp-kook-connector 插件 Wiki</span></span><br />
<br />
将 Kook 机器人集成到你的 SA-MP / open.mp 服务器游戏模式中。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="font-weight: bold;" class="mycode_b">目录</span><br />
<br />
<ol type="1" class="mycode_list"><li><a href="http://#install" target="_blank" rel="noopener" class="mycode_url">安装</a><br />
</li>
<li><a href="http://#notes" target="_blank" rel="noopener" class="mycode_url">重要说明</a><br />
</li>
<li><a href="http://#natives" target="_blank" rel="noopener" class="mycode_url">Natives（原生函数）</a><ul class="mycode_list"><li><a href="http://#ch" target="_blank" rel="noopener" class="mycode_url">频道</a><br />
</li>
<li><a href="http://#msg" target="_blank" rel="noopener" class="mycode_url">消息</a><br />
</li>
<li><a href="http://#usr" target="_blank" rel="noopener" class="mycode_url">用户</a><br />
</li>
<li><a href="http://#role" target="_blank" rel="noopener" class="mycode_url">身份组</a><br />
</li>
<li><a href="http://#guild" target="_blank" rel="noopener" class="mycode_url">服务器</a><br />
</li>
<li><a href="http://#bot" target="_blank" rel="noopener" class="mycode_url">机器人</a><br />
</li>
<li><a href="http://#embed" target="_blank" rel="noopener" class="mycode_url">嵌入消息</a><br />
</li>
<li><a href="http://#emoji" target="_blank" rel="noopener" class="mycode_url">表情</a><br />
</li>
<li><a href="http://#react" target="_blank" rel="noopener" class="mycode_url">反应</a><br />
</li>
<li><a href="http://#misc" target="_blank" rel="noopener" class="mycode_url">其他</a><br />
</li>
</ul>
</li>
<li><a href="http://#callbacks" target="_blank" rel="noopener" class="mycode_url">Callbacks（回调函数）</a><ul class="mycode_list"><li><a href="http://#cb-ch" target="_blank" rel="noopener" class="mycode_url">频道回调</a><br />
</li>
<li><a href="http://#cb-msg" target="_blank" rel="noopener" class="mycode_url">消息回调</a><br />
</li>
<li><a href="http://#cb-usr" target="_blank" rel="noopener" class="mycode_url">用户回调</a><br />
</li>
<li><a href="http://#cb-guild" target="_blank" rel="noopener" class="mycode_url">服务器回调</a><br />
</li>
</ul>
</li>
</ol>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">1. 安装</span></span><br />
<br />
<span style="text-decoration: underline;" class="mycode_u">1.1 创建 Kook 机器人</span><br />
<br />
<ol type="1" class="mycode_list"><li>访问 <a href="https://developer.kookapp.cn/" target="_blank" rel="noopener" class="mycode_url">https://developer.kookapp.cn/</a><br />
</li>
<li>创建一个新的应用 / 机器人<br />
</li>
<li>输入机器人名称并完成创建<br />
</li>
<li>从机器人设置页面获取你的 <span style="font-weight: bold;" class="mycode_b">机器人令牌（Bot Token）</span><br />
</li>
<li>通过开发者门户或邀请链接，将机器人邀请到你的服务器<br />
</li>
</ol>
<br />
<span style="text-decoration: underline;" class="mycode_u">1.2 配置令牌</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">SA-MP（server.cfg）：</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>kook_bot_token YOUR_BOT_TOKEN_HERE</code></div></div><br />
<span style="font-weight: bold;" class="mycode_b">open.mp（config.json）：</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>kook.bot_token YOUR_BOT_TOKEN_HERE</code></div></div><br />
也可以使用环境变量代替：<br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>SAMP_KOOK_BOT_TOKEN=YOUR_BOT_TOKEN_HERE</code></div></div><br />
<blockquote class="mycode_quote"><cite>引用:</cite><span style="font-weight: bold;" class="mycode_b">注意事项：</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">永远不要</span>将机器人令牌分享给任何人<br />
</li>
<li>确保服务器时钟定期同步，否则速率限制器将无法正常工作，机器人可能会被封禁<br />
</li>
<li>此插件专为 open.mp (OMP) 服务器设计<br />
</li>
</ul>
</blockquote>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">2. 重要说明</span></span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite><span style="font-weight: bold;" class="mycode_b">关于 Kook ID 与内部 ID：</span><br />
Kook ID 是一个很大的数字，无法放入 PAWN 的 32 位整数中。因此插件采用两套 ID 体系：<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Kook ID</span>：Kook 平台使用的真实 ID，必须以字符串形式传递<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">内部 ID</span>：插件内部使用的整数索引，通过 <span style="font-family: courier;" class="mycode_font">KCC_Find*</span> / <span style="font-family: courier;" class="mycode_font">KCC_Get*</span> 系列函数获取<br />
</li>
</ul>
<br />
你的脚本只需持有内部 ID（索引），插件会在内部维护与真实 ID 的映射关系。</blockquote>
<br />
<blockquote class="mycode_quote"><cite>引用:</cite><span style="font-weight: bold;" class="mycode_b">关于发送私信：</span><br />
向用户发送私信需要两步：<br />
<ol type="1" class="mycode_list"><li>调用 <span style="font-family: courier;" class="mycode_font">KCC_CreatePrivateChannel(user, "回调函数名")</span> 打开私信频道<br />
</li>
<li>在回调函数中调用 <span style="font-family: courier;" class="mycode_font">KCC_GetCreatedPrivateChannel()</span> 获取频道 ID<br />
</li>
<li>使用该频道 ID 调用 <span style="font-family: courier;" class="mycode_font">KCC_SendChannelMessage</span> 等频道函数发送消息<br />
</li>
</ol>
</blockquote>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">3. Natives（原生函数）</span></span><br />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.1 频道</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KOOK_FindChannelById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KOOK_FindChannelById(const channel_id[])</code></div></div>通过 Kook ID 查找频道，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Channel</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelId(KCC_Channel:channel, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取频道的 Kook ID，以文本形式存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelType</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelType(KCC_Channel:channel, &amp;KCC_ChannelType:type)</code></div></div>获取频道类型，存入 <span style="font-family: courier;" class="mycode_font">type</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelGuild</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelGuild(KCC_Channel:channel, &amp;KCC_Guild:guild)</code></div></div>获取频道所属服务器，存入 <span style="font-family: courier;" class="mycode_font">guild</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelName(KCC_Channel:channel, dest[], max_size = sizeof dest)</code></div></div>获取频道名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelTopic</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelTopic(KCC_Channel:channel, dest[], max_size = sizeof dest)</code></div></div>获取频道主题，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelPosition</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelPosition(KCC_Channel:channel, &amp;position)</code></div></div>获取频道排列位置，存入 <span style="font-family: courier;" class="mycode_font">position</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SendChannelMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SendChannelMessage(KCC_Channel:channel, const message[], const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>向指定频道发送消息。<span style="font-family: courier;" class="mycode_font">callback</span>（可选）为消息发送确认后调用的公共函数，<span style="font-family: courier;" class="mycode_font">format</span> 及后续参数为回调参数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetChannelName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetChannelName(KCC_Channel:channel, const name[])</code></div></div>修改频道名称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetChannelTopic</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetChannelTopic(KCC_Channel:channel, const topic[])</code></div></div>修改频道主题。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteChannel(KCC_Channel:channel)</code></div></div>删除指定频道。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.2 消息</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageId(KCC_Message:message, dest[KCC_ID_SIZE], max_size = KCC_ID_SIZE)</code></div></div>获取消息的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageChannel(KCC_Message:message, &amp;KCC_Channel:channel)</code></div></div>获取消息所在频道，存入 <span style="font-family: courier;" class="mycode_font">channel</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageAuthor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageAuthor(KCC_Message:message, &amp;KCC_User:author)</code></div></div>获取消息发送者，存入 <span style="font-family: courier;" class="mycode_font">author</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageContent</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageContent(KCC_Message:message, dest[], max_size = sizeof dest)</code></div></div>获取消息文本内容，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsMessageMentioningEveryone</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsMessageMentioningEveryone(KCC_Message:message, &amp;bool:mentions_everyone)</code></div></div>检查消息是否 @全体成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageUserMentionCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageUserMentionCount(KCC_Message:message, &amp;mentioned_user_count)</code></div></div>获取消息中提及的用户数量。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageUserMention</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageUserMention(KCC_Message:message, offset, &amp;KCC_User:mentioned_user)</code></div></div>按索引获取消息中提及的某个用户。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageRoleMentionCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageRoleMentionCount(KCC_Message:message, &amp;mentioned_role_count)</code></div></div>获取消息中提及的身份组数量。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageRoleMention</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageRoleMention(KCC_Message:message, offset, &amp;KCC_Role:mentioned_role)</code></div></div>按索引获取消息中提及的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteMessage(KCC_Message:message)</code></div></div>在 Kook 上删除该消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedMessage()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_SendChannelMessage</span> 的回调中使用，返回刚发送的消息的内部 ID（带 <span style="font-family: courier;" class="mycode_font">KCC_Message</span> 标签）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteInternalMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteInternalMessage(KCC_Message:message)</code></div></div>从插件内部存储中移除该消息（<span style="font-weight: bold;" class="mycode_b">不会</span>在 Kook 上删除消息），用于持久化消息的清理。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_EditMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_EditMessage(KCC_Message:message, const content[], KCC_Embed:embed = KCC_Embed:0)</code></div></div>编辑消息内容，可选附带嵌入消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetMessagePersistent</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetMessagePersistent(KCC_Message:message, bool:persistent)</code></div></div>设置消息是否持久保存在插件内部存储中。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CacheChannelMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CacheChannelMessage(const channel_id[DCC_ID_SIZE], const message_id[DCC_ID_SIZE], const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>通过 Kook ID 将指定消息缓存到插件中，缓存完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.3 用户</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>用户的 discriminator 是附加在 Kook 用户名后的 4 位数字标识。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindUserByName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindUserByName(const user_name[], const user_discriminator[])</code></div></div>通过用户名 + discriminator 查找用户，返回带 <span style="font-family: courier;" class="mycode_font">KCC_User</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindUserById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindUserById(const user_id[])</code></div></div>通过 Kook ID 查找用户，返回带 <span style="font-family: courier;" class="mycode_font">KCC_User</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetUserId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetUserId(KCC_User:user, dest[DCC_ID_SIZE], max_size = DCC_ID_SIZE)</code></div></div>获取用户的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetUserName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetUserName(KCC_User:user, dest[DCC_USERNAME_SIZE], max_size = sizeof dest)</code></div></div>获取用户名，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetUserDiscriminator</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetUserDiscriminator(KCC_User:user, dest[], max_size = DCC_ID_SIZE)</code></div></div>获取用户的 discriminator，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsUserBot</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsUserBot(KCC_User:user, &amp;bool:is_bot)</code></div></div>检查用户是否为机器人。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsUserVerified</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsUserVerified(KCC_User:user, &amp;bool:is_verified)</code></div></div>检查用户是否已完成验证。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.4 身份组</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>dest 字符串大小必须为 DCC_ID_SIZE。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindRoleByName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindRoleByName(KCC_Guild:guild, const role_name[])</code></div></div>在指定服务器中按名称查找身份组，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Role</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindRoleById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindRoleById(const role_id[])</code></div></div>通过 Kook ID 查找身份组，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Role</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRoleId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRoleId(KCC_Role:role, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取身份组的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRoleName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRoleName(KCC_Role:role, dest[], max_size = sizeof dest)</code></div></div>获取身份组名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRoleColor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRoleColor(KCC_Role:role, &amp;color)</code></div></div>获取身份组颜色值，存入 <span style="font-family: courier;" class="mycode_font">color</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRolePermissions</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRolePermissions(KCC_Role:role, &amp;perm_high, &amp;perm_low)</code></div></div>获取身份组权限（64 位整数分为高低两个 32 位部分）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsRoleHoist</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsRoleHoist(KCC_Role:role, &amp;bool:is_hoist)</code></div></div>检查身份组是否在成员列表中单独显示（提升显示）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRolePosition</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRolePosition(KCC_Role:role, &amp;position)</code></div></div>获取身份组的排列位置，存入 <span style="font-family: courier;" class="mycode_font">position</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsRoleMentionable</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsRoleMentionable(KCC_Role:role, &amp;bool:is_mentionable)</code></div></div>检查身份组是否可被 @ 提及。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.5 服务器</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>dest 字符串大小必须为 DCC_ID_SIZE。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">— 查询 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindGuildByName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindGuildByName(const guild_name[])</code></div></div>按名称查找服务器，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Guild</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindGuildById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindGuildById(const guild_id[])</code></div></div>通过 Kook ID 查找服务器，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Guild</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildId(KCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取服务器的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildName(KCC_Guild:guild, dest[], max_size = sizeof dest)</code></div></div>获取服务器名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildOwnerId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildOwnerId(KCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取服务器所有者的 Kook 用户 ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetAllGuilds</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetAllGuilds(KCC_Guild:dest[], max_size = sizeof dest)</code></div></div>获取所有服务器的内部 ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span> 数组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">— 频道 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildChannel(KCC_Guild:guild, offset, &amp;KCC_Channel:channel)</code></div></div>按索引获取服务器中的某个频道。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildChannelCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildChannelCount(KCC_Guild:guild, &amp;count)</code></div></div>获取服务器的频道总数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateGuildChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateGuildChannel(KCC_Guild:guild, const name[], DCC_ChannelType:type, const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>在服务器中创建新频道，完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedGuildChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedGuildChannel()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_CreateGuildChannel</span> 的回调中使用，返回新创建频道的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">— 成员 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMember</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMember(KCC_Guild:guild, offset, &amp;KCC_User:user)</code></div></div>按索引获取服务器中的某个成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberCount(KCC_Guild:guild, &amp;count)</code></div></div>获取服务器成员总数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberVoiceChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberVoiceChannel(KCC_Guild:guild, KCC_User:user, &amp;KCC_Channel:channel)</code></div></div>获取成员当前所在的语音频道。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberNickname</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberNickname(KCC_Guild:guild, KCC_User:user, dest[DCC_NICKNAME_SIZE], max_size = sizeof dest)</code></div></div>获取成员在服务器中的昵称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberRole(KCC_Guild:guild, KCC_User:user, offset, &amp;KCC_Role:role)</code></div></div>按索引获取成员拥有的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberRoleCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberRoleCount(KCC_Guild:guild, KCC_User:user, &amp;count)</code></div></div>获取成员拥有的身份组数量。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_HasGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_HasGuildMemberRole(KCC_Guild:guild, KCC_User:user, KCC_Role:role, &amp;bool:has_role)</code></div></div>检查成员是否拥有指定身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildMemberNickname</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildMemberNickname(KCC_Guild:guild, KCC_User:user, const nickname[])</code></div></div>修改成员昵称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_AddGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_AddGuildMemberRole(KCC_Guild:guild, KCC_User:user, KCC_Role:role)</code></div></div>为成员添加身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_RemoveGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_RemoveGuildMemberRole(KCC_Guild:guild, KCC_User:user, KCC_Role:role)</code></div></div>移除成员的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_RemoveGuildMember</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_RemoveGuildMember(KCC_Guild:guild, KCC_User:user)</code></div></div>踢出服务器成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateGuildMemberBan</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateGuildMemberBan(KCC_Guild:guild, KCC_User:user, const reason[] = "")</code></div></div>封禁成员，可附带原因。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_RemoveGuildMemberBan</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_RemoveGuildMemberBan(KCC_Guild:guild, KCC_User:user)</code></div></div>解封成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">— 身份组管理 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildRole(KCC_Guild:guild, offset, &amp;KCC_Role:role)</code></div></div>按索引获取服务器中的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildRoleCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildRoleCount(KCC_Guild:guild, &amp;count)</code></div></div>获取服务器的身份组总数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateGuildRole(KCC_Guild:guild, const name[], const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>在服务器中创建新身份组，完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedGuildRole()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_CreateGuildRole</span> 的回调中使用，返回新创建身份组的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteGuildRole(KCC_Guild:guild, KCC_Role:role)</code></div></div>删除服务器中的身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleName(KCC_Guild:guild, KCC_Role:role, const name[])</code></div></div>修改身份组名称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRolePermissions</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRolePermissions(KCC_Guild:guild, KCC_Role:role, perm_high, perm_low)</code></div></div>修改身份组权限（64 位整数分为高低两个 32 位部分）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleColor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleColor(KCC_Guild:guild, KCC_Role:role, color)</code></div></div>修改身份组颜色。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleHoist</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleHoist(KCC_Guild:guild, KCC_Role:role, bool:hoist)</code></div></div>设置身份组是否在成员列表中单独显示。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleMentionable</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleMentionable(KCC_Guild:guild, KCC_Role:role, bool:mentionable)</code></div></div>设置身份组是否可被 @ 提及。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.6 机器人</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreatePrivateChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreatePrivateChannel(KCC_User:user, const callback[], const format[] = "", {Float, _}:...)</code></div></div>向指定用户打开私信频道，完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedPrivateChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedPrivateChannel()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_CreatePrivateChannel</span> 的回调中使用，返回私信频道的内部 ID（可直接用于 <span style="font-family: courier;" class="mycode_font">KCC_SendChannelMessage</span> 等函数）。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.7 嵌入消息</span><br />
<br />
嵌入消息（Embed）允许向 Kook 频道发送富文本内容消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateEmbed</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateEmbed(const title[] = "", const description[] = "", const url[] = "", const timestamp[] = "", color = 0, const footer_text[] = "", const footer_icon_url[] = "", const thumbnail_url[] = "", const image_url[] = "")</code></div></div>创建一个嵌入消息，所有参数均为可选，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Embed</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteEmbed</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteEmbed(KCC_Embed:embed)</code></div></div>删除嵌入消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SendChannelEmbedMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SendChannelEmbedMessage(KCC_Channel:channel, KCC_Embed:embed, const message[] = "", const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>向频道发送带嵌入消息的内容，可附带普通文字。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_AddEmbedField</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_AddEmbedField(KCC_Embed:embed, const name[], const value[], bool:inline = false)</code></div></div>为嵌入消息添加字段，<span style="font-family: courier;" class="mycode_font">inline</span> 为 <span style="font-family: courier;" class="mycode_font">true</span> 时字段并排显示。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedTitle</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedTitle(KCC_Embed:embed, const title[])</code></div></div>设置嵌入消息标题。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedDescription</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedDescription(KCC_Embed:embed, const description[])</code></div></div>设置嵌入消息描述。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedUrl</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedUrl(KCC_Embed:embed, const url[])</code></div></div>设置嵌入消息链接。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedTimestamp</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedTimestamp(KCC_Embed:embed, const timestamp[])</code></div></div>设置嵌入消息时间戳。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedColor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedColor(KCC_Embed:embed, color)</code></div></div>设置嵌入消息左侧色条颜色。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedFooter</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedFooter(KCC_Embed:embed, const footer_text[], const footer_icon_url[] = "")</code></div></div>设置嵌入消息页脚文本，可附带图标 URL。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedThumbnail</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedThumbnail(KCC_Embed:embed, const thumbnail_url[])</code></div></div>设置嵌入消息缩略图。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedImage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedImage(KCC_Embed:embed, const image_url[])</code></div></div>设置嵌入消息主图片。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.8 表情</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>dest 字符串大小必须为 <span style="font-family: courier;" class="mycode_font">DCC_EMOJI_NAME_SIZE</span>。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateEmoji</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateEmoji(const name[DCC_EMOJI_NAME_SIZE], const snowflake[DCC_ID_SIZE] = "")</code></div></div>创建一个表情对象，<span style="font-family: courier;" class="mycode_font">snowflake</span> 为可选的 Kook 雪花 ID，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Emoji</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteEmoji</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteEmoji(KCC_Emoji:emoji)</code></div></div>删除表情对象。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetEmojiName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetEmojiName(KCC_Emoji:emoji, dest[DCC_EMOJI_NAME_SIZE], maxlen = DCC_EMOJI_NAME_SIZE)</code></div></div>获取表情名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.9 反应</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateReaction</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateReaction(KCC_Message:message, KCC_Emoji:reaction_emoji)</code></div></div>对指定消息添加表情反应。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteMessageReaction</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteMessageReaction(KCC_Message:message, KCC_Emoji:reaction_emoji = KCC_Emoji:0)</code></div></div>移除消息上的表情反应。<span style="font-family: courier;" class="mycode_font">reaction_emoji</span> 为 0（默认）时删除该消息上的<span style="font-weight: bold;" class="mycode_b">所有</span>反应。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.10 其他</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_EscapeMarkdown</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_EscapeMarkdown(const src[], dest[], max_size = sizeof dest)</code></div></div>对字符串中的 Markdown 特殊字符进行转义，使文本在 Kook 消息中原样显示，不被格式化。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">4. Callbacks（回调函数）</span></span><br />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.1 频道回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnChannelCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnChannelCreate(KCC_Channel:channel)</code></div></div>触发时机：服务器中有新频道创建时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnChannelUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnChannelUpdate(KCC_Channel:channel)</code></div></div>触发时机：频道信息更新时（名称、权限等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnChannelDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnChannelDelete(KCC_Channel:channel)</code></div></div>触发时机：频道被删除时。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.2 消息回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnMessageCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnMessageCreate(KCC_Message:message)</code></div></div>触发时机：频道中有新消息发送时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnMessageDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnMessageDelete(KCC_Message:message)</code></div></div>触发时机：消息被删除时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnMessageReaction</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnMessageReaction(KCC_Message:message, KCC_User:reaction_user, KCC_Emoji:emoji, DCC_MessageReactionType:reaction_type)</code></div></div>触发时机：消息添加或移除表情反应时。<ul class="mycode_list"><li><span style="font-family: courier;" class="mycode_font">message</span>：消息内部 ID<br />
</li>
<li><span style="font-family: courier;" class="mycode_font">reaction_user</span>：操作反应的用户内部 ID<br />
</li>
<li><span style="font-family: courier;" class="mycode_font">emoji</span>：使用的表情内部 ID<br />
</li>
<li><span style="font-family: courier;" class="mycode_font">reaction_type</span>：反应事件类型（添加 / 移除等）<br />
</li>
</ul>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.3 用户回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnUserUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnUserUpdate(KCC_User:user)</code></div></div>触发时机：用户资料更新时（用户名、头像等）。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.4 服务器回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildCreate(KCC_Guild:guild)</code></div></div>触发时机：服务器创建，或机器人加入新服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildUpdate(KCC_Guild:guild)</code></div></div>触发时机：服务器信息更新时（名称、图标等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildDelete(KCC_Guild:guild)</code></div></div>触发时机：服务器删除，或机器人离开服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberAdd</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberAdd(KCC_Guild:guild, KCC_User:user)</code></div></div>触发时机：用户加入服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberUpdate(KCC_Guild:guild, KCC_User:user)</code></div></div>触发时机：成员信息更新时（昵称、身份组等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberVoiceUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberVoiceUpdate(KCC_Guild:guild, KCC_User:user, KCC_Channel:channel)</code></div></div>触发时机：成员语音状态变化时（加入 / 离开语音频道）。<ul class="mycode_list"><li><span style="font-family: courier;" class="mycode_font">channel</span>：语音频道内部 ID，用户离开语音时该值可能无效<br />
</li>
</ul>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberRemove</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberRemove(KCC_Guild:guild, KCC_User:user)</code></div></div>触发时机：用户离开或被踢出服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildRoleCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildRoleCreate(KCC_Guild:guild, KCC_Role:role)</code></div></div>触发时机：服务器中创建新身份组时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildRoleUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildRoleUpdate(KCC_Guild:guild, KCC_Role:role)</code></div></div>触发时机：服务器身份组更新时（名称、颜色、权限等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildRoleDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildRoleDelete(KCC_Guild:guild, KCC_Role:role)</code></div></div>触发时机：服务器身份组被删除时。]]></description>
			<content:encoded><![CDATA[<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">samp-kook-connector 插件 Wiki</span></span><br />
<br />
将 Kook 机器人集成到你的 SA-MP / open.mp 服务器游戏模式中。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="font-weight: bold;" class="mycode_b">目录</span><br />
<br />
<ol type="1" class="mycode_list"><li><a href="http://#install" target="_blank" rel="noopener" class="mycode_url">安装</a><br />
</li>
<li><a href="http://#notes" target="_blank" rel="noopener" class="mycode_url">重要说明</a><br />
</li>
<li><a href="http://#natives" target="_blank" rel="noopener" class="mycode_url">Natives（原生函数）</a><ul class="mycode_list"><li><a href="http://#ch" target="_blank" rel="noopener" class="mycode_url">频道</a><br />
</li>
<li><a href="http://#msg" target="_blank" rel="noopener" class="mycode_url">消息</a><br />
</li>
<li><a href="http://#usr" target="_blank" rel="noopener" class="mycode_url">用户</a><br />
</li>
<li><a href="http://#role" target="_blank" rel="noopener" class="mycode_url">身份组</a><br />
</li>
<li><a href="http://#guild" target="_blank" rel="noopener" class="mycode_url">服务器</a><br />
</li>
<li><a href="http://#bot" target="_blank" rel="noopener" class="mycode_url">机器人</a><br />
</li>
<li><a href="http://#embed" target="_blank" rel="noopener" class="mycode_url">嵌入消息</a><br />
</li>
<li><a href="http://#emoji" target="_blank" rel="noopener" class="mycode_url">表情</a><br />
</li>
<li><a href="http://#react" target="_blank" rel="noopener" class="mycode_url">反应</a><br />
</li>
<li><a href="http://#misc" target="_blank" rel="noopener" class="mycode_url">其他</a><br />
</li>
</ul>
</li>
<li><a href="http://#callbacks" target="_blank" rel="noopener" class="mycode_url">Callbacks（回调函数）</a><ul class="mycode_list"><li><a href="http://#cb-ch" target="_blank" rel="noopener" class="mycode_url">频道回调</a><br />
</li>
<li><a href="http://#cb-msg" target="_blank" rel="noopener" class="mycode_url">消息回调</a><br />
</li>
<li><a href="http://#cb-usr" target="_blank" rel="noopener" class="mycode_url">用户回调</a><br />
</li>
<li><a href="http://#cb-guild" target="_blank" rel="noopener" class="mycode_url">服务器回调</a><br />
</li>
</ul>
</li>
</ol>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">1. 安装</span></span><br />
<br />
<span style="text-decoration: underline;" class="mycode_u">1.1 创建 Kook 机器人</span><br />
<br />
<ol type="1" class="mycode_list"><li>访问 <a href="https://developer.kookapp.cn/" target="_blank" rel="noopener" class="mycode_url">https://developer.kookapp.cn/</a><br />
</li>
<li>创建一个新的应用 / 机器人<br />
</li>
<li>输入机器人名称并完成创建<br />
</li>
<li>从机器人设置页面获取你的 <span style="font-weight: bold;" class="mycode_b">机器人令牌（Bot Token）</span><br />
</li>
<li>通过开发者门户或邀请链接，将机器人邀请到你的服务器<br />
</li>
</ol>
<br />
<span style="text-decoration: underline;" class="mycode_u">1.2 配置令牌</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">SA-MP（server.cfg）：</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>kook_bot_token YOUR_BOT_TOKEN_HERE</code></div></div><br />
<span style="font-weight: bold;" class="mycode_b">open.mp（config.json）：</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>kook.bot_token YOUR_BOT_TOKEN_HERE</code></div></div><br />
也可以使用环境变量代替：<br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>SAMP_KOOK_BOT_TOKEN=YOUR_BOT_TOKEN_HERE</code></div></div><br />
<blockquote class="mycode_quote"><cite>引用:</cite><span style="font-weight: bold;" class="mycode_b">注意事项：</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">永远不要</span>将机器人令牌分享给任何人<br />
</li>
<li>确保服务器时钟定期同步，否则速率限制器将无法正常工作，机器人可能会被封禁<br />
</li>
<li>此插件专为 open.mp (OMP) 服务器设计<br />
</li>
</ul>
</blockquote>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">2. 重要说明</span></span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite><span style="font-weight: bold;" class="mycode_b">关于 Kook ID 与内部 ID：</span><br />
Kook ID 是一个很大的数字，无法放入 PAWN 的 32 位整数中。因此插件采用两套 ID 体系：<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">Kook ID</span>：Kook 平台使用的真实 ID，必须以字符串形式传递<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">内部 ID</span>：插件内部使用的整数索引，通过 <span style="font-family: courier;" class="mycode_font">KCC_Find*</span> / <span style="font-family: courier;" class="mycode_font">KCC_Get*</span> 系列函数获取<br />
</li>
</ul>
<br />
你的脚本只需持有内部 ID（索引），插件会在内部维护与真实 ID 的映射关系。</blockquote>
<br />
<blockquote class="mycode_quote"><cite>引用:</cite><span style="font-weight: bold;" class="mycode_b">关于发送私信：</span><br />
向用户发送私信需要两步：<br />
<ol type="1" class="mycode_list"><li>调用 <span style="font-family: courier;" class="mycode_font">KCC_CreatePrivateChannel(user, "回调函数名")</span> 打开私信频道<br />
</li>
<li>在回调函数中调用 <span style="font-family: courier;" class="mycode_font">KCC_GetCreatedPrivateChannel()</span> 获取频道 ID<br />
</li>
<li>使用该频道 ID 调用 <span style="font-family: courier;" class="mycode_font">KCC_SendChannelMessage</span> 等频道函数发送消息<br />
</li>
</ol>
</blockquote>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">3. Natives（原生函数）</span></span><br />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.1 频道</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KOOK_FindChannelById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KOOK_FindChannelById(const channel_id[])</code></div></div>通过 Kook ID 查找频道，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Channel</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelId(KCC_Channel:channel, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取频道的 Kook ID，以文本形式存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelType</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelType(KCC_Channel:channel, &amp;KCC_ChannelType:type)</code></div></div>获取频道类型，存入 <span style="font-family: courier;" class="mycode_font">type</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelGuild</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelGuild(KCC_Channel:channel, &amp;KCC_Guild:guild)</code></div></div>获取频道所属服务器，存入 <span style="font-family: courier;" class="mycode_font">guild</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelName(KCC_Channel:channel, dest[], max_size = sizeof dest)</code></div></div>获取频道名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelTopic</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelTopic(KCC_Channel:channel, dest[], max_size = sizeof dest)</code></div></div>获取频道主题，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetChannelPosition</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetChannelPosition(KCC_Channel:channel, &amp;position)</code></div></div>获取频道排列位置，存入 <span style="font-family: courier;" class="mycode_font">position</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SendChannelMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SendChannelMessage(KCC_Channel:channel, const message[], const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>向指定频道发送消息。<span style="font-family: courier;" class="mycode_font">callback</span>（可选）为消息发送确认后调用的公共函数，<span style="font-family: courier;" class="mycode_font">format</span> 及后续参数为回调参数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetChannelName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetChannelName(KCC_Channel:channel, const name[])</code></div></div>修改频道名称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetChannelTopic</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetChannelTopic(KCC_Channel:channel, const topic[])</code></div></div>修改频道主题。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteChannel(KCC_Channel:channel)</code></div></div>删除指定频道。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.2 消息</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageId(KCC_Message:message, dest[KCC_ID_SIZE], max_size = KCC_ID_SIZE)</code></div></div>获取消息的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageChannel(KCC_Message:message, &amp;KCC_Channel:channel)</code></div></div>获取消息所在频道，存入 <span style="font-family: courier;" class="mycode_font">channel</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageAuthor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageAuthor(KCC_Message:message, &amp;KCC_User:author)</code></div></div>获取消息发送者，存入 <span style="font-family: courier;" class="mycode_font">author</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageContent</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageContent(KCC_Message:message, dest[], max_size = sizeof dest)</code></div></div>获取消息文本内容，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsMessageMentioningEveryone</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsMessageMentioningEveryone(KCC_Message:message, &amp;bool:mentions_everyone)</code></div></div>检查消息是否 @全体成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageUserMentionCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageUserMentionCount(KCC_Message:message, &amp;mentioned_user_count)</code></div></div>获取消息中提及的用户数量。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageUserMention</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageUserMention(KCC_Message:message, offset, &amp;KCC_User:mentioned_user)</code></div></div>按索引获取消息中提及的某个用户。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageRoleMentionCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageRoleMentionCount(KCC_Message:message, &amp;mentioned_role_count)</code></div></div>获取消息中提及的身份组数量。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetMessageRoleMention</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetMessageRoleMention(KCC_Message:message, offset, &amp;KCC_Role:mentioned_role)</code></div></div>按索引获取消息中提及的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteMessage(KCC_Message:message)</code></div></div>在 Kook 上删除该消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedMessage()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_SendChannelMessage</span> 的回调中使用，返回刚发送的消息的内部 ID（带 <span style="font-family: courier;" class="mycode_font">KCC_Message</span> 标签）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteInternalMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteInternalMessage(KCC_Message:message)</code></div></div>从插件内部存储中移除该消息（<span style="font-weight: bold;" class="mycode_b">不会</span>在 Kook 上删除消息），用于持久化消息的清理。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_EditMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_EditMessage(KCC_Message:message, const content[], KCC_Embed:embed = KCC_Embed:0)</code></div></div>编辑消息内容，可选附带嵌入消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetMessagePersistent</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetMessagePersistent(KCC_Message:message, bool:persistent)</code></div></div>设置消息是否持久保存在插件内部存储中。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CacheChannelMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CacheChannelMessage(const channel_id[DCC_ID_SIZE], const message_id[DCC_ID_SIZE], const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>通过 Kook ID 将指定消息缓存到插件中，缓存完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.3 用户</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>用户的 discriminator 是附加在 Kook 用户名后的 4 位数字标识。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindUserByName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindUserByName(const user_name[], const user_discriminator[])</code></div></div>通过用户名 + discriminator 查找用户，返回带 <span style="font-family: courier;" class="mycode_font">KCC_User</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindUserById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindUserById(const user_id[])</code></div></div>通过 Kook ID 查找用户，返回带 <span style="font-family: courier;" class="mycode_font">KCC_User</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetUserId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetUserId(KCC_User:user, dest[DCC_ID_SIZE], max_size = DCC_ID_SIZE)</code></div></div>获取用户的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetUserName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetUserName(KCC_User:user, dest[DCC_USERNAME_SIZE], max_size = sizeof dest)</code></div></div>获取用户名，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetUserDiscriminator</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetUserDiscriminator(KCC_User:user, dest[], max_size = DCC_ID_SIZE)</code></div></div>获取用户的 discriminator，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsUserBot</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsUserBot(KCC_User:user, &amp;bool:is_bot)</code></div></div>检查用户是否为机器人。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsUserVerified</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsUserVerified(KCC_User:user, &amp;bool:is_verified)</code></div></div>检查用户是否已完成验证。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.4 身份组</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>dest 字符串大小必须为 DCC_ID_SIZE。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindRoleByName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindRoleByName(KCC_Guild:guild, const role_name[])</code></div></div>在指定服务器中按名称查找身份组，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Role</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindRoleById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindRoleById(const role_id[])</code></div></div>通过 Kook ID 查找身份组，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Role</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRoleId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRoleId(KCC_Role:role, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取身份组的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRoleName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRoleName(KCC_Role:role, dest[], max_size = sizeof dest)</code></div></div>获取身份组名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRoleColor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRoleColor(KCC_Role:role, &amp;color)</code></div></div>获取身份组颜色值，存入 <span style="font-family: courier;" class="mycode_font">color</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRolePermissions</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRolePermissions(KCC_Role:role, &amp;perm_high, &amp;perm_low)</code></div></div>获取身份组权限（64 位整数分为高低两个 32 位部分）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsRoleHoist</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsRoleHoist(KCC_Role:role, &amp;bool:is_hoist)</code></div></div>检查身份组是否在成员列表中单独显示（提升显示）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetRolePosition</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetRolePosition(KCC_Role:role, &amp;position)</code></div></div>获取身份组的排列位置，存入 <span style="font-family: courier;" class="mycode_font">position</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_IsRoleMentionable</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_IsRoleMentionable(KCC_Role:role, &amp;bool:is_mentionable)</code></div></div>检查身份组是否可被 @ 提及。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.5 服务器</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>dest 字符串大小必须为 DCC_ID_SIZE。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">— 查询 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindGuildByName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindGuildByName(const guild_name[])</code></div></div>按名称查找服务器，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Guild</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_FindGuildById</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_FindGuildById(const guild_id[])</code></div></div>通过 Kook ID 查找服务器，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Guild</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildId(KCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取服务器的 Kook ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildName(KCC_Guild:guild, dest[], max_size = sizeof dest)</code></div></div>获取服务器名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildOwnerId</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildOwnerId(KCC_Guild:guild, dest[DCC_ID_SIZE], max_size = sizeof dest)</code></div></div>获取服务器所有者的 Kook 用户 ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetAllGuilds</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetAllGuilds(KCC_Guild:dest[], max_size = sizeof dest)</code></div></div>获取所有服务器的内部 ID，存入 <span style="font-family: courier;" class="mycode_font">dest</span> 数组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">— 频道 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildChannel(KCC_Guild:guild, offset, &amp;KCC_Channel:channel)</code></div></div>按索引获取服务器中的某个频道。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildChannelCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildChannelCount(KCC_Guild:guild, &amp;count)</code></div></div>获取服务器的频道总数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateGuildChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateGuildChannel(KCC_Guild:guild, const name[], DCC_ChannelType:type, const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>在服务器中创建新频道，完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedGuildChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedGuildChannel()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_CreateGuildChannel</span> 的回调中使用，返回新创建频道的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">— 成员 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMember</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMember(KCC_Guild:guild, offset, &amp;KCC_User:user)</code></div></div>按索引获取服务器中的某个成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberCount(KCC_Guild:guild, &amp;count)</code></div></div>获取服务器成员总数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberVoiceChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberVoiceChannel(KCC_Guild:guild, KCC_User:user, &amp;KCC_Channel:channel)</code></div></div>获取成员当前所在的语音频道。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberNickname</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberNickname(KCC_Guild:guild, KCC_User:user, dest[DCC_NICKNAME_SIZE], max_size = sizeof dest)</code></div></div>获取成员在服务器中的昵称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberRole(KCC_Guild:guild, KCC_User:user, offset, &amp;KCC_Role:role)</code></div></div>按索引获取成员拥有的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildMemberRoleCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildMemberRoleCount(KCC_Guild:guild, KCC_User:user, &amp;count)</code></div></div>获取成员拥有的身份组数量。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_HasGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_HasGuildMemberRole(KCC_Guild:guild, KCC_User:user, KCC_Role:role, &amp;bool:has_role)</code></div></div>检查成员是否拥有指定身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildMemberNickname</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildMemberNickname(KCC_Guild:guild, KCC_User:user, const nickname[])</code></div></div>修改成员昵称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_AddGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_AddGuildMemberRole(KCC_Guild:guild, KCC_User:user, KCC_Role:role)</code></div></div>为成员添加身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_RemoveGuildMemberRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_RemoveGuildMemberRole(KCC_Guild:guild, KCC_User:user, KCC_Role:role)</code></div></div>移除成员的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_RemoveGuildMember</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_RemoveGuildMember(KCC_Guild:guild, KCC_User:user)</code></div></div>踢出服务器成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateGuildMemberBan</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateGuildMemberBan(KCC_Guild:guild, KCC_User:user, const reason[] = "")</code></div></div>封禁成员，可附带原因。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_RemoveGuildMemberBan</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_RemoveGuildMemberBan(KCC_Guild:guild, KCC_User:user)</code></div></div>解封成员。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">— 身份组管理 —</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildRole(KCC_Guild:guild, offset, &amp;KCC_Role:role)</code></div></div>按索引获取服务器中的某个身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetGuildRoleCount</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetGuildRoleCount(KCC_Guild:guild, &amp;count)</code></div></div>获取服务器的身份组总数。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateGuildRole(KCC_Guild:guild, const name[], const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>在服务器中创建新身份组，完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedGuildRole()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_CreateGuildRole</span> 的回调中使用，返回新创建身份组的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteGuildRole</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteGuildRole(KCC_Guild:guild, KCC_Role:role)</code></div></div>删除服务器中的身份组。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleName(KCC_Guild:guild, KCC_Role:role, const name[])</code></div></div>修改身份组名称。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRolePermissions</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRolePermissions(KCC_Guild:guild, KCC_Role:role, perm_high, perm_low)</code></div></div>修改身份组权限（64 位整数分为高低两个 32 位部分）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleColor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleColor(KCC_Guild:guild, KCC_Role:role, color)</code></div></div>修改身份组颜色。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleHoist</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleHoist(KCC_Guild:guild, KCC_Role:role, bool:hoist)</code></div></div>设置身份组是否在成员列表中单独显示。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetGuildRoleMentionable</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetGuildRoleMentionable(KCC_Guild:guild, KCC_Role:role, bool:mentionable)</code></div></div>设置身份组是否可被 @ 提及。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.6 机器人</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreatePrivateChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreatePrivateChannel(KCC_User:user, const callback[], const format[] = "", {Float, _}:...)</code></div></div>向指定用户打开私信频道，完成后调用 <span style="font-family: courier;" class="mycode_font">callback</span>。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetCreatedPrivateChannel</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetCreatedPrivateChannel()</code></div></div>在 <span style="font-family: courier;" class="mycode_font">KCC_CreatePrivateChannel</span> 的回调中使用，返回私信频道的内部 ID（可直接用于 <span style="font-family: courier;" class="mycode_font">KCC_SendChannelMessage</span> 等函数）。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.7 嵌入消息</span><br />
<br />
嵌入消息（Embed）允许向 Kook 频道发送富文本内容消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateEmbed</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateEmbed(const title[] = "", const description[] = "", const url[] = "", const timestamp[] = "", color = 0, const footer_text[] = "", const footer_icon_url[] = "", const thumbnail_url[] = "", const image_url[] = "")</code></div></div>创建一个嵌入消息，所有参数均为可选，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Embed</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteEmbed</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteEmbed(KCC_Embed:embed)</code></div></div>删除嵌入消息。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SendChannelEmbedMessage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SendChannelEmbedMessage(KCC_Channel:channel, KCC_Embed:embed, const message[] = "", const callback[] = "", const format[] = "", {Float, _}:...)</code></div></div>向频道发送带嵌入消息的内容，可附带普通文字。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_AddEmbedField</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_AddEmbedField(KCC_Embed:embed, const name[], const value[], bool:inline = false)</code></div></div>为嵌入消息添加字段，<span style="font-family: courier;" class="mycode_font">inline</span> 为 <span style="font-family: courier;" class="mycode_font">true</span> 时字段并排显示。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedTitle</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedTitle(KCC_Embed:embed, const title[])</code></div></div>设置嵌入消息标题。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedDescription</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedDescription(KCC_Embed:embed, const description[])</code></div></div>设置嵌入消息描述。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedUrl</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedUrl(KCC_Embed:embed, const url[])</code></div></div>设置嵌入消息链接。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedTimestamp</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedTimestamp(KCC_Embed:embed, const timestamp[])</code></div></div>设置嵌入消息时间戳。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedColor</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedColor(KCC_Embed:embed, color)</code></div></div>设置嵌入消息左侧色条颜色。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedFooter</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedFooter(KCC_Embed:embed, const footer_text[], const footer_icon_url[] = "")</code></div></div>设置嵌入消息页脚文本，可附带图标 URL。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedThumbnail</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedThumbnail(KCC_Embed:embed, const thumbnail_url[])</code></div></div>设置嵌入消息缩略图。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_SetEmbedImage</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_SetEmbedImage(KCC_Embed:embed, const image_url[])</code></div></div>设置嵌入消息主图片。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.8 表情</span><br />
<br />
<blockquote class="mycode_quote"><cite>引用:</cite>dest 字符串大小必须为 <span style="font-family: courier;" class="mycode_font">DCC_EMOJI_NAME_SIZE</span>。</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateEmoji</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateEmoji(const name[DCC_EMOJI_NAME_SIZE], const snowflake[DCC_ID_SIZE] = "")</code></div></div>创建一个表情对象，<span style="font-family: courier;" class="mycode_font">snowflake</span> 为可选的 Kook 雪花 ID，返回带 <span style="font-family: courier;" class="mycode_font">KCC_Emoji</span> 标签的内部 ID。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteEmoji</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteEmoji(KCC_Emoji:emoji)</code></div></div>删除表情对象。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_GetEmojiName</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_GetEmojiName(KCC_Emoji:emoji, dest[DCC_EMOJI_NAME_SIZE], maxlen = DCC_EMOJI_NAME_SIZE)</code></div></div>获取表情名称，存入 <span style="font-family: courier;" class="mycode_font">dest</span>。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.9 反应</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_CreateReaction</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_CreateReaction(KCC_Message:message, KCC_Emoji:reaction_emoji)</code></div></div>对指定消息添加表情反应。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_DeleteMessageReaction</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_DeleteMessageReaction(KCC_Message:message, KCC_Emoji:reaction_emoji = KCC_Emoji:0)</code></div></div>移除消息上的表情反应。<span style="font-family: courier;" class="mycode_font">reaction_emoji</span> 为 0（默认）时删除该消息上的<span style="font-weight: bold;" class="mycode_b">所有</span>反应。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">3.10 其他</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_EscapeMarkdown</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>KCC_EscapeMarkdown(const src[], dest[], max_size = sizeof dest)</code></div></div>对字符串中的 Markdown 特殊字符进行转义，使文本在 Kook 消息中原样显示，不被格式化。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u"><span style="font-weight: bold;" class="mycode_b">4. Callbacks（回调函数）</span></span><br />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.1 频道回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnChannelCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnChannelCreate(KCC_Channel:channel)</code></div></div>触发时机：服务器中有新频道创建时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnChannelUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnChannelUpdate(KCC_Channel:channel)</code></div></div>触发时机：频道信息更新时（名称、权限等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnChannelDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnChannelDelete(KCC_Channel:channel)</code></div></div>触发时机：频道被删除时。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.2 消息回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnMessageCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnMessageCreate(KCC_Message:message)</code></div></div>触发时机：频道中有新消息发送时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnMessageDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnMessageDelete(KCC_Message:message)</code></div></div>触发时机：消息被删除时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnMessageReaction</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnMessageReaction(KCC_Message:message, KCC_User:reaction_user, KCC_Emoji:emoji, DCC_MessageReactionType:reaction_type)</code></div></div>触发时机：消息添加或移除表情反应时。<ul class="mycode_list"><li><span style="font-family: courier;" class="mycode_font">message</span>：消息内部 ID<br />
</li>
<li><span style="font-family: courier;" class="mycode_font">reaction_user</span>：操作反应的用户内部 ID<br />
</li>
<li><span style="font-family: courier;" class="mycode_font">emoji</span>：使用的表情内部 ID<br />
</li>
<li><span style="font-family: courier;" class="mycode_font">reaction_type</span>：反应事件类型（添加 / 移除等）<br />
</li>
</ul>
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.3 用户回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnUserUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnUserUpdate(KCC_User:user)</code></div></div>触发时机：用户资料更新时（用户名、头像等）。<br />
<br />
<hr class="mycode_hr" />
<br />
<span style="text-decoration: underline;" class="mycode_u">4.4 服务器回调</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildCreate(KCC_Guild:guild)</code></div></div>触发时机：服务器创建，或机器人加入新服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildUpdate(KCC_Guild:guild)</code></div></div>触发时机：服务器信息更新时（名称、图标等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildDelete(KCC_Guild:guild)</code></div></div>触发时机：服务器删除，或机器人离开服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberAdd</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberAdd(KCC_Guild:guild, KCC_User:user)</code></div></div>触发时机：用户加入服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberUpdate(KCC_Guild:guild, KCC_User:user)</code></div></div>触发时机：成员信息更新时（昵称、身份组等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberVoiceUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberVoiceUpdate(KCC_Guild:guild, KCC_User:user, KCC_Channel:channel)</code></div></div>触发时机：成员语音状态变化时（加入 / 离开语音频道）。<ul class="mycode_list"><li><span style="font-family: courier;" class="mycode_font">channel</span>：语音频道内部 ID，用户离开语音时该值可能无效<br />
</li>
</ul>
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildMemberRemove</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildMemberRemove(KCC_Guild:guild, KCC_User:user)</code></div></div>触发时机：用户离开或被踢出服务器时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildRoleCreate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildRoleCreate(KCC_Guild:guild, KCC_Role:role)</code></div></div>触发时机：服务器中创建新身份组时。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildRoleUpdate</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildRoleUpdate(KCC_Guild:guild, KCC_Role:role)</code></div></div>触发时机：服务器身份组更新时（名称、颜色、权限等）。<br />
<br />
<span style="font-weight: bold;" class="mycode_b">KCC_OnGuildRoleDelete</span><br />
<div class="codeblock"><div class="title">代码:</div><div class="body" dir="ltr"><code>public KCC_OnGuildRoleDelete(KCC_Guild:guild, KCC_Role:role)</code></div></div>触发时机：服务器身份组被删除时。]]></content:encoded>
		</item>
	</channel>
</rss>