Hotfix autoInit
This commit is contained in:
		
							parent
							
								
									fedeef916c
								
							
						
					
					
						commit
						abaeb6d966
					
				
					 2 changed files with 7 additions and 9 deletions
				
			
		|  | @ -30,9 +30,7 @@ export class Base { | ||||||
|         return cached |         return cached | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     this.restFunc = endpoint.find(((v) => { |     this.restFunc = endpoint.find(v => v.name === init.endpoint) | ||||||
|       v.name === init.endpoint |  | ||||||
|     })) |  | ||||||
|     // TODO: Make error for this
 |     // TODO: Make error for this
 | ||||||
|     if(this.restFunc) { |     if(this.restFunc) { | ||||||
|       const resp = await fetch(this.restFunc(...init.restURLfuncArgs), { |       const resp = await fetch(this.restFunc(...init.restURLfuncArgs), { | ||||||
|  |  | ||||||
|  | @ -13,22 +13,22 @@ bot.connect(TOKEN, [GatewayIntents.GUILD_MEMBERS, GatewayIntents.GUILD_PRESENCES | ||||||
| const member = <Member> await Member.autoInit(bot, { | const member = <Member> await Member.autoInit(bot, { | ||||||
|   cacheName: 'member', |   cacheName: 'member', | ||||||
|   endpoint: 'GUILD_MEMBER', |   endpoint: 'GUILD_MEMBER', | ||||||
|   restURLfuncArgs: ['', ''] |   restURLfuncArgs: ['668753256419426314', '333432936390983680'] | ||||||
| }) | }) | ||||||
| console.log('getted (cached) ' + member.id) | console.log('getted (cached) ' + member.nick) | ||||||
| setInterval(async () => { | setInterval(async () => { | ||||||
|   //refreshed check
 |   //refreshed check
 | ||||||
|   console.log('refreshed check: ' + member.id) |   console.log('refreshed check: ' + member.nick) | ||||||
|   //cached
 |   //cached
 | ||||||
|   console.log('cache: '+(<Member> cache.get('member', '')).id) |   console.log('cache: '+(<Member> cache.get('member', '668753256419426314:333432936390983680')).nick) | ||||||
| }, 10000) | }, 10000) | ||||||
| 
 | 
 | ||||||
| setInterval(async() => { | setInterval(async() => { | ||||||
|   member.refresh(bot, { |   member.refresh(bot, { | ||||||
|     cacheName: 'member', |     cacheName: 'member', | ||||||
|     endpoint: 'GUILD_MEMBER', |     endpoint: 'GUILD_MEMBER', | ||||||
|     restURLfuncArgs: ['', ''] |     restURLfuncArgs: ['668753256419426314', '333432936390983680'] | ||||||
|   }) |   }) | ||||||
|   //refreshed
 |   //refreshed
 | ||||||
|   console.log('refreshed: ' + member.id) |   console.log('refreshed: ' + member.nick) | ||||||
| }, 20000) | }, 20000) | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue