Skip to content

Commit

Permalink
🔀 Merge pull request #1292 from TF2Autobot/fix-clearfriends
Browse files Browse the repository at this point in the history
🐛 Fix bot removing non-friends (should not) on !clearfriends command
  • Loading branch information
idinium96 authored Aug 6, 2022
2 parents 4838086 + b829cb1 commit a1e81c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/classes/Commands/sub-classes/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ export default class ManagerCommands {
return this.bot.sendMessage(steamID, `❌ Error getting friendlist: ${JSON.stringify(err)}`);
}

const friendsToRemove = Object.keys(friendlist).filter(steamid => !friendsToKeep.includes(steamid));
const friendsToRemove = Object.keys(friendlist).filter(
// Make sure only friends, not overall
friendID => !friendsToKeep.includes(friendID) && friendlist[friendID] === EFriendRelationship.Friend
);

if (friendsToRemove.length === 0) {
return this.bot.sendMessage(steamID, `❌ I don't have any friends to remove.`);
}
Expand Down

0 comments on commit a1e81c0

Please sign in to comment.