ErdbeerbaerLP / CF-MR-Bot

A discord bot, which informs users about new files of mods on curseforge and modrinth
MIT License
10 stars 6 forks source link

Execution stops on "Connected to WebSocket" #46

Closed estevez-dev closed 3 years ago

estevez-dev commented 3 years ago

So I launched the bot in a Docker container. Here are the logs:

Cought command line args!,
Using github: true,
Logging in to github...,
Attempting to use repository "CurseforgeBotCache",
org.kohsuke.github.PagedSearchIterable@3feb2dda,
Searching existing repos...,
Found repo ha_client,
Found repo XiaomiAntsAlarmService,
Found repo edwin-home,
Found repo VaporizR2,
Found repo ha_client_fcf,
Found repo estevez-dev.github.io,
Found repo ha-client-website,
Found repo keystore,
Found repo Subarino,
Found repo ha-client.app,
Found repo sample_flutter_app,
Found repo CurseforgeBotCache,
Bot-Token is ***********************,
SLF4J: No SLF4J providers were found.,
SLF4J: Defaulting to no-operation (NOP) logger implementation,
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.,
[main] INFO JDA - Login Successful!,
[JDA MainWS-ReadThread] INFO WebSocketClient - Connected to WebSocket,

Bot is invited to a server and appears online, but the repository on GitHub is still emapty. Is it intended and the cache will be generated later, or I made something wrong?

My bot.config:

# Don´t change this! Used internally to backup and reset the config if needed!
ver = 4

# Insert your discord bot token here
# or use "args" here and the argument "- token TOKEN" after the jar
BotToken = "************************************"

# The Default channel ID used for messages
DefaultChannelID=843839277971669035

# Provide some Curseforge project IDs you want the bot to listen to
#
# If you want a specific mod in a different channel and also ping a differnt role, you can add the 
# channel id and role id like this:
# "id;;ChannelID;;RoleID"
# Role ID doesnt have to be set, if its not dont include second ;;
# NOTE: Role ID can only be set if a channel id is set as well
ids = [
    # Questie
    "334372",
    # Combuctor (classic Bagnon)
    "15947",
    # Bagnon
    "1592",
    # CraftPresence
    "457334",
    # AtlasLootClassic
    "326516"
]

## UPDATE MESSAGE OPTIONS ##

# If you want the message to mention a particualr role when a update message is sent, add the Role ID here
#
# Only supports 1 role ID at this time
mentionRole=000000000

# Sets the message to include a download link for the new project file
#
# Use the following 3 options only to set the link
# "direct" = Direct link to download the file
# "curse" = Link to the file download page on curseforge.com
# "nolink" = Do not include a download link
updateFileLink="curse"

# This sets the text that appears as the message description in the update notification
# (the text directly under the project name which is the message title)
#
# This can adhere to discord markdown rules but due to how the message is formatted as a whole, keep this
# message under 250 characters
messageDescription = "New file detected for CurseForge addon"

# Provide a language syntax name to have the changelog formatted inside the embeded message for easier viewing if desired.
#
# Can be very usefull if project owner/author uses discord MarkDown formatting in their changelog
# Uploads as plain text if not changed (example: yml, md, css) Only choose one syntax
changelogDiscordFormat = "md"

## GITHUB OPTIONS ##

# If you want the cache to be stored on github, add the -github argument and enter your OAuth token here
# You can also use '-github TOKEN', so it won´t be stored in a file
# NOTE: The token needs full "Repo" access
githubToken = "*********************************"

# When using github as cache storage, you can also specify an custom repository name
# This bot will create an new (private) one, if none with this name exists
githubRepo = "CurseforgeBotCache"

# NOTE: This config option is not yet implemented, but planned!
#
#
# You can also provide users to listen to (this will subscribe the bot to ALL projects of the user!!)
#
# (You need to provide the name from the URL here and you can also specify an channel like above!)
#users=[
#    "runemoro"
#]
Griefed commented 3 years ago

Does your GitHub token have the necessary scopess in order to create private repositories? Check your token and whether it has all scopes necessary in order to create, read and write to private repos. Additionally, if the repo CurseforgeBotCache exists, try stopping the bot, deleting the repository and then starting the bot again.

The logs should then look like this:

Generating new private repository...
Bot-Token is ***
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
[main] INFO JDA - Login Successful!
[JDA MainWS-ReadThread] INFO WebSocketClient - Connected to WebSocket
[JDA MainWS-ReadThread] INFO JDA - Finished Loading!
Generating cache...
Attempting to save cache...
Pushing to github repo...
Done!
Griefed commented 3 years ago

P.S.: If you've created the bot with a specific configuration, then changed the configuration in your docker-compose, you need to delete the config file created by the docker container in your mounted volume. Delete the bot.conf in said volume and restart the container to generate a new config from the values in your docker-compose.

Griefed commented 3 years ago

When using your own Discord bot, make sure you've set the name to what you want it to be in the Discord Developer portal. Personally, I haven't made a lot of experience with using webhooks for Erdbeerbaer's bot, I've always used a Discord bot for that and it happily posts update message under the bots name in my server. So, to directly answer your question: Yes, it is possible, but I don't know how to set it up the way you want using webhooks.

estevez-dev commented 3 years ago

Sorry @Griefed , I posted to the wrong issue ))

The repo was created by a bot, so the permissions are right. I'm running in a Docker container. Here is my Dockerfile:

FROM openjdk
COPY ./Curseforge-Bot-1.2.3.jar /usr/app/
COPY ./bot.conf /usr/app/
WORKDIR /usr/app
ENTRYPOINT ["java", "-jar", "Curseforge-Bot-1.2.3.jar", "-github", "-debug"]

I'm still having [JDA MainWS-WriteThread] INFO WebSocketClient - Connected to WebSocket as a last log message. Also, there is no bot.conf created in /config.

Griefed commented 3 years ago

Ah, you're using your own image, that explains why there's nothing in /config. I assumed you were using my image 😅 Hm, sorry, in that case I do not know why the cache is not created in your repository. Strange.

estevez-dev commented 3 years ago

Ah, you're using your own image, that explains why there's nothing in /config. I assumed you were using my image 😅 Hm, sorry, in that case I do not know why the cache is not created in your repository. Strange.

I'll try to use your image

estevez-dev commented 3 years ago

So I used griefed/curseforge-bot:arm image. bot.conf is now in /config, but the last log entry is still:

[JDA MainWS-WriteThread] INFO WebSocketClient - Connected to WebSocket
Griefed commented 3 years ago

Ah, one of the older images. Guess DockerHub still keeps those. Please use griefed/curseforge-bot:latest as every other image can be considered deprecated. The image in latest is a multi-arch image and works on Raspberry Pis as well (used to run one on my Pi 3B+) Anyway. This is such a strange behaviour. I literally have no idea how to adress this. I'm using the latest image myself on a Linux VPN, with a Discord bot and GitHub cache, and it just works....sorry man, I'm out of ideas.

ErdbeerbaerLP commented 3 years ago

Umm... Looking at that title, you might have ratelimiting problems. Due to the age of this code I might need to update it so it does not try to cache all members.

For now you should enable Server Members Intent for your bot instances on the discord developers page. Same problem exists for my Discord Integration mod / plugin, but it acutally needs to cache it

estevez-dev commented 3 years ago

Umm... Looking at that title, you might have ratelimiting problems. Due to the age of this code I might need to update it so it does not try to cache all members.

For now you should enable Server Members Intent for your bot instances on the discord developers page. Same problem exists for my Discord Integration mod / plugin, but it acutally needs to cache it

It works, thanks a lot!