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


Java Message.getId方法代碼示例

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


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

示例1: sendNowPlaying

import net.dv8tion.jda.core.entities.Message; //導入方法依賴的package包/類
public void sendNowPlaying() {
    isPlaying = true;
    currentTrack = musicManager.player.getPlayingTrack();

    String title = currentTrack.getInfo().title;
    String position = getTimestamp(currentTrack.getPosition());
    String duration = getTimestamp(currentTrack.getDuration());

    String msg = String.format("[%s](%s)\n\n**Time:** \n[%s / %s]", title, currentTrack.getInfo().uri, position, duration);
    EmbedBuilder builder = new EmbedBuilder();
    builder.setColor(server.getSelfMember().getColor());
    builder.setTitle("Playing:");
    builder.setDescription(msg);
    if (currentTrack instanceof YoutubeAudioTrack) {
        String id = YouTubeHelper.extractVideoIdFromUrl(currentTrack.getInfo().uri);
        trackImgUrl = String.format(Constant.youtubeThumbnailUrl, id);
    } else if (currentTrack instanceof VimeoAudioTrack) {
        trackImgUrl = Constant.vimeoIconUrl;
    } else if (currentTrack instanceof TwitchStreamAudioTrack) {
        trackImgUrl = Constant.twitchIconUrl;
    } else if (currentTrack instanceof SoundCloudAudioTrack) {
        trackImgUrl = Constant.soundcloudIconUrl;
    } else if (currentTrack instanceof BandcampAudioTrack) {
        trackImgUrl = Constant.bandcampIconUrl;
    } else {
        trackImgUrl = Constant.lambdaMusicIconUrl;
    }
    builder.setThumbnail(trackImgUrl);
    builder.setFooter(server.getSelfMember().getNickname() != null ? server.getSelfMember().getNickname() : server.getSelfMember().getEffectiveName(), server.getIconUrl());
    channel.getManager().setTopic("**Playing:** " + title).queue();
    Message theMessage = channel.sendMessage(builder.build()).complete();
    idMessageNowPlaying = theMessage.getId();
    try {
        channel.addReactionById(idMessageNowPlaying, "⏹").complete(true);
        channel.addReactionById(idMessageNowPlaying, "⏯").complete(true);
        channel.addReactionById(idMessageNowPlaying, "⏭").submit();
    } catch (Exception e) {
    }
}
 
開發者ID:elgoupil,項目名稱:GoupilBot,代碼行數:40,代碼來源:NowPlaying.java

示例2: sendNowPaused

import net.dv8tion.jda.core.entities.Message; //導入方法依賴的package包/類
public void sendNowPaused() {
    isPlaying = false;
    channel.getManager().setTopic("").queue();
    channel.deleteMessageById(idMessageNowPlaying).complete();

    idMessageNowPlaying = "";

    currentTrack = musicManager.player.getPlayingTrack();

    String title = currentTrack.getInfo().title;
    String position = getTimestamp(currentTrack.getPosition());
    String duration = getTimestamp(currentTrack.getDuration());

    String msg = String.format("[%s](%s)\n\n**Time:** \n[%s / %s]", title, currentTrack.getInfo().uri, position, duration);
    EmbedBuilder builder = new EmbedBuilder();
    builder.setColor(server.getSelfMember().getColor());
    builder.setTitle("Paused:");
    builder.setDescription(msg);
    builder.setThumbnail(trackImgUrl);
    builder.setFooter(server.getSelfMember().getNickname() != null ? server.getSelfMember().getNickname() : server.getSelfMember().getEffectiveName(), server.getIconUrl());
    channel.getManager().setTopic("**Paused:** " + title).queue();
    Message theMessage = channel.sendMessage(builder.build()).complete();
    idMessageNowPlaying = theMessage.getId();
    try {
        channel.addReactionById(idMessageNowPlaying, "⏹").complete(true);
        channel.addReactionById(idMessageNowPlaying, "⏯").complete(true);
        channel.addReactionById(idMessageNowPlaying, "⏭").submit();
    } catch (Exception e) {
    }
}
 
開發者ID:elgoupil,項目名稱:GoupilBot,代碼行數:31,代碼來源:NowPlaying.java

示例3: build

import net.dv8tion.jda.core.entities.Message; //導入方法依賴的package包/類
private void build(){
	Message m = channel.sendMessage(text).complete();
	id = m.getId();
	for(String b : buttons){
		m.addReaction(b).complete();
	}
}
 
開發者ID:Implosions,項目名稱:BullyBot,代碼行數:8,代碼來源:MenuItem.java


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