set process title
This commit is contained in:
parent
bf1a94bc19
commit
7c692758ee
4 changed files with 17 additions and 6 deletions
|
@ -6,7 +6,6 @@ const {listUsers} = require("./listUsers");
|
|||
function switchChannel(input) {
|
||||
if (input == "") {
|
||||
listUsers();
|
||||
comcord.state.channelSwitch = false;
|
||||
return;
|
||||
}
|
||||
let target;
|
||||
|
@ -29,6 +28,10 @@ function switchChannel(input) {
|
|||
comcord.state.lastChannel.set(comcord.state.currentGuild, target);
|
||||
|
||||
listUsers();
|
||||
|
||||
const channel = guild.channels.get(comcord.state.currentChannel);
|
||||
|
||||
process.title = `${guild.name} - ${channel.name} - comcord`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ function switchGuild(input) {
|
|||
console.log("<guild not found>");
|
||||
} else {
|
||||
comcord.state.currentGuild = target;
|
||||
// TODO: store last visited channel and switch to it if we've been to this guild before
|
||||
if (!comcord.state.lastChannel.has(target)) {
|
||||
const topChannel = findTopChannel(target);
|
||||
comcord.state.currentChannel = topChannel.id;
|
||||
|
@ -43,6 +42,11 @@ function switchGuild(input) {
|
|||
|
||||
listChannels();
|
||||
listUsers();
|
||||
|
||||
const guild = comcord.client.guilds.get(comcord.state.currentGuild);
|
||||
const channel = guild.channels.get(comcord.state.currentChannel);
|
||||
|
||||
process.title = `${guild.name} - ${channel.name} - comcord`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ const chalk = require("chalk");
|
|||
|
||||
const token = process.argv[2];
|
||||
|
||||
process.title = "comcord";
|
||||
|
||||
global.comcord = {
|
||||
state: {
|
||||
currentGuild: null,
|
||||
|
|
|
@ -17,12 +17,14 @@ function processMessage({
|
|||
const headerLength = 5 + reply.author.username.length;
|
||||
const length = headerLength + reply.content.length;
|
||||
|
||||
const replyContent = reply.content.replace(/\n/g, " ");
|
||||
|
||||
if (noColor) {
|
||||
console.log(
|
||||
` \u250d [${reply.author.username}] ${
|
||||
length > 79
|
||||
? reply.content.substring(0, length - headerLength) + "\u2026"
|
||||
: reply.content
|
||||
? replyContent.substring(0, length - headerLength) + "\u2026"
|
||||
: replyContent
|
||||
}`
|
||||
);
|
||||
} else {
|
||||
|
@ -32,8 +34,8 @@ function processMessage({
|
|||
chalk.reset(
|
||||
`${
|
||||
length > 79
|
||||
? reply.content.substring(0, length - headerLength) + "\u2026"
|
||||
: reply.content
|
||||
? replyContent.substring(0, length - headerLength) + "\u2026"
|
||||
: replyContent
|
||||
}`
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue