Skip to content

Commit cd1c824

Browse files
committed
chore: update wabot dependency and refactor plugins
- update @znan/wabot to v0.0.102 - cleanup button plugin examples - expand custom and meta plugin functionalities
1 parent e378c43 commit cd1c824

4 files changed

Lines changed: 239 additions & 45 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"dependencies": {
3333
"@whiskeysockets/baileys": "git+https://github.com/neoxr/baileys.git",
34-
"@znan/wabot": "^0.0.99",
34+
"@znan/wabot": "^0.0.102",
3535
"archiver": "^7.0.1",
3636
"cfonts": "^3.3.0",
3737
"express": "^4.21.2",
@@ -45,4 +45,4 @@
4545
"resolutions": {
4646
"jimp": "0.22.12"
4747
}
48-
}
48+
}

plugins/example/button.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs')
22

33
module.exports = {
4-
help: ['button1', 'button2', 'button3', 'button4', 'button5', 'button6'],
4+
help: ['button1', 'button2', 'button3', 'button4', 'button5'],
55
tags: 'example',
66
run: async (m, {
77
conn,
@@ -133,26 +133,6 @@ module.exports = {
133133
})
134134
break
135135

136-
case 'button6': // Button 6 (Message Modify)
137-
conn.sendButton(m.chat, [{
138-
text: 'Runtime',
139-
command: '.runtime'
140-
}, {
141-
text: 'Statistic',
142-
command: '.stat'
143-
}], m, {
144-
text: 'Hi @0',
145-
footer: global.footer,
146-
docs: {
147-
name: 'オートメーション',
148-
pages: 20,
149-
size: '1GB',
150-
extension: 'ppt'
151-
},
152-
body: 'WhatsApp Automation',
153-
thumbnail: Func.isUrl(setting.cover) ? setting.cover : Buffer.from(setting.cover, 'base64')
154-
})
155-
break
156136
}
157137
} catch (e) {
158138
conn.reply(m.chat, Func.jsonFormat(e), m)

plugins/example/custom.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
help: ['ephemeral', 'customid'],
2+
help: ['ephemeral', 'customid', 'stcai', 'stcprem'],
33
tags: 'example',
44
run: async (m, {
55
conn,
@@ -17,12 +17,31 @@ module.exports = {
1717
})
1818
}
1919
break
20+
2021
case 'customid': {
2122
conn.reply(m.chat, 'Hi!', null, {}, {
2223
isAI: true
2324
})
2425
}
2526
break
27+
28+
case 'stcai': {
29+
conn.sendSticker(m.chat, 'https://i.pinimg.com/1200x/4d/9e/29/4d9e29361d4dcdc6eabf5a0a035c900d.jpg', m, {
30+
packname: global.db.setting.packname,
31+
author: global.db.setting.author,
32+
mode: 'ai'
33+
})
34+
}
35+
break
36+
37+
case 'stcprem': {
38+
conn.sendSticker(m.chat, 'https://i.pinimg.com/1200x/4d/9e/29/4d9e29361d4dcdc6eabf5a0a035c900d.jpg', m, {
39+
packname: global.db.setting.packname,
40+
author: global.db.setting.author,
41+
mode: 'premium'
42+
})
43+
}
44+
break
2645
}
2746
},
2847
error: false

plugins/example/meta.js

Lines changed: 216 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,233 @@
11
module.exports = {
2-
help: ['metatable', 'metacode', 'metafile'],
2+
help: ['metatext', 'metatable', 'metacode', 'metamuted', 'metasuggest', 'metasource', 'metareels', 'metaposts', 'metaproduct', 'metamedia', 'metamix'],
33
tags: 'example',
44
run: async (m, {
55
conn,
6-
command
6+
command,
7+
setting,
8+
env
79
}) => {
810
switch (command) {
11+
12+
case 'metatext': {
13+
conn.metaSnippet(m.chat,
14+
`Hi!
15+
### Markdown support
16+
Hyperlink: [Google](https://google.com)
17+
Citation: [](https://openai.com)
18+
LaTeX: [moonbot|1429|1897]<https://cdn.ornzora.eu.cc/a3a756f2-6bb8-4814-a024-c325524a2308-FIORA.png>`,
19+
m, {
20+
title: global.header
21+
})
22+
}
23+
break
24+
925
case 'metatable': {
10-
await conn.metaSnippet(m.chat, {
11-
text: 'Product List',
12-
table: {
13-
headers: ['Product', 'Price', 'Stock'],
14-
rows: [
15-
['VPS 1GB', '15000', '12'],
16-
['VPS 2GB', '25000', '7']
17-
]
26+
conn.metaSnippet(m.chat, [
27+
{
28+
table: {
29+
title: 'List',
30+
headers: ['Name', 'Strength'],
31+
rows: [
32+
['Asta', 'Anti-magic'],
33+
['Yuno', 'Magic']
34+
]
35+
}
1836
}
19-
}, m)
37+
], m, {
38+
title: global.header
39+
})
2040
}
2141
break
42+
2243
case 'metacode': {
23-
await conn.metaSnippet(m.chat, {
24-
text: 'Example Code JavaScript:',
25-
code: "const hello = 'world'\\nconsole.log(hello)"
26-
}, m)
44+
conn.metaSnippet(m.chat, [
45+
{ text: 'Inline code :' },
46+
{ code: "const hello = 'world'\nconsole.log(hello)", language: 'javascript' },
47+
{ text: '\n' },
48+
{ text: 'Code from file (auto-detect language) :' },
49+
{ code: './package.json' },
50+
{ text: '\n' },
51+
{ text: 'Code from file + explicit language :' },
52+
{ code: './replit.nix', language: 'nix' }
53+
], m, {
54+
title: global.header
55+
})
56+
}
57+
break
58+
59+
case 'metamuted': {
60+
conn.metaSnippet(m.chat, [
61+
{ text: 'Normal text here' },
62+
{ muted: 'This is muted / secondary text' }
63+
], m, {
64+
title: global.header
65+
})
66+
}
67+
break
68+
69+
case 'metasuggest': {
70+
conn.metaSnippet(m.chat, [
71+
{ text: 'Choose one :' },
72+
{ suggestions: ['Asta', 'Yuno'] }
73+
], m, {
74+
title: global.header
75+
})
76+
}
77+
break
78+
79+
case 'metasource': {
80+
conn.metaSnippet(m.chat, [
81+
{ text: 'Useful links :' },
82+
{
83+
sources: [
84+
{ icon: 'https://www.google.com/favicon.ico', title: 'Google', url: 'https://google.com' },
85+
{ icon: 'https://github.com/favicon.ico', title: 'GitHub', url: 'https://github.com' }
86+
]
87+
}
88+
], m, {
89+
title: global.header
90+
})
2791
}
2892
break
29-
case 'metafile': {
30-
await conn.metaSnippet(m.chat, {
31-
text: 'Example File getfile.js:',
32-
code: {
33-
file: './plugins/owner/getfile.js'
93+
94+
case 'metareels': {
95+
conn.metaSnippet(m.chat, [
96+
{ text: 'Random reels :' },
97+
{
98+
reels: [
99+
'https://i.pinimg.com/736x/c0/da/3c/c0da3c1c8127c678eba75ffe9bb101a5.jpg',
100+
'https://i.pinimg.com/736x/66/79/8d/66798d31a8e67fe58b23fae3d869b3d9.jpg',
101+
'https://i.pinimg.com/736x/bf/77/fa/bf77fab7a4cda45e0b70fc66875fc6fe.jpg',
102+
'https://i.pinimg.com/736x/e1/1b/f6/e11bf6fe1aa10ae3b633a0bcbb6c1bcc.jpg',
103+
'https://i.pinimg.com/736x/82/18/ed/8218ed2750542ecad90b71c412200a20.jpg'
104+
].map(image => ({
105+
creator: 'Moon Automatic',
106+
avatar: 'https://i.pinimg.com/736x/01/8d/14/018d14227c267f1c00dd99938e355569.jpg',
107+
verified: true,
108+
thumbnail: image,
109+
url: 'https://alyachan.dev',
110+
source: 'IG'
111+
}))
34112
}
35-
}, m)
113+
], m, {
114+
title: global.header
115+
})
116+
}
117+
break
118+
119+
case 'metaposts': {
120+
conn.metaSnippet(m.chat, [
121+
{ text: 'Social media posts :' },
122+
{
123+
posts: [{
124+
media: 'https://i.pinimg.com/736x/e1/2d/b0/e12db0eb7dba391aff0fa13a2feb7a3c.jpg',
125+
caption: 'Lorem ipsum dolor sit amet.',
126+
source: 'FACEBOOK'
127+
}, {
128+
media: 'https://i.pinimg.com/736x/95/1a/0f/951a0f9e25ac94599f5305bef4aecf47.jpg',
129+
caption: 'Lorem ipsum dolor sit amet.',
130+
source: 'THREADS'
131+
}, {
132+
media: 'https://i.pinimg.com/736x/c6/60/1c/c6601ce8d808999b5e3150919201dc0e.jpg',
133+
caption: 'Lorem ipsum dolor sit amet.',
134+
source: 'INSTAGRAM'
135+
}].map(v => ({
136+
username: 'Moon Automatic',
137+
avatar: 'https://i.pinimg.com/736x/01/8d/14/018d14227c267f1c00dd99938e355569.jpg',
138+
verified: true,
139+
caption: v.caption,
140+
url: 'https://alyachan.dev',
141+
thumbnail: v.media,
142+
source: v.source,
143+
post_type: 'PHOTO'
144+
}))
145+
}
146+
], m, {
147+
title: global.header
148+
})
149+
}
150+
break
151+
152+
case 'metaproduct': {
153+
conn.metaSnippet(m.chat, [
154+
{ text: 'Single product :' },
155+
{
156+
product: {
157+
title: 'Pygmy Goat',
158+
brand: 'Moon Automatic',
159+
price: 'Rp 50.000.000',
160+
sale_price: 'Rp 45.000.000',
161+
url: 'https://wa.me/' + env.owner,
162+
image: 'https://i.pinimg.com/736x/b3/f1/ac/b3f1ac8a91d2576b675347a17167cccc.jpg'
163+
}
164+
},
165+
{ text: '\n' },
166+
{ text: 'Multiple products (carousel) :' },
167+
{
168+
products: [
169+
{
170+
title: 'Hamster',
171+
price: 'Rp 50.000',
172+
sale_price: 'Rp 45.000',
173+
brand: 'Moon Automatic',
174+
url: 'https://wa.me/' + env.owner,
175+
image: 'https://i.pinimg.com/1200x/bf/05/08/bf0508b667569abbaad333932c3a410c.jpg'
176+
},
177+
{
178+
title: 'Love Bird',
179+
price: 'Rp 2.000.000',
180+
sale_price: 'Rp 1.900.000',
181+
brand: 'Moon Automatic',
182+
url: 'https://wa.me/' + env.owner,
183+
image: 'https://i.pinimg.com/736x/61/75/30/61753029a3114339b58e3ad25127a6c0.jpg'
184+
}
185+
]
186+
}
187+
], m, {
188+
title: global.header
189+
})
190+
}
191+
break
192+
193+
case 'metamedia': {
194+
conn.metaSnippet(m.chat, [
195+
{ image: setting.cover },
196+
{
197+
video: {
198+
url: 'https://cdn.ornzora.eu.cc/5c3e1109-38d3-408e-926c-588694fd9581-FIORA.mp4',
199+
mime_type: 'video/mp4'
200+
}
201+
}
202+
], m, {
203+
title: global.header
204+
})
205+
}
206+
break
207+
208+
case 'metamix': {
209+
conn.metaSnippet(m.chat, [
210+
{ header: 'Custom Header Title' },
211+
{ text: 'Text with [link](https://google.com) support dan [citations](https://openai.com).' },
212+
{ text: '\n' },
213+
{ code: 'console.log("hello world")', language: 'javascript' },
214+
{ text: '\n' },
215+
{
216+
table: {
217+
title: 'Sample Data',
218+
headers: ['Key', 'Value'],
219+
rows: [['name', 'Lily'], ['age', '12']]
220+
}
221+
},
222+
{ muted: 'Additional info here' },
223+
{ text: '\n' },
224+
{ suggestions: ['Yes', 'No', 'Maybe'] },
225+
{ text: '\n' },
226+
{ sources: [{ icon: 'https://github.com/favicon.ico', title: 'GitHub', url: 'https://github.com' }] },
227+
{ footer: global.footer }
228+
], m, {
229+
title: global.header
230+
})
36231
}
37232
break
38233
}

0 commit comments

Comments
 (0)