Make messages prettier
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-11-20 05:43:17 +01:00
parent 7d9c820243
commit 96953bddcb

View File

@ -59,7 +59,7 @@ public class SlashCommandListener extends ListenerAdapter
} }
else { else {
// answer by saying that the operation has begun. // answer by saying that the operation has begun.
InteractionHook replyInteraction = event.reply("Clearing...").complete(); InteractionHook replyInteraction = event.reply("\uD83D\uDEA7 Clearing...").complete();
// int to keep track of how many messages we deleted. // int to keep track of how many messages we deleted.
int deleted = 0; int deleted = 0;
@ -146,8 +146,8 @@ public class SlashCommandListener extends ListenerAdapter
a less efficient way that triggers rate-limiting very quickly. */ a less efficient way that triggers rate-limiting very quickly. */
} catch (Exception e) } catch (Exception e)
{ {
replyInteraction.editOriginal("Sorry, it seems like there was an issue! " + e.getMessage()).queue(); replyInteraction.editOriginal("\uD83D\uDE22 Sorry, it seems like there was an issue! " + e.getMessage()).queue();
return; return; // warning: this quits everything.
} }
} }
@ -159,24 +159,15 @@ public class SlashCommandListener extends ListenerAdapter
// log having deleted the messages. // log having deleted the messages.
if(deleted < 1) if(deleted < 1)
{ {
replyInteraction.editOriginal("Couldn't clear any message!").queue(); replyInteraction.editOriginal("\uD83D\uDE22 Couldn't clear any message!").queue();
} else if(deleted == 1) } else if(deleted == 1)
{ {
replyInteraction.editOriginal("Cleared 1 message!").queue(); replyInteraction.editOriginal("Cleared 1 message!").queue();
} else { } else {
replyInteraction.editOriginal("Cleared " + deleted + " messages!").queue(); replyInteraction.editOriginal("Cleared " + deleted + " messages!").queue();
} }
} }
/*MessageHistory.MessageRetrieveAction action = channel.getHistoryBefore(event.getInteraction().getIdLong(), toDeleteAmount);
List<Message> messages = action.complete().getRetrievedHistory();
//more than 2 messages, less than 100 for this method
((TextChannel) channel).deleteMessages(messages).queue();
// announce having cleared the messages.
replyInteraction.editOriginal("Cleared " + toDeleteAmount + " messages!").queue();*/
} }
} }