telegram-user: align capabilities and media limits
This commit is contained in:
parent
66a64463ab
commit
3cb14cf81a
@ -7,6 +7,7 @@ import {
|
|||||||
deleteAccountFromConfigSection,
|
deleteAccountFromConfigSection,
|
||||||
formatPairingApproveHint,
|
formatPairingApproveHint,
|
||||||
normalizeAccountId,
|
normalizeAccountId,
|
||||||
|
resolveChannelMediaMaxBytes,
|
||||||
setAccountEnabledInConfigSection,
|
setAccountEnabledInConfigSection,
|
||||||
type ChannelGroupContext,
|
type ChannelGroupContext,
|
||||||
type ChannelPlugin,
|
type ChannelPlugin,
|
||||||
@ -101,10 +102,10 @@ export const telegramUserPlugin: ChannelPlugin<ResolvedTelegramUserAccount> = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
capabilities: {
|
capabilities: {
|
||||||
chatTypes: ["direct", "group"],
|
chatTypes: ["direct", "group", "thread"],
|
||||||
polls: true,
|
polls: true,
|
||||||
reactions: false,
|
reactions: true,
|
||||||
threads: false,
|
threads: true,
|
||||||
media: true,
|
media: true,
|
||||||
nativeCommands: false,
|
nativeCommands: false,
|
||||||
blockStreaming: true,
|
blockStreaming: true,
|
||||||
@ -236,11 +237,21 @@ export const telegramUserPlugin: ChannelPlugin<ResolvedTelegramUserAccount> = {
|
|||||||
});
|
});
|
||||||
return { channel: "telegram-user", ...result };
|
return { channel: "telegram-user", ...result };
|
||||||
},
|
},
|
||||||
sendMedia: async ({ to, text, mediaUrl, accountId, threadId }) => {
|
sendMedia: async ({ cfg, to, text, mediaUrl, accountId, threadId }) => {
|
||||||
|
const maxBytes = resolveChannelMediaMaxBytes({
|
||||||
|
cfg,
|
||||||
|
resolveChannelLimitMb: ({ cfg, accountId }) =>
|
||||||
|
resolveTelegramUserAccount({
|
||||||
|
cfg: cfg as CoreConfig,
|
||||||
|
accountId,
|
||||||
|
}).config.mediaMaxMb,
|
||||||
|
accountId,
|
||||||
|
});
|
||||||
const result = await sendMediaTelegramUser(to, text, {
|
const result = await sendMediaTelegramUser(to, text, {
|
||||||
accountId: accountId ?? undefined,
|
accountId: accountId ?? undefined,
|
||||||
mediaUrl,
|
mediaUrl,
|
||||||
threadId,
|
threadId,
|
||||||
|
...(maxBytes ? { maxBytes } : {}),
|
||||||
});
|
});
|
||||||
return { channel: "telegram-user", ...result };
|
return { channel: "telegram-user", ...result };
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user