Change bot url
This commit is contained in:
parent
b41dc8c8ca
commit
0e32ee10db
@ -200,7 +200,7 @@ public class BotListener extends ListenerAdapter {
|
|||||||
EmbedBuilder eb = new EmbedBuilder().setColor(Color.GREEN)
|
EmbedBuilder eb = new EmbedBuilder().setColor(Color.GREEN)
|
||||||
.setTitle("Hello there !")
|
.setTitle("Hello there !")
|
||||||
.setDescription("Allow me to introduce myself -- I am a CL4P-TP the discord bot, but my friends call me Claptrap ! Or they would, if any of them were real...\n"+
|
.setDescription("Allow me to introduce myself -- I am a CL4P-TP the discord bot, but my friends call me Claptrap ! Or they would, if any of them were real...\n"+
|
||||||
"\nYou can access to my web UI with: https://bot.seb6596.ovh")
|
"\nYou can access to my web UI with: " + MainBot.url)
|
||||||
.setImage("https://i.imgur.com/Anf1Srg.gif");
|
.setImage("https://i.imgur.com/Anf1Srg.gif");
|
||||||
|
|
||||||
event.getGuild().getDefaultChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
event.getGuild().getDefaultChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
||||||
|
@ -37,39 +37,11 @@ public class Settings implements Commande {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void action(String[] args, MessageReceivedEvent event) {
|
public void action(String[] args, MessageReceivedEvent event) {
|
||||||
if(args.length == 0){
|
|
||||||
GuildPreferenceEntity guildPref = SettingsUtils.getInstance().getPreference(event.getGuild());
|
|
||||||
MessageEmbed message = EmbedMessageUtils.getPref(guildPref);
|
|
||||||
event.getTextChannel().sendMessage(message).complete();
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
switch (args[0]){
|
|
||||||
case "set":
|
|
||||||
if(args.length >= 3){
|
|
||||||
StringBuilder val = new StringBuilder();
|
|
||||||
for(int i = 2; i < args.length; i++){
|
|
||||||
val.append(args[i]).append(" ");
|
|
||||||
}
|
|
||||||
set(event, args[1], val.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
else{
|
|
||||||
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("Missing argument.\n:arrow_right: Please use `//help preference`"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nUnknown argument`\n\nMore info with `//help preference`"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
EmbedBuilder builder = new EmbedBuilder()
|
||||||
|
.setTitle("Settings")
|
||||||
|
.setDescription("You can do all the configuration on this web ender the \"Bot Settings\" menu.\nhttps://"+MainBot.url).setColor(Color.green);
|
||||||
|
event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(builder)).queue();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -88,123 +60,4 @@ public class Settings implements Commande {
|
|||||||
public boolean isNSFW() {
|
public boolean isNSFW() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void set(MessageReceivedEvent event, String key, String value){
|
|
||||||
GuildPreferenceEntity pref = SettingsUtils.getInstance().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);
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder eb = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Anti Spam", "```java\n" + String.valueOf(pref.isAntiSpam()) + "```", false).setColor(Color.green);
|
|
||||||
Message sended = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
|
||||||
}else{
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nWrong value, expect `true` or `false`\n\nMore info with `//help preference`"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case "default_role":
|
|
||||||
value = value.replaceAll(" ", "");
|
|
||||||
if(value.toLowerCase().equals("true") || value.toLowerCase().equals("false")){
|
|
||||||
boolean result = Boolean.parseBoolean(value);
|
|
||||||
pref.setDefaultRole(result);
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder eb = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Default Role", "```java\n" + String.valueOf(pref.isDefaultRole()) + "```", false).setColor(Color.green);
|
|
||||||
Message sended = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
|
||||||
}else{
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nWrong value, expect `true` or `false`\n\nMore info with `//help preference`"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "default_role_id":
|
|
||||||
try{
|
|
||||||
value = value.replaceAll(" ", "");
|
|
||||||
Role role = event.getGuild().getRoleById(value);
|
|
||||||
if(role != null){
|
|
||||||
pref.setDefaultRoleId(role.getId());
|
|
||||||
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder eb = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Default Role ID", "```java\n" + pref.getDefaultRoleId()+ "```", false).setColor(Color.green);
|
|
||||||
Message sended = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new NumberFormatException();
|
|
||||||
}
|
|
||||||
}catch (NumberFormatException e){
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nRole not found!\n\nUse `//listroles` to get roles id"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "welcome":
|
|
||||||
value = value.replaceAll(" ", "");
|
|
||||||
if(value.toLowerCase().equals("true") || value.toLowerCase().equals("false")){
|
|
||||||
boolean result = Boolean.parseBoolean(value);
|
|
||||||
pref.setWelcome(result);
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder eb = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Welcome", "```java\n" + String.valueOf(pref.isWelcome()) + "```", false).setColor(Color.green);
|
|
||||||
Message sended = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
|
||||||
}else{
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nWrong value, expect `true` or `false`\n\nMore info with `//help preference`"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "welcome_chanel_id":
|
|
||||||
try{
|
|
||||||
value = value.replaceAll(" ", "");
|
|
||||||
TextChannel chanel = event.getGuild().getTextChannelById(value);
|
|
||||||
if(chanel != null){
|
|
||||||
pref.setWelcomeChanelID(chanel.getId());
|
|
||||||
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder eb = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Welcome chanel ID", "```java\n" + pref.getWelcomeChanelID() + "```", false).setColor(Color.green);
|
|
||||||
Message sended = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new NumberFormatException();
|
|
||||||
}
|
|
||||||
}catch (NumberFormatException e){
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nText channel not found!\n\nUse `//listroles` to get roles id"));
|
|
||||||
Message sended = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "welcome_message":
|
|
||||||
pref.setWelcomeMessage(value);
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder eb = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Welcome message", "```java\n" + pref.getWelcomeMessage() + "```", false).setColor(Color.green);
|
|
||||||
Message sended = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(eb)).complete();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "daily_madame":
|
|
||||||
value = value.replaceAll(" ", "");
|
|
||||||
if(value.toLowerCase().equals("true") || value.toLowerCase().equals("false")){
|
|
||||||
boolean result = Boolean.parseBoolean(value);
|
|
||||||
pref.setDailyMadame(result);
|
|
||||||
pref = guildPreferenceRepository.save(pref);
|
|
||||||
EmbedBuilder ebd = new EmbedBuilder().addField(":ok: Ok :ok:","",false).addField("> Daily Madame", "Activate daily madame message\n```java\n" + String.valueOf(value) + "```", false).setColor(Color.green);
|
|
||||||
Message sendedm = event.getTextChannel().sendMessage(EmbedMessageUtils.buildStandar(ebd)).complete();
|
|
||||||
}else{
|
|
||||||
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nWrong value, expect `true` or `false`\n\nMore info with `//help preference`"));
|
|
||||||
Message sendedm = event.getTextChannel().sendMessage(msg).complete();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
MessageEmbed msg2 = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nUnknown id.\n\nUse `//preference` to see list"));
|
|
||||||
Message sended2 = event.getTextChannel().sendMessage(msg2).complete();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class Init {
|
|||||||
dayListener.addListener(new DailyMadame());
|
dayListener.addListener(new DailyMadame());
|
||||||
dayListener.start();
|
dayListener.start();
|
||||||
jda.addEventListener(new BotListener());
|
jda.addEventListener(new BotListener());
|
||||||
jda.getPresence().setPresence(OnlineStatus.ONLINE, Game.playing("bot.seb6596.ovh"));
|
jda.getPresence().setPresence(OnlineStatus.ONLINE, Game.playing(MainBot.url));
|
||||||
logger.info("-----------------------END INIT-----------------------");
|
logger.info("-----------------------END INIT-----------------------");
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ public class MainBot {
|
|||||||
public static boolean ready = false;
|
public static boolean ready = false;
|
||||||
public static boolean dev = false;
|
public static boolean dev = false;
|
||||||
|
|
||||||
|
public static String url= "claptrapbot.com";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import java.time.format.DateTimeFormatter;
|
|||||||
*/
|
*/
|
||||||
public class EmbedMessageUtils {
|
public class EmbedMessageUtils {
|
||||||
public static MessageEmbed getUnknowCommand() {
|
public static MessageEmbed getUnknowCommand() {
|
||||||
return new EmbedBuilder().setTitle(":warning: Commande inconnue! :warning:").setDescription(":arrow_right: Utilisez `//help` pour voirs les commandes disponible.").setColor(Color.orange).setFooter("bot.seb6596.ovh", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
|
return new EmbedBuilder().setTitle(":warning: Commande inconnue! :warning:").setDescription(":arrow_right: Utilisez `//help` pour voirs les commandes disponible.").setColor(Color.orange).setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class EmbedMessageUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MessageEmbed getMusicError(String message){
|
public static MessageEmbed getMusicError(String message){
|
||||||
return new EmbedBuilder().setTitle(":warning: Musique Error :warning:").setDescription(":arrow_right: "+message).setFooter("'//help music' pour plus d'info",MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.red).setFooter("bot.seb6596.ovh", MainBot.jda.getSelfUser().getAvatarUrl()).build();
|
return new EmbedBuilder().setTitle(":warning: Musique Error :warning:").setDescription(":arrow_right: "+message).setFooter("'//help music' pour plus d'info",MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.red).setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class EmbedMessageUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MessageEmbed buildStandar(EmbedBuilder embedBuilder){
|
public static MessageEmbed buildStandar(EmbedBuilder embedBuilder){
|
||||||
return embedBuilder.setFooter("bot.seb6596.ovh", MainBot.jda.getSelfUser().getAvatarUrl()).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
|
return embedBuilder.setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MessageEmbed getUnautorized(){
|
public static MessageEmbed getUnautorized(){
|
||||||
|
@ -32,7 +32,7 @@ public class Oauth {
|
|||||||
URL myUrl = new URL(httpsURL);
|
URL myUrl = new URL(httpsURL);
|
||||||
HttpURLConnection con = (HttpURLConnection)myUrl.openConnection();
|
HttpURLConnection con = (HttpURLConnection)myUrl.openConnection();
|
||||||
con.setRequestProperty("Authorization", "Bearer "+token);
|
con.setRequestProperty("Authorization", "Bearer "+token);
|
||||||
con.setRequestProperty("User-Agent", "DiscordBot (bot.seb6596.ovh, 0.1)");
|
con.setRequestProperty("User-Agent", "DiscordBot (claptrapbot.com, 0.1)");
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
logger.debug("Response code: " + con.getResponseCode());
|
logger.debug("Response code: " + con.getResponseCode());
|
||||||
BufferedReader in = new BufferedReader(
|
BufferedReader in = new BufferedReader(
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
```
|
```
|
||||||
_PU = Private Usable (Utilisable en Message Privée)_
|
_PU = Private Usable (Utilisable en Message Privée)_
|
||||||
|
|
||||||
**>** __**[Web UI](https://bot.seb6596.ovh )**__ :arrow_right: Music control, General server info (Coming soon)
|
**>** __**[Web UI](https://claptrapbot.com )**__ :arrow_right: Music control, General server info (Coming soon)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user