mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-25 15:06:41 +07:00
added help command
This commit is contained in:
parent
6d3f511807
commit
621b03fb70
12 changed files with 91 additions and 9 deletions
|
@ -16,6 +16,8 @@ export const defaultConfig: Config = {
|
|||
groups: [],
|
||||
},
|
||||
templates: {
|
||||
help: "templates/help.md",
|
||||
help_admin: "templates/help_admin.md",
|
||||
message_new: "templates/message_new.md",
|
||||
wall_post_new: "templates/post_new.md",
|
||||
group_join: "templates/group_join.md",
|
||||
|
|
|
@ -13,12 +13,18 @@ const data = fs.readFileSync(
|
|||
"utf8"
|
||||
);
|
||||
|
||||
const userConfig = yaml.load(data) as Config;
|
||||
const userConfig = yaml.load<Config>(data);
|
||||
|
||||
const config =
|
||||
(userConfig && merge(defaultConfig, userConfig)) || defaultConfig;
|
||||
|
||||
export default function prepareConfig() {
|
||||
validateConfig(config);
|
||||
|
||||
config.telegram.templates = {
|
||||
help: config.templates.help,
|
||||
help_admin: config.templates.help_admin,
|
||||
};
|
||||
|
||||
return config;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ import { HttpConfig } from "../api/http/types";
|
|||
import { LoggerConfig } from "../service/logger/types";
|
||||
import { PostgresConfig } from "../service/db/postgres/types";
|
||||
|
||||
export type TemplateConfig = Record<VkEvent, string>;
|
||||
export type TemplateConfig = Record<VkEvent, string> &
|
||||
Partial<Record<"help" | "help_admin", string>>;
|
||||
|
||||
export interface Config extends Record<string, any> {
|
||||
http: HttpConfig;
|
||||
|
|
|
@ -11,6 +11,8 @@ export const templateConfigSchema = object().required().shape({
|
|||
wall_post_new: string().required(),
|
||||
group_join: string().required(),
|
||||
group_leave: string().required(),
|
||||
help: string().optional(),
|
||||
help_admin: string().optional(),
|
||||
});
|
||||
|
||||
export const templateOptionalSchema = object().shape({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue