Giter Site home page Giter Site logo

tharun634 / javabot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from java-discord/javabot

0.0 1.0 0.0 3.49 MB

General utility bot for the JavaDiscord Community

Home Page: https://javadiscord.net

License: GNU General Public License v3.0

Java 99.60% Kotlin 0.40%

javabot's Introduction

JavaBot โ€” General Utility Bot for the JavaDiscord Community

Banner

Usage

To start up, run the bot once, and it will generate a config directory. Stop the bot, and set the up all of the following values:

  • in systems.json
    • jdaBotToken to your bot's token
    • (some adminUsers which, e.g., can manipulate the database)
  • in {guildId}.json
    • moderation.logChannelId to a channelId
    • moderation.staffRoleId to a roleId
    • moderation.adminRoleId to a roleId
    • jam.adminRoleId to a roleId

Note that this is just what is required for the bot to start. Certain features may require other values to be set.

Configuration

The bot's configuration consists of a collection of simple JSON files:

  • systems.json contains global settings for the bot's core systems.
  • For every guild, a {guildId}.json file exists, which contains any guild-specific configuration settings.

At startup, the bot will initially start by loading just the global settings, and then when the Discord ready event is received, the bot will add configuration for each guild it's in, loading it from the matching JSON file, or creating a new file if needed.

Commands

We're using DIH4JDA as our Command/Interaction framework, which makes it quite easy to add new commands.

PingCommand.java

/**
 * <h3>This class represents the /ping command.</h3>
 */
public class PingCommand extends SlashCommand {
	/**
	 * The constructor of this class, which sets the corresponding {@link net.dv8tion.jda.api.interactions.commands.build.SlashCommandData}.
	 */
	public PingCommand() {
		setSlashCommandData(Commands.slash("ping", "Shows the bot's gateway ping.")
				.setGuildOnly(true)
		);
	}

	@Override
	public void execute(@NotNull SlashCommandInteractionEvent event) {
		event.replyEmbeds(new EmbedBuilder()
				.setAuthor(event.getJDA().getGatewayPing() + "ms", null, event.getJDA().getSelfUser().getAvatarUrl())
				.setColor(Responses.Type.DEFAULT.getColor())
				.build()
		).queue();
	}
}

For more information on how this works, visit the DIH4JDA Wiki!

API Documentation

GET guilds/{guild_id}/metrics

  • Responds with guild-specific metrics, such as the member- and (approximate) online count.

GET guilds/{guild_id}/users/{user_id}

  • Responds with the specified users' profile which includes some basic info, such as the users' name and avatar url, but also their recent warns, their current help experience and more!

GET guilds/{guild_id}/leaderboard/qotw?page=1

  • A paginated endpoint which responds with an ordered list of users, based on their QOTW points.

GET guilds/{guild_id}/leaderboard/experience?page=1

  • A paginated endpoint which responds with an ordered list of users, based on their help channel experience.

You can try out the API yourself on api.javadiscord.net!

Credits

Inspiration we took from other communities:

javabot's People

Contributors

jasonlessenich avatar andrewlalis avatar moontm-git avatar sahilasopa avatar danthe1st avatar discorddioxin avatar developercallum avatar loadingbg avatar kemikals avatar liquiddevelopmentnet avatar cbrt-x avatar tharun634 avatar denuxplays avatar maeves2 avatar that-guy977 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.