当前位置: 首页>>代码示例>>Java>>正文


Java IVoiceChannel.join方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:24,代码来源:MainMusic.java

示例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();
}
 
开发者ID:Pedro12909,项目名称:RexCord,代码行数:20,代码来源:HereCommand.java

示例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);
        }
    }
}
 
开发者ID:ArsenArsen,项目名称:FlareBot,代码行数:15,代码来源:JoinCommand.java

示例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());
    }
}
 
开发者ID:Kaysoro,项目名称:KaellyBot,代码行数:13,代码来源:SoundCommand.java

示例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());
	}
}
 
开发者ID:Shadorc,项目名称:Shadbot,代码行数:7,代码来源:GuildMusic.java


注:本文中的sx.blah.discord.handle.obj.IVoiceChannel.join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。