0

I am trying to set up a Java Telegram bot using the following wrapper.

I have Maven/Java 8 setup on my machine using Visual Code, following this guide.

I used the standard issue Maven quick start archetype and added the telegram bot wrapper dependency to my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.carrein.maya</groupId>
  <artifactId>Maya</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maya</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.telegram</groupId>
      <artifactId>telegrambots</artifactId>
      <version>3.6</version>
    </dependency>
  </dependencies>
</project>

After which i used mvn dependency:resolve.

My class is setup as follows:

package com.carrein.maya;

import org.telegram.*;
import org.telegram.telegrambots.*;


public class Maya extends TelegramLongPollingBot {

  @Override
  public String getBotUsername() {
    return null;
  }

  @Override
  public String getBotToken() {
    return null;
  }

  @Override
  public void onUpdateReceived(final Update update) {
  }

}

However I get the following error on running mvn -B verify:

[19,3] method does not override or implement a method from a supertype.

I not sure how to resolve the following error as I have already imported the package org.telegram.* into my class file.

I assumed that it would work as the generated AppTest.java file has a import junit.framework.Test; declaration on top, which is also a dependency in the pom.xml.

Carrein
  • 3,231
  • 7
  • 36
  • 77

1 Answers1

1

I've checked it and it looks like there's an error in imports. In my case I have this:

import org.telegram.telegrambots.api.objects.Update;
import org.telegram.telegrambots.bots.TelegramLongPollingBot;

So your imports are too short, you can replace them with:

import org.telegram.telegrambots.bots.*
import org.telegram.telegrambots.api.objects.*;
Vicctor
  • 803
  • 6
  • 13