mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:54:31 +00:00
Discord: gate guild prefix to numeric keys
This commit is contained in:
@@ -394,7 +394,8 @@ export const discordOnboardingAdapter: ChannelOnboardingAdapter = {
|
|||||||
const channels = value?.channels ?? {};
|
const channels = value?.channels ?? {};
|
||||||
const channelKeys = Object.keys(channels);
|
const channelKeys = Object.keys(channels);
|
||||||
if (channelKeys.length === 0) {
|
if (channelKeys.length === 0) {
|
||||||
return [guildKey];
|
const input = /^\d+$/.test(guildKey) ? `guild:${guildKey}` : guildKey;
|
||||||
|
return [input];
|
||||||
}
|
}
|
||||||
return channelKeys.map((channelKey) => `${guildKey}/${channelKey}`);
|
return channelKeys.map((channelKey) => `${guildKey}/${channelKey}`);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) {
|
|||||||
const channels = guildCfg?.channels ?? {};
|
const channels = guildCfg?.channels ?? {};
|
||||||
const channelKeys = Object.keys(channels).filter((key) => key !== "*");
|
const channelKeys = Object.keys(channels).filter((key) => key !== "*");
|
||||||
if (channelKeys.length === 0) {
|
if (channelKeys.length === 0) {
|
||||||
entries.push({ input: guildKey, guildKey });
|
const input = /^\d+$/.test(guildKey) ? `guild:${guildKey}` : guildKey;
|
||||||
|
entries.push({ input, guildKey });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (const channelKey of channelKeys) {
|
for (const channelKey of channelKeys) {
|
||||||
|
|||||||
Reference in New Issue
Block a user