Search in sources :

Example 1 with CommandFramework

use of io.github.jdiscordbots.command_framework.CommandFramework in project Me-e--bypasser by JDiscordBots.

the class MeeBypasser method main.

public static void main(String[] args) {
    File tokenFile = new File(".token");
    if (tokenFile.exists()) {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(tokenFile), StandardCharsets.UTF_8))) {
            final DefaultShardManagerBuilder builder = DefaultShardManagerBuilder.createLight(reader.readLine(), GatewayIntent.getIntents(GatewayIntent.DEFAULT)).setAutoReconnect(true).setStatus(OnlineStatus.ONLINE).setActivity(Activity.watching("https://github.com/JDiscordBots/Mee6-bypasser")).setRequestTimeoutRetry(true);
            MessageAction.setDefaultMentions(Collections.emptySet());
            CommandFramework framework = new CommandFramework();
            framework.setSlashCommandsPerGuild(true);
            framework.setPrefix("mb!");
            builder.addEventListeners(framework.build(), new MsgListener());
            ShardManager manager = builder.build();
            for (JDA jda : manager.getShards()) {
                jda.awaitReady();
            }
        } catch (LoginException | IOException e) {
            LOG.error("Cannot initialize bot", e);
        } catch (InterruptedException e) {
            LOG.warn("The main thread was interruped while waiting for a shard to connect initially", e);
            Thread.currentThread().interrupt();
        }
    } else {
        try {
            Files.createFile(tokenFile.toPath());
        } catch (IOException e) {
            LOG.error("Cannot create token file.", e);
        }
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) JDA(net.dv8tion.jda.api.JDA) ShardManager(net.dv8tion.jda.api.sharding.ShardManager) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) DefaultShardManagerBuilder(net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder) BufferedReader(java.io.BufferedReader) LoginException(javax.security.auth.login.LoginException) File(java.io.File) CommandFramework(io.github.jdiscordbots.command_framework.CommandFramework)

Aggregations

CommandFramework (io.github.jdiscordbots.command_framework.CommandFramework)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 LoginException (javax.security.auth.login.LoginException)1 JDA (net.dv8tion.jda.api.JDA)1 DefaultShardManagerBuilder (net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder)1 ShardManager (net.dv8tion.jda.api.sharding.ShardManager)1