mirror of
https://github.com/FoxxMD/context-mod.git
synced 2026-04-19 03:00:07 -04:00
fix: Check bot entity exists before getting invites
This commit is contained in:
@@ -1337,11 +1337,19 @@ class Bot implements BotInstanceFunctions {
|
||||
}
|
||||
|
||||
getSubredditInvites(): SubredditInviteDataPersisted[] {
|
||||
return this.botEntity.getSubredditInvites().map(x => x.toSubredditInviteData());
|
||||
if(this.botEntity !== undefined) {
|
||||
return this.botEntity.getSubredditInvites().map(x => x.toSubredditInviteData());
|
||||
}
|
||||
this.logger.warn('No bot entity found');
|
||||
return [];
|
||||
}
|
||||
|
||||
getInvite(id: string): SubredditInvite | undefined {
|
||||
return this.botEntity.getSubredditInvites().find(x => x.id === id);
|
||||
if(this.botEntity !== undefined) {
|
||||
return this.botEntity.getSubredditInvites().find(x => x.id === id);
|
||||
}
|
||||
this.logger.warn('No bot entity found');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getOnboardingReadiness(invite: SubredditInvite): SubredditOnboardingReadiness {
|
||||
|
||||
Reference in New Issue
Block a user