use of discord4j.core.GatewayDiscordClient in project symja_android_library by axkr.
the class SymjaBot method main.
public static void main(String[] args) {
if (args.length > 0) {
Locale.setDefault(Locale.US);
ParserConfig.PARSER_USE_LOWERCASE_SYMBOLS = true;
ToggleFeature.COMPILE = false;
Config.JAVA_UNSAFE = true;
Config.SHORTEN_STRING_LENGTH = 512;
Config.USE_VISJS = true;
Config.FILESYSTEM_ENABLED = false;
Config.FUZZY_PARSER = true;
Config.UNPROTECT_ALLOWED = false;
Config.USE_MANIPULATE_JS = true;
Config.JAS_NO_THREADS = true;
Config.MATHML_TRIG_LOWERCASE = false;
Config.MAX_AST_SIZE = 10000;
Config.MAX_OUTPUT_SIZE = 10000;
Config.MAX_BIT_LENGTH = 200000;
Config.MAX_POLYNOMIAL_DEGREE = 100;
Config.MAX_INPUT_LEAVES = 100L;
Config.MAX_MATRIX_DIMENSION_SIZE = 100;
Config.PRIME_FACTORS = new BigIntegerPrimality();
EvalEngine.get().setPackageMode(true);
String theDiscordToken = args[0];
GatewayDiscordClient client = DiscordClientBuilder.create(theDiscordToken).build().login().block();
client.getEventDispatcher().on(ReadyEvent.class).subscribe(event -> {
LocalDateTime now = LocalDateTime.now();
final User self = event.getSelf();
System.out.println(String.format(TIME_FORMATTER.format(now) + ": Logged in as %s#%s", self.getUsername(), self.getDiscriminator()));
});
client.on(MessageCreateEvent.class).subscribe(event -> {
final Message message = event.getMessage();
if (filterMessage(message)) {
createMessage(message);
}
});
client.onDisconnect().block();
} else {
System.out.println("The discord bot token has to be set as the first argument.");
}
}
Aggregations