refactor(ringcentral): simplify selfOnly mode, remove allowOtherChats
- selfOnly: true (default) = only respond to JWT user in Personal chat - selfOnly: false = enable full DM/group policy controls Removed redundant allowOtherChats option. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
parent
f77aeeb34c
commit
7e57e324d1
@ -74,14 +74,13 @@ export RINGCENTRAL_JWT="your-jwt-token"
|
||||
| `clientSecret` | string | - | RingCentral app client secret |
|
||||
| `jwt` | string | - | JWT token for authentication |
|
||||
| `server` | string | `https://platform.ringcentral.com` | RingCentral API server URL |
|
||||
| `selfOnly` | boolean | `true` | Only accept messages from the JWT user |
|
||||
| `allowOtherChats` | boolean | `false` | In selfOnly mode, allow chats other than Personal |
|
||||
| `selfOnly` | boolean | `true` | Only respond to JWT user in Personal chat |
|
||||
| `name` | string | - | Bot display name |
|
||||
| `textChunkLimit` | number | `4000` | Maximum characters per message chunk |
|
||||
| `dmPolicy` | string | `"pairing"` | DM policy (only applies when `selfOnly: false`) |
|
||||
| `groupPolicy` | string | `"allowlist"` | Group policy (only applies when `selfOnly: false`) |
|
||||
| `dmPolicy` | string | `"pairing"` | DM policy (only when `selfOnly: false`) |
|
||||
| `groupPolicy` | string | `"allowlist"` | Group policy (only when `selfOnly: false`) |
|
||||
|
||||
> **Note:** When `selfOnly: true` (default), the `dmPolicy`, `allowFrom`, `groupPolicy`, and related settings are ignored. The bot only responds to the JWT user in their Personal chat.
|
||||
> **Note:** When `selfOnly: true` (default), the bot only responds to the JWT user in their Personal chat. All other policy settings (`dmPolicy`, `allowFrom`, `groupPolicy`, etc.) are ignored.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@ const RingCentralAccountSchemaBase = z
|
||||
allowBots: z.boolean().optional(),
|
||||
botExtensionId: z.string().optional(),
|
||||
selfOnly: z.boolean().optional(),
|
||||
allowOtherChats: z.boolean().optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
|
||||
@ -226,14 +226,10 @@ async function processMessageWithPipeline(params: {
|
||||
const isGroup = chatType !== "Direct" && chatType !== "PersonalChat" && chatType !== "Personal";
|
||||
runtime.log?.(`[${account.accountId}] Chat type: ${chatType}, isGroup: ${isGroup}`);
|
||||
|
||||
// In selfOnly mode, by default only allow "Personal" chat (conversation with yourself)
|
||||
// Set allowOtherChats: true to allow DMs and groups
|
||||
if (selfOnly) {
|
||||
const allowOtherChats = account.config.allowOtherChats === true; // default false
|
||||
if (!allowOtherChats && !isPersonalChat) {
|
||||
logVerbose(core, runtime, `ignore non-personal chat in selfOnly mode: chatType=${chatType}`);
|
||||
return;
|
||||
}
|
||||
// In selfOnly mode, only allow "Personal" chat (conversation with yourself)
|
||||
if (selfOnly && !isPersonalChat) {
|
||||
logVerbose(core, runtime, `ignore non-personal chat in selfOnly mode: chatType=${chatType}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const defaultGroupPolicy = config.channels?.defaults?.groupPolicy;
|
||||
|
||||
@ -114,8 +114,7 @@ export type RingCentralAccountConfig = {
|
||||
allowBots?: boolean;
|
||||
botExtensionId?: string;
|
||||
replyToMode?: "off" | "all";
|
||||
selfOnly?: boolean; // JWT mode: only accept messages from the JWT user (default: true)
|
||||
allowOtherChats?: boolean; // In selfOnly mode, allow chats other than Personal (default: false)
|
||||
selfOnly?: boolean; // JWT mode: only accept messages from the JWT user in Personal chat (default: true)
|
||||
};
|
||||
|
||||
export type RingCentralConfig = RingCentralAccountConfig & {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user