mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 14:15:25 +00:00
Don't assume config file extension
Even if we want to enforce one extension, doing it in requires scattered across the whole project doesn't sound like a good idea (don't repeat yourself). This commit also enables .js configs, so I added that to .gitignore. I'll document it when we settle on default config format. Why was .json everywhere in the first place? I thought it was neccessary in some older versions of Node to be able to require a .json file.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
node_modules
|
||||
data/
|
||||
config.json
|
||||
config.js
|
||||
.env
|
||||
.idea/
|
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const Telegraf = require('telegraf');
|
||||
const config = require('../config.json');
|
||||
const config = require('../config');
|
||||
|
||||
const bot = new Telegraf(config.token);
|
||||
|
||||
|
@@ -6,7 +6,7 @@ const { escapeHtml, scheduleDeletion } = require('../../utils/tg');
|
||||
// DB
|
||||
const { listGroups } = require('../../stores/group');
|
||||
|
||||
const config = require('../../config.json');
|
||||
const config = require('../../config');
|
||||
|
||||
const inline_keyboard = config.groupsInlineKeyboard;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ const addCommandHandler = require('./addCommand');
|
||||
const removeCommandHandler = require('./removeCommand');
|
||||
const helpHandler = require('./help');
|
||||
|
||||
let { deleteCommands } = require('../../config.json');
|
||||
let { deleteCommands } = require('../../config');
|
||||
|
||||
if (typeof deleteCommands === 'undefined') {
|
||||
deleteCommands = 'own';
|
||||
|
@@ -4,7 +4,7 @@
|
||||
const { link, scheduleDeletion } = require('../../utils/tg');
|
||||
|
||||
// Config
|
||||
const { numberOfWarnsToBan } = require('../../config.json');
|
||||
const { numberOfWarnsToBan } = require('../../config');
|
||||
|
||||
// Bot
|
||||
const { replyOptions } = require('../../bot/options');
|
||||
|
@@ -8,7 +8,7 @@ const { logError } = require('../../utils/log');
|
||||
const {
|
||||
numberOfWarnsToBan,
|
||||
warnInlineKeyboard,
|
||||
} = require('../../config.json');
|
||||
} = require('../../config');
|
||||
const reply_markup = { inline_keyboard: warnInlineKeyboard };
|
||||
|
||||
// Bot
|
||||
|
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
// Config
|
||||
const { master } = require('../../config.json');
|
||||
const { master } = require('../../config');
|
||||
|
||||
// DB
|
||||
const { addUser, isUser } = require('../../stores/user');
|
||||
|
@@ -9,7 +9,7 @@ const {
|
||||
excludeLinks,
|
||||
numberOfWarnsToBan,
|
||||
warnInlineKeyboard,
|
||||
} = require('../../config.json');
|
||||
} = require('../../config');
|
||||
const reply_markup = { inline_keyboard: warnInlineKeyboard };
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@ const { replyOptions } = require('../../bot/options');
|
||||
|
||||
const { admin } = require('../../stores/user');
|
||||
const { addGroup, managesGroup } = require('../../stores/group');
|
||||
const { master } = require('../../config.json');
|
||||
const { master } = require('../../config');
|
||||
|
||||
const addedToGroupHandler = async (ctx, next) => {
|
||||
const msg = ctx.message;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { deleteCommands } = require('../../config.json');
|
||||
const { deleteCommands } = require('../../config');
|
||||
|
||||
const noop = Function.prototype;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
const { compose } = require('telegraf');
|
||||
|
||||
const config = require('../config.json');
|
||||
const config = require('../config');
|
||||
const names = config.plugins || [];
|
||||
|
||||
const plugins = names.map(name => `./${name}`).map(require);
|
||||
|
Reference in New Issue
Block a user