|
5 | 5 | import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; |
6 | 6 | import net.dv8tion.jda.api.events.guild.invite.GuildInviteCreateEvent; |
7 | 7 | import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent; |
| 8 | +import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent; |
8 | 9 | import net.dv8tion.jda.api.hooks.ListenerAdapter; |
9 | 10 | import org.jetbrains.annotations.NotNull; |
10 | 11 |
|
@@ -34,15 +35,35 @@ public InviteListener(SupportBot bot) { |
34 | 35 | } |
35 | 36 | } |
36 | 37 |
|
| 38 | + @Override |
| 39 | + public void onGuildMemberRemove(GuildMemberRemoveEvent e) { |
| 40 | + String mention = "<@"+e.getUser().getId()+">"; |
| 41 | + bot.getLogger().debug(e.getUser().getAsTag()+" left!"); |
| 42 | + TextChannel welcomeChannel = bot.getJDA().getTextChannelById(698756204801032202L); |
| 43 | + if(welcomeChannel == null) { |
| 44 | + bot.getLogger().error("Cannot find welcome channel for aj's plugins! Cannot send leave message"); |
| 45 | + } else { |
| 46 | + welcomeChannel.sendMessage( mention + " left.").queue(); |
| 47 | + } |
| 48 | + } |
| 49 | + |
37 | 50 | @Override |
38 | 51 | public void onGuildMemberJoin(@NotNull GuildMemberJoinEvent e) { |
| 52 | + String mention = "<@"+e.getUser().getId()+">"; |
| 53 | + bot.getLogger().debug(e.getUser().getAsTag()+" joined!"); |
| 54 | + |
| 55 | + TextChannel welcomeChannel = bot.getJDA().getTextChannelById(698756204801032202L); |
| 56 | + if(welcomeChannel == null) { |
| 57 | + bot.getLogger().error("Cannot find welcome channel for aj's plugins! Cannot send join message"); |
| 58 | + } else { |
| 59 | + welcomeChannel.sendMessage("Hey " + mention + ", welcome to the discord server for aj's Plugins! If you are here for support, make sure to read <#1064604482752762076>!").queue(); |
| 60 | + } |
| 61 | + |
39 | 62 | TextChannel channel = bot.getJDA().getTextChannelById(698756204801032202L); |
40 | 63 | if(channel == null) { |
41 | 64 | bot.getLogger().error("Cannot find logger-log channel for aj's plugins!"); |
42 | 65 | return; |
43 | 66 | } |
44 | | - String mention = "<@"+e.getUser().getId()+">"; |
45 | | - bot.getLogger().debug(e.getUser().getAsTag()+" joined!"); |
46 | 67 | try { |
47 | 68 | Thread.sleep(100); |
48 | 69 | Map<String, Integer> newUses = getInviteCounts(e.getGuild()); |
|
0 commit comments