mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 07:12:41 +01:00
Updated Campfire adapter to be able to post sound messages and paste messages.
Test Plan: Ran the bot with a handler that sends sound commands. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4922
This commit is contained in:
parent
edaff9e2a3
commit
eb942f3e1e
1 changed files with 19 additions and 7 deletions
|
@ -129,11 +129,23 @@ extends PhabricatorBaseProtocolAdapter {
|
||||||
|
|
||||||
public function writeMessage(PhabricatorBotMessage $message) {
|
public function writeMessage(PhabricatorBotMessage $message) {
|
||||||
switch ($message->getCommand()) {
|
switch ($message->getCommand()) {
|
||||||
case 'MESSAGE':
|
case 'MESSAGE':
|
||||||
$this->speak(
|
$this->speak(
|
||||||
$message->getBody(),
|
$message->getBody(),
|
||||||
$message->getTarget());
|
$message->getTarget());
|
||||||
break;
|
break;
|
||||||
|
case 'SOUND':
|
||||||
|
$this->speak(
|
||||||
|
$message->getBody(),
|
||||||
|
$message->getTarget(),
|
||||||
|
'SoundMessage');
|
||||||
|
break;
|
||||||
|
case 'PASTE':
|
||||||
|
$this->speak(
|
||||||
|
$message->getBody(),
|
||||||
|
$message->getTarget(),
|
||||||
|
'PasteMessage');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,12 +159,12 @@ extends PhabricatorBaseProtocolAdapter {
|
||||||
unset($this->inRooms[$room_id]);
|
unset($this->inRooms[$room_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function speak($message, $room_id) {
|
private function speak($message, $room_id, $type='TextMessage') {
|
||||||
$this->performPost(
|
$this->performPost(
|
||||||
"/room/{$room_id}/speak.json",
|
"/room/{$room_id}/speak.json",
|
||||||
array(
|
array(
|
||||||
'message' => array(
|
'message' => array(
|
||||||
'type' => 'TextMessage',
|
'type' => $type,
|
||||||
'body' => $message)));
|
'body' => $message)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue