Search in sources :

Example 1 with Message

use of net.dv8tion.jda.core.entities.Message in project MOOTBoot by LeshDev.

the class serverInfo method onMessageReceived.

public void onMessageReceived(MessageReceivedEvent e) {
    Message msg = e.getMessage();
    EmbedBuilder eB = new EmbedBuilder();
    if (!msg.getRawContent().startsWith("-server") || bannedList.black.contains(e.getAuthor().getIdLong()) || e.getAuthor().isBot()) {
        return;
    }
    eB.setAuthor("Server Infos", null, lib.bot_image);
    eB.addField("**Owner**", "" + e.getGuild().getOwner().getEffectiveName(), true);
    eB.addField("**Name**", "" + e.getGuild().getName(), true);
    eB.addField("**Region**", e.getGuild().getRegion().getName(), true);
    eB.setThumbnail(e.getGuild().getIconUrl());
    eB.setColor(java.awt.Color.RED);
    e.getChannel().sendMessage(eB.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Message(net.dv8tion.jda.core.entities.Message)

Example 2 with Message

use of net.dv8tion.jda.core.entities.Message in project MOOTBoot by LeshDev.

the class pingPongGame method onMessageReceived.

public void onMessageReceived(MessageReceivedEvent e) {
    Message msg = e.getMessage();
    if (!msg.getRawContent().startsWith("-pingGame") || bannedList.black.contains(e.getAuthor().getIdLong())) {
        return;
    }
    if (!e.equals(e.getJDA().getSelfUser())) {
        return;
    }
    e.getChannel().sendMessage("Pong").queue();
    if (!msg.getRawContent().startsWith("ping") || bannedList.black.contains(e.getAuthor().getIdLong()) || !e.equals(e.getJDA().getSelfUser())) {
        e.getChannel().sendMessage("F*ck YEAH !!! Bot wins").queue();
    }
    e.getChannel().sendMessage("Ping").queue();
    if (!msg.getRawContent().startsWith("ping") || bannedList.black.contains(e.getAuthor().getIdLong()) || !e.equals(e.getJDA().getSelfUser())) {
        e.getChannel().sendMessage("F*ck YEAH !!! Bot wins").queue();
    }
    e.getChannel().sendMessage("Pong").queue();
    if (!msg.getRawContent().startsWith("pong") || bannedList.black.contains(e.getAuthor().getIdLong()) || !e.equals(e.getJDA().getSelfUser())) {
        e.getChannel().sendMessage("F*ck YEAH !!! Bot wins").queue();
    }
    e.getChannel().sendMessage(e.getAuthor().getAsMention() + " has won :(").queue();
}
Also used : Message(net.dv8tion.jda.core.entities.Message)

Example 3 with Message

use of net.dv8tion.jda.core.entities.Message in project MOOTBoot by LeshDev.

the class botHelp method onMessageReceived.

public void onMessageReceived(MessageReceivedEvent e) {
    Message msg = e.getMessage();
    if (!msg.getRawContent().startsWith("-help") || bannedList.black.contains(e.getAuthor().getIdLong()) || e.getAuthor().isBot()) {
        return;
    }
    EmbedBuilder eB = new EmbedBuilder();
    eB.setAuthor("Help Menu for " + lib.bot_name, null, lib.bot_image);
    eB.addField("**Bot Info**", "-info > Gives infos about the bot", true);
    eB.addField("**User Info**", "-user <@User> > Gives infos about the user", true);
    eB.addField("**Change Game**", "-game <String> > Change the 'Playing' status", true);
    eB.addField("**Server Info**", "-server > Gives infos about the server", true);
    eB.addField("**Ideen**", "-ideen / -ideen add > Shows Ideas list / Add new ideas", true);
    eB.addField("**Ping**", "-ping > Shows ping from user and bot", true);
    eB.addField("**Clock**", "-clock > Shows current time", true);
    eB.setColor(java.awt.Color.YELLOW);
    e.getChannel().sendMessage(eB.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Message(net.dv8tion.jda.core.entities.Message)

Example 4 with Message

use of net.dv8tion.jda.core.entities.Message in project MOOTBoot by LeshDev.

the class clock method onMessageReceived.

public void onMessageReceived(MessageReceivedEvent e) {
    Message msg = e.getMessage();
    if (!msg.getRawContent().toLowerCase().startsWith("-clock") || bannedList.black.contains(e.getAuthor().getIdLong()) || e.getAuthor().isBot() || !permittedList.perm.contains(e.getAuthor().getIdLong())) {
        return;
    }
    EmbedBuilder eB = new EmbedBuilder();
    eB.setTitle("Time");
    eB.setColor(lib.randomColor());
    eB.setDescription(currentTime());
    e.getChannel().sendMessage(eB.build()).queue(sentMsg -> {
        if (msg.getRawContent().contains("temp")) {
            sentMsg.delete().queueAfter(5, SECONDS);
            msg.delete().queue();
        }
    });
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Message(net.dv8tion.jda.core.entities.Message)

Example 5 with Message

use of net.dv8tion.jda.core.entities.Message in project MantaroBot by Mantaro.

the class ActionCmds method meow.

@Command
public static void meow(CommandRegistry registry) {
    registry.register("meow", new SimpleCommand(Category.ACTION) {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            Message receivedMessage = event.getMessage();
            if (!receivedMessage.getMentionedUsers().isEmpty()) {
                String mew = event.getMessage().getMentionedUsers().stream().map(IMentionable::getAsMention).collect(Collectors.joining(" "));
                event.getChannel().sendFile(ImageActionCmd.CACHE.getInput("http://imgur.com/yFGHvVR.gif"), "mew.gif", new MessageBuilder().append(EmoteReference.TALKING).append(String.format("%s *is meowing at %s.*", event.getAuthor().getAsMention(), mew)).build()).queue();
            } else {
                event.getChannel().sendFile(ImageActionCmd.CACHE.getInput("http://imgur.com/yFGHvVR.gif"), "mew.gif", new MessageBuilder().append(":speech_balloon: Meow.").build()).queue();
            }
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Meow command").setDescription("**Meow either to a person or the sky**.").setColor(Color.cyan).build();
        }
    });
    registry.registerAlias("meow", "mew");
}
Also used : MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) SimpleCommand(net.kodehawa.mantarobot.modules.commands.SimpleCommand) Message(net.dv8tion.jda.core.entities.Message) IMentionable(net.dv8tion.jda.core.entities.IMentionable) MessageBuilder(net.dv8tion.jda.core.MessageBuilder) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) SimpleCommand(net.kodehawa.mantarobot.modules.commands.SimpleCommand) Command(net.kodehawa.mantarobot.modules.Command)

Aggregations

Message (net.dv8tion.jda.core.entities.Message)30 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)14 Guild (net.dv8tion.jda.core.entities.Guild)13 User (net.dv8tion.jda.core.entities.User)12 MessageChannel (net.dv8tion.jda.core.entities.MessageChannel)11 Subcommand (tk.ardentbot.core.executor.Subcommand)8 Command (tk.ardentbot.core.executor.Command)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 Database.connection (tk.ardentbot.rethink.Database.connection)4 Database.r (tk.ardentbot.rethink.Database.r)4 List (java.util.List)3 TimeUnit (java.util.concurrent.TimeUnit)3 Consumer (java.util.function.Consumer)3 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)3 MessageUtils (tk.ardentbot.utils.discord.MessageUtils)3 Cursor (com.rethinkdb.net.Cursor)2 FriendlyException (com.sedmelluq.discord.lavaplayer.tools.FriendlyException)2 AudioTrackInfo (com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo)2