本文整理汇总了Java中sx.blah.discord.handle.obj.IVoiceChannel.leave方法的典型用法代码示例。如果您正苦于以下问题:Java IVoiceChannel.leave方法的具体用法?Java IVoiceChannel.leave怎么用?Java IVoiceChannel.leave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sx.blah.discord.handle.obj.IVoiceChannel
的用法示例。
在下文中一共展示了IVoiceChannel.leave方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: leaveMusic
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
@Command(
command = "leave",
alias = "leave",
description = "The Bot leaves voice Server",
arguments = {},
permission = "music_control",
prefix = Globals.MUSIC_PREFIX
)
public boolean leaveMusic(MessageReceivedEvent event, String[] args) {
IVoiceChannel botVoiceChannel = event.getClient().getOurUser().getVoiceStateForGuild(event.getGuild()).getChannel();
if (botVoiceChannel == null) {
BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(LANG.getTranslation("music_notinchannel_user")), true);
return false;
}
AudioPlayer audioP = AudioPlayer.getAudioPlayerForGuild(event.getGuild());
audioP.clear();
botVoiceChannel.leave();
return true;
}
示例2: runCommand
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
/**
* Leaves current voice channel
* @param event passed event
* @param args passed arguments
*/
@Override
public final void runCommand(MessageReceivedEvent event, String args) {
// The channel the bot is in
IVoiceChannel currentChannel = event.getClient().getOurUser()
.getVoiceStateForGuild(event.getGuild()).getChannel();
if (currentChannel == null) {
rexCord.sendMessageWithBlock(event.getChannel(),
"RexCord is not in a voice channel!");
return;
}
currentChannel.leave();
}
示例3: leaveVoiceChannel
import sx.blah.discord.handle.obj.IVoiceChannel; //导入方法依赖的package包/类
public void leaveVoiceChannel() {
IVoiceChannel voiceChannel = Shadbot.getClient().getOurUser().getVoiceStateForGuild(guild).getChannel();
if(voiceChannel != null && voiceChannel.getShard().isReady()) {
voiceChannel.leave();
}
}