Skip to content

Commit

Permalink
feat: created isDonate tool (#1479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolfx committed Jan 27, 2023
1 parent 5b752aa commit b991229
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/lib/tools/isDonate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { TradeOffer } from '@tf2autobot/tradeoffer-manager';

export default function isDonate(offer: TradeOffer) {
// Check if the message is a donation
const offerMessage = offer.message.toLowerCase();
const isGift = [
'gift',
'donat', // So that 'donate' or 'donation' will also be accepted
'tip', // All others are synonyms
'tribute',
'souvenir',
'favor',
'giveaway',
'bonus',
'grant',
'bounty',
'present',
'contribution',
'award',
'nice', // Up until here actually
'happy', // All below people might also use
'thank',
'goo', // For 'good', 'goodie' or anything else
'awesome',
'rep',
'joy',
'cute', // right?
'enjoy',
'prize',
'free',
'tnx',
'ty',
'love',
'<3'
].some(word => offerMessage.includes(word));

return isGift;
}

0 comments on commit b991229

Please sign in to comment.