Translation and some change

This commit is contained in:
Sebastien 2018-12-04 18:06:04 +02:00
parent 196e61d6bb
commit 8dfd2324a6
6 changed files with 39 additions and 154 deletions

View File

@ -1,36 +0,0 @@
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

@ -42,7 +42,7 @@ public class Help implements Commande {
Commande cmdObj = MainBot.commandes.get(argsString);
if(!cmdObj.isAdminCmd() || isAdmin(event))
{
logger.info("Aide demmander pour la cmd "+argsString+" par "+event.getAuthor().getName());
logger.debug("Help for "+argsString+" by "+event.getAuthor().getName());
MessageEmbed messageEmbed;
try {
messageEmbed = EmbedMessageUtils.getHelp(argsString);
@ -55,24 +55,7 @@ public class Help implements Commande {
}
}
if(!event.isFromType(ChannelType.PRIVATE)) {
Message rest = event.getTextChannel().sendMessage(messageEmbed).complete();
if(args.length<=1)
{
Message finalRest = rest;
List<Message> messages = new ArrayList<Message>(){{
add(finalRest);
add(event.getMessage());
}};
new MessageTimeOut(messages,MainBot.messageTimeOut).start();
}
else if(!args[1].toLowerCase().equals("true")){
Message finalRest1 = rest;
List<Message> messages = new ArrayList<Message>(){{
add(finalRest1);
add(event.getMessage());
}};
new MessageTimeOut(messages,MainBot.messageTimeOut).start();
}
event.getTextChannel().sendMessage(messageEmbed).queue();
} else{
PrivateMessage.send(event.getAuthor(), messageEmbed,logger);
@ -109,7 +92,7 @@ public class Help implements Commande {
} else{
PrivateMessage.send(event.getAuthor(),EmbedMessageUtils.getUnknowCommand(),logger);
}
logger.info("Commande Inconnue!");
logger.debug("Unknown command!");
}
}
else
@ -142,7 +125,7 @@ public class Help implements Commande {
txt += nsfwTable.build();
if(!event.isFromType(ChannelType.PRIVATE)){
Message rest = event.getTextChannel().sendMessage(new EmbedBuilder().setTitle("Command envoyées par message privé").setColor(Color.green).build()).complete();
Message rest = event.getTextChannel().sendMessage(new EmbedBuilder().setTitle("Commands send by private message").setColor(Color.green).build()).complete();
new MessageTimeOut(MainBot.messageTimeOut, rest, event.getMessage()).start();
}

View File

@ -89,7 +89,6 @@ public class MainBot {
return;
}
//On verifie que la commande existe
if (commandes.containsKey(cmd.commande))
{
Commande cmdObj = commandes.get(cmd.commande);
@ -113,8 +112,7 @@ public class MainBot {
commandes.get(cmd.commande).action(cmd.args, cmd.event);
}
else{
Message msg = cmd.event.getTextChannel().sendMessage(cmd.event.getAuthor().getAsMention() + "\n:warning: **__Channel règlementé! Go sur over18!__**:warning: ").complete();
new MessageTimeOut(messageTimeOut, msg, cmd.event.getMessage()).start();
cmd.event.getMessage().delete().queue();
}
}
@ -130,36 +128,10 @@ public class MainBot {
new MessageTimeOut(gifMessageTimeOut, msg, cmd.event.getMessage()).start();
}
}
}
else
{
MessageReceivedEvent event = cmd.event;
if(commandes.size() == 0){
if(event.isFromType(ChannelType.PRIVATE))
event.getPrivateChannel().sendMessage("Loading please wait...").queue();
else {
Message message = event.getTextChannel().sendMessage("Loading please wait...").complete();
new MessageTimeOut(messageTimeOut, message, event.getMessage());
}
}
else{
if(event.isFromType(ChannelType.PRIVATE))
event.getPrivateChannel().sendMessage(EmbedMessageUtils.getUnknowCommand()).queue();
else {
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getUnknowCommand()).complete();
new MessageTimeOut(messageTimeOut, message, event.getMessage());
}
logger.warn("Commande inconnue");
}
else{
logger.debug("Unknown command : " + cmd.commande);
}
}
}

View File

@ -19,7 +19,7 @@ import java.time.format.DateTimeFormatter;
*/
public class EmbedMessageUtils {
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(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
return new EmbedBuilder().setTitle(":warning: Unknown command! :warning:").setDescription(":arrow_right: Use `//help` to see the available commands.").setColor(Color.orange).setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
}
@ -31,12 +31,12 @@ public class EmbedMessageUtils {
}
public static MessageEmbed getNoPrivate(){
EmbedBuilder temp = new EmbedBuilder().setTitle(":warning: Commande non disponible en privé! :warning:").setDescription(":arrow_right: Utilisez `//help` pour voirs les commandes disponible.").setColor(Color.red);
EmbedBuilder temp = new EmbedBuilder().setTitle(":warning: Command not available in private :warning:").setDescription(":arrow_right: Use `//help` to see the available commands.").setColor(Color.red);
return buildStandar(temp);
}
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(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).build();
return new EmbedBuilder().setTitle(":warning: Musique Error :warning:").setDescription(":arrow_right: "+message).setFooter("'//help music' for more info.",MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.red).setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).build();
}
@ -46,22 +46,22 @@ public class EmbedMessageUtils {
}
public static MessageEmbed getSpamExtermine(Member autor, int multi) {
return new EmbedBuilder().setTitle(":mute: Spam Hunter :mute:").setDescription(autor.getAsMention() + " détecté comme spammer !\n\nOn te revoit dans __**" + multi + "**__ min!").setImage("https://media.giphy.com/media/WVudyGEaizNeg/giphy.gif").setFooter("Spam info disponible via '//spaminfo' en privé", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setTimestamp(Instant.now()).setColor(Color.orange).setColor(Color.orange).build();
return new EmbedBuilder().setTitle(":mute: Spam Hunter :mute:").setDescription(autor.getAsMention() + " detected as spam !\n\nSee you in __**" + multi + "**__ minutes!").setImage("https://media.giphy.com/media/WVudyGEaizNeg/giphy.gif").setFooter("Spam info available with '//spaminfo' in private.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setTimestamp(Instant.now()).setColor(Color.orange).setColor(Color.orange).build();
}
public static MessageEmbed getSpamPardon(Member autor) {
return new EmbedBuilder().setTitle(":mute: Spam Hunter :mute:").setDescription(autor.getAsMention() + " est de retour, fais gaffe!\nJe te surveille!").setImage("https://media.giphy.com/media/3o7TKwBctlv08kY08M/giphy.gif").setFooter("Spam info disponible via '//spaminfo' en privé", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.orange).build();
return new EmbedBuilder().setTitle(":mute: Spam Hunter :mute:").setDescription(autor.getAsMention() + " is back retour, watch out!\nI'm watching you!").setImage("https://media.giphy.com/media/3o7TKwBctlv08kY08M/giphy.gif").setFooter("Spam info available with '//spaminfo' in private.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.orange).build();
}
public static MessageEmbed getHelp(String command) throws FileNotFoundException {
String name = command.substring(0, 1).toUpperCase() + command.substring(1).toLowerCase();
String message = new ResourceLoader().getFile("Help/"+name+"/fr/main.md");
String message = new ResourceLoader().getFile("Help/"+name+"/en/main.md");
EmbedBuilder temp = new EmbedBuilder().setTitle(":question: " + command.substring(0, 1).toUpperCase() + command.substring(1).toLowerCase() + " :question: ").setDescription(message).setColor(Color.green);
return buildStandar(temp);
}
public static MessageEmbed getMoveError(String message) {
return new EmbedBuilder().setTitle(":warning: Move Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help move' pour plus d'info ", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
return new EmbedBuilder().setTitle(":warning: Move Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help move' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
}
public static MessageEmbed getMoveOk(String message) {
@ -70,20 +70,20 @@ public class EmbedMessageUtils {
}
public static MessageEmbed getSpamError(String message) {
return new EmbedBuilder().setTitle(":warning: Spam Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help spam' pour plus d'info ", MainBot.jda.getSelfUser().getAvatarUrl()).build();
return new EmbedBuilder().setTitle(":warning: Spam Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help spam' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).build();
}
public static MessageEmbed getSpamError(String message, String sub) {
return new EmbedBuilder().setTitle(":warning: Spam Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help spam "+sub+"' pour plus d'info ", MainBot.jda.getSelfUser().getAvatarUrl()).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
return new EmbedBuilder().setTitle(":warning: Spam Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help spam "+sub+"' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
}
public static MessageEmbed getSpamInfo(String message) {
EmbedBuilder temp = new EmbedBuilder().setTitle(":hourglass: Spam Info :hourglass:").setDescription(message).setColor(Color.green);
EmbedBuilder temp = new EmbedBuilder().setTitle(":hourglass: Spam Info :hourglass:").setDescription(message).setColor(Color.green);
return buildStandar(temp);
}
public static MessageEmbed getFlushError(String message) {
return new EmbedBuilder().setTitle(":warning: Flush Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help flush' pour plus d'info ", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
return new EmbedBuilder().setTitle(":warning: Flush Error :warning: ").setDescription(message).setColor(Color.red).setFooter("'//help flush' for more info. ", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
}
public static MessageEmbed getRegister(String message) {
@ -91,7 +91,7 @@ public class EmbedMessageUtils {
}
public static MessageEmbed getInternalError(){
return buildStandar(getError("Je... Je... je ne me sens pas bien... :thermometer_face: \nContactez vite mon developeur!").setImage("https://i.imgur.com/anKv8U5.gif"));
return buildStandar(getError("I... I... I don't feel so good ~~mr stark~~... :thermometer_face: \nPlease contact my developer!").setImage("https://i.imgur.com/anKv8U5.gif"));
}
public static MessageEmbed buildStandar(EmbedBuilder embedBuilder){
@ -99,30 +99,13 @@ public class EmbedMessageUtils {
}
public static MessageEmbed getUnautorized(){
return buildStandar(getError("Vous n'avez pas l'autorisation de faire ça!").setImage("https://i.imgur.com/0OSsdvW.gif"));
return buildStandar(getError("You're not powerful enough to do that slave !").setImage("https://i.imgur.com/0OSsdvW.gif"));
}
public static MessageEmbed getHelpList(String role, String list) throws FileNotFoundException {
String message = new ResourceLoader().getFile("Help/main.md");
message = message.replace("@list", list);
return new EmbedBuilder().setTitle("Command du bot ("+role+")").setDescription(message).setFooter("Utilise '//help <commande>' pour plus de détails.",MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.green).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).build();
}
public static MessageEmbed getPref(GuildPreferenceEntity guildPref){
EmbedBuilder messageB = new EmbedBuilder()
.setColor(Color.green)
.setTitle("**Guild config**")
.setDescription("_This is the current config of bot for this Guild_")
.addField("> Guild ID", "This is the curent guild ID\n```java\n" + guildPref.getGuildId() + "```Edit: :lock:", false)
.addField("> Anti Spam", "Activate Spam hunter\n```java\n" + String.valueOf(guildPref.isAntiSpam()) + "```Edit: :unlock:\nKey: anti_spam", false)
.addField("> Default Role", "Activate auto move to default role\n```java\n" + String.valueOf(guildPref.isDefaultRole()) + "```Edit: :unlock:\nKey: default_role", false)
.addField("> Default Role ID", "Role id for auto move\n```java\n" + guildPref.getDefaultRoleId() + "```Edit: :unlock:\nKey: default_role_id", false)
.addField("> Welcome", "Activate welcome message\n```java\n" + String.valueOf(guildPref.isWelcome()) + "```Edit: :unlock:\nKey: welcome", false)
.addField("> Welcome chanel ID", "Chane id for welcome message\n```" + guildPref.getWelcomeChanelID() + "```Edit: :unlock:\nKey: welcome_chanel_id", false)
.addField("> Welcome message", "Welcome message (@name for mention)\n```markdown\n" + guildPref.getWelcomeMessage() + "```Edit: :unlock:\nKey: welcome_message", false)
.addField("> Daily Madame", "Activate daily madame message\n```java\n" + String.valueOf(guildPref.isDailyMadame()) + "```Edit: :unlock:\nKey: daily_madame", false);
return buildStandar(messageB);
return new EmbedBuilder().setTitle("Bot Command ("+role+")").setDescription(message).setFooter("Use '//help <command>' for more info",MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).setColor(Color.green).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).build();
}
public static MessageEmbed searchResult(SearchResult result){

View File

@ -89,8 +89,7 @@ public class AudioM {
public void trackLoaded(AudioTrack track) {
logger.info("Single Track detected!");
UserAudioTrack uat = new UserAudioTrack(event.getAuthor(), track);
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Ajout de "+track.getInfo().title+" à la file d'attente!")).complete();
new MessageTimeOut(MainBot.messageTimeOut, message, event.getMessage()).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Add "+track.getInfo().title+" to playlist")).queue();
play(guild, voiceChannel, musicManager, uat, onHead);
}
@ -100,8 +99,8 @@ public class AudioM {
logger.info("Playlist detected! Limit: "+playlistLimit);
AudioTrack firstTrack = playlist.getSelectedTrack();
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Ajout de "+firstTrack.getInfo().title+" et les 30 premiers titres à la file d'attente!")).complete();
new MessageTimeOut(MainBot.messageTimeOut, message, event.getMessage()).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Add "+firstTrack.getInfo().title+" and 30 first videos to playlist !")).queue();
playListLoader(playlist, playlistLimit ,event.getAuthor() , onHead);
@ -112,24 +111,15 @@ public class AudioM {
@Override
public void noMatches() {
logger.warn("Cant find media!");
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Musique introuvable!")).complete();
List<Message> messages = new ArrayList<Message>(){{
add(message);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Video not found !")).queue();
}
@Override
public void loadFailed(FriendlyException exception) {
logger.error("Cant load media!");
logger.error(exception.getMessage());
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Erreur de lecture!")).complete();
List<Message> messages = new ArrayList<Message>(){{
add(message);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Playback error !")).queue();
}
});
}
@ -222,8 +212,7 @@ public class AudioM {
public void skipTrack(MessageReceivedEvent event) {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.nextTrack();
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Musique suivante!")).complete();
new MessageTimeOut(MainBot.messageTimeOut, message, event.getMessage()).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Next music!")).queue();
}
/**
@ -234,8 +223,8 @@ public class AudioM {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.pause();
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Musique en pause !")).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Music paused")).queue();
}
@ -247,8 +236,7 @@ public class AudioM {
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.resume();
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Reprise de la piste en cour !")).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Music resumed")).queue();
}
/**
@ -260,15 +248,13 @@ public class AudioM {
AudioTrackInfo info = musicManager.scheduler.getInfo();
UserAudioTrack userAudioTrack = musicManager.scheduler.getCurrentPlayingTrack();
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk(info.title + "\n" + info.uri + "\nSubmitted by: " + userAudioTrack.getSubmittedUser().getName())).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk(info.title + "\n" + info.uri + "\nSubmitted by: " + userAudioTrack.getSubmittedUser().getName())).queue();
}
public void flush(MessageReceivedEvent event){
GuildMusicManager musicManager = getGuildAudioPlayer();
musicManager.scheduler.flush();
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("RAZ de la playlist!")).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Flush playlist!")).queue();
}
/**
@ -280,7 +266,7 @@ public class AudioM {
List<UserAudioTrackData> list = musicManager.scheduler.getList();
StringBuilder resp = new StringBuilder();
if(list.size() == 0){
resp.append("Oh mon dieux!\nElle est vide! \n:astonished: ");
resp.append("Oh my god!\nThe playlist is empty ! \n:astonished: ");
}
else
{
@ -290,8 +276,7 @@ public class AudioM {
resp.append("\n");
}
}
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Playlist:\n\n"+resp.toString())).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Playlist:\n\n"+resp.toString())).queue();
}
/**
@ -307,8 +292,7 @@ public class AudioM {
}
else
{
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Aucune lecture en cour!")).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Not connected to vocal chanel !")).queue();
}
}
@ -321,8 +305,7 @@ public class AudioM {
musicManager.scheduler.flush();
if (event != null) {
Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Arret de la musique!")).complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), message).start();
event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicOk("Music stopped")).queue();
}
}

View File

@ -1,7 +1,7 @@
```
@list
```
_PU = Private Usable (Utilisable en Message Privée)_
_PU = Private Usable
**>** __**[Web UI](https://claptrapbot.com )**__ :arrow_right: Music control, General server info (Coming soon)
**>** __**[Web UI](https://claptrapbot.com )**__ :arrow_right: Music control, Settings, News