Skip to content

Commit

Permalink
update handler
Browse files Browse the repository at this point in the history
  • Loading branch information
indonumberone committed Mar 20, 2024
1 parent bc09cff commit 3c087eb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@whiskeysockets/baileys": "^6.6.0",
"axios": "^1.6.7",
"dotenv": "^16.4.5",
"moment-timezone": "^0.5.45",
"phin": "^3.7.0",
"wa-sticker-formatter": "^4.4.4"
}
Expand Down
22 changes: 19 additions & 3 deletions src/commands/help.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import utils from '../lib/utils.js';
import { IWebMessageInfoExtended } from '../lib/types.js';

import moment from 'moment-timezone';
async function sapaan() {
const time: number = moment.tz('Asia/Jakarta').format('HH');
let salam: string;
if (time <= 10 && time >= 3) {
return (salam = ' *selamat pagi kakak* ');
} else if (time <= 14) {
return (salam = ' *selamat siang kakak* ');
} else if (time <= 17) {
return (salam = ' *selamat sore kakak* ');
} else if (time <= 23) {
return (salam = ' *selamat malam kakak* ');
} else {
return (salam = ' *kok belum tidur?* ');
}
}
export async function helpCommand(
senderNumber: string,
m: IWebMessageInfoExtended,
) {
const helpCmd = '*TRIBot* - Command List';
const prefix = '/';
const salam = await sapaan();
const commandList = [
'help',
'ip',
Expand All @@ -18,8 +34,8 @@ export async function helpCommand(
'aimode',
];

const usage = `*Usage*\n[prefix](command)\n\n-- _Example_ --:\n\`\`\`${prefix}${commandList[2]}\`\`\`\n`;
const text = `${helpCmd}\n\n*MAIN*\n\`\`\`${commandList}\`\`\`\n\n${usage}`;
const usage = `\n*Usage*\n[prefix](command)\n\n-- _Example_ --:\n\`\`\`${prefix}${commandList[2]}\`\`\`\n`;
const text = `${salam}\n\n${helpCmd}\n\n*MAIN*\n\`\`\`${commandList}\`\`\`\n\n${usage}`;
const url = 'https://beradadisini.com/wp-content/uploads/2008/08/eve.jpg';

utils.replyWithImages(text, url, senderNumber, m);
Expand Down

0 comments on commit 3c087eb

Please sign in to comment.