Assorted db changes (#333)
* postgres: use transaction-scoped sql for upgrade
* database: combine fixGuild and addGuild into getGuild
* postgres, sqlite: simplify upgrade()
* allow running commands in DMs without prefix
this functionality was broken in
16095c0256
but is now fixed
* allow running esmBot without a database
Before this change, the only way to run esmBot without a database is to use the
dummy database driver which is broken but fails silently. THis can lead to a
confusing user experience. For instance, using `&command disable` with the
dummy database driver will tell you that the command has been disabled even
though it has not been.
This change adds support for running esmBot with no database driver by leaving
the DB= config option empty, and explicitly telling the user that some
functionality is now unavailable rather than failing silently like the dummy
driver.
* remove dummy database driver
This commit is contained in:
parent
345b525188
commit
ed25116851
18 changed files with 130 additions and 177 deletions
|
@ -131,9 +131,11 @@ if (process.env.METRICS && process.env.METRICS !== "") {
|
|||
# HELP esmbot_shard_count Number of shards the bot has
|
||||
# TYPE esmbot_shard_count gauge
|
||||
`);
|
||||
const counts = await database.getCounts();
|
||||
for (const [i, w] of Object.entries(counts)) {
|
||||
res.write(`esmbot_command_count{command="${i}"} ${w}\n`);
|
||||
if (database) {
|
||||
const counts = await database.getCounts();
|
||||
for (const [i, w] of Object.entries(counts)) {
|
||||
res.write(`esmbot_command_count{command="${i}"} ${w}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
res.write(`esmbot_server_count ${serverCount}\n`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue