The ting goes grrrrra #46

Merged
Schlauer-Hax merged 4 commits from hax-dev into master 2019-11-03 16:49:48 +01:00
5 changed files with 95 additions and 16 deletions
Showing only changes of commit cdd52f1430 - Show all commits

View file

@ -11,6 +11,12 @@ after_success:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh success $WEBHOOK_URL
- mvn clean compile assembly:single
- cd target
- sshpass -p $SFTP_PASSWORD scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r Hadder-Build.jar $SFTP_USER@$SFTP_IP:/home/Bots/Hadder-Build.jar
- echo $?
- sshpass -p $SFTP_PASSWORD ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $SFTP_IP /home/Bots/deploy.sh
- echo $?
after_failure:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh

42
pom.xml
View file

@ -19,7 +19,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>LATEST</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
@ -35,22 +35,22 @@
<dependency>
<groupId>com.rethinkdb</groupId>
<artifactId>rethinkdb-driver</artifactId>
<version>LATEST</version>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>LATEST</version>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<version>1.7.29</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
<version>1.7.29</version>
</dependency>
</dependencies>
@ -71,21 +71,26 @@
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.1.2</version>
<configuration>
<finalName>Hadder-Build</finalName>
<archive>
<manifest>
<mainClass>com.bbn.hadder.Hadder</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
@ -98,7 +103,7 @@
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<version>3.8.2</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
@ -123,6 +128,21 @@
<target>12</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>Hadder-Build</finalName>
<archive>
<manifest>
<mainClass>com.bbn.hadder.Hadder</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -4,6 +4,7 @@ import com.bbn.hadder.commands.general.*;
import com.bbn.hadder.commands.fun.GifCommand;
import com.bbn.hadder.commands.misc.GitHubCommand;
import com.bbn.hadder.commands.moderation.*;
import com.bbn.hadder.commands.owner.RebootCommand;
import com.bbn.hadder.commands.owner.ShutdownCommand;
import com.bbn.hadder.commands.owner.TestCommand;
import com.bbn.hadder.commands.settings.PrefixCommand;
@ -24,7 +25,10 @@ import java.util.List;
public class Hadder {
public static void main(String[] args) {
startBot();
}
public static void startBot() {
File configfile = new File("./config.json");
if (!configfile.exists()) {
System.err.println("No Config File Found!");
@ -43,12 +47,12 @@ public class Hadder {
DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder();
builder.setShardsTotal(1);
builder.setActivity(Activity.streaming("auf dem BigBotNetwork", "https://twitch.tv/BigBotNetwork"));
builder.setActivity(Activity.streaming("on the BigBotNetwork", "https://twitch.tv/BigBotNetwork"));
builder.setToken(config.getString("Token"));
CommandHandler.cmdlist.addAll(List.of(new HelpCommand(), new TestCommand(), new BanCommand(), new PrefixCommand(), new ShutdownCommand(), new KickCommand(), new PingCommand(), new GifCommand(), new ClearCommand(), new GitHubCommand()));
CommandHandler.cmdlist.addAll(List.of(new HelpCommand(), new TestCommand(), new BanCommand(), new PrefixCommand(), new ShutdownCommand(), new KickCommand(), new PingCommand(), new GifCommand(), new ClearCommand(), new GitHubCommand(), new RebootCommand()));
builder.addEventListeners(
new MentionListener(),
new PrivateMessageListener(),
@ -61,7 +65,5 @@ public class Hadder {
} catch (LoginException e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,44 @@
package com.bbn.hadder.commands.owner;
/*
* @author Skidder / GregTCLTK
*/
import com.bbn.hadder.Rethink;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.util.Timer;
import java.util.TimerTask;
import static com.bbn.hadder.Hadder.startBot;
public class RebootCommand implements Command {
@Override
public void executed(String[] args, MessageReceivedEvent event) {
if (event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")) {
} else {
EmbedBuilder builder = new EmbedBuilder();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_PERMISSION, builder).build()).queue();
}
}
@Override
public String[] labels() {
return new String[]{"restart"};
}
@Override
public String description() {
return "Restart the bot";
}
@Override
public String usage() {
return labels()[0];
}
}

View file

@ -7,6 +7,7 @@ package com.bbn.hadder.listener;
import com.bbn.hadder.Rethink;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
import net.dv8tion.jda.api.events.guild.GuildLeaveEvent;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
@ -17,6 +18,12 @@ import java.time.Instant;
public class GuildListener extends ListenerAdapter {
public void onGuildJoin(GuildJoinEvent event) {
for (User user : event.getJDA().getUsers()) {
if (!user.getId().equals(event.getJDA().getSelfUser().getId())) {
Rethink.insertUser(user.getId());
}
}
Rethink.insertServer(event.getGuild().getId());
EmbedBuilder builder = new EmbedBuilder();
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)