Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
.classpath | ||
.settings/ | ||
target/ | ||
bot.properties | ||
*.rb | ||
*Example* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,52 @@ | ||
package pw.chew.Chewbotcca; | ||
|
||
import com.jagrosh.jdautilities.command.CommandClientBuilder; | ||
import com.jagrosh.jdautilities.commons.waiter.EventWaiter; | ||
import net.dv8tion.jda.api.JDABuilder; | ||
import net.dv8tion.jda.api.OnlineStatus; | ||
import net.dv8tion.jda.api.entities.Activity; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import pw.chew.Chewbotcca.commands.about.HelpCommand; | ||
|
||
import javax.security.auth.login.LoginException; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.util.Properties; | ||
|
||
public class Main { | ||
private static final Logger logger = LoggerFactory.getLogger(Main.class); | ||
static Properties prop = new Properties(); | ||
|
||
public static void main(String[] args) throws LoginException, IOException { | ||
prop.load(new FileInputStream("bot.properties")); | ||
|
||
EventWaiter waiter = new EventWaiter(); | ||
|
||
CommandClientBuilder client = new CommandClientBuilder(); | ||
|
||
client.useDefaultGame(); | ||
client.setOwnerId(prop.getProperty("owner_id")); | ||
|
||
// Set your bot's prefix | ||
logger.info("Setting Prefix to " + prop.getProperty("prefix")); | ||
client.setPrefix(prop.getProperty("prefix")); | ||
|
||
client.useHelpBuilder(false); | ||
|
||
// Register commands | ||
client.addCommands( | ||
new HelpCommand() | ||
); | ||
|
||
// Register listeners | ||
|
||
// Register JDA | ||
JDABuilder.createDefault(prop.getProperty("token")) | ||
.setStatus(OnlineStatus.ONLINE) | ||
.setActivity(Activity.playing("Booting...")) | ||
.addEventListeners(waiter, client.build()) | ||
.build(); | ||
|
||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/pw/chew/Chewbotcca/commands/about/HelpCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package pw.chew.Chewbotcca.commands.about; | ||
|
||
import com.jagrosh.jdautilities.command.Command; | ||
import com.jagrosh.jdautilities.command.CommandEvent; | ||
import net.dv8tion.jda.api.EmbedBuilder; | ||
import net.dv8tion.jda.api.Permission; | ||
|
||
public class HelpCommand extends Command { | ||
public HelpCommand() { | ||
this.name = "help"; | ||
this.help = "Get Help with the bot"; | ||
this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; | ||
this.guildOnly = false; | ||
} | ||
|
||
@Override | ||
protected void execute(CommandEvent commandEvent) { | ||
commandEvent.reply(new EmbedBuilder() | ||
.setTitle("Welcome to the Chewbotcca Discord Bot") | ||
.setColor(0xd084) | ||
.setDescription("Chewbotcca is a multi-purpose, semi-functional, almost always online, discord bot!") | ||
.addField("Commands", "You can find all my commands [here](http://discord.chewbotcca.co/commands)", true) | ||
.addField("Invite me!", "You can invite me to your server with [this link](http://bit.ly/Chewbotcca).", true) | ||
.addField("Help Server", "Click [me](https://discord.gg/Q8TazNz) to join the help server.", true) | ||
.addField("More Bot Stats", "Run `%^stats` to see more stats!", true) | ||
.build()); | ||
} | ||
} |