fix: add Emoji#guild property back
This commit is contained in:
		
							parent
							
								
									c59d8f1639
								
							
						
					
					
						commit
						6c6334ee07
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -2,6 +2,7 @@ import { Client } from '../models/client.ts' | ||||||
| import { EmojiPayload } from '../types/emoji.ts' | import { EmojiPayload } from '../types/emoji.ts' | ||||||
| import { EMOJI } from '../types/endpoint.ts' | import { EMOJI } from '../types/endpoint.ts' | ||||||
| import { Base } from './base.ts' | import { Base } from './base.ts' | ||||||
|  | import { Guild } from "./guild.ts" | ||||||
| import { User } from './user.ts' | import { User } from './user.ts' | ||||||
| 
 | 
 | ||||||
| export class Emoji extends Base { | export class Emoji extends Base { | ||||||
|  | @ -9,6 +10,7 @@ export class Emoji extends Base { | ||||||
|   name: string |   name: string | ||||||
|   roles?: string[] |   roles?: string[] | ||||||
|   user?: User |   user?: User | ||||||
|  |   guild?: Guild; | ||||||
|   requireColons?: boolean |   requireColons?: boolean | ||||||
|   managed?: boolean |   managed?: boolean | ||||||
|   animated?: boolean |   animated?: boolean | ||||||
|  | @ -37,14 +39,16 @@ export class Emoji extends Base { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /** Modify the given emoji. Requires the MANAGE_EMOJIS permission. Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event. */ |   /** Modify the given emoji. Requires the MANAGE_EMOJIS permission. Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event. */ | ||||||
|   async edit(guildID: string, data: ModifyGuildEmojiParams) { |   async edit(data: ModifyGuildEmojiParams) { | ||||||
|     const res = await this.client.rest.patch(EMOJI(guildID, this.id!)) |     if (!this.guild) throw new Error("Guild is undefined"); | ||||||
|  |     const res = await this.client.rest.patch(EMOJI(this.guild.id, this.id!), data) | ||||||
|     return new Emoji(this.client, res) |     return new Emoji(this.client, res) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns `true` on success. Fires a Guild Emojis Update Gateway event. */ |   /** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns `true` on success. Fires a Guild Emojis Update Gateway event. */ | ||||||
|   async delete(guildID: string): Promise<boolean> { |   async delete(): Promise<boolean> { | ||||||
|     await this.client.rest.patch(EMOJI(guildID, this.id!)) |     if (!this.guild) throw new Error("Guild is undefined"); | ||||||
|  |     await this.client.rest.patch(EMOJI(this.guild.id, this.id!)) | ||||||
|     return true |     return true | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue