Skip to content

Commit

Permalink
šŸ„“
Browse files Browse the repository at this point in the history
  • Loading branch information
hardasf committed May 27, 2024
1 parent 4bb5385 commit 24c20ee
Show file tree
Hide file tree
Showing 11 changed files with 301 additions and 276 deletions.
3 changes: 2 additions & 1 deletion cmds/ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
cooldown: 8,
execute(api, event, args, commands) {
if (args.length === 0) {
api.sendMessage("Please provide a question.", event.threadID);
api.sendMessage("Please provide a question.", event.threadID, event.messageID);
api.setMessageReaction( ': heart:', event.messageID);
return;
}

Expand Down
57 changes: 57 additions & 0 deletions cmds/editconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const fs = require('fs');
const path = require('path');

module.exports = {
description: "Modify the configuration settings",
role: "admin",
credits: "Rejard",
async execute(api, event, args, commands) {
const configPath = path.join(__dirname, '../config.json');

try {
if (args.length < 2) {
api.sendMessage("Usage: configedit <prefix|password|addadmin> <value>", event.threadID);
return;
}
const action = args[0];
const value = args[1];

const configData = fs.readFileSync(configPath, 'utf-8');
const config = JSON.parse(configData);

switch(action.toLowerCase()) {
case 'prefix':
config.PREFIX = value;
break;

case 'password':
config.dakogOten = value;
break;

case 'addadmin':
if (!config.admin.includes(value)) {
config.admin.push(value);
} else {
api.sendMessage(`Admin ${value} is already in the list.`, event.threadID);
return;
}
break;

default:
api.sendMessage("Invalid action. Use one of the following: prefix, password, addadmin", event.threadID);
return;
}
fs.writeFileSync(configPath, JSON.stringify(config, null, 4), 'utf-8');
api.sendMessage("Configuration updated successfully.", event.threadID, () => {
// Delay
setTimeout(() => {
process.exit(1);
}, 3000);
});

} catch (error) {
console.error("An error occurred:", error);
api.sendMessage("An error occurred while trying to update the configuration. Please try again later.", event.threadID);
}
}
};
80 changes: 80 additions & 0 deletions cmds/fliker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const axios = require('axios');
const fs = require('fs').promises;
const path = require('path');

module.exports = {
description: 'Get reactions for a post',
role: 'user',
cooldown: 3,
execute: async function(api, event, args) {
const [link, type, cookieCmd, cookieValue] = args;
if (!link || !type) {
api.sendMessage(`šŸŖ· | Please provide all required parameters: [link] [type].`, event.threadID);
api.setMessageReaction( ': heart:', event.messageID);
return;
}

const createDir = async (dir) => {
try {
await fs.mkdir(dir, { recursive: true });
} catch (error) {
console.error('Error creating directory:', error);
}
};

const userDataDir = path.join(__dirname, '..', 'database', 'users');
await createDir(userDataDir);
const uid = event.senderID;
const userFilePath = path.join(userDataDir, `${uid}.json`);
const readUserData = async () => {
try {
const data = await fs.readFile(userFilePath, 'utf8');
return JSON.parse(data);
} catch (error) {
return {}; // Return empty
}
};

const writeUserData = async (data) => {
try {
await fs.writeFile(userFilePath, JSON.stringify(data, null, 2), 'utf8');
} catch (error) {
console.error('Error writing user data:', error);
}
};

// Check if the user wan
if (cookieCmd === 'addcookie' && cookieValue) {
const userData = await readUserData();
userData.cookie = cookieValue;
await writeUserData(userData);
api.sendMessage('šŸŖ Cookie added/updated successfully.', event.threadID);
return;
}

api.sendMessage(`šŸ”„ Fetching reactions for ${link}...`, event.threadID);
try {
const userData = await readUserData();
const cookie = userData.cookie || '';

const response = await axios.post("https://flikers.net/android/android_get_react.php", {
post_id: link,
react_type: type,
version: "v1.7"
}, {
headers: {
'User-Agent': "Dalvik/2.1.0 (Linux; U; Android 12; V2134 Build/SP1A.210812.003)",
'Connection': "Keep-Alive",
'Accept-Encoding': "gzip",
'Content-Type': "application/json",
'Cookie': cookie
}
});

api.sendMessage(JSON.stringify(response.data), event.threadID);
} catch (error) {
console.error(error);
api.sendMessage('An error occurred while fetching reactions.', event.threadID);
}
}
};
63 changes: 0 additions & 63 deletions cmds/gemini.js

This file was deleted.

38 changes: 0 additions & 38 deletions cmds/gemma.js

This file was deleted.

33 changes: 0 additions & 33 deletions cmds/gpt.js

This file was deleted.

Loading

0 comments on commit 24c20ee

Please sign in to comment.