@ -8,15 +8,29 @@ import discord4j.core.object.entity.Member;
import discord4j.core.object.entity.channel.PrivateChannel ;
import discord4j.core.spec.InteractionApplicationCommandCallbackReplyMono ;
import org.springframework.stereotype.Service ;
import zoltan.vari.spotify_mixer_discord_bot.config.DiscordBotConstants ;
@Service
public class DiscordCommandService {
public InteractionApplicationCommandCallbackReplyMono processCommand ( GatewayDiscordClient gw , DiscordClient client , ApplicationCommandInteractionEvent event ) {
PrivateChannel userChannel = event . getInteraction ( ) . getUser ( ) . getPrivateChannel ( ) . block ( ) ;
switch ( event . getCommandName ( ) ) {
case DiscordBotConstants . CREATE_SESSION_COMMAND - > {
return createSession ( gw , client , event ) ;
}
default - > {
PrivateChannel userChannel = event . getInteraction ( ) . getUser ( ) . getPrivateChannel ( ) . block ( ) ;
client . getChannelById ( userChannel . getId ( ) ) . createMessage ( "test" ) . block ( ) ;
return event . reply ( event . toString ( ) ) ;
}
}
}
client . getChannelById ( userChannel . getId ( ) ) . createMessage ( "test" ) . block ( ) ;
private InteractionApplicationCommandCallbackReplyMono createSession ( GatewayDiscordClient gw , DiscordClient client , ApplicationCommandInteractionEvent event ) {
PrivateChannel userChannel = event . getInteraction ( ) . getUser ( ) . getPrivateChannel ( ) . block ( ) ;
client . getChannelById ( userChannel . getId ( ) ) . createMessage ( "create session result" ) . block ( ) ;
return event . reply ( event . toString ( ) ) ;
}