Migrate clear slashcommand
This commit is contained in:
parent
9517a0a318
commit
872dde7695
24
README.md
24
README.md
@ -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
|
||||||
|
14
build.gradle
14
build.gradle
@ -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() {
|
||||||
|
@ -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 (event.getMember().getRoles().size() == 0) {
|
||||||
if (!MainBot.roleFlag) {
|
logger.info("[" + event.getGuild().getName() + "] : " + event.getUser().getName() + " have no roles, reset to default !");
|
||||||
|
Role default_role = event.getGuild().getRoleById(guildPref.getDefaultRoleId());
|
||||||
if (event.getMember().getRoles().size() == 0) {
|
if (default_role == null) {
|
||||||
|
logger.fatal("[" + event.getGuild().getName() + "] : Default role is null !");
|
||||||
logger.info(event.getUser().getName() + "have no roles, move it!");
|
return;
|
||||||
List<Role> roles = new ArrayList<>();
|
|
||||||
roles.add(event.getGuild().getRoleById(guildPref.getDefaultRoleId()));
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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());
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -12,7 +12,8 @@ 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
|
||||||
*/
|
*/
|
||||||
void action(SlashCommandEvent event);
|
void action(SlashCommandEvent event);
|
||||||
@ -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();
|
||||||
|
@ -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
|
||||||
|
58
src/main/java/net/Broken/SlashCommands/Clear.java
Normal file
58
src/main/java/net/Broken/SlashCommands/Clear.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
|
||||||
|
|
||||||
// #-----------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
||||||
*
|
*
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
Hey look! A cat!
|
|
||||||
And he's different everytime !
|
|
||||||
That is so cute! :cat:
|
|
@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
Ho! Regarde! Un chat!
|
|
||||||
Mais il est different à chaque fois en plus!
|
|
||||||
C'est trop cute! :cat:
|
|
@ -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.
|
|
@ -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.
|
|
@ -1,2 +0,0 @@
|
|||||||
This command doesn't have any help at the moment.
|
|
||||||
To help us improve: https://github.com/BrokenFire/BrokenDiscordBot
|
|
@ -1,2 +0,0 @@
|
|||||||
L'aide pour cette commande n'est pas encore disponible !
|
|
||||||
Pour contribué: https://github.com/BrokenFire/BrokenDiscordBot
|
|
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
`//flush <number>`
|
|
||||||
:arrow_right: *Erase the n last posts (Max = 100)*
|
|
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
`//flush <nbr>`
|
|
||||||
:arrow_right: *Efface les n derniers messages (Max = 100)*
|
|
@ -1,2 +0,0 @@
|
|||||||
`//move <@user> <@targeted_role>`
|
|
||||||
:arrow_right: *Move an user to the targeted role.*
|
|
@ -1,2 +0,0 @@
|
|||||||
`//move <@utilisateur> <@rôleCible>`
|
|
||||||
:arrow_right: *Deplacement d'un utilisateur vers un rôle cible, attention à bien faire les mentions.*
|
|
@ -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.*
|
|
@ -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.*
|
|
@ -1,2 +0,0 @@
|
|||||||
`//ping`
|
|
||||||
:arrow_right: *Send back the bot's ping*
|
|
@ -1,2 +0,0 @@
|
|||||||
`//ping`
|
|
||||||
:arrow_right: *Renvoi le ping du bot*
|
|
@ -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.*
|
|
@ -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.*
|
|
@ -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)*
|
|
@ -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)*
|
|
@ -1,7 +0,0 @@
|
|||||||
```
|
|
||||||
@list
|
|
||||||
```
|
|
||||||
_PU = Private Usable
|
|
||||||
|
|
||||||
**>** __**[Web UI](https://claptrapbot.com )**__ :arrow_right: Music control, Settings, News
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
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:
|
||||||
**%code**
|
**%code**
|
||||||
|
@ -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>
|
||||||
|
@ -7,266 +7,293 @@
|
|||||||
* 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;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: Helvetica, arial, freesans, clean, sans-serif;
|
font-family: Helvetica, arial, freesans, clean, sans-serif;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed, .gha-feed h2, .gha-feed h3, .gha-feed p, .gha-feed ul, .gha-feed li {
|
.gha-feed, .gha-feed h2, .gha-feed h3, .gha-feed p, .gha-feed ul, .gha-feed li {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed ul {
|
.gha-feed ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed li {
|
.gha-feed li {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed small a {
|
.gha-feed small a {
|
||||||
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;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed a {
|
.gha-feed a {
|
||||||
color: #4183c4;
|
color: #4183c4;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed a:hover {
|
.gha-feed a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-feed pre {
|
.gha-feed pre {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
box-shadow: 1px 1px 4px #bbb;
|
box-shadow: 1px 1px 4px #bbb;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-header {
|
.gha-header {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
left: 1px;
|
left: 1px;
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
height: 67px;
|
height: 67px;
|
||||||
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 {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: -1px;
|
bottom: -1px;
|
||||||
left: 1px;
|
left: 1px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-top: 1px solid #ddd;
|
border-top: 1px solid #ddd;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-footer a {
|
.gha-footer a {
|
||||||
float: right;
|
float: right;
|
||||||
color: #495961;
|
color: #495961;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
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;
|
||||||
float: left;
|
float: left;
|
||||||
padding: 9px 0 0;
|
padding: 9px 0 0;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
color: #495961;
|
color: #495961;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-github-icon .octicon {
|
.gha-github-icon .octicon {
|
||||||
font: normal normal 40px octicons;
|
font: normal normal 40px octicons;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-gravatar {
|
.gha-gravatar {
|
||||||
display: inline;
|
display: inline;
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
max-width: 60px;
|
max-width: 60px;
|
||||||
height: 67px;
|
height: 67px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-gravatar img {
|
.gha-gravatar img {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
box-shadow: 1px 1px 3px #ccc;
|
box-shadow: 1px 1px 3px #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-activity {
|
.gha-activity {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.gha-activity.gha-small {
|
.gha-activity.gha-small {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-activity.gha-small a {
|
.gha-activity.gha-small a {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-activity.gha-small span {
|
.gha-activity.gha-small span {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-activity:last-child {
|
.gha-activity:last-child {
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-repo {
|
.gha-repo {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
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;
|
||||||
margin: 6px auto;
|
margin: 6px auto;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font: normal normal 30px octicons;
|
font: normal normal 30px octicons;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-activity-icon .gha-small {
|
.gha-activity-icon .gha-small {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-message {
|
.gha-message {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
float: left;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-sha {
|
.gha-sha {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-family: Consolas, "Liberation Mono", Courier, monospace;
|
font-family: Consolas, "Liberation Mono", Courier, monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-gravatar-small {
|
.gha-gravatar-small {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-gravatar-commit {
|
.gha-gravatar-commit {
|
||||||
margin-bottom: -3px;
|
margin-bottom: -3px;
|
||||||
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;
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 6px 10px 5px;
|
padding: 6px 10px 5px;
|
||||||
color: #495961;
|
color: #495961;
|
||||||
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;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-info {
|
.gha-info {
|
||||||
margin: 15px;
|
margin: 15px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid #e4e4c6;
|
border: 1px solid #e4e4c6;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: #ffffde;
|
background: #ffffde;
|
||||||
color: #6d6d4b;
|
color: #6d6d4b;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gha-time {
|
.gha-time {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
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;
|
||||||
|
}
|
||||||
|
8814
src/main/resources/static/css/materialize.css
vendored
8814
src/main/resources/static/css/materialize.css
vendored
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,10 +22,10 @@ main {
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Norwester";
|
font-family: "Norwester";
|
||||||
src: url("/css/font/norwester.ttf"),
|
src: url("/css/font/norwester.ttf"),
|
||||||
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
@ -7,373 +7,554 @@
|
|||||||
* 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 = "";
|
||||||
renderGitHubLink: function(url, title, cssClass) {
|
return Mustache.render('<a class="' + cssClass + '" href="{{url}}" target="_blank">{{{title}}}</a>', {
|
||||||
if (!title) { title = url; }
|
url: url,
|
||||||
if (typeof(cssClass) === 'undefined') cssClass = "";
|
title: title
|
||||||
return methods.renderLink('https://github.com/' + url, title, cssClass);
|
});
|
||||||
},
|
},
|
||||||
getMessageFor: function(data) {
|
renderGitHubLink: function (url, title, cssClass) {
|
||||||
var p = data.payload;
|
if (!title) {
|
||||||
data.repoLink = methods.renderGitHubLink(data.repo.name);
|
title = url;
|
||||||
data.userGravatar = Mustache.render('<div class="gha-gravatar-user"><img src="{{url}}" class="gha-gravatar-small"></div>', { url: data.actor.avatar_url });
|
}
|
||||||
|
if (typeof (cssClass) === 'undefined') cssClass = "";
|
||||||
|
return methods.renderLink('https://github.com/' + url, title, cssClass);
|
||||||
|
},
|
||||||
|
getMessageFor: function (data) {
|
||||||
|
var p = data.payload;
|
||||||
|
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});
|
||||||
|
|
||||||
// Get the branch name if it exists.
|
// Get the branch name if it exists.
|
||||||
if (p.ref) {
|
if (p.ref) {
|
||||||
if (p.ref.substring(0, 11) === 'refs/heads/') {
|
if (p.ref.substring(0, 11) === 'refs/heads/') {
|
||||||
data.branch = p.ref.substring(11);
|
data.branch = p.ref.substring(11);
|
||||||
} else {
|
} else {
|
||||||
data.branch = p.ref;
|
data.branch = p.ref;
|
||||||
|
}
|
||||||
|
data.branchLink = methods.renderGitHubLink(data.repo.name + '/tree/' + data.branch, data.branch) + ' at ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only show the first 6 characters of the SHA of each commit if given.
|
||||||
|
if (p.commits) {
|
||||||
|
var shaDiff = p.before + '...' + p.head;
|
||||||
|
var length = p.commits.length;
|
||||||
|
if (length === 2) {
|
||||||
|
// 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 »</a>', {
|
||||||
|
repo: data.repo.name,
|
||||||
|
shaDiff: shaDiff
|
||||||
|
});
|
||||||
|
} else if (length > 2) {
|
||||||
|
// 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) + ' »</a>', {
|
||||||
|
repo: data.repo.name,
|
||||||
|
shaDiff: shaDiff,
|
||||||
|
length: p.size - 2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
p.commits.forEach(function (d, i) {
|
||||||
|
if (d.message.length > 66) {
|
||||||
|
d.message = d.message.substring(0, 66) + '...';
|
||||||
|
}
|
||||||
|
if (i < 2) {
|
||||||
|
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)});
|
||||||
|
} else {
|
||||||
|
// Delete the rest of the commits after the first 2, and then break out of the each loop.
|
||||||
|
p.commits.splice(2, p.size);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the link if this is an IssueEvent.
|
||||||
|
if (p.issue) {
|
||||||
|
var title = data.repo.name + "#" + p.issue.number;
|
||||||
|
data.issueLink = methods.renderLink(p.issue.html_url, title);
|
||||||
|
data.issueType = "issue";
|
||||||
|
if (p.issue.pull_request) {
|
||||||
|
data.issueType = "pull request";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the pull request link if this is a PullRequestEvent.
|
||||||
|
if (p.pull_request) {
|
||||||
|
var pr = p.pull_request;
|
||||||
|
data.pullRequestLink = methods.renderLink(pr.html_url, data.repo.name + "#" + pr.number);
|
||||||
|
data.mergeMessage = "";
|
||||||
|
|
||||||
|
// If this was a merge, set the merge message.
|
||||||
|
if (p.pull_request.merged) {
|
||||||
|
p.action = "merged";
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the link if this is a PullRequestReviewCommentEvent
|
||||||
|
if (p.comment && p.comment.pull_request_url) {
|
||||||
|
var title = data.repo.name + "#" + p.comment.pull_request_url.split('/').pop();
|
||||||
|
data.pullRequestLink = methods.renderLink(p.comment.html_url, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the comment if one exists, and trim it to 150 characters.
|
||||||
|
if (p.comment && p.comment.body) {
|
||||||
|
data.comment = p.comment.body;
|
||||||
|
if (data.comment.length > 150) {
|
||||||
|
data.comment = data.comment.substring(0, 150) + '...';
|
||||||
|
}
|
||||||
|
if (p.comment.html_url && p.comment.commit_id) {
|
||||||
|
var title = data.repo.name + '@' + p.comment.commit_id.substring(0, 10);
|
||||||
|
data.commentLink = methods.renderLink(p.comment.html_url, title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'ReleaseEvent') {
|
||||||
|
data.tagLink = methods.renderLink(p.release.html_url, p.release.tag_name);
|
||||||
|
data.zipLink = methods.renderLink(p.release.zipball_url, 'Download Source Code (zip)');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wiki event
|
||||||
|
if (data.type === 'GollumEvent') {
|
||||||
|
var page = p.pages[0];
|
||||||
|
data.actionType = page.action;
|
||||||
|
data.message = data.actionType.charAt(0).toUpperCase() + data.actionType.slice(1) + ' ';
|
||||||
|
data.message += methods.renderGitHubLink(page.html_url, page.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'FollowEvent') data.targetLink = methods.renderGitHubLink(p.target.login);
|
||||||
|
if (data.type === 'ForkEvent') data.forkLink = methods.renderGitHubLink(p.forkee.full_name);
|
||||||
|
if (data.type === 'MemberEvent') data.memberLink = methods.renderGitHubLink(p.member.login);
|
||||||
|
|
||||||
|
if (p.gist) {
|
||||||
|
data.actionType = p.action === 'fork' ? p.action + 'ed' : p.action + 'd';
|
||||||
|
data.gistLink = methods.renderLink(p.gist.html_url, 'gist: ' + p.gist.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
var message = Mustache.render(templates[data.type], data);
|
||||||
|
var timeString = millisecondsToStr(new Date() - new Date(data.created_at));
|
||||||
|
var icon;
|
||||||
|
|
||||||
|
if (data.type == 'CreateEvent' && (['repository', 'branch', 'tag'].indexOf(p.ref_type) >= 0)) {
|
||||||
|
// Display separate icons depending on type of create event.
|
||||||
|
icon = icons[data.type + '_' + p.ref_type];
|
||||||
|
} else {
|
||||||
|
icon = icons[data.type]
|
||||||
|
}
|
||||||
|
var activity = {
|
||||||
|
message: message,
|
||||||
|
icon: icon,
|
||||||
|
timeString: timeString,
|
||||||
|
userLink: methods.renderGitHubLink(data.actor.login)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (singleLineActivities.indexOf(data.type) > -1) {
|
||||||
|
return Mustache.render(templates.SingleLineActivity, activity);
|
||||||
|
}
|
||||||
|
return Mustache.render(templates.Activity, activity);
|
||||||
|
},
|
||||||
|
getHeaderHTML: function (data) {
|
||||||
|
if (data.name) {
|
||||||
|
data.userNameLink = methods.renderLink(data.html_url, data.name);
|
||||||
|
} else {
|
||||||
|
data.withoutName = ' without-name';
|
||||||
|
}
|
||||||
|
data.userLink = methods.renderLink(data.html_url, data.login);
|
||||||
|
data.gravatarLink = methods.renderLink(data.html_url, '<img src="' + data.avatar_url + '">');
|
||||||
|
|
||||||
|
return Mustache.render(templates.UserHeader, data);
|
||||||
|
},
|
||||||
|
getActivityHTML: function (data, limit) {
|
||||||
|
var text = '';
|
||||||
|
var dataLength = data.length;
|
||||||
|
if (limit && limit > dataLength) {
|
||||||
|
limit = dataLength;
|
||||||
|
}
|
||||||
|
limit = limit ? limit : dataLength;
|
||||||
|
|
||||||
|
if (limit === 0) {
|
||||||
|
return Mustache.render(templates.NoActivity, {});
|
||||||
|
}
|
||||||
|
for (var i = 0; i < limit; i++) {
|
||||||
|
text += methods.getMessageFor(data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
},
|
||||||
|
getOutputFromRequest: function (url, callback) {
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
request.open('GET', url);
|
||||||
|
request.setRequestHeader('Accept', 'application/vnd.github.v3+json');
|
||||||
|
|
||||||
|
request.onreadystatechange = function () {
|
||||||
|
if (request.readyState === 4) {
|
||||||
|
if (request.status >= 200 && request.status < 300) {
|
||||||
|
var data = JSON.parse(request.responseText);
|
||||||
|
callback(undefined, data);
|
||||||
|
} else {
|
||||||
|
callback('request for ' + url + ' yielded status ' + request.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
request.onerror = function () {
|
||||||
|
callback('An error occurred connecting to ' + url);
|
||||||
|
};
|
||||||
|
request.send();
|
||||||
|
},
|
||||||
|
renderStream: function (output, div) {
|
||||||
|
div.innerHTML = Mustache.render(templates.Stream, {text: output, footer: templates.Footer});
|
||||||
|
div.style.position = 'relative';
|
||||||
|
},
|
||||||
|
writeOutput: function (selector, content) {
|
||||||
|
var div = selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1));
|
||||||
|
if (div instanceof HTMLCollection) {
|
||||||
|
for (var i = 0; i < div.length; i++) {
|
||||||
|
methods.renderStream(content, div[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
methods.renderStream(content, div);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
renderIfReady: function (selector, header, activity) {
|
||||||
|
if (header && activity) {
|
||||||
|
methods.writeOutput(selector, header + activity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data.branchLink = methods.renderGitHubLink(data.repo.name + '/tree/' + data.branch, data.branch) + ' at ';
|
};
|
||||||
}
|
|
||||||
|
|
||||||
// Only show the first 6 characters of the SHA of each commit if given.
|
obj.feed = function (options) {
|
||||||
if (p.commits) {
|
if (!options.username || !options.selector) {
|
||||||
var shaDiff = p.before + '...' + p.head;
|
throw "You must specify the username and selector options for the activity stream.";
|
||||||
var length = p.commits.length;
|
|
||||||
if (length === 2) {
|
|
||||||
// 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 »</a>', { repo: data.repo.name, shaDiff: shaDiff });
|
|
||||||
} else if (length > 2) {
|
|
||||||
// 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) + ' »</a>', { repo: data.repo.name, shaDiff: shaDiff, length: p.size - 2 });
|
|
||||||
}
|
|
||||||
|
|
||||||
p.commits.forEach(function(d, i) {
|
|
||||||
if (d.message.length > 66) {
|
|
||||||
d.message = d.message.substring(0, 66) + '...';
|
|
||||||
}
|
|
||||||
if (i < 2) {
|
|
||||||
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) });
|
|
||||||
} else {
|
|
||||||
// Delete the rest of the commits after the first 2, and then break out of the each loop.
|
|
||||||
p.commits.splice(2, p.size);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var selector = options.selector,
|
||||||
|
userUrl = 'https://api.github.com/users/' + options.username,
|
||||||
|
eventsUrl = userUrl + '/events',
|
||||||
|
header,
|
||||||
|
activity;
|
||||||
|
|
||||||
|
if (!!options.repository) {
|
||||||
|
eventsUrl = 'https://api.github.com/repos/' + options.username + '/' + options.repository + '/events';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.clientId && options.clientSecret) {
|
||||||
|
var authString = '?client_id=' + options.clientId + '&client_secret=' + options.clientSecret;
|
||||||
|
userUrl += authString;
|
||||||
|
eventsUrl += authString;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!!options.eventsUrl) {
|
||||||
|
eventsUrl = options.eventsUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow templates override
|
||||||
|
if (typeof options.templates == 'object') {
|
||||||
|
for (var template in templates) {
|
||||||
|
if (typeof options.templates[template] == 'string') {
|
||||||
|
templates[template] = options.templates[template];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
methods.getOutputFromRequest(userUrl, function (error, output) {
|
||||||
|
if (error) {
|
||||||
|
header = Mustache.render(templates.UserNotFound, {username: options.username});
|
||||||
|
} else {
|
||||||
|
header = methods.getHeaderHTML(output)
|
||||||
|
}
|
||||||
|
methods.renderIfReady(selector, header, activity)
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// Get the link if this is an IssueEvent.
|
methods.getOutputFromRequest(eventsUrl, function (error, output) {
|
||||||
if (p.issue) {
|
if (error) {
|
||||||
var title = data.repo.name + "#" + p.issue.number;
|
activity = Mustache.render(templates.EventsNotFound, {username: options.username});
|
||||||
data.issueLink = methods.renderLink(p.issue.html_url, title);
|
} else {
|
||||||
data.issueType = "issue";
|
var limit = options.limit != 'undefined' ? parseInt(options.limit, 10) : null;
|
||||||
if (p.issue.pull_request) {
|
activity = methods.getActivityHTML(output, limit);
|
||||||
data.issueType = "pull request";
|
}
|
||||||
}
|
methods.renderIfReady(selector, header, activity);
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Retrieve the pull request link if this is a PullRequestEvent.
|
return obj;
|
||||||
if (p.pull_request) {
|
|
||||||
var pr = p.pull_request;
|
|
||||||
data.pullRequestLink = methods.renderLink(pr.html_url, data.repo.name + "#" + pr.number);
|
|
||||||
data.mergeMessage = "";
|
|
||||||
|
|
||||||
// If this was a merge, set the merge message.
|
|
||||||
if (p.pull_request.merged) {
|
|
||||||
p.action = "merged";
|
|
||||||
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 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the link if this is a PullRequestReviewCommentEvent
|
|
||||||
if (p.comment && p.comment.pull_request_url) {
|
|
||||||
var title = data.repo.name + "#" + p.comment.pull_request_url.split('/').pop();
|
|
||||||
data.pullRequestLink = methods.renderLink(p.comment.html_url, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the comment if one exists, and trim it to 150 characters.
|
|
||||||
if (p.comment && p.comment.body) {
|
|
||||||
data.comment = p.comment.body;
|
|
||||||
if (data.comment.length > 150) {
|
|
||||||
data.comment = data.comment.substring(0, 150) + '...';
|
|
||||||
}
|
|
||||||
if (p.comment.html_url && p.comment.commit_id) {
|
|
||||||
var title = data.repo.name + '@' + p.comment.commit_id.substring(0, 10);
|
|
||||||
data.commentLink = methods.renderLink(p.comment.html_url, title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.type === 'ReleaseEvent') {
|
|
||||||
data.tagLink = methods.renderLink(p.release.html_url, p.release.tag_name);
|
|
||||||
data.zipLink = methods.renderLink(p.release.zipball_url, 'Download Source Code (zip)');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wiki event
|
|
||||||
if (data.type === 'GollumEvent') {
|
|
||||||
var page = p.pages[0];
|
|
||||||
data.actionType = page.action;
|
|
||||||
data.message = data.actionType.charAt(0).toUpperCase() + data.actionType.slice(1) + ' ';
|
|
||||||
data.message += methods.renderGitHubLink(page.html_url, page.title);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.type === 'FollowEvent') data.targetLink = methods.renderGitHubLink(p.target.login);
|
|
||||||
if (data.type === 'ForkEvent') data.forkLink = methods.renderGitHubLink(p.forkee.full_name);
|
|
||||||
if (data.type === 'MemberEvent') data.memberLink = methods.renderGitHubLink(p.member.login);
|
|
||||||
|
|
||||||
if (p.gist) {
|
|
||||||
data.actionType = p.action === 'fork' ? p.action + 'ed' : p.action + 'd';
|
|
||||||
data.gistLink = methods.renderLink(p.gist.html_url, 'gist: ' + p.gist.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
var message = Mustache.render(templates[data.type], data);
|
|
||||||
var timeString = millisecondsToStr(new Date() - new Date(data.created_at));
|
|
||||||
var icon;
|
|
||||||
|
|
||||||
if (data.type == 'CreateEvent' && (['repository', 'branch', 'tag'].indexOf(p.ref_type) >= 0)) {
|
|
||||||
// Display separate icons depending on type of create event.
|
|
||||||
icon = icons[data.type + '_' + p.ref_type];
|
|
||||||
} else {
|
|
||||||
icon = icons[data.type]
|
|
||||||
}
|
|
||||||
var activity = { message: message, icon: icon, timeString: timeString, userLink: methods.renderGitHubLink(data.actor.login) };
|
|
||||||
|
|
||||||
if (singleLineActivities.indexOf(data.type) > -1) {
|
|
||||||
return Mustache.render(templates.SingleLineActivity, activity);
|
|
||||||
}
|
|
||||||
return Mustache.render(templates.Activity, activity);
|
|
||||||
},
|
|
||||||
getHeaderHTML: function(data) {
|
|
||||||
if (data.name) {
|
|
||||||
data.userNameLink = methods.renderLink(data.html_url, data.name);
|
|
||||||
} else {
|
|
||||||
data.withoutName = ' without-name';
|
|
||||||
}
|
|
||||||
data.userLink = methods.renderLink(data.html_url, data.login);
|
|
||||||
data.gravatarLink = methods.renderLink(data.html_url, '<img src="' + data.avatar_url + '">');
|
|
||||||
|
|
||||||
return Mustache.render(templates.UserHeader, data);
|
|
||||||
},
|
|
||||||
getActivityHTML: function(data, limit) {
|
|
||||||
var text = '';
|
|
||||||
var dataLength = data.length;
|
|
||||||
if (limit && limit > dataLength) {
|
|
||||||
limit = dataLength;
|
|
||||||
}
|
|
||||||
limit = limit ? limit : dataLength;
|
|
||||||
|
|
||||||
if (limit === 0) {
|
|
||||||
return Mustache.render(templates.NoActivity, {});
|
|
||||||
}
|
|
||||||
for (var i = 0; i < limit; i++) {
|
|
||||||
text += methods.getMessageFor(data[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
|
||||||
},
|
|
||||||
getOutputFromRequest: function(url, callback) {
|
|
||||||
var request = new XMLHttpRequest();
|
|
||||||
request.open('GET', url);
|
|
||||||
request.setRequestHeader('Accept', 'application/vnd.github.v3+json');
|
|
||||||
|
|
||||||
request.onreadystatechange = function() {
|
|
||||||
if (request.readyState === 4) {
|
|
||||||
if (request.status >= 200 && request.status < 300){
|
|
||||||
var data = JSON.parse(request.responseText);
|
|
||||||
callback(undefined, data);
|
|
||||||
} else {
|
|
||||||
callback('request for ' + url + ' yielded status ' + request.status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
request.onerror = function() { callback('An error occurred connecting to ' + url); };
|
|
||||||
request.send();
|
|
||||||
},
|
|
||||||
renderStream: function(output, div) {
|
|
||||||
div.innerHTML = Mustache.render(templates.Stream, { text: output, footer: templates.Footer });
|
|
||||||
div.style.position = 'relative';
|
|
||||||
},
|
|
||||||
writeOutput: function(selector, content) {
|
|
||||||
var div = selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1));
|
|
||||||
if (div instanceof HTMLCollection) {
|
|
||||||
for (var i = 0; i < div.length; i++) {
|
|
||||||
methods.renderStream(content, div[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
methods.renderStream(content, div);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
renderIfReady: function(selector, header, activity) {
|
|
||||||
if (header && activity) {
|
|
||||||
methods.writeOutput(selector, header + activity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
obj.feed = function(options) {
|
|
||||||
if (!options.username || !options.selector) {
|
|
||||||
throw "You must specify the username and selector options for the activity stream.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selector = options.selector,
|
|
||||||
userUrl = 'https://api.github.com/users/' + options.username,
|
|
||||||
eventsUrl = userUrl + '/events',
|
|
||||||
header,
|
|
||||||
activity;
|
|
||||||
|
|
||||||
if (!!options.repository){
|
|
||||||
eventsUrl = 'https://api.github.com/repos/' + options.username + '/' + options.repository + '/events';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.clientId && options.clientSecret) {
|
|
||||||
var authString = '?client_id=' + options.clientId + '&client_secret=' + options.clientSecret;
|
|
||||||
userUrl += authString;
|
|
||||||
eventsUrl += authString;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!!options.eventsUrl){
|
|
||||||
eventsUrl = options.eventsUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow templates override
|
|
||||||
if (typeof options.templates == 'object') {
|
|
||||||
for (var template in templates) {
|
|
||||||
if (typeof options.templates[template] == 'string') {
|
|
||||||
templates[template] = options.templates[template];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
methods.getOutputFromRequest(userUrl, function(error, output) {
|
|
||||||
if (error) {
|
|
||||||
header = Mustache.render(templates.UserNotFound, { username: options.username });
|
|
||||||
} else {
|
|
||||||
header = methods.getHeaderHTML(output)
|
|
||||||
}
|
|
||||||
methods.renderIfReady(selector, header, activity)
|
|
||||||
});
|
|
||||||
|
|
||||||
methods.getOutputFromRequest(eventsUrl, function(error, output) {
|
|
||||||
if (error) {
|
|
||||||
activity = Mustache.render(templates.EventsNotFound, { username: options.username });
|
|
||||||
} else {
|
|
||||||
var limit = options.limit != 'undefined' ? parseInt(options.limit, 10) : null;
|
|
||||||
activity = methods.getActivityHTML(output, limit);
|
|
||||||
}
|
|
||||||
methods.renderIfReady(selector, header, activity);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// Takes in milliseconds and converts it to a human readable time,
|
// Takes in milliseconds and converts it to a human readable time,
|
||||||
// such as 'about 3 hours ago' or '23 days ago'
|
// such as 'about 3 hours ago' or '23 days ago'
|
||||||
function millisecondsToStr(milliseconds) {
|
function millisecondsToStr(milliseconds) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
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 years = Math.floor(temp / 31536000);
|
var temp = Math.floor(milliseconds / 1000);
|
||||||
if (years) return years + ' year' + numberEnding(years);
|
|
||||||
|
|
||||||
var months = Math.floor((temp %= 31536000) / 2592000);
|
var years = Math.floor(temp / 31536000);
|
||||||
if (months) return months + ' month' + numberEnding(months);
|
if (years) return years + ' year' + numberEnding(years);
|
||||||
|
|
||||||
var days = Math.floor((temp %= 2592000) / 86400);
|
var months = Math.floor((temp %= 31536000) / 2592000);
|
||||||
if (days) return days + ' day' + numberEnding(days);
|
if (months) return months + ' month' + numberEnding(months);
|
||||||
|
|
||||||
var hours = Math.floor((temp %= 86400) / 3600);
|
var days = Math.floor((temp %= 2592000) / 86400);
|
||||||
if (hours) return 'about ' + hours + ' hour' + numberEnding(hours);
|
if (days) return days + ' day' + numberEnding(days);
|
||||||
|
|
||||||
var minutes = Math.floor((temp %= 3600) / 60);
|
var hours = Math.floor((temp %= 86400) / 3600);
|
||||||
if (minutes) return minutes + ' minute' + numberEnding(minutes);
|
if (hours) return 'about ' + hours + ' hour' + numberEnding(hours);
|
||||||
|
|
||||||
var seconds = temp % 60;
|
var minutes = Math.floor((temp %= 3600) / 60);
|
||||||
if (seconds) return seconds + ' second' + numberEnding(seconds);
|
if (minutes) return minutes + ' minute' + numberEnding(minutes);
|
||||||
|
|
||||||
return 'just now';
|
var seconds = temp % 60;
|
||||||
|
if (seconds) return seconds + ' second' + numberEnding(seconds);
|
||||||
|
|
||||||
|
return 'just now';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pluralizes a word, but only works when the word requires
|
// Pluralizes a word, but only works when the word requires
|
||||||
// an 's' to be added for pluralization.
|
// an 's' to be added for pluralization.
|
||||||
function pluralize(word, number) {
|
function pluralize(word, number) {
|
||||||
// Yeah I know, this sucks.
|
// Yeah I know, this sucks.
|
||||||
if (number !== 1) return word + 's';
|
if (number !== 1) return word + 's';
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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>',
|
||||||
Activity: '<div id="{{id}}" class="gha-activity">\
|
Activity: '<div id="{{id}}" class="gha-activity">\
|
||||||
<div class="gha-activity-icon"><span class="octicon octicon-{{icon}}"></span></div>\
|
<div class="gha-activity-icon"><span class="octicon octicon-{{icon}}"></span></div>\
|
||||||
<div class="gha-message"><div class="gha-time">{{{timeString}}}</div>{{{userLink}}} {{{message}}}</div>\
|
<div class="gha-message"><div class="gha-time">{{{timeString}}}</div>{{{userLink}}} {{{message}}}</div>\
|
||||||
<div class="gha-clear"></div>\
|
<div class="gha-clear"></div>\
|
||||||
</div>',
|
</div>',
|
||||||
SingleLineActivity: '<div class="gha-activity gha-small">\
|
SingleLineActivity: '<div class="gha-activity gha-small">\
|
||||||
<div class="gha-activity-icon"><span class="octicon octicon-{{icon}}"></span></div>\
|
<div class="gha-activity-icon"><span class="octicon octicon-{{icon}}"></span></div>\
|
||||||
<div class="gha-message"><div class="gha-time">{{{timeString}}}</div>{{{userLink}}} {{{message}}}</div>\
|
<div class="gha-message"><div class="gha-time">{{{timeString}}}</div>{{{userLink}}} {{{message}}}</div>\
|
||||||
<div class="gha-clear"></div>\
|
<div class="gha-clear"></div>\
|
||||||
</div>',
|
</div>',
|
||||||
UserHeader: '<div class="gha-header">\
|
UserHeader: '<div class="gha-header">\
|
||||||
<div class="gha-github-icon"><span class="octicon octicon-mark-github"></span></div>\
|
<div class="gha-github-icon"><span class="octicon octicon-mark-github"></span></div>\
|
||||||
<div class="gha-user-info{{withoutName}}">{{{userNameLink}}}<p>{{{userLink}}}</p></div>\
|
<div class="gha-user-info{{withoutName}}">{{{userNameLink}}}<p>{{{userLink}}}</p></div>\
|
||||||
<div class="gha-gravatar">{{{gravatarLink}}}</div>\
|
<div class="gha-gravatar">{{{gravatarLink}}}</div>\
|
||||||
</div><div class="gha-push"></div>',
|
</div><div class="gha-push"></div>',
|
||||||
Footer: '<div class="gha-footer">Public Activity <a href="https://github.com/caseyscarborough/github-activity" target="_blank">GitHub Activity Stream</a>',
|
Footer: '<div class="gha-footer">Public Activity <a href="https://github.com/caseyscarborough/github-activity" target="_blank">GitHub Activity Stream</a>',
|
||||||
NoActivity: '<div class="gha-info">This user does not have any public activity yet.</div>',
|
NoActivity: '<div class="gha-info">This user does not have any public activity yet.</div>',
|
||||||
UserNotFound: '<div class="gha-info">User {{username}} wasn\'t found.</div>',
|
UserNotFound: '<div class="gha-info">User {{username}} wasn\'t found.</div>',
|
||||||
EventsNotFound: '<div class="gha-info">Events for user {{username}} not found.</div>',
|
EventsNotFound: '<div class="gha-info">Events for user {{username}} not found.</div>',
|
||||||
CommitCommentEvent: 'commented on commit {{{commentLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
|
CommitCommentEvent: 'commented on commit {{{commentLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
|
||||||
CreateEvent: 'created {{payload.ref_type}} {{{branchLink}}}{{{repoLink}}}',
|
CreateEvent: 'created {{payload.ref_type}} {{{branchLink}}}{{{repoLink}}}',
|
||||||
DeleteEvent: 'deleted {{payload.ref_type}} {{payload.ref}} at {{{repoLink}}}',
|
DeleteEvent: 'deleted {{payload.ref_type}} {{payload.ref}} at {{{repoLink}}}',
|
||||||
FollowEvent: 'started following {{{targetLink}}}',
|
FollowEvent: 'started following {{{targetLink}}}',
|
||||||
ForkEvent: 'forked {{{repoLink}}} to {{{forkLink}}}',
|
ForkEvent: 'forked {{{repoLink}}} to {{{forkLink}}}',
|
||||||
GistEvent: '{{actionType}} {{{gistLink}}}',
|
GistEvent: '{{actionType}} {{{gistLink}}}',
|
||||||
GollumEvent: '{{actionType}} the {{{repoLink}}} wiki<br>{{{userGravatar}}}<small>{{{message}}}</small>',
|
GollumEvent: '{{actionType}} the {{{repoLink}}} wiki<br>{{{userGravatar}}}<small>{{{message}}}</small>',
|
||||||
IssueCommentEvent: 'commented on {{issueType}} {{{issueLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
|
IssueCommentEvent: 'commented on {{issueType}} {{{issueLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
|
||||||
IssuesEvent: '{{payload.action}} issue {{{issueLink}}}<br>{{{userGravatar}}}<small>{{payload.issue.title}}</small>',
|
IssuesEvent: '{{payload.action}} issue {{{issueLink}}}<br>{{{userGravatar}}}<small>{{payload.issue.title}}</small>',
|
||||||
MemberEvent: 'added {{{memberLink}}} to {{{repoLink}}}',
|
MemberEvent: 'added {{{memberLink}}} to {{{repoLink}}}',
|
||||||
PublicEvent: 'open sourced {{{repoLink}}}',
|
PublicEvent: 'open sourced {{{repoLink}}}',
|
||||||
PullRequestEvent: '{{payload.action}} pull request {{{pullRequestLink}}}<br>{{{userGravatar}}}<small>{{payload.pull_request.title}}</small>{{{mergeMessage}}}',
|
PullRequestEvent: '{{payload.action}} pull request {{{pullRequestLink}}}<br>{{{userGravatar}}}<small>{{payload.pull_request.title}}</small>{{{mergeMessage}}}',
|
||||||
PullRequestReviewCommentEvent: 'commented on pull request {{{pullRequestLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
|
PullRequestReviewCommentEvent: 'commented on pull request {{{pullRequestLink}}}<br>{{{userGravatar}}}<small>{{comment}}</small>',
|
||||||
PushEvent: 'pushed to {{{branchLink}}}{{{repoLink}}}<br>\
|
PushEvent: 'pushed to {{{branchLink}}}{{{repoLink}}}<br>\
|
||||||
<ul class="gha-commits">{{#payload.commits}}<li><small>{{{committerGravatar}}} {{{shaLink}}} {{message}}</small></li>{{/payload.commits}}</ul>\
|
<ul class="gha-commits">{{#payload.commits}}<li><small>{{{committerGravatar}}} {{{shaLink}}} {{message}}</small></li>{{/payload.commits}}</ul>\
|
||||||
<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',
|
||||||
CreateEvent_branch: 'git-branch-create',
|
CreateEvent_branch: 'git-branch-create',
|
||||||
DeleteEvent: 'repo-delete',
|
DeleteEvent: 'repo-delete',
|
||||||
FollowEvent: 'person-follow',
|
FollowEvent: 'person-follow',
|
||||||
ForkEvent: 'repo-forked',
|
ForkEvent: 'repo-forked',
|
||||||
GistEvent: 'gist',
|
GistEvent: 'gist',
|
||||||
GollumEvent: 'repo',
|
GollumEvent: 'repo',
|
||||||
IssuesEvent: 'issue-opened',
|
IssuesEvent: 'issue-opened',
|
||||||
IssueCommentEvent: 'comment-discussion',
|
IssueCommentEvent: 'comment-discussion',
|
||||||
MemberEvent: 'person',
|
MemberEvent: 'person',
|
||||||
PublicEvent: 'globe',
|
PublicEvent: 'globe',
|
||||||
PullRequestEvent: 'git-pull-request',
|
PullRequestEvent: 'git-pull-request',
|
||||||
PullRequestReviewCommentEvent: 'comment-discussion',
|
PullRequestReviewCommentEvent: 'comment-discussion',
|
||||||
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'];
|
||||||
|
@ -6,160 +6,164 @@
|
|||||||
* Released under the MIT license
|
* Released under the MIT license
|
||||||
*/
|
*/
|
||||||
;(function (factory) {
|
;(function (factory) {
|
||||||
var registeredInModuleLoader = false;
|
var registeredInModuleLoader = false;
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(factory);
|
define(factory);
|
||||||
registeredInModuleLoader = true;
|
registeredInModuleLoader = true;
|
||||||
}
|
}
|
||||||
if (typeof exports === 'object') {
|
if (typeof exports === 'object') {
|
||||||
module.exports = factory();
|
module.exports = factory();
|
||||||
registeredInModuleLoader = true;
|
registeredInModuleLoader = true;
|
||||||
}
|
}
|
||||||
if (!registeredInModuleLoader) {
|
if (!registeredInModuleLoader) {
|
||||||
var OldCookies = window.Cookies;
|
var OldCookies = window.Cookies;
|
||||||
var api = window.Cookies = factory();
|
var api = window.Cookies = factory();
|
||||||
api.noConflict = function () {
|
api.noConflict = function () {
|
||||||
window.Cookies = OldCookies;
|
window.Cookies = OldCookies;
|
||||||
return api;
|
return api;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}(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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
if (arguments.length > 1) {
|
if (arguments.length > 1) {
|
||||||
attributes = extend({
|
attributes = extend({
|
||||||
path: '/'
|
path: '/'
|
||||||
}, api.defaults, attributes);
|
}, api.defaults, attributes);
|
||||||
|
|
||||||
if (typeof attributes.expires === 'number') {
|
if (typeof attributes.expires === 'number') {
|
||||||
var expires = new Date();
|
var expires = new Date();
|
||||||
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
||||||
attributes.expires = expires;
|
attributes.expires = expires;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're using "expires" because "max-age" is not supported by IE
|
// We're using "expires" because "max-age" is not supported by IE
|
||||||
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = JSON.stringify(value);
|
result = JSON.stringify(value);
|
||||||
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))
|
||||||
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||||
} else {
|
} else {
|
||||||
value = converter.write(value, key);
|
value = converter.write(value, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
key = encodeURIComponent(String(key));
|
key = encodeURIComponent(String(key));
|
||||||
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
||||||
key = key.replace(/[\(\)]/g, escape);
|
key = key.replace(/[\(\)]/g, escape);
|
||||||
|
|
||||||
var stringifiedAttributes = '';
|
var stringifiedAttributes = '';
|
||||||
|
|
||||||
for (var attributeName in attributes) {
|
for (var attributeName in attributes) {
|
||||||
if (!attributes[attributeName]) {
|
if (!attributes[attributeName]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
stringifiedAttributes += '; ' + attributeName;
|
stringifiedAttributes += '; ' + attributeName;
|
||||||
if (attributes[attributeName] === true) {
|
if (attributes[attributeName] === true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
stringifiedAttributes += '=' + attributes[attributeName];
|
stringifiedAttributes += '=' + attributes[attributeName];
|
||||||
}
|
}
|
||||||
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read
|
// Read
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
result = {};
|
result = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// To prevent the for loop in the first place assign an empty array
|
// To prevent the for loop in the first place assign an empty array
|
||||||
// in case there are no cookies at all. Also prevents odd result when
|
// in case there are no cookies at all. Also prevents odd result when
|
||||||
// calling "get()"
|
// calling "get()"
|
||||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||||
var rdecode = /(%[0-9A-Z]{2})+/g;
|
var rdecode = /(%[0-9A-Z]{2})+/g;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
for (; i < cookies.length; i++) {
|
for (; i < cookies.length; i++) {
|
||||||
var parts = cookies[i].split('=');
|
var parts = cookies[i].split('=');
|
||||||
var cookie = parts.slice(1).join('=');
|
var cookie = parts.slice(1).join('=');
|
||||||
|
|
||||||
if (!this.json && cookie.charAt(0) === '"') {
|
if (!this.json && cookie.charAt(0) === '"') {
|
||||||
cookie = cookie.slice(1, -1);
|
cookie = cookie.slice(1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var name = parts[0].replace(rdecode, decodeURIComponent);
|
var name = parts[0].replace(rdecode, decodeURIComponent);
|
||||||
cookie = converter.read ?
|
cookie = converter.read ?
|
||||||
converter.read(cookie, name) : converter(cookie, name) ||
|
converter.read(cookie, name) : converter(cookie, name) ||
|
||||||
cookie.replace(rdecode, decodeURIComponent);
|
cookie.replace(rdecode, decodeURIComponent);
|
||||||
|
|
||||||
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) {
|
||||||
result = cookie;
|
result = cookie;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
result[name] = cookie;
|
result[name] = cookie;
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
api.set = api;
|
api.set = api;
|
||||||
api.get = function (key) {
|
api.get = function (key) {
|
||||||
return api.call(api, key);
|
return api.call(api, key);
|
||||||
};
|
};
|
||||||
api.getJSON = function () {
|
api.getJSON = function () {
|
||||||
return api.apply({
|
return api.apply({
|
||||||
json: true
|
json: true
|
||||||
}, [].slice.call(arguments));
|
}, [].slice.call(arguments));
|
||||||
};
|
};
|
||||||
api.defaults = {};
|
api.defaults = {};
|
||||||
|
|
||||||
api.remove = function (key, attributes) {
|
api.remove = function (key, attributes) {
|
||||||
api(key, '', extend(attributes, {
|
api(key, '', extend(attributes, {
|
||||||
expires: -1
|
expires: -1
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
api.withConverter = init;
|
api.withConverter = init;
|
||||||
|
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
return init(function () {});
|
return init(function () {
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
setInterval("loop()",1000);
|
setInterval("loop()", 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
function loop() {
|
function loop() {
|
||||||
|
@ -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,30 +50,25 @@ 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',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
url: "/api/userManagement/requestToken",
|
url: "/api/userManagement/requestToken",
|
||||||
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;
|
||||||
|
23934
src/main/resources/static/js/materialize.js
vendored
23934
src/main/resources/static/js/materialize.js
vendored
File diff suppressed because it is too large
Load Diff
@ -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 "🔴 LIVE";
|
return "🔴 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)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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,16 +53,13 @@ function disconnected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function navListeners() {
|
function navListeners() {
|
||||||
|
|
||||||
btn_disconnect.click(function () {
|
btn_disconnect.click(function () {
|
||||||
Cookies.remove('token');
|
Cookies.remove('token');
|
||||||
Cookies.remove('name');
|
Cookies.remove('name');
|
||||||
Cookies.remove('guild');
|
Cookies.remove('guild');
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#guild_form').change(function () {
|
$('#guild_form').change(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() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -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 = "/";
|
||||||
}
|
}
|
||||||
|
@ -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 = "/"
|
||||||
|
@ -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});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -58,16 +57,22 @@ $(document).ready(function(){
|
|||||||
type: "POST",
|
type: "POST",
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
url: "/api/settings",
|
url: "/api/settings",
|
||||||
data: JSON.stringify(post_json)
|
data: JSON.stringify(post_json)
|
||||||
|
|
||||||
}).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'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
|
@ -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>
|
||||||
|
<loc>https://claptrapbot.com/</loc>
|
||||||
|
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
||||||
|
<priority>1.00</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>https://claptrapbot.com/music</loc>
|
||||||
|
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
||||||
|
<priority>0.80</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>https://claptrapbot.com/login</loc>
|
||||||
|
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
||||||
|
<priority>0.80</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>https://claptrapbot.com/register</loc>
|
||||||
|
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
||||||
|
<priority>0.64</priority>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
|
||||||
<url>
|
|
||||||
<loc>https://claptrapbot.com/</loc>
|
|
||||||
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
|
||||||
<priority>1.00</priority>
|
|
||||||
</url>
|
|
||||||
<url>
|
|
||||||
<loc>https://claptrapbot.com/music</loc>
|
|
||||||
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
|
||||||
<priority>0.80</priority>
|
|
||||||
</url>
|
|
||||||
<url>
|
|
||||||
<loc>https://claptrapbot.com/login</loc>
|
|
||||||
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
|
||||||
<priority>0.80</priority>
|
|
||||||
</url>
|
|
||||||
<url>
|
|
||||||
<loc>https://claptrapbot.com/register</loc>
|
|
||||||
<lastmod>2018-12-03T15:47:35+00:00</lastmod>
|
|
||||||
<priority>0.64</priority>
|
|
||||||
</url>
|
|
||||||
|
|
||||||
|
|
||||||
</urlset>
|
</urlset>
|
@ -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);
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
@ -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 {
|
||||||
|
@ -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>
|
||||||
|
@ -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 {
|
||||||
|
@ -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>
|
||||||
|
@ -11,52 +11,65 @@
|
|||||||
<!-- 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"
|
||||||
</li>
|
data-target="dropdown_guilds"
|
||||||
<li class="" th:classappend="(${page} == 'home')? 'active' : ''">
|
id="drop-trigger-guilds" style="margin-top: 2px;margin-right: 10px;" th:if="${guild_name != ''}"
|
||||||
<a class="waves-effect waves-light" href="/">Home</a>
|
th:inline="text">[[${guild_name}]]<img class="brand-logo left circle"
|
||||||
</li>
|
id="guildLogo"
|
||||||
<li class="disable" th:classappend="(${page} == 'music')? 'active' : ''">
|
style="max-height: 100%; margin-right: 10px; padding: 2px; padding-left: 0"
|
||||||
<a class="waves-effect waves-light" href="/music">Music Control</a>
|
th:src="${guild_icon}"/></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="disable" th:classappend="(${page} == 'rank')? 'active' : ''">
|
<li class="" th:classappend="(${page} == 'home')? 'active' : ''">
|
||||||
<a class="waves-effect waves-light" href="/rank">Stats</a>
|
<a class="waves-effect waves-light" href="/">Home</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="disable" th:classappend="(${page} == 'music')? 'active' : ''">
|
||||||
|
<a class="waves-effect waves-light" href="/music">Music Control</a>
|
||||||
|
</li>
|
||||||
|
<li class="disable" th:classappend="(${page} == 'rank')? 'active' : ''">
|
||||||
|
<a class="waves-effect waves-light" href="/rank">Stats</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<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
|
||||||
</li>
|
class="material-icons">account_box</i></a>
|
||||||
|
</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>
|
||||||
|
|
||||||
@ -84,11 +102,14 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
@ -231,16 +244,17 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<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"
|
||||||
<td th:text="${stat.messageCount}"></td>
|
th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(2)}"></span> <span>S</span></td>
|
||||||
|
<td th:text="${stat.messageCount}"></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -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);
|
||||||
});
|
});
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user