File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1- import { MessageEmbed , MessageEmbedOptions } from 'discord.js' ;
1+ import { MessageAttachment , MessageEmbed , MessageEmbedOptions } from 'discord.js' ;
2+ import path from 'path' ;
23
34type AnyObject = { [ k : string ] : any } ;
45
@@ -153,6 +154,18 @@ export class BetterEmbed extends MessageEmbed {
153154 }
154155 }
155156
157+ public setImageFromFile ( link : string ) {
158+ const attachment = new MessageAttachment ( link , path . basename ( link ) ) ;
159+ this . attachFiles ( [ attachment ] ) ;
160+ this . setImage ( `attachment://${ attachment . name } ` ) ;
161+ }
162+
163+ public setThumbnailFromFile ( link : string ) {
164+ const attachment = new MessageAttachment ( link , path . basename ( link ) ) ;
165+ this . attachFiles ( [ attachment ] ) ;
166+ this . setThumbnail ( `attachment://${ attachment . name } ` ) ;
167+ }
168+
156169 public throwIfTooLong ( field : keyof Template ) : void ;
157170 public throwIfTooLong ( field ?: keyof Template ) {
158171 if ( field ) {
You can’t perform that action at this time.
0 commit comments