Skip to content

Commit

Permalink
Commandapi dependency (DiscordBolt#110)
Browse files Browse the repository at this point in the history
* Move command API to dependency

* Update CommandAPI to version 1.0
  • Loading branch information
Techtony96 authored Dec 15, 2017
1 parent f0c017d commit 487470a
Show file tree
Hide file tree
Showing 37 changed files with 106 additions and 741 deletions.
18 changes: 10 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
<scope>compile</scope>
</dependency>

<!-- DISCORD BOLT DEPENDENCIES -->
<dependency>
<groupId>com.github.DiscordBolt</groupId>
<artifactId>CommandAPI</artifactId>
<version>1.0</version>
</dependency>


<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java-->
<dependency>
<groupId>mysql</groupId>
Expand All @@ -59,14 +67,6 @@
<version>3.2.7.Final</version>
</dependency>

<!-- Used for Commands API -->
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
<scope>compile</scope>
</dependency>

<!-- Used for playing/downloading audio -->
<dependency>
<groupId>com.sedmelluq</groupId>
Expand All @@ -82,11 +82,13 @@
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>RELEASE</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
18 changes: 11 additions & 7 deletions src/main/java/net/ajpappas/discord/Discord.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.ajpappas.discord;

import net.ajpappas.discord.api.commands.CommandModule;
import com.discordbolt.api.command.CommandManager;
import net.ajpappas.discord.api.mysql.MySQL;
import net.ajpappas.discord.api.mysql.data.DataSync;
import net.ajpappas.discord.api.mysql.data.persistent.GuildData;
import net.ajpappas.discord.modules.audiostreamer.AudioStreamer;
import net.ajpappas.discord.modules.dice.DiceModule;
import net.ajpappas.discord.modules.disconnect.DisconnectModule;
import net.ajpappas.discord.modules.help.HelpModule;
import net.ajpappas.discord.modules.log.LogModule;
import net.ajpappas.discord.modules.misc.CuntModule;
import net.ajpappas.discord.modules.misc.TableFixerModule;
Expand All @@ -29,6 +29,8 @@
*/
public class Discord {

private static CommandManager commandManager;

public static void main(String[] args) {
if (args.length < 1) {
Logger.error("No Bot Token specified.");
Expand Down Expand Up @@ -63,7 +65,10 @@ private static void registerModules(IDiscordClient client) {
// API Modules
Logger.trace("Loading API modules.");
client.getDispatcher().registerListener(new DataSync(client));
client.getModuleLoader().loadModule(new CommandModule(client));

commandManager = new CommandManager(client, "net.ajpappas.discord");
client.getGuilds().stream().map(g -> GuildData.getById(g.getLongID())).filter(gd -> gd.isPresent()).filter(gd -> gd.get().getCommandPrefix() != null).forEach(gd -> commandManager.setCommandPrefix(client.getGuildByID(gd.get().getGuildId()), gd.get().getCommandPrefix().charAt(0)));

client.getModuleLoader().loadModule(new LogModule(client));
Logger.trace("Finished loading API modules");

Expand All @@ -80,10 +85,9 @@ private static void registerModules(IDiscordClient client) {
client.getModuleLoader().loadModule(new StreamAnnouncer(client));
client.getModuleLoader().loadModule(new TagModule(client));
Logger.trace("Finished loading feature modules.");
}

// Dependent Modules
Logger.trace("Loading dependent modules.");
client.getModuleLoader().loadModule(new HelpModule(client));
Logger.trace("Finished loading dependent modules.");
public static CommandManager getCommandManager() {
return commandManager;
}
}
41 changes: 0 additions & 41 deletions src/main/java/net/ajpappas/discord/api/commands/BotCommand.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/java/net/ajpappas/discord/api/commands/CommandModule.java

This file was deleted.

Loading

0 comments on commit 487470a

Please sign in to comment.