本文整理汇总了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();
}
}
示例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);
}
示例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();
}
示例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();
}
}
示例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);
}
示例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));
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例10: onGuildVoiceJoin
import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent; //导入依赖的package包/类
@Override
public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
charrizard.getEventBus().post(event);
}
示例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());
}
示例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;
}
}
示例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());
}
示例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);
}
}