mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-02 23:57:22 +00:00
[AB-xxx] upgrading to newer JDA version
This commit is contained in:
@@ -14,7 +14,7 @@ An example implementation of this bot can be seen [here](https://github.com/Shel
|
|||||||
|
|
||||||
|
|
||||||
## Technologies
|
## Technologies
|
||||||
* [JDA](https://github.com/DV8FromTheWorld/JDA/) The Discord API Wrapper in the version 4.2.1_262
|
* [JDA](https://github.com/DV8FromTheWorld/JDA/) The Discord API Wrapper in the version 4.3.0_284
|
||||||
* [Spring boot](https://github.com/spring-projects/spring-boot) is used as a framework to create standalone application in Java with Java EE methods. (including Dependency injection and more)
|
* [Spring boot](https://github.com/spring-projects/spring-boot) is used as a framework to create standalone application in Java with Java EE methods. (including Dependency injection and more)
|
||||||
* [Hibernate](https://github.com/hibernate/hibernate-orm) is used as a reference implementation of JPA.
|
* [Hibernate](https://github.com/hibernate/hibernate-orm) is used as a reference implementation of JPA.
|
||||||
* [Freemarker](https://github.com/apache/freemarker) is used as a templating engine. This is used to provide internationalization for user facing text and enable dynamic embed configuration.
|
* [Freemarker](https://github.com/apache/freemarker) is used as a templating engine. This is used to provide internationalization for user facing text and enable dynamic embed configuration.
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class ChannelServiceBean implements ChannelService {
|
|||||||
@Override
|
@Override
|
||||||
public MessageAction sendEmbedToChannelInComplete(MessageEmbed embed, MessageChannel channel) {
|
public MessageAction sendEmbedToChannelInComplete(MessageEmbed embed, MessageChannel channel) {
|
||||||
metricService.incrementCounter(MESSAGE_SEND_METRIC);
|
metricService.incrementCounter(MESSAGE_SEND_METRIC);
|
||||||
return channel.sendMessage(embed).allowedMentions(getAllowedMentionsFor(channel, null));
|
return channel.sendMessageEmbeds(embed).allowedMentions(getAllowedMentionsFor(channel, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -218,7 +218,7 @@ public class ChannelServiceBean implements ChannelService {
|
|||||||
metricService.incrementCounter(MESSAGE_SEND_METRIC);
|
metricService.incrementCounter(MESSAGE_SEND_METRIC);
|
||||||
String text = messageToSend.getMessages().get(i);
|
String text = messageToSend.getMessages().get(i);
|
||||||
MessageEmbed embed = messageToSend.getEmbeds().get(i);
|
MessageEmbed embed = messageToSend.getEmbeds().get(i);
|
||||||
MessageAction messageAction = textChannel.sendMessage(text).embed(embed);
|
MessageAction messageAction = textChannel.sendMessage(text).setEmbeds(embed);
|
||||||
allMessageActions.add(messageAction);
|
allMessageActions.add(messageAction);
|
||||||
}
|
}
|
||||||
// one of these loops will get additional iterations, if the number is different, not both
|
// one of these loops will get additional iterations, if the number is different, not both
|
||||||
@@ -231,7 +231,7 @@ public class ChannelServiceBean implements ChannelService {
|
|||||||
for (int i = iterations; i < messageToSend.getEmbeds().size(); i++) {
|
for (int i = iterations; i < messageToSend.getEmbeds().size(); i++) {
|
||||||
metricService.incrementCounter(MESSAGE_SEND_METRIC);
|
metricService.incrementCounter(MESSAGE_SEND_METRIC);
|
||||||
MessageEmbed embed = messageToSend.getEmbeds().get(i);
|
MessageEmbed embed = messageToSend.getEmbeds().get(i);
|
||||||
MessageAction messageAction = textChannel.sendMessage(embed);
|
MessageAction messageAction = textChannel.sendMessageEmbeds(embed);
|
||||||
allMessageActions.add(messageAction);
|
allMessageActions.add(messageAction);
|
||||||
}
|
}
|
||||||
if(messageToSend.hasFileToSend()) {
|
if(messageToSend.hasFileToSend()) {
|
||||||
@@ -280,12 +280,12 @@ public class ChannelServiceBean implements ChannelService {
|
|||||||
messageAction = channel.editMessageById(messageId, messageToSend.getMessages().get(0));
|
messageAction = channel.editMessageById(messageId, messageToSend.getMessages().get(0));
|
||||||
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
|
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
|
||||||
log.debug("Also editing the embed for message {}.", messageId);
|
log.debug("Also editing the embed for message {}.", messageId);
|
||||||
messageAction = messageAction.embed(messageToSend.getEmbeds().get(0));
|
messageAction = messageAction.setEmbeds(messageToSend.getEmbeds().get(0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.debug("Editing message {} with new embeds.", messageId);
|
log.debug("Editing message {} with new embeds.", messageId);
|
||||||
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
|
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
|
||||||
messageAction = channel.editMessageById(messageId, messageToSend.getEmbeds().get(0));
|
messageAction = channel.editMessageEmbedsById(messageId, messageToSend.getEmbeds().get(0));
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Message to send did not contain anything to send.");
|
throw new IllegalArgumentException("Message to send did not contain anything to send.");
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ public class ChannelServiceBean implements ChannelService {
|
|||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Message> editEmbedMessageInAChannel(MessageEmbed embedToSend, MessageChannel channel, Long messageId) {
|
public CompletableFuture<Message> editEmbedMessageInAChannel(MessageEmbed embedToSend, MessageChannel channel, Long messageId) {
|
||||||
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
||||||
return channel.editMessageById(messageId, embedToSend).submit();
|
return channel.editMessageEmbedsById(messageId, embedToSend).submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -312,7 +312,7 @@ public class ChannelServiceBean implements ChannelService {
|
|||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Message> editTextMessageInAChannel(String text, MessageEmbed messageEmbed, MessageChannel channel, Long messageId) {
|
public CompletableFuture<Message> editTextMessageInAChannel(String text, MessageEmbed messageEmbed, MessageChannel channel, Long messageId) {
|
||||||
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
||||||
return channel.editMessageById(messageId, text).embed(messageEmbed).submit();
|
return channel.editMessageById(messageId, text).setEmbeds(messageEmbed).submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -208,13 +208,13 @@ public class MessageServiceBean implements MessageService {
|
|||||||
@Override
|
@Override
|
||||||
public MessageAction editMessage(Message message, MessageEmbed messageEmbed) {
|
public MessageAction editMessage(Message message, MessageEmbed messageEmbed) {
|
||||||
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
||||||
return message.editMessage(messageEmbed);
|
return message.editMessageEmbeds(messageEmbed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessageAction editMessage(Message message, String text, MessageEmbed messageEmbed) {
|
public MessageAction editMessage(Message message, String text, MessageEmbed messageEmbed) {
|
||||||
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
||||||
return message.editMessage(text).embed(messageEmbed);
|
return message.editMessage(text).setEmbeds(messageEmbed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.build.timestamp.format>yyyy/MM/dd HH:mm</maven.build.timestamp.format>
|
<maven.build.timestamp.format>yyyy/MM/dd HH:mm</maven.build.timestamp.format>
|
||||||
<jda.version>4.2.1_262</jda.version>
|
<jda.version>4.3.0_284</jda.version>
|
||||||
<jda.utilities.version>3.0.4</jda.utilities.version>
|
<jda.utilities.version>3.0.4</jda.utilities.version>
|
||||||
<asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
|
<asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
|
||||||
<asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version>
|
<asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version>
|
||||||
|
|||||||
Reference in New Issue
Block a user