當前位置: 首頁>>代碼示例>>Java>>正文


Java TextChannel.getId方法代碼示例

本文整理匯總了Java中net.dv8tion.jda.core.entities.TextChannel.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java TextChannel.getId方法的具體用法?Java TextChannel.getId怎麽用?Java TextChannel.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.dv8tion.jda.core.entities.TextChannel的用法示例。


在下文中一共展示了TextChannel.getId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: blockChannel

import net.dv8tion.jda.core.entities.TextChannel; //導入方法依賴的package包/類
private void blockChannel(CommandManager.ParsedCommandInvocation parsedCommandInvocation) {
    Message message = parsedCommandInvocation.getMessage();
    if (message.getMentionedChannels().isEmpty()) {
        message.getTextChannel().sendMessage(EmbedUtil.error("Unknown channel", "Please mention the textchannel that should be blacklisted").build()).queue(msg -> msg.delete().queueAfter(5, TimeUnit.SECONDS));
        return;
    }
    TextChannel channel = message.getMentionedChannels().get(0);
    if (RubiconBot.getMySQL().isBlacklisted(channel)) {
        message.getTextChannel().sendMessage(EmbedUtil.error("Blacklisted channel", "That channel is already blacklisted").build()).queue(msg -> msg.delete().queueAfter(5, TimeUnit.SECONDS));
        return;
    }
    String oldEntry = RubiconBot.getMySQL().getGuildValue(message.getGuild(), "blacklist");
    String newEntry;
    if (oldEntry.equals(""))
        newEntry = channel.getId();
    else
        newEntry = oldEntry + "," + channel.getId();
    RubiconBot.getMySQL().updateGuildValue(message.getGuild(), "blacklist", newEntry);
    message.getTextChannel().sendMessage(EmbedUtil.success("Blacklisted channel!", "Successfully added channel to blacklist").build()).queue(msg -> msg.delete().queueAfter(5, TimeUnit.SECONDS));
}
 
開發者ID:Rubicon-Bot,項目名稱:Rubicon,代碼行數:21,代碼來源:CommandBlacklist.java

示例2: onTextChannelDelete

import net.dv8tion.jda.core.entities.TextChannel; //導入方法依賴的package包/類
@Override
public void onTextChannelDelete(TextChannelDeleteEvent e) {
    String portalStatus = RubiconBot.getMySQL().getGuildValue(e.getGuild(), "portal");
    if(portalStatus.equalsIgnoreCase("closed") || portalStatus.equalsIgnoreCase("waiting"))
        return;
    if(portalStatus.equalsIgnoreCase("open")) {
        TextChannel channel = e.getJDA().getTextChannelById(RubiconBot.getMySQL().getPortalValue(e.getGuild(), "channelid"));
        if(e.getChannel().getId() != channel.getId())
            return;

        Guild partnerGuild = e.getJDA().getGuildById(RubiconBot.getMySQL().getPortalValue(e.getGuild(), "partnerid"));
        RubiconBot.getMySQL().deletePortal(e.getGuild());
        RubiconBot.getMySQL().deletePortal(partnerGuild);
        RubiconBot.getMySQL().updateGuildValue(e.getGuild(), "portal", "closed");
        RubiconBot.getMySQL().updateGuildValue(partnerGuild, "portal", "closed");

        sendPortalNotification(e.getGuild(), "Portal was closed.");
        sendPortalNotification(partnerGuild, "Portal was closed on the other side.");
    }
}
 
開發者ID:Rubicon-Bot,項目名稱:Rubicon,代碼行數:21,代碼來源:ChannelDeleteListener.java

示例3: SparkTwitchBean

import net.dv8tion.jda.core.entities.TextChannel; //導入方法依賴的package包/類
private SparkTwitchBean(TextChannel ch, String twitchHandle) {
	this.channelId = ch.getId();
	this.channelName = ch.getName();
	this.twitchHandle = twitchHandle;
}
 
開發者ID:paul-io,項目名稱:momo-2,代碼行數:6,代碼來源:SparkTwitchBean.java


注:本文中的net.dv8tion.jda.core.entities.TextChannel.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。