@@ -96,7 +96,7 @@ public void execute(@NotNull SlashCommandInteractionEvent event) {
9696
9797 try {
9898 HelpAccount account = helpExperienceService .getOrCreateAccount (user .getIdLong ());
99- WebhookMessageCreateAction <Message > reply = event .getHook ().sendMessageEmbeds (buildHelpAccountEmbed (account , user , event .getGuild (), totalThanks , weekThanks ));
99+ WebhookMessageCreateAction <Message > reply = event .getHook ().sendMessageEmbeds (buildHelpAccountEmbed (account , user , event .getGuild (), totalThanks , weekThanks , upload ));
100100 if (upload !=null ) {
101101 reply .addFiles (upload );
102102 }
@@ -129,7 +129,7 @@ private FileUpload generatePlot(User user) {
129129 plotData .add (new Pair <>(position .getMonth () + " " + position .getYear (), value ));
130130 }
131131
132- BufferedImage plt = new Plotter (plotData ).plot ();
132+ BufferedImage plt = new Plotter (plotData , "gained help XP per month" ).plot ();
133133 try (ByteArrayOutputStream os = new ByteArrayOutputStream ()){
134134 ImageIO .write (plt , "png" , os );
135135 return FileUpload .fromData (os .toByteArray (), "image.png" );
@@ -139,16 +139,19 @@ private FileUpload generatePlot(User user) {
139139 return null ;
140140 }
141141
142- private @ NotNull MessageEmbed buildHelpAccountEmbed (HelpAccount account , @ NotNull User user , Guild guild , long totalThanks , long weekThanks ) {
143- return new EmbedBuilder ()
142+ private @ NotNull MessageEmbed buildHelpAccountEmbed (HelpAccount account , @ NotNull User user , Guild guild , long totalThanks , long weekThanks , FileUpload upload ) {
143+ EmbedBuilder eb = new EmbedBuilder ()
144144 .setAuthor (user .getAsTag (), null , user .getEffectiveAvatarUrl ())
145145 .setTitle ("Help Account" )
146146 .setThumbnail (user .getEffectiveAvatarUrl ())
147147 .setDescription ("Here are some statistics about how you've helped others here." )
148148 .addField ("Experience (BETA)" , formatExperience (guild , account ), false )
149149 .addField ("Total Times Thanked" , String .format ("**%s**" , totalThanks ), true )
150- .addField ("Times Thanked This Week" , String .format ("**%s**" , weekThanks ), true )
151- .build ();
150+ .addField ("Times Thanked This Week" , String .format ("**%s**" , weekThanks ), true );
151+ if (upload != null ) {
152+ eb .setImage ("attachment://" +upload .getName ());
153+ }
154+ return eb .build ();
152155 }
153156
154157 private @ NotNull String formatExperience (Guild guild , @ NotNull HelpAccount account ) {
0 commit comments