Skip to content

Commit

Permalink
Merge branch 'dev' into dev-autohostselector-improve-texts-and-error-…
Browse files Browse the repository at this point in the history
…messages
  • Loading branch information
xayanide committed May 29, 2022
2 parents f46c904 + 86b42c1 commit dca83ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/cli/OahrBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,22 @@ export class OahrBase {
// Remove all but ascii graphic characters
name = name.replace(/[^ -~]/g, '');
if (!this.isRegistered) await this.ensureRegisteredAsync();
logger.info(`Making a lobby... Name : ${name}`);
logger.info(`Making a lobby... Name: ${name}`);
await this.lobby.MakeLobbyAsync(name);
this.lobby.SendMessage(`!mp password ${this.option.password}`);
for (const p of this.option.invite_users) {
this.lobby.SendMessage(`!mp invite ${p}`);
}
logger.info(`Successfully made the lobby. Channel : ${this.lobby.channel}`);
logger.info(`Successfully made the lobby. Channel: ${this.lobby.channel}`);
}

async enterLobbyAsync(id: string): Promise<void> {
if (!this.isRegistered) await this.ensureRegisteredAsync();
const channel = parser.EnsureMpChannelId(id);
logger.info(`Entering a lobby... Channel : ${channel}`);
logger.info(`Entering a lobby... Channel: ${channel}`);
await this.lobby.EnterLobbyAsync(channel);
await this.lobby.LoadMpSettingsAsync();

logger.info(`Successfully entered the lobby. Channel : ${this.lobby.channel}`);
logger.info(`Successfully entered the lobby. Channel: ${this.lobby.channel}`);
}
}
10 changes: 5 additions & 5 deletions src/cli/OahrCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class OahrCli extends OahrBase {
await this.makeLobbyAsync(l.arg);
this.transitionToLobbyMenu();
} catch (e: any) {
logger.info(`Failed to make a lobby :\n${e}`);
logger.info(`Failed to make a lobby:\n${e}`);
this.scene = this.scenes.exited;
}
break;
Expand All @@ -75,7 +75,7 @@ export class OahrCli extends OahrBase {
await this.enterLobbyAsync(l.arg);
this.transitionToLobbyMenu();
} catch (e: any) {
logger.info(`Invalid channel :\n${e}`);
logger.info(`Invalid channel:\n${e}`);
this.scene = this.scenes.exited;
}
break;
Expand All @@ -96,7 +96,7 @@ export class OahrCli extends OahrBase {
case '':
break;
default:
logger.info(`Invalid command : ${line}`);
logger.info(`Invalid command: ${line}`);
break;
}
},
Expand Down Expand Up @@ -180,7 +180,7 @@ export class OahrCli extends OahrBase {
} else if (l.command.startsWith('!') || l.command.startsWith('*')) {
this.lobby.RaiseReceivedChatCommand(this.lobby.GetOrMakePlayer(this.client.nick), `${l.command} ${l.arg}`);
} else {
console.log(`Invalid command : ${line}`);
console.log(`Invalid command: ${line}`);
}
break;
}
Expand Down Expand Up @@ -236,7 +236,7 @@ export class OahrCli extends OahrBase {
});

r.on('line', line => {
logger.trace(`Scene:${this.scene.name}, Line:${line}`);
logger.trace(`Scene: ${this.scene.name}, Line: ${line}`);
this.scene.action(line).then(() => {
if (!this.exited) {
r.setPrompt(this.prompt);
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/AfkKicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export class AfkKicker extends LobbyPlugin {
stat.afkPoint = 0;
} else if (this.option.threshold <= stat.afkPoint) {
this.lobby.SendMessage(`!mp kick ${player.escaped_name}`);
this.lobby.SendMessage('bot: Kicked an AFK player.');
this.logger.info(`Kicked ${player.escaped_name}`);
this.lobby.SendMessage('Bot: Kicked an AFK player.');
this.logger.info(`Kicked player ${player.escaped_name}`);
}
}

Expand Down Expand Up @@ -200,6 +200,8 @@ export class AfkKicker extends LobbyPlugin {
points = `\n Points: ${points}`;
}
return `-- AFK Kicker --
Status: ${this.option.enabled ? 'Enabled' : 'Disabled'}, Threshold: ${this.option.threshold}, Cooltime(ms): ${this.option.cooltime_ms} ${points}`;
Status: ${this.option.enabled ? 'Enabled' : 'Disabled'}
Threshold: ${this.option.threshold}
Cooltime(ms): ${this.option.cooltime_ms} ${points}`;
}
}

0 comments on commit dca83ea

Please sign in to comment.