当前位置: 首页>>代码示例>>Java>>正文


Java Message.getChannel方法代码示例

本文整理汇总了Java中net.dv8tion.jda.core.entities.Message.getChannel方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getChannel方法的具体用法?Java Message.getChannel怎么用?Java Message.getChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.dv8tion.jda.core.entities.Message的用法示例。


在下文中一共展示了Message.getChannel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onGuildMessageReceived

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
    Message message = event.getMessage();
    checkForAdvertising(event.getMember(), event.getMessage(), event.getChannel());
    if (message.getChannel() == Channels.BOT_META.getChannel() && message.isWebhookMessage()) {
        MessageEmbed embed = message.getEmbeds().get(0);
        if ((embed.getTitle().startsWith("[WheezyGold7931/happybot] Issue closed:") || embed.getTitle().startsWith("[WheezyGold7931/happybot] New comment on issue") ) && !RuntimeEditor.isPingIssueClose())
            return;
        Roles.GIT.getRole().getManager().setMentionable(true).queue();
        Channels.BOT_META.getChannel().sendMessage(Roles.GIT.getRole().getAsMention()).queue();
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            Roles.GIT.getRole().getManager().setMentionable(false).queue();
        }
    }
        
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:21,代码来源:AutoMod.java

示例2: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    String content = message.getRawContent();
    MessageChannel channel = message.getChannel();
    String commandNParameters[] = DodoStringHandler.getCommandNParameters(content);
    try {
        if (commandNParameters.length > 1) {
            for (Submission s : RedditHandler.getPosts(commandNParameters[1], 2)) {
                channel.sendMessage("https://www.reddit.com" + s.getPermalink()).complete();
            }
        } else
            channel.sendMessage("```" + prefix + usage + "```").complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        channel.sendMessage("```" + e.getMessage() + "```").complete();
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:19,代码来源:Reddit.java

示例3: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    String content = message.getRawContent();
    MessageChannel channel = message.getChannel();
    String commandNParameters[] = DodoStringHandler.getCommandNParameters(content);
    try {
        if (commandNParameters.length > 1) {
            message.delete().complete();
            String whatToSay = DodoStringHandler.glueStringsBackTogether(commandNParameters, " ", 1);
            channel.sendMessage(whatToSay.substring(0, 1).toUpperCase() + whatToSay.substring(1) + ".").complete();
        } else {
            channel.sendMessage(getUsage()).complete();
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:19,代码来源:Speak.java

示例4: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    MessageChannel channel = message.getChannel();
    User author = message.getAuthor();
    try {
        BufferedImage avatar = ReadImage.readImageFromURL(author.getAvatarUrl());
        BufferedImage triggered = ReadImage.readImageFromDisk("triggered.jpg");
        DrawOnImg.drawImg(avatar, triggered, 0, avatar.getHeight() - 20, avatar.getWidth(), 20);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(avatar, "png", baos);
        channel.sendFile(baos.toByteArray(), "triggered.png", null).complete();

    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:18,代码来源:Triggered.java

示例5: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    MessageChannel channel = message.getChannel();
    EmbedBuilder embMsg = new EmbedBuilder();
    try {
        embMsg.setTitle("About DodoBot", "https://github.com/ExidCuter/JDodoBot");
        embMsg.setThumbnail("https://pbs.twimg.com/profile_images/932637770874589186/KgP5zJjH_400x400.jpg");
        embMsg.setColor(new Color(0x13FF00));
        embMsg.addField("Version", ver, true);
        embMsg.addField("By", "Dodo Dodović", true);
        embMsg.addField("Servers", Integer.toString(getNumOfServers()), true);
        embMsg.addField("GitHub", "https://github.com/ExidCuter/JDodoBot", false);
        embMsg.addField("Donate", " https://www.paypal.me/DodoDodovic", false);
        channel.sendMessage(embMsg.build()).complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:20,代码来源:About.java

示例6: CommandMessage

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
public CommandMessage(Message message, boolean mentionableCommand, String[] aliasArguments) {
    super(message.getIdLong(), message.getChannel(), message.isWebhookMessage(), message.getType());

    this.mentionableCommand = mentionableCommand;
    String rawContent = prepareRawContent(message.getRawContent(), aliasArguments != null);
    if (aliasArguments != null) {
        rawContent = ":alias " + String.join(" ", aliasArguments) + " " + rawContent;
    }

    this.setContent(rawContent)
        .setAuthor(message.getAuthor())
        .setTime(message.getCreationTime())
        .setEditedTime(message.getEditedTime())
        .setAttachments(message.getAttachments())
        .setEmbeds(message.getEmbeds())
        .setMentionedChannels(message.getMentionedChannels())
        .setMentionedRoles(message.getMentionedRoles())
        .setMentionedUsers(prepareMentionedUsers(message.getMentionedUsers()))
        .setMentionsEveryone(message.mentionsEveryone())
        .setReactions(message.getReactions())
        .setPinned(message.isPinned())
        .setTTS(message.isTTS());
}
 
开发者ID:avaire,项目名称:avaire,代码行数:24,代码来源:CommandMessage.java

示例7: update

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
public void update(Message message) {
    if (!(message.getChannel() instanceof TextChannel)) {
        UIChannelListItem item = channelItems.get(message.getChannel().getId());
        channelList.remove(item);
        channelList.add(item,c,0);
        item.updatePreview(message);
        refresh();
    }
}
 
开发者ID:MCPlummet,项目名称:TransparentDiscord,代码行数:10,代码来源:UIChannelList.java

示例8: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    String content = message.getRawContent();
    MessageChannel channel = message.getChannel();
    String commandNParameters[] = DodoStringHandler.getCommandNParameters(content);
    try {
        if (commandNParameters.length > 2) {
            String quote = DodoStringHandler.glueStringsBackTogether(commandNParameters, " ", 2);
            quote = quote.replace("\"", "");
            Quote temp = new Quote(commandNParameters[1], quote);
            quotes.add(temp);
            FileHandler.writeToFile(quotes);
            channel.sendMessage(temp.toString()).complete();
        } else if (commandNParameters.length == 2) {
            Random rnd = new Random();
            ArrayList<Quote> tempQuotes = new ArrayList<>();
            for (Quote q : quotes) {
                System.out.println(q.getWho());
                if (q.getWho().toLowerCase().equals(commandNParameters[1].toLowerCase())) {
                    tempQuotes.add(q);
                }
            }
            if (tempQuotes.size() > 0)
                channel.sendMessage(tempQuotes.get(rnd.nextInt(tempQuotes.size())).toString()).complete();
            else
                channel.sendMessage("No quotes from " + commandNParameters[1] + "!").complete();
        } else {
            channel.sendMessage("```" + prefix + usage + "```").complete();
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:35,代码来源:QuotePerson.java

示例9: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    User author = message.getAuthor();
    MessageChannel channel = message.getChannel();

    BankAccount temp = new BankAccount("temp");
    boolean exists = false;
    for (BankAccount b : bankAccounts) {
        if (b.getID().equals(author.getId())) {
            exists = true;
            temp = b;
        }
    }
    try {
        if (exists && temp.lastPay.before(new Date(System.currentTimeMillis() - TimeUnit.HOURS.toMillis(23)))) {
            temp.setBalance(temp.getBalance() + 100.00);
            temp.lastPay = new Date();
            channel.sendMessage("You got 100.00 Dodos.\nNew balance: " + Double.toString(temp.getBalance())).complete();
            FileHandler.writeToFile(bankAccounts);
        } else {
            channel.sendMessage("You have already got your pay!").complete();
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:28,代码来源:Payday.java

示例10: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    User author = message.getAuthor();
    String content = message.getRawContent();
    MessageChannel channel = message.getChannel();
    String commandNParameters[] = DodoStringHandler.getCommandNParameters(content);
    BankAccount temp = new BankAccount("temp");
    boolean exists = false;
    for (BankAccount b : bankAccounts) {
        if (b.getID().equals(author.getId())) {
            exists = true;
            temp = b;
        }
    }
    try {
        if (commandNParameters.length < 2)
            channel.sendMessage("```" + prefix + usage + "```").complete();
        else if (exists && temp.getBalance() >= Double.parseDouble(commandNParameters[1])) {
            if (Double.parseDouble(commandNParameters[1]) > -1)
                SlotMashina.slotMashinas(Double.parseDouble(commandNParameters[1]), channel, temp);
            else
                channel.sendMessage("Can't slot that!").complete();
        } else {
            if (!exists) {
                channel.sendMessage("You have to register! Use `" + prefix + "bank register`").complete();
            } else channel.sendMessage("You are too poor!").complete();
        }

    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:34,代码来源:Slot.java

示例11: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    MessageChannel channel = message.getChannel();
    User author = message.getAuthor();
    try {
        BufferedImage avatar;
        List<User> users = message.getMentionedUsers();
        if (users.isEmpty()) avatar = ReadImage.readImageFromURL(author.getAvatarUrl());
        else avatar = ReadImage.readImageFromURL(users.get(0).getAvatarUrl());
        for (int i = 0; i < gif.length; i++) {
            gif[i] = ReadImage.readImageFromDisk("gif/"+String.valueOf(i)+".png");
        }

        GifImage img = new GifImage(gif[0].getWidth(),gif[0].getHeight(),GifImage.RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE);

        for (int i = 0; i < gif.length; i++) {
            if (i>21) DrawOnImg.drawImg(gif[i],avatar,30-(10*(i-20)),42+(11*(i-20)),110,98);
            else DrawOnImg.drawImg(gif[i],avatar,30,42,110,98);
            img.addGifFrame(new GifFrame(gif[i]));
        }
        img.setDefaultDelay(1);
        GifEncoder.encode(img, new File("hudio.gif"), true);
        Path fileLocation = Paths.get("hudio.gif");
        byte[] data = Files.readAllBytes(fileLocation);

        channel.sendFile(data, "shoot.gif", null).complete();

    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:33,代码来源:Shoot.java

示例12: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    MessageChannel channel = message.getChannel();
    try {
        String helpVoice = "join [name]  - Joins a voice channel that has the provided name\njoin [id]    - Joins a voice channel based on the provided id.\nleave        - Leaves the voice channel that the bot is currently in.\nplay         - Plays songs from the current queue. Starts playing again if it was previously paused\nplay [url]   - Adds a new song to the queue and starts playing if it wasn't playing already\npplay        - Adds a playlist to the queue and starts playing if not already playing\npause        - Pauses audio playback\nstop         - Completely stops audio playback, skipping the current song.\nskip         - Skips the current song, automatically starting the next\nnowplaying   - Prints information about the currently playing song (title, current time)\nnp           - alias for nowplaying\nlist         - Lists the songs in the queue\nvolume [val] - Sets the volume of the MusicPlayer [10 - 100]\nrestart      - Restarts the current song or restarts the previous song if there is no current song playing.\nrepeat       - Makes the player repeat the currently playing song\nreset        - Completely resets the player, fixing all errors and clearing the queue.\n";
        channel.sendMessage("```Voice Commands:  \n" + helpVoice + "```").complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:12,代码来源:HelpMusic.java

示例13: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    String content = message.getRawContent();
    MessageChannel channel = message.getChannel();
    String commandNParameters[] = DodoStringHandler.getCommandNParameters(content);
    try {
        if (commandNParameters.length > 1)
            channel.sendMessage("http://lmgtfy.com/?q=" + URLEncoder.encode(DodoStringHandler.glueStringsBackTogether(commandNParameters, " ", 1), "UTF-8")).complete();
        else
            channel.sendMessage(getUsage()).complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:16,代码来源:LMGTFY.java

示例14: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    MessageChannel channel = message.getChannel();
    try {
        channel.sendMessage(HTTPHandler.getCat()).complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:11,代码来源:Cat.java

示例15: doYaThing

import net.dv8tion.jda.core.entities.Message; //导入方法依赖的package包/类
@Override
public void doYaThing(Message message) {
    User author = message.getAuthor();
    MessageChannel channel = message.getChannel();
    try {
        channel.sendMessage("Hello " + author.getAsMention()).complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
开发者ID:ExidCuter,项目名称:JDodoBot,代码行数:12,代码来源:Hi.java


注:本文中的net.dv8tion.jda.core.entities.Message.getChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。