Browse Source

things

master
Morgan Bazalgette 4 years ago
parent
commit
0ef4262682
1 changed files with 9 additions and 8 deletions
  1. +9
    -8
      index.js

+ 9
- 8
index.js View File

@@ -63,17 +63,17 @@ var sendPic = function(userID, chatID) {
if (err)
throw err;
postCount = result.posts.$.count;
if (postCount == 0) {
bot.sendMessage({
chat_id: userID,
text: "I'm sorry, but I was unable to find any images for those tags. Perhaps try again? I have reset the tags for you, btw."
});
memoryData.users[userID].last_tags = null;
return;
}
postID = utils.r(1, (+postCount));
request("http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=1&tags=" + encodeURIComponent((user.last_tags === null? "" : user.last_tags) + " -webm " + (user.rating != "everything"? "rating:" + user.rating : "")) + "&pid=" + postID, function (err, re, body) {
utils.parseXml(body, function(err, result) {
if (typeof result.posts.post[0] !== "undefined") {
bot.sendMessage({
chat_id: userID,
text: "I'm sorry, but I was unable to find any images for those tags. Perhaps try again? I have reset the tags for you, btw."
});
memoryData.users[userID].last_tags = null;
return;
}
postUrl = result.posts.post[0].$.file_url;
actualPostID = result.posts.post[0].$.id;
splitPostUrl = postUrl.split("/");
@@ -113,6 +113,7 @@ var slashGet = function(userID, chatID, command) {
};
var changeRating = function(userID, chatID, newRating) {
getUserInMemory(userID);
newRating = newRating.trim();
if (newRating !== "everything" && newRating !== "explicit"
&& newRating !== "questionable" && newRating !== "safe")
memoryData.users[userID].rating = newRating;

Loading…
Cancel
Save