-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmessage-effects.ts
More file actions
71 lines (61 loc) · 1.88 KB
/
message-effects.ts
File metadata and controls
71 lines (61 loc) · 1.88 KB
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
import type { BubbleEffect } from "../types";
import { createSDK, handleError } from "./utils";
const CHAT_GUID = process.env.CHAT_GUID || "any;-;+1234567890";
const BUBBLE_EFFECTS: BubbleEffect[] = [
"confetti",
"lasers",
"fireworks",
"balloons",
"hearts",
"shootingStar",
"celebration",
"echo",
"spotlight",
"gentle",
"loud",
"slam",
"invisibleInk",
];
const EFFECT_MESSAGES: Record<BubbleEffect, string> = {
confetti: "Happy Birthday!",
lasers: "Pew pew pew!",
fireworks: "Celebration time!",
balloons: "Congratulations!",
hearts: "I love you!",
shootingStar: "Make a wish!",
celebration: "Amazing!",
echo: "Hello hello hello...",
spotlight: "Look at me!",
gentle: "Shh...",
loud: "IMPORTANT MESSAGE!",
slam: "BAM!",
invisibleInk: "Secret message!",
};
async function main() {
const sdk = createSDK();
sdk.on("ready", async () => {
console.log("Bubble effect examples (requires Private API)\n");
try {
for (const effect of BUBBLE_EFFECTS) {
const msg = await sdk.messages.sendMessage({
chatGuid: CHAT_GUID,
message: EFFECT_MESSAGES[effect],
bubbleEffect: effect,
});
console.log(`${effect}: ${msg.guid}`);
await new Promise((resolve) => setTimeout(resolve, 5000));
}
console.log("\nAvailable bubble effects:");
for (const effect of BUBBLE_EFFECTS) {
console.log(` ${effect}`);
}
} catch (error) {
handleError(error, "Failed to send message with effect");
console.log("\nNote: Bubble effects require Private API to be enabled");
}
await sdk.close();
process.exit(0);
});
await sdk.connect();
}
main().catch(console.error);