当前位置: 首页>>代码示例>>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;未经允许,请勿转载。