From daa404cbc6e8dd69da95d1befd4c9d474842dfda Mon Sep 17 00:00:00 2001 From: Jayden <37990999+Android1108@users.noreply.github.com> Date: Sun, 16 May 2021 18:43:44 +0800 Subject: [PATCH 1/2] Update index.ts --- src/commands/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/commands/index.ts b/src/commands/index.ts index c94a2c4..9cbfed5 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,2 +1,4 @@ export * from "./about"; export * from "./sendkey"; +export * from "./test"; + From aa5d9499bb667f96ea2cd96b725346869ac7bfa5 Mon Sep 17 00:00:00 2001 From: Jayden <37990999+Android1108@users.noreply.github.com> Date: Sun, 16 May 2021 21:15:19 +0800 Subject: [PATCH 2/2] update --- src/commands/getName.ts | 15 +++++++++++++++ src/commands/index.ts | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/commands/getName.ts diff --git a/src/commands/getName.ts b/src/commands/getName.ts new file mode 100644 index 0000000..b9492de --- /dev/null +++ b/src/commands/getName.ts @@ -0,0 +1,15 @@ +import { author, homepage, name, version } from "../../package.json"; + +const debug = require("debug")("bot:about_command"); + +const getName = () => (ctx: any) => { + + const name= ctx.from.last_name ? `${ctx.from.first_name} ${ctx.from.last_name}` : ctx.from.first_name; + + const message = `*${name}`; + debug(`Triggered "about" command with message \n${message}`); + + ctx.reply(message); +}; + +export { getName }; diff --git a/src/commands/index.ts b/src/commands/index.ts index 9cbfed5..f701cfc 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,4 +1,5 @@ export * from "./about"; export * from "./sendkey"; -export * from "./test"; + +export * from "./getName";