1 parent ebc5e6d commit aaebde2Copy full SHA for aaebde2
1 file changed
examples/simple-bot.ts
@@ -1,5 +1,12 @@
1
import { Client } from '../src/index.js'
2
3
+const OWNER = (process.env['OWNER'] ?? '').replace(/\D/g, '')
4
+if (!OWNER) {
5
+ console.error('Set OWNER (nomor kamu), e.g. OWNER=6285xxxx bun run examples/simple-bot.ts')
6
+ process.exit(1)
7
+}
8
+const digitsOf = (jid: string): string => (jid.split(/[:@]/)[0] ?? '').replace(/\D/g, '')
9
+
10
const client = new Client()
11
12
client.on('qr', ({ qrString }) => {
@@ -11,7 +18,7 @@ client.on('connect', ({ me }) => {
18
})
19
13
20
client.on('text', async (message) => {
14
- if (message.isFromMe) return
21
+ if (digitsOf(message.senderId) !== OWNER) return
15
22
16
23
await message.react('👀')
17
24
0 commit comments