W-Larsen / reputation-telegram-bot

2 stars 1 forks source link

Couldn't start the bot #18

Closed alsoGAMER closed 3 years ago

alsoGAMER commented 4 years ago

Every time I try to start the bot I receive this warning in the console, and then the bot crashes. How can I fix this?

2020-09-02 18:09:20.887  WARN 204558 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduledAppPingService' defined in file [/home/src/reputation-telegram-bot/build/classes/java/main/com/telegram/drb/service/ping/ScheduledAppPingService.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Encountered invalid @Scheduled method 'pingBot': Cron expression must consist of 6 fields (found 1 in "/reputation/update")
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduledAppPingService' defined in file [/home/src/reputation-telegram-bot/build/classes/java/main/com/telegram/drb/service/ping/ScheduledAppPingService.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Encountered invalid @Scheduled method 'pingBot': Cron expression must consist of 6 fields (found 1 in "/reputation/update")
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
    at com.telegram.drb.DawgReputationBotInit.main(DawgReputationBotInit.java:22) ~[main/:na]
Caused by: java.lang.IllegalStateException: Encountered invalid @Scheduled method 'pingBot': Cron expression must consist of 6 fields (found 1 in "/reputation/update")
    at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.processScheduled(ScheduledAnnotationBeanPostProcessor.java:499) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.lambda$null$1(ScheduledAnnotationBeanPostProcessor.java:362) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
    at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.lambda$postProcessAfterInitialization$2(ScheduledAnnotationBeanPostProcessor.java:362) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:na]
    at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(ScheduledAnnotationBeanPostProcessor.java:361) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    ... 15 common frames omitted
W-Larsen commented 4 years ago

Hello. As you can see from stacktrace there is the problem with spring cron expression. In this question on stackoverflow you can find the right format of spring cron expressions.

For example0 0/10 * * * * - this expression equals every 10 min.

P.S. Basically, if you want to use this bot for the personal needs and you don't want to deploy it to free version of heroku you can just delete this service. It was added as a workaround because on free version of heroku application it goes to sleep after half an hour of inactivity, so I decided to ping myself every 20 minutes.

alsoGAMER commented 4 years ago

Hello. As you can see from stacktrace there is the problem with spring cron expression. In this question on stackoverflow you can find the right format of spring cron expressions.

For example0 0/10 * * * * - this expression equals every 10 min.

Oh ok, thanks!

P.S. Basically, if you want to use this bot for the personal needs and you don't want to deploy it to free version of heroku you can just delete this service. It was added as a workaround because on free version of heroku application it goes to sleep after half an hour of inactivity, so I decided to ping myself every 20 minutes.

I'll host this on my own vps, but i don't know what to delete from the sourcecode.

W-Larsen commented 4 years ago

I'll host this on my own vps, but i don't know what to delete from the sourcecode.

service.ping package is responsible for pinging.

alsoGAMER commented 4 years ago

image This one?

W-Larsen commented 4 years ago

Yes. But if first you can just try to add cron expression to your environment variables.

alsoGAMER commented 4 years ago

Yes. But if first you can just try to add cron expression to your environment variables.

Is working now, I've just added "0 0/10 " to dawg.ping.scheduled.cron in the application.properties file (like i did with the other options)

alsoGAMER commented 4 years ago

Oh there is a new error now:

2020-09-02 21:25:19.300 ERROR 220778 --- [legram Executor] o.t.t.u.DefaultBotSession                : URI is not absolute

java.lang.IllegalArgumentException: URI is not absolute
    at java.base/java.net.URL.fromURI(URL.java:692) ~[na:na]
    at java.base/java.net.URI.toURL(URI.java:1116) ~[na:na]
    at org.springframework.http.client.SimpleClientHttpRequestFactory.createRequest(SimpleClientHttpRequestFactory.java:145) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.http.client.support.HttpAccessor.createRequest(HttpAccessor.java:124) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:738) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:677) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:345) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at com.telegram.drb.client.DawgReputationBotClient.ping(DawgReputationBotClient.java:30) ~[main/:na]
    at com.telegram.drb.command.HealthCheckCommand.execute(HealthCheckCommand.java:36) ~[main/:na]
    at com.telegram.drb.command.handler.CommandHandler.handleMessage(CommandHandler.java:67) ~[main/:na]
    at com.telegram.drb.bot.DawgReputationBot.onUpdateReceived(DawgReputationBot.java:62) ~[main/:na]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) ~[na:na]
    at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[telegrambots-meta-4.9.jar:na]
    at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:321) ~[telegrambots-4.9.jar:na]

I don't know which "URI" I've to check..

W-Larsen commented 4 years ago

Great.

In fact, this application is a simple bot that can raise or lower a reputation if someone replies with special characters to another user's message in the Telegram bot, which was made for the own chat. So don't expect much functionality ;)

But in future I'm going to add some new interesting things, rewrite it with modern technologies and write proper installation guide.

W-Larsen commented 4 years ago

I don't know which "URI" I've to check..

I think it's a problem with dawg.ping.urlproperty. It should be URI of your application. If it localhost then just add http://localhost:8080/

alsoGAMER commented 4 years ago

I don't know which "URI" I've to check..

I think it's a problem with dawg.ping.urlproperty. It should be URI of your application. If it localhost then just add http://localhost:8080/

Is working now, thanks again! Other two things, how to use the database related functions (if any) of this bot? I've already set the credentials and the JDBC URL in the application configuration file

And, where I can report this warning? I'm using java 11 (the integrated JRE in IntelliJ idea to be clear)

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/ag/.gradle/caches/modules-2/files-2.1/com.google.inject/guice/4.2.2/6dacbe18e5eaa7f6c9c36db33b42e7985e94ce77/guice-4.2.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
W-Larsen commented 4 years ago

Other two things, how to use the database related functions (if any) of this bot?

If you add a bot to the Telegram chat and reply to someone's message, information about the user, chat, and users reputation will be automatically added to the database.

And, where I can report this warning?

You can ignore it, these are standard warnings

alsoGAMER commented 4 years ago

Other two things, how to use the database related functions (if any) of this bot?

If you add a bot to the Telegram chat and reply to someone's message, information about the user, chat, and users reputation will be automatically added to the database.

Oh ok! But I just tried to "increase" my reputation using "+" and in the console is appeared this error:

2020-09-02 21:43:31.901 ERROR 222851 --- [legram Executor] o.t.t.u.DefaultBotSession                : PreparedStatementCallback; SQL [insert into user_reputations (user_id, chat_id, reputation_value, updated_date_time, updated_from_id) values (?,?,?,?,?)]; ERROR: duplicate key value violates unique constraint "user_reputations_pkey"
  Detail: Key (user_id, chat_id)=(MY_ID, GROUP_CHAT_ID) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "user_reputations_pkey"
  Detail: Key (user_id, chat_id)=(MY_ID, GROUP_CHAT_ID) already exists.

org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into user_reputations (user_id, chat_id, reputation_value, updated_date_time, updated_from_id) values (?,?,?,?,?)]; ERROR: duplicate key value violates unique constraint "user_reputations_pkey"
  Detail: Key (user_id, chat_id)=(MY_ID, GROUP_CHAT_ID) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "user_reputations_pkey"
  Detail: Key (user_id, chat_id)=(MY_ID, GROUP_CHAT_ID) already exists.
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1443) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:862) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:917) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:927) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at com.telegram.drb.repository.reputation.impl.UserReputationRepository.createUserReputation(UserReputationRepository.java:35) ~[main/:na]
    at com.telegram.drb.repository.reputation.impl.UserReputationRepository$$FastClassBySpringCGLIB$$f0e05a31.invoke(<generated>) ~[main/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at com.telegram.drb.repository.reputation.impl.UserReputationRepository$$EnhancerBySpringCGLIB$$561916e2.createUserReputation(<generated>) ~[main/:na]
    at com.telegram.drb.service.reputation.impl.UserReputationService.createUserRelation(UserReputationService.java:102) ~[main/:na]
    at com.telegram.drb.service.reputation.impl.UserReputationService.manageUserReputation(UserReputationService.java:74) ~[main/:na]
    at com.telegram.drb.service.reputation.impl.UserReputationService$$FastClassBySpringCGLIB$$2781c625.invoke(<generated>) ~[main/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at com.telegram.drb.service.reputation.impl.UserReputationService$$EnhancerBySpringCGLIB$$4a76468b.manageUserReputation(<generated>) ~[main/:na]
    at com.telegram.drb.command.managing.ManageReputationCommand.executeChangingReputation(ManageReputationCommand.java:45) ~[main/:na]
    at com.telegram.drb.command.managing.IncreaseReputationCommand.execute(IncreaseReputationCommand.java:24) ~[main/:na]
    at com.telegram.drb.command.handler.CommandHandler.handleMessage(CommandHandler.java:67) ~[main/:na]
    at com.telegram.drb.bot.DawgReputationBot.onUpdateReceived(DawgReputationBot.java:62) ~[main/:na]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) ~[na:na]
    at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[telegrambots-meta-4.9.jar:na]
    at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:321) ~[telegrambots-4.9.jar:na]
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "user_reputations_pkey"
  Detail: Key (user_id, chat_id)=(MY_ID, GROUP_CHAT_ID) already exists.
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477) ~[postgresql-42.1.4.jar:42.1.4]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190) ~[postgresql-42.1.4.jar:42.1.4]
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300) ~[postgresql-42.1.4.jar:42.1.4]
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428) ~[postgresql-42.1.4.jar:42.1.4]
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354) ~[postgresql-42.1.4.jar:42.1.4]
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169) ~[postgresql-42.1.4.jar:42.1.4]
    at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:136) ~[postgresql-42.1.4.jar:42.1.4]
    at org.springframework.jdbc.core.JdbcTemplate.lambda$update$0(JdbcTemplate.java:867) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617) ~[spring-jdbc-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    ... 34 common frames omitted

And also if I use the /myrep command, this error appears in the console:

2020-09-02 21:44:08.038 ERROR 222851 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message

And, where I can report this warning?

You can ignore it, these are standard warnings

Ok.

alsoGAMER commented 4 years ago

I'm running PostgreSQL 12.3, and I've just added to the bot to my group, so I don't know why there is another key for that group.

W-Larsen commented 4 years ago

Unfortunately, I don't know why this happened. Obviously, there is a problem with duplicate primary keys in your db. Try to remove all data from tables and try again. How did you try to increase your reputation? It can be possible only if someone else will reply on your message.

alsoGAMER commented 4 years ago

Unfortunately, I don't know why this happened. Obviously, there is a problem with duplicate primary keys in your db. Try to remove all data from tables and try again.

Ok, I'll try now EDIT: All the tables are already empty, whaaat?....

How did you try to increase your reputation? It can be possible only if someone else will reply on your message.

Literally, by replying with "+" to one of my messages

PS: If you can give me your telegram username, I can contact you there so I can reply more quickly.

W-Larsen commented 4 years ago

Literally, by replying with "+" to one of my messages

It's strange because I thought that I had added validation checks for it. I'll check it and fix, thanks

W-Larsen commented 4 years ago

But it's strange because when if i do the same i don't have such errors.

W-Larsen commented 4 years ago

PS: If you can give me your telegram username, I can contact you there so I can reply more quickly.

Sorry, it would be better to talk here because I don't always have free time to answer questions.

W-Larsen commented 4 years ago

EDIT: All the tables are already empty, whaaat?....

You can ask someone to help you with testing, or you can create another Telegram account and test it yourself.

alsoGAMER commented 4 years ago

But it's strange because when if i do the same i don't have such errors.

Now I've tried to increase the reputation of one random user, and it worked, but I try to increase my reputation by replying to my messages, the message with the ""rankup"" of the previous user gets deleted, and I didn't get this error anymore.

EDIT: Also, if I try to increase/decrease the reputation of the bot itself, i get this error in the console:

2020-09-02 22:23:30.203 ERROR 222851 --- [legram Executor] o.t.t.u.DefaultBotSession                : null

java.lang.NullPointerException: null
    at com.telegram.drb.bot.DawgReputationBot.onUpdateReceived(DawgReputationBot.java:63) ~[main/:na]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) ~[na:na]
    at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[telegrambots-meta-4.9.jar:na]
    at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:321) ~[telegrambots-4.9.jar:na]

However this isn't a real issue, cause try to do that is just very stupid lol

But the issue with the /myrep command is still here, I wonder if is caused by the hardcoded username of your bot (@dawgReputationBot to be clear) image

alsoGAMER commented 4 years ago

PS: If you can give me your telegram username, I can contact you there so I can reply more quickly.

Sorry, it would be better to talk here because I don't always have free time to answer questions.

Ok, don't worry :) Instead, thanks for your support

alsoGAMER commented 4 years ago

EDIT: All the tables are already empty, whaaat?....

You can ask someone to help you with testing, or you can create another Telegram account and test it yourself.

Yes, I'm already testing the bot in my private group

W-Larsen commented 4 years ago

Now I've tried to increase the reputation of one random user, and it worked, but I try to increase my reputation by replying to my messages, the message with the ""rankup"" of the previous user gets deleted, and I didn't get this error anymore.

I'll add fixes for this. I found out the problem.

But the issue with the /myrep command is still here, I wonder if is caused by the hardcoded username of your bot (@dawgReputationBot to be clear)

Probably yes, the problem with username of my bot, thanks. I'll add some fixes and for this too. But for now, you can just write the your bot's username.

W-Larsen commented 4 years ago

I thought that no one would use this except me, so I didn't really think about scalability and substitution by other bots. But in this case I will try to do everything right.

alsoGAMER commented 4 years ago

I thought that no one would use this except me, so I didn't really think about scalability and substitution by other bots. But in this case I will try to do everything right.

It's actually a very good project, however, the lack of an installation guide makes the whole bot hosting process difficult

W-Larsen commented 4 years ago

however, the lack of an installation guide makes the whole bot hosting process difficult

Sure, I understand and I'll add it. By the way, you can try Combot. It's the real big project that has a various functionality.

alsoGAMER commented 4 years ago

But the issue with the /myrep command is still here, I wonder if is caused by the hardcoded username of your bot (@dawgReputationBot to be clear)

Probably yes, the problem with username of my bot, thanks. I'll add some fixes and for this too. But for now, you can just write the your bot's username.

I've replaced it but I got the same issue, here the console output:

2020-09-02 22:35:37.592 ERROR 229408 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 22:35:49.168 ERROR 229408 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message

EDIT: I'm getting the same error with the /minrep and /toprep commands, I've already tried to insert the username of my bot, but this didn't help at all

alsoGAMER commented 4 years ago

however, the lack of an installation guide makes the whole bot hosting process difficult

Sure, I understand and I'll add it.

Great!

By the way, you can try Combot. It's the real big project that has a various functionality.

Yes, I already know and use combot, but for some groups, I want to use something that I host

W-Larsen commented 4 years ago

I've replaced it but I got the same issue, here the console output:

Hm, and what about other commands? /minrep and /toprep?

alsoGAMER commented 4 years ago

I've replaced it but I got the same issue, here the console output:

Hm, and what about other commands? /minrep and /toprep?

Just tried and got the same issue, I wonder if is a markdownv2 related issue

W-Larsen commented 4 years ago

Just tried

Try to debug it.

alsoGAMER commented 4 years ago

Just tried

Try to debug it.

How could I do?

W-Larsen commented 4 years ago

How could I do?

You can use default Idea debugger and run the app in debug mode. image

alsoGAMER commented 4 years ago

How could I do?

You can use default Idea debugger and run the app in debug mode. image

Ok now I'm running the bot in debug mode, but i still get this errors in the console, and nothing else:

2020-09-02 22:56:27.757 ERROR 231820 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 22:57:02.725 ERROR 231820 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 22:57:08.318 ERROR 231820 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 22:57:12.732 ERROR 231820 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 22:57:16.806 ERROR 231820 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 22:57:52.386 ERROR 231820 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
W-Larsen commented 4 years ago

You need to add some break point in the app, for example: image

And you can read the guide for Intellij Idea debugger.

W-Larsen commented 4 years ago

Also, if I try to increase/decrease the reputation of the bot itself, i get this error in the console:

By the way, I've fixed it. You can pull from master and check

alsoGAMER commented 4 years ago

Also, if I try to increase/decrease the reputation of the bot itself, i get this error in the console:

By the way, I've fixed it. You can pull from master and check

Done, now that issue is fixed, but the commands still doesn't work, i get the same error in the console:

2020-09-02 23:17:16.041 ERROR 234461 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 23:17:23.586 ERROR 234461 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 23:17:26.959 ERROR 234461 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 23:17:29.616 ERROR 234461 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 23:18:28.595 ERROR 234461 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message
2020-09-02 23:18:32.706 ERROR 234461 --- [legram Executor] com.telegram.drb.bot.DawgReputationBot   : Failed to send message due to error: Error sending message

But sadly I don't know how to use the debug features, I'm not a java developer/expert, so I don't know how to do that.

W-Larsen commented 4 years ago

But sadly I don't know how to use the debug features, I'm not a java developer/expert, so I don't know how to do that.

Okay, I'll try to find the problem and fix it next but not now. If you find any more problems or find the reason of this issues - please write on this thread.

alsoGAMER commented 4 years ago

But sadly I don't know how to use the debug features, I'm not a java developer/expert, so I don't know how to do that.

Okay, I'll try to find the problem and fix it next but not now. If you find any more problems or find the reason of this issues - please write on this thread.

Ok, thank you for the support!

W-Larsen commented 4 years ago

Ok, thank you for the support!

And thank you for using this and finding bugs :)