/*
 * MIT License
 *
 * Copyright (c) Copyright (c) 2017-2017, Greatmancode
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.greatmancode.legendarybot.plugin.botgeneral;

import net.dv8tion.jda.core.MessageBuilder;
import net.dv8tion.jda.core.events.guild.GuildJoinEvent;
import net.dv8tion.jda.core.events.guild.GuildLeaveEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;

/**
 * Event listener for general bot things. Currently announce how to configure on join and log join/leave in the bot's discord server.
 */
public class MessageListener extends ListenerAdapter {

    @Override
    public void onGuildJoin(GuildJoinEvent event) {
        MessageBuilder builder = new MessageBuilder();
        builder.append("Hello! I am LegendaryBot, a World of Warcraft Bot! To see all my commands. Type !help. The bot need some basic configuration to work properly. Please use the following commands:\n\n");
        builder.append("Your Battle.net region: `!setserversetting WOW_REGION_NAME US/EU`\n\n");
        builder.append("Your Server Name (In Slug format, so remove all special characters and spaces are replaced with \"-\" (hyphen)) `!setserversetting WOW_SERVER_NAME Arthas`\n\n");
        builder.append("Your Guild Name, spaces are supported without \"\": `!setserversetting GUILD_NAME YourGuildName`\n\n");
        builder.append("That is all you need for the bot to run properly! If you have any questions, feel free to see the documentation here: https://github.com/greatman/legendarybot");
        event.getGuild().getPublicChannel().sendMessage(builder.build()).queue();


        //We log the event
        event.getJDA().getGuildsByName("LegendaryBot",false).get(0).getTextChannelsByName("logs-guild",true).get(0).sendMessage(":robot: Joined guild " + event.getGuild().getName() + ". Members: " + event.getGuild().getMembers().size()).queue();
    }

    @Override
    public void onGuildLeave(GuildLeaveEvent event) {
        //We log the event
        event.getJDA().getGuildsByName("LegendaryBot",false).get(0).getTextChannelsByName("logs-guild",true).get(0).sendMessage(":broken_heart: Left guild " + event.getGuild().getName() + ".").queue();
    }

}

@@ -1211,52 +1211,8 @@
 l;%0A%0A
-import net.dv8tion.jda.core.MessageBuilder;%0A
 impo
@@ -1260,24 +1260,24 @@
 dJoinEvent;%0A
+
 import net.d
@@ -1572,16 +1572,17 @@
 pter %7B%0A%0A
+%0A
     @Ove
@@ -1579,32 +1579,32 @@
 %0A%0A    @Override%0A
+
     public void 
@@ -1643,952 +1643,8 @@
 ) %7B%0A
-        MessageBuilder builder = new MessageBuilder();%0A        builder.append(%22Hello! I am LegendaryBot, a World of Warcraft Bot! To see all my commands. Type !help. The bot need some basic configuration to work properly. Please use the following commands:%5Cn%5Cn%22);%0A        builder.append(%22Your Battle.net region: %60!setserversetting WOW_REGION_NAME US/EU%60%5Cn%5Cn%22);%0A        builder.append(%22Your Server Name (In Slug format, so remove all special characters and spaces are replaced with %5C%22-%5C%22 (hyphen)) %60!setserversetting WOW_SERVER_NAME Arthas%60%5Cn%5Cn%22);%0A        builder.append(%22Your Guild Name, spaces are supported without %5C%22%5C%22: %60!setserversetting GUILD_NAME YourGuildName%60%5Cn%5Cn%22);%0A        builder.append(%22That is all you need for the bot to run properly! If you have any questions, feel free to see the documentation here: https://github.com/greatman/legendarybot%22);%0A        event.getGuild().getPublicChannel().sendMessage(builder.build()).queue();%0A%0A
 %0A   

Remove spammy message.