2020-10-22 15:50:47 +00:00
|
|
|
import { Client } from '../models/client.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
import { Guild } from '../structures/guild.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
import { GatewayIntents } from '../types/gatewayTypes.ts'
|
2020-10-22 15:55:42 +00:00
|
|
|
import { TOKEN } from './config.ts'
|
2020-10-25 06:50:32 +00:00
|
|
|
import * as cache from '../models/cache.ts'
|
2020-10-25 08:02:24 +00:00
|
|
|
import { Member } from '../structures/member.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
|
|
|
|
const bot = new Client()
|
|
|
|
|
2020-10-25 06:50:32 +00:00
|
|
|
bot.connect(TOKEN, [GatewayIntents.GUILD_MEMBERS, GatewayIntents.GUILD_PRESENCES, GatewayIntents.GUILD_MESSAGES])
|
2020-10-23 16:11:00 +00:00
|
|
|
|
|
|
|
|
2020-10-25 06:50:32 +00:00
|
|
|
const member = <Member> await Member.autoInit(bot, {
|
|
|
|
cacheName: 'member',
|
|
|
|
endpoint: 'GUILD_MEMBER',
|
2020-10-25 08:20:11 +00:00
|
|
|
restURLfuncArgs: ['', '']
|
2020-10-25 06:50:32 +00:00
|
|
|
})
|
2020-10-25 08:18:32 +00:00
|
|
|
console.log('getted (cached) ' + member.nick)
|
2020-10-25 06:50:32 +00:00
|
|
|
setInterval(async () => {
|
|
|
|
//refreshed check
|
2020-10-25 08:18:32 +00:00
|
|
|
console.log('refreshed check: ' + member.nick)
|
2020-10-25 06:50:32 +00:00
|
|
|
//cached
|
2020-10-25 08:20:11 +00:00
|
|
|
console.log('cache: '+(<Member> cache.get('member', '')).nick)
|
2020-10-25 06:50:32 +00:00
|
|
|
}, 10000)
|
|
|
|
|
|
|
|
setInterval(async() => {
|
|
|
|
member.refresh(bot, {
|
|
|
|
cacheName: 'member',
|
|
|
|
endpoint: 'GUILD_MEMBER',
|
2020-10-25 08:20:11 +00:00
|
|
|
restURLfuncArgs: ['', '']
|
2020-10-25 00:15:33 +00:00
|
|
|
})
|
2020-10-25 06:50:32 +00:00
|
|
|
//refreshed
|
2020-10-25 08:18:32 +00:00
|
|
|
console.log('refreshed: ' + member.nick)
|
2020-10-25 06:50:32 +00:00
|
|
|
}, 20000)
|