[AB-xxx] upgrading to newer JDA version

This commit is contained in:
Sheldan
2021-06-27 22:47:10 +02:00
parent 67121b318d
commit bbc5918d88
4 changed files with 11 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ An example implementation of this bot can be seen [here](https://github.com/Shel
## 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)
* [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.

View File

@@ -180,7 +180,7 @@ public class ChannelServiceBean implements ChannelService {
@Override
public MessageAction sendEmbedToChannelInComplete(MessageEmbed embed, MessageChannel channel) {
metricService.incrementCounter(MESSAGE_SEND_METRIC);
return channel.sendMessage(embed).allowedMentions(getAllowedMentionsFor(channel, null));
return channel.sendMessageEmbeds(embed).allowedMentions(getAllowedMentionsFor(channel, null));
}
@Override
@@ -218,7 +218,7 @@ public class ChannelServiceBean implements ChannelService {
metricService.incrementCounter(MESSAGE_SEND_METRIC);
String text = messageToSend.getMessages().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);
}
// 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++) {
metricService.incrementCounter(MESSAGE_SEND_METRIC);
MessageEmbed embed = messageToSend.getEmbeds().get(i);
MessageAction messageAction = textChannel.sendMessage(embed);
MessageAction messageAction = textChannel.sendMessageEmbeds(embed);
allMessageActions.add(messageAction);
}
if(messageToSend.hasFileToSend()) {
@@ -280,12 +280,12 @@ public class ChannelServiceBean implements ChannelService {
messageAction = channel.editMessageById(messageId, messageToSend.getMessages().get(0));
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
log.debug("Also editing the embed for message {}.", messageId);
messageAction = messageAction.embed(messageToSend.getEmbeds().get(0));
messageAction = messageAction.setEmbeds(messageToSend.getEmbeds().get(0));
}
} else {
log.debug("Editing message {} with new embeds.", messageId);
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
messageAction = channel.editMessageById(messageId, messageToSend.getEmbeds().get(0));
messageAction = channel.editMessageEmbedsById(messageId, messageToSend.getEmbeds().get(0));
} else {
throw new IllegalArgumentException("Message to send did not contain anything to send.");
}
@@ -300,7 +300,7 @@ public class ChannelServiceBean implements ChannelService {
@Override
public CompletableFuture<Message> editEmbedMessageInAChannel(MessageEmbed embedToSend, MessageChannel channel, Long messageId) {
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
return channel.editMessageById(messageId, embedToSend).submit();
return channel.editMessageEmbedsById(messageId, embedToSend).submit();
}
@Override
@@ -312,7 +312,7 @@ public class ChannelServiceBean implements ChannelService {
@Override
public CompletableFuture<Message> editTextMessageInAChannel(String text, MessageEmbed messageEmbed, MessageChannel channel, Long messageId) {
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
return channel.editMessageById(messageId, text).embed(messageEmbed).submit();
return channel.editMessageById(messageId, text).setEmbeds(messageEmbed).submit();
}
@Override

View File

@@ -208,13 +208,13 @@ public class MessageServiceBean implements MessageService {
@Override
public MessageAction editMessage(Message message, MessageEmbed messageEmbed) {
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
return message.editMessage(messageEmbed);
return message.editMessageEmbeds(messageEmbed);
}
@Override
public MessageAction editMessage(Message message, String text, MessageEmbed messageEmbed) {
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
return message.editMessage(text).embed(messageEmbed);
return message.editMessage(text).setEmbeds(messageEmbed);
}
@Override

View File

@@ -57,7 +57,7 @@
<properties>
<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>
<asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version>