-
-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bot change name, picture, up sw, fix grup add
- Loading branch information
Showing
11 changed files
with
251 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Command } from "../../types/command" | ||
import i18n from "../../libs/international" | ||
import config from "../../utils/config" | ||
|
||
export const name = "bname" | ||
|
||
export default <Command>{ | ||
category: "owner", | ||
aliases: ["botname"], | ||
desc: "Change bot profile name", | ||
ownerOnly: true, | ||
example: ` | ||
@PREFIX@CMD name~ | ||
`.trimEnd(), | ||
execute: async ({ aruga, arg, user, message }) => { | ||
if (!arg) throw "noCmd" | ||
|
||
await aruga.updateProfileName(arg) | ||
|
||
const text = | ||
"┏━━「 𓆩 𝐻ɪᴅᴅᴇɴ 𝐹ɪɴᴅᴇʀ 𓆪 」\n" + | ||
"┃\n" + | ||
`┃ ${i18n.translate("commands.owner.bot-name", {}, user.language)}\n` + | ||
"┃\n" + | ||
`┗━━「 ꗥ${config.name}ꗥ 」` | ||
|
||
return await message.reply(text, true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import i18n from "../../libs/international" | ||
import config from "../../utils/config" | ||
import type { Command } from "../../types/command" | ||
|
||
export const name = "bpicture" | ||
|
||
export default <Command>{ | ||
category: "owner", | ||
aliases: ["botpicture"], | ||
desc: "Change bot profile picture", | ||
ownerOnly: true, | ||
example: ` | ||
Send a image message with caption | ||
@PREFIX@CMD | ||
-------- | ||
or Reply a image message with text | ||
@PREFIX@CMD | ||
-------- | ||
If you want to crop the image | ||
@PREFIX@CMD crop | ||
-------- | ||
`.trimEnd(), | ||
execute: async ({ aruga, message, arg, user }) => { | ||
if (message.type.includes("image") || (message.quoted && message.quoted.type.includes("image"))) { | ||
const imgBuffer: Buffer = message.quoted ? await aruga.downloadMediaMessage(message.quoted) : await aruga.downloadMediaMessage(message) | ||
const crop = arg && arg.toLowerCase() === "crop" | ||
|
||
await aruga.updateProfilePicture(aruga.decodeJid(aruga.user.id), imgBuffer, crop) | ||
|
||
const text = | ||
"┏━━「 𓆩 𝐻ɪᴅᴅᴇɴ 𝐹ɪɴᴅᴇʀ 𓆪 」\n" + | ||
"┃\n" + | ||
`┃ ${i18n.translate("commands.owner.bot-picture", {}, user.language)}\n` + | ||
"┃\n" + | ||
`┗━━「 ꗥ${config.name}ꗥ 」` | ||
|
||
return await message.reply(text, true) | ||
} | ||
|
||
throw "noCmd" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { database } from "../../libs/whatsapp" | ||
import type { Command } from "../../types/command" | ||
|
||
export default <Command>{ | ||
category: "owner", | ||
aliases: ["upstatus", "upstory"], | ||
desc: "Upload bot status", | ||
ownerOnly: true, | ||
example: ` | ||
Send a image/video message with caption | ||
@PREFIX@CMD status caption | ||
-------- | ||
or Reply a image/video message with text | ||
@PREFIX@CMD status caption | ||
-------- | ||
Send a text message | ||
@PREFIX@CMD status caption | ||
`.trimEnd(), | ||
execute: async ({ aruga, message, arg }) => { | ||
const contactList = await database.getUsers() | ||
|
||
/** | ||
* just arrange it as you like | ||
*/ | ||
|
||
await aruga.sendMessage( | ||
"status@broadcast", | ||
{ | ||
...(message.type === "image" || (message.quoted && message.quoted.type === "image") | ||
? { | ||
image: await aruga.downloadMediaMessage(message.quoted || message), | ||
caption: message.quoted?.body || arg | ||
} | ||
: message.type === "video" || (message.quoted && message.quoted.type === "video") | ||
? { | ||
video: await aruga.downloadMediaMessage(message.quoted || message), | ||
caption: message.quoted?.body || arg | ||
} | ||
: { | ||
text: arg | ||
}) | ||
}, | ||
{ | ||
backgroundColor: "#123456", | ||
font: 3, | ||
//it is always necessary to inform the list of contacts that will have access to the posted status | ||
statusJidList: contactList.map((user) => user.userId).concat(aruga.decodeJid(aruga.user.id)) | ||
} | ||
) | ||
|
||
return await message.reply("Status uploaded successfully", true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.