| 4153 | |
| 4154 | class CollapseFeature extends BaseFeatureHandler { |
| 4155 | readonly name = "折叠设置"; |
| 4156 | readonly command = "collapse"; |
| 4157 | readonly description = "设置消息折叠"; |
| 4158 | |
| 4159 | constructor(configManagerPromise: Promise<ConfigManager>) { |
| 4160 | super(configManagerPromise); |
| 4161 | } |
| 4162 | |
| 4163 | async execute( |
| 4164 | msg: Api.Message, |
| 4165 | args: string[], |
| 4166 | _prefixes: string[], |
| 4167 | ): Promise<void> { |
| 4168 | const configManager = await this.getConfigManager(); |
| 4169 | const config = configManager.getConfig(); |
| 4170 | |
| 4171 | if (args.length < 2) { |
| 4172 | await this.editMessage( |
| 4173 | msg, |
| 4174 | `📖 <b>消息折叠状态:</b>\n\n📄 当前状态: ${config.collapse ? "开启" : "关闭"}`, |
| 4175 | ); |
| 4176 | return; |
| 4177 | } |
| 4178 | |
| 4179 | const state = args[1].toLowerCase(); |
| 4180 | requireUser(state === "on" || state === "off", "参数必须是 on 或 off"); |
| 4181 | |
| 4182 | await configManager.updateConfig((cfg) => { |
| 4183 | cfg.collapse = state === "on"; |
| 4184 | }); |
| 4185 | |
| 4186 | await this.editMessage( |
| 4187 | msg, |
| 4188 | `✅ 引用折叠已${state === "on" ? "开启" : "关闭"}`, |
| 4189 | ); |
| 4190 | } |
| 4191 | } |
| 4192 | |
| 4193 | class TelegraphFeature extends BaseFeatureHandler { |
| 4194 | readonly name = "Telegraph 管理"; |
| 4195 | readonly command = "telegraph"; |
nothing calls this directly
no outgoing calls
no test coverage detected