Multi guild change

This commit is contained in:
Sebastien 2018-04-26 11:24:48 +02:00
parent 2796993fec
commit cd511e5eea
3 changed files with 5 additions and 4 deletions

View File

@ -42,8 +42,9 @@ public class BotListener extends ListenerAdapter {
@Override @Override
public void onGuildMemberJoin(GuildMemberJoinEvent event) { public void onGuildMemberJoin(GuildMemberJoinEvent event) {
logger.info(event.getUser().getName()+ "join the guild, move it!"); logger.info(event.getUser().getName()+ "join the guild, move it!");
new Move().exc(event.getMember(),event.getJDA().getRolesByName("Newbies",true),false,event.getJDA().getGuilds().get(0),event.getJDA().getGuilds().get(0).getManager()); new Move().exc(event.getMember(),event.getJDA().getRolesByName("Newbies",true),false,event.getGuild(),event.getGuild().getManager());
TextChannel chanel = event.getGuild().getTextChannelsByName("accueil", true).get(0); TextChannel chanel = event.getGuild().getTextChannelsByName("accueil", true).get(0);
if(chanel != null)
chanel.sendMessage("Salut "+event.getUser().getAsMention()+"! Ecris ton nom, prénom, ta promotion et ton groupe ici! Un admin te donnera accées a ton groupe!").complete(); chanel.sendMessage("Salut "+event.getUser().getAsMention()+"! Ecris ton nom, prénom, ta promotion et ton groupe ici! Un admin te donnera accées a ton groupe!").complete();
MainBot.roleFlag = false; MainBot.roleFlag = false;
} }
@ -55,7 +56,7 @@ public class BotListener extends ListenerAdapter {
if(event.getMember().getRoles().size() == 0){ if(event.getMember().getRoles().size() == 0){
logger.info(event.getUser().getName()+ "have no roles, move it!"); logger.info(event.getUser().getName()+ "have no roles, move it!");
new Move().exc(event.getMember(),event.getJDA().getRolesByName("Populace",true),false,event.getJDA().getGuilds().get(0),event.getJDA().getGuilds().get(0).getManager()); new Move().exc(event.getMember(),event.getGuild().getRolesByName("Populace",true),false,event.getGuild(),event.getGuild().getManager());
MainBot.roleFlag = false; MainBot.roleFlag = false;
} }
} }

View File

@ -120,7 +120,7 @@ public class Help implements Commande {
boolean isAdmin; boolean isAdmin;
if(event.isFromType(ChannelType.PRIVATE)) if(event.isFromType(ChannelType.PRIVATE))
isAdmin = event.getJDA().getGuilds().get(0).getMember(event.getAuthor()).hasPermission(Permission.ADMINISTRATOR); isAdmin = event.getGuild().getMember(event.getAuthor()).hasPermission(Permission.ADMINISTRATOR);
else else
isAdmin = event.getMember().hasPermission(Permission.ADMINISTRATOR); isAdmin = event.getMember().hasPermission(Permission.ADMINISTRATOR);

View File

@ -111,7 +111,7 @@ public class MainBot {
Commande cmdObj = commandes.get(cmd.commande); Commande cmdObj = commandes.get(cmd.commande);
boolean isAdmin; boolean isAdmin;
if(cmd.event.isFromType(ChannelType.PRIVATE)){ if(cmd.event.isFromType(ChannelType.PRIVATE)){
isAdmin = jda.getGuilds().get(0).getMember(cmd.event.getAuthor()).hasPermission(Permission.ADMINISTRATOR); isAdmin = cmd.event.getGuild().getMember(cmd.event.getAuthor()).hasPermission(Permission.ADMINISTRATOR);
} }
else else
isAdmin = cmd.event.getMember().hasPermission(Permission.ADMINISTRATOR); isAdmin = cmd.event.getMember().hasPermission(Permission.ADMINISTRATOR);