QOL Mention Response

This commit is contained in:
unknown 2022-03-28 09:54:55 -07:00
parent decac57347
commit 23b9b18faf

View file

@ -10,12 +10,14 @@ import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.events.user.update.GenericUserPresenceEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Timer;
import java.util.TimerTask;
@ -49,6 +51,22 @@ public class MainListener extends ListenerAdapter {
" Guilds Active: " + event.getGuildAvailableCount() + " Guilds Unavailable: " + event.getGuildUnavailableCount());
}
/**
* Quick Response for if someone pings me.
*/
public void onMessageReceived(MessageReceivedEvent event) {
if(event.getMessage().getMentionedUsers().contains(Kiafumi.JDA.getSelfUser())) {
EmbedBuilder eb = new EmbedBuilder()
.setColor(Color.PINK)
.setImage(Kiafumi.JDA.getSelfUser().getAvatarUrl())
.setTitle("Hi, i'm Kiafumi!")
.setDescription("I was born on October 6th 2017! My goal is to explore the metaverse and help people in it!")
.setTimestamp(ZonedDateTime.now())
.setFooter("Kiafumi - Maintained by oko.moe");
event.getChannel().sendMessageEmbeds(eb.build()).queue();
}
}
/**
* Game Prevention, is a global mechanic :^)
* @param event - GenericUserPresenceEvent event to be used.