📦 Stream29 / TelegramTrigger

📄 command.yaml · 153 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153identity:
  name: command
  author: developer
  label:
    en_US: Command
    zh_Hans: 命令

description:
  human:
    en_US: Triggers when a bot command is received
    zh_Hans: 当收到机器人命令时触发
  llm:
    en_US: This trigger activates when a bot command (starting with /) is received from a Telegram bot, providing information about the command, message, chat, and user who sent it.
    zh_Hans: 当从 Telegram bot 收到机器人命令(以 / 开头)时,此触发器会被激活,提供有关命令、消息、聊天和发送命令的用户的信息。

parameters:
- name: command_filter
  label:
    en_US: Command Filter
    zh_Hans: 命令过滤
  type: string
  required: false
  description:
    en_US: "Only trigger for specific commands (e.g., start, help, settings - comma-separated, without /)"
    zh_Hans: "仅对特定命令触发(例如:start, help, settings - 逗号分隔,不带 /)"

- name: chat_type
  label:
    en_US: Chat Type Filter
    zh_Hans: 聊天类型过滤
  type: string
  required: false
  description:
    en_US: "Only trigger for specific chat types: private, group, supergroup, channel (comma-separated)"
    zh_Hans: "仅对特定聊天类型触发:private, group, supergroup, channel(逗号分隔)"

- name: from_username
  label:
    en_US: From Username
    zh_Hans: 来自用户名
  type: string
  required: false
  description:
    en_US: "Only trigger for commands from these usernames (comma-separated)"
    zh_Hans: "仅对这些用户名的命令触发(逗号分隔)"

output_schema:
  type: object
  properties:
    message:
      type: object
      description: The message object
      properties:
        message_id:
          type: integer
          description: Unique message identifier
        from:
          type: object
          description: Sender of the message
          properties:
            id:
              type: integer
              description: Unique identifier for this user or bot
            is_bot:
              type: boolean
              description: True, if this user is a bot
            first_name:
              type: string
              description: User's or bot's first name
            last_name:
              type: string
              description: User's or bot's last name
            username:
              type: string
              description: User's or bot's username
            language_code:
              type: string
              description: IETF language tag of the user's language
        chat:
          type: object
          description: Conversation the message belongs to
          properties:
            id:
              type: integer
              description: Unique identifier for this chat
            type:
              type: string
              enum:
              - private
              - group
              - supergroup
              - channel
              description: Type of chat
            title:
              type: string
              description: Title, for supergroups, channels and group chats
            username:
              type: string
              description: Username, for private chats, supergroups and channels
            first_name:
              type: string
              description: First name of the other party in a private chat
            last_name:
              type: string
              description: Last name of the other party in a private chat
        date:
          type: integer
          description: Date the message was sent in Unix time
        text:
          type: string
          description: The command text (e.g., /start, /help)
        entities:
          type: array
          description: Special entities like bot commands
          items:
            type: object
            properties:
              type:
                type: string
                description: Type of the entity (bot_command)
              offset:
                type: integer
                description: Offset in UTF-16 code units to the start of the entity
              length:
                type: integer
                description: Length of the entity in UTF-16 code units
      required:
      - message_id
      - date
      - chat
      - text

    update_id:
      type: integer
      description: The update's unique identifier

    command:
      type: string
      description: The extracted command (without / prefix)

    command_args:
      type: string
      description: Arguments after the command (if any)

  required:
  - update_id
  - message
  - command

extra:
  python:
    source: events/command/command.py