(message: any)
| 185 | } |
| 186 | |
| 187 | private messageUpdate(message: any) { |
| 188 | // this.log("messageUpdate", message); |
| 189 | const { |
| 190 | content, |
| 191 | embeds, |
| 192 | interaction = {}, |
| 193 | nonce, |
| 194 | id, |
| 195 | components, |
| 196 | } = message; |
| 197 | |
| 198 | if (!nonce) { |
| 199 | const { name } = interaction; |
| 200 | |
| 201 | switch (name) { |
| 202 | case "settings": |
| 203 | this.emit("settings", message); |
| 204 | return; |
| 205 | case "describe": |
| 206 | let uri = embeds?.[0]?.image?.url; |
| 207 | if (this.config.ImageProxy !== "") { |
| 208 | uri = uri.replace( |
| 209 | "https://cdn.discordapp.com/", |
| 210 | this.config.ImageProxy |
| 211 | ); |
| 212 | } |
| 213 | const describe: MJDescribe = { |
| 214 | id: id, |
| 215 | flags: message.flags, |
| 216 | descriptions: embeds?.[0]?.description.split("\n\n"), |
| 217 | uri: uri, |
| 218 | proxy_url: embeds?.[0]?.image?.proxy_url, |
| 219 | options: formatOptions(components), |
| 220 | }; |
| 221 | this.emitMJ(id, describe); |
| 222 | break; |
| 223 | case "prefer remix": |
| 224 | if (content != "") { |
| 225 | this.emit("prefer-remix", content); |
| 226 | } |
| 227 | break; |
| 228 | case "shorten": |
| 229 | const shorten: MJShorten = { |
| 230 | description: embeds?.[0]?.description, |
| 231 | prompts: formatPrompts(embeds?.[0]?.description as string), |
| 232 | options: formatOptions(components), |
| 233 | id, |
| 234 | flags: message.flags, |
| 235 | }; |
| 236 | this.emitMJ(id, shorten); |
| 237 | break; |
| 238 | case "info": |
| 239 | this.emit("info", embeds?.[0]?.description); |
| 240 | return; |
| 241 | } |
| 242 | } |
| 243 | if (embeds?.[0]) { |
| 244 | var { description, title } = embeds[0]; |
no test coverage detected