本文整理汇总了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) {
}
}
示例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) {
}
}
示例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();
}
}