Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halting feature #1123

Merged
merged 19 commits into from
May 30, 2022
Merged

Halting feature #1123

merged 19 commits into from
May 30, 2022

Conversation

RobotoLev
Copy link
Collaborator

@RobotoLev RobotoLev commented May 27, 2022

Resolves #843


Edited by @idinium96:

New commands (admins only) added:

  • !halt - Pause the trading ⏸ (disables listings, commands, most of trades). Admins are immune. Do not spam this.
  • !unhalt - Unpause the trading ▶ (enables listings, commands, trades). Do not spam this.
  • !haltstatus - Get the info whether the bot is paused or not ⏯

New options added:

  • offerReceived.halted.ignoreHalted
    • Default is false, if set to true, the bot will ignore all incoming offer during halt mode)
  • manualReview.halted.note
    • Default is "❌ The bot is not operational right now, but your offer has been put to review, please wait for my owner to manually accept/decline your offer."
  • customMessage.halted
    • Default is "❌ The bot is not operational right now. Please come back later."
  • customMessage.decline.halted
    • Only triggered if you set manualReview.enable to false
    • Default is "/pre ❌ Ohh nooooes! The offer is no longer available. Reason: The offer has been declined because I am not operational right now. Please come back later."

idinium96 and others added 9 commits May 24, 2022 12:21
* Trading can be stopped with !halt and resumed with !unhalt commands
* All incoming trades will be declined while in halt (admins are immune)
* All commands will be declined while in halt (admins are immune)
Uploading current version of the feature from my fork
* Trades are now declined only for good reason, and normally go to review
@RobotoLev
Copy link
Collaborator Author

My tests: https://imgur.com/a/7L5kPCk
Lion is not a bot which was being tested, that's just another bot of mine. I used it to send trades since my main acc is admin.

@idinium96
Copy link
Member

I don't think this should happen at all. GIFT summary should be the same as GIFT_NO_NOTE (no item values).
image

@idinium96
Copy link
Member

But, will check again

@idinium96
Copy link
Member

Oh what, it has a gift note, but I wonder why it passes to ONLY_METAL reason.

@idinium96
Copy link
Member

If it's a gift, just accept (if reputation checks returned false of course).
So, yes my comment above is kinda valid.

if (itemsToGiveCount === 0) {
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));
if (isGift) {
// We can accept escrow if it's gift
if (checkBannedFailed) {
offer.log('info', `is a gift offer, but failed to check for banned status, declining...`);
return {
action: 'decline',
reason: 'GIFT_FAILED_CHECK_BANNED',
meta: isContainsHighValue ? { highValue: highValueMeta } : undefined
};
}
if (this.bot.isHalted) {
offer.log('info', 'is an acceptable gift offer, but skipping due to halt mode being on');
} else {
offer.log(
'trade',
`is a gift offer, accepting. Summary:\n${JSON.stringify(
summarize(offer, this.bot, 'summary-accepting', false),
null,
4
)}`
);
return {
action: 'accept',
reason: 'GIFT',
meta: isContainsHighValue ? { highValue: highValueMeta } : undefined
};
}

@idinium96
Copy link
Member

idinium96 commented May 28, 2022

OOOHHHHH, it was skipped. I see.
Okay, I understand now.

Copy link
Member

@idinium96 idinium96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if it's a gift, just accept, since the items are only on their side.

@idinium96 idinium96 mentioned this pull request May 29, 2022
@RobotoLev RobotoLev marked this pull request as ready for review May 29, 2022 13:04
@RobotoLev RobotoLev changed the title WIP: halting feature Halting feature May 29, 2022
@RobotoLev RobotoLev linked an issue May 29, 2022 that may be closed by this pull request
Copy link
Member

@idinium96 idinium96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your hard work @RobotoLev.
My review:

src/classes/Commands/sub-classes/Manager.ts Show resolved Hide resolved
src/classes/MyHandler/MyHandler.ts Show resolved Hide resolved
@RobotoLev
Copy link
Collaborator Author

In my opinion, this can be released in v4.13. I can submit any other desirable changes after that.
If there's something that needs to be done before the first release, I can still do it, but it will take some time (I'll be busier next week).

@idinium96
Copy link
Member

idinium96 commented May 29, 2022

Alright, thank you very much for your help.
I will take over from here, and finalize anything that is still not done yet.

Copy link
Member

@idinium96 idinium96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@idinium96 idinium96 merged commit 56a2db3 into development May 30, 2022
@idinium96 idinium96 deleted the feature/halt branch May 30, 2022 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separating the !stop command into 2 different commands
2 participants