Skip to content

Commit

Permalink
AFK split ban-checking the AFK text from the entire message
Browse files Browse the repository at this point in the history
- should allow for more clarity when receiving banphrased reminders - the author and other status will still be visible
  • Loading branch information
Supinic committed Oct 8, 2024
1 parent dd4daf2 commit f1f81b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/afk.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const Filter = require("./filter.js");
const User = require("./user.js");

const { responses } = require("./afk-definitions.json");
const { responses: configResponses } = require("../config.json");

module.exports = class AwayFromKeyboard extends require("./template.js") {
static data = new Map();
Expand Down Expand Up @@ -133,11 +135,15 @@ module.exports = class AwayFromKeyboard extends require("./template.js") {
statusMessage = sb.Utils.randArray(staticResponses);
}

// const statusMessage = sb.Utils.randArray(afkResponses[data.Status] ?? afkResponses[AwayFromKeyboard.defaultStatus]);
/**
* @todo Whenever the AFK table is split into AFK and AFK_History (similar to Reminder), only keep the Silent
* flag in the historical table and the active one should not have it. Then remove this condition.
*/
if (!data.Silent) {
const userMention = await channelData.Platform.createUserMention(userData);
const message = `${userMention} ${statusMessage}: ${data.Text} (${sb.Utils.timeDelta(data.Started)})`;
const fixedReminderText = await channelData.prepareMessage(data.Text) ?? configResponses.defaultBanphrase;

const message = `${userMention} ${statusMessage}: ${fixedReminderText} (${sb.Utils.timeDelta(data.Started)})`;
if (channelData.Mirror) {
const mirroredMessage = `${userData.Name} ${statusMessage}: ${data.Text} (${sb.Utils.timeDelta(data.Started)})`;
await channelData.mirror(mirroredMessage, null, { commandUsed: false });
Expand Down

0 comments on commit f1f81b8

Please sign in to comment.