• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GuildVoiceJoinEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent的典型用法代码示例。如果您正苦于以下问题:Java GuildVoiceJoinEvent类的具体用法?Java GuildVoiceJoinEvent怎么用?Java GuildVoiceJoinEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GuildVoiceJoinEvent类属于net.dv8tion.jda.core.events.guild.voice包,在下文中一共展示了GuildVoiceJoinEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event)
{
    Guild guild = event.getGuild();
    TextChannel tc = db.getServerlogChannel(guild);
    TextChannel channel = FinderUtil.getDefaultChannel(event.getGuild());
    VoiceChannel vc = event.getChannelJoined();
    User user = event.getMember().getUser();
    Calendar calendar = GregorianCalendar.getInstance();
    calendar.setTime(new Date());
    String hour = String.format("%02d",calendar.get(Calendar.HOUR_OF_DAY));
    String min = String.format("%02d", calendar.get(Calendar.MINUTE));
    String sec = String.format("%02d", calendar.get(Calendar.SECOND));

    if(!(tc==null) && !(user.isBot()))
    {
        if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
            guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
                    null, (e) -> channel.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
        else
            tc.sendMessage("`["+hour+":"+min+":"+sec+"] [Voice Join]:`  **"+user.getName()+"#"+user.getDiscriminator()+"** has joined a Voice Channel: **"+vc.getName()+"** (ID: "+vc.getId()+")").queue();
    }
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:24,代码来源:ServerLogging.java


示例2: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent e) {
	// Ignore guilds that are not related to this instance
	if (e.getGuild().getId() != guildId) {
		return;
	}
	// Ignore voice channels that are not linked
	if (!channelsAndMembers.containsKey(e.getChannelJoined())) {
		return;
	}
	// Ignore link channel
	if (linkChannel.getId().equals(e.getChannelJoined().getId())) {
		return;
	}
	
	Member member = e.getMember();
	channelsAndMembers.forEach((c, ms) -> ms.remove(member));
	channelsAndMembers.get(e.getChannelJoined()).add(member);
	e.getGuild().getController().moveVoiceMember(member, linkChannel);
}
 
开发者ID:Tazzie02,项目名称:Tazbot,代码行数:21,代码来源:LinkUnlink.java


示例3: onVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Subscribe
public void onVoiceJoin(GuildVoiceJoinEvent event) {
    CGuild cGuild = charrizard.getCGuildManager().getGuild(event.getGuild());
    if (cGuild == null) {
        charrizard.getCGuildManager().createGuild(event.getGuild());
        cGuild = charrizard.getCGuildManager().getGuild(event.getGuild());
    }
    CVoiceChannel cVoiceChannel = cGuild.getVoiceChannel(event.getChannelJoined());
    if (cVoiceChannel == null) {
        cGuild.createVoiceChannel(event.getChannelJoined());
        cVoiceChannel = cGuild.getVoiceChannel(event.getChannelJoined());
    }
    cVoiceChannel.addConnection();
}
 
开发者ID:kacperduras,项目名称:Charrizard,代码行数:15,代码来源:VoiceListener.java


示例4: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent e) {
    VoiceChannel ch = e.getChannelJoined();
    if(isAutoChannel(e.getGuild(), ch)) {
        VoiceChannel newChannel = (VoiceChannel) e.getGuild().getController().createCopyOfChannel(ch).setName(ch.getName() + " [AC]").complete();
        e.getGuild().getController().moveVoiceMember(e.getMember(), newChannel).queue();
    }
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:9,代码来源:AutochannelListener.java


示例5: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    if (!isEventEnabled(event.getGuild(), LogEventKeys.VOICE))
        return;
    TextChannel textChannel = getLogChannel(event.getGuild());
    if (textChannel == null)
        return;

    EmbedBuilder embedBuilder = new EmbedBuilder();
    embedBuilder.setAuthor("A member created voice connection", null, event.getMember().getUser().getAvatarUrl());
    embedBuilder.setDescription("**" + event.getMember().getEffectiveName() + " (" + event.getMember().getUser().getId() + ")** joined `" + event.getChannelJoined().getName() + "`");
    embedBuilder.setColor(evVoiceLog);
    sendLog(textChannel, embedBuilder);
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:15,代码来源:ServerLogHandler.java


示例6: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent e)
{	
	if (e.getMember().getUser().isBot())
		return;
	
	
	if (e.getChannelJoined().getName().equalsIgnoreCase("Weenie Hut General"))
		WeenieBot.getBot().addCommand(new Command(e.getMember().getUser().getName(), "hat", e, CommandType.ENTRANCE_PLAY));
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:11,代码来源:EntranceListener.java


示例7: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    // Check if not ourselves
    if (!event.getMember().getUser().equals(event.getJDA().getSelfUser())) return;

    getLink(event.getGuild()).onVoiceJoin();
}
 
开发者ID:Frederikam,项目名称:Lavalink,代码行数:8,代码来源:Lavalink.java


示例8: onEvent

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onEvent(Event event) {
    if(event instanceof GuildVoiceMoveEvent) {
        onGuildVoiceMove((GuildVoiceMoveEvent)event);
    } else if(event instanceof GuildVoiceJoinEvent) {
        onGuildVoiceJoin((GuildVoiceJoinEvent)event);
    } else if(event instanceof GuildVoiceLeaveEvent) {
        onGuildVoiceLeave((GuildVoiceLeaveEvent)event);
    } else if(event instanceof GuildVoiceMuteEvent) {
        onGuildVoiceMute((GuildVoiceMuteEvent)event);
    }
}
 
开发者ID:natanbc,项目名称:GabrielBot,代码行数:13,代码来源:MusicListener.java


示例9: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent e) {
	// If a user joins the voiceChannel that was created
	if (voiceChannel.getChannel().getId().equals(e.getChannelJoined().getId())) {
		if (!ignoreTimer) {
			messageChannel.sendMessage(String.format("%s has joined temp channel \"%s\". "
					+ "Channel will be deleted when all users disconnect.",
					e.getMember().getUser().getName(), e.getChannelJoined().getName()));
		}
		ignoreTimer = true;
	}
}
 
开发者ID:Tazzie02,项目名称:Tazbot,代码行数:13,代码来源:TempChannel.java


示例10: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    charrizard.getEventBus().post(event);
}
 
开发者ID:kacperduras,项目名称:Charrizard,代码行数:5,代码来源:EventCaller.java


示例11: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public final void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    Standard.log(Instant.now(), event.getGuild(), LOG_NAME, LOG_CHANNEL_ID_VOICE, LOG_TEXT_VOICE_JOIN, "[%1$s] [%2$s] %3$s joined #%4$s", LOG_DATE_TIME_FORMAT, Config.CONFIG.getUserNameForUser(event.getMember().getUser(), event.getGuild(), true), event.getChannelJoined().getName());
}
 
开发者ID:Panzer1119,项目名称:Supreme-Bot,代码行数:5,代码来源:GuildVoiceLogger.java


示例12: proccessCommand

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
public void proccessCommand()
{
	if (this.commandQueue.peek() == null)
		return;
	
	/* We lock the bot here to prevent any commands from running while a command is being processed */
	this.isLocked = true;
	
	/* Retrieve the first command in the queue */
	Command c = commandQueue.poll();		
	log.info("Attempting to process command: <" + c.getMessage() + ">");
	
	switch (c.getType())
	{
		/* Normal Commands that get processed in the order they come */
		case PLAY:
			playCommand(c.getUser(), c.getMessage(), (MessageReceivedEvent) c.getEvent());
			break;
			
		case ENTRANCE_PLAY:	
			GuildVoiceJoinEvent tempJE = (GuildVoiceJoinEvent) c.getEvent();
			entrancePlayCommand(c.getUser(), c.getMessage(), tempJE.getGuild(), tempJE.getChannelJoined());
			break;
			
		case MOVE_PLAY:
			GuildVoiceMoveEvent tempME = (GuildVoiceMoveEvent) c.getEvent();
			entrancePlayCommand(c.getUser(), c.getMessage(), tempME.getGuild(), tempME.getChannelJoined());
			break;
			
		case RELOAD_LIBRARY:
			reloadCommand();
			this.isLocked = false;
			break;
			
		case RANDOM:
			randomCommand(c.getUser(), (MessageReceivedEvent) c.getEvent());
			break;
			
		case VOLUME:
			volumeCommand(c.getUser(), c.getMessage(), (MessageReceivedEvent) c.getEvent());
			this.isLocked = false;
			break;
			
		case LIST:
			listCommand(c.getUser(), (MessageReceivedEvent) c.getEvent());
			this.isLocked = false;
			break;
			
		default:
			break;
	}
}
 
开发者ID:SegfaultError11,项目名称:WeenieBot,代码行数:53,代码来源:WeenieBot.java


示例13: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    if(event.getChannelJoined().getMembers().contains(event.getGuild().getSelfMember()))
        onJoin(event.getChannelJoined());
}
 
开发者ID:natanbc,项目名称:GabrielBot,代码行数:5,代码来源:MusicListener.java


示例14: onGuildVoiceJoin

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
    if (event.getMember().getUser().equals(event.getJDA().getSelfUser())) {
        event.getGuild().getAudioManager().setSelfDeafened(true);
    }
}
 
开发者ID:Minehut,项目名称:MinehutBOT,代码行数:7,代码来源:VoiceEvents.java



注:本文中的net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ThemeSingleton类代码示例发布时间:2022-05-22
下一篇:
Java ClientCookieEncoder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap