Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,22 @@ core.display = (data, options) => {
l
);

if (options.log || options.logSqlite) {
const plainDateFormat = removeEscapeSequences(dateFormat);
const plainChannel = removeEscapeSequences(channel);
const plainName = removeEscapeSequences(name);
name = chalk.white("|>");
});

if (options && (options.log || options.logSqlite)) {
const plainDateFormat = data.time.format("YYYY-MM-DD HH:mm:ss");
const plainChannel = removeEscapeSequences(channel);
const plainName = removeEscapeSequences(
util.users[data.user]
? chalk[util.users[data.user].color](util.users[data.user].name)
: (typeof data.user === "string" ? data.user : "-")
);

(data.fullLines || data.lines).forEach((line) => {
let l = emoji.emojify(line);
l = util.replaceSlackId(l);
l = util.decolateText(l);
const plainLine = removeEscapeSequences(l);

if (options.log) {
Expand All @@ -166,10 +178,8 @@ core.display = (data, options) => {
data.threadTs || null
);
}
}

name = chalk.white("|>");
});
});
}
};

core.start = async (commander) => {
Expand Down Expand Up @@ -421,6 +431,7 @@ core.start = async (commander) => {
}
}

let fullLines = lines;
if (lines.length > 8) {
lines = lines.slice(0, 5);
lines.push("--- snip ---");
Expand All @@ -438,6 +449,7 @@ core.start = async (commander) => {
let data = {
bufferKey: (typeof message.channel == "string") ? resolveChannelLabelKey(message.channel) : "-",
lines: lines,
fullLines: fullLines,
time: time,
channel: message.channel,
user: message.user,
Expand Down
Loading