-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
33 lines (25 loc) · 1 KB
/
index.ts
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
import Client from 'nina';
import type { iMessageCreate } from "nina/interface/iMessageCreate"
import MessageCreate from './src/events/MessageCreate';
import type { iFriend } from 'nina/interface/iFriendList';
import NinaError from 'nina/exceptions/NinaError';
const client = new Client({
prefix: '!'
});
client.on('friendList', async (friend: iFriend) => {
try {
if (friend.receiveFriends.length == 0) return;
for (const { friendUserCode } of friend.receiveFriends) {
await friend.accept(friendUserCode)
client.send({ userCode: friendUserCode, content: 'Olá! Eu me chamo Nina e sou um Chat Bot do ERBS. \nCaso queira usar meus comandos digite: !comandos' })
}
} catch (err: unknown) {
if (err instanceof NinaError) {
console.error(`${err.name}: ${err.message}`)
return
}
console.error(err)
}
})
client.on('messageCreate', (message: iMessageCreate) => new MessageCreate(client, message))
client.login();