-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn all components into autoconfigurations.
- Loading branch information
Showing
6 changed files
with
98 additions
and
18 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package stelitop.mad4j; | ||
|
||
import discord4j.core.GatewayDiscordClient; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.env.Environment; | ||
import stelitop.mad4j.listeners.CommandOptionAutocompleteListener; | ||
|
||
@Configuration | ||
public class Mad4jAutoConfiguration { | ||
|
||
@Bean | ||
public SlashCommandRegistrar slashCommandRegistrar( | ||
GatewayDiscordClient gatewayDiscordClient, | ||
CommandOptionAutocompleteListener commandOptionAutocompleteListener, | ||
ApplicationContext applicationContext, | ||
Environment environment | ||
) { | ||
return new SlashCommandRegistrar( | ||
gatewayDiscordClient, | ||
commandOptionAutocompleteListener, | ||
applicationContext, | ||
environment | ||
); | ||
} | ||
} |
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
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
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
43 changes: 43 additions & 0 deletions
43
src/main/java/stelitop/mad4j/listeners/Mad4jListenersAutoConfiguration.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,43 @@ | ||
package stelitop.mad4j.listeners; | ||
|
||
import discord4j.core.GatewayDiscordClient; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import stelitop.mad4j.autocomplete.AutocompletionExecutor; | ||
import stelitop.mad4j.requirements.CommandRequirementExecutor; | ||
|
||
import java.util.List; | ||
|
||
@Configuration | ||
public class Mad4jListenersAutoConfiguration { | ||
|
||
@Bean | ||
public SlashCommandListener slashCommandListener( | ||
ApplicationContext applicationContext, | ||
GatewayDiscordClient client, | ||
List<CommandRequirementExecutor> possibleRequirements | ||
) { | ||
return new SlashCommandListener( | ||
applicationContext, | ||
client, | ||
possibleRequirements | ||
); | ||
} | ||
|
||
@Bean | ||
public CommandOptionAutocompleteListener commandOptionAutocompleteListener( | ||
GatewayDiscordClient client, | ||
List<AutocompletionExecutor> autocompletionExecutors | ||
) { | ||
return new CommandOptionAutocompleteListener(client, autocompletionExecutors); | ||
} | ||
|
||
@Bean | ||
public ComponentEventListener componentEventListener( | ||
GatewayDiscordClient client, | ||
ApplicationContext applicationContext | ||
) { | ||
return new ComponentEventListener(client, applicationContext); | ||
} | ||
} |
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