Merge branch 'main' of https://github.com/Helloyunho/harmony into reaction
This commit is contained in:
		
						commit
						4ab29bc91c
					
				
					 2 changed files with 30 additions and 13 deletions
				
			
		|  | @ -109,21 +109,37 @@ export class Message extends Base { | |||
|   } | ||||
| 
 | ||||
|   /** Edits this message. */ | ||||
|   async edit(text?: string, option?: MessageOption): Promise<Message> { | ||||
|   async edit( | ||||
|     content?: string | AllMessageOptions, | ||||
|     option?: AllMessageOptions | ||||
|   ): Promise<Message> { | ||||
|     if (typeof content === 'object') { | ||||
|       option = content | ||||
|       content = undefined | ||||
|     } | ||||
|     if (content === undefined && option === undefined) { | ||||
|       throw new Error('Either text or option is necessary.') | ||||
|     } | ||||
|     if (option instanceof Embed) { | ||||
|       option = { | ||||
|         embed: option | ||||
|       } | ||||
|     } | ||||
|     if ( | ||||
|       this.client.user !== undefined && | ||||
|       this.author.id !== this.client.user?.id | ||||
|     ) | ||||
|     ) { | ||||
|       throw new Error("Cannot edit other users' messages") | ||||
|     return this.channel.editMessage(this.id, text, option) | ||||
|     } | ||||
|     return this.channel.editMessage(this.id, content, option) | ||||
|   } | ||||
| 
 | ||||
|   /** Creates a Reply to this Message. */ | ||||
|   async reply( | ||||
|     text?: string | AllMessageOptions, | ||||
|     content?: string | AllMessageOptions, | ||||
|     option?: AllMessageOptions | ||||
|   ): Promise<Message> { | ||||
|     return this.channel.send(text, option, this) | ||||
|     return this.channel.send(content, option, this) | ||||
|   } | ||||
| 
 | ||||
|   /** Deletes the Message. */ | ||||
|  |  | |||
|  | @ -46,29 +46,30 @@ export class TextChannel extends Channel { | |||
| 
 | ||||
|   /** | ||||
|    * | ||||
|    * @param text Text content of the Message to send. | ||||
|    * @param content Text content of the Message to send. | ||||
|    * @param option Various other Message options. | ||||
|    * @param reply Reference to a Message object to reply-to. | ||||
|    */ | ||||
|   async send( | ||||
|     text?: string | AllMessageOptions, | ||||
|     content?: string | AllMessageOptions, | ||||
|     option?: AllMessageOptions, | ||||
|     reply?: Message | ||||
|   ): Promise<Message> { | ||||
|     if (typeof text === 'object') { | ||||
|       option = text | ||||
|       text = undefined | ||||
|     if (typeof content === 'object') { | ||||
|       option = content | ||||
|       content = undefined | ||||
|     } | ||||
|     if (text === undefined && option === undefined) { | ||||
|     if (content === undefined && option === undefined) { | ||||
|       throw new Error('Either text or option is necessary.') | ||||
|     } | ||||
|     if (option instanceof Embed) | ||||
|     if (option instanceof Embed) { | ||||
|       option = { | ||||
|         embed: option | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     const payload: any = { | ||||
|       content: text, | ||||
|       content: content, | ||||
|       embed: option?.embed, | ||||
|       file: option?.file, | ||||
|       tts: option?.tts, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue