Skip to content

Commit

Permalink
Merge pull request #191 from Dex-Spirit/master
Browse files Browse the repository at this point in the history
custom changes
  • Loading branch information
Dex-Spirit authored Jul 30, 2024
2 parents 2ffa33f + bd37b87 commit 373d627
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/classes/DiscordWebhook/sendOfferReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export default function sendOfferReview(
? `${offer.id}`
: `${
opt.offerReview.isMention && opt.ownerID.length > 0
? opt.ownerID.map(id => `<@!${id}>`).join(', ') + `, `
? opt.ownerID.map(id => `<@!${id}>`).join(', ') + `, check this! - `
: ''
}check this! - ${offer.id}`;
}${offer.id}`;

const botInfo = bot.handler.getBotInfo;
const pureStock = pure.stock(bot);
Expand Down
4 changes: 2 additions & 2 deletions src/classes/DiscordWebhook/sendPartnerMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function sendPartnerMessage(
username: opt.displayName || botInfo.name,
avatar_url: opt.avatarURL || botInfo.avatarURL,
content: `${
opt.messages.isMention && opt.ownerID.length > 0 ? opt.ownerID.map(id => `<@!${id}>`).join(', ') + `, ` : ''
}new message! - ${steamID}`,
opt.messages.isMention && opt.ownerID.length > 0 ? opt.ownerID.map(id => `<@!${id}>`).join(', ') + `, new message! - ` : ''
}${steamID}`,
embeds: [
{
author: {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Listings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ export default class Listings {
.replace(/%keyPrice%/g, '')
.replace(/%uses%/g, '');
if (entry.sku === '5021;6' && this.bot.handler.autokeys.isEnabled && opt.details.showAutokeys) {
details = '[𝐀𝐮𝐭𝐨𝐤𝐞𝐲𝐬] ' + details;
details.replace(/⚡️𝘧𝘢𝘴𝘵 𝘵𝘳𝘢𝘥𝘪𝘯𝘨⚡️/g, '[𝐀𝐮𝐭𝐨𝐤𝐞𝐲𝐬]');
}
//
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/classes/MyHandler/offer/notify/accepted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ import Bot from '../../../Bot';
export default function accepted(offer: TradeOffer, bot: Bot): void {
const custom = bot.options.customMessage.success;

bot.sendMessage(offer.partner, custom ? custom : '/pre ✅ Success! The offer went through successfully.');
if (custom) {
bot.sendMessage(offer.partner, custom);
}
bot.sendMessage(offer.partner, '/pre ✅ Success! The offer went through successfully.');
}
4 changes: 2 additions & 2 deletions src/classes/MyHandler/offer/notify/cancelled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function cancelled(offer: TradeOffer, oldState: number, bot: Bot)
const custom = bot.options.customMessage.cancelledActiveForAwhile;
reply = custom
? custom
: '/pre ❌ Ohh nooooes! The offer is no longer available. Reason: The offer has been active for a while. ' +
"If the offer was just created, this is likely an issue on Steam's end. Please try again";
: '/pre ❌ Ohh nooooes! The offer is no longer available. Reason: The offer has been active for a while.' +
"\nIf the offer was just created, this is likely an issue on Steam's end. Please try again";
}

bot.sendMessage(offer.partner, reply);
Expand Down
79 changes: 61 additions & 18 deletions src/lib/tools/summarizeOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function getSummary(
? `${bot.schema.getName(SKU.fromString(sku), properName)}${entry?.id ? ` - ${entry.id}` : ''}`
: priceKey; // Non-TF2 items
const name = properName ? generateName : replace.itemName(generateName ? generateName : 'unknown');
const pureSku = ['5021;6', '5002;6', '5001;6', '5000;6'];

if (showStockChanges) {
let oldStock: number | null = 0;
Expand Down Expand Up @@ -209,32 +210,74 @@ function getSummary(
? pureEmoji.get(sku)
: name
: name
}](https://autobot.tf/items/${sku})${amount > 1 ? ` x${amount}` : ''} (${
(summaryAccepted || summaryInProcess) && oldStock !== null ? `${oldStock} → ` : ''
}${
which === 'our'
? summaryInProcess
? currentStock - amount
: currentStock
: summaryInProcess
? currentStock + amount
: currentStock
}${entry ? `/${entry.max}` : ''})`
);
} else {
summary.push(
`${name}${amount > 1 ? ` x${amount}` : ''}${
['review-partner', 'declined'].includes(type)
}](https://autobot.tf/items/${sku})${
amount > 1 || (bot.options.tradeSummary.showPureInEmoji && pureSku.includes(sku))
? ` x${amount}`
: ''
} ${
bot.options.tradeSummary.showPureInEmoji && pureSku.includes(sku)
? ''
: ` (${(summaryAccepted || summaryInProcess) && oldStock !== null ? `${oldStock} → ` : ''}${
: entry
? `(${
which === 'our'
? summaryInProcess
? currentStock - amount
: currentStock
: summaryInProcess
? currentStock + amount
: currentStock
}${entry ? `/${entry.max}` : ''})`
}/${entry.max})`
: `${
(summaryAccepted || summaryInProcess) && oldStock !== null
? `(${oldStock}${
which === 'our'
? summaryInProcess
? currentStock - amount
: currentStock
: summaryInProcess
? currentStock + amount
: currentStock
})`
: ''
}`
}`
);
} else {
summary.push(
`${name}${
amount > 1 || (bot.options.tradeSummary.showPureInEmoji && pureSku.includes(sku))
? ` x${amount}`
: ''
}${
['review-partner', 'declined'].includes(type)
? ''
: ` ${
bot.options.tradeSummary.showPureInEmoji && pureSku.includes(sku)
? ''
: entry
? `(${
which === 'our'
? summaryInProcess
? currentStock - amount
: currentStock
: summaryInProcess
? currentStock + amount
: currentStock
}/${entry.max})`
: `${
(summaryAccepted || summaryInProcess) && oldStock !== null
? `(${oldStock}${
which === 'our'
? summaryInProcess
? currentStock - amount
: currentStock
: summaryInProcess
? currentStock + amount
: currentStock
})`
: ''
}`
})`
}`
);
}
Expand Down

0 comments on commit 373d627

Please sign in to comment.