Merge branch 'master' into devel

This commit is contained in:
Sebastien 2018-05-10 18:15:06 +02:00
commit eacba43ce0
5 changed files with 111 additions and 41 deletions

View File

@ -0,0 +1,36 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.Tools.EmbedMessageUtils;
import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import java.awt.*;
public class GetChannels implements Commande{
@Override
public void action(String[] args, MessageReceivedEvent event) {
event.getGuild().getTextChannels();
EmbedBuilder eb = new EmbedBuilder().setColor(Color.green);
for(TextChannel channel : event.getGuild().getTextChannels())
eb.addField(channel.getName(),"ID: " + channel.getId(), false);
event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return true;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -108,6 +108,7 @@ public class Preference implements Commande {
GuildPreferenceEntity pref = getPreference(event.getGuild());
switch (key){
case "anti_spam":
value = value.replaceAll(" ", "");
if(value.toLowerCase().equals("true") || value.toLowerCase().equals("false")){
boolean result = Boolean.parseBoolean(value);
pref.setAntiSpam(result);
@ -125,6 +126,7 @@ public class Preference implements Commande {
case "default_role":
value = value.replaceAll(" ", "");
if(value.toLowerCase().equals("true") || value.toLowerCase().equals("false")){
boolean result = Boolean.parseBoolean(value);
pref.setDefaultRole(result);
@ -140,6 +142,7 @@ public class Preference implements Commande {
break;
case "default_role_id":
try{
value = value.replaceAll(" ", "");
Role role = event.getGuild().getRoleById(value);
if(role != null){
pref.setDefaultRoleId(role.getId());
@ -162,6 +165,7 @@ public class Preference implements Commande {
break;
case "welcome":
value = value.replaceAll(" ", "");
if(value.toLowerCase().equals("true") || value.toLowerCase().equals("false")){
boolean result = Boolean.parseBoolean(value);
pref.setWelcome(result);
@ -177,6 +181,7 @@ public class Preference implements Commande {
break;
case "welcome_chanel_id":
try{
value = value.replaceAll(" ", "");
TextChannel chanel = event.getGuild().getTextChannelById(value);
if(chanel != null){
pref.setWelcomeChanelID(chanel.getId());
@ -192,7 +197,7 @@ public class Preference implements Commande {
throw new NumberFormatException();
}
}catch (NumberFormatException e){
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nRole not found!\n\nUse `//listroles` to get roles id"));
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nText channel not found!\n\nUse `//listroles` to get roles id"));
Message sended = event.getTextChannel().sendMessage(msg).complete();
new MessageTimeOut(MainBot.messageTimeOut, sended, event.getMessage()).start();
}

View File

@ -10,34 +10,39 @@
<!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
</head>
<body class="blue-grey lighten-5" >
<nav class="blue-grey darken-4 z-depth-3" role="navigation" >
<div class="nav-wrapper container">
<a id="logo-container" href="/" class="brand-logo">Discord Bot</a>
<a id="logo-container" href="/" class="brand-logo">Claptrap Bot</a>
<ul class="right hide-on-med-and-down">
<li class="">
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
<li class="" th:classappend="(${page} == 'home')? 'active' : ''">
<a class="waves-effect waves-light" href="/">Home</a>
</li>
<li class="" >
<li class="" th:classappend="(${page} == 'music')? 'active' : ''">
<a class="waves-effect waves-light" href="/music">Music Control</a>
</li>
<li id="nav-bar-account">
<a class="dropdown-account" data-activates="dropdown1"><i class="material-icons">account_box</i></a>
<a class="dropdown-account dropdown-trigger" data-target="dropdown_connected"><i class="material-icons">account_box</i></a>
</li>
</ul>
<ul id="nav-mobile" class="side-nav">
<li class="center">
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
</div>
</nav>
<ul id="nav-mobile" class="sidenav">
<li class="center" th:classappend="(${page} == 'home')? 'active' : ''">
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
</li>
<li class="center">
<li class="center" th:classappend="(${page} == 'music')? 'active' : ''">
<a class="waves-effect waves-light" href="/music">Music Control</a>
</li>
@ -54,9 +59,11 @@
<li><a class="center red-text nav-disconnect" style="font-weight: bold">Disconnect</a></li>
</ul>
<a href="#" data-activates="nav-mobile" class="button-navbar-mobile button-collapse"><i class="material-icons">menu</i></a>
</div>
</nav>
<!-- Dropdown connected -->
<ul id="dropdown_connected" class="dropdown-content ">
@ -93,14 +100,16 @@
<div class="input-field col s6 offset-s3">
<i class="material-icons prefix">account_box</i>
<input name="username" id="user_input" type="text" class="validate"/>
<label for="user_input" data-error="User not registered!">User Name</label>
<label for="user_input" >User Name</label>
<span class="helper-text" data-error="User not registered!"></span>
</div>
</div>
<div class="row">
<div class="input-field col s6 offset-s3">
<i class="material-icons prefix">security</i>
<input name="password" id="password_input" type="password" class="validate"/>
<label for="password_input" data-error="Wrong password!">Password</label>
<label for="password_input">Password</label>
<span class="helper-text" data-error="Wrong password!"></span>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
@ -120,6 +129,34 @@
</div>
<!--________________________________________-->
<!-- Guild modal -->
<!--________________________________________-->
<div id="modal_guild" class="modal">
<div class="modal-content" style="padding-bottom: 0px">
<div class="row" style="margin-bottom: 0px">
<h3 class="col s12 center">Guild Selection</h3>
<div class="col offset-s4 s4 center">
<form id="guild_form" action="#" class="left-align">
</form>
</div>
</div>
</div>
<div class="modal-footer">
<a href="#" id="btn_ok_guild" class="modal-action modal-close waves-effect waves-green btn-flat disabled">Ok</a>
</div>
</div>
<p id="radioTemplateGuild" class="" style="visibility: hidden; display: none ">
<label>
<input name="guildRadio" class="with-gap" type="radio" value="@id" id="@id"/>
<span>@name</span>
</label>
</p>
<!--__________________________________________________________-->
<!-- -->
<!-- END -->

View File

@ -174,7 +174,7 @@ function getGuild(){
$('#guild_form').empty();
if(data.length === 1){
Cookies.set('guild', data.id, { expires: 31 });
Cookies.set('guild', data[0].id, { expires: 31 });
return;
}
data.forEach(function(element){

View File

@ -23,15 +23,7 @@
<!--__________________________________________________________-->
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" href="/" class="brand-logo">Discord Bot</a>
<ul class="right hide-on-med-and-down">
</ul>
<ul id="nav-mobile" class="side-nav">
</ul>
<a href="#" data-activates="nav-mobile" class="button-navbar-mobile button-collapse"><i class="material-icons">menu</i></a>
<a id="logo-container" href="/" class="brand-logo">Claptrap Bot</a>
</div>
</nav>