ci: add Emoji#id check
This commit is contained in:
		
							parent
							
								
									73e9ba9a25
								
							
						
					
					
						commit
						a69988b653
					
				
					 2 changed files with 7 additions and 5 deletions
				
			
		|  | @ -7,8 +7,8 @@ import { Role } from './role.ts' | |||
| import { User } from './user.ts' | ||||
| 
 | ||||
| export class Emoji extends Base { | ||||
|   id: string | ||||
|   name: string | ||||
|   id: string | null | ||||
|   name: string | null | ||||
|   roles?: string[] | ||||
|   user?: User | ||||
|   guild?: Guild | ||||
|  | @ -41,8 +41,9 @@ 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. */ | ||||
|   async edit(data: ModifyGuildEmojiParams): Promise<Emoji> { | ||||
|     if (this.id === null) throw new Error("Emoji ID is not valid."); | ||||
|     if (this.guild === undefined) throw new Error('Guild is undefined') | ||||
|     const res = await this.client.rest.patch(EMOJI(this.guild.id, this.id), { | ||||
|     const res = await this.client.rest.patch(EMOJI(this.guild.id, this.id!), { | ||||
|       ...data, | ||||
|       roles: data.roles?.map((role) => role.id) | ||||
|     }) | ||||
|  | @ -51,6 +52,7 @@ export class Emoji extends Base { | |||
| 
 | ||||
|   /** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns `true` on success. Fires a Guild Emojis Update Gateway event. */ | ||||
|   async delete(): Promise<boolean> { | ||||
|     if (this.id === null) return false; | ||||
|     if (this.guild === undefined) return false | ||||
|     await this.client.rest.delete(EMOJI(this.guild.id, this.id)) | ||||
|     return true | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { UserPayload } from './user.ts' | ||||
| 
 | ||||
| export interface EmojiPayload { | ||||
|   id: string | ||||
|   name: string | ||||
|   id: string | null | ||||
|   name: string | null | ||||
|   roles?: string[] | ||||
|   user?: UserPayload | ||||
|   require_colons?: boolean | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue