Hello. Help me please find out my error and fix it. Im using spring boot, gradle.
SendMessageService.Java
package org.xpremiumbot.services; import org.springframework.stereotype.Service; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; import org.telegram.telegrambots.meta.api.objects.Message; import org.xpremiumbot.messagesender.MessageSender; @Service public class SendMessageService { private final MessageSender messageSender; public SendMessageService(MessageSender messageSender) { this.messageSender = messageSender; } public void test(Message message) { var msg = SendMessage.builder() .text("<b>Bold</b> " + "<i>italic</i> " + "<code>mono</code> " + "<a href=\"google.com\">Google<a/>") .parseMode("HTML") .chatId(String.valueOf(message.getChatId())) .build(); messageSender.sendMessage(msg); } }
TelegrambotApplication.java
package org.xpremiumbot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class TelegrambotApplication { public static void main(String[] args) { SpringApplication.run(TelegrambotApplication.class, args); } }
Main file (xBot.java)
package org.xpremiumbot; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Update; import org.xpremiumbot.services.SendMessageService; @Component public class xBot extends TelegramLongPollingBot { @Value("${telegram.bot.username}") private String username; @Value("${telegram.bot.token}") private String token; @Override public String getBotUsername() { return username; } @Override public String getBotToken() { return token; } private SendMessageService sendMessageService; @Override public void onUpdateReceived(Update update) { if (update.hasMessage()) { Message message = update.getMessage(); if (message.hasText()) { sendMessageService.test(message); } } } @Autowired public SendMessageService getSendMessageService() { return sendMessageService; } }
And got this error:
Execution failed for task ':TelegrambotApplication.main()'.
> Process 'command 'C:/Users/Jexly/.jdks/openjdk-17.0.1/bin/java.exe'' finished with non-zero exit value 1
I searched the Internet for an error, everything that is written there did not help me. I don’t understand what exactly is my problem, the code is written perfectly
--- Update ---
If you need any more files, or a description of what each line does, please contact me, I need to fix this error