本文整理汇总了Java中sx.blah.discord.handle.obj.IVoiceChannel.join方法的典型用法代码示例。如果您正苦于以下问题:Java IVoiceChannel.join方法的具体用法?Java IVoiceChannel.join怎么用?Java IVoiceChannel.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sx.blah.discord.handle.obj.IVoiceChannel
的用法示例。
在下文中一共展示了IVoiceChannel.join方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: joinCommand
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
@Command(
command = "join",
alias = "join",
description = "The Bot joins voice Server",
arguments = {},
permission = "music_control",
prefix = Globals.MUSIC_PREFIX
)
public boolean joinCommand(MessageReceivedEvent event, String[] args) {
if (DRIVER.getPropertyOnly(DRIVER.CONFIG, "music_disabled_default").equals(false) || !SERVER_CONTROL.getDisabledlist(SERVER_CONTROL.MUSIC_MODULE).contains(event.getGuild().getStringID())) {
IVoiceChannel userVoiceChannel = event.getAuthor().getVoiceStateForGuild(event.getGuild()).getChannel();
if (userVoiceChannel == null)
return false;
userVoiceChannel.join();
this.volumeMusic(event, new String[]{DRIVER.getPropertyOnly(DRIVER.CONFIG, "defaultvolume").toString()});
return true;
} else {
BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(LANG.getTranslation("disabledserver")), true);
return false;
}
}
示例2: runCommand
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
/**
* Joins a a voice channel after being summoned
* @param event passed event
* @param args passed arguments
*/
@Override
public final void runCommand(MessageReceivedEvent event, String args) {
// The channel the user is in
IVoiceChannel userChannel = event.getAuthor()
.getVoiceStateForGuild(event.getGuild()).getChannel();
if (userChannel == null) {
rexCord.sendMessageWithBlock(event.getChannel(),
"User is not in a voice channel!");
return;
}
userChannel.join();
}
示例3: onCommand
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
@Override
public void onCommand(IUser sender, IChannel channel, IMessage message, String[] args) {
if (!sender.getConnectedVoiceChannels().isEmpty()) {
IVoiceChannel voiceChannel = sender.getConnectedVoiceChannels().get(0);
try {
voiceChannel.join();
if (FlareBot.getInstance().getMusicManager().hasPlayer(channel.getGuild().getID())) {
FlareBot.getInstance().getMusicManager().getPlayer(channel.getGuild().getID()).setPaused(false);
}
} catch (MissingPermissionsException e) {
MessageUtils.sendMessage(sender.mention() + " I cannot join that voice channel!", channel);
}
}
}
示例4: playSound
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
private void playSound(IVoiceChannel voice, IMessage message, File file) {
try {
voice.join();
AudioPlayer.getAudioPlayerForGuild(message.getGuild()).queue(file).getMetadata()
.put(file.getName(), file.toString());
} catch (IOException | UnsupportedAudioFileException e) {
ClientConfig.setSentryContext(message.getGuild(),
message.getAuthor(), message.getChannel(),
message);
LOG.error(e.getMessage());
}
}
示例5: joinVoiceChannel
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
public void joinVoiceChannel(IVoiceChannel voiceChannel) {
if(voiceChannel.getClient().getOurUser().getVoiceStateForGuild(guild).getChannel() == null) {
voiceChannel.join();
LogUtils.infof("{Guild ID: %d} Voice channel joined.", voiceChannel.getGuild().getLongID());
}
}