-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Softawii/feature/metrics
feat: metrics (prometheus + micrometer)
- Loading branch information
Showing
25 changed files
with
515 additions
and
326 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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/softawii/capivara/controller/SocialBlueskyController.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,39 @@ | ||
package com.softawii.capivara.controller; | ||
|
||
import com.softawii.capivara.exceptions.MissingPermissionsException; | ||
import com.softawii.capivara.services.SocialParserConfigService; | ||
import com.softawii.curupira.v2.annotations.DiscordController; | ||
import com.softawii.curupira.v2.annotations.RequestInfo; | ||
import com.softawii.curupira.v2.annotations.commands.DiscordCommand; | ||
import com.softawii.curupira.v2.annotations.interactions.DiscordButton; | ||
import com.softawii.curupira.v2.api.TextLocaleResponse; | ||
import net.dv8tion.jda.api.Permission; | ||
import net.dv8tion.jda.api.entities.Guild; | ||
import net.dv8tion.jda.api.entities.Member; | ||
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion; | ||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; | ||
import net.dv8tion.jda.api.interactions.DiscordLocale; | ||
import net.dv8tion.jda.api.interactions.components.buttons.Button; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@DiscordController(parent = "social", value = "bsky", description = "Bluesky Controller", permissions = Permission.ADMINISTRATOR, resource = "social", locales = DiscordLocale.PORTUGUESE_BRAZILIAN) | ||
public class SocialBlueskyController { | ||
private final SocialParserConfigService service; | ||
|
||
public SocialBlueskyController(SocialParserConfigService service) { | ||
this.service = service; | ||
} | ||
|
||
@DiscordCommand(name = "enable", description = "Enable the automatic Bluesky link transformation service") | ||
public TextLocaleResponse enable(Guild guild) { | ||
this.service.changeBluesky(guild.getIdLong(), true); | ||
return new TextLocaleResponse("social.bluesky.enable.response", guild.getName()); | ||
} | ||
|
||
@DiscordCommand(name = "disable", description = "Disable the automatic Bluesky link transformation service") | ||
public TextLocaleResponse disable(Guild guild) { | ||
this.service.changeBluesky(guild.getIdLong(), false); | ||
return new TextLocaleResponse("social.bluesky.disable.response", guild.getName()); | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
src/main/java/com/softawii/capivara/controller/SocialGenericController.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,41 @@ | ||
package com.softawii.capivara.controller; | ||
|
||
import com.softawii.capivara.exceptions.MissingPermissionsException; | ||
import com.softawii.curupira.v2.annotations.DiscordController; | ||
import com.softawii.curupira.v2.annotations.RequestInfo; | ||
import com.softawii.curupira.v2.annotations.interactions.DiscordButton; | ||
import com.softawii.curupira.v2.api.TextLocaleResponse; | ||
import net.dv8tion.jda.api.Permission; | ||
import net.dv8tion.jda.api.entities.Member; | ||
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion; | ||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; | ||
import net.dv8tion.jda.api.interactions.DiscordLocale; | ||
import net.dv8tion.jda.api.interactions.components.buttons.Button; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@DiscordController(parent = "social", value = "generic", description = "Social Generic Controller", permissions = Permission.ADMINISTRATOR, resource = "social", locales = DiscordLocale.PORTUGUESE_BRAZILIAN) | ||
public class SocialGenericController { | ||
public static final String deleteBotMessage = "social-bot-message-delete"; | ||
|
||
public static Button generateDeleteButton(long authorId) { | ||
return Button.danger(String.format("%s:%s", deleteBotMessage, authorId), "Delete"); | ||
} | ||
|
||
@DiscordButton(name = deleteBotMessage, ephemeral = true) | ||
public TextLocaleResponse delete(ButtonInteractionEvent event, @RequestInfo Member member) throws MissingPermissionsException { | ||
// Format: ButtonID:Owner | ||
String ownerId = event.getComponentId().split(":")[1]; | ||
String messageOwner = member.getId(); | ||
|
||
MessageChannelUnion channel = event.getChannel(); | ||
|
||
if (!messageOwner.equals(ownerId)) { | ||
throw new MissingPermissionsException(); | ||
} | ||
|
||
channel.deleteMessageById(event.getMessageId()).queue(); | ||
|
||
return new TextLocaleResponse("social.delete.response"); | ||
} | ||
} |
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
132 changes: 0 additions & 132 deletions
132
src/main/java/com/softawii/capivara/core/EmbedManager.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.