Skip to content

Commit

Permalink
Merge pull request #9 from Zastinian/beta
Browse files Browse the repository at this point in the history
Update to version 2.5.0
  • Loading branch information
Zastinian authored May 3, 2024
2 parents 7f2047f + 6321289 commit ee259b9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,18 @@ try {
const store = makeInMemoryStore({ logger: pino().child({ level: "silent" }) });
store?.readFromFile("./hedystia.json");

Object.values(store.messages).forEach((m) => m.clear());

setInterval(() => {
store?.writeToFile("./hedystia.json");
}, 10_000);
}, 10000);

setInterval(
() => {
Object.values(store.messages).forEach((m) => m.clear());
},
4 * 60 * 60 * 1000,
);

fs.readdir("./tmp", (err, files) => {
if (err) return;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hedystiamd",
"version": "2.4.0",
"version": "2.5.0",
"description": "A whatsapp bot that can be used to play music",
"main": "index.js",
"type": "commonjs",
Expand Down
26 changes: 26 additions & 0 deletions src/commands/images/dexter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { sticker } = require("../../lib/sticker");

module.exports = {
name: "dexter",
run: async (bot, _lang, message, global, _args) => {
const who = message.quoted
? message.quoted.sender
: message.mentionedJid && message.mentionedJid[0]
? message.mentionedJid[0]
: message.fromMe
? bot.user.jid
: message.sender;
const response = await fetch(
`https://strangeapi.hostz.me/api/generators/dexter?image=${encodeURIComponent(await bot.profilePictureUrl(who).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`,
{
headers: {
Authorization: `Bearer ${global.imageToken}`,
},
},
);
const buffer = await response.arrayBuffer();
const buf = Buffer.from(buffer);
const stiker = await sticker(buf, null);
bot.sendFile(message.chat, stiker, null, { asSticker: true });
},
};

0 comments on commit ee259b9

Please sign in to comment.