|
1 | | -import { He4rtClient, TickerName } from '@/types' |
2 | | -import { ActivityType } from 'discord.js' |
3 | | -import { DISCORD_PRESENCE_IN_MINUTES, TICKER_SETTER } from '@/defines/values.json' |
4 | | - |
5 | | -export const setPresence = (client: He4rtClient) => { |
6 | | - const type = ActivityType.Watching as Exclude<ActivityType, ActivityType.Custom> |
7 | | - |
8 | | - const activities = [ |
9 | | - { |
10 | | - type, |
11 | | - url: 'https://heartdevs.com', |
12 | | - name: 'da comunidade para a comunidade.', |
13 | | - }, |
14 | | - { |
15 | | - type, |
16 | | - url: 'https://beacons.ai/heartdevs', |
17 | | - name: 'beacons.ai/heartdevs', |
18 | | - }, |
19 | | - { |
20 | | - type, |
21 | | - url: 'https://heartdevs.com', |
22 | | - name: 'heartdevs.com', |
23 | | - }, |
24 | | - { |
25 | | - type, |
26 | | - url: 'https://github.com/he4rt', |
27 | | - name: 'github.com/he4rt', |
28 | | - }, |
29 | | - { |
30 | | - type, |
31 | | - url: 'https://heartdevs.com', |
32 | | - name: '/apresentar', |
33 | | - }, |
34 | | - ] |
35 | | - const randomTimer = 60 * DISCORD_PRESENCE_IN_MINUTES |
36 | | - let randomCounterInSeconds = TICKER_SETTER |
37 | | - |
38 | | - client.ticker.add(TickerName.DiscordPresence, () => { |
39 | | - --randomCounterInSeconds |
40 | | - |
41 | | - if (randomCounterInSeconds <= 0) { |
42 | | - randomCounterInSeconds = randomTimer |
43 | | - |
44 | | - client.user.setPresence({ |
45 | | - status: 'online', |
46 | | - activities: [activities[Math.floor(Math.random() * activities.length)]], |
47 | | - }) |
48 | | - } |
49 | | - }) |
50 | | -} |
| 1 | +import { He4rtClient, TickerName } from '@/types' |
| 2 | +import { ActivityType } from 'discord.js' |
| 3 | +import { DISCORD_PRESENCE_IN_MINUTES, TICKER_SETTER } from '@/defines/values.json' |
| 4 | + |
| 5 | +export const setPresence = async (client: He4rtClient) => { |
| 6 | + const type = ActivityType.Watching as Exclude<ActivityType, ActivityType.Custom> |
| 7 | + |
| 8 | + const activities = [ |
| 9 | + { |
| 10 | + type, |
| 11 | + url: 'https://heartdevs.com', |
| 12 | + name: 'da comunidade para a comunidade.', |
| 13 | + }, |
| 14 | + { |
| 15 | + type, |
| 16 | + url: 'https://beacons.ai/heartdevs', |
| 17 | + name: 'beacons.ai/heartdevs', |
| 18 | + }, |
| 19 | + { |
| 20 | + type, |
| 21 | + url: 'https://heartdevs.com', |
| 22 | + name: 'heartdevs.com', |
| 23 | + }, |
| 24 | + { |
| 25 | + type, |
| 26 | + url: 'https://github.com/he4rt', |
| 27 | + name: 'github.com/he4rt', |
| 28 | + }, |
| 29 | + { |
| 30 | + type, |
| 31 | + url: 'https://heartdevs.com', |
| 32 | + name: '/apresentar', |
| 33 | + }, |
| 34 | + ] |
| 35 | + const randomTimer = 60 * DISCORD_PRESENCE_IN_MINUTES |
| 36 | + let randomCounterInSeconds = TICKER_SETTER |
| 37 | + |
| 38 | + client.ticker.add(TickerName.DiscordPresence, () => { |
| 39 | + --randomCounterInSeconds |
| 40 | + |
| 41 | + if (randomCounterInSeconds <= 0) { |
| 42 | + randomCounterInSeconds = randomTimer |
| 43 | + |
| 44 | + client.user.setPresence({ |
| 45 | + status: 'online', |
| 46 | + activities: [activities[Math.floor(Math.random() * activities.length)]], |
| 47 | + }) |
| 48 | + } |
| 49 | + }) |
| 50 | +} |
0 commit comments