Spaces:
Paused
Paused
Download src/plugin/autorecording.js from arabdullah/ethix-md-user-4: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/arabdullah/ethix-md-user-4/resolve/main/src/plugin/autorecording.js
- Command line
-
hf download hf://spaces/arabdullah/ethix-md-user-4/src/plugin/autorecording.js
-
curl -L -o autorecording.js https://huggingface.co/spaces/arabdullah/ethix-md-user-4/resolve/main/src/plugin/autorecording.js
1.33 kB
| import config from '../../config.cjs'; | |
| const autorecordingCommand = async (m, Matrix) => { | |
| const botNumber = await Matrix.decodeJid(Matrix.user.id); | |
| const isCreator = [botNumber, config.OWNER_NUMBER + '@s.whatsapp.net'].includes(m.sender); | |
| const prefix = config.PREFIX; | |
| const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | |
| const text = m.body.slice(prefix.length + cmd.length).trim(); | |
| if (cmd === 'autorecording') { | |
| if (!isCreator) return m.reply("*📛 THIS IS AN OWNER COMMAND*"); | |
| let responseMessage; | |
| if (text === 'on') { | |
| config.AUTO_RECORDING = true; | |
| responseMessage = "Auto-Recording has been enabled."; | |
| } else if (text === 'off') { | |
| config.AUTO_RECORDING = false; | |
| responseMessage = "Auto-Recording has been disabled."; | |
| } else { | |
| responseMessage = "Usage:\n- `autorecording on`: Enable Auto-Recording\n- `autorecording off`: Disable Auto-Recording"; | |
| } | |
| try { | |
| await Matrix.sendMessage(m.from, { text: responseMessage }, { quoted: m }); | |
| } catch (error) { | |
| console.error("Error processing your request:", error); | |
| await Matrix.sendMessage(m.from, { text: 'Error processing your request.' }, { quoted: m }); | |
| } | |
| } | |
| }; | |
| export default autorecordingCommand; | |