camphouse.js
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -11,4 +11,9 @@ const axios = require('axios'); | ||
this.interval = null; | ||
this.commands = {}; | ||
} | ||
on(command, callback) { | ||
this.commands[command] = callback; | ||
} | ||
async login(email, password) { | ||
@@ -29,7 +34,8 @@ try { | ||
for (const post of newPosts) { | ||
const postId = post.id; | ||
const commentsResponse = await axios.get(`${BASE_URL}/comments/post/${postId}`, { | ||
headers: { Authorization: `Bearer ${this.token}` }, | ||
}); | ||
post.comments = commentsResponse.data.data; | ||
// Check if the post content contains a command and execute corresponding functionality | ||
for (const command in this.commands) { | ||
if (post.content.includes(command)) { | ||
this.commands[command](post); | ||
} | ||
} | ||
} | ||
@@ -56,20 +62,2 @@ return newPosts; | ||
} | ||
handleInteractionPostCreate(post) { | ||
const command = 's!randomnumber'; // Example command to check for | ||
if (post.content.includes(command)) { | ||
// Handle the command functionality for post creation | ||
// Assuming this is how you create a post (modify as needed) | ||
console.log(`Post ${post.id} contains the command: ${command}`); | ||
} | ||
} | ||
handleInteractionCommentCreate(comment) { | ||
const command = 's!randomnumber'; // Example command to check for | ||
if (comment.comment.includes(command)) { | ||
// Handle the command functionality for comment creation | ||
// Assuming this is how you create a comment (modify as needed) | ||
console.log(`Comment ${comment._id} contains the command: ${command}`); | ||
} | ||
} | ||
} | ||
@@ -76,0 +64,0 @@ |
{ | ||
"name": "camphouse.js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A package to interact with the Camphouse API", | ||
@@ -5,0 +5,0 @@ "main": "camphouse.js", |
3706
56