Skip to main content

Configuration

Every setting of your bot instance. The settings of a single server are not here: server admins change those in the dashboard.

How it works​

The bot reads one JSON file. Its path is given with the system property bot.config, either absolute or relative to the working directory. The Docker image uses config/config.json in /app.

On every start, and on /bot system reload:

  1. If the file is missing, the bot writes it with all defaults and stops with "Please configure the config.".
  2. Otherwise it reads the file. Missing settings get their default, unknown keys are ignored.
  3. It writes the complete file back, with every setting.

So you only write the settings you want to change, and the bot adds the rest. A new version adds its new settings the same way.

Many settings can also come from an environment variable or a system property. The order is:

  1. environment variable,
  2. system property (-D...),
  3. config.json,
  4. the default.

Values from the environment are never written into the file. That makes the environment the right place for the token and passwords.

tip

/bot system reload reads the file again while the bot runs. Settings the bot only uses at start, like the token, the database and the API host and port, still need a restart.

A starting file​

{
"baseSettings": {
"botOwner": [123456789012345678],
"botGuild": 234567890123456789
},
"api": {
"url": "https://repbot.example.com"
},
"discordOAuth": {
"clientId": "YOUR_CLIENT_ID",
"redirectUri": "https://repbot.example.com/v1/auth/discord/callback"
},
"links": {
"invite": "https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot+applications.commands&permissions=4503875914918976"
}
}

Give the token, the client secret and the database password as BOT_TOKEN, BOT_DISCORD_CLIENT_SECRET and BOT_DB_PASSWORD.

baseSettings​

KeyDefaultEnvironmentWhat it does
token""BOT_TOKENThe bot token. Required.
botOwner[]Discord user ids of the bot owners. Only they can use /bot, and they can open the dashboard of every server the bot is in.
botGuild0The id of your own server. /bot is registered only there. Required.
privateSupportChannel0A text channel on the bot guild. When someone sends the bot a direct message, it offers to open a support thread there, and forwards messages both ways. Each user has one open thread at a time; locking or archiving it closes the request. With 0, or without a botGuild, the bot ignores direct messages.
reviewChannel0A text channel on the bot guild. The bot posts there when a server changes the bot's nickname. 0 turns it off.

database​

PostgreSQL. See database.

KeyDefaultEnvironmentWhat it does
host"localhost"BOT_DB_HOSTDatabase host.
port"5432"BOT_DB_PORTDatabase port. A string in the file.
database"postgres"BOT_DB_DATABASEDatabase name.
schema"repbot_schema"BOT_DB_SCHEMASchema for all tables. Created if missing.
user"postgres"BOT_DB_USERDatabase user.
password"postgres"BOT_DB_PASSWORDDatabase password.
poolSize5BOT_DB_POOLSIZEMaximum number of database connections.

api​

The web server for the dashboard and its API.

KeyDefaultEnvironmentWhat it does
host"0.0.0.0"BOT_API_HOSTAddress to listen on.
port8888BOT_API_PORTPort to listen on.
url"https://repbot.chojo.dev"BOT_API_URLThe public address of your dashboard, without a trailing slash. Used for dashboard links in Discord, the return after Discord login, and the /bot system metrics charts. Set it.
tokenValidHours720How long a dashboard login stays valid without being used, in hours. Expired logins are deleted every hour.

discordOAuth​

Login with Discord for the dashboard. See Discord application.

KeyDefaultEnvironmentWhat it does
clientId""BOT_DISCORD_CLIENT_IDThe client id of your application.
clientSecret""BOT_DISCORD_CLIENT_SECRETThe client secret.
redirectUri""BOT_DISCORD_REDIRECT_URIYour address with /v1/auth/discord/callback. Must match the redirect in the portal.

Links the bot shows in /info, /invite, its leave message and the dashboard.

KeyDefaultWhat it does
tos""Terms of service.
invitethe public instance's inviteInvite link of the bot. Set it to your own.
support""Support server.
website"https://docs.chojo.dev/reputation-bot"Website.
faq"https://docs.chojo.dev/reputation-bot/faq"FAQ.
kofi"https://ko-fi.com/reputationbot"Ko-fi page.

The dashboard pages /tos and /privacy show the Markdown files in the assets folder next to the bot (/app/assets in the image). They contain the texts of the public instance. Replace them with your own if your bot is used by others.

selfcleanup​

The bot asks unused servers whether it should stay, and leaves if nobody answers. Note the lower case key.

KeyDefaultEnvironmentWhat it does
activetrueBOT_SELF_CLEANUP, bot.cleanupTurns the self cleanup on or off.
promptDays3Only shown in the prompt message.
leaveDays3Days after the prompt until the bot leaves.
inactiveDays90A server is unused when the bot joined more than this many days ago, and either the last reputation is older than this, or the server limits thanking to listed channels and lists none. Servers that never had any reputation are never prompted.
tip

For a bot that only serves your own servers, set BOT_SELF_CLEANUP=false.

cleanup​

How long the bot keeps temporary data.

KeyDefaultWhat it does
analyzerLogHours24Hours the message analyzer results are kept.
gdprDays90Days a finished data request is kept in the log.
voiceActivityHours24Hours voice activity is kept for abuse protection.
cleanupScheduleDays14Days after which the data of a server the bot left is deleted.

analyzerSettings​

How the bot looks at a message to find out who is thanked.

KeyDefaultWhat it does
historySize100How many earlier messages the bot reads. At most 100.
voiceMembers10How many recent voice channel members count as context.
latestMaxHours12How old a message may be to count as recent.
minFuzzyScore0.9How close a fuzzy match must be, from 0 to 1.

magicImage​

When someone thanks themselves in a message, the bot sometimes replies with an image.

KeyDefaultWhat it does
magicImageLink""Link to the image. Empty turns the image off.
magicImagineChance10The chance is one in this number. 0 turns the image off.
magicImageCooldown30Minutes between two images.
magicImageDeleteSchedule60Seconds until the image is deleted again.

badges​

KeyDefaultWhat it does
enablestrueShows badges on profiles. Note the spelling of the key.
badges[]Image links. The first is shown on the profile of rank 1, the second on rank 2, and so on.

presenceSettings​

The status of the bot in Discord.

KeyDefaultWhat it does
activefalseChanges the status regularly.
interval5Minutes between two changes.
statusseven custom statusesA list of {"type": ..., "text": ...}. The bot picks one at random.

type is a Discord activity type: PLAYING, STREAMING, LISTENING, WATCHING, CUSTOM_STATUS or COMPETING. The text can use these placeholders: %guild_count%, %channel_count%, %total_rep%, %weekly_rep%, %today_rep%, %weekly_avg_rep%, %analyzed_messages%.

botlist​

For listing the bot on bot list sites. Your own bot can leave this section alone.

KeyDefaultWhat it does
submitfalsetrue posts the server count to the bot lists every hour. With false it posts only every 60 days.
topGg, discordBotsGg, discordBotlistCom, botListMeOne block per site: name, statsToken, voteToken, guildId, profileUrl, voteUrl.

voting​

Tokens for voting on bot lists.

KeyDefaultWhat it does
minDaysStreak7Days of voting in a row before a vote gives double tokens.
hoursSteak28Hours a vote may be apart from the last one to keep the streak. Note the spelling of the key.

kofi​

KeyDefaultWhat it does
tokennullThe verification token of your Ko-fi webhook. Ko-fi sends payments to /v1/kofi. Without a token, the bot rejects every payment it receives.

mailing​

The bot sends mail to verify the mail addresses users add in the dashboard, and about Ko-fi purchases. Your own bot doesn't need it.

KeyDefaultWhat it does
mailSaltrandomSalt for storing mail addresses as hashes. Created on the first start. Don't change or lose it.
smtp{"host": "", "port": 665, "ssl": false}Server for sending.
imap{"host": "", "port": 665, "ssl": false}Server where sent mails are stored.
user""Mail account, also the sender address.
password""Its password.
properties{}Extra JavaMail properties.

skus​

Discord shop items and the supporter features they unlock. This is how the public instance sells features. For your own bot, use BOT_GRANT_ALL_SKU=true instead and leave this section alone.

KeyDefaultWhat it does
subscriptionsone empty entryEach with name, kofiSubscriptionId, kofiLifetimeId, subscriptionSku and lifetimeSku.
interactions{"slash": {}, "messages": {}, "users": {}}Commands that need a SKU, as command name to a list of SKU ids.
featuresone block per featureEach with id, tokens (price per month in the token shop), localeKey and skuEntry (SKU ids that unlock it).
subscriptionErrorMessageHours36Hours between two messages about a missing subscription.
errorThresholdBlock10Together with the hours above, sets the time left that the missing subscription message shows.

The feature blocks are reputationLog, analyzerLog, reputationCategories, reputationChannel, channelBlacklist, localeOverrides, autopost, advancedRankings, detailedProfile, logChannel, additionalEmojis, profile, integrationBypass and commandAliases. Some have one more key: reputationLog.defaultSize, analyzerLog.extendedLogHours, reputationCategories.defaultCategories and reputationChannel.defaultChannel.

Settings outside the file​

These exist only as environment variables or system properties.

EnvironmentSystem propertyDefaultWhat it does
BOT_GRANT_ALL_SKUbot.grantallskufalsetrue unlocks every supporter feature on every server.
BOT_GDPR_ENABLEbot.gdpr.enabletruefalse stops the hourly data job: it sends requested data exports, queues the data of servers the bot left for deletion, and deletes it after cleanup.cleanupScheduleDays.
DOCKERdockerfalsetrue hides /bot system restart, upgrade and shutdown. The image sets it. Here the property wins over the variable.
CJDA_INTERACTIONS_TESTMODEcjda.interactions.testmodefalseFor development. Registers the commands per server instead of globally.
CJDA_INTERACTIONS_CLEANGUILDCOMMANDScjda.interactions.cleanguildcommandsfalseFor development. Redeploys the commands of every server on start.
CJDA_PREMIUM_SKIP_ENTITLED_CHECKcjda.premium.skipEntitledCheckfalseFor development. Skips the SKU check of commands listed in skus.interactions.
bot.confignonePath of config.json, absolute or relative to the working directory. Required.
log4j2.configurationFilenonePath of the logging setup.
cjda.localisation.error.namefalse hides warnings about untranslated command names. The image sets it.

The image starts the bot like this:

java -Dbot.config=config/config.json -Dlog4j2.configurationFile=config/log4j2.xml -Dcjda.localisation.error.name=false -jar bot.jar