-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
301 additions
and
276 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
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); | ||
} | ||
} | ||
}; |
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,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); | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.