Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageType;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
Expand Down Expand Up @@ -549,6 +550,12 @@ public CommandResult execute(Message message, Arguments args) {
private void useTrick(Trick trick, Message message, MessageChannel channel, long guildID, Arguments args) {
MessageSettings dMessage = plugin.getMessageSettings();
var type = trick.getType();
var replyTarget = message.getMessageReference() == null ? null : message.getMessageReference().getMessage();
boolean shouldPing = false;
if (replyTarget != null && replyTarget.getMember() != null) {
shouldPing = replyTarget.getMember().getRoles()
.stream().noneMatch((role) -> role.isHoisted() ^ role.getName().equals("Patreons"));
}
if (type == TrickType.NORMAL) {
dMessage.withButton(
dMessage.apply(channel.sendMessage(trick.getContent()))
Expand All @@ -561,7 +568,7 @@ private void useTrick(Trick trick, Message message, MessageChannel channel, long
return true;
})
.toList()
).queue();
).setMessageReference(replyTarget).mentionRepliedUser(shouldPing).queue();
trick.use();
save(trick);
} else if (type == TrickType.ALIAS) {
Expand Down