Don't consider new topic as topic message
This commit is contained in:
parent
4fe7de5d38
commit
c5b2e101a9
@ -38,10 +38,12 @@ public class Bot extends PircBot {
|
||||
this.handleDie(sender, message);
|
||||
this.handleStartReview(sender, message);
|
||||
this.handleStopReview(sender, message);
|
||||
this.handleStartIndividualTopic(sender, message);
|
||||
this.handleStartCollectiveTopic(sender, message);
|
||||
if (!this.handleStartIndividualTopic(sender, message)) {
|
||||
if (!this.handleStartCollectiveTopic(sender, message)) {
|
||||
this.handleMessage(sender, message);
|
||||
}
|
||||
}
|
||||
this.handleComment(sender, message);
|
||||
this.handleMessage(sender, message);
|
||||
this.handleDisplayCurrent(sender, message);
|
||||
this.handleHelp(sender, message);
|
||||
}
|
||||
@ -78,35 +80,38 @@ public class Bot extends PircBot {
|
||||
this.review.addRaw(new Message(sender, message));
|
||||
}
|
||||
|
||||
private void handleDie(final String sender, final String message) {
|
||||
private boolean handleDie(final String sender, final String message) {
|
||||
if (!"!stop".equalsIgnoreCase(message)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.disconnect();
|
||||
this.dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleStartReview(final String sender, final String message) {
|
||||
private boolean
|
||||
handleStartReview(final String sender, final String message) {
|
||||
if (!"!debut".equalsIgnoreCase(message)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.review = new Review(sender);
|
||||
this.sendMessage(sender, "Vous êtes le conducteur de réunion");
|
||||
this.sendMessage(sender, "Pour terminer la réunion, tapez \"!fin\"");
|
||||
this.sendMessage("Début de la réunion hebdomadaire");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleStopReview(final String sender, final String message) {
|
||||
private boolean handleStopReview(final String sender, final String message) {
|
||||
if (this.review == null || !"!fin".equalsIgnoreCase(message)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.review.isOwner(sender)) {
|
||||
this.sendMessage(sender
|
||||
+ ", vous n'êtes pas le conducteur de la réunion");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final ReviewListener listener : this.listeners) {
|
||||
@ -115,48 +120,51 @@ public class Bot extends PircBot {
|
||||
|
||||
this.review = null;
|
||||
this.sendMessage("Fin de la revue hebdomadaire");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleStartIndividualTopic(final String sender,
|
||||
private boolean handleStartIndividualTopic(final String sender,
|
||||
final String message) {
|
||||
if (this.review == null || !message.matches("\\s*#[^#].*")) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.review.isOwner(sender)) {
|
||||
this.sendMessage(sender
|
||||
+ ", vous n'êtes pas le conducteur de la réunion");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
final IndividualTopic topic =
|
||||
new IndividualTopic(message.replaceFirst("#", "").trim());
|
||||
this.review.begin(topic);
|
||||
this.sendMessage("Sujet individuel : " + topic.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleStartCollectiveTopic(final String sender,
|
||||
private boolean handleStartCollectiveTopic(final String sender,
|
||||
final String message) {
|
||||
if (this.review == null || !message.matches("\\s*##.*")) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.review.isOwner(sender)) {
|
||||
this.sendMessage(sender
|
||||
+ ", vous n'êtes pas le conducteur de la réunion");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
final CollectiveTopic topic =
|
||||
new CollectiveTopic(message.replaceFirst("##", "").trim());
|
||||
this.review.begin(topic);
|
||||
this.sendMessage("Sujet collectif : " + topic.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void
|
||||
handleDisplayCurrent(final String sender, final String message) {
|
||||
private boolean handleDisplayCurrent(final String sender,
|
||||
final String message) {
|
||||
if (this.review == null || !"!courant".equalsIgnoreCase(message)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
final Topic current = this.review.getCurrentTopic();
|
||||
@ -168,6 +176,7 @@ public class Bot extends PircBot {
|
||||
} else if (current instanceof CollectiveTopic) {
|
||||
this.sendMessage("Sujet collectif en cours : " + current.getTitle());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void sendMessage(final String message) {
|
||||
|
Loading…
Reference in New Issue
Block a user