Migrate clear slashcommand

This commit is contained in:
SebClem 2022-05-15 18:39:46 +02:00
parent 9517a0a318
commit 872dde7695
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
83 changed files with 21823 additions and 23135 deletions

View File

@ -1,6 +1,7 @@
<p align="center"><img alt="discord" src="https://claptrapbot.com/favicon.png" width="150"/></p> <p align="center"><img alt="discord" src="https://claptrapbot.com/favicon.png" width="150"/></p>
# ClaptrapBot: A multifunctional Discord Bot ! # ClaptrapBot: A multifunctional Discord Bot !
[![GitHub Release][releases-shield]][releases] [![GitHub Release][releases-shield]][releases]
![Project Stage][project-stage-shield] ![Project Stage][project-stage-shield]
[![License][license-shield]](LICENSE.md) [![License][license-shield]](LICENSE.md)
@ -9,16 +10,20 @@
![Project Maintenance][maintenance-shield] ![Project Maintenance][maintenance-shield]
[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] [![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
## About ## About
ClaptrapBot is a Discord bot. (No way! :open_mouth:) ClaptrapBot is a Discord bot. (No way! :open_mouth:)
### Features: ### Features:
- :notes: Music bot with a cool web control interface ! - :notes: Music bot with a cool web control interface !
- :bar_chart: Rank and Stats ! (Text and voice) - :bar_chart: Rank and Stats ! (Text and voice)
- :heart_eyes: NSFW Commands ! (With a daily surprise :kissing_heart:) - :heart_eyes: NSFW Commands ! (With a daily surprise :kissing_heart:)
- :hammer_and_pick: Moderation commands ! - :hammer_and_pick: Moderation commands !
You can add the bot to your server from the home page: https://claptrapbot.com/ You can add the bot to your server from the home page: https://claptrapbot.com/
## Authors & contributors ## Authors & contributors
The original development is by [SebClem][Sebclem]. The original development is by [SebClem][Sebclem].
@ -55,19 +60,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
[license-shield]: https://img.shields.io/github/license/Sebclem/ClaptrapBot.svg [license-shield]: https://img.shields.io/github/license/Sebclem/ClaptrapBot.svg
[build-badge]: https://img.shields.io/github/workflow/status/Sebclem/ClaptrapBot/Build [build-badge]: https://img.shields.io/github/workflow/status/Sebclem/ClaptrapBot/Build
[maintenance-shield]: https://img.shields.io/maintenance/yes/2020.svg [maintenance-shield]: https://img.shields.io/maintenance/yes/2020.svg
[project-stage-shield]: https://img.shields.io/badge/project%20stage-Beta-red.svg [project-stage-shield]: https://img.shields.io/badge/project%20stage-Beta-red.svg
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg [buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg
[buymeacoffee]: https://www.buymeacoffee.com/seb6596 [buymeacoffee]: https://www.buymeacoffee.com/seb6596
[issue]: https://github.com/hassio-addons/addon-log-viewer/issues [issue]: https://github.com/hassio-addons/addon-log-viewer/issues
[releases-shield]: https://img.shields.io/github/release/Sebclem/ClaptrapBot.svg?include_prereleases [releases-shield]: https://img.shields.io/github/release/Sebclem/ClaptrapBot.svg?include_prereleases
[releases]: https://github.com/Sebclem/ClaptrapBot/releases [releases]: https://github.com/Sebclem/ClaptrapBot/releases
[Sebclem]: https://github.com/Sebclem [Sebclem]: https://github.com/Sebclem
[alex]: https://github.com/Alexandre064 [alex]: https://github.com/Alexandre064
[Aeka]: https://twitter.com/Le_aeka [Aeka]: https://twitter.com/Le_aeka
[contributors]: https://github.com/Sebclem/ClaptrapBot/graphs/contributors [contributors]: https://github.com/Sebclem/ClaptrapBot/graphs/contributors

View File

@ -21,27 +21,25 @@ repositories {
url 'https://m2.dv8tion.net/releases' url 'https://m2.dv8tion.net/releases'
} }
} }
jar{ jar {
enabled(false) enabled(false)
} }
dependencies { dependencies {
implementation("org.springframework.boot:spring-boot-starter-web"){ implementation("org.springframework.boot:spring-boot-starter-web") {
exclude group:"org.springframework.boot", module: "spring-boot-starter-logging" exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
} }
implementation("org.springframework.boot:spring-boot-starter-log4j2") implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation 'org.codehaus.groovy:groovy-all:3.0.8' implementation 'org.codehaus.groovy:groovy-all:3.0.8'
implementation 'com.sedmelluq:lavaplayer:1.3.77' implementation 'com.sedmelluq:lavaplayer:1.3.77'
implementation 'net.dv8tion:JDA:4.4.0_350' implementation 'net.dv8tion:JDA:4.4.0_350'
implementation group: 'org.json', name: 'json', version: '20210307' implementation group: 'org.json', name: 'json', version: '20210307'
implementation 'org.springframework.security:spring-security-web:5.5.0' implementation 'org.springframework.security:spring-security-web:5.5.0'
// JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) // JPA Data (We are going to use Repositories, Entities, Hibernate, etc...)
implementation("org.springframework.boot:spring-boot-starter-data-jpa") { implementation("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group:"org.springframework.boot", module: "spring-boot-starter-logging" exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
} }
implementation(platform("org.apache.logging.log4j:log4j-bom:2.17.1")) implementation(platform("org.apache.logging.log4j:log4j-bom:2.17.1"))
// Use MySQL Connector-J // Use MySQL Connector-J
@ -56,7 +54,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") { implementation("org.springframework.boot:spring-boot-starter-thymeleaf") {
exclude group:"org.springframework.boot", module: "spring-boot-starter-logging" exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
} }
} }
@ -65,7 +63,7 @@ class Version {
static String getBuild() { static String getBuild() {
System.getenv("GITHUB_RUN_NUMBER") ?: System.getProperty("BUILD_NUMBER") ?: System.getenv("GITHUB_RUN_NUMBER") ?: System.getProperty("BUILD_NUMBER") ?:
System.getenv("GIT_COMMIT")?.substring(0, 7) ?: System.getProperty("GIT_COMMIT")?.substring(0, 7) ?:"DEV" System.getenv("GIT_COMMIT")?.substring(0, 7) ?: System.getProperty("GIT_COMMIT")?.substring(0, 7) ?: "DEV"
} }
String toString() { String toString() {

View File

@ -1,16 +1,17 @@
package net.Broken; package net.Broken;
import net.Broken.Commands.Move;
import net.Broken.DB.Entity.GuildPreferenceEntity; import net.Broken.DB.Entity.GuildPreferenceEntity;
import net.Broken.DB.Entity.UserEntity;
import net.Broken.DB.Repository.GuildPreferenceRepository; import net.Broken.DB.Repository.GuildPreferenceRepository;
import net.Broken.DB.Repository.UserRepository; import net.Broken.Tools.AutoVoiceChannel;
import net.Broken.Tools.*; import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.Command.CommandParser;
import net.Broken.Tools.UserManager.Stats.UserStatsUtils; import net.Broken.Tools.UserManager.Stats.UserStatsUtils;
import net.Broken.audio.AudioM; import net.Broken.audio.AudioM;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.ReadyEvent; import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.events.guild.GuildJoinEvent; import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent; import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
@ -20,16 +21,13 @@ import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent;
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent; import net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.managers.GuildManager;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -38,84 +36,59 @@ import java.util.List;
* Bot Listener * Bot Listener
*/ */
public class BotListener extends ListenerAdapter { public class BotListener extends ListenerAdapter {
private AntiSpam antispam = new AntiSpam(); private final GuildPreferenceRepository guildPreferenceRepository;
private Moderateur modo = new Moderateur();
private GuildPreferenceRepository guildPreferenceRepository; private final Logger logger = LogManager.getLogger();
private UserRepository userRepository;
private Logger logger = LogManager.getLogger();
public BotListener() { public BotListener() {
ApplicationContext context = SpringContext.getAppContext(); ApplicationContext context = SpringContext.getAppContext();
guildPreferenceRepository = (GuildPreferenceRepository) context.getBean("guildPreferenceRepository"); guildPreferenceRepository = (GuildPreferenceRepository) context.getBean("guildPreferenceRepository");
userRepository = (UserRepository) context.getBean("userRepository");
} }
@Override @Override
public void onReady(ReadyEvent event) { public void onReady(ReadyEvent event) {
logger.info("Connection succees"); logger.info("Connection success");
} }
@Override @Override
public void onGuildMemberJoin(GuildMemberJoinEvent event) { public void onGuildMemberJoin(GuildMemberJoinEvent event) {
GuildPreferenceEntity guildPref = getPreference(event.getGuild()); GuildPreferenceEntity guildPref = getPreference(event.getGuild());
if (guildPref.isDefaultRole()) { if (guildPref.isDefaultRole()) {
logger.info("[" + event.getGuild().getName() + "] : " + event.getUser().getName() + " join the guild, adding default role !");
logger.info(event.getUser().getName() + "join the guild, move it!"); Role default_role = event.getGuild().getRoleById(guildPref.getDefaultRoleId());
if (default_role != null) {
List<Role> roles = new ArrayList<>(); event.getGuild().addRoleToMember(event.getMember(), default_role).queue();
roles.add(event.getGuild().getRoleById(guildPref.getDefaultRoleId())); } else {
logger.fatal("[" + event.getGuild().getName() + "] : Default role is null !");
}
new Move().exc(event.getMember(), roles, false, event.getGuild(), event.getGuild().getManager());
} }
if (guildPref.isWelcome()) { if (guildPref.isWelcome()) {
TextChannel chanel = event.getGuild().getTextChannelById(guildPref.getWelcomeChanelID()); TextChannel chanel = event.getGuild().getTextChannelById(guildPref.getWelcomeChanelID());
if (chanel != null) { if (chanel != null) {
String message = guildPref.getWelcomeMessage(); String message = guildPref.getWelcomeMessage().replaceAll("@name", event.getMember().getAsMention());
message = message.replaceAll("@name", event.getMember().getAsMention());
logger.debug(message); logger.debug(message);
chanel.sendMessage(message).complete(); chanel.sendMessage(message).queue();
}else {
logger.fatal("[" + event.getGuild().getName() + "] : Welcome chanel is null !");
} }
MainBot.roleFlag = false;
} }
} }
@Override @Override
public void onGuildMemberRoleRemove(GuildMemberRoleRemoveEvent event) { public void onGuildMemberRoleRemove(GuildMemberRoleRemoveEvent event) {
GuildPreferenceEntity guildPref = getPreference(event.getGuild()); GuildPreferenceEntity guildPref = getPreference(event.getGuild());
if (guildPref.isDefaultRole()) { if (guildPref.isDefaultRole()) {
if (!MainBot.roleFlag) {
if (event.getMember().getRoles().size() == 0) { if (event.getMember().getRoles().size() == 0) {
logger.info("[" + event.getGuild().getName() + "] : " + event.getUser().getName() + " have no roles, reset to default !");
logger.info(event.getUser().getName() + "have no roles, move it!"); Role default_role = event.getGuild().getRoleById(guildPref.getDefaultRoleId());
List<Role> roles = new ArrayList<>(); if (default_role == null) {
roles.add(event.getGuild().getRoleById(guildPref.getDefaultRoleId())); logger.fatal("[" + event.getGuild().getName() + "] : Default role is null !");
return;
new Move().exc(event.getMember(), roles, false, event.getGuild(), event.getGuild().getManager());
MainBot.roleFlag = false;
} }
} else { event.getGuild().addRoleToMember(event.getMember(), default_role).queue();
logger.debug("ignore it");
MainBot.roleFlag = false;
} }
} }
@ -163,66 +136,16 @@ public class BotListener extends ListenerAdapter {
@Override @Override
public void onMessageReceived(MessageReceivedEvent event) { public void onMessageReceived(MessageReceivedEvent event) {
if (!event.getAuthor().isBot()) { if (!event.getAuthor().isBot()) {
UserStatsUtils.getINSTANCE().addMessageCount(event.getMember()); UserStatsUtils.getINSTANCE().addMessageCount(event.getMember());
} }
try {
if (event.getMessage().getContentRaw().startsWith("//") && !event.getMessage().getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
//On a detecter que c'etait une commande
//System.out.println(event.getMessage().getContent());
List<UserEntity> users = userRepository.findByJdaId(event.getAuthor().getId());
UserEntity user = users.size() == 0 ? null : users.get(0);
MainBot.handleCommand(new CommandParser().parse(event.getMessage().getContentRaw(), event), user);
} else if (!event.getMessage().getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
if (!event.isFromType(ChannelType.PRIVATE)) {
Guild serveur = event.getGuild();
GuildPreferenceEntity guildPref = getPreference(serveur);
if (!guildPref.isAntiSpam())
return;
try {
GuildManager guildManager = serveur.getManager();
Member user = event.getMember();
// appel de la methode d'analyse de message de "Moderateur"
if (event.getMessage().getContentRaw().length() > 0) {
if (modo.analyse(user, serveur, guildManager, event) == 1) {
antispam.extermine(user, serveur, guildManager, true, event);
}
} else if (event.getMessage().getContentRaw().length() == 0)
logger.error("Image detected, ignoring it.");
} catch (InsufficientPermissionException e) {
logger.warn("Insufficient permission for guild " + e.getGuild(MainBot.jda).getName() + " Missing " + e.getPermission() + " permission.");
}
}
}
} catch (Exception e) {
logger.catching(e);
if (event.isFromType(ChannelType.PRIVATE))
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getInternalError(), logger);
else
event.getTextChannel().sendMessage(EmbedMessageUtils.getInternalError()).queue();
}
} }
@Override @Override
public void onSlashCommand(@NotNull SlashCommandEvent event) { public void onSlashCommand(@NotNull SlashCommandEvent event) {
HashMap<String, SlashCommand> commands = MainBot.slashCommands; HashMap<String, SlashCommand> commands = MainBot.slashCommands;
super.onSlashCommand(event); super.onSlashCommand(event);
if(commands.containsKey(event.getName())){ if (commands.containsKey(event.getName())) {
commands.get(event.getName()).action(event); commands.get(event.getName()).action(event);
} }
} }
@ -237,14 +160,15 @@ public class BotListener extends ListenerAdapter {
.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: " + MainBot.url) "\nYou can access to my web UI with: " + MainBot.url)
.setImage("https://i.imgur.com/Anf1Srg.gif"); .setImage("https://i.imgur.com/Anf1Srg.gif");
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.buildStandar(eb)).build();
TextChannel defaultChan = event.getGuild().getDefaultChannel(); TextChannel defaultChan = event.getGuild().getDefaultChannel();
if (defaultChan != null && defaultChan.canTalk()) if (defaultChan != null && defaultChan.canTalk()) {
defaultChan.sendMessage(EmbedMessageUtils.buildStandar(eb)).queue(); defaultChan.sendMessage(message).queue();
else { } else {
for(TextChannel chan : event.getGuild().getTextChannels()){ for (TextChannel chan : event.getGuild().getTextChannels()) {
if(chan.canTalk()){ if (chan.canTalk()) {
chan.sendMessage(EmbedMessageUtils.buildStandar(eb)).queue(); chan.sendMessage(message).queue();
} }
} }
} }
@ -254,9 +178,9 @@ public class BotListener extends ListenerAdapter {
List<GuildPreferenceEntity> guildPrefList = guildPreferenceRepository.findByGuildId(guild.getId()); List<GuildPreferenceEntity> guildPrefList = guildPreferenceRepository.findByGuildId(guild.getId());
GuildPreferenceEntity guildPref; GuildPreferenceEntity guildPref;
if (guildPrefList.isEmpty()) { if (guildPrefList.isEmpty()) {
logger.info("Generate default pref"); logger.info("[" + guild.getName() + "] : Generate default pref");
guildPref = GuildPreferenceEntity.getDefault(guild); guildPref = GuildPreferenceEntity.getDefault(guild);
guildPreferenceRepository.save(guildPref); guildPref = guildPreferenceRepository.save(guildPref);
} else } else
guildPref = guildPrefList.get(0); guildPref = guildPrefList.get(0);
return guildPref; return guildPref;

View File

@ -1,71 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
/**
* Command that return a random picture of cat.
*/
public class Cat implements Commande {
@Override
public void action(String[] args, MessageReceivedEvent event) {
if (!event.isFromType(ChannelType.PRIVATE)) {
try {
URL urlC = new URL("http://aws.random.cat/meow");
URLConnection yc = urlC.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream(), "UTF-8"));
String inputLine;
StringBuilder a = new StringBuilder();
while ((inputLine = in.readLine()) != null)
a.append(inputLine);
in.close();
JSONObject json = new JSONObject(a.toString());
event.getTextChannel().sendMessage(json.getString("file")).queue();
} catch (IOException e) {
e.printStackTrace();
}
} else
event.getPrivateChannel().sendMessage("\n:warning: **__This command cannot be used there !__** :warning:").queue();
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -1,94 +0,0 @@
package net.Broken.Commands;
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
import net.Broken.Commande;
import net.Broken.DB.Repository.UserRepository;
import net.Broken.SpringContext;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationContext;
import java.awt.*;
public class Code implements Commande {
private UserRepository userRepository;
private Logger logger = LogManager.getLogger();
public Code() {
ApplicationContext context = SpringContext.getAppContext();
userRepository = (UserRepository) context.getBean("userRepository");
}
@Override
public void action(String[] args, MessageReceivedEvent event) {
StringBuilder stringBuilder = new StringBuilder();
for (String arg : args) {
stringBuilder.append(arg);
stringBuilder.append(" ");
}
Binding binding = new Binding();
binding.setVariable("event", event);
GroovyShell shell = new GroovyShell(binding);
EmbedBuilder builder;
try {
Object value = shell.evaluate(stringBuilder.toString());
StringBuilder stringResult = new StringBuilder();
if (value.getClass().isArray()) {
Object[] array = (Object[]) value;
for (Object obj : array) {
if (stringResult.length() < 1800) {
stringResult.append(obj.toString()).append("\n\n");
} else {
stringResult.append("\n...");
break;
}
}
} else {
stringResult.append(value.toString());
}
builder = new EmbedBuilder().setColor(Color.orange).setTitle(":hammer_pick: Compilation Successful :hammer_pick:").setDescription("```java\n" + stringResult.toString() + "```");
} catch (Exception ex) {
builder = new EmbedBuilder().setColor(Color.red).setTitle(":x: Compilation Failed :x:").setDescription("```java\n" + ex.toString() + "```");
}
event.getChannel().sendMessage(builder.build()).queue();
}
@Override
public boolean isPrivateUsable() {
return true;
}
@Override
public boolean isAdminCmd() {
return true;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return true;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -35,8 +35,6 @@ public class Flush implements Commande {
} else { } else {
event.getTextChannel().sendMessage(EmbedMessageUtils.getFlushError("You are not a supreme being, you cannot do that !")).queue(); event.getTextChannel().sendMessage(EmbedMessageUtils.getFlushError("You are not a supreme being, you cannot do that !")).queue();
} }
} }
} }

View File

@ -1,184 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.MainBot;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.MessageTimeOut;
import net.Broken.Tools.PrivateMessage;
import net.Broken.Tools.TableRenderer;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.awt.*;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Help Command.
*/
public class Help implements Commande {
Logger logger = LogManager.getLogger();
private int cellLenght = 25;
@Override
public void action(String[] args, MessageReceivedEvent event) {
if (args.length >= 1) {
String argsString = args[0];
//System.out.println(argsString);
if (MainBot.commandes.containsKey(argsString)) {
Commande cmdObj = MainBot.commandes.get(argsString);
if (!cmdObj.isAdminCmd() || isAdmin(event)) {
logger.debug("Help for " + argsString + " by " + event.getAuthor().getName());
MessageEmbed messageEmbed;
try {
messageEmbed = EmbedMessageUtils.getHelp(argsString);
} catch (FileNotFoundException e) {
try {
messageEmbed = EmbedMessageUtils.getHelp("Default");
} catch (FileNotFoundException e1) {
messageEmbed = EmbedMessageUtils.getInternalError();
logger.catching(e1);
}
}
if (!event.isFromType(ChannelType.PRIVATE)) {
event.getTextChannel().sendMessage(messageEmbed).queue();
} else {
PrivateMessage.send(event.getAuthor(), messageEmbed, logger);
}
} else {
logger.info("Help wanted for admin command, Denied!");
if (!event.isFromType(ChannelType.PRIVATE)) {
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getUnautorized()).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
} else {
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getUnautorized(), logger);
}
}
} else {
if (!event.isFromType(ChannelType.PRIVATE)) {
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getUnknowCommand()).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
} else {
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getUnknowCommand(), logger);
}
logger.debug("Unknown command!");
}
} else {
TableRenderer table = new TableRenderer();
table.setHeader("Command", "PU");
TableRenderer nsfwTable = new TableRenderer();
nsfwTable.setHeader("NSFW Only\u00A0", "PU");
List<String> noPu = new ArrayList<>();
for (Map.Entry<String, Commande> e : MainBot.commandes.entrySet()) {
if (!e.getValue().isAdminCmd() || isAdmin(event)) {
if (e.getValue().isPrivateUsable())
table.addRow(e.getKey(), "XX");
else if (e.getValue().isNSFW())
nsfwTable.addRow(e.getKey(), "");
else
noPu.add(e.getKey());
}
}
for (String key : noPu)
table.addRow(key, "");
String txt = table.build();
txt += "\n\n";
txt += nsfwTable.build();
if (!event.isFromType(ChannelType.PRIVATE)) {
Message rest = event.getTextChannel().sendMessage(new EmbedBuilder().setTitle("Commands sent by private message").setColor(Color.green).build()).complete();
new MessageTimeOut(MainBot.messageTimeOut, rest, event.getMessage()).start();
}
String role;
if (isAdmin(event))
role = "Admin";
else
role = "No Admin";
try {
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getHelpList(role, txt), logger);
} catch (FileNotFoundException e) {
logger.catching(e);
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getInternalError(), logger);
}
}
}
@Override
public boolean isPrivateUsable() {
return true;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
public boolean isAdmin(MessageReceivedEvent event) {
if (event.isFromType(ChannelType.PRIVATE)) {
List<Guild> guilds = event.getAuthor().getMutualGuilds();
for (Guild iterator : guilds) {
if (iterator.getMember(event.getAuthor()).hasPermission(Permission.ADMINISTRATOR)) {
return true;
}
}
} else
return event.getMember().hasPermission(Permission.ADMINISTRATOR);
return false;
}
}

View File

@ -1,18 +1,17 @@
package net.Broken.Commands; package net.Broken.Commands;
import net.Broken.Commande; import net.Broken.Commande;
import net.Broken.Tools.PrivateMessage;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
public class Invite implements Commande { public class Invite implements Commande {
@Override @Override
public void action(String[] args, MessageReceivedEvent event) { public void action(String[] args, MessageReceivedEvent event) {
if (event.getChannelType().isGuild()) { // if (event.getChannelType().isGuild()) {
event.getTextChannel().sendMessage("You can invite me whit this link:\nhttps://discordapp.com/oauth2/authorize?client_id=" + event.getJDA().getSelfUser().getId() + "&scope=bot&permissions=8").complete(); // event.getTextChannel().sendMessage("You can invite me whit this link:\nhttps://discordapp.com/oauth2/authorize?client_id=" + event.getJDA().getSelfUser().getId() + "&scope=bot&permissions=8").complete();
} else { // } else {
PrivateMessage.send(event.getAuthor(), "You can invite me whit this link:\nhttps://discordapp.com/oauth2/authorize?client_id=" + event.getJDA().getSelfUser().getId() + "&scope=bot&permissions=8", LogManager.getLogger()); // PrivateMessage.send(event.getAuthor(), "You can invite me whit this link:\nhttps://discordapp.com/oauth2/authorize?client_id=" + event.getJDA().getSelfUser().getId() + "&scope=bot&permissions=8", LogManager.getLogger());
} // }
} }
@Override @Override

View File

@ -1,48 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.awt.*;
import java.util.List;
public class ListRoles implements Commande {
@Override
public void action(String[] args, MessageReceivedEvent event) {
List<Role> roles = event.getGuild().getRoles();
EmbedBuilder messageB = new EmbedBuilder();
for (Role role : roles) {
messageB.addField(role.getName(), "```id: " + role.getId() + "```", false);
}
messageB.setColor(Color.green);
event.getTextChannel().sendMessage(messageB.build()).complete();
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return true;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -1,182 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.MainBot;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.MessageTimeOut;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.exceptions.HierarchyException;
import net.dv8tion.jda.api.managers.GuildManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
/**
* Move Command
*/
public class Move implements Commande {
public List<Role> saveRoleUser;
public Member user;
public Guild serveur;
public GuildManager serveurManager;
Logger logger = LogManager.getLogger();
private String HELP = "`//move <@user> <@Role>`\n:arrow_right:\t*Move a user to a specified role.*";
/**
* Perform a move (Reset is role and add target(s) role(s)
*
* @param user User to move
* @param cible Complete list of new role
* @param reset
* @param serveur Guild
* @param serveurManager GuildManager
* @return success
*/
public boolean exc(Member user, List<Role> cible, boolean reset, Guild serveur, GuildManager serveurManager) throws HierarchyException {
MainBot.roleFlag = true;
boolean erreur = false;
List<Role> allRoll = serveur.getRoles();
//On recupere les roles de l'utilisateur
List<Role> roleUserList = user.getRoles();
logger.info("Roles of " + user.getEffectiveName() + ":");
//On les save
saveRoleUser = roleUserList;
//Ajout du role cible
//On transforme la le role a ajouter en une liste pour pouvoir l'utiliser dans modifyMemberRoles
//on fait ensuite les modif
serveur.modifyMemberRoles(user, cible).complete();
logger.info("Give " + cible + " role to " + user.getEffectiveName());
this.user = user;
this.serveur = serveur;
this.serveurManager = serveurManager;
return erreur;
}
/**
* Command handler
*
* @param args
* @param event
*/
public void action(String[] args, MessageReceivedEvent event) {
if (!event.isFromType(ChannelType.PRIVATE)) {
if (args.length >= 2) {
serveur = event.getGuild();
List<User> userL = event.getMessage().getMentionedUsers();
List<Role> roleL = event.getMessage().getMentionedRoles();
if (userL.size() < 1 || roleL.size() < 1) {
logger.warn("Wrong mention.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveError("Error, please check if the user and/or the role are existing.")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
} else {
user = serveur.getMember(userL.get(0));
serveur = event.getGuild();
logger.info("Attempting role assignement for " + user.getEffectiveName() + " to " + roleL + " by " + event.getAuthor().getName());
logger.info("Permission granted, role assignement authorized");
logger.debug("User found");
try {
boolean erreur = this.exc(user, roleL, true, serveur, serveur.getManager());
if (erreur) {
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveError("Check the targeted role. ")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
} else {
StringBuilder roleStr = new StringBuilder("");
boolean first = true;
for (Role role : roleL) {
if (!first) {
roleStr.append(", ");
} else
first = false;
roleStr.append("__");
roleStr.append(role.getName());
roleStr.append("__");
}
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveOk("User " + user.getEffectiveName() + " as been successfully moved to " + roleStr.toString())).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
} catch (HierarchyException e) {
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveError("You cannot move " + user.getRoles().get(0).getAsMention())).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
logger.error("Hierarchy error, please move bot's role on top!");
}
}
} else {
logger.warn("Missing argument.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveError("Missing argument.")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
} else
event.getPrivateChannel().sendMessage(EmbedMessageUtils.getNoPrivate());
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return true;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -1,57 +0,0 @@
package net.Broken.Commands.Over18;
import net.Broken.Commande;
import net.Broken.Tools.FindContentOnWebPage;
import net.Broken.Tools.Redirection;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
/**
* TODO Remove this
*/
public class SM implements Commande {
Logger logger = LogManager.getLogger();
@Override
public void action(String[] args, MessageReceivedEvent event) {
Redirection redirect = new Redirection();
try {
String redirectUrl = redirect.get("https://bonjourfetish.tumblr.com/random");
logger.debug(redirectUrl);
String img = FindContentOnWebPage.doYourJob(redirectUrl, "article-picture center", "img");
event.getTextChannel().sendMessage(img).queue();
} catch (IOException e) {
logger.warn("Redirection fail.");
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Redirection fail (5 attempt), Try again__**:warning: ").queue();
}
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return true;
}
}

View File

@ -1,83 +0,0 @@
package net.Broken.Commands.Over18;
import net.Broken.Commande;
import net.Broken.Tools.FindContentOnWebPage;
import net.Broken.Tools.Redirection;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
public class Suicide implements Commande {
private Logger logger = LogManager.getLogger();
@Override
public void action(String[] args, MessageReceivedEvent event) {
Redirection redirection = new Redirection();
String base = "http://suicidegirls.tumblr.com";
String redirectUrl = null;
try {
Boolean success = false;
int tryCount = 0;
while (!success && tryCount < 10) {
redirectUrl = redirection.get(base + "/random");
String img;
try {
img = FindContentOnWebPage.doYourJob(redirectUrl, "post photo_nav_caption", "img");
event.getTextChannel().sendMessage(img).queue();
success = true;
} catch (StringIndexOutOfBoundsException | IOException e) {
logger.debug("Photo_nav not found try photoset");
try {
String mid = FindContentOnWebPage.doYourJob(redirectUrl, "html_photoset", "iframe");
img = FindContentOnWebPage.doYourJob(base + mid, "photoset_row", "img");
event.getTextChannel().sendMessage(img).queue();
success = true;
} catch (StringIndexOutOfBoundsException | IOException e1) {
logger.debug("Nothing found, assume it's a comment.");
}
}
tryCount++;
}
} catch (IOException e) {
logger.catching(e);
}
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return true;
}
}

View File

@ -1,54 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.MainBot;
import net.Broken.Tools.MessageTimeOut;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
/**
* Command that return the Bot's ping
*/
public class Ping implements Commande {
@Override
public void action(String[] args, MessageReceivedEvent event) {
long ping = event.getJDA().getGatewayPing();
// long receivedTime = Timestamp.valueOf(LocalDateTime.ofInstant(event.getMessage().getCreationTime().toInstant(), ZoneId.systemDefault())).getTime();
if (event.isFromType(ChannelType.PRIVATE))
event.getPrivateChannel().sendMessage(":arrow_right: Pong! `" + ping + "ms`").queue();
else {
Message rest = event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:arrow_right: Pong! `" + ping + "ms`").complete();
new MessageTimeOut(MainBot.messageTimeOut, event.getMessage(), rest).start();
}
LogManager.getLogger().debug("pong");
}
@Override
public boolean isPrivateUsable() {
return true;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -1,311 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.MainBot;
import net.Broken.Tools.AntiSpam;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.MessageTimeOut;
import net.Broken.Tools.UserSpamUtils;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.exceptions.RateLimitedException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Spam admin command
*/
// TODO Rebuild this ...
public class Spam implements Commande {
private Logger logger = LogManager.getLogger();
@Override
public void action(String[] args, MessageReceivedEvent event) {
/****************************
* Verif argument *
****************************/
if (args.length >= 1) {
String commande = args[0];
/****************************
* on traite la commande *
****************************/
switch (commande) {
case "pardon":
this.pardon(event, args);
break;
case "extermine":
try {
this.extermine(event, args);
} catch (RateLimitedException e) {
e.printStackTrace();
}
break;
case "reset":
try {
this.reset(event, args);
} catch (RateLimitedException e) {
e.printStackTrace();
}
break;
}
}
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return true;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
public void pardon(MessageReceivedEvent event, String[] args) {
Guild serveur = event.getGuild();
/****************************
* verif argument *
****************************/
if (args.length >= 1) {
/****************************
* On recupere l'utilisateur et le role cible
****************************/
List<Member> userL = event.getMessage().getMentionedMembers();
/****************************
* verif utilisteur trouver *
****************************/
if (userL.size() < 1) {
logger.error("User unknown.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError(":arrow_right: User not found. ", "pardon")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
} else {
Member user = userL.get(0);
logger.info("Attempt to forgive " + user.getEffectiveName() + " by " + event.getMember().getEffectiveName());
/****************************
* virif si en spammer *
****************************/
if (MainBot.spamUtils.containsKey(user)) {
if (MainBot.spamUtils.get(user).isOnSpam()) {
MainBot.spamUtils.get(user).setOnSpam(false);
} else {
logger.warn("User is not in spam.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError(":arrow_right: This user is not in spam.", "pardon")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
} else {
logger.warn("User is not in spam.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError(":arrow_right: This user is not in spam.", "pardon")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
}
} else {
logger.warn("Missing argument.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError("Missing argument!", "pardon")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
}
public void extermine(MessageReceivedEvent event, String[] args) throws RateLimitedException {
/****************************
* verif argument *
****************************/
if (args.length >= 3) {
/****************************
* On recupere l'utilisateur et le role cible
****************************/
List<User> userL = event.getMessage().getMentionedUsers();
/****************************
* verif utilisteur trouver *
****************************/
if (userL.size() < 1) {
logger.warn("Wrong mention (Spam).");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError("Wrong mention. ", "extermine")).complete();
} else {
Guild serveur = event.getGuild();
Member user = serveur.getMember(userL.get(0));
logger.info("Starting protocol 66 on " + user.getEffectiveName() + " by the command of " + event.getAuthor().getName());
String multiStr = args[2];
/****************************
* virif pas deja en spammer *
****************************/
if (MainBot.spamUtils.containsKey(user)) {
if (!MainBot.spamUtils.get(user).isOnSpam()) {
this.goSpam(user, multiStr, serveur, event);
} else {
logger.warn("User already in spam.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError("User already in spam.", "extermine")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
} else {
this.goSpam(user, multiStr, serveur, event);
}
}
} else {
logger.warn("Missing argument.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError("Missing argument!", "extermine")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
}
public void reset(MessageReceivedEvent event, String[] args) throws RateLimitedException {
if (event != null) {
if (args.length >= 2) {
Guild serveur = event.getGuild();
/****************************
* On recupere l'utilisateur et le role cible
****************************/
List<Member> userL = event.getMessage().getMentionedMembers();
/****************************
* verif utilisteur trouver *
****************************/
if (userL.size() < 1) {
logger.warn("User not found.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError("User not found.", "reset")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
} else {
Member user = userL.get(0);
logger.info("Attempt spam reset of " + user.getEffectiveName() + " by " + event.getMember().getEffectiveName());
/****************************
* verif utilisteur trouver *
****************************/
if (MainBot.spamUtils.containsKey(user)) {
logger.info("Multiplictor reset for " + user.getEffectiveName() + " done.");
Message rest = event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n *The spam multiplicator of " + user.getEffectiveName() + " is now down to zero.*").complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
MainBot.spamUtils.remove(user);
}
}
} else {
logger.warn("Missing argument.");
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamError("Missing argument!", "reset")).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
}
} else {
if (args[0].equals("all")) {
logger.info("Multiplicator reseted automaticly.");
for (Member unUser : MainBot.spamUtils.keySet()) {
MainBot.message_compteur.remove(unUser); //TODO resolve garbage collector error ????
}
}
}
}
public void goSpam(Member user, String multiStr, Guild serveur, MessageReceivedEvent event) {
if (Objects.equals(multiStr, "/")) {
new AntiSpam().extermine(user, serveur, serveur.getManager(), true, event);
} else {
int multi = Integer.parseInt(multiStr);
if (MainBot.spamUtils.containsKey(user)) {
MainBot.spamUtils.get(user).setMultip(multi);
} else {
MainBot.spamUtils.put(user, new UserSpamUtils(user, new ArrayList<>()));
MainBot.spamUtils.get(user).setMultip(multi);
}
new AntiSpam().extermine(user, serveur, serveur.getManager(), false, event);
}
}
}

View File

@ -1,186 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.MainBot;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.MessageTimeOut;
import net.Broken.Tools.PrivateMessage;
import net.Broken.Tools.UserSpamUtils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Spam Info Command
*/
public class SpamInfo implements Commande {
Logger logger = LogManager.getLogger();
private HashMap<Member, MessageUpdater> threadHashMap = new HashMap<>();
@Override
public void action(String[] args, MessageReceivedEvent event) {
Member user;
if (event.getMessage().getMentionedUsers().size() == 0) {
user = event.getMember();
} else {
user = event.getMessage().getMentionedMembers().get(0);
}
Message message = null;
if (!MainBot.spamUtils.containsKey(user)) {
if (!event.isFromType(ChannelType.PRIVATE))
message = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + ":\n\t- Multiplicator: `1`\n\t- In spam: `No`")).complete();
else
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + ":\n\t- Multiplicator: `1`\n\t- In spam: `No`"), logger);
} else {
UserSpamUtils util = MainBot.spamUtils.get(user);
if (!util.isOnSpam()) {
if (!event.isFromType(ChannelType.PRIVATE))
message = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + "\n\t- Multiplicator: `" + util.getMultip() + "`\n\t- In spam: `No`")).complete();
else
PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + ":\n\t- Multiplicator: `" + util.getMultip() + "`\n\t- In spam: `No`"), logger);
} else {
if (!event.isFromType(ChannelType.PRIVATE))
message = event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + ":\n\t- Multiplicator: `" + util.getMultip() + "`\n\t- In spam: `Yes`\n\t- Time remaining: `" + formatSecond(util.getTimeLeft()) + "`")).complete();
else
message = PrivateMessage.send(event.getAuthor(), EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + "\n\t- Multiplicator: `" + util.getMultip() + "`\n\t- In spam: `Yes`\n\t- Time remaining: `" + formatSecond(util.getTimeLeft()) + "`"), logger);
}
}
if (message != null) {
if (threadHashMap.containsKey(user)) {
MessageUpdater startedThread = threadHashMap.get(user);
if (!message.getChannelType().equals(startedThread.message.getChannelType())) {
MessageUpdater newThread = new MessageUpdater(message, event.getMessage(), MainBot.spamUtils.get(user), user);
threadHashMap.put(user, newThread);
newThread.start();
} else {
threadHashMap.get(user).stop = true;
MessageUpdater newThread = new MessageUpdater(message, event.getMessage(), MainBot.spamUtils.get(user), user);
threadHashMap.replace(user, newThread);
newThread.start();
}
} else {
MessageUpdater newThread = new MessageUpdater(message, event.getMessage(), MainBot.spamUtils.get(user), user);
threadHashMap.put(user, newThread);
newThread.start();
}
}
}
@Override
public boolean isPrivateUsable() {
return true;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
public String formatSecond(int second) {
long days = TimeUnit.SECONDS.toDays(second);
second -= TimeUnit.DAYS.toSeconds(days);
long hours = TimeUnit.SECONDS.toHours(second);
second -= TimeUnit.HOURS.toSeconds(hours);
long minutes = TimeUnit.SECONDS.toMinutes(second);
second -= TimeUnit.MINUTES.toSeconds(minutes);
long seconds = TimeUnit.SECONDS.toSeconds(second);
logger.debug("" + days + ":" + hours + ":" + minutes + ":" + seconds);
String finalText = "";
if (days != 0)
finalText += days + " day(s) ";
if (hours != 0)
finalText += hours + "h ";
if (minutes != 0)
finalText += minutes + "min ";
finalText += seconds + "s";
return finalText;
}
private class MessageUpdater extends Thread {
public Message message;
public Message command;
public UserSpamUtils util;
public boolean stop;
private int oldValue;
private Member user;
public MessageUpdater(Message message, Message command, UserSpamUtils util, Member user) {
this.message = message;
this.util = util;
this.user = user;
this.command = command;
}
@Override
public void run() {
logger.debug("Start " + user.getEffectiveName() + " theard!");
if (util != null) {
oldValue = util.getTimeLeft();
while (util.getTimeLeft() != 0 && !stop && util.isOnSpam()) {
try {
Thread.sleep(500);
if (util.getTimeLeft() % 5 == 0 && oldValue - util.getTimeLeft() >= 5) {
message.editMessage(EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + ":\n\t- Multiplicator: `" + util.getMultip() + "`\n\t- In spam: `Yes`\n\t- Time remaining: `" + formatSecond(util.getTimeLeft()) + "`")).complete();
oldValue = util.getTimeLeft();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
logger.debug("Kill " + user.getEffectiveName() + " theard!");
if (stop)
message.editMessage(new EmbedBuilder().setColor(Color.RED).setTitle("Aborted").build()).complete();
else
message.editMessage(EmbedMessageUtils.getSpamInfo(user.getEffectiveName() + "\n\t- Multiplicator: `" + util.getMultip() + "`\n\t- In spam: `No`")).complete();
}
logger.debug("Timer for message deletion of " + user.getEffectiveName() + " stated...");
threadHashMap.remove(user);
List<Message> messages = new ArrayList<>();
messages.add(command);
messages.add(message);
new MessageTimeOut(messages, 15).start();
}
}
}

View File

@ -1,74 +0,0 @@
package net.Broken.Commands;
import net.Broken.Commande;
import net.Broken.MainBot;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.MessageTimeOut;
import net.Broken.audio.Youtube.SearchResult;
import net.Broken.audio.Youtube.YoutubeSearchRework;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.util.List;
public class YtSearch implements Commande {
private Logger logger = LogManager.getLogger();
@Override
public void action(String[] args, MessageReceivedEvent event) {
YoutubeSearchRework youtubeSearch = YoutubeSearchRework.getInstance();
if (args.length < 1) {
logger.info("YtSearch: Missing args, user: " + event.getAuthor().getName());
Message message = event.getChannel().sendMessage(EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("Missing search query!"))).complete();
new MessageTimeOut(MainBot.messageTimeOut, message, event.getMessage()).start();
} else {
try {
StringBuilder builder = new StringBuilder();
for (String arg : args) {
builder.append(arg);
}
List<SearchResult> result = youtubeSearch.searchVideo(builder.toString(), 5, false);
for (SearchResult item : result) {
event.getChannel().sendMessage(EmbedMessageUtils.searchResult(item)).queue();
}
} catch (IOException t) {
logger.catching(t);
event.getChannel().sendMessage(EmbedMessageUtils.getInternalError()).queue();
}
}
}
@Override
public boolean isPrivateUsable() {
return false;
}
@Override
public boolean isAdminCmd() {
return false;
}
/**
* Determines if the command is usable only by bot level admin user
*
* @return boolean
*/
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -7,7 +7,6 @@ import net.Broken.Tools.Command.CommandLoader;
import net.Broken.Tools.Command.SlashCommandLoader; import net.Broken.Tools.Command.SlashCommandLoader;
import net.Broken.Tools.DayListener.DayListener; import net.Broken.Tools.DayListener.DayListener;
import net.Broken.Tools.DayListener.Listeners.DailyMadame; import net.Broken.Tools.DayListener.Listeners.DailyMadame;
import net.Broken.Tools.DayListener.Listeners.ResetSpam;
import net.Broken.Tools.UserManager.Stats.UserStatsUtils; import net.Broken.Tools.UserManager.Stats.UserStatsUtils;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.JDABuilder;
@ -89,7 +88,6 @@ public class Init {
SlashCommandLoader.registerSlashCommands(jda.updateCommands()); SlashCommandLoader.registerSlashCommands(jda.updateCommands());
ApiCommandLoader.load(); ApiCommandLoader.load();
DayListener dayListener = DayListener.getInstance(); DayListener dayListener = DayListener.getInstance();
dayListener.addListener(new ResetSpam());
dayListener.addListener(new DailyMadame()); dayListener.addListener(new DailyMadame());
dayListener.start(); dayListener.start();
jda.addEventListener(new BotListener()); jda.addEventListener(new BotListener());

View File

@ -1,13 +1,6 @@
package net.Broken; package net.Broken;
import net.Broken.DB.Entity.UserEntity;
import net.Broken.Tools.Command.CommandParser;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.PrivateMessage;
import net.Broken.Tools.UserSpamUtils;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -30,11 +23,8 @@ public class MainBot {
public static HashMap<String, Commande> commandes = new HashMap<>(); public static HashMap<String, Commande> commandes = new HashMap<>();
public static HashMap<String, SlashCommand> slashCommands = new HashMap<>(); public static HashMap<String, SlashCommand> slashCommands = new HashMap<>();
public static HashMap<Member, ArrayList<Message>> historique = new HashMap<>();
public static HashMap<Member, Integer> message_compteur = new HashMap<>();
public static HashMap<String, Integer> mutualGuildCount = new HashMap<>(); public static HashMap<String, Integer> mutualGuildCount = new HashMap<>();
public static boolean roleFlag = false; public static boolean roleFlag = false;
public static HashMap<Member, UserSpamUtils> spamUtils = new HashMap<>();
public static JDA jda; public static JDA jda;
public static boolean ready = false; public static boolean ready = false;
public static boolean dev = false; public static boolean dev = false;
@ -79,54 +69,4 @@ public class MainBot {
ready = true; ready = true;
} }
/**
* Perform test (admin, NSFW and private usable or not) and execute command or not
*
* @param cmd Container whit all command info
*/
public static void handleCommand(CommandParser.CommandContainer cmd, UserEntity user) {
if (!ready) {
return;
}
if (commandes.containsKey(cmd.commande)) {
Commande cmdObj = commandes.get(cmd.commande);
boolean isAdmin;
boolean isBotAdmin = user != null && user.isBotAdmin();
if (cmd.event.isFromType(ChannelType.PRIVATE)) {
isAdmin = false;
} else
isAdmin = cmd.event.getMember().hasPermission(Permission.ADMINISTRATOR);
if ((!cmdObj.isAdminCmd() || isAdmin) && (!cmdObj.isBotAdminCmd() || isBotAdmin)) {
if (cmd.event.isFromType(ChannelType.PRIVATE) && commandes.get(cmd.commande).isPrivateUsable()) {
commandes.get(cmd.commande).action(cmd.args, cmd.event);
} else if (!cmd.event.isFromType(ChannelType.PRIVATE)) {
if (!cmdObj.isNSFW() || cmd.event.getTextChannel().isNSFW()) {
commandes.get(cmd.commande).action(cmd.args, cmd.event);
} else {
cmd.event.getMessage().delete().queue();
}
} else
cmd.event.getPrivateChannel().sendMessage(EmbedMessageUtils.getNoPrivate()).queue();
} else {
if (cmd.event.isFromType(ChannelType.PRIVATE)) {
PrivateMessage.send(cmd.event.getAuthor(), EmbedMessageUtils.getUnautorized(), logger);
} else {
cmd.event.getTextChannel().sendMessage(EmbedMessageUtils.getUnautorized()).complete();
}
}
} else {
logger.debug("Unknown command : " + cmd.commande);
}
}
} }

View File

@ -1,12 +1,15 @@
package net.Broken.RestApi; package net.Broken.RestApi;
import net.Broken.DB.Entity.PendingUserEntity;
import net.Broken.DB.Entity.UserEntity; import net.Broken.DB.Entity.UserEntity;
import net.Broken.DB.Repository.PendingUserRepository; import net.Broken.DB.Repository.PendingUserRepository;
import net.Broken.DB.Repository.UserRepository; import net.Broken.DB.Repository.UserRepository;
import net.Broken.MainBot; import net.Broken.MainBot;
import net.Broken.RestApi.Data.UserManager.*; import net.Broken.RestApi.Data.UserManager.GuildInfo;
import net.Broken.Tools.UserManager.Exceptions.*; import net.Broken.RestApi.Data.UserManager.UserConnectionData;
import net.Broken.RestApi.Data.UserManager.UserInfoData;
import net.Broken.Tools.UserManager.Exceptions.PasswordNotMatchException;
import net.Broken.Tools.UserManager.Exceptions.UnknownTokenException;
import net.Broken.Tools.UserManager.Exceptions.UserNotFoundException;
import net.Broken.Tools.UserManager.Oauth; import net.Broken.Tools.UserManager.Oauth;
import net.Broken.Tools.UserManager.Stats.GuildStatsPack; import net.Broken.Tools.UserManager.Stats.GuildStatsPack;
import net.Broken.Tools.UserManager.Stats.UserStatsUtils; import net.Broken.Tools.UserManager.Stats.UserStatsUtils;
@ -48,43 +51,43 @@ public class UserManagerAPIController {
} }
@RequestMapping(value = "/preRegister", method = RequestMethod.POST) // @RequestMapping(value = "/preRegister", method = RequestMethod.POST)
public ResponseEntity<CheckResposeData> command(@RequestBody UserInfoData data) { // public ResponseEntity<CheckResposeData> command(@RequestBody UserInfoData data) {
if (data != null && data.name != null) { // if (data != null && data.name != null) {
try { // try {
String id = userUtils.sendCheckToken(pendingUserRepository, userRepository, passwordEncoder, data); // String id = userUtils.sendCheckToken(pendingUserRepository, userRepository, passwordEncoder, data);
return new ResponseEntity<>(new CheckResposeData(true, data.name, "Message sent", id), HttpStatus.OK); // return new ResponseEntity<>(new CheckResposeData(true, data.name, "Message sent", id), HttpStatus.OK);
} catch (UserNotFoundException e) { // } catch (UserNotFoundException e) {
logger.warn("User \"" + data.name + "\" not found!"); // logger.warn("User \"" + data.name + "\" not found!");
return new ResponseEntity<>(new CheckResposeData(false, data.name, "User not found on server!", ""), HttpStatus.NOT_FOUND); // return new ResponseEntity<>(new CheckResposeData(false, data.name, "User not found on server!", ""), HttpStatus.NOT_FOUND);
} catch (PasswordNotMatchException userAlreadyRegistered) { // } catch (PasswordNotMatchException userAlreadyRegistered) {
return new ResponseEntity<>(new CheckResposeData(false, data.name, "User already registered in pending database and password not match!", ""), HttpStatus.NOT_ACCEPTABLE); // return new ResponseEntity<>(new CheckResposeData(false, data.name, "User already registered in pending database and password not match!", ""), HttpStatus.NOT_ACCEPTABLE);
//
// } catch (UserAlreadyRegistered userAlreadyRegistered) {
// return new ResponseEntity<>(new CheckResposeData(false, data.name, "User already registered in database!", ""), HttpStatus.NOT_ACCEPTABLE);
// }
// } else {
// return new ResponseEntity<>(new CheckResposeData(false, "", "Missing parameter(s)", ""), HttpStatus.BAD_REQUEST);
// }
// }
} catch (UserAlreadyRegistered userAlreadyRegistered) { // @RequestMapping(value = "/confirmAccount", method = RequestMethod.POST)
return new ResponseEntity<>(new CheckResposeData(false, data.name, "User already registered in database!", ""), HttpStatus.NOT_ACCEPTABLE); // public ResponseEntity<UserConnectionData> confirAccount(@RequestBody ConfirmData data) {
} // try {
} else { // PendingUserEntity pUser = userUtils.confirmCheckToken(pendingUserRepository, Integer.parseInt(data.id), data.checkToken);
return new ResponseEntity<>(new CheckResposeData(false, "", "Missing parameter(s)", ""), HttpStatus.BAD_REQUEST); // UserEntity user = new UserEntity(pUser, userUtils.generateApiToken());
} // userRepository.save(user);
} // pendingUserRepository.delete(pUser);
//
@RequestMapping(value = "/confirmAccount", method = RequestMethod.POST) // return new ResponseEntity<>(new UserConnectionData(true, user.getName(), user.getApiToken(), ""), HttpStatus.OK);
public ResponseEntity<UserConnectionData> confirAccount(@RequestBody ConfirmData data) { // } catch (TokenNotMatch tokenNotMatch) {
try { // logger.warn("Pre token not match for " + data.id + "!");
PendingUserEntity pUser = userUtils.confirmCheckToken(pendingUserRepository, Integer.parseInt(data.id), data.checkToken); // return new ResponseEntity<>(new UserConnectionData(false, "Token not match!", "token"), HttpStatus.NOT_ACCEPTABLE);
UserEntity user = new UserEntity(pUser, userUtils.generateApiToken()); // } catch (UserNotFoundException e) {
userRepository.save(user); // logger.warn("Id not found in DB (" + data.id + ")");
pendingUserRepository.delete(pUser); // return new ResponseEntity<>(new UserConnectionData(false, "User not found on DB!", "user"), HttpStatus.NOT_ACCEPTABLE);
// }
return new ResponseEntity<>(new UserConnectionData(true, user.getName(), user.getApiToken(), ""), HttpStatus.OK); // }
} catch (TokenNotMatch tokenNotMatch) {
logger.warn("Pre token not match for " + data.id + "!");
return new ResponseEntity<>(new UserConnectionData(false, "Token not match!", "token"), HttpStatus.NOT_ACCEPTABLE);
} catch (UserNotFoundException e) {
logger.warn("Id not found in DB (" + data.id + ")");
return new ResponseEntity<>(new UserConnectionData(false, "User not found on DB!", "user"), HttpStatus.NOT_ACCEPTABLE);
}
}
@RequestMapping(value = "/requestToken", method = RequestMethod.POST) @RequestMapping(value = "/requestToken", method = RequestMethod.POST)
public ResponseEntity<UserConnectionData> requestToken(@RequestBody UserInfoData data) { public ResponseEntity<UserConnectionData> requestToken(@RequestBody UserInfoData data) {

View File

@ -12,6 +12,7 @@ import java.util.List;
public interface SlashCommand { public interface SlashCommand {
/** /**
* Main action of command * Main action of command
*
* @param args Command args. * @param args Command args.
* @param event Command MessageReceivedEvent * @param event Command MessageReceivedEvent
*/ */
@ -25,12 +26,14 @@ public interface SlashCommand {
/** /**
* Determines if the command is usable only by bot level admin user * Determines if the command is usable only by bot level admin user
*
* @return boolean * @return boolean
*/ */
boolean isBotAdminCmd(); boolean isBotAdminCmd();
/** /**
* Determines if the command is only usable on NSFW channels * Determines if the command is only usable on NSFW channels
*
* @return boolean * @return boolean
*/ */
boolean isNSFW(); boolean isNSFW();

View File

@ -1,15 +1,10 @@
package net.Broken.SlashCommands; package net.Broken.SlashCommands;
import net.Broken.Commande;
import net.Broken.SlashCommand; import net.Broken.SlashCommand;
import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.EmbedMessageUtils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.MessageBuilder; import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.interactions.commands.build.OptionData; import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData; import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -50,7 +45,7 @@ public class Cat implements SlashCommand {
} catch (IOException e) { } catch (IOException e) {
logger.catching(e); logger.catching(e);
event.reply(new MessageBuilder().setEmbeds(EmbedMessageUtils.getInternalError()).build()).queue(); event.reply(new MessageBuilder().setEmbeds(EmbedMessageUtils.getInternalError()).build()).setEphemeral(true).queue();
} }
@ -63,7 +58,7 @@ public class Cat implements SlashCommand {
@Override @Override
public List<OptionData> getOptions() { public List<OptionData> getOptions() {
return new ArrayList<>(); return null;
} }
@Override @Override

View File

@ -0,0 +1,58 @@
package net.Broken.SlashCommands;
import net.Broken.SlashCommand;
import net.Broken.Tools.EmbedMessageUtils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import java.util.ArrayList;
import java.util.List;
public class Clear implements SlashCommand {
@Override
public void action(SlashCommandEvent event) {
if (event.getMember().hasPermission(Permission.MESSAGE_MANAGE)) {
event.reply(":white_check_mark: Done").setEphemeral(true).queue();
long n = event.getOption("n").getAsLong();
MessageChannel chanel = event.getChannel();
chanel.getIterableHistory().takeAsync((int) n).thenAccept(chanel::purgeMessages);
} else {
Message message = new MessageBuilder().setEmbeds(EmbedMessageUtils.getFlushError("You are not a supreme being, you cannot do that !")).build();
event.reply(message).setEphemeral(true).queue();
}
}
@Override
public String getDescription() {
return "Clear the last [n] message(s)";
}
@Override
public List<OptionData> getOptions() {
ArrayList<OptionData> options = new ArrayList<>();
options.add(new OptionData(OptionType.INTEGER, "n", "The number of message(s) to clear", true));
return options;
}
@Override
public List<SubcommandData> getSubcommands() {
return null;
}
@Override
public boolean isBotAdminCmd() {
return false;
}
@Override
public boolean isNSFW() {
return false;
}
}

View File

@ -1,10 +1,8 @@
package net.Broken.SlashCommands; package net.Broken.SlashCommands;
import net.Broken.MainBot;
import net.Broken.SlashCommand; import net.Broken.SlashCommand;
import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.MessageTimeOut;
import net.Broken.audio.AudioM; import net.Broken.audio.AudioM;
import net.dv8tion.jda.api.MessageBuilder; import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
@ -16,13 +14,7 @@ import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData; import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -7,18 +7,17 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class SpringContext implements ApplicationContextAware{ public class SpringContext implements ApplicationContextAware {
@Autowired @Autowired
static ApplicationContext context; static ApplicationContext context;
public static ApplicationContext getAppContext() {
return context;
}
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext; context = applicationContext;
} }
public static ApplicationContext getAppContext(){
return context;
}
} }

View File

@ -1,158 +0,0 @@
package net.Broken.Tools;
import net.Broken.Commands.Move;
import net.Broken.MainBot;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.exceptions.HierarchyException;
import net.dv8tion.jda.api.managers.GuildManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import static java.lang.Thread.sleep;
/**
* AntiSpam punishment system
*/
public class AntiSpam {
public Move move = new Move();
Logger logger = LogManager.getLogger();
public AntiSpam() {
}
/**
* Send user to Spam role
*
* @param user User to punish
* @param guild Guild
* @param guildManager GuildManager
* @param incrMulti True for increment punishment time
* @param event Message Received Event
*/
public void extermine(Member user, Guild guild, GuildManager guildManager, Boolean incrMulti, MessageReceivedEvent event) {
try {
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// On créer un nouvelle case dans le tableau des statuts si il n'y est pas
if (!MainBot.spamUtils.containsKey(user)) {
List<Message> messages = new ArrayList<>();
messages.addAll(MainBot.historique.get(user));
MainBot.spamUtils.put(user, new UserSpamUtils(user, messages));
}
// On verrifie que l'uttilisateur n'est pas deja en spam
if (!MainBot.spamUtils.get(user).isOnSpam()) {
//l'utilisateur n'est pas deja en spam
if (MainBot.spamUtils.get(user).getMultip() != 0) {
if (MainBot.spamUtils.get(user).getMultip() < 45 && incrMulti) {
MainBot.spamUtils.get(user).setMultip(MainBot.spamUtils.get(user).getMultip() * 2);
}
} else
MainBot.spamUtils.get(user).setMultip(1);
logger.info("Starting protocol 66 on " + user.getEffectiveName() + " with a multiplicator of " + MainBot.spamUtils.get(user));
if (!MainBot.spamUtils.get(user).isOnSpam()) {
MainBot.spamUtils.get(user).setOnSpam(true);
List<Role> spm = guild.getRolesByName("Spammer", false);
if (spm.size() != 0) {
try {
move.exc(user, spm, true, guild, guildManager);
MainBot.spamUtils.get(user).addMessage(event.getTextChannel().sendMessage(EmbedMessageUtils.getSpamExtermine(user, MainBot.spamUtils.get(user.getUser()).getMultip())).complete());
MainBot.spamUtils.get(user).setMinuteur(new Minuteur(MainBot.spamUtils.get(user).getMultip(), move.user, move.saveRoleUser, move.serveur, move.serveurManager, event));
MainBot.spamUtils.get(user).launchMinuteur();
} catch (HierarchyException e) {
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveError("You cannot move a " + user.getRoles().get(0).getAsMention())).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
MainBot.spamUtils.get(user).setOnSpam(false);
}
} else {
MessageEmbed msg = EmbedMessageUtils.buildStandar(EmbedMessageUtils.getError("\nSpam role not found, you need to create it!"));
event.getTextChannel().sendMessage(msg).complete();
}
}
}
}
/**
* Timer to auto remove user from Spam role
*/
public class Minuteur extends Thread {
public TextChannel chanel;
public List<Role> saveRoleUser;
public Member user;
public Guild serveur;
public GuildManager serveurManager;
public int multip;
public MessageReceivedEvent event;
public int timeLeft;
public Minuteur(int multip, Member user, List<Role> saveRoleUser, Guild serveur, GuildManager serveurManager, MessageReceivedEvent event) {
this.multip = multip;
this.user = user;
this.saveRoleUser = saveRoleUser;
this.serveur = serveur;
this.serveurManager = serveurManager;
this.event = event;
this.chanel = event.getTextChannel();
this.timeLeft = 60 * multip;
}
@Override
public void run() {
logger.info("[" + user.getEffectiveName() + "] Start for " + multip + "min");
while (MainBot.spamUtils.get(user).isOnSpam()) {
try {
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (timeLeft <= 0) {
MainBot.spamUtils.get(user.getUser()).setOnSpam(false);
}
timeLeft--;
}
logger.info("[" + user.getEffectiveName() + "] End of spam for " + user.getEffectiveName() + " after " + multip + "min.");
try {
move.exc(user, saveRoleUser, true, serveur, serveurManager); //aSaveroleUser=saveRoleUser.get(i)
} catch (HierarchyException e) {
Message rest = event.getTextChannel().sendMessage(EmbedMessageUtils.getMoveError("You cannot move " + user.getRoles().get(0).getAsMention())).complete();
List<Message> messages = new ArrayList<Message>() {{
add(rest);
add(event.getMessage());
}};
new MessageTimeOut(messages, MainBot.messageTimeOut).start();
logger.error("Hierarchy error");
}
logger.info("[" + user.getEffectiveName() + "] End for " + multip + "min");
new MessageTimeOut(new ArrayList<>(MainBot.spamUtils.get(user).getMessages()), 0).start();
MainBot.spamUtils.get(user).clearAndAdd(chanel.sendMessage(EmbedMessageUtils.getSpamPardon(user)).complete());
new MessageTimeOut(MainBot.spamUtils.get(user).getMessages(), 60).start();
// #-----------------------------------------------#
}
}
}

View File

@ -1,22 +0,0 @@
package net.Broken.Tools.DayListener.Listeners;
import net.Broken.Commands.Spam;
import net.Broken.Tools.DayListener.NewDayListener;
import net.dv8tion.jda.api.exceptions.RateLimitedException;
/**
* Daily spam reset
*/
public class ResetSpam implements NewDayListener {
@Override
public void onNewDay() {
Spam spam = new Spam();
String str[] = {"all"};
try {
spam.reset(null, str);
} catch (RateLimitedException e) {
e.printStackTrace();
}
}
}

View File

@ -3,7 +3,6 @@ package net.Broken.Tools;
import net.Broken.MainBot; import net.Broken.MainBot;
import net.Broken.audio.Youtube.SearchResult; import net.Broken.audio.Youtube.SearchResult;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import java.awt.*; import java.awt.*;
@ -16,26 +15,15 @@ import java.util.Map;
* Pre build Message Embed * Pre build Message Embed
*/ */
public class EmbedMessageUtils { public class EmbedMessageUtils {
public static MessageEmbed getUnknowCommand() {
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();
}
public static EmbedBuilder getError(String message) { public static EmbedBuilder getError(String message) {
EmbedBuilder temp = new EmbedBuilder().setTitle(":warning: Error! :warning:").setColor(Color.red).setDescription(message); EmbedBuilder temp = new EmbedBuilder().setTitle(":warning: Error! :warning:").setColor(Color.red).setDescription(message);
return temp; return temp;
} }
public static MessageEmbed getNoPrivate() {
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) { public static MessageEmbed getMusicError(String message) {
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(); 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();
} }
public static MessageEmbed getMusicOk(String message) { public static MessageEmbed getMusicOk(String message) {
@ -43,75 +31,28 @@ public class EmbedMessageUtils {
return buildStandar(temp); return buildStandar(temp);
} }
public static MessageEmbed getSpamExtermine(Member autor, int multi) {
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() + " is back , 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 + "/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' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
}
public static MessageEmbed getMoveOk(String message) {
EmbedBuilder temp = new EmbedBuilder().setTitle(":arrow_left: Move :arrow_right: ").setDescription(message).setColor(Color.green);
return buildStandar(temp);
}
public static MessageEmbed getSpamError(String message) {
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 + "' 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);
return buildStandar(temp);
}
public static MessageEmbed getFlushError(String message) { public static MessageEmbed getFlushError(String message) {
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(); return buildStandar(new EmbedBuilder().setTitle(":warning: Flush Error :warning: ").setDescription(message).setColor(Color.red));
} }
public static MessageEmbed getRegister(String message) {
return buildStandar(new EmbedBuilder().setTitle(":pencil: Web Registration :pencil:").setDescription(message).setColor(Color.green));
}
public static MessageEmbed getInternalError() { public static MessageEmbed getInternalError() {
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")); 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) { public static MessageEmbed buildStandar(EmbedBuilder embedBuilder) {
return embedBuilder.setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).setThumbnail(MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build(); return embedBuilder.setFooter(MainBot.url, MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
} }
public static MessageEmbed getUnautorized() { public static MessageEmbed getUnautorized() {
return buildStandar(getError("You're not powerful enough to do that slave !").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("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 getLastMessageFromTextChannel(HashMap<String, String> message) { public static MessageEmbed getLastMessageFromTextChannel(HashMap<String, String> message) {
EmbedBuilder temp = new EmbedBuilder().setTitle("Channel uses checker").setDescription("Last message date for channels:").setColor(Color.green); EmbedBuilder temp = new EmbedBuilder().setTitle("Channel uses checker").setDescription("Last message date for channels:").setColor(Color.green);
for (Map.Entry<String, String> entry : message.entrySet()) { for (Map.Entry<String, String> entry : message.entrySet()) {
temp.addField(entry.getKey(), entry.getValue(), false); temp.addField(entry.getKey(), entry.getValue(), false);
} }
return buildStandar(temp); return buildStandar(temp);
} }
@ -119,16 +60,5 @@ public class EmbedMessageUtils {
return new EmbedBuilder().setTitle(":warning: Command error :warning: ").setDescription("").setColor(Color.red).setFooter("'//help move' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build(); return new EmbedBuilder().setTitle(":warning: Command error :warning: ").setDescription("").setColor(Color.red).setFooter("'//help move' for more info.", MainBot.jda.getSelfUser().getAvatarUrl()).setTimestamp(Instant.now()).build();
} }
public static MessageEmbed searchResult(SearchResult result) {
EmbedBuilder builder = new EmbedBuilder()
.setColor(Color.CYAN)
.setTitle(result.title)
.setImage(result.imageUrl)
.addField("Duration: ", result.duration, false)
.addField("URL:", "https://www.youtube.com/watch?v=" + result.id, false)
.addField("Chanel:", result.channelTittle, false);
return buildStandar(builder);
}
} }

View File

@ -1,50 +0,0 @@
package net.Broken.Tools;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Arrays;
import java.util.List;
/**
* Auto dell message util
*/
public class MessageTimeOut extends Thread {
List<Message> messages;
int second;
Logger logger = LogManager.getLogger();
public MessageTimeOut(List<Message> messages, int second) {
this.messages = messages;
this.second = second;
}
public MessageTimeOut(int second, Message... messages) {
this.messages = Arrays.asList(messages);
this.second = second;
}
@Override
public void run() {
logger.debug("Timer for message deletion stated...");
for (int i = 0; i < second; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
logger.debug("Time out! Deleting message!");
for (Message aMessage : messages) {
try {
aMessage.delete().queue();
} catch (ErrorResponseException e) {
logger.warn("Unknown Message");
}
}
}
}

View File

@ -1,125 +0,0 @@
package net.Broken.Tools;
import net.Broken.MainBot;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.managers.GuildManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
/**
* Auto spam utils TODO Rebuild all this shit!
*/
public class Moderateur {
Logger logger = LogManager.getLogger();
public Moderateur() {
}
// Cette méthode récupère le dernier message est le rajoute à "historique"
// SI (spam) retourne 1 (si l'user spam)
// SINON retourne 0
/**
* Get last message and add it on history. After analyse for spam detection
*
* @param user User
* @param guild Guild
* @param guildManager Guild manager
* @param event Message received event
* @return 1 if detected as spam, else 0
*/
public int analyse(Member user, Guild guild, GuildManager guildManager, MessageReceivedEvent event) {
ArrayList<Message> thisUserHistory = new ArrayList<>();//Creer tableau pour la copie
int i = 0; // variable de parcours de "historique"
int nbMessage = 3;
int spam = 0;
if (MainBot.spamUtils.containsKey(user) && MainBot.spamUtils.get(user).isOnSpam()) {
MainBot.spamUtils.get(user).addMessage(event.getMessage());
}
/********************************************
* si l'USER a deja envoyé un message *
********************************************/
if (MainBot.historique.containsKey(user))// Si le user a deja posté un message
{
/********************************************
* COPIE des infos d"historique" vers TOI[] *
********************************************/
thisUserHistory = (ArrayList<Message>) MainBot.historique.get(user).clone();
/********************************************
* Ajout dernier message recu + dans histo' *
********************************************/
thisUserHistory.add(0, event.getMessage());
if (thisUserHistory.size() > nbMessage + 1)
thisUserHistory.remove(4);
MainBot.historique.put(user, thisUserHistory);// On ajoute dans l'historique TOI
/*****************************
* ANALYSE des messages *
*****************************/
int equalCont = 0;
String oldMessage = "";
for (Message aMessage : thisUserHistory) {
if (aMessage.getContentRaw().equals(oldMessage))
equalCont++;
oldMessage = aMessage.getContentRaw();
}
if (equalCont >= nbMessage) {
spam = 1;
logger.info("Spam detected for " + user.getEffectiveName() + "with 3 identical messages : ");
for (Message aMessage : thisUserHistory) {
logger.info("\t - " + aMessage.getContentRaw());
}
MainBot.historique.put(user, new ArrayList<Message>());
}
} else {
/********************************************
* SI c'est le 1er message de l'USER *
********************************************/
// si le user n'a pas encore posté de message
// on ajoute le dernier message dans "historique"
thisUserHistory.add(0, event.getMessage());
MainBot.historique.put(user, thisUserHistory);
}
/**********************************
* AFFICHAGE DE HISTORIQUE *
**********************************/
/********************************************
* Comptage du nombre de message *
********************************************/
if (MainBot.message_compteur.containsKey(user))// Si le user a deja posté un message
{
int cpt = MainBot.message_compteur.get(user);
cpt++;
//System.out.println("compteur : "+cpt);
MainBot.message_compteur.put(user, cpt);
if (cpt > 5) {
MainBot.message_compteur.put(user, 0);
spam = 1;
logger.info("Spam detected for " + user.getEffectiveName() + "with 5 messages in 5 secondes: ");
ArrayList<Message> histo = MainBot.historique.get(user);
for (Message aMessage : histo) {
// logger.debug("\t*"+aMessage.getContent());
}
}
} else {
MainBot.message_compteur.put(user, 1);
}
return spam;
}
}

View File

@ -1,38 +0,0 @@
package net.Broken.Tools;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.User;
import org.apache.logging.log4j.Logger;
/**
* Private message utils
*/
public class PrivateMessage {
/**
* Auto open private channel and send message
*
* @param user User to send message
* @param message Message to send
* @param logger Logger
*/
public static void send(User user, String message, Logger logger) {
user.openPrivateChannel().complete().sendMessage(message).queue();
}
/**
* Auto open private channel and send message
*
* @param user User to send message
* @param message Message to send
* @param logger Logger
* @return Sended Message
*/
public static Message send(User user, MessageEmbed message, Logger logger) {
return user.openPrivateChannel().complete().sendMessage(message).complete();
}
}

View File

@ -7,7 +7,6 @@ import net.Broken.DB.Repository.UserRepository;
import net.Broken.MainBot; import net.Broken.MainBot;
import net.Broken.RestApi.Data.UserManager.UserInfoData; import net.Broken.RestApi.Data.UserManager.UserInfoData;
import net.Broken.Tools.EmbedMessageUtils; import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.PrivateMessage;
import net.Broken.Tools.ResourceLoader; import net.Broken.Tools.ResourceLoader;
import net.Broken.Tools.UserManager.Exceptions.*; import net.Broken.Tools.UserManager.Exceptions.*;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
@ -40,108 +39,6 @@ public class UserUtils {
public static UserUtils getInstance() { public static UserUtils getInstance() {
return INSTANCE; return INSTANCE;
} }
/**
* Check if user exist on Guild, if exist, generate and send checkTocken, create entry on PendingUser DB
*
* @param pendingUserRepository Pending user DB interface
* @param userRepository User DB interface
* @param passwordEncoder Password encoder
* @param userInfo Received data
* @return PendingUserEntity PK
* @throws UserNotFoundException User not found in guild
* @throws PasswordNotMatchException User already registered in PendingUser DB but password not match
* @throws UserAlreadyRegistered User already registered in User DB
*/
public String sendCheckToken(PendingUserRepository pendingUserRepository, UserRepository userRepository, PasswordEncoder passwordEncoder, UserInfoData userInfo) throws UserNotFoundException, PasswordNotMatchException, UserAlreadyRegistered {
logger.info("New registration for " + userInfo.name);
List<User> users = MainBot.jda.getUsersByName(userInfo.name, true);
if (users.size() < 1)
throw new UserNotFoundException();
User user = users.get(0);
logger.info("User found!");
PendingUserEntity pendingUserEntity = null;
String token = "";
//Preference if exist on register user
if (userRepository.findByJdaId(user.getId()).size() > 0) {
logger.warn("User already registered!");
throw new UserAlreadyRegistered();
}
//Check if exist in pading user Table
List<PendingUserEntity> pendingUsers = pendingUserRepository.findByJdaId(user.getId());
if (pendingUsers.size() != 0) {
PendingUserEntity thisUser = pendingUsers.get(0);
if (passwordEncoder.matches(userInfo.password, thisUser.getPassword())) {
logger.info("Password matches");
pendingUserEntity = thisUser;
token = thisUser.getCheckToken();
} else {
logger.warn("Password don't match!");
throw new PasswordNotMatchException();
}
}
logger.info("Generating check Token...");
if (token.equals("")) {
token = generateCheckToken();
}
logger.info("Token generated: " + token);
if (pendingUserEntity == null) {
pendingUserEntity = new PendingUserEntity(user.getName(), user.getId(), token, passwordEncoder.encode(userInfo.password));
pendingUserEntity = pendingUserRepository.save(pendingUserEntity);
}
String message = null;
try {
message = new ResourceLoader().getFile("MessagesTemplates/RegisterMessage.md");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
message = message.replace("%code", token);
MessageEmbed ebM = EmbedMessageUtils.getRegister(message);
PrivateMessage.send(user, ebM, logger);
return pendingUserEntity.getId().toString();
}
/**
* Confirm user account
*
* @param pendingUserRepository Pending user DB interface
* @param id UserPendingEntity PK to cofirm
* @param checkToken received token
* @return PendingUserEntity
* @throws TokenNotMatch Given token not match
* @throws UserNotFoundException User not found in Pending user DB
*/
public PendingUserEntity confirmCheckToken(PendingUserRepository pendingUserRepository, int id, String checkToken) throws TokenNotMatch, UserNotFoundException {
PendingUserEntity pendingUser = pendingUserRepository.findById(id);
if (pendingUser != null) {
if (pendingUser.getCheckToken().equals(checkToken)) {
logger.info("Check Token match!");
} else {
logger.warn("Check token not match!");
throw new TokenNotMatch();
}
} else {
logger.warn("Id not Found!");
throw new UserNotFoundException();
}
return pendingUser;
}
/** /**
* Get user Entity * Get user Entity
* *

View File

@ -1,67 +0,0 @@
package net.Broken.Tools;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import java.util.List;
/**
* Spam info for one user
*/
public class UserSpamUtils {
private AntiSpam.Minuteur minuteur;
private Member user;
private int multip = 0;
private boolean onSpam = false;
private List<Message> messages;
public UserSpamUtils(Member user, List<Message> messages) {
this.user = user;
this.messages = messages;
}
public int getTimeLeft() {
return minuteur.timeLeft;
}
public int getMultip() {
return multip;
}
public void setMultip(int multip) {
this.multip = multip;
}
public void setMinuteur(AntiSpam.Minuteur minuteur) {
this.minuteur = minuteur;
}
public void launchMinuteur() {
minuteur.start();
}
public boolean isOnSpam() {
return onSpam;
}
public void setOnSpam(boolean onSpam) {
this.onSpam = onSpam;
}
public Member getUser() {
return user;
}
public void addMessage(Message message) {
messages.add(message);
}
public List<Message> getMessages() {
return messages;
}
public void clearAndAdd(Message message) {
messages.clear();
messages.add(message);
}
}

View File

@ -1,4 +0,0 @@
Hey look! A cat!
And he's different everytime !
That is so cute! :cat:

View File

@ -1,4 +0,0 @@
Ho! Regarde! Un chat!
Mais il est different à chaque fois en plus!
C'est trop cute! :cat:

View File

@ -1,5 +0,0 @@
This command allow you to see which text channel is used by
returning the date from the last message sent in every text channel.
You can add a date in the format "day.month.year" to return channels
that don't have new message since this date.

View File

@ -1,6 +0,0 @@
Cette commande permet de verifier quels channels textes ne sont
pas utilisés en remontant la date du dernier message envoyé
dans tout les channels.
Vous pouvez ajouter une date au format "jour.mois.année" pour remonter les channels
qui n'ont pas eu de message depuis avant cette date.

View File

@ -1,2 +0,0 @@
This command doesn't have any help at the moment.
To help us improve: https://github.com/BrokenFire/BrokenDiscordBot

View File

@ -1,2 +0,0 @@
L'aide pour cette commande n'est pas encore disponible !
Pour contribué: https://github.com/BrokenFire/BrokenDiscordBot

View File

@ -1,3 +0,0 @@
`//flush <number>`
:arrow_right: *Erase the n last posts (Max = 100)*

View File

@ -1,3 +0,0 @@
`//flush <nbr>`
:arrow_right: *Efface les n derniers messages (Max = 100)*

View File

@ -1,2 +0,0 @@
`//move <@user> <@targeted_role>`
:arrow_right: *Move an user to the targeted role.*

View File

@ -1,2 +0,0 @@
`//move <@utilisateur> <@rôleCible>`
:arrow_right: *Deplacement d'un utilisateur vers un rôle cible, attention à bien faire les mentions.*

View File

@ -1,26 +0,0 @@
`//music play <url>`
:arrow_right: *Let's dance! Sets the vocal chat to use.*
`//music pause`
:arrow_right: *Pause the current track.*
`//music resume`
:arrow_right: *Resume the current track.*
`//music next`
:arrow_right: *Skip the current track.*
`//music stop`
:arrow_right: *Stop the current track and empty the playlist.*
`//music info`
:arrow_right: *Show info of the current track.*
`//music flush`
:arrow_right: *Delete the current playlist.*
`//music list`
:arrow_right: *Show information of the current playlist.*
`//music add(Next) <url>`
:arrow_right: *Add the url to the current playlist.*

View File

@ -1,26 +0,0 @@
`//music play <url>`
:arrow_right: *Let's dance! Definit le chat vocal à utiliser.*
`//music pause`
:arrow_right: *Mise en pause de la piste en cours.*
`//music resume`
:arrow_right: *Reprise de la lecture de la piste en cours.*
`//music next`
:arrow_right: *Change la piste en cours.*
`//music stop`
:arrow_right: *Arrête la piste en cours et supprime la playlist.*
`//music info`
:arrow_right: *Affiche les infos de la piste en cours.*
`//music flush`
:arrow_right: *Supprime la playlist en cours.*
`//music list`
:arrow_right: *Affiche la playlist en cours.*
`//music add(Next) <url>`
:arrow_right: *Ajoute l'url à la playlist en cours.*

View File

@ -1,2 +0,0 @@
`//ping`
:arrow_right: *Send back the bot's ping*

View File

@ -1,2 +0,0 @@
`//ping`
:arrow_right: *Renvoi le ping du bot*

View File

@ -1,8 +0,0 @@
`//spam extermine <@user> <multiplier>`
:arrow_right: *Penalize a spammer.*
`//spam pardon <@user>`
:arrow_right: *Forgive a spammer*
`//spam reset <@user>`
:arrow_right: *Reset the user's multiplier.*

View File

@ -1,8 +0,0 @@
`//spam extermine <@utilisateur> <multiplicateur>`
:arrow_right: *Punir un spammeur.*
`//spam pardon <@utilisateur>`
:arrow_right: *Annuler la punition d'un utilisateur.*
`//spam reset <@utilisateur>`
:arrow_right: *RAZ du multiplicateur d'un utilisateur.*

View File

@ -1,2 +0,0 @@
`//spaminfo <@user> `
:arrow_right: *Show punishment's information against the spam of the mentioned user (the author if there is no mention)*

View File

@ -1,2 +0,0 @@
`//spaminfo <@utilisateur> `
:arrow_right: *Affiche les infos relatives aux punitions contre le spam de l'utilisateur mentionnée (de l'auteur si pas de mention)*

View File

@ -1,7 +0,0 @@
```
@list
```
_PU = Private Usable
**>** __**[Web UI](https://claptrapbot.com )**__ :arrow_right: Music control, Settings, News

View File

@ -1,4 +1,3 @@
An attempt to associate your discord name was requested. An attempt to associate your discord name was requested.
Here is the verification code: Here is the verification code:

View File

@ -1,16 +1,21 @@
<Configuration status="error" packages="com.coralogix.sdk.appenders"> <Configuration status="error" packages="com.coralogix.sdk.appenders">
<Appenders> <Appenders>
<Console name="Console" target="SYSTEM_OUT"> <Console name="Console" target="SYSTEM_OUT">
<!--<PatternLayout pattern="[%d{HH:mm:ss.SSS}][%-5level][%-30.30c{1.}]: %msg%n" />--> <!--<PatternLayout pattern="[%d{HH:mm:ss.SSS}][%-5level][%-30.30c{1.}]: %msg%n" />-->
<PatternLayout> <PatternLayout>
<Pattern>[%d{HH:mm:ss.SSS}]%highlight{[%-5level]}{FATAL=red blink, ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}[%-30.30c{1.}]: %highlight{%msg%n}{FATAL=red blink, ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}</Pattern> <Pattern>[%d{HH:mm:ss.SSS}]%highlight{[%-5level]}{FATAL=red blink, ERROR=red, WARN=bright yellow ,
INFO=blue, DEBUG=bright black, TRACE=cyan}[%-30.30c{1.}]: %highlight{%msg%n}{FATAL=red blink,
ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}
</Pattern>
</PatternLayout> </PatternLayout>
</Console> </Console>
<RollingFile name="RollingFile" fileName="./logs/current-day.log" <RollingFile name="RollingFile" fileName="./logs/current-day.log"
filePattern="./logs/$${date:yyyy-MM}/discordBot-%d{yyyy-MM-dd}-%i.log.gz"> filePattern="./logs/$${date:yyyy-MM}/discordBot-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout> <PatternLayout>
<Pattern>[%d{HH:mm:ss.SSS}]%highlight{[%-5level]}{FATAL=red blink, ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}[%-30.30c{1.}]: %highlight{%msg%n}{FATAL=red blink, ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}</Pattern> <Pattern>[%d{HH:mm:ss.SSS}]%highlight{[%-5level]}{FATAL=red blink, ERROR=red, WARN=bright yellow ,
INFO=blue, DEBUG=bright black, TRACE=cyan}[%-30.30c{1.}]: %highlight{%msg%n}{FATAL=red blink,
ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}
</Pattern>
</PatternLayout> </PatternLayout>
<Policies> <Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/> <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
@ -20,7 +25,10 @@
</RollingFile> </RollingFile>
<File name="current" fileName="logs/current.log" append="false"> <File name="current" fileName="logs/current.log" append="false">
<PatternLayout> <PatternLayout>
<Pattern>[%d{HH:mm:ss.SSS}]%highlight{[%-5level]}{FATAL=red blink, ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}[%-30.30c{1.}]: %highlight{%msg%n}{FATAL=red blink, ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}</Pattern> <Pattern>[%d{HH:mm:ss.SSS}]%highlight{[%-5level]}{FATAL=red blink, ERROR=red, WARN=bright yellow ,
INFO=blue, DEBUG=bright black, TRACE=cyan}[%-30.30c{1.}]: %highlight{%msg%n}{FATAL=red blink,
ERROR=red, WARN=bright yellow , INFO=blue, DEBUG=bright black, TRACE=cyan}
</Pattern>
</PatternLayout> </PatternLayout>
</File> </File>
</Appenders> </Appenders>

View File

@ -7,7 +7,7 @@
* http://opensource.org/licenses/MIT * http://opensource.org/licenses/MIT
*/ */
.gha-feed { .gha-feed {
width: 100%; width: 100%;
height: 100%; height: 100%;
background: #fff; background: #fff;
@ -35,7 +35,7 @@
line-height: 1.4; line-height: 1.4;
} }
.gha-feed small{ .gha-feed small {
color: #666; color: #666;
font-weight: normal; font-weight: normal;
font-size: 13px; font-size: 13px;
@ -45,7 +45,9 @@
font-weight: normal; font-weight: normal;
} }
.gha-feed small a .more-commits { font-size: 11px; } .gha-feed small a .more-commits {
font-size: 11px;
}
span.gha-time { span.gha-time {
color: #bbb; color: #bbb;
@ -81,12 +83,12 @@ span.gha-time {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
background: #ffffff; /* Old browsers */ background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#f4f4f4)); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f4f4f4)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */ background: -webkit-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f4f4f4 100%); /* Opera 11.10+ */ background: -o-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f4f4f4 100%); /* IE10+ */ background: -ms-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#f4f4f4 100%); /* W3C */ background: linear-gradient(to bottom, #ffffff 0%, #f4f4f4 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f4f4f4', GradientType=0); /* IE6-9 */
} }
.gha-footer { .gha-footer {
@ -99,12 +101,12 @@ span.gha-time {
width: calc(100% - 15px); width: calc(100% - 15px);
background: #ffffff; /* Old browsers */ background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#f4f4f4)); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f4f4f4)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */ background: -webkit-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f4f4f4 100%); /* Opera 11.10+ */ background: -o-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f4f4f4 100%); /* IE10+ */ background: -ms-linear-gradient(top, #ffffff 0%, #f4f4f4 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#f4f4f4 100%); /* W3C */ background: linear-gradient(to bottom, #ffffff 0%, #f4f4f4 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f4f4f4', GradientType=0); /* IE6-9 */
color: #495961; color: #495961;
font-size: 13px; font-size: 13px;
padding-left: 10px; padding-left: 10px;
@ -118,8 +120,13 @@ span.gha-time {
font-weight: bold; font-weight: bold;
} }
.gha-footer a:hover { text-decoration: none; } .gha-footer a:hover {
.gha-header a:hover { text-decoration: none; } text-decoration: none;
}
.gha-header a:hover {
text-decoration: none;
}
.gha-github-icon { .gha-github-icon {
display: inline; display: inline;
@ -182,7 +189,7 @@ span.gha-time {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.gha-activity-icon .octicon{ .gha-activity-icon .octicon {
display: inline; display: inline;
float: left; float: left;
clear: both; clear: both;
@ -203,13 +210,15 @@ span.gha-time {
width: calc(100% - 50px); width: calc(100% - 50px);
} }
.gha-message-commits { font-size: 11px; } .gha-message-commits {
font-size: 11px;
}
.gha-message-merge { .gha-message-merge {
padding: 3px 7px; padding: 3px 7px;
border-radius: 3px; border-radius: 3px;
background: #e8f1f6; background: #e8f1f6;
color: rgba(0,0,0,0.5); color: rgba(0, 0, 0, 0.5);
font-size: 12px; font-size: 12px;
line-height: 2.0; line-height: 2.0;
} }
@ -230,7 +239,9 @@ span.gha-time {
border-radius: 2px; border-radius: 2px;
} }
.gha-gravatar-user { float: left; } .gha-gravatar-user {
float: left;
}
.gha-user-info { .gha-user-info {
display: inline-block; display: inline-block;
@ -241,8 +252,13 @@ span.gha-time {
font-size: 20px; font-size: 20px;
} }
.gha-user-info a { color: #495961; } .gha-user-info a {
.gha-user-info p a { font-weight: 100; } color: #495961;
}
.gha-user-info p a {
font-weight: 100;
}
.gha-without-name { .gha-without-name {
padding-top: 20px; padding-top: 20px;
@ -266,7 +282,18 @@ span.gha-time {
font-size: 12px; font-size: 12px;
} }
.gha-clear { clear: both; } .gha-clear {
.gha-muted { color: #666; } clear: both;
.gha-push { height: 87px; } }
.gha-push-small { height: 26px; }
.gha-muted {
color: #666;
}
.gha-push {
height: 87px;
}
.gha-push-small {
height: 26px;
}

View File

@ -2768,10 +2768,12 @@ video.responsive-video {
.pagination { .pagination {
width: 100%; width: 100%;
} }
.pagination li.prev, .pagination li.prev,
.pagination li.next { .pagination li.next {
width: 10%; width: 10%;
} }
.pagination li.pages { .pagination li.pages {
width: 80%; width: 80%;
overflow: hidden; overflow: hidden;
@ -3026,28 +3028,35 @@ td, th {
position: relative; position: relative;
/* sort out borders */ /* sort out borders */
} }
table.responsive-table td:empty:before { table.responsive-table td:empty:before {
content: '\00a0'; content: '\00a0';
} }
table.responsive-table th, table.responsive-table th,
table.responsive-table td { table.responsive-table td {
margin: 0; margin: 0;
vertical-align: top; vertical-align: top;
} }
table.responsive-table th { table.responsive-table th {
text-align: left; text-align: left;
} }
table.responsive-table thead { table.responsive-table thead {
display: block; display: block;
float: left; float: left;
} }
table.responsive-table thead tr { table.responsive-table thead tr {
display: block; display: block;
padding: 0 10px 0 0; padding: 0 10px 0 0;
} }
table.responsive-table thead tr th::before { table.responsive-table thead tr th::before {
content: "\00a0"; content: "\00a0";
} }
table.responsive-table tbody { table.responsive-table tbody {
display: block; display: block;
width: auto; width: auto;
@ -3055,23 +3064,28 @@ td, th {
overflow-x: auto; overflow-x: auto;
white-space: nowrap; white-space: nowrap;
} }
table.responsive-table tbody tr { table.responsive-table tbody tr {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
} }
table.responsive-table th { table.responsive-table th {
display: block; display: block;
text-align: right; text-align: right;
} }
table.responsive-table td { table.responsive-table td {
display: block; display: block;
min-height: 1.25em; min-height: 1.25em;
text-align: left; text-align: left;
} }
table.responsive-table tr { table.responsive-table tr {
border-bottom: none; border-bottom: none;
padding: 0 10px; padding: 0 10px;
} }
table.responsive-table thead { table.responsive-table thead {
border: 0; border: 0;
border-right: 1px solid rgba(0, 0, 0, 0.12); border-right: 1px solid rgba(0, 0, 0, 0.12);
@ -3727,177 +3741,224 @@ table span.badge {
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m2 { .row .col.m2 {
width: 16.6666666667%; width: 16.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m3 { .row .col.m3 {
width: 25%; width: 25%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m4 { .row .col.m4 {
width: 33.3333333333%; width: 33.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m5 { .row .col.m5 {
width: 41.6666666667%; width: 41.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m6 { .row .col.m6 {
width: 50%; width: 50%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m7 { .row .col.m7 {
width: 58.3333333333%; width: 58.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m8 { .row .col.m8 {
width: 66.6666666667%; width: 66.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m9 { .row .col.m9 {
width: 75%; width: 75%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m10 { .row .col.m10 {
width: 83.3333333333%; width: 83.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m11 { .row .col.m11 {
width: 91.6666666667%; width: 91.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.m12 { .row .col.m12 {
width: 100%; width: 100%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.offset-m1 { .row .col.offset-m1 {
margin-left: 8.3333333333%; margin-left: 8.3333333333%;
} }
.row .col.pull-m1 { .row .col.pull-m1 {
right: 8.3333333333%; right: 8.3333333333%;
} }
.row .col.push-m1 { .row .col.push-m1 {
left: 8.3333333333%; left: 8.3333333333%;
} }
.row .col.offset-m2 { .row .col.offset-m2 {
margin-left: 16.6666666667%; margin-left: 16.6666666667%;
} }
.row .col.pull-m2 { .row .col.pull-m2 {
right: 16.6666666667%; right: 16.6666666667%;
} }
.row .col.push-m2 { .row .col.push-m2 {
left: 16.6666666667%; left: 16.6666666667%;
} }
.row .col.offset-m3 { .row .col.offset-m3 {
margin-left: 25%; margin-left: 25%;
} }
.row .col.pull-m3 { .row .col.pull-m3 {
right: 25%; right: 25%;
} }
.row .col.push-m3 { .row .col.push-m3 {
left: 25%; left: 25%;
} }
.row .col.offset-m4 { .row .col.offset-m4 {
margin-left: 33.3333333333%; margin-left: 33.3333333333%;
} }
.row .col.pull-m4 { .row .col.pull-m4 {
right: 33.3333333333%; right: 33.3333333333%;
} }
.row .col.push-m4 { .row .col.push-m4 {
left: 33.3333333333%; left: 33.3333333333%;
} }
.row .col.offset-m5 { .row .col.offset-m5 {
margin-left: 41.6666666667%; margin-left: 41.6666666667%;
} }
.row .col.pull-m5 { .row .col.pull-m5 {
right: 41.6666666667%; right: 41.6666666667%;
} }
.row .col.push-m5 { .row .col.push-m5 {
left: 41.6666666667%; left: 41.6666666667%;
} }
.row .col.offset-m6 { .row .col.offset-m6 {
margin-left: 50%; margin-left: 50%;
} }
.row .col.pull-m6 { .row .col.pull-m6 {
right: 50%; right: 50%;
} }
.row .col.push-m6 { .row .col.push-m6 {
left: 50%; left: 50%;
} }
.row .col.offset-m7 { .row .col.offset-m7 {
margin-left: 58.3333333333%; margin-left: 58.3333333333%;
} }
.row .col.pull-m7 { .row .col.pull-m7 {
right: 58.3333333333%; right: 58.3333333333%;
} }
.row .col.push-m7 { .row .col.push-m7 {
left: 58.3333333333%; left: 58.3333333333%;
} }
.row .col.offset-m8 { .row .col.offset-m8 {
margin-left: 66.6666666667%; margin-left: 66.6666666667%;
} }
.row .col.pull-m8 { .row .col.pull-m8 {
right: 66.6666666667%; right: 66.6666666667%;
} }
.row .col.push-m8 { .row .col.push-m8 {
left: 66.6666666667%; left: 66.6666666667%;
} }
.row .col.offset-m9 { .row .col.offset-m9 {
margin-left: 75%; margin-left: 75%;
} }
.row .col.pull-m9 { .row .col.pull-m9 {
right: 75%; right: 75%;
} }
.row .col.push-m9 { .row .col.push-m9 {
left: 75%; left: 75%;
} }
.row .col.offset-m10 { .row .col.offset-m10 {
margin-left: 83.3333333333%; margin-left: 83.3333333333%;
} }
.row .col.pull-m10 { .row .col.pull-m10 {
right: 83.3333333333%; right: 83.3333333333%;
} }
.row .col.push-m10 { .row .col.push-m10 {
left: 83.3333333333%; left: 83.3333333333%;
} }
.row .col.offset-m11 { .row .col.offset-m11 {
margin-left: 91.6666666667%; margin-left: 91.6666666667%;
} }
.row .col.pull-m11 { .row .col.pull-m11 {
right: 91.6666666667%; right: 91.6666666667%;
} }
.row .col.push-m11 { .row .col.push-m11 {
left: 91.6666666667%; left: 91.6666666667%;
} }
.row .col.offset-m12 { .row .col.offset-m12 {
margin-left: 100%; margin-left: 100%;
} }
.row .col.pull-m12 { .row .col.pull-m12 {
right: 100%; right: 100%;
} }
.row .col.push-m12 { .row .col.push-m12 {
left: 100%; left: 100%;
} }
@ -3910,177 +3971,224 @@ table span.badge {
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l2 { .row .col.l2 {
width: 16.6666666667%; width: 16.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l3 { .row .col.l3 {
width: 25%; width: 25%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l4 { .row .col.l4 {
width: 33.3333333333%; width: 33.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l5 { .row .col.l5 {
width: 41.6666666667%; width: 41.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l6 { .row .col.l6 {
width: 50%; width: 50%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l7 { .row .col.l7 {
width: 58.3333333333%; width: 58.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l8 { .row .col.l8 {
width: 66.6666666667%; width: 66.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l9 { .row .col.l9 {
width: 75%; width: 75%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l10 { .row .col.l10 {
width: 83.3333333333%; width: 83.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l11 { .row .col.l11 {
width: 91.6666666667%; width: 91.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.l12 { .row .col.l12 {
width: 100%; width: 100%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.offset-l1 { .row .col.offset-l1 {
margin-left: 8.3333333333%; margin-left: 8.3333333333%;
} }
.row .col.pull-l1 { .row .col.pull-l1 {
right: 8.3333333333%; right: 8.3333333333%;
} }
.row .col.push-l1 { .row .col.push-l1 {
left: 8.3333333333%; left: 8.3333333333%;
} }
.row .col.offset-l2 { .row .col.offset-l2 {
margin-left: 16.6666666667%; margin-left: 16.6666666667%;
} }
.row .col.pull-l2 { .row .col.pull-l2 {
right: 16.6666666667%; right: 16.6666666667%;
} }
.row .col.push-l2 { .row .col.push-l2 {
left: 16.6666666667%; left: 16.6666666667%;
} }
.row .col.offset-l3 { .row .col.offset-l3 {
margin-left: 25%; margin-left: 25%;
} }
.row .col.pull-l3 { .row .col.pull-l3 {
right: 25%; right: 25%;
} }
.row .col.push-l3 { .row .col.push-l3 {
left: 25%; left: 25%;
} }
.row .col.offset-l4 { .row .col.offset-l4 {
margin-left: 33.3333333333%; margin-left: 33.3333333333%;
} }
.row .col.pull-l4 { .row .col.pull-l4 {
right: 33.3333333333%; right: 33.3333333333%;
} }
.row .col.push-l4 { .row .col.push-l4 {
left: 33.3333333333%; left: 33.3333333333%;
} }
.row .col.offset-l5 { .row .col.offset-l5 {
margin-left: 41.6666666667%; margin-left: 41.6666666667%;
} }
.row .col.pull-l5 { .row .col.pull-l5 {
right: 41.6666666667%; right: 41.6666666667%;
} }
.row .col.push-l5 { .row .col.push-l5 {
left: 41.6666666667%; left: 41.6666666667%;
} }
.row .col.offset-l6 { .row .col.offset-l6 {
margin-left: 50%; margin-left: 50%;
} }
.row .col.pull-l6 { .row .col.pull-l6 {
right: 50%; right: 50%;
} }
.row .col.push-l6 { .row .col.push-l6 {
left: 50%; left: 50%;
} }
.row .col.offset-l7 { .row .col.offset-l7 {
margin-left: 58.3333333333%; margin-left: 58.3333333333%;
} }
.row .col.pull-l7 { .row .col.pull-l7 {
right: 58.3333333333%; right: 58.3333333333%;
} }
.row .col.push-l7 { .row .col.push-l7 {
left: 58.3333333333%; left: 58.3333333333%;
} }
.row .col.offset-l8 { .row .col.offset-l8 {
margin-left: 66.6666666667%; margin-left: 66.6666666667%;
} }
.row .col.pull-l8 { .row .col.pull-l8 {
right: 66.6666666667%; right: 66.6666666667%;
} }
.row .col.push-l8 { .row .col.push-l8 {
left: 66.6666666667%; left: 66.6666666667%;
} }
.row .col.offset-l9 { .row .col.offset-l9 {
margin-left: 75%; margin-left: 75%;
} }
.row .col.pull-l9 { .row .col.pull-l9 {
right: 75%; right: 75%;
} }
.row .col.push-l9 { .row .col.push-l9 {
left: 75%; left: 75%;
} }
.row .col.offset-l10 { .row .col.offset-l10 {
margin-left: 83.3333333333%; margin-left: 83.3333333333%;
} }
.row .col.pull-l10 { .row .col.pull-l10 {
right: 83.3333333333%; right: 83.3333333333%;
} }
.row .col.push-l10 { .row .col.push-l10 {
left: 83.3333333333%; left: 83.3333333333%;
} }
.row .col.offset-l11 { .row .col.offset-l11 {
margin-left: 91.6666666667%; margin-left: 91.6666666667%;
} }
.row .col.pull-l11 { .row .col.pull-l11 {
right: 91.6666666667%; right: 91.6666666667%;
} }
.row .col.push-l11 { .row .col.push-l11 {
left: 91.6666666667%; left: 91.6666666667%;
} }
.row .col.offset-l12 { .row .col.offset-l12 {
margin-left: 100%; margin-left: 100%;
} }
.row .col.pull-l12 { .row .col.pull-l12 {
right: 100%; right: 100%;
} }
.row .col.push-l12 { .row .col.push-l12 {
left: 100%; left: 100%;
} }
@ -4093,177 +4201,224 @@ table span.badge {
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl2 { .row .col.xl2 {
width: 16.6666666667%; width: 16.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl3 { .row .col.xl3 {
width: 25%; width: 25%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl4 { .row .col.xl4 {
width: 33.3333333333%; width: 33.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl5 { .row .col.xl5 {
width: 41.6666666667%; width: 41.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl6 { .row .col.xl6 {
width: 50%; width: 50%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl7 { .row .col.xl7 {
width: 58.3333333333%; width: 58.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl8 { .row .col.xl8 {
width: 66.6666666667%; width: 66.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl9 { .row .col.xl9 {
width: 75%; width: 75%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl10 { .row .col.xl10 {
width: 83.3333333333%; width: 83.3333333333%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl11 { .row .col.xl11 {
width: 91.6666666667%; width: 91.6666666667%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.xl12 { .row .col.xl12 {
width: 100%; width: 100%;
margin-left: auto; margin-left: auto;
left: auto; left: auto;
right: auto; right: auto;
} }
.row .col.offset-xl1 { .row .col.offset-xl1 {
margin-left: 8.3333333333%; margin-left: 8.3333333333%;
} }
.row .col.pull-xl1 { .row .col.pull-xl1 {
right: 8.3333333333%; right: 8.3333333333%;
} }
.row .col.push-xl1 { .row .col.push-xl1 {
left: 8.3333333333%; left: 8.3333333333%;
} }
.row .col.offset-xl2 { .row .col.offset-xl2 {
margin-left: 16.6666666667%; margin-left: 16.6666666667%;
} }
.row .col.pull-xl2 { .row .col.pull-xl2 {
right: 16.6666666667%; right: 16.6666666667%;
} }
.row .col.push-xl2 { .row .col.push-xl2 {
left: 16.6666666667%; left: 16.6666666667%;
} }
.row .col.offset-xl3 { .row .col.offset-xl3 {
margin-left: 25%; margin-left: 25%;
} }
.row .col.pull-xl3 { .row .col.pull-xl3 {
right: 25%; right: 25%;
} }
.row .col.push-xl3 { .row .col.push-xl3 {
left: 25%; left: 25%;
} }
.row .col.offset-xl4 { .row .col.offset-xl4 {
margin-left: 33.3333333333%; margin-left: 33.3333333333%;
} }
.row .col.pull-xl4 { .row .col.pull-xl4 {
right: 33.3333333333%; right: 33.3333333333%;
} }
.row .col.push-xl4 { .row .col.push-xl4 {
left: 33.3333333333%; left: 33.3333333333%;
} }
.row .col.offset-xl5 { .row .col.offset-xl5 {
margin-left: 41.6666666667%; margin-left: 41.6666666667%;
} }
.row .col.pull-xl5 { .row .col.pull-xl5 {
right: 41.6666666667%; right: 41.6666666667%;
} }
.row .col.push-xl5 { .row .col.push-xl5 {
left: 41.6666666667%; left: 41.6666666667%;
} }
.row .col.offset-xl6 { .row .col.offset-xl6 {
margin-left: 50%; margin-left: 50%;
} }
.row .col.pull-xl6 { .row .col.pull-xl6 {
right: 50%; right: 50%;
} }
.row .col.push-xl6 { .row .col.push-xl6 {
left: 50%; left: 50%;
} }
.row .col.offset-xl7 { .row .col.offset-xl7 {
margin-left: 58.3333333333%; margin-left: 58.3333333333%;
} }
.row .col.pull-xl7 { .row .col.pull-xl7 {
right: 58.3333333333%; right: 58.3333333333%;
} }
.row .col.push-xl7 { .row .col.push-xl7 {
left: 58.3333333333%; left: 58.3333333333%;
} }
.row .col.offset-xl8 { .row .col.offset-xl8 {
margin-left: 66.6666666667%; margin-left: 66.6666666667%;
} }
.row .col.pull-xl8 { .row .col.pull-xl8 {
right: 66.6666666667%; right: 66.6666666667%;
} }
.row .col.push-xl8 { .row .col.push-xl8 {
left: 66.6666666667%; left: 66.6666666667%;
} }
.row .col.offset-xl9 { .row .col.offset-xl9 {
margin-left: 75%; margin-left: 75%;
} }
.row .col.pull-xl9 { .row .col.pull-xl9 {
right: 75%; right: 75%;
} }
.row .col.push-xl9 { .row .col.push-xl9 {
left: 75%; left: 75%;
} }
.row .col.offset-xl10 { .row .col.offset-xl10 {
margin-left: 83.3333333333%; margin-left: 83.3333333333%;
} }
.row .col.pull-xl10 { .row .col.pull-xl10 {
right: 83.3333333333%; right: 83.3333333333%;
} }
.row .col.push-xl10 { .row .col.push-xl10 {
left: 83.3333333333%; left: 83.3333333333%;
} }
.row .col.offset-xl11 { .row .col.offset-xl11 {
margin-left: 91.6666666667%; margin-left: 91.6666666667%;
} }
.row .col.pull-xl11 { .row .col.pull-xl11 {
right: 91.6666666667%; right: 91.6666666667%;
} }
.row .col.push-xl11 { .row .col.push-xl11 {
left: 91.6666666667%; left: 91.6666666667%;
} }
.row .col.offset-xl12 { .row .col.offset-xl12 {
margin-left: 100%; margin-left: 100%;
} }
.row .col.pull-xl12 { .row .col.pull-xl12 {
right: 100%; right: 100%;
} }
.row .col.push-xl12 { .row .col.push-xl12 {
left: 100%; left: 100%;
} }
@ -4348,14 +4503,17 @@ nav .brand-logo.center {
-webkit-transform: translateX(-50%); -webkit-transform: translateX(-50%);
transform: translateX(-50%); transform: translateX(-50%);
} }
nav .brand-logo.left, nav .brand-logo.right { nav .brand-logo.left, nav .brand-logo.right {
padding: 0; padding: 0;
-webkit-transform: none; -webkit-transform: none;
transform: none; transform: none;
} }
nav .brand-logo.left { nav .brand-logo.left {
left: 0.5rem; left: 0.5rem;
} }
nav .brand-logo.right { nav .brand-logo.right {
right: 0.5rem; right: 0.5rem;
left: auto; left: auto;
@ -4475,10 +4633,12 @@ nav .input-field label.active i {
nav.nav-extended .nav-wrapper { nav.nav-extended .nav-wrapper {
min-height: 64px; min-height: 64px;
} }
nav, nav .nav-wrapper i, nav a.sidenav-trigger, nav a.sidenav-trigger i { nav, nav .nav-wrapper i, nav a.sidenav-trigger, nav a.sidenav-trigger i {
height: 64px; height: 64px;
line-height: 64px; line-height: 64px;
} }
.navbar-fixed { .navbar-fixed {
height: 64px; height: 64px;
} }
@ -5118,12 +5278,14 @@ small {
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
} }
.tabs .tab { .tabs .tab {
-webkit-box-flex: 1; -webkit-box-flex: 1;
-webkit-flex-grow: 1; -webkit-flex-grow: 1;
-ms-flex-positive: 1; -ms-flex-positive: 1;
flex-grow: 1; flex-grow: 1;
} }
.tabs .tab a { .tabs .tab a {
padding: 0 12px; padding: 0 12px;
} }
@ -6107,15 +6269,19 @@ label {
::-webkit-input-placeholder { ::-webkit-input-placeholder {
color: #d1d1d1; color: #d1d1d1;
} }
::-moz-placeholder { ::-moz-placeholder {
color: #d1d1d1; color: #d1d1d1;
} }
:-ms-input-placeholder { :-ms-input-placeholder {
color: #d1d1d1; color: #d1d1d1;
} }
::-ms-input-placeholder { ::-ms-input-placeholder {
color: #d1d1d1; color: #d1d1d1;
} }
::placeholder { ::placeholder {
color: #d1d1d1; color: #d1d1d1;
} }
@ -7714,13 +7880,16 @@ input[type=range]::-ms-thumb {
-webkit-transform: translateX(-105%); -webkit-transform: translateX(-105%);
transform: translateX(-105%); transform: translateX(-105%);
} }
.sidenav.sidenav-fixed.right-aligned { .sidenav.sidenav-fixed.right-aligned {
-webkit-transform: translateX(105%); -webkit-transform: translateX(105%);
transform: translateX(105%); transform: translateX(105%);
} }
.sidenav > a { .sidenav > a {
padding: 0 16px; padding: 0 16px;
} }
.sidenav .user-view { .sidenav .user-view {
padding: 16px 16px 0; padding: 16px 16px 0;
} }
@ -8486,10 +8655,19 @@ input[type=range]::-ms-thumb {
visibility: visible; visibility: visible;
-webkit-animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite; -webkit-animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite;
animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite; animation: pulse-animation 1s cubic-bezier(0.24, 0, 0.38, 1) infinite;
-webkit-transition: opacity .3s, visibility 0s 1s, -webkit-transform .3s; -webkit-transition: opacity .3s,
transition: opacity .3s, visibility 0s 1s, -webkit-transform .3s; visibility 0s 1s,
transition: opacity .3s, transform .3s, visibility 0s 1s; -webkit-transform .3s;
transition: opacity .3s, transform .3s, visibility 0s 1s, -webkit-transform .3s; transition: opacity .3s,
visibility 0s 1s,
-webkit-transform .3s;
transition: opacity .3s,
transform .3s,
visibility 0s 1s;
transition: opacity .3s,
transform .3s,
visibility 0s 1s,
-webkit-transform .3s;
} }
.tap-target { .tap-target {
@ -8542,10 +8720,19 @@ input[type=range]::-ms-thumb {
.tap-target-wave::after { .tap-target-wave::after {
visibility: hidden; visibility: hidden;
-webkit-transition: opacity .3s, visibility 0s, -webkit-transform .3s; -webkit-transition: opacity .3s,
transition: opacity .3s, visibility 0s, -webkit-transform .3s; visibility 0s,
transition: opacity .3s, transform .3s, visibility 0s; -webkit-transform .3s;
transition: opacity .3s, transform .3s, visibility 0s, -webkit-transform .3s; transition: opacity .3s,
visibility 0s,
-webkit-transform .3s;
transition: opacity .3s,
transform .3s,
visibility 0s;
transition: opacity .3s,
transform .3s,
visibility 0s,
-webkit-transform .3s;
z-index: -1; z-index: -1;
} }
@ -8823,6 +9010,7 @@ input[type=range]::-ms-thumb {
.datepicker-modal { .datepicker-modal {
max-width: 625px; max-width: 625px;
} }
.datepicker-container.modal-content { .datepicker-container.modal-content {
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-webkit-box-direction: normal; -webkit-box-direction: normal;
@ -8830,17 +9018,20 @@ input[type=range]::-ms-thumb {
-ms-flex-direction: row; -ms-flex-direction: row;
flex-direction: row; flex-direction: row;
} }
.datepicker-date-display { .datepicker-date-display {
-webkit-box-flex: 0; -webkit-box-flex: 0;
-webkit-flex: 0 1 270px; -webkit-flex: 0 1 270px;
-ms-flex: 0 1 270px; -ms-flex: 0 1 270px;
flex: 0 1 270px; flex: 0 1 270px;
} }
.datepicker-controls, .datepicker-controls,
.datepicker-table, .datepicker-table,
.datepicker-footer { .datepicker-footer {
width: 320px; width: 320px;
} }
.datepicker-day-button { .datepicker-day-button {
line-height: 44px; line-height: 44px;
} }
@ -9047,6 +9238,7 @@ input[type=range]::-ms-thumb {
.timepicker-modal { .timepicker-modal {
max-width: 600px; max-width: 600px;
} }
.timepicker-container.modal-content { .timepicker-container.modal-content {
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-webkit-box-direction: normal; -webkit-box-direction: normal;
@ -9054,9 +9246,11 @@ input[type=range]::-ms-thumb {
-ms-flex-direction: row; -ms-flex-direction: row;
flex-direction: row; flex-direction: row;
} }
.timepicker-text-container { .timepicker-text-container {
top: 32%; top: 32%;
} }
.timepicker-display-am-pm { .timepicker-display-am-pm {
position: relative; position: relative;
right: auto; right: auto;

View File

@ -1,11 +1,11 @@
/*.nav-wrapper{*/ /*.nav-wrapper{*/
/*!*margin-right: 1%;*!*/ /*!*margin-right: 1%;*!*/
/*margin-left: 1%;*/ /*margin-left: 1%;*/
/*width: 100%;*/ /*width: 100%;*/
/*}*/ /*}*/
.collapsible-body{ .collapsible-body {
padding: 0px; padding: 0px;
} }
@ -25,7 +25,7 @@ main {
url("/css/font/norwester.woff"); url("/css/font/norwester.woff");
} }
.brand-logo{ .brand-logo {
font-family: Norwester; font-family: Norwester;
font-size: 45px !important; font-size: 45px !important;
font-weight: bold; font-weight: bold;
@ -34,10 +34,10 @@ main {
-webkit-text-stroke-width: 3px; -webkit-text-stroke-width: 3px;
} }
#dropdown_guilds a:hover{ #dropdown_guilds a:hover {
background-color: rgba(0, 0, 0, 0) !important; background-color: rgba(0, 0, 0, 0) !important;
} }
#dropdown_guilds li:hover{ #dropdown_guilds li:hover {
background-color: rgba(0, 0, 0, 0.2) !important; background-color: rgba(0, 0, 0, 0.2) !important;
} }

File diff suppressed because one or more lines are too long

View File

@ -7,26 +7,33 @@
* http://opensource.org/licenses/MIT * http://opensource.org/licenses/MIT
*/ */
var GitHubActivity = (function() { var GitHubActivity = (function () {
'use strict'; 'use strict';
var obj = {}; var obj = {};
var methods = { var methods = {
renderLink: function(url, title, cssClass) { renderLink: function (url, title, cssClass) {
if (!title) { title = url; } if (!title) {
if (typeof(cssClass) === 'undefined') cssClass = ""; title = url;
return Mustache.render('<a class="' + cssClass + '" href="{{url}}" target="_blank">{{{title}}}</a>', { url: url, title: title }); }
if (typeof (cssClass) === 'undefined') cssClass = "";
return Mustache.render('<a class="' + cssClass + '" href="{{url}}" target="_blank">{{{title}}}</a>', {
url: url,
title: title
});
}, },
renderGitHubLink: function(url, title, cssClass) { renderGitHubLink: function (url, title, cssClass) {
if (!title) { title = url; } if (!title) {
if (typeof(cssClass) === 'undefined') cssClass = ""; title = url;
}
if (typeof (cssClass) === 'undefined') cssClass = "";
return methods.renderLink('https://github.com/' + url, title, cssClass); return methods.renderLink('https://github.com/' + url, title, cssClass);
}, },
getMessageFor: function(data) { getMessageFor: function (data) {
var p = data.payload; var p = data.payload;
data.repoLink = methods.renderGitHubLink(data.repo.name); data.repoLink = methods.renderGitHubLink(data.repo.name);
data.userGravatar = Mustache.render('<div class="gha-gravatar-user"><img src="{{url}}" class="gha-gravatar-small"></div>', { url: data.actor.avatar_url }); data.userGravatar = Mustache.render('<div class="gha-gravatar-user"><img src="{{url}}" class="gha-gravatar-small"></div>', {url: data.actor.avatar_url});
// Get the branch name if it exists. // Get the branch name if it exists.
if (p.ref) { if (p.ref) {
@ -44,19 +51,26 @@ var GitHubActivity = (function() {
var length = p.commits.length; var length = p.commits.length;
if (length === 2) { if (length === 2) {
// If there are 2 commits, show message 'View comparison for these 2 commits >>' // If there are 2 commits, show message 'View comparison for these 2 commits >>'
data.commitsMessage = Mustache.render('<a href="https://github.com/{{repo}}/compare/{{shaDiff}}">View comparison for these 2 commits &raquo;</a>', { repo: data.repo.name, shaDiff: shaDiff }); data.commitsMessage = Mustache.render('<a href="https://github.com/{{repo}}/compare/{{shaDiff}}">View comparison for these 2 commits &raquo;</a>', {
repo: data.repo.name,
shaDiff: shaDiff
});
} else if (length > 2) { } else if (length > 2) {
// If there are more than two, show message '(numberOfCommits - 2) more commits >>' // If there are more than two, show message '(numberOfCommits - 2) more commits >>'
data.commitsMessage = Mustache.render('<a href="https://github.com/{{repo}}/compare/{{shaDiff}}">{{length}} more ' + pluralize('commit', length - 2) + ' &raquo;</a>', { repo: data.repo.name, shaDiff: shaDiff, length: p.size - 2 }); data.commitsMessage = Mustache.render('<a href="https://github.com/{{repo}}/compare/{{shaDiff}}">{{length}} more ' + pluralize('commit', length - 2) + ' &raquo;</a>', {
repo: data.repo.name,
shaDiff: shaDiff,
length: p.size - 2
});
} }
p.commits.forEach(function(d, i) { p.commits.forEach(function (d, i) {
if (d.message.length > 66) { if (d.message.length > 66) {
d.message = d.message.substring(0, 66) + '...'; d.message = d.message.substring(0, 66) + '...';
} }
if (i < 2) { if (i < 2) {
d.shaLink = methods.renderGitHubLink(data.repo.name + '/commit/' + d.sha, d.sha.substring(0, 6), 'gha-sha'); d.shaLink = methods.renderGitHubLink(data.repo.name + '/commit/' + d.sha, d.sha.substring(0, 6), 'gha-sha');
d.committerGravatar = Mustache.render('<img class="gha-gravatar-commit" src="https://gravatar.com/avatar/{{hash}}?s=30&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="16" />', { hash: md5(d.author.email) }); d.committerGravatar = Mustache.render('<img class="gha-gravatar-commit" src="https://gravatar.com/avatar/{{hash}}?s=30&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="16" />', {hash: md5(d.author.email)});
} else { } else {
// Delete the rest of the commits after the first 2, and then break out of the each loop. // Delete the rest of the commits after the first 2, and then break out of the each loop.
p.commits.splice(2, p.size); p.commits.splice(2, p.size);
@ -85,7 +99,11 @@ var GitHubActivity = (function() {
if (p.pull_request.merged) { if (p.pull_request.merged) {
p.action = "merged"; p.action = "merged";
var message = '{{c}} ' + pluralize('commit', pr.commits) + ' with {{a}} ' + pluralize('addition', pr.additions) + ' and {{d}} ' + pluralize('deletion', pr.deletions); var message = '{{c}} ' + pluralize('commit', pr.commits) + ' with {{a}} ' + pluralize('addition', pr.additions) + ' and {{d}} ' + pluralize('deletion', pr.deletions);
data.mergeMessage = Mustache.render('<br><small class="gha-message-merge">' + message + '</small>', { c: pr.commits, a: pr.additions, d: pr.deletions }); data.mergeMessage = Mustache.render('<br><small class="gha-message-merge">' + message + '</small>', {
c: pr.commits,
a: pr.additions,
d: pr.deletions
});
} }
} }
@ -139,14 +157,19 @@ var GitHubActivity = (function() {
} else { } else {
icon = icons[data.type] icon = icons[data.type]
} }
var activity = { message: message, icon: icon, timeString: timeString, userLink: methods.renderGitHubLink(data.actor.login) }; var activity = {
message: message,
icon: icon,
timeString: timeString,
userLink: methods.renderGitHubLink(data.actor.login)
};
if (singleLineActivities.indexOf(data.type) > -1) { if (singleLineActivities.indexOf(data.type) > -1) {
return Mustache.render(templates.SingleLineActivity, activity); return Mustache.render(templates.SingleLineActivity, activity);
} }
return Mustache.render(templates.Activity, activity); return Mustache.render(templates.Activity, activity);
}, },
getHeaderHTML: function(data) { getHeaderHTML: function (data) {
if (data.name) { if (data.name) {
data.userNameLink = methods.renderLink(data.html_url, data.name); data.userNameLink = methods.renderLink(data.html_url, data.name);
} else { } else {
@ -157,7 +180,7 @@ var GitHubActivity = (function() {
return Mustache.render(templates.UserHeader, data); return Mustache.render(templates.UserHeader, data);
}, },
getActivityHTML: function(data, limit) { getActivityHTML: function (data, limit) {
var text = ''; var text = '';
var dataLength = data.length; var dataLength = data.length;
if (limit && limit > dataLength) { if (limit && limit > dataLength) {
@ -174,14 +197,14 @@ var GitHubActivity = (function() {
return text; return text;
}, },
getOutputFromRequest: function(url, callback) { getOutputFromRequest: function (url, callback) {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open('GET', url); request.open('GET', url);
request.setRequestHeader('Accept', 'application/vnd.github.v3+json'); request.setRequestHeader('Accept', 'application/vnd.github.v3+json');
request.onreadystatechange = function() { request.onreadystatechange = function () {
if (request.readyState === 4) { if (request.readyState === 4) {
if (request.status >= 200 && request.status < 300){ if (request.status >= 200 && request.status < 300) {
var data = JSON.parse(request.responseText); var data = JSON.parse(request.responseText);
callback(undefined, data); callback(undefined, data);
} else { } else {
@ -190,14 +213,16 @@ var GitHubActivity = (function() {
} }
}; };
request.onerror = function() { callback('An error occurred connecting to ' + url); }; request.onerror = function () {
callback('An error occurred connecting to ' + url);
};
request.send(); request.send();
}, },
renderStream: function(output, div) { renderStream: function (output, div) {
div.innerHTML = Mustache.render(templates.Stream, { text: output, footer: templates.Footer }); div.innerHTML = Mustache.render(templates.Stream, {text: output, footer: templates.Footer});
div.style.position = 'relative'; div.style.position = 'relative';
}, },
writeOutput: function(selector, content) { writeOutput: function (selector, content) {
var div = selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1)); var div = selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1));
if (div instanceof HTMLCollection) { if (div instanceof HTMLCollection) {
for (var i = 0; i < div.length; i++) { for (var i = 0; i < div.length; i++) {
@ -207,14 +232,14 @@ var GitHubActivity = (function() {
methods.renderStream(content, div); methods.renderStream(content, div);
} }
}, },
renderIfReady: function(selector, header, activity) { renderIfReady: function (selector, header, activity) {
if (header && activity) { if (header && activity) {
methods.writeOutput(selector, header + activity); methods.writeOutput(selector, header + activity);
} }
} }
}; };
obj.feed = function(options) { obj.feed = function (options) {
if (!options.username || !options.selector) { if (!options.username || !options.selector) {
throw "You must specify the username and selector options for the activity stream."; throw "You must specify the username and selector options for the activity stream.";
return false; return false;
@ -226,7 +251,7 @@ var GitHubActivity = (function() {
header, header,
activity; activity;
if (!!options.repository){ if (!!options.repository) {
eventsUrl = 'https://api.github.com/repos/' + options.username + '/' + options.repository + '/events'; eventsUrl = 'https://api.github.com/repos/' + options.username + '/' + options.repository + '/events';
} }
@ -236,7 +261,7 @@ var GitHubActivity = (function() {
eventsUrl += authString; eventsUrl += authString;
} }
if (!!options.eventsUrl){ if (!!options.eventsUrl) {
eventsUrl = options.eventsUrl; eventsUrl = options.eventsUrl;
} }
@ -249,18 +274,18 @@ var GitHubActivity = (function() {
} }
} }
methods.getOutputFromRequest(userUrl, function(error, output) { methods.getOutputFromRequest(userUrl, function (error, output) {
if (error) { if (error) {
header = Mustache.render(templates.UserNotFound, { username: options.username }); header = Mustache.render(templates.UserNotFound, {username: options.username});
} else { } else {
header = methods.getHeaderHTML(output) header = methods.getHeaderHTML(output)
} }
methods.renderIfReady(selector, header, activity) methods.renderIfReady(selector, header, activity)
}); });
methods.getOutputFromRequest(eventsUrl, function(error, output) { methods.getOutputFromRequest(eventsUrl, function (error, output) {
if (error) { if (error) {
activity = Mustache.render(templates.EventsNotFound, { username: options.username }); activity = Mustache.render(templates.EventsNotFound, {username: options.username});
} else { } else {
var limit = options.limit != 'undefined' ? parseInt(options.limit, 10) : null; var limit = options.limit != 'undefined' ? parseInt(options.limit, 10) : null;
activity = methods.getActivityHTML(output, limit); activity = methods.getActivityHTML(output, limit);
@ -280,6 +305,7 @@ function millisecondsToStr(milliseconds) {
function numberEnding(number) { function numberEnding(number) {
return (number > 1) ? 's ago' : ' ago'; return (number > 1) ? 's ago' : ' ago';
} }
var temp = Math.floor(milliseconds / 1000); var temp = Math.floor(milliseconds / 1000);
var years = Math.floor(temp / 31536000); var years = Math.floor(temp / 31536000);
@ -312,7 +338,162 @@ function pluralize(word, number) {
} }
/** MD5 methods written by Joseph Myers. http://www.myersdaily.org/joseph/javascript/md5-text.html */ /** MD5 methods written by Joseph Myers. http://www.myersdaily.org/joseph/javascript/md5-text.html */
function md5cycle(f,h){var g=f[0],e=f[1],j=f[2],i=f[3];g=ff(g,e,j,i,h[0],7,-680876936);i=ff(i,g,e,j,h[1],12,-389564586);j=ff(j,i,g,e,h[2],17,606105819);e=ff(e,j,i,g,h[3],22,-1044525330);g=ff(g,e,j,i,h[4],7,-176418897);i=ff(i,g,e,j,h[5],12,1200080426);j=ff(j,i,g,e,h[6],17,-1473231341);e=ff(e,j,i,g,h[7],22,-45705983);g=ff(g,e,j,i,h[8],7,1770035416);i=ff(i,g,e,j,h[9],12,-1958414417);j=ff(j,i,g,e,h[10],17,-42063);e=ff(e,j,i,g,h[11],22,-1990404162);g=ff(g,e,j,i,h[12],7,1804603682);i=ff(i,g,e,j,h[13],12,-40341101);j=ff(j,i,g,e,h[14],17,-1502002290);e=ff(e,j,i,g,h[15],22,1236535329);g=gg(g,e,j,i,h[1],5,-165796510);i=gg(i,g,e,j,h[6],9,-1069501632);j=gg(j,i,g,e,h[11],14,643717713);e=gg(e,j,i,g,h[0],20,-373897302);g=gg(g,e,j,i,h[5],5,-701558691);i=gg(i,g,e,j,h[10],9,38016083);j=gg(j,i,g,e,h[15],14,-660478335);e=gg(e,j,i,g,h[4],20,-405537848);g=gg(g,e,j,i,h[9],5,568446438);i=gg(i,g,e,j,h[14],9,-1019803690);j=gg(j,i,g,e,h[3],14,-187363961);e=gg(e,j,i,g,h[8],20,1163531501);g=gg(g,e,j,i,h[13],5,-1444681467);i=gg(i,g,e,j,h[2],9,-51403784);j=gg(j,i,g,e,h[7],14,1735328473);e=gg(e,j,i,g,h[12],20,-1926607734);g=hh(g,e,j,i,h[5],4,-378558);i=hh(i,g,e,j,h[8],11,-2022574463);j=hh(j,i,g,e,h[11],16,1839030562);e=hh(e,j,i,g,h[14],23,-35309556);g=hh(g,e,j,i,h[1],4,-1530992060);i=hh(i,g,e,j,h[4],11,1272893353);j=hh(j,i,g,e,h[7],16,-155497632);e=hh(e,j,i,g,h[10],23,-1094730640);g=hh(g,e,j,i,h[13],4,681279174);i=hh(i,g,e,j,h[0],11,-358537222);j=hh(j,i,g,e,h[3],16,-722521979);e=hh(e,j,i,g,h[6],23,76029189);g=hh(g,e,j,i,h[9],4,-640364487);i=hh(i,g,e,j,h[12],11,-421815835);j=hh(j,i,g,e,h[15],16,530742520);e=hh(e,j,i,g,h[2],23,-995338651);g=ii(g,e,j,i,h[0],6,-198630844);i=ii(i,g,e,j,h[7],10,1126891415);j=ii(j,i,g,e,h[14],15,-1416354905);e=ii(e,j,i,g,h[5],21,-57434055);g=ii(g,e,j,i,h[12],6,1700485571);i=ii(i,g,e,j,h[3],10,-1894986606);j=ii(j,i,g,e,h[10],15,-1051523);e=ii(e,j,i,g,h[1],21,-2054922799);g=ii(g,e,j,i,h[8],6,1873313359);i=ii(i,g,e,j,h[15],10,-30611744);j=ii(j,i,g,e,h[6],15,-1560198380);e=ii(e,j,i,g,h[13],21,1309151649);g=ii(g,e,j,i,h[4],6,-145523070);i=ii(i,g,e,j,h[11],10,-1120210379);j=ii(j,i,g,e,h[2],15,718787259);e=ii(e,j,i,g,h[9],21,-343485551);f[0]=add32(g,f[0]);f[1]=add32(e,f[1]);f[2]=add32(j,f[2]);f[3]=add32(i,f[3])}function cmn(h,e,d,c,g,f){e=add32(add32(e,h),add32(c,f));return add32((e<<g)|(e>>>(32-g)),d)}function ff(g,f,k,j,e,i,h){return cmn((f&k)|((~f)&j),g,f,e,i,h)}function gg(g,f,k,j,e,i,h){return cmn((f&j)|(k&(~j)),g,f,e,i,h)}function hh(g,f,k,j,e,i,h){return cmn(f^k^j,g,f,e,i,h)}function ii(g,f,k,j,e,i,h){return cmn(k^(f|(~j)),g,f,e,i,h)}function md51(c){txt="";var e=c.length,d=[1732584193,-271733879,-1732584194,271733878],b;for(b=64;b<=c.length;b+=64){md5cycle(d,md5blk(c.substring(b-64,b)))}c=c.substring(b-64);var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;b<c.length;b++){a[b>>2]|=c.charCodeAt(b)<<((b%4)<<3)}a[b>>2]|=128<<((b%4)<<3);if(b>55){md5cycle(d,a);for(b=0;b<16;b++){a[b]=0}}a[14]=e*8;md5cycle(d,a);return d}function md5blk(b){var c=[],a;for(a=0;a<64;a+=4){c[a>>2]=b.charCodeAt(a)+(b.charCodeAt(a+1)<<8)+(b.charCodeAt(a+2)<<16)+(b.charCodeAt(a+3)<<24)}return c}var hex_chr="0123456789abcdef".split("");function rhex(c){var b="",a=0;for(;a<4;a++){b+=hex_chr[(c>>(a*8+4))&15]+hex_chr[(c>>(a*8))&15]}return b}function hex(a){for(var b=0;b<a.length;b++){a[b]=rhex(a[b])}return a.join("")}function md5(a){return hex(md51(a))}function add32(d,c){return(d+c)&4294967295}if(md5("hello")!="5d41402abc4b2a76b9719d911017c592"){function add32(a,d){var c=(a&65535)+(d&65535),b=(a>>16)+(d>>16)+(c>>16);return(b<<16)|(c&65535)}}; function md5cycle(f, h) {
var g = f[0], e = f[1], j = f[2], i = f[3];
g = ff(g, e, j, i, h[0], 7, -680876936);
i = ff(i, g, e, j, h[1], 12, -389564586);
j = ff(j, i, g, e, h[2], 17, 606105819);
e = ff(e, j, i, g, h[3], 22, -1044525330);
g = ff(g, e, j, i, h[4], 7, -176418897);
i = ff(i, g, e, j, h[5], 12, 1200080426);
j = ff(j, i, g, e, h[6], 17, -1473231341);
e = ff(e, j, i, g, h[7], 22, -45705983);
g = ff(g, e, j, i, h[8], 7, 1770035416);
i = ff(i, g, e, j, h[9], 12, -1958414417);
j = ff(j, i, g, e, h[10], 17, -42063);
e = ff(e, j, i, g, h[11], 22, -1990404162);
g = ff(g, e, j, i, h[12], 7, 1804603682);
i = ff(i, g, e, j, h[13], 12, -40341101);
j = ff(j, i, g, e, h[14], 17, -1502002290);
e = ff(e, j, i, g, h[15], 22, 1236535329);
g = gg(g, e, j, i, h[1], 5, -165796510);
i = gg(i, g, e, j, h[6], 9, -1069501632);
j = gg(j, i, g, e, h[11], 14, 643717713);
e = gg(e, j, i, g, h[0], 20, -373897302);
g = gg(g, e, j, i, h[5], 5, -701558691);
i = gg(i, g, e, j, h[10], 9, 38016083);
j = gg(j, i, g, e, h[15], 14, -660478335);
e = gg(e, j, i, g, h[4], 20, -405537848);
g = gg(g, e, j, i, h[9], 5, 568446438);
i = gg(i, g, e, j, h[14], 9, -1019803690);
j = gg(j, i, g, e, h[3], 14, -187363961);
e = gg(e, j, i, g, h[8], 20, 1163531501);
g = gg(g, e, j, i, h[13], 5, -1444681467);
i = gg(i, g, e, j, h[2], 9, -51403784);
j = gg(j, i, g, e, h[7], 14, 1735328473);
e = gg(e, j, i, g, h[12], 20, -1926607734);
g = hh(g, e, j, i, h[5], 4, -378558);
i = hh(i, g, e, j, h[8], 11, -2022574463);
j = hh(j, i, g, e, h[11], 16, 1839030562);
e = hh(e, j, i, g, h[14], 23, -35309556);
g = hh(g, e, j, i, h[1], 4, -1530992060);
i = hh(i, g, e, j, h[4], 11, 1272893353);
j = hh(j, i, g, e, h[7], 16, -155497632);
e = hh(e, j, i, g, h[10], 23, -1094730640);
g = hh(g, e, j, i, h[13], 4, 681279174);
i = hh(i, g, e, j, h[0], 11, -358537222);
j = hh(j, i, g, e, h[3], 16, -722521979);
e = hh(e, j, i, g, h[6], 23, 76029189);
g = hh(g, e, j, i, h[9], 4, -640364487);
i = hh(i, g, e, j, h[12], 11, -421815835);
j = hh(j, i, g, e, h[15], 16, 530742520);
e = hh(e, j, i, g, h[2], 23, -995338651);
g = ii(g, e, j, i, h[0], 6, -198630844);
i = ii(i, g, e, j, h[7], 10, 1126891415);
j = ii(j, i, g, e, h[14], 15, -1416354905);
e = ii(e, j, i, g, h[5], 21, -57434055);
g = ii(g, e, j, i, h[12], 6, 1700485571);
i = ii(i, g, e, j, h[3], 10, -1894986606);
j = ii(j, i, g, e, h[10], 15, -1051523);
e = ii(e, j, i, g, h[1], 21, -2054922799);
g = ii(g, e, j, i, h[8], 6, 1873313359);
i = ii(i, g, e, j, h[15], 10, -30611744);
j = ii(j, i, g, e, h[6], 15, -1560198380);
e = ii(e, j, i, g, h[13], 21, 1309151649);
g = ii(g, e, j, i, h[4], 6, -145523070);
i = ii(i, g, e, j, h[11], 10, -1120210379);
j = ii(j, i, g, e, h[2], 15, 718787259);
e = ii(e, j, i, g, h[9], 21, -343485551);
f[0] = add32(g, f[0]);
f[1] = add32(e, f[1]);
f[2] = add32(j, f[2]);
f[3] = add32(i, f[3])
}
function cmn(h, e, d, c, g, f) {
e = add32(add32(e, h), add32(c, f));
return add32((e << g) | (e >>> (32 - g)), d)
}
function ff(g, f, k, j, e, i, h) {
return cmn((f & k) | ((~f) & j), g, f, e, i, h)
}
function gg(g, f, k, j, e, i, h) {
return cmn((f & j) | (k & (~j)), g, f, e, i, h)
}
function hh(g, f, k, j, e, i, h) {
return cmn(f ^ k ^ j, g, f, e, i, h)
}
function ii(g, f, k, j, e, i, h) {
return cmn(k ^ (f | (~j)), g, f, e, i, h)
}
function md51(c) {
txt = "";
var e = c.length, d = [1732584193, -271733879, -1732584194, 271733878], b;
for (b = 64; b <= c.length; b += 64) {
md5cycle(d, md5blk(c.substring(b - 64, b)))
}
c = c.substring(b - 64);
var a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (b = 0; b < c.length; b++) {
a[b >> 2] |= c.charCodeAt(b) << ((b % 4) << 3)
}
a[b >> 2] |= 128 << ((b % 4) << 3);
if (b > 55) {
md5cycle(d, a);
for (b = 0; b < 16; b++) {
a[b] = 0
}
}
a[14] = e * 8;
md5cycle(d, a);
return d
}
function md5blk(b) {
var c = [], a;
for (a = 0; a < 64; a += 4) {
c[a >> 2] = b.charCodeAt(a) + (b.charCodeAt(a + 1) << 8) + (b.charCodeAt(a + 2) << 16) + (b.charCodeAt(a + 3) << 24)
}
return c
}
var hex_chr = "0123456789abcdef".split("");
function rhex(c) {
var b = "", a = 0;
for (; a < 4; a++) {
b += hex_chr[(c >> (a * 8 + 4)) & 15] + hex_chr[(c >> (a * 8)) & 15]
}
return b
}
function hex(a) {
for (var b = 0; b < a.length; b++) {
a[b] = rhex(a[b])
}
return a.join("")
}
function md5(a) {
return hex(md51(a))
}
function add32(d, c) {
return (d + c) & 4294967295
}
if (md5("hello") != "5d41402abc4b2a76b9719d911017c592") {
function add32(a, d) {
var c = (a & 65535) + (d & 65535), b = (a >> 16) + (d >> 16) + (c >> 16);
return (b << 16) | (c & 65535)
}
}
;
var templates = { var templates = {
Stream: '<div class="gha-feed">{{{text}}}<div class="gha-push-small"></div>{{{footer}}}</div>', Stream: '<div class="gha-feed">{{{text}}}<div class="gha-push-small"></div>{{{footer}}}</div>',
@ -353,9 +534,9 @@ var templates = {
<small class="gha-message-commits">{{{commitsMessage}}}</small>', <small class="gha-message-commits">{{{commitsMessage}}}</small>',
ReleaseEvent: 'released {{{tagLink}}} at {{{repoLink}}}<br>{{{userGravatar}}}<small><span class="octicon octicon-cloud-download"></span> {{{zipLink}}}</small>', ReleaseEvent: 'released {{{tagLink}}} at {{{repoLink}}}<br>{{{userGravatar}}}<small><span class="octicon octicon-cloud-download"></span> {{{zipLink}}}</small>',
WatchEvent: 'starred {{{repoLink}}}' WatchEvent: 'starred {{{repoLink}}}'
}, },
icons = { icons = {
CommitCommentEvent: 'comment-discussion', CommitCommentEvent: 'comment-discussion',
CreateEvent_repository: 'repo-create', CreateEvent_repository: 'repo-create',
CreateEvent_tag: 'tag-add', CreateEvent_tag: 'tag-add',
@ -374,6 +555,6 @@ icons = {
PushEvent: 'git-commit', PushEvent: 'git-commit',
ReleaseEvent: 'tag-add', ReleaseEvent: 'tag-add',
WatchEvent: 'star' WatchEvent: 'star'
}, },
singleLineActivities = [ 'CreateEvent', 'DeleteEvent', 'FollowEvent', 'ForkEvent', 'GistEvent', 'MemberEvent', 'WatchEvent' ]; singleLineActivities = ['CreateEvent', 'DeleteEvent', 'FollowEvent', 'ForkEvent', 'GistEvent', 'MemberEvent', 'WatchEvent'];

View File

@ -24,11 +24,11 @@
}; };
} }
}(function () { }(function () {
function extend () { function extend() {
var i = 0; var i = 0;
var result = {}; var result = {};
for (; i < arguments.length; i++) { for (; i < arguments.length; i++) {
var attributes = arguments[ i ]; var attributes = arguments[i];
for (var key in attributes) { for (var key in attributes) {
result[key] = attributes[key]; result[key] = attributes[key];
} }
@ -36,8 +36,8 @@
return result; return result;
} }
function init (converter) { function init(converter) {
function api (key, value, attributes) { function api(key, value, attributes) {
var result; var result;
if (typeof document === 'undefined') { if (typeof document === 'undefined') {
return; return;
@ -64,7 +64,8 @@
if (/^[\{\[]/.test(result)) { if (/^[\{\[]/.test(result)) {
value = result; value = result;
} }
} catch (e) {} } catch (e) {
}
if (!converter.write) { if (!converter.write) {
value = encodeURIComponent(String(value)) value = encodeURIComponent(String(value))
@ -122,7 +123,8 @@
if (this.json) { if (this.json) {
try { try {
cookie = JSON.parse(cookie); cookie = JSON.parse(cookie);
} catch (e) {} } catch (e) {
}
} }
if (key === name) { if (key === name) {
@ -133,7 +135,8 @@
if (!key) { if (!key) {
result[name] = cookie; result[name] = cookie;
} }
} catch (e) {} } catch (e) {
}
} }
return result; return result;
@ -161,5 +164,6 @@
return api; return api;
} }
return init(function () {}); return init(function () {
});
})); }));

View File

@ -1,5 +1,5 @@
$(document).ready(function () { $(document).ready(function () {
setInterval("loop()",1000); setInterval("loop()", 1000);
}); });
function loop() { function loop() {

View File

@ -1,5 +1,3 @@
var input_name; var input_name;
var input_psw; var input_psw;
var btn_submit; var btn_submit;
@ -7,7 +5,7 @@ var btn_submit;
$(document).ready(() => { $(document).ready(() => {
$("#login_form").submit(function(e){ $("#login_form").submit(function (e) {
e.preventDefault(); e.preventDefault();
tryConnection(); tryConnection();
}); });
@ -18,40 +16,33 @@ $(document).ready(() => {
btn_submit = $("#btn-submit-connect"); btn_submit = $("#btn-submit-connect");
input_name.on("input", function () { input_name.on("input", function () {
if(input_name.val() !== "" && input_psw.val() !== "") { if (input_name.val() !== "" && input_psw.val() !== "") {
popInSubmit(); popInSubmit();
}else } else {
{
popOutSubmit(); popOutSubmit();
} }
}); });
input_psw.on("input", function () { input_psw.on("input", function () {
if(input_name.val() !== "" && input_psw.val() !== "") { if (input_name.val() !== "" && input_psw.val() !== "") {
popInSubmit(); popInSubmit();
}else } else {
{
popOutSubmit(); popOutSubmit();
} }
}); });
}); });
function popOutSubmit() {
function popOutSubmit(){
if (btn_submit.hasClass("scale-in")) { if (btn_submit.hasClass("scale-in")) {
btn_submit.removeClass("scale-in"); btn_submit.removeClass("scale-in");
btn_submit.addClass("scale-out"); btn_submit.addClass("scale-out");
} }
} }
function popInSubmit(){ function popInSubmit() {
if (btn_submit.hasClass("scale-out")) { if (btn_submit.hasClass("scale-out")) {
btn_submit.removeClass("scale-out"); btn_submit.removeClass("scale-out");
btn_submit.addClass("scale-in"); btn_submit.addClass("scale-in");
@ -59,14 +50,9 @@ function popInSubmit(){
} }
function tryConnection() { function tryConnection() {
var request = { name: input_name.val(), password: input_psw.val()}; var request = {name: input_name.val(), password: input_psw.val()};
$.ajax({ $.ajax({
type: "POST", type: "POST",
dataType: 'json', dataType: 'json',
@ -75,14 +61,14 @@ function tryConnection() {
data: JSON.stringify(request), data: JSON.stringify(request),
success: function (data) { success: function (data) {
console.log(data); console.log(data);
Cookies.set('token',data.token, { expires: 31 }); Cookies.set('token', data.token, {expires: 31});
Cookies.set('name', data.name, { expires: 31 }); Cookies.set('name', data.name, {expires: 31});
window.location.reload(true); window.location.reload(true);
} }
}).fail(function (data) { }).fail(function (data) {
console.log(data); console.log(data);
switch(data.responseJSON.error){ switch (data.responseJSON.error) {
case "user": case "user":
input_name.addClass("invalid"); input_name.addClass("invalid");
break; break;

File diff suppressed because it is too large Load Diff

View File

@ -89,8 +89,7 @@ function getCurentMusic() {
enableBtn(btn_play); enableBtn(btn_play);
enableBtn(btn_next); enableBtn(btn_next);
enableBtn(btn_disconnect_music); enableBtn(btn_disconnect_music);
} } else {
else {
disableBtn(btn_play); disableBtn(btn_play);
disableBtn(btn_stop); disableBtn(btn_stop);
disableBtn(btn_info); disableBtn(btn_info);
@ -139,7 +138,7 @@ function getCurentMusic() {
if ($('#music_progress').hasClass("determinate")) { if ($('#music_progress').hasClass("determinate")) {
$('#music_progress').addClass("indeterminate").removeClass("determinate"); $('#music_progress').addClass("indeterminate").removeClass("determinate");
} }
if(!musicLoadFlag){ if (!musicLoadFlag) {
clearInterval(interval); clearInterval(interval);
interval = setInterval("getCurentMusic()", 200); interval = setInterval("getCurentMusic()", 200);
musicLoadFlag = true; musicLoadFlag = true;
@ -180,25 +179,23 @@ function getCurentMusic() {
} }
if (switchAutoFlow.is(':checked') !== data.currentMusic.autoflow) if (switchAutoFlow.is(':checked') !== data.currentMusic.autoflow)
switchAutoFlow.prop('checked', data.currentMusic.autoflow); switchAutoFlow.prop('checked', data.currentMusic.autoflow);
if (data.currentMusic.state !== "DISCONNECTED" && data.currentMusic.state !== "STOP"){ if (data.currentMusic.state !== "DISCONNECTED" && data.currentMusic.state !== "STOP") {
getPlayList(data.playlist.list); getPlayList(data.playlist.list);
if(data.currentMusic.state !== "LOADING"){ if (data.currentMusic.state !== "LOADING") {
$(".ctl-btn").removeClass("disabled"); $(".ctl-btn").removeClass("disabled");
if(musicLoadFlag){ if (musicLoadFlag) {
clearInterval(interval); clearInterval(interval);
interval = setInterval("getCurentMusic()", 1000); interval = setInterval("getCurentMusic()", 1000);
musicLoadFlag = false; musicLoadFlag = false;
} }
} }
} } else {
else {
if (loadingFlag) { if (loadingFlag) {
modal_loading.close(); modal_loading.close();
loadingFlag = false; loadingFlag = false;
} }
$(".ctl-btn").removeClass("disabled"); $(".ctl-btn").removeClass("disabled");
if(musicLoadFlag){ if (musicLoadFlag) {
clearInterval(interval); clearInterval(interval);
interval = setInterval("getCurentMusic()", 1000); interval = setInterval("getCurentMusic()", 1000);
musicLoadFlag = false; musicLoadFlag = false;
@ -252,8 +249,7 @@ function getPlayList(data) {
sendCommand(command, true); sendCommand(command, true);
}); });
} }
} } else {
else {
$('#playlist_list').empty(); $('#playlist_list').empty();
savedPlaylist = {}; savedPlaylist = {};
} }
@ -263,8 +259,6 @@ function getPlayList(data) {
} }
} }
function getChannels() { function getChannels() {
@ -313,14 +307,14 @@ function updateModal(data) {
function updateControl(data) { function updateControl(data) {
if($('#music_text').text() !== data.info.audioTrackInfo.title){ if ($('#music_text').text() !== data.info.audioTrackInfo.title) {
$('#music_text').text(data.info.audioTrackInfo.title); $('#music_text').text(data.info.audioTrackInfo.title);
} }
var percent = (data.currentPos / data.info.audioTrackInfo.length) * 100; var percent = (data.currentPos / data.info.audioTrackInfo.length) * 100;
$('#music_progress').width(percent + "%"); $('#music_progress').width(percent + "%");
if(data.state !== "LOADING"){ if (data.state !== "LOADING") {
if (Cookies.get('token') !== undefined) { if (Cookies.get('token') !== undefined) {
enableBtn(btn_play); enableBtn(btn_play);
enableBtn(btn_stop); enableBtn(btn_stop);
@ -329,8 +323,7 @@ function updateControl(data) {
enableBtn(btn_flush); enableBtn(btn_flush);
enableBtn(btn_next); enableBtn(btn_next);
enableBtn(btn_disconnect_music); enableBtn(btn_disconnect_music);
} } else {
else {
disableBtn(btn_play); disableBtn(btn_play);
disableBtn(btn_stop); disableBtn(btn_stop);
disableBtn(btn_info); disableBtn(btn_info);
@ -345,7 +338,6 @@ function updateControl(data) {
} }
$('#music_img').attr("src", "https://img.youtube.com/vi/" + data.info.audioTrackInfo.identifier + "/hqdefault.jpg"); $('#music_img').attr("src", "https://img.youtube.com/vi/" + data.info.audioTrackInfo.identifier + "/hqdefault.jpg");
$('#total_time').text(msToTime(data.info.audioTrackInfo.length)); $('#total_time').text(msToTime(data.info.audioTrackInfo.length));
$('#current_time').text(msToTime(data.currentPos)); $('#current_time').text(msToTime(data.currentPos));
@ -370,7 +362,7 @@ function sendCommand(command, modal) {
success: function (data) { success: function (data) {
loadingFlag = true; loadingFlag = true;
getCurentMusic(); getCurentMusic();
if(interval != null) if (interval != null)
clearInterval(interval); clearInterval(interval);
interval = setInterval("getCurentMusic()", 1000); interval = setInterval("getCurentMusic()", 1000);
@ -392,8 +384,7 @@ function sendCommand(command, modal) {
Cookies.remove('token'); Cookies.remove('token');
Cookies.remove('name'); Cookies.remove('name');
location.reload(); location.reload();
} } else {
else {
M.toast({ M.toast({
html: " <i class=\"material-icons\" style='margin-right: 10px'>warning</i> Command fail!", html: " <i class=\"material-icons\" style='margin-right: 10px'>warning</i> Command fail!",
classes: 'red', classes: 'red',
@ -489,8 +480,7 @@ function addListClick(event) {
let button; let button;
if (event.target.nodeName === "I") { if (event.target.nodeName === "I") {
button = event.target.parentNode; button = event.target.parentNode;
} } else
else
button = event.target; button = event.target;
button.classList.add("scale-out"); button.classList.add("scale-out");
@ -509,7 +499,7 @@ function ytTimeToTime(duration) {
let seconds; let seconds;
if (duration === "PT0S") if (duration === "PT0S")
return "&#x1F534 LIVE"; return "&#x1F534 LIVE";
if(duration.endsWith("Video(s)")) if (duration.endsWith("Video(s)"))
return duration; return duration;
if (duration.includes("H")) if (duration.includes("H"))
hours = parseInt(duration.match(/\d*H/)[0].replace("H", ""), 10); hours = parseInt(duration.match(/\d*H/)[0].replace("H", ""), 10);
@ -587,8 +577,7 @@ function listeners() {
$('#input_search').on("input", function () { $('#input_search').on("input", function () {
if ($('#input_search').val() == "") { if ($('#input_search').val() == "") {
disableBtn($('#btn_search')); disableBtn($('#btn_search'));
} } else {
else {
enableBtn($('#btn_search')); enableBtn($('#btn_search'));
} }
}); });
@ -623,8 +612,7 @@ function listeners() {
switchAutoFlow.click(function () { switchAutoFlow.click(function () {
if (switchAutoFlow.is(':checked')) { if (switchAutoFlow.is(':checked')) {
sendCommand({command: 'AUTOFLOWON'}, false) sendCommand({command: 'AUTOFLOWON'}, false)
} } else
else
sendCommand({command: 'AUTOFLOWOFF'}, false) sendCommand({command: 'AUTOFLOWOFF'}, false)
}); });
} }

View File

@ -5,9 +5,7 @@ var btn_disconnect;
var nav_name; var nav_name;
$(document).ready(function () {
$(document).ready(function() {
$('.tooltipped').tooltip(); $('.tooltipped').tooltip();
$('#modal_guild').modal({ $('#modal_guild').modal({
@ -19,9 +17,6 @@ $(document).ready(function() {
}); });
nav_bar_account_link = $("#nav-bar-account"); nav_bar_account_link = $("#nav-bar-account");
btn_disconnect = $(".nav-disconnect"); btn_disconnect = $(".nav-disconnect");
nav_name = $("#nav-name"); nav_name = $("#nav-name");
@ -34,15 +29,13 @@ $(document).ready(function() {
}); });
function connected() {
function connected(){
console.log("Connected!"); console.log("Connected!");
console.log("Checking token..."); console.log("Checking token...");
console.log(window.location.href); console.log(window.location.href);
if(!window.location.href.includes("oauthCallback")){ if (!window.location.href.includes("oauthCallback")) {
checkToken(); checkToken();
} } else {
else{
console.log("Oauth page skip check token"); console.log("Oauth page skip check token");
} }
@ -60,9 +53,6 @@ function disconnected() {
} }
function navListeners() { function navListeners() {
btn_disconnect.click(function () { btn_disconnect.click(function () {
@ -80,13 +70,13 @@ function navListeners() {
$('#btn_ok_guild').click(function () { $('#btn_ok_guild').click(function () {
guild = $('input[name=guildRadio]:checked').val(); guild = $('input[name=guildRadio]:checked').val();
Cookies.set('guild', guild, { expires: 31 }); Cookies.set('guild', guild, {expires: 31});
window.location.reload(true); window.location.reload(true);
}); });
$('.guild_change').click(function () { $('.guild_change').click(function () {
let id = this.getAttribute("data-id"); let id = this.getAttribute("data-id");
Cookies.set('guild', id, { expires: 31 }); Cookies.set('guild', id, {expires: 31});
window.location.reload(true); window.location.reload(true);
}); });
@ -97,22 +87,20 @@ function navListeners() {
} }
function getGuild(){ function getGuild() {
$.get("api/userManagement/getGuilds", function (data) { $.get("api/userManagement/getGuilds", function (data) {
}).done(function (data) { }).done(function (data) {
console.log(data); console.log(data);
$('#guild_form').empty(); $('#guild_form').empty();
if(data.length === 0 && location.pathname !== "/") if (data.length === 0 && location.pathname !== "/")
window.location.replace("/"); window.location.replace("/");
if(data.length === 0){ if (data.length === 0) {
return; return;
} } else if (data.length === 1) {
Cookies.set('guild', data[0].id, {expires: 31});
else if(data.length === 1){
Cookies.set('guild', data[0].id, { expires: 31 });
window.location.reload(true); window.location.reload(true);
} }
data.forEach(function(element){ data.forEach(function (element) {
var template = $('#radioTemplateGuild').clone(); var template = $('#radioTemplateGuild').clone();
template.removeAttr("id"); template.removeAttr("id");
template.removeAttr("style"); template.removeAttr("style");
@ -127,7 +115,7 @@ function getGuild(){
$('#modal_guild').modal('open'); $('#modal_guild').modal('open');
}).fail(function (data) { }).fail(function (data) {
if(!error){ if (!error) {
alert("Com error, please refresh."); alert("Com error, please refresh.");
error = true; error = true;
} }
@ -144,10 +132,9 @@ function checkConnection() {
console.log("Connection Ok"); console.log("Connection Ok");
console.log(Cookies.get('token')); console.log(Cookies.get('token'));
if(Cookies.get('token') === undefined){ if (Cookies.get('token') === undefined) {
disconnected() disconnected()
} } else {
else{
connected(); connected();
} }
@ -182,9 +169,9 @@ function checkToken() {
closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
draggable: true // Choose whether you can drag to open on touch screens, draggable: true // Choose whether you can drag to open on touch screens,
}); });
if (Cookies.get('guild') === undefined ) { if (Cookies.get('guild') === undefined) {
getGuild() getGuild()
}else{ } else {
$('#drop-trigger-guilds').dropdown({ $('#drop-trigger-guilds').dropdown({
constrainWidth: false, // Does not change width of dropdown to that of the activator constrainWidth: false, // Does not change width of dropdown to that of the activator
coverTrigger: false, // Displays dropdown below the button coverTrigger: false, // Displays dropdown below the button
@ -208,6 +195,4 @@ function checkToken() {
}); });
} }

View File

@ -1,16 +1,15 @@
var hash = window.location.hash.replace("#", "").split("&");
var hash = window.location.hash.replace("#","").split("&");
var discordToken = ""; var discordToken = "";
debugger; debugger;
hash.forEach(function (value) { hash.forEach(function (value) {
if(value.indexOf("access_token") !== -1){ if (value.indexOf("access_token") !== -1) {
discordToken = value.split("=")[1]; discordToken = value.split("=")[1];
return 0; return 0;
} }
}); });
if(discordToken !== ""){ if (discordToken !== "") {
console.log(discordToken); console.log(discordToken);
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -19,14 +18,14 @@ if(discordToken !== ""){
url: "/api/userManagement/oauthLogin?token=" + discordToken, url: "/api/userManagement/oauthLogin?token=" + discordToken,
success: function (data) { success: function (data) {
console.log(data); console.log(data);
Cookies.set('token',data.token, { expires: 31 }); Cookies.set('token', data.token, {expires: 31});
Cookies.set('name', data.name, { expires: 31 }); Cookies.set('name', data.name, {expires: 31});
window.location = "/"; window.location = "/";
} }
}).fail(function (data) { }).fail(function (data) {
console.log(data); console.log(data);
}); });
}else{ } else {
window.location = "/"; window.location = "/";
} }

View File

@ -1,20 +1,18 @@
var ok_passwrd = false; var ok_passwrd = false;
$(document).ready(function() { $(document).ready(function () {
var baseUrl = window.location.protocol + "//" +window.location.host + window.location.pathname; var baseUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
console.log(baseUrl); console.log(baseUrl);
var sendBtn = $('#sendBtn'); var sendBtn = $('#sendBtn');
$('#name').on("input", function () { $('#name').on("input", function () {
if($('#name').val() === ""){ if ($('#name').val() === "") {
if (sendBtn.hasClass("scale-in")) { if (sendBtn.hasClass("scale-in")) {
sendBtn.removeClass("scale-in"); sendBtn.removeClass("scale-in");
sendBtn.addClass("scale-out"); sendBtn.addClass("scale-out");
} }
} } else {
else{
if (sendBtn.hasClass("scale-out") && ok_passwrd) { if (sendBtn.hasClass("scale-out") && ok_passwrd) {
sendBtn.removeClass("scale-out"); sendBtn.removeClass("scale-out");
sendBtn.addClass("scale-in"); sendBtn.addClass("scale-in");
@ -26,7 +24,7 @@ $(document).ready(function() {
var passwrd = $('#passwrd'); var passwrd = $('#passwrd');
var confirm = $('#passwrd2'); var confirm = $('#passwrd2');
passwrd.on("input", function () { passwrd.on("input", function () {
if((passwrd.val() === confirm.val())&& passwrd.val() !== ''){ if ((passwrd.val() === confirm.val()) && passwrd.val() !== '') {
if (passwrd.hasClass("invalid")) { if (passwrd.hasClass("invalid")) {
passwrd.addClass("valid"); passwrd.addClass("valid");
passwrd.removeClass("invalid"); passwrd.removeClass("invalid");
@ -35,15 +33,14 @@ $(document).ready(function() {
} }
if($('#name').val() !== ""){ if ($('#name').val() !== "") {
if (sendBtn.hasClass("scale-out")) { if (sendBtn.hasClass("scale-out")) {
sendBtn.removeClass("scale-out"); sendBtn.removeClass("scale-out");
sendBtn.addClass("scale-in"); sendBtn.addClass("scale-in");
} }
} }
ok_passwrd = true; ok_passwrd = true;
} } else {
else{
if (!passwrd.hasClass("invalid")) { if (!passwrd.hasClass("invalid")) {
passwrd.addClass("invalid"); passwrd.addClass("invalid");
passwrd.removeClass("valid"); passwrd.removeClass("valid");
@ -60,7 +57,7 @@ $(document).ready(function() {
}); });
confirm.on("input", function () { confirm.on("input", function () {
if((passwrd.val() === confirm.val())&& passwrd.val() !== ''){ if ((passwrd.val() === confirm.val()) && passwrd.val() !== '') {
if (passwrd.hasClass("invalid")) { if (passwrd.hasClass("invalid")) {
passwrd.addClass("valid"); passwrd.addClass("valid");
passwrd.removeClass("invalid"); passwrd.removeClass("invalid");
@ -68,15 +65,14 @@ $(document).ready(function() {
confirm.removeClass("invalid"); confirm.removeClass("invalid");
} }
if($('#name').val() !== ""){ if ($('#name').val() !== "") {
if (sendBtn.hasClass("scale-out")) { if (sendBtn.hasClass("scale-out")) {
sendBtn.removeClass("scale-out"); sendBtn.removeClass("scale-out");
sendBtn.addClass("scale-in"); sendBtn.addClass("scale-in");
} }
} }
ok_passwrd = true; ok_passwrd = true;
} } else {
else{
if (!passwrd.hasClass("invalid")) { if (!passwrd.hasClass("invalid")) {
passwrd.addClass("invalid"); passwrd.addClass("invalid");
passwrd.removeClass("valid"); passwrd.removeClass("valid");
@ -102,21 +98,20 @@ $(document).ready(function() {
dataType: 'json', dataType: 'json',
contentType: 'application/json', contentType: 'application/json',
url: "/api/userManagement/preRegister", url: "/api/userManagement/preRegister",
data: JSON.stringify({ name: name, password: password}), data: JSON.stringify({name: name, password: password}),
success: function (data) { success: function (data) {
console.log(data); console.log(data);
window.location.href = baseUrl + "?id="+data.id window.location.href = baseUrl + "?id=" + data.id
} }
}).fail(function (data) { }).fail(function (data) {
console.log(data); console.log(data);
if(data.status === 404){ if (data.status === 404) {
alert("User Not Found!"); alert("User Not Found!");
$('#name').addClass("invalid"); $('#name').addClass("invalid");
$('#name').removeClass("valid"); $('#name').removeClass("valid");
} } else {
else{
alert(data.responseJSON.message); alert(data.responseJSON.message);
} }
@ -124,20 +119,19 @@ $(document).ready(function() {
}); });
$('#modalToken').modal({dismissible: false}); $('#modalToken').modal({dismissible: false});
if(id !== ''){ if (id !== '') {
$('#modalToken').modal('open'); $('#modalToken').modal('open');
} }
$('#input_preToken').on("input", function () { $('#input_preToken').on("input", function () {
var sendBtn = $('#preTokenSend'); var sendBtn = $('#preTokenSend');
if($('#input_preToken').val().length < 4){ if ($('#input_preToken').val().length < 4) {
if (sendBtn.hasClass("scale-in")) { if (sendBtn.hasClass("scale-in")) {
sendBtn.removeClass("scale-in"); sendBtn.removeClass("scale-in");
sendBtn.addClass("scale-out"); sendBtn.addClass("scale-out");
} }
} } else {
else{
if (sendBtn.hasClass("scale-out")) { if (sendBtn.hasClass("scale-out")) {
sendBtn.removeClass("scale-out"); sendBtn.removeClass("scale-out");
sendBtn.addClass("scale-in"); sendBtn.addClass("scale-in");
@ -150,10 +144,10 @@ $(document).ready(function() {
dataType: 'json', dataType: 'json',
contentType: 'application/json', contentType: 'application/json',
url: "/api/userManagement/confirmAccount", url: "/api/userManagement/confirmAccount",
data: JSON.stringify({ id: id.toString(), checkToken: $('#input_preToken').val()}), data: JSON.stringify({id: id.toString(), checkToken: $('#input_preToken').val()}),
success: function (data) { success: function (data) {
console.log(data); console.log(data);
Cookies.set('token',data.token); Cookies.set('token', data.token);
Cookies.set('name', data.name); Cookies.set('name', data.name);
debugger; debugger;
window.location.href = "/" window.location.href = "/"

View File

@ -1,8 +1,7 @@
var post_json = {settings : []}; var post_json = {settings: []};
$(document).ready(function () {
$(document).ready(function(){
$('select').formSelect(); $('select').formSelect();
modal_loading = $('#modal_loading'); modal_loading = $('#modal_loading');
@ -13,42 +12,42 @@ $(document).ready(function(){
$('#sendBtn').click(function () { $('#sendBtn').click(function () {
var select = $('.collect-select'); var select = $('.collect-select');
select.each(function(){ select.each(function () {
var val = $(this).find("select").val(); var val = $(this).find("select").val();
var id = $(this).attr("id"); var id = $(this).attr("id");
if(val != null){ if (val != null) {
post_json["settings"].push({"id" : id, "val" : val}); post_json["settings"].push({"id": id, "val": val});
} }
}); });
var select_multi = $('.collect-select-multiple'); var select_multi = $('.collect-select-multiple');
select_multi.each(function(){ select_multi.each(function () {
var instance = M.FormSelect.getInstance($(this).find("select")[0]); var instance = M.FormSelect.getInstance($(this).find("select")[0]);
var id = $(this).attr("id"); var id = $(this).attr("id");
post_json["settings"].push({"id" : id, "vals" : instance.getSelectedValues()}); post_json["settings"].push({"id": id, "vals": instance.getSelectedValues()});
}); });
var switch_collected = $('.collect-switch'); var switch_collected = $('.collect-switch');
switch_collected.each(function(){ switch_collected.each(function () {
var val = $(this).is(':checked').toString(); var val = $(this).is(':checked').toString();
var id = $(this).attr("id"); var id = $(this).attr("id");
if(val != null){ if (val != null) {
post_json["settings"].push({"id" : id, "val" : val}); post_json["settings"].push({"id": id, "val": val});
} }
}); });
var text = $('.collect-text'); var text = $('.collect-text');
text.each(function(){ text.each(function () {
var val = $(this).val(); var val = $(this).val();
var id = $(this).attr("id"); var id = $(this).attr("id");
if(val != null){ if (val != null) {
post_json["settings"].push({"id" : id, "val" : val}); post_json["settings"].push({"id": id, "val": val});
} }
}); });
@ -62,12 +61,18 @@ $(document).ready(function(){
}).done(function (data) { }).done(function (data) {
console.log("ok"); console.log("ok");
M.toast({html: '<i class="small material-icons" style="margin-right: 0.3em">done</i>Save Successful ! ', classes: 'rounded green'}); M.toast({
html: '<i class="small material-icons" style="margin-right: 0.3em">done</i>Save Successful ! ',
classes: 'rounded green'
});
modal_loading.modal('close'); modal_loading.modal('close');
}).fail(function (data) { }).fail(function (data) {
console.log(data); console.log(data);
modal_loading.modal('close'); modal_loading.modal('close');
M.toast({html: '<i class="small material-icons" style="margin-right: 0.3em">report</i>Save Failed ! ', classes: 'rounded red'}); M.toast({
html: '<i class="small material-icons" style="margin-right: 0.3em">report</i>Save Failed ! ',
classes: 'rounded red'
});
}); });

View File

@ -1,9 +1,9 @@
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
window.addEventListener('load', function() { window.addEventListener('load', function () {
navigator.serviceWorker.register('/sw.js').then(function(registration) { navigator.serviceWorker.register('/sw.js').then(function (registration) {
// Registration was successful // Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope); console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) { }, function (err) {
// registration failed :( // registration failed :(
console.log('ServiceWorker registration failed: ', err); console.log('ServiceWorker registration failed: ', err);
}); });

View File

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset <urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com --> <!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url> <url>
<loc>https://claptrapbot.com/</loc> <loc>https://claptrapbot.com/</loc>
<lastmod>2018-12-03T15:47:35+00:00</lastmod> <lastmod>2018-12-03T15:47:35+00:00</lastmod>
<priority>1.00</priority> <priority>1.00</priority>
</url> </url>
<url> <url>
<loc>https://claptrapbot.com/music</loc> <loc>https://claptrapbot.com/music</loc>
<lastmod>2018-12-03T15:47:35+00:00</lastmod> <lastmod>2018-12-03T15:47:35+00:00</lastmod>
<priority>0.80</priority> <priority>0.80</priority>
</url> </url>
<url> <url>
<loc>https://claptrapbot.com/login</loc> <loc>https://claptrapbot.com/login</loc>
<lastmod>2018-12-03T15:47:35+00:00</lastmod> <lastmod>2018-12-03T15:47:35+00:00</lastmod>
<priority>0.80</priority> <priority>0.80</priority>
</url> </url>
<url> <url>
<loc>https://claptrapbot.com/register</loc> <loc>https://claptrapbot.com/register</loc>
<lastmod>2018-12-03T15:47:35+00:00</lastmod> <lastmod>2018-12-03T15:47:35+00:00</lastmod>
<priority>0.64</priority> <priority>0.64</priority>
</url> </url>
</urlset> </urlset>

View File

@ -31,12 +31,12 @@ self.addEventListener('fetch', function (event) {
var request = event.request; var request = event.request;
event.respondWith(fetch(request).catch( function (reason) { event.respondWith(fetch(request).catch(function (reason) {
console.error( console.error(
'[onfetch] Failed. Serving cached offline fallback ' + '[onfetch] Failed. Serving cached offline fallback ' +
reason reason
); );
return caches.open(CACHE_NAME).then(function(cache){ return caches.open(CACHE_NAME).then(function (cache) {
return cache.match(request); return cache.match(request);
}) })
})); }));

View File

@ -1,19 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
<style> <style>
@media only screen and (max-width: 992px) { @media only screen and (max-width: 992px) {
.row.valign-wrapper { .row.valign-wrapper {

View File

@ -1,19 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="/css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
</head> </head>

View File

@ -1,19 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
<style> <style>
@media only screen and (max-width: 992px) { @media only screen and (max-width: 992px) {
.row.valign-wrapper { .row.valign-wrapper {

View File

@ -6,17 +6,19 @@
</head> </head>
<body> <body>
<link href="../static/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="../static/css/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<div class="footer-copyright brown darken-4" th:fragment="footer"> <div class="footer-copyright brown darken-4" th:fragment="footer">
<div class="container center-align"> <div class="container center-align">
<a href="https://github.com/Sebclem/ClaptrapBot" style="margin-right: 10px; height: 41px" class="" target="_blank"> <a class="" href="https://github.com/Sebclem/ClaptrapBot" style="margin-right: 10px; height: 41px"
<img th:src="@{/img/GitHub.png}" height="41px" alt="Github"/> target="_blank">
<img th:src="@{/img/GitHub_Logo.png}" height="41px" style="margin-left: -3px" alt="Github"/> <img alt="Github" height="41px" th:src="@{/img/GitHub.png}"/>
<img alt="Github" height="41px" style="margin-left: -3px" th:src="@{/img/GitHub_Logo.png}"/>
</a> </a>
<a href="https://www.buymeacoffee.com/seb6596" target="_blank"> <a href="https://www.buymeacoffee.com/seb6596" target="_blank">
<img alt="Buy Me A Coffee" src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"/> <img alt="Buy Me A Coffee"
src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"/>
</a> </a>
</div> </div>

View File

@ -11,17 +11,23 @@
<!-- AND --> <!-- AND -->
<!-- LOGIN --> <!-- LOGIN -->
<!--__________________________________________________________--> <!--__________________________________________________________-->
<link href="../static/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="../static/css/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<div th:fragment="header (page, guild_name, isAdmin)"> <div th:fragment="header (page, guild_name, isAdmin)">
<nav class="brown darken-4 z-depth-3" role="navigation" > <nav class="brown darken-4 z-depth-3" role="navigation">
<div class="nav-wrapper container"> <div class="nav-wrapper container">
<a href="/" class="brand-logo hide-on-small-and-down" style="white-space: nowrap">Claptrap Bot</a> <a class="brand-logo hide-on-small-and-down" href="/" style="white-space: nowrap">Claptrap Bot</a>
<a href="/" class="brand-logo hide-on-med-and-up show-on-small" style="white-space: nowrap">Claptrap</a> <a class="brand-logo hide-on-med-and-up show-on-small" href="/" style="white-space: nowrap">Claptrap</a>
<ul class="right hide-on-med-and-down"> <ul class="right hide-on-med-and-down">
<li> <li>
<a th:if="${guild_name != ''}" class="truncate waves-effect brown darken-3 waves-light btn-flat grey-text text-darken-1 dropdown-trigger" id="drop-trigger-guilds" data-target="dropdown_guilds" th:inline="text" style="margin-top: 2px;margin-right: 10px;">[[${guild_name}]]<img th:src="${guild_icon}" id="guildLogo" class="brand-logo left circle" style="max-height: 100%; margin-right: 10px; padding: 2px; padding-left: 0"/></a> <a class="truncate waves-effect brown darken-3 waves-light btn-flat grey-text text-darken-1 dropdown-trigger"
data-target="dropdown_guilds"
id="drop-trigger-guilds" style="margin-top: 2px;margin-right: 10px;" th:if="${guild_name != ''}"
th:inline="text">[[${guild_name}]]<img class="brand-logo left circle"
id="guildLogo"
style="max-height: 100%; margin-right: 10px; padding: 2px; padding-left: 0"
th:src="${guild_icon}"/></a>
</li> </li>
<li class="" th:classappend="(${page} == 'home')? 'active' : ''"> <li class="" th:classappend="(${page} == 'home')? 'active' : ''">
<a class="waves-effect waves-light" href="/">Home</a> <a class="waves-effect waves-light" href="/">Home</a>
@ -35,28 +41,35 @@
<li id="nav-bar-account"> <li id="nav-bar-account">
<a class="dropdown-account dropdown-trigger" data-target="dropdown_connected"><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> </li>
</ul> </ul>
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a> <a class="sidenav-trigger" data-target="nav-mobile" href="#"><i class="material-icons">menu</i></a>
</div> </div>
</nav> </nav>
<ul id="nav-mobile" class="sidenav"> <ul class="sidenav" id="nav-mobile">
<li class="center"> <li class="center">
<a class="brand-logo" href="/" style="font-weight: bold"><h3 class="blue-grey-text text-darken-4" style="font-weight: bold">Claptrap</h3></a> <a class="brand-logo" href="/" style="font-weight: bold"><h3 class="blue-grey-text text-darken-4"
style="font-weight: bold">Claptrap</h3></a>
</li>
<li>
<div class="divider"></div>
</li> </li>
<li><div class="divider"></div></li>
<li class="center "> <li class="center ">
<a class="nav-change-guild truncate waves-effect waves-light btn grey lighten-2 black-text " th:text="${guild_name}" style=""></a> <a class="nav-change-guild truncate waves-effect waves-light btn grey lighten-2 black-text "
style="" th:text="${guild_name}"></a>
</li>
<li>
<div class="divider"></div>
</li> </li>
<li><div class="divider"></div></li>
<li class="center" th:classappend="(${page} == 'home')? 'active' : ''"> <li class="center" th:classappend="(${page} == 'home')? 'active' : ''">
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a> <a class="waves-effect waves-light sidenav-trigger" data-target="slide-out" href="/">Home</a>
</li> </li>
<li class="center" th:classappend="(${page} == 'music')? 'active' : ''"> <li class="center" th:classappend="(${page} == 'music')? 'active' : ''">
<a class="waves-effect waves-light" href="/music">Music Control</a> <a class="waves-effect waves-light" href="/music">Music Control</a>
@ -66,16 +79,21 @@
</li> </li>
<li><div class="divider"></div></li> <li>
<div class="divider"></div>
</li>
<li><a class="center nav-change-guild" href="#">Change Server</a></li> <li><a class="center nav-change-guild" href="#">Change Server</a></li>
<li class="center bot-settings" th:classappend="(${page} == 'settings')? 'active' : ''" th:style="${isAdmin} ? '' : 'visibility: hidden; display: none;'"> <li class="center bot-settings" th:classappend="(${page} == 'settings')? 'active' : ''"
th:style="${isAdmin} ? '' : 'visibility: hidden; display: none;'">
<a class="waves-effect waves-light" href="/settings">Bot Settings</a> <a class="waves-effect waves-light" href="/settings">Bot Settings</a>
</li> </li>
<li> <li>
<a class="center tooltipped" data-position="bottom" data-delay="50" data-tooltip="Under Development!">My Account</a> <a class="center tooltipped" data-delay="50" data-position="bottom" data-tooltip="Under Development!">My
Account</a>
</li> </li>
<li> <li>
<a class="center tooltipped" data-position="bottom" data-delay="50" data-tooltip="Under Development!">My Playlists</a> <a class="center tooltipped" data-delay="50" data-position="bottom" data-tooltip="Under Development!">My
Playlists</a>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
@ -87,8 +105,11 @@
<ul class="dropdown-content" id="dropdown_guilds"> <ul class="dropdown-content" id="dropdown_guilds">
<!--/*@thymesVar id="mutual_guilds" type="java.util.List<net.dv8tion.jda.core.entities.Guild>"*/--> <!--/*@thymesVar id="mutual_guilds" type="java.util.List<net.dv8tion.jda.core.entities.Guild>"*/-->
<th:block th:each="guild : ${mutual_guilds}"> <th:block th:each="guild : ${mutual_guilds}">
<li style="height: 50px; white-space: nowrap;" th:attr="data-id = ${guild.getId()}" th:if="${guild.getId() != guild_id}" class="guild_change"> <li class="guild_change" style="height: 50px; white-space: nowrap;"
<img th:src="${guild.getIconUrl() == null ? 'https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png' : guild.getIconUrl()}" class="left circle" style="max-height: 100%; padding: 5px; "/><a class="center blue-grey-text text-darken-4" th:inline="text" style="margin-left: 50px">[[${guild.getName()}]]</a> th:attr="data-id = ${guild.getId()}" th:if="${guild.getId() != guild_id}">
<img class="left circle"
style="max-height: 100%; padding: 5px; " th:src="${guild.getIconUrl() == null ? 'https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png' : guild.getIconUrl()}"/><a
class="center blue-grey-text text-darken-4" style="margin-left: 50px" th:inline="text">[[${guild.getName()}]]</a>
</li> </li>
</th:block> </th:block>
@ -96,22 +117,24 @@
</ul> </ul>
<!-- Dropdown connected --> <!-- Dropdown connected -->
<ul id="dropdown_connected" class="dropdown-content "> <ul class="dropdown-content " id="dropdown_connected">
<li> <li>
<a class="center blue-grey-text text-darken-4 tooltipped" data-position="left" data-delay="50" data-tooltip="It's you !" id="nav-name" style="font-weight: bold"></a> <a class="center blue-grey-text text-darken-4 tooltipped" data-delay="50" data-position="left"
data-tooltip="It's you !" id="nav-name" style="font-weight: bold"></a>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
<li><a class="center nav-change-guild" href="#">Change Server</a></li> <li><a class="center nav-change-guild" href="#">Change Server</a></li>
<li class="bot-settings" th:style="${isAdmin} ? '' : 'visibility: hidden; display: none;'"> <li class="bot-settings" th:style="${isAdmin} ? '' : 'visibility: hidden; display: none;'">
<a class=" center waves-effect waves-light " href="/settings" >Bot Settings</a> <a class=" center waves-effect waves-light " href="/settings">Bot Settings</a>
</li> </li>
<li> <li>
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Account</a> <a class="center tooltipped" data-delay="50" data-position="left" data-tooltip="Under Development!">My
Account</a>
</li> </li>
<li> <li>
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Playlists</a> <a class="center tooltipped" data-delay="50" data-position="left" data-tooltip="Under Development!">My
Playlists</a>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
@ -119,29 +142,28 @@
</ul> </ul>
<!--________________________________________--> <!--________________________________________-->
<!-- Guild modal --> <!-- Guild modal -->
<!--________________________________________--> <!--________________________________________-->
<div id="modal_guild" class="modal"> <div class="modal" id="modal_guild">
<div class="modal-content" style="padding-bottom: 0px"> <div class="modal-content" style="padding-bottom: 0px">
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<h3 class="col l12 m12 s12 center">Server Selection</h3> <h3 class="col l12 m12 s12 center">Server Selection</h3>
<div class="col l4 offset-l4 m8 offset-m4 offset-s3 s8 center"> <div class="col l4 offset-l4 m8 offset-m4 offset-s3 s8 center">
<form id="guild_form" action="#" class="left-align"> <form action="#" class="left-align" id="guild_form">
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" id="btn_ok_guild" class="modal-action modal-close waves-effect waves-green btn-flat disabled">Ok</a> <a class="modal-action modal-close waves-effect waves-green btn-flat disabled" href="#"
id="btn_ok_guild">Ok</a>
</div> </div>
</div> </div>
<div class="modal" id="modal_internet">
<div id="modal_internet" class="modal">
<div class="modal-content" style="padding-bottom: 0px"> <div class="modal-content" style="padding-bottom: 0px">
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<h3 class="col l12 m 12 s12 center red-text">Can't connect to the server!</h3> <h3 class="col l12 m 12 s12 center red-text">Can't connect to the server!</h3>
@ -155,12 +177,10 @@
</div> </div>
<p class="" id="radioTemplateGuild" style="visibility: hidden; display: none ">
<p id="radioTemplateGuild" class="" style="visibility: hidden; display: none ">
<label> <label>
<input name="guildRadio" class="with-gap" type="radio" value="@id" id="@id" data-icon="@url"/> <input class="with-gap" data-icon="@url" id="@id" name="guildRadio" type="radio" value="@id"/>
<span><img src="@url" class="circle left" style="max-height: 100%; margin-right: 6px"/> @name</span> <span><img class="circle left" src="@url" style="max-height: 100%; margin-right: 6px"/> @name</span>
</label> </label>
</p> </p>

View File

@ -5,32 +5,37 @@
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script> <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-144247946-1'); gtag('config', 'UA-144247946-1');
</script> </script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<meta name="description" content="Claptrap discord bot at your service! Add me to your discord server and my beautiful web interface will be there for you ! Music control, config, news, you can do anything with my web page!"/> <meta content="Claptrap discord bot at your service! Add me to your discord server and my beautiful web interface will be there for you ! Music control, config, news, you can do anything with my web page!"
name="description"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<th:block th:if="${isLogged} == true and ${noMutualGuilds} == false"> <th:block th:if="${isLogged} == true and ${noMutualGuilds} == false">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.0.2/octicons.min.css"/> <link href="//cdnjs.cloudflare.com/ajax/libs/octicons/2.0.2/octicons.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="css/github-activity.css"/> <link href="css/github-activity.css" rel="stylesheet"/>
</th:block> </th:block>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
<style> <style>
@media only screen and (max-width: 992px) { @media only screen and (max-width: 992px) {
.row.valign-wrapper { .row.valign-wrapper {
@ -42,7 +47,6 @@
</style> </style>
</head> </head>
<body class="blue-grey lighten-5"> <body class="blue-grey lighten-5">
@ -62,18 +66,18 @@
<div th:if="${isLogged} == false"> <div th:if="${isLogged} == false">
<div class="row valign-wrapper"> <div class="row valign-wrapper">
<div class="col m6 offset-s2 s8 center"> <div class="col m6 offset-s2 s8 center">
<img src="/favicon.png" class="responsive-img"/> <img class="responsive-img" src="/favicon.png"/>
<div class="card blue-grey"> <div class="card blue-grey">
<div class="card-content white-text center z-depth-5"> <div class="card-content white-text center z-depth-5">
<span class="card-title">Add me to your server !</span> <span class="card-title">Add me to your server !</span>
<a class="btn green" th:href="${inviteLink}" target="_blank">Invite me !</a> <a class="btn green" target="_blank" th:href="${inviteLink}">Invite me !</a>
</div> </div>
</div> </div>
</div> </div>
<div class="col m6 s12 center flow-text"> <div class="col m6 s12 center flow-text">
<h2>Hello you !</h2> <h2>Hello you !</h2>
<h4>Please log in to have access to your server</h4> <h4>Please log in to have access to your server</h4>
<a class="btn green pulse" style="margin-top: 10px" href="/login">Log in / Register</a> <a class="btn green pulse" href="/login" style="margin-top: 10px">Log in / Register</a>
</div> </div>
</div> </div>
@ -84,13 +88,14 @@
<div th:if="${noMutualGuilds} == true"> <div th:if="${noMutualGuilds} == true">
<div class="row valign-wrapper"> <div class="row valign-wrapper">
<div class="col m6 offset-s3 s6"> <div class="col m6 offset-s3 s6">
<img src="/favicon.png" class="responsive-img"/> <img class="responsive-img" src="/favicon.png"/>
</div> </div>
<div class="col m6 s12 center flow-text"> <div class="col m6 s12 center flow-text">
<h2>Oh no !</h2> <h2>Oh no !</h2>
<h4>We don't have any mutual server !</h4> <h4>We don't have any mutual server !</h4>
<h5>You can change this by inviting me with this button !</h5> <h5>You can change this by inviting me with this button !</h5>
<a th:href="${inviteLink}" class="btn blue pulse" style="margin-top: 10px" href="/login" target="_blank">Invite me !</a> <a class="btn blue pulse" href="/login" style="margin-top: 10px" target="_blank"
th:href="${inviteLink}">Invite me !</a>
</div> </div>
</div> </div>
@ -98,12 +103,13 @@
<div th:if="${noMutualGuilds} == false"> <div th:if="${noMutualGuilds} == false">
<div class="row"> <div class="row">
<div class="col l6 offset-s2 s8 center"> <div class="col l6 offset-s2 s8 center">
<img src="/favicon.png" class="responsive-img"/> <img class="responsive-img" src="/favicon.png"/>
<h2 class="flow-text">Home Page Comming soon!</h2> <h2 class="flow-text">Home Page Comming soon!</h2>
<div class="card blue-grey"> <div class="card blue-grey">
<div class="card-content white-text center z-depth-4"> <div class="card-content white-text center z-depth-4">
<span class="card-title">Add me to your server !</span> <span class="card-title">Add me to your server !</span>
<a class="btn green waves-effect" th:href="${inviteLink}" target="_blank">Invite me !</a> <a class="btn green waves-effect" target="_blank" th:href="${inviteLink}">Invite me
!</a>
</div> </div>
</div> </div>
</div> </div>
@ -130,7 +136,8 @@
<script th:src="@{/js/fontawesome.js}"></script> <script th:src="@{/js/fontawesome.js}"></script>
<script th:src="@{/js/workerRegister.js}"></script> <script th:src="@{/js/workerRegister.js}"></script>
<th:block th:if="${isLogged} == true and ${noMutualGuilds} == false"> <th:block th:if="${isLogged} == true and ${noMutualGuilds} == false">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/3.0.1/mustache.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/3.0.1/mustache.min.js"
type="text/javascript"></script>
<script th:src="@{/js/github-activity.js}"></script> <script th:src="@{/js/github-activity.js}"></script>
<script> <script>
GitHubActivity.feed({ GitHubActivity.feed({
@ -143,6 +150,5 @@
</th:block> </th:block>
</body> </body>
</html> </html>

View File

@ -1,18 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
</head> </head>
<body class="blue-grey lighten-5"> <body class="blue-grey lighten-5">
@ -25,8 +25,9 @@
<header> <header>
<nav class="brown darken-4 z-depth-3" role="navigation"> <nav class="brown darken-4 z-depth-3" role="navigation">
<div class="nav-wrapper container"> <div class="nav-wrapper container">
<a href="/" class="brand-logo hide-on-small-and-down center" style="white-space: nowrap">Claptrap Bot</a> <a class="brand-logo hide-on-small-and-down center" href="/" style="white-space: nowrap">Claptrap Bot</a>
<a href="/" class="brand-logo hide-on-med-and-up show-on-small center" style="white-space: nowrap">Claptrap</a> <a class="brand-logo hide-on-med-and-up show-on-small center" href="/"
style="white-space: nowrap">Claptrap</a>
</div> </div>
</nav> </nav>
</header> </header>

View File

@ -4,23 +4,27 @@
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script> <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-144247946-1'); gtag('config', 'UA-144247946-1');
</script> </script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
</head> </head>
@ -34,8 +38,9 @@
<header> <header>
<nav class="brown darken-4 z-depth-3" role="navigation"> <nav class="brown darken-4 z-depth-3" role="navigation">
<div class="nav-wrapper container"> <div class="nav-wrapper container">
<a href="/" class="brand-logo hide-on-small-and-down center" style="white-space: nowrap">Claptrap Bot</a> <a class="brand-logo hide-on-small-and-down center" href="/" style="white-space: nowrap">Claptrap Bot</a>
<a href="/" class="brand-logo hide-on-med-and-up show-on-small center" style="white-space: nowrap">Claptrap</a> <a class="brand-logo hide-on-med-and-up show-on-small center" href="/"
style="white-space: nowrap">Claptrap</a>
</div> </div>
</nav> </nav>
</header> </header>
@ -66,25 +71,29 @@
</div> </div>
</div> </div>
<div class="row center" style="margin-bottom: 0px"> <div class="row center" style="margin-bottom: 0px">
<form name="login_form" id="login_form"> <form id="login_form" name="login_form">
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<div class="input-field col l6 offset-l3 m10 offset-m1 s10 offset-s1"> <div class="input-field col l6 offset-l3 m10 offset-m1 s10 offset-s1">
<i class="material-icons prefix">account_box</i> <i class="material-icons prefix">account_box</i>
<input name="username" id="user_input" type="text" class="validate" autocomplete="username"/> <input autocomplete="username" class="validate" id="user_input" name="username"
<label for="user_input" >User Name</label> type="text"/>
<label for="user_input">User Name</label>
<span class="helper-text" data-error="User not registered!"></span> <span class="helper-text" data-error="User not registered!"></span>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="input-field col l6 offset-l3 m10 offset-m1 s10 offset-s1"> <div class="input-field col l6 offset-l3 m10 offset-m1 s10 offset-s1">
<i class="material-icons prefix">security</i> <i class="material-icons prefix">security</i>
<input name="password" id="password_input" type="password" class="validate" autocomplete="current-password"/> <input autocomplete="current-password" class="validate" id="password_input" name="password"
type="password"/>
<label for="password_input">Password</label> <label for="password_input">Password</label>
<span class="helper-text" data-error="Wrong password!"></span> <span class="helper-text" data-error="Wrong password!"></span>
</div> </div>
</div> </div>
<div class="row" style="margin-bottom: 10px"> <div class="row" style="margin-bottom: 10px">
<button id="btn-submit-connect" class="btn waves-effect waves-light light-green darken-1 scale-transition scale-out" type="submit" name="action" > <button class="btn waves-effect waves-light light-green darken-1 scale-transition scale-out"
id="btn-submit-connect"
name="action" type="submit">
Submit<i class="material-icons right">send</i> Submit<i class="material-icons right">send</i>
</button> </button>
</div> </div>
@ -113,7 +122,7 @@
<script th:src="@{/js/materialize.js}"></script> <script th:src="@{/js/materialize.js}"></script>
<script th:src="@{/js/login.js}"></script> <script th:src="@{/js/login.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script> <script th:src="@{/js/js.cookie.js}"></script>
<script src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" crossorigin="anonymous"></script> <script crossorigin="anonymous" src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
</body> </body>

View File

@ -4,24 +4,28 @@
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script> <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-144247946-1'); gtag('config', 'UA-144247946-1');
</script> </script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Music Control - Claptrap Bot</title> <title>Music Control - Claptrap Bot</title>
<link rel="icon" <link href="favicon.png"
type="image/x-icon" rel="icon"
href="favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="/css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
<style> <style>
@media only screen and (max-width: 1200px) { @media only screen and (max-width: 1200px) {
#modalAdd { #modalAdd {
@ -34,6 +38,7 @@
width: 80%; width: 80%;
} }
} }
@media only screen and (min-width: 993px) { @media only screen and (min-width: 993px) {
#card-playlist { #card-playlist {
max-height: 75vh; max-height: 75vh;
@ -46,7 +51,7 @@
padding: 0; padding: 0;
} }
#card-playlist li:not(.active){ #card-playlist li:not(.active) {
margin: 0; margin: 0;
} }
@ -101,8 +106,8 @@
<div class="row"> <div class="row">
<div class="col l8 s12 m12"> <div class="col l8 s12 m12">
<div class="row center"> <div class="row center">
<img class="responsive-img z-depth-3" id="music_img" style="max-width: 30%" <img class="responsive-img z-depth-3" id="music_img" src="/img/disconnected.png"
src="/img/disconnected.png"/> style="max-width: 30%"/>
</div> </div>
<h4 class="center" id="music_text"></h4> <h4 class="center" id="music_text"></h4>
<div class="row center" style="margin-bottom: 0px"> <div class="row center" style="margin-bottom: 0px">
@ -111,11 +116,11 @@
</div> </div>
</div> </div>
<div class="row center"> <div class="row center">
<div class="col l2 offset-l3 m2 offset-m1 s2 offset-s1 left-align" style="padding: 0px" <div class="col l2 offset-l3 m2 offset-m1 s2 offset-s1 left-align" id="current_time"
id="current_time">0:00 style="padding: 0px">0:00
</div> </div>
<div class="col l2 offset-l2 m2 offset-m6 s2 offset-s6 right-align " style="padding: 0px" <div class="col l2 offset-l2 m2 offset-m6 s2 offset-s6 right-align " id="total_time"
id="total_time">0:00 style="padding: 0px">0:00
</div> </div>
</div> </div>
<div class="row center"> <div class="row center">
@ -171,17 +176,17 @@
</div> </div>
<div class="col l3 m2 s2 center" style="padding-right: 0px; padding-left: 0px"> <div class="col l3 m2 s2 center" style="padding-right: 0px; padding-left: 0px">
<!-- Modal Trigger --> <!-- Modal Trigger -->
<a class="waves-effect waves-light btn modal-trigger green darken-4" id="add_btn" <a class="waves-effect waves-light btn modal-trigger green darken-4" href="#modalAdd"
href="#modalAdd"><i class="material-icons">add_circle_outline</i></a> id="add_btn"><i class="material-icons">add_circle_outline</i></a>
</div> </div>
<div class="col l3 m2 s2 center " style="padding-left: 0px"> <div class="col l3 m2 s2 center " style="padding-left: 0px">
<div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px"> <div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px">
AutoFlow AutoFlow
</div> </div>
<div class="row switch tooltipped ctl-btn" data-position="bottom" data-delay="50" <div class="row switch tooltipped ctl-btn" data-delay="50" data-position="bottom"
data-tooltip="Experimental!"> data-tooltip="Experimental!">
<label> <label>
<input type="checkbox" id="autoflow"/> <input id="autoflow" type="checkbox"/>
<span class="lever"></span> <span class="lever"></span>
</label> </label>
</div> </div>
@ -197,7 +202,7 @@
<td> <td>
<div class="row card-panel scroll" id="card-playlist"> <div class="row card-panel scroll" id="card-playlist">
<div class="col s12" style="padding: 0"> <div class="col s12" style="padding: 0">
<ul id="playlist_list" class="collapsible" data-collapsible="accordion" <ul class="collapsible" data-collapsible="accordion" id="playlist_list"
style="margin: 0px"> style="margin: 0px">
</ul> </ul>
@ -217,7 +222,7 @@
<!-- Music --> <!-- Music -->
<div id="modal_current_info" class="modal bottom-sheet"> <div class="modal bottom-sheet" id="modal_current_info">
<div class="modal-content"> <div class="modal-content">
<ul class="collection"> <ul class="collection">
<li class="collection-item " id="modal_title"></li> <li class="collection-item " id="modal_title"></li>
@ -234,7 +239,7 @@
</div> </div>
<!--Add Modal--> <!--Add Modal-->
<div id="modalAdd" class="modal modal-fixed-footer "> <div class="modal modal-fixed-footer " id="modalAdd">
<div class="modal-content" style="padding-bottom: 0px"> <div class="modal-content" style="padding-bottom: 0px">
<div class="row valign-wrapper"> <div class="row valign-wrapper">
<h3 class="col l12 m12 s12 center"> Add Music</h3> <h3 class="col l12 m12 s12 center"> Add Music</h3>
@ -246,24 +251,24 @@
<div class="input-field col offset-l1 l9 m9 s7" <div class="input-field col offset-l1 l9 m9 s7"
style="padding-left: 0px; padding-right: 0px"> style="padding-left: 0px; padding-right: 0px">
<!--<i class="material-icons prefix">link</i>--> <!--<i class="material-icons prefix">link</i>-->
<input id="input_search" type="text" class="validate"/> <input class="validate" id="input_search" type="text"/>
<label for="input_search">Search</label> <label for="input_search">Search</label>
</div> </div>
<div class="input-field col l1 m2 s3" style="margin-top: 22px"> <div class="input-field col l1 m2 s3" style="margin-top: 22px">
<button class="btn waves-effect waves-light green darken-4 white-text" id="btn_search" <button class="btn waves-effect waves-light green darken-4 white-text" id="btn_search"
type="button"><i class="material-icons">search</i></button> type="button"><i class="material-icons">search</i></button>
</div> </div>
<!-- <div class="col l1 m1 s2 center" style="padding: 0; margin-top: 15px;">--> <!-- <div class="col l1 m1 s2 center" style="padding: 0; margin-top: 15px;">-->
<!-- <div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px">--> <!-- <div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px">-->
<!-- Playlist--> <!-- Playlist-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="row switch">--> <!-- <div class="row switch">-->
<!-- <label>--> <!-- <label>-->
<!-- <input type="checkbox" id="playlistSearch"/>--> <!-- <input type="checkbox" id="playlistSearch"/>-->
<!-- <span class="lever"></span>--> <!-- <span class="lever"></span>-->
<!-- </label>--> <!-- </label>-->
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
</div> </div>
<div class="row"> <div class="row">
@ -297,7 +302,7 @@
<div class="modal-footer"> <div class="modal-footer">
<span style="margin-right: 10px"> <span style="margin-right: 10px">
<label> <label>
<input name="group1" type="radio" checked="checked" id="bottom"/> <input checked="checked" id="bottom" name="group1" type="radio"/>
<span>Bottom</span> <span>Bottom</span>
</label> </label>
</span> </span>
@ -307,7 +312,7 @@
<span>Top</span> <span>Top</span>
</label> </label>
</span> </span>
<a href="#" class="modal-action modal-close waves-effect waves-green btn-flat">Close</a> <a class="modal-action modal-close waves-effect waves-green btn-flat" href="#">Close</a>
</div> </div>
</div> </div>
@ -319,7 +324,7 @@
<ul class="collection"> <ul class="collection">
<li class="collection-item">Author: @author</li> <li class="collection-item">Author: @author</li>
<li class="collection-item">Duration: @lenght</li> <li class="collection-item">Duration: @lenght</li>
<li class="collection-item">URL: <a target="_blank" href="@url">@url</a></li> <li class="collection-item">URL: <a href="@url" target="_blank">@url</a></li>
<li class="collection-item">Submitted by: @user</li> <li class="collection-item">Submitted by: @user</li>
<li class="collection-item center"> <li class="collection-item center">
<a class="btn red darken-4 z-depth-3 waves-effect waves-light btn_dell_playlist" data_url="@url"> <a class="btn red darken-4 z-depth-3 waves-effect waves-light btn_dell_playlist" data_url="@url">
@ -331,27 +336,27 @@
</li> </li>
<!-- Modal Chanels --> <!-- Modal Chanels -->
<div id="modalChanels" class="modal"> <div class="modal" id="modalChanels">
<div class="modal-content" style="padding-bottom: 0px"> <div class="modal-content" style="padding-bottom: 0px">
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<h3 class="col l12 m12 s12 center">Vocal Channels</h3> <h3 class="col l12 m12 s12 center">Vocal Channels</h3>
<div class="col offset-l4 l4 m4 offset-m4 s8 offset-s2 center"> <div class="col offset-l4 l4 m4 offset-m4 s8 offset-s2 center">
<form id="channelForm" action="#" class="left-align"> <form action="#" class="left-align" id="channelForm">
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="/" class="modal-action modal-close waves-effect waves-red btn-flat ">Cancel</a> <a class="modal-action modal-close waves-effect waves-red btn-flat " href="/">Cancel</a>
<a href="#!" id="btn_ok_channel" <a class="modal-action modal-close waves-effect waves-green btn-flat disabled" href="#!"
class="modal-action modal-close waves-effect waves-green btn-flat disabled">Connect</a> id="btn_ok_channel">Connect</a>
</div> </div>
</div> </div>
<!--Loading Modal--> <!--Loading Modal-->
<div id="modal_loading" class="modal valign-wrapper"> <div class="modal valign-wrapper" id="modal_loading">
<div class="modal-content"> <div class="modal-content">
<div class="row center"> <div class="row center">
<h3 class="col l12 m12 s12 center">Please wait</h3> <h3 class="col l12 m12 s12 center">Please wait</h3>
@ -411,9 +416,9 @@
</div> </div>
<p id="radioTemplate" class="" style="visibility: hidden; display: none"> <p class="" id="radioTemplate" style="visibility: hidden; display: none">
<label> <label>
<input name="vocalRadio" class="with-gap" type="radio" value="@id" id="@id"/> <input class="with-gap" id="@id" name="vocalRadio" type="radio" value="@id"/>
<span for="@id">@name</span> <span for="@id">@name</span>
</label> </label>

View File

@ -1,18 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
</head> </head>
@ -62,7 +62,5 @@
<script th:src="@{/js/fontawesome.js}"></script> <script th:src="@{/js/fontawesome.js}"></script>
</body> </body>
</html> </html>

View File

@ -5,25 +5,29 @@
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script> <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-144247946-1'); gtag('config', 'UA-144247946-1');
</script> </script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Claptrap Bot</title> <title>Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
<style> <style>
tr { tr {
border-color: #fbcf40; border-color: #fbcf40;
@ -35,16 +39,18 @@
font-weight: normal; font-weight: normal;
} }
td span{ td span {
color: #fbcf40; color: #fbcf40;
font-size: 12px; font-size: 12px;
} }
.collapsible{
.collapsible {
border-color: #fbcf40; border-color: #fbcf40;
border-left: none; border-left: none;
border-right: none; border-right: none;
} }
.collapsible-header{
.collapsible-header {
border-color: #fbcf40; border-color: #fbcf40;
} }
</style> </style>
@ -67,15 +73,16 @@
<th:block th:if="${stack != null}"> <th:block th:if="${stack != null}">
<div class="row" style="margin-bottom: 0"> <div class="row" style="margin-bottom: 0">
<div class="col l6 offset-l3 m10 offset-m1 s10 offset-s1 card-panel grey darken-4 white-text"> <div class="col l6 offset-l3 m10 offset-m1 s10 offset-s1 card-panel grey darken-4 white-text">
<h4 class="center" style="font-weight: bold"><span th:text="${guild_name}" th:remove="tag"></span><br/>Stats </h4> <h4 class="center" style="font-weight: bold"><span th:remove="tag" th:text="${guild_name}"></span><br/>Stats
</h4>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="card-panel col l6 offset-l3 m10 offset-m1 s10 offset-s1 grey darken-4 white-text"> <div class="card-panel col l6 offset-l3 m10 offset-m1 s10 offset-s1 grey darken-4 white-text">
<div class="row" style="margin-bottom: 0"> <div class="row" style="margin-bottom: 0">
<div class="col s12 center" style="margin-top: 10px"> <div class="col s12 center" style="margin-top: 10px">
<img class="circle" th:src="${stack.selfStats.avatarUrl}" <img class="circle" style="border-color: green; border-style: solid;"
style="border-color: green; border-style: solid;"/> th:src="${stack.selfStats.avatarUrl}"/>
</div> </div>
<div class="col s12 center"> <div class="col s12 center">
<h4 style="font-weight: bold; margin: 0;" th:text="${stack.selfStats.userName}"></h4> <h4 style="font-weight: bold; margin: 0;" th:text="${stack.selfStats.userName}"></h4>
@ -92,8 +99,8 @@
<tbody> <tbody>
<tr> <tr>
<td> <td>
<h4 style="font-weight: bold; margin: 0"><span th:text="${stack.rank}" <h4 style="font-weight: bold; margin: 0"><span th:remove="tag"
th:remove="tag"></span> <span th:text="${stack.rank}"></span> <span
th:text="${' / ' + stack.ranking.size()}">/ 50</span></h4> th:text="${' / ' + stack.ranking.size()}">/ 50</span></h4>
</td> </td>
</tr> </tr>
@ -111,8 +118,8 @@
<tbody> <tbody>
<tr> <tr>
<td> <td>
<h4 style="font-weight: bold; margin: 0"><span th:text="${stack.selfStats.total}" <h4 style="font-weight: bold; margin: 0"><span th:remove="tag"
th:remove="tag"></span> th:text="${stack.selfStats.total}"></span>
<span>Xp</span> <span>Xp</span>
</h4> </h4>
</td> </td>
@ -135,12 +142,12 @@
<tr> <tr>
<td> <td>
<h4 style="font-weight: bold; margin: 0"> <h4 style="font-weight: bold; margin: 0">
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stack.selfStats.voiceTime).get(0)}" <span th:remove="tag"
th:remove="tag"></span> <span>H</span> th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stack.selfStats.voiceTime).get(0)}"></span> <span>H</span>
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stack.selfStats.voiceTime).get(1)}" <span th:remove="tag"
th:remove="tag"></span> <span>M</span> th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stack.selfStats.voiceTime).get(1)}"></span> <span>M</span>
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stack.selfStats.voiceTime).get(2)}" <span th:remove="tag"
th:remove="tag"></span> <span>S</span> th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stack.selfStats.voiceTime).get(2)}"></span> <span>S</span>
</h4> </h4>
</td> </td>
</tr> </tr>
@ -159,8 +166,8 @@
<tr> <tr>
<td> <td>
<h4 style="font-weight: bold; margin: 0"><span <h4 style="font-weight: bold; margin: 0"><span
th:text="${stack.selfStats.messageCount}" th:remove="tag"
th:remove="tag"></span> <span>msg</span> th:text="${stack.selfStats.messageCount}"></span> <span>msg</span>
</h4> </h4>
</td> </td>
</tr> </tr>
@ -193,14 +200,14 @@
<th:block th:each="stat : ${stack.ranking}"> <th:block th:each="stat : ${stack.ranking}">
<tr> <tr>
<td th:text="${stat.rank}"></td> <td th:text="${stat.rank}"></td>
<td><img th:src="${stat.avatarUrl}" class="circle" style="max-height: 50px"/></td> <td><img class="circle" style="max-height: 50px" th:src="${stat.avatarUrl}"/></td>
<td th:text="${stat.userName}"></td> <td th:text="${stat.userName}"></td>
<td> <span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(0)}" <td> <span th:remove="tag"
th:remove="tag"></span> <span>H</span> th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(0)}"></span> <span>H</span>
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(1)}" <span th:remove="tag"
th:remove="tag"></span> <span>M</span> th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(1)}"></span> <span>M</span>
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(2)}" <span th:remove="tag"
th:remove="tag"></span> <span>S</span></td> th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(2)}"></span> <span>S</span></td>
<td th:text="${stat.messageCount}"></td> <td th:text="${stat.messageCount}"></td>
<td th:text="${stat.total}"></td> <td th:text="${stat.total}"></td>
@ -216,10 +223,16 @@
<div class="col s10 offset-s1 hide-on-med-and-up card-panel grey darken-4 white-text"> <div class="col s10 offset-s1 hide-on-med-and-up card-panel grey darken-4 white-text">
<h3 class="center"><b>Ranking</b></h3> <h3 class="center"><b>Ranking</b></h3>
<ul class="collapsible popout" > <ul class="collapsible popout">
<th:block th:each="stat : ${stack.ranking}"> <th:block th:each="stat : ${stack.ranking}">
<li> <li>
<div class="collapsible-header grey darken-3 valign-wrapper"> <span th:text="${stat.rank + '. '}" style="font-weight: bold"></span><img th:src="${stat.avatarUrl}" class="circle" style="max-height: 40px; margin: 0 10px 0 10px"/> <span th:text="${stat.userName}"></span><span class="badge new green" data-badge-caption="xp " th:text="${stat.total}">4</span></div> <div class="collapsible-header grey darken-3 valign-wrapper"><span
style="font-weight: bold" th:text="${stat.rank + '. '}"></span><img
class="circle" style="max-height: 40px; margin: 0 10px 0 10px"
th:src="${stat.avatarUrl}"/> <span
th:text="${stat.userName}"></span><span class="badge new green"
data-badge-caption="xp "
th:text="${stat.total}">4</span></div>
<div class="collapsible-body grey darken-2"> <div class="collapsible-body grey darken-2">
<table class="centered"> <table class="centered">
<thead> <thead>
@ -232,12 +245,13 @@
<tbody> <tbody>
<tr> <tr>
<td> <span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(0)}" <td> <span
th:remove="tag"></span> <span>H</span> th:remove="tag"
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(1)}" th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(0)}"></span> <span>H</span>
th:remove="tag"></span> <span>M</span> <span th:remove="tag"
<span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(2)}" th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(1)}"></span> <span>M</span>
th:remove="tag"></span> <span>S</span></td> <span th:remove="tag"
th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(2)}"></span> <span>S</span></td>
<td th:text="${stat.messageCount}"></td> <td th:text="${stat.messageCount}"></td>
</tr> </tr>
@ -269,7 +283,7 @@
<script th:src="@{/js/navabar.js}"></script> <script th:src="@{/js/navabar.js}"></script>
<script th:src="@{/js/js.cookie.js}"></script> <script th:src="@{/js/js.cookie.js}"></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function () {
var elems = document.querySelectorAll('.collapsible'); var elems = document.querySelectorAll('.collapsible');
var instances = M.Collapsible.init(elems); var instances = M.Collapsible.init(elems);
}); });

View File

@ -5,23 +5,27 @@
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script> <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-144247946-1'); gtag('config', 'UA-144247946-1');
</script> </script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Sign up - Claptrap Bot</title> <title>Sign up - Claptrap Bot</title>
<link rel="icon" type="image/x-icon" href="favicon.png"/> <link href="favicon.png" rel="icon" type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
</head> </head>
<body class="blue-grey lighten-5"> <body class="blue-grey lighten-5">
@ -41,8 +45,8 @@
<div class="col s12"> <div class="col s12">
<div class="input-field inline"> <div class="input-field inline">
<i class="material-icons prefix">assignment_ind</i> <i class="material-icons prefix">assignment_ind</i>
<input id="name" type="text" class="validate invalid"/> <input class="validate invalid" id="name" type="text"/>
<label for="name" data-error="" data-success="">Discord Name</label> <label data-error="" data-success="" for="name">Discord Name</label>
</div> </div>
</div> </div>
</div> </div>
@ -50,8 +54,8 @@
<div class="col s12"> <div class="col s12">
<div class="input-field inline"> <div class="input-field inline">
<i class="material-icons prefix">security</i> <i class="material-icons prefix">security</i>
<input id="passwrd" type="password" class="invalid"/> <input class="invalid" id="passwrd" type="password"/>
<label for="passwrd" data-error="" data-success="">Password</label> <label data-error="" data-success="" for="passwrd">Password</label>
</div> </div>
</div> </div>
</div> </div>
@ -59,13 +63,13 @@
<div class="col s12"> <div class="col s12">
<div class="input-field inline"> <div class="input-field inline">
<i class="material-icons prefix">security</i> <i class="material-icons prefix">security</i>
<input id="passwrd2" type="password" class="invalid"/> <input class="invalid" id="passwrd2" type="password"/>
<label for="passwrd2" data-error="" data-success="">Confirm</label> <label data-error="" data-success="" for="passwrd2">Confirm</label>
</div> </div>
</div> </div>
</div> </div>
<div class="col s12"> <div class="col s12">
<a id="sendBtn" class="waves-effect waves-light btn scale-transition scale-out">Send<i <a class="waves-effect waves-light btn scale-transition scale-out" id="sendBtn">Send<i
class="material-icons left">send</i></a> class="material-icons left">send</i></a>
</div> </div>
</div> </div>
@ -73,7 +77,7 @@
<!-- Modal Structure --> <!-- Modal Structure -->
<div id="modalToken" class="modal"> <div class="modal" id="modalToken">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<h3 class="col s12 center"> User Validation</h3> <h3 class="col s12 center"> User Validation</h3>
@ -90,7 +94,7 @@
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<div class="input-field col s6 offset-s3"> <div class="input-field col s6 offset-s3">
<i class="material-icons prefix">fingerprint</i> <i class="material-icons prefix">fingerprint</i>
<input id="input_preToken" type="text" class="validate"/> <input class="validate" id="input_preToken" type="text"/>
<label for="input_preToken">Verification Code</label> <label for="input_preToken">Verification Code</label>
</div> </div>
</div> </div>
@ -98,7 +102,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" id="preTokenSend" class="modal-action waves-effect waves-green btn scale-transition scale-out">Send</a> <a class="modal-action waves-effect waves-green btn scale-transition scale-out" href="#" id="preTokenSend">Send</a>
</div> </div>
</div> </div>
</main> </main>

View File

@ -5,25 +5,29 @@
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script> <script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-144247946-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-144247946-1'); gtag('config', 'UA-144247946-1');
</script> </script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/> <meta content="width=device-width, initial-scale=1, maximum-scale=1.0" name="viewport"/>
<title>Bot Settings - Claptrap Bot</title> <title>Bot Settings - Claptrap Bot</title>
<link rel="icon" <link href="/favicon.png"
type="image/x-icon" rel="icon"
href="/favicon.png"/> type="image/x-icon"/>
<!-- CSS --> <!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/> <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/materialize.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/> <link href="css/style.css" media="screen,projection" rel="stylesheet" type="text/css"/>
<link rel="manifest" href="/manifest.json"/> <link href="/manifest.json" rel="manifest"/>
<meta name="theme-color" content="#263238"/> <meta content="#263238" name="theme-color"/>
</head> </head>
@ -60,49 +64,51 @@
<div th:each="setting : ${settings}"> <div th:each="setting : ${settings}">
<div class="row"> <div class="row">
<div class="col l10 offset-l1 m10 offset-m1 s10 offset-s1"> <div class="col l10 offset-l1 m10 offset-m1 s10 offset-s1">
<h5 th:text="${setting.name}" style="font-weight: bold"></h5> <h5 style="font-weight: bold" th:text="${setting.name}"></h5>
<div class="switch" th:if="${setting.type.toString() == 'BOOL'}"> <div class="switch" th:if="${setting.type.toString() == 'BOOL'}">
<label> <label>
Off Off
<input class="collect-switch" type="checkbox" th:id="${setting.id}" <input class="collect-switch" th:checked="${setting.current}" th:id="${setting.id}"
th:checked="${setting.current}"/> type="checkbox"/>
<span class="lever"></span> <span class="lever"></span>
On On
</label> </label>
<div th:text="${setting.description}"></div> <div th:text="${setting.description}"></div>
</div> </div>
<div th:id="${setting.id}" class="input-field col l12 m12 s12 collect-select" <div class="input-field col l12 m12 s12 collect-select" th:id="${setting.id}"
th:if="${setting.type.toString() == 'LIST'}"> th:if="${setting.type.toString() == 'LIST'}">
<select> <select>
<option disabled="disabled" th:selected="${setting.current} == ' '" value="">Choose your option <option disabled="disabled" th:selected="${setting.current} == ' '" value="">Choose
your option
</option> </option>
<option th:each="val : ${setting.values}" th:value="${val.id}" <option th:each="val : ${setting.values}" th:selected="${setting.current} == ${val.id}"
th:text="${#strings.capitalize(val.name)}" th:text="${#strings.capitalize(val.name)}"
th:selected="${setting.current} == ${val.id}"></option> th:value="${val.id}"></option>
</select> </select>
<div th:text="${setting.description}"></div> <div th:text="${setting.description}"></div>
</div> </div>
<div th:id="${setting.id}" class="input-field col l12 m12 s12 collect-select-multiple" <div class="input-field col l12 m12 s12 collect-select-multiple" th:id="${setting.id}"
th:if="${setting.type.toString() == 'SELECT_LIST'}"> th:if="${setting.type.toString() == 'SELECT_LIST'}">
<select multiple="multiple"> <select multiple="multiple">
<option disabled="disabled" value="">Choose your option <option disabled="disabled" value="">Choose your option
</option> </option>
<option th:each="val : ${setting.values}" th:value="${val.id}" <option th:each="val : ${setting.values}" th:selected="${val.selected} == true"
th:text="${#strings.capitalize(val.name)}" th:text="${#strings.capitalize(val.name)}"
th:selected="${val.selected} == true"></option> th:value="${val.id}"></option>
</select> </select>
<div th:text="${setting.description}"></div> <div th:text="${setting.description}"></div>
</div> </div>
<div class="input-field col l12 m12 s12 collect"
<div class="input-field col l12 m12 s12 collect" th:if="${setting.type.toString() == 'STRING'}"> th:if="${setting.type.toString() == 'STRING'}">
<input th:id="${setting.id}" placeholder="Use @name variable" th:value="${setting.current}" <input class="validate collect-text" id="first_name"
id="first_name" type="text" class="validate collect-text"/> placeholder="Use @name variable"
th:id="${setting.id}" th:value="${setting.current}" type="text"/>
<div th:text="${setting.description}"></div> <div th:text="${setting.description}"></div>
</div> </div>
@ -117,7 +123,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col s12 center"> <div class="col s12 center">
<a id="sendBtn" class="waves-effect waves-light btn green">Save<i <a class="waves-effect waves-light btn green" id="sendBtn">Save<i
class="material-icons left">save</i></a> class="material-icons left">save</i></a>
</div> </div>
</div> </div>
@ -125,7 +131,7 @@
</div> </div>
</div> </div>
<div id="modal_loading" class="modal valign-wrapper"> <div class="modal valign-wrapper" id="modal_loading">
<div class="modal-content"> <div class="modal-content">
<div class="row center"> <div class="row center">
<h3 class="col l12 m12 s12 center">Please wait</h3> <h3 class="col l12 m12 s12 center">Please wait</h3>