@@ -6,8 +6,9 @@ if (!TO) {
66 process . exit ( 1 )
77}
88
9- const IMG = 'https://placehold.co/512x512/png'
10- const VIDEO = 'https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4'
9+ const POSTER = 'https://placehold.co/600x800/png'
10+ const SHOT = 'https://placehold.co/512x512/png'
11+ const CLIP = 'https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4'
1112
1213const sleep = ( ms : number ) : Promise < void > => new Promise ( ( r ) => setTimeout ( r , ms ) )
1314
@@ -16,104 +17,124 @@ const client = new Client()
1617client . on ( 'qr' , ( { qrString } ) => console . log ( 'Scan QR:' , qrString ) )
1718
1819client . on ( 'connect' , async ( { me } ) => {
19- console . log ( '\n┌─ zaileys · AIRich demo' )
20- console . log ( '├─ from :' , me . id )
21- console . log ( '└─ to :' , TO , '\n' )
20+ const bar = '═' . repeat ( 34 )
21+ console . log ( `\n${ bar } \n zaileys · AIRich showcase\n ${ me . id } → ${ TO } \n${ bar } \n` )
2222
23- let step = 0
23+ let n = 0
2424 let ok = 0
2525 const send = async ( label : string , fn : ( ) => unknown ) : Promise < void > => {
26- step ++
26+ n ++
2727 try {
2828 const key = ( await ( fn ( ) as Promise < { id ?: string } > ) ) ?? { }
2929 ok ++
30- console . log ( ` ${ String ( step ) . padStart ( 2 , '0' ) } . ✓ ${ label . padEnd ( 28 ) } ${ key . id ?? 'sent' } ` )
30+ console . log ( ` [ ${ n } /4] ✓ ${ label . padEnd ( 22 ) } → ${ key . id ?? 'sent' } ` )
3131 } catch ( e ) {
32- console . log ( ` ${ String ( step ) . padStart ( 2 , '0' ) } . ✗ ${ label . padEnd ( 28 ) } ${ e instanceof Error ? e . message : String ( e ) } ` )
32+ console . log ( ` [ ${ n } /4] ✗ ${ label . padEnd ( 22 ) } → ${ e instanceof Error ? e . message : String ( e ) } ` )
3333 }
3434 await sleep ( 1800 )
3535 }
3636
37- const intro = [
38- '*AIRich — rich response dalam satu pesan* ' ,
37+ const brief = [
38+ '*Tech Brief — Senin pagi* ☕ ' ,
3939 '' ,
40- 'Repo: [GitHub ](https://github.com/zeative/zaileys)' ,
41- 'Docs: [](https://github.com/zeative/zaileys)' ,
40+ 'Rangkuman harian dari [zaileys ](https://github.com/zeative/zaileys). ' ,
41+ 'Sumber data dipantau otomatis. [](https://github.com/zeative/zaileys)' ,
4242 '' ,
43- 'Teks + hyperlink + sitasi, code block ber-syntax, dan tabel — semua menyatu .' ,
43+ 'Tiga sorotan utama hari ini, plus cuplikan kode untuk bikin bot interaktif .' ,
4444 ] . join ( '\n' )
4545
4646 const code = [
4747 "import { Client } from 'zaileys'" ,
4848 '' ,
4949 'const client = new Client()' ,
5050 '' ,
51- "client.on('connect', ({ me }) => {" ,
52- " console.log('Connected as', me.id)" ,
51+ "client.on('message', async (msg) => {" ,
52+ ' await client.send(msg.senderId).buttons(' ,
53+ " [{ id: 'yes', text: 'Ya' }, { id: 'no', text: 'Tidak' }]," ,
54+ " { text: 'Lanjut order?' }," ,
55+ ' )' ,
5356 '})' ,
5457 '' ,
55- "client.on('text ', async (msg ) => {" ,
56- ' await client.send(msg.senderId).text(`Halo ${msg.senderName}!`)' ,
58+ "client.on('button-click ', (ctx ) => {" ,
59+ " console.log('clicked:', ctx.buttonId)" ,
5760 '})' ,
5861 ] . join ( '\n' )
5962
60- const featureTable = [
61- [ 'Fitur' , 'Status' , 'Versi' ] ,
62- [ 'Button' , '✅ Ready' , 'v4' ] ,
63- [ 'ButtonV2 (CTA)' , '✅ Ready' , 'v4' ] ,
64- [ 'Carousel' , '✅ Ready' , 'v4' ] ,
65- [ 'Header Media' , '✅ Ready' , 'v4' ] ,
66- [ 'AIRich' , '🧪 Experimental' , 'v4' ] ,
67- [ 'Hyperlink' , '🆕 New' , 'v4' ] ,
68- [ 'Citation' , '🆕 New' , 'v4' ] ,
69- [ 'Code Block' , '🆕 New' , 'v4' ] ,
70- [ 'Table' , '🆕 New' , 'v4' ] ,
63+ const leaderboard = [
64+ [ 'Repo' , 'Stars' , 'Δ 24h' ] ,
65+ [ 'zaileys' , '12.4k' , '+318' ] ,
66+ [ 'baileys' , '15.1k' , '+92' ] ,
67+ [ 'venom' , '6.2k' , '+11' ] ,
7168 ]
7269
73- await send ( 'text + code + table ' , ( ) =>
70+ await send ( 'briefing ' , ( ) =>
7471 client . send ( TO ) . aiRich (
7572 [
76- { type : 'text' , text : intro } ,
73+ { type : 'text' , text : brief } ,
7774 { type : 'code' , language : 'typescript' , content : code } ,
78- { type : 'table' , rows : featureTable } ,
75+ { type : 'table' , rows : leaderboard } ,
7976 ] ,
8077 {
81- title : '🐙 zaileys Bot ' ,
82- footer : '💡 Powered by zaileys — github.com/zeative/zaileys' ,
78+ title : '📰 zaileys Daily ' ,
79+ footer : '💡 Dibuat dengan zaileys — github.com/zeative/zaileys' ,
8380 sources : [ [ 'https://avatars.githubusercontent.com/u/9919?s=64' , 'https://github.com/zeative/zaileys' , 'zaileys on GitHub' ] ] ,
8481 } ,
8582 ) ,
8683 )
8784
88- await send ( 'image + video + suggest ' , ( ) =>
85+ await send ( 'galeri ' , ( ) =>
8986 client . send ( TO ) . aiRich (
9087 [
91- { type : 'text' , text : '*Lihat perincian * — kartu image & video dalam satu rich response .' } ,
92- { type : 'image' , url : IMG } ,
93- { type : 'video' , url : VIDEO , duration : 10 } ,
94- { type : 'tip' , text : 'Gunakan zaileys <mode> untuk tes fitur spesifik ' } ,
95- { type : 'suggest' , prompts : [ 'zaileys buttons ' , 'zaileys carousel ' , 'zaileys product' , 'zaileys post '] } ,
88+ { type : 'text' , text : '*Galeri rilis v4 * — geser untuk lihat tangkapan layar & klip .' } ,
89+ { type : 'image' , url : [ POSTER , SHOT ] } ,
90+ { type : 'video' , url : CLIP , duration : 10 } ,
91+ { type : 'tip' , text : 'Ketuk gambar untuk pratinjau penuh ' } ,
92+ { type : 'suggest' , prompts : [ 'Lihat changelog ' , 'Cara upgrade ' , 'Bandingkan v3 vs v4 ' ] } ,
9693 ] ,
97- { title : '🐙 zaileys Bot ' , footer : '#zaileys' } ,
94+ { title : '🖼️ zaileys v4 ' , footer : '#zaileys' } ,
9895 ) ,
9996 )
10097
101- await send ( 'product carousel ' , ( ) =>
98+ await send ( 'sosial ' , ( ) =>
10299 client . send ( TO ) . aiRich (
103100 [
104- { type : 'text' , text : 'Menu hari ini 👇' } ,
101+ { type : 'text' , text : 'Lagi ramai dibahas komunitas 👇' } ,
102+ {
103+ type : 'reels' ,
104+ reels : [
105+ { username : 'zeative' , title : 'Demo nativeFlow buttons' , url : CLIP , thumbnail : SHOT , views : 12400 , likes : 980 , verified : true } ,
106+ { username : 'zeative' , title : 'AIRich rich response' , url : CLIP , thumbnail : POSTER , views : 8800 , likes : 740 , verified : true } ,
107+ ] ,
108+ } ,
109+ {
110+ type : 'post' ,
111+ posts : [
112+ { username : 'zeative' , title : 'zaileys v4 is out' , caption : 'Buttons, carousel, AIRich — semua built-in.' , thumbnail : SHOT , likes : 1500 , comments : 132 , verified : true , source : 'GITHUB' } ,
113+ ] ,
114+ } ,
115+ { type : 'suggest' , prompts : [ 'Tonton lagi' , 'Bagikan' ] } ,
116+ ] ,
117+ { title : '🔥 Trending' } ,
118+ ) ,
119+ )
120+
121+ await send ( 'toko' , ( ) =>
122+ client . send ( TO ) . aiRich (
123+ [
124+ { type : 'text' , text : 'Merch komunitas zaileys 🛍️' } ,
105125 {
106126 type : 'product' ,
107127 products : [
108- { title : 'Pizza Mozzarella' , price : '$7' , salePrice : '$6' , brand : 'zaileys' , image : IMG , url : 'https://github.com/zeative/zaileys' } ,
109- { title : 'Ramen Kaldu' , price : '$6' , salePrice : '$5' , brand : 'zaileys' , image : IMG , url : 'https://github.com/zeative/zaileys' } ,
128+ { title : 'Sticker Pack' , price : 'Rp35.000' , salePrice : 'Rp25.000' , brand : 'zaileys' , image : SHOT , url : 'https://github.com/zeative/zaileys' } ,
129+ { title : 'Hoodie Dev' , price : 'Rp320.000' , salePrice : 'Rp275.000' , brand : 'zaileys' , image : POSTER , url : 'https://github.com/zeative/zaileys' } ,
130+ { title : 'Mug Coder' , price : 'Rp90.000' , salePrice : 'Rp69.000' , brand : 'zaileys' , image : SHOT , url : 'https://github.com/zeative/zaileys' } ,
110131 ] ,
111132 } ,
112- { type : 'suggest' , prompts : [ 'Lihat semua produk' , 'Pesan sekarang ' ] } ,
133+ { type : 'suggest' , prompts : [ 'Lihat semua produk' , 'Checkout ' ] } ,
113134 ] ,
114- { title : '🛍️ Product Carousel ' } ,
135+ { title : '🛍️ zaileys Store ' } ,
115136 ) ,
116137 )
117138
118- console . log ( `\n└─ done · ${ ok } /${ step } terkirim — cek WhatsApp kamu. \n` )
139+ console . log ( `\n${ bar } \n selesai · ${ ok } /${ n } terkirim — cek WhatsApp kamu\n ${ bar } \n` )
119140} )
0 commit comments