Merge remote-tracking branch 'origin/main' into slash
merge main
This commit is contained in:
		
						commit
						3f436b2b3f
					
				
					 4 changed files with 29 additions and 43 deletions
				
			
		
							
								
								
									
										2
									
								
								LICENSE
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
										
									
									
									
								
							|  | @ -1,6 +1,6 @@ | |||
| MIT License | ||||
| 
 | ||||
| Copyright (c) 2020 Harmony Org | ||||
| Copyright (c) 2020-21 Harmony Org | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
|  |  | |||
|  | @ -159,6 +159,6 @@ Small note: If editing the README, please conform to the [standard-readme](https | |||
| 
 | ||||
| ## License | ||||
| 
 | ||||
| [MIT © 2020 Harmony Org](LICENSE) | ||||
| [MIT © 2020-21 Harmony Org](LICENSE) | ||||
| 
 | ||||
| #### Made with ❤ by Harmony-org | ||||
|  |  | |||
|  | @ -168,8 +168,9 @@ export class Guild extends Base { | |||
|   constructor(client: Client, data: GuildPayload) { | ||||
|     super(client, data) | ||||
|     this.id = data.id | ||||
|     this.bans = new GuildBans(client, this) | ||||
|     this.unavailable = data.unavailable | ||||
|     this.readFromData(data) | ||||
|     this.bans = new GuildBans(client, this) | ||||
|     this.members = new MembersManager(this.client, this) | ||||
|     this.voiceStates = new GuildVoiceStatesManager(client, this) | ||||
|     this.presences = new GuildPresencesManager(client, this) | ||||
|  | @ -181,45 +182,6 @@ export class Guild extends Base { | |||
|     this.roles = new RolesManager(this.client, this) | ||||
|     this.emojis = new GuildEmojisManager(this.client, this.client.emojis, this) | ||||
|     this.invites = new InviteManager(this.client, this) | ||||
| 
 | ||||
|     if (!this.unavailable) { | ||||
|       this.name = data.name | ||||
|       this.icon = data.icon | ||||
|       this.iconHash = data.icon_hash | ||||
|       this.splash = data.splash | ||||
|       this.discoverySplash = data.discovery_splash | ||||
|       this.owner = data.owner | ||||
|       this.ownerID = data.owner_id | ||||
|       this.permissions = data.permissions | ||||
|       this.region = data.region | ||||
|       this.afkTimeout = data.afk_timeout | ||||
|       this.afkChannelID = data.afk_channel_id | ||||
|       this.widgetEnabled = data.widget_enabled | ||||
|       this.widgetChannelID = data.widget_channel_id | ||||
|       this.verificationLevel = data.verification_level | ||||
|       this.defaultMessageNotifications = data.default_message_notifications | ||||
|       this.explicitContentFilter = data.explicit_content_filter | ||||
|       this.features = data.features | ||||
|       this.mfaLevel = data.mfa_level | ||||
|       this.systemChannelID = data.system_channel_id | ||||
|       this.systemChannelFlags = data.system_channel_flags | ||||
|       this.rulesChannelID = data.rules_channel_id | ||||
|       this.joinedAt = data.joined_at | ||||
|       this.large = data.large | ||||
|       this.memberCount = data.member_count | ||||
|       this.maxPresences = data.max_presences | ||||
|       this.maxMembers = data.max_members | ||||
|       this.vanityURLCode = data.vanity_url_code | ||||
|       this.description = data.description | ||||
|       this.banner = data.banner | ||||
|       this.premiumTier = data.premium_tier | ||||
|       this.premiumSubscriptionCount = data.premium_subscription_count | ||||
|       this.preferredLocale = data.preferred_locale | ||||
|       this.publicUpdatesChannelID = data.public_updates_channel_id | ||||
|       this.maxVideoChannelUsers = data.max_video_channel_users | ||||
|       this.approximateNumberCount = data.approximate_number_count | ||||
|       this.approximatePresenceCount = data.approximate_presence_count | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   readFromData(data: GuildPayload): void { | ||||
|  | @ -343,6 +305,27 @@ export class Guild extends Base { | |||
|       } | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * Fulfills promise when guild becomes available | ||||
|    * @param timeout Configurable timeout to cancel the wait to safely remove listener. | ||||
|    */ | ||||
|   async awaitAvailability(timeout: number = 1000): Promise<Guild> { | ||||
|     return await new Promise((resolve, reject) => { | ||||
|       if(!this.unavailable) resolve(this); | ||||
|       const listener = (guild: Guild): void => { | ||||
|         if (guild.id === this.id) { | ||||
|           this.client.removeListener('guildLoaded', listener); | ||||
|           resolve(this); | ||||
|         } | ||||
|       }; | ||||
|       this.client.on('guildLoaded', listener); | ||||
|       setTimeout(() => { | ||||
|         this.client.removeListener('guildLoaded', listener); | ||||
|         reject(Error("Timeout. Guild didn't arrive in time.")); | ||||
|       }, timeout); | ||||
|     }); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export class GuildIntegration extends Base { | ||||
|  |  | |||
|  | @ -32,7 +32,10 @@ export interface InteractionPayload { | |||
|   /** Token of the Interaction to respond */ | ||||
|   token: string | ||||
|   /** Member object of user who invoked */ | ||||
|   member: MemberPayload | ||||
|   member: MemberPayload & { | ||||
|     /** Total permissions of the member in the channel, including overrides */ | ||||
|     permissions: string | ||||
|   } | ||||
|   /** ID of the Interaction */ | ||||
|   id: string | ||||
|   /** | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue