Add tiers, continuation, fetch cooldown, persistent action log, voice read, batch MCP

This commit is contained in:
Fisto
2026-09-11 15:53:06 +02:00
parent 82f78bb2b4
commit 8e8c15e8bc
17 changed files with 669 additions and 139 deletions
+1
View File
@@ -34,6 +34,7 @@ const KNOWN_ACTIONS = new Set<string>([
PuppetAction.Ping,
PuppetAction.EventsSubscribe,
PuppetAction.StateGet,
PuppetAction.VoiceGet,
PuppetAction.MessageSend,
PuppetAction.MessageRead,
PuppetAction.MessageFetch,
+43 -1
View File
@@ -9,7 +9,13 @@
import { openPrivateChannel, sendMessage } from "@vencord/types/utils";
import { findByPropsLazy } from "@vencord/types/webpack";
import { ChannelStore, GuildStore, MessageStore, UserStore } from "@vencord/types/webpack/common";
import {
ChannelStore,
GuildStore,
MessageStore,
UserStore,
VoiceStateStore
} from "@vencord/types/webpack/common";
import { isSnowflake, PUPPET_LIMITS, PuppetAction, PuppetErrorCode, type PuppetResult } from "shared/puppetProtocol";
/** Channel types that can receive text messages. */
@@ -154,6 +160,42 @@ export async function handlePuppetAction(
return ok(state);
}
case PuppetAction.VoiceGet: {
const { guildId, userId } = params;
if (guildId !== undefined) {
assert(isSnowflake(guildId), PuppetErrorCode.InvalidSnowflake, "guildId must be a snowflake");
}
if (userId !== undefined) {
assert(isSnowflake(userId), PuppetErrorCode.InvalidSnowflake, "userId must be a snowflake");
}
const targetId = (userId as string | undefined) ?? UserStore.getCurrentUser()?.id;
assert(targetId, PuppetErrorCode.NotLoggedIn, "no user is logged in");
const voiceState = VoiceStateStore.getVoiceState((guildId as string | null) ?? null, targetId);
if (!voiceState?.channelId) {
return ok({ guildId: guildId ?? null, channelId: null, channelName: null, members: [] });
}
const channel = ChannelStore.getChannel(voiceState.channelId);
const states = VoiceStateStore.getVoiceStatesForChannel(voiceState.channelId);
return ok({
guildId: channel?.guild_id ?? guildId ?? null,
channelId: voiceState.channelId,
channelName: channel?.name ?? null,
members: Object.values(states).map(state => {
const user = UserStore.getUser(state.userId);
return {
id: state.userId,
username: user?.username ?? state.userId,
mute: state.mute,
deaf: state.deaf
};
})
});
}
case PuppetAction.MessageSend: {
const { channelId } = params;
assert(isSnowflake(channelId), PuppetErrorCode.InvalidSnowflake, "channelId must be a snowflake");
+2
View File
@@ -10,6 +10,7 @@ export const enum PuppetAction {
Ping = "ping",
EventsSubscribe = "events.subscribe",
StateGet = "state.get",
VoiceGet = "voice.get",
MessageSend = "message.send",
MessageRead = "message.read",
MessageFetch = "message.fetch",
@@ -20,6 +21,7 @@ export const PuppetActions: readonly PuppetAction[] = [
PuppetAction.Ping,
PuppetAction.EventsSubscribe,
PuppetAction.StateGet,
PuppetAction.VoiceGet,
PuppetAction.MessageSend,
PuppetAction.MessageRead,
PuppetAction.MessageFetch,