Channels: add telegram-user plugin
This commit is contained in:
1 parent
da71eaebd2
commit
52e730e090
20 files changed
+1166
-1
No files matched your search
@@ -36,6 +36,8 @@ export type ChannelSetupInput = {
|
||||
audienceType?: string;
|
||||
audience?: string;
|
||||
useEnv?: boolean;
|
||||
apiId?: number;
|
||||
apiHash?: string;
|
||||
homeserver?: string;
|
||||
userId?: string;
|
||||
accessToken?: string;
|
||||
|
||||
@@ -39,6 +39,8 @@ const optionNamesAdd = [
|
||||
"audienceType",
|
||||
"audience",
|
||||
"useEnv",
|
||||
"apiId",
|
||||
"apiHash",
|
||||
"homeserver",
|
||||
"userId",
|
||||
"accessToken",
|
||||
@@ -175,6 +177,8 @@ export function registerChannelsCli(program: Command) {
|
||||
.option("--webhook-url <url>", "Google Chat webhook URL")
|
||||
.option("--audience-type <type>", "Google Chat audience type (app-url|project-number)")
|
||||
.option("--audience <value>", "Google Chat audience value (app URL or project number)")
|
||||
.option("--api-id <id>", "Telegram user API id (my.telegram.org)")
|
||||
.option("--api-hash <hash>", "Telegram user API hash (my.telegram.org)")
|
||||
.option("--homeserver <url>", "Matrix homeserver URL")
|
||||
.option("--user-id <id>", "Matrix user ID")
|
||||
.option("--access-token <token>", "Matrix access token")
|
||||
|
||||
@@ -40,6 +40,8 @@ export function applyChannelAccountConfig(params: {
|
||||
audienceType?: string;
|
||||
audience?: string;
|
||||
useEnv?: boolean;
|
||||
apiId?: number;
|
||||
apiHash?: string;
|
||||
homeserver?: string;
|
||||
userId?: string;
|
||||
accessToken?: string;
|
||||
@@ -77,6 +79,8 @@ export function applyChannelAccountConfig(params: {
|
||||
audienceType: params.audienceType,
|
||||
audience: params.audience,
|
||||
useEnv: params.useEnv,
|
||||
apiId: params.apiId,
|
||||
apiHash: params.apiHash,
|
||||
homeserver: params.homeserver,
|
||||
userId: params.userId,
|
||||
accessToken: params.accessToken,
|
||||
|
||||
@@ -37,6 +37,8 @@ export type ChannelsAddOptions = {
|
||||
audienceType?: string;
|
||||
audience?: string;
|
||||
useEnv?: boolean;
|
||||
apiId?: string | number;
|
||||
apiHash?: string;
|
||||
homeserver?: string;
|
||||
userId?: string;
|
||||
accessToken?: string;
|
||||
@@ -181,7 +183,12 @@ export async function channelsAddCommand(
|
||||
: undefined;
|
||||
const groupChannels = parseList(opts.groupChannels);
|
||||
const dmAllowlist = parseList(opts.dmAllowlist);
|
||||
|
||||
const apiId =
|
||||
typeof opts.apiId === "number"
|
||||
? opts.apiId
|
||||
: typeof opts.apiId === "string" && opts.apiId.trim()
|
||||
? Number.parseInt(opts.apiId, 10)
|
||||
: undefined;
|
||||
const validationError = plugin.setup.validateInput?.({
|
||||
cfg: nextConfig,
|
||||
accountId,
|
||||
@@ -204,6 +211,8 @@ export async function channelsAddCommand(
|
||||
webhookUrl: opts.webhookUrl,
|
||||
audienceType: opts.audienceType,
|
||||
audience: opts.audience,
|
||||
apiId,
|
||||
apiHash: opts.apiHash,
|
||||
homeserver: opts.homeserver,
|
||||
userId: opts.userId,
|
||||
accessToken: opts.accessToken,
|
||||
@@ -247,6 +256,8 @@ export async function channelsAddCommand(
|
||||
webhookUrl: opts.webhookUrl,
|
||||
audienceType: opts.audienceType,
|
||||
audience: opts.audience,
|
||||
apiId,
|
||||
apiHash: opts.apiHash,
|
||||
homeserver: opts.homeserver,
|
||||
userId: opts.userId,
|
||||
accessToken: opts.accessToken,
|
||||
|
||||
Reference in new issue
Block a user