Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
hotfixed moveall command
Browse files Browse the repository at this point in the history
  • Loading branch information
ゼクロ committed Sep 11, 2017
1 parent aad1a88 commit fbd016c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
Empty file added broadcast_ignores.txt
Empty file.
33 changes: 27 additions & 6 deletions src/main/java/commands/guildAdministration/Moveall.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

import commands.Command;
import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.VoiceChannel;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import net.dv8tion.jda.core.managers.GuildController;
import utils.MSGS;
import utils.STATICS;

import java.awt.*;
import java.io.IOException;
import java.text.ParseException;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.*;
import java.util.List;

/**
* Created by zekro on 07.05.2017 / 10:55
Expand Down Expand Up @@ -50,8 +51,28 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept
String VCfrom = event.getMember().getVoiceState().getChannel().getName();
String VCto = vc.getName();

event.getMember().getVoiceState().getChannel().getMembers()
.forEach(member -> event.getGuild().getController().moveVoiceMember(member, vc).queue());
HashMap<VoiceChannel, Guild> autochans = commands.guildAdministration.Autochannel.getAutochans();

System.out.println(autochans.keySet());

if (autochans.containsKey(vc)) {
ArrayList<Member> membs = new ArrayList<>(event.getMember().getVoiceState().getChannel().getMembers());
GuildController controller = event.getGuild().getController();

Member firstOne = membs.get(0);
controller.moveVoiceMember(firstOne, vc).queue();
membs.remove(firstOne);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
System.out.println(membs.get(0));
membs.forEach(m -> controller.moveVoiceMember(m, firstOne.getVoiceState().getChannel()).queue());
}
}, 1000);
} else {
event.getMember().getVoiceState().getChannel().getMembers()
.forEach(member -> event.getGuild().getController().moveVoiceMember(member, vc).queue());
}

event.getMessage().delete().queue();
Message msg = event.getTextChannel().sendMessage(new EmbedBuilder().setColor(new Color(0, 169, 255))
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/utils/STATICS.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class STATICS {
//######### GENERAL BOT SETTINGS #########//


public static String VERSION = "1.38.3.0";
public static String VERSION = "1.38.3.1";
public static String THISBUILD = BUILDTYPE.STABLE;

public static class BUILDTYPE {
Expand Down

0 comments on commit fbd016c

Please sign in to comment.