Hotfix autoInit

This commit is contained in:
yky4589 2020-10-25 17:18:32 +09:00
parent fedeef916c
commit abaeb6d966
2 changed files with 7 additions and 9 deletions

View File

@ -30,9 +30,7 @@ export class Base {
return cached
}
}
this.restFunc = endpoint.find(((v) => {
v.name === init.endpoint
}))
this.restFunc = endpoint.find(v => v.name === init.endpoint)
// TODO: Make error for this
if(this.restFunc) {
const resp = await fetch(this.restFunc(...init.restURLfuncArgs), {

View File

@ -13,22 +13,22 @@ bot.connect(TOKEN, [GatewayIntents.GUILD_MEMBERS, GatewayIntents.GUILD_PRESENCES
const member = <Member> await Member.autoInit(bot, {
cacheName: 'member',
endpoint: 'GUILD_MEMBER',
restURLfuncArgs: ['', '']
restURLfuncArgs: ['668753256419426314', '333432936390983680']
})
console.log('getted (cached) ' + member.id)
console.log('getted (cached) ' + member.nick)
setInterval(async () => {
//refreshed check
console.log('refreshed check: ' + member.id)
console.log('refreshed check: ' + member.nick)
//cached
console.log('cache: '+(<Member> cache.get('member', '')).id)
console.log('cache: '+(<Member> cache.get('member', '668753256419426314:333432936390983680')).nick)
}, 10000)
setInterval(async() => {
member.refresh(bot, {
cacheName: 'member',
endpoint: 'GUILD_MEMBER',
restURLfuncArgs: ['', '']
restURLfuncArgs: ['668753256419426314', '333432936390983680']
})
//refreshed
console.log('refreshed: ' + member.id)
console.log('refreshed: ' + member.nick)
}, 20000)