Skip to content

Commit 6e71115

Browse files
eric0324claude
andcommitted
Remove LINE Notify integration
LINE Notify service has been discontinued, so removing all related code: - Removed API, Service, and View files for LINE Notify - Updated constants to remove 'line_notify' from SERVICES array - Cleaned up initializer, notification service, and OAuth service - Updated documentation to reflect the removal 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3fc5bf2 commit 6e71115

11 files changed

+82
-217
lines changed

.claude/settings.local.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(ls:*)",
5+
"Bash(composer show:*)",
6+
"Bash(rm:*)",
7+
"Bash(composer:*)",
8+
"Bash(find:*)",
9+
"Bash(rg:*)",
10+
"Bash(git add:*)"
11+
],
12+
"deny": []
13+
}
14+
}

CLAUDE.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Bot Cat is a WordPress plugin that sends automated chatbot notifications via LINE, Telegram, and Slack when specific WordPress/WooCommerce events occur.
8+
9+
## Architecture
10+
11+
The plugin uses PSR-4 autoloading with the `BotCat` namespace:
12+
13+
- **Entry Point**: `bot-cat.php` - Main plugin file
14+
- **Core Classes**:
15+
- `BotCatInitializer`: Central initialization class in includes/BotCatInitializer.php
16+
- `BotCatConstants`: Plugin constants in includes/BotCatConstants.php
17+
- **Directory Structure**:
18+
- `/includes/Api/`: REST API endpoints for OAuth authentication
19+
- `/includes/Service/`: Business logic for each platform and core services
20+
- `/includes/View/`: Admin interface and frontend components
21+
22+
## Development Commands
23+
24+
Currently, there are no build, test, or lint commands configured. Development tasks:
25+
26+
```bash
27+
# Install dependencies (if any are added)
28+
composer install
29+
30+
# Update autoloader after adding new classes
31+
composer dump-autoload
32+
```
33+
34+
## Key Integration Points
35+
36+
1. **WordPress Hooks**: Posts, comments, and user registration events
37+
2. **WooCommerce Hooks**: Orders and product events (stock management)
38+
3. **REST API Routes**: OAuth callbacks for each platform
39+
4. **Shortcode**: `[bot-cat-oauth]` for OAuth authentication buttons
40+
41+
## Technical Requirements
42+
43+
- PHP 8.2+
44+
- WordPress 6.4.2+
45+
- Requires API key from bot-cat.com console
46+
47+
## Important Files
48+
49+
- **Service Layer**: Platform-specific implementations in `/includes/Service/`:
50+
- `BotCatLineService.php`: LINE messaging
51+
- `BotCatTelegramService.php`: Telegram messaging
52+
- `BotCatSlackService.php`: Slack messaging
53+
- `BotCatNotificationService.php`: Core notification dispatch
54+
55+
- **API Layer**: OAuth endpoints in `/includes/Api/`:
56+
- Each platform has its own authentication API class
57+
- `BotCatMessageApi.php`: Handles incoming messages
58+
59+
- **Views**: Admin panels in `/includes/View/`:
60+
- Platform-specific admin views for configuration
61+
- Partial views for reusable components

includes/Api/BotCatLineNotifyAuthApi.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

includes/BotCatConstants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
const BOT_CAT_REST_NAMESPACE_PREFIX = 'bot-cat';
1010

11-
const SERVICES = [ 'line', 'line_notify', 'telegram', 'slack' ];
11+
const SERVICES = [ 'line', 'telegram', 'slack' ];

includes/BotCatInitializer.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
namespace BotCat;
1010

1111
use BotCat\Api\BotCatLineAuthApi;
12-
use BotCat\Api\BotCatLineNotifyAuthApi;
1312
use BotCat\Api\BotCatMessageApi;
1413
use BotCat\Api\BotCatTelegramAuthApi;
1514
use BotCat\Service\BotCatNotificationService;
1615
use BotCat\Service\BotCatShortcodeService;
1716
use BotCat\View\Admin\BotCatAdminView;
1817
use BotCat\View\Admin\BotCatLineAdminView;
19-
use BotCat\View\Admin\BotCatLineNotifyAdminView;
2018
use BotCat\View\Admin\BotCatSlackAdminView;
2119
use BotCat\View\Admin\BotCatTelegramAdminView;
2220
use BotCat\View\BotCatProfileView;
@@ -66,16 +64,14 @@ public static function bot_cat_load_text_domain(): void {
6664
* function `register_setting()`. It registers the following settings:
6765
*
6866
* 1. Basic Settings: BOT_CAT_OPTION_PREFIX + 'basic'
69-
* 2. Line Notify Settings: BOT_CAT_OPTION_PREFIX + 'line_notify'
70-
* 3. Line Settings: BOT_CAT_OPTION_PREFIX + 'line'
71-
* 4. Telegram Settings: BOT_CAT_OPTION_PREFIX + 'telegram'
72-
* 5. Slack Settings: BOT_CAT_OPTION_PREFIX + 'slack'
67+
* 2. Line Settings: BOT_CAT_OPTION_PREFIX + 'line'
68+
* 3. Telegram Settings: BOT_CAT_OPTION_PREFIX + 'telegram'
69+
* 4. Slack Settings: BOT_CAT_OPTION_PREFIX + 'slack'
7370
*
7471
* @return void
7572
*/
7673
public static function bot_cat_register_settings(): void {
7774
register_setting( BOT_CAT_OPTION_PREFIX . 'basic', BOT_CAT_OPTION_PREFIX . 'basic' );
78-
register_setting( BOT_CAT_OPTION_PREFIX . 'line_notify', BOT_CAT_OPTION_PREFIX . 'line_notify' );
7975
register_setting( BOT_CAT_OPTION_PREFIX . 'line', BOT_CAT_OPTION_PREFIX . 'line' );
8076
register_setting( BOT_CAT_OPTION_PREFIX . 'telegram', BOT_CAT_OPTION_PREFIX . 'telegram' );
8177
register_setting( BOT_CAT_OPTION_PREFIX . 'slack', BOT_CAT_OPTION_PREFIX . 'slack' );
@@ -125,14 +121,13 @@ public static function bot_cat_profile_view(): void {
125121
* This method adds action hooks to the "admin_menu" action, which will be triggered
126122
* when the WordPress admin menu is being rendered. The action hooks will call the
127123
* corresponding admin methods in the BotCatAdminView, BotCatLineAdminView,
128-
* BotCatLineNotifyAdminView, BotCatTelegramAdminView, and BotCatSlackAdminView classes.
124+
* BotCatTelegramAdminView, and BotCatSlackAdminView classes.
129125
*
130126
* @return void
131127
*/
132128
public static function bot_cat_admin_view(): void {
133129
add_action( 'admin_menu', [ BotCatAdminView::class, 'bot_cat_admin' ] );
134130
add_action( 'admin_menu', [ BotCatLineAdminView::class, 'bot_cat_line_admin' ] );
135-
add_action( 'admin_menu', [ BotCatLineNotifyAdminView::class, 'bot_cat_line_notify_admin' ] );
136131
add_action( 'admin_menu', [ BotCatTelegramAdminView::class, 'bot_cat_telegram_admin' ] );
137132
add_action( 'admin_menu', [ BotCatSlackAdminView::class, 'bot_cat_slack_admin' ] );
138133
}
@@ -144,7 +139,6 @@ public static function bot_cat_admin_view(): void {
144139
*/
145140
public static function bot_cat_api(): void {
146141
add_action( 'rest_api_init', [ BotCatLineAuthApi::class, 'register_rest_route' ] );
147-
add_action( 'rest_api_init', [ BotCatLineNotifyAuthApi::class, 'register_rest_route' ] );
148142
add_action( 'rest_api_init', [ BotCatTelegramAuthApi::class, 'register_rest_route' ] );
149143
add_action( 'rest_api_init', [ BotCatMessageApi::class, 'register_rest_route' ] );
150144
}

includes/Service/Api/BotCatLineNotifyService.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

includes/Service/BotCatNotificationService.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace BotCat\Service;
1010

11-
use BotCat\Service\Api\BotCatLineNotifyService;
1211
use BotCat\Service\Api\BotCatLineService;
1312
use BotCat\Service\Api\BotCatSlackService;
1413
use BotCat\Service\Api\BotCatTelegramService;
@@ -22,7 +21,6 @@ class BotCatNotificationService {
2221
private BotCatMessageService $bot_cat_message_service;
2322
private BotCatLineService $bot_cat_line_service;
2423
private BotCatTelegramService $bot_cat_telegram_service;
25-
private BotCatLineNotifyService $bot_cat_line_notify_service;
2624
private BotCatSlackService $bot_cat_slack_service;
2725

2826
public function __construct() {
@@ -31,7 +29,6 @@ public function __construct() {
3129

3230
$this->bot_cat_message_service = new BotCatMessageService();
3331
$this->bot_cat_line_service = new BotCatLineService();
34-
$this->bot_cat_line_notify_service = new BotCatLineNotifyService();
3532
$this->bot_cat_telegram_service = new BotCatTelegramService();
3633
$this->bot_cat_slack_service = new BotCatSlackService();
3734
}
@@ -84,16 +81,6 @@ private function bot_cat_send_text_message( array $uuids, array $messages ): voi
8481
}
8582
}
8683

87-
if ( $service === 'line_notify' ) {
88-
if ( isset( $uuids[ $service ]['admin'] ) && count( $uuids[ $service ]['admin'] ) > 0 ) {
89-
$this->bot_cat_line_notify_service->bot_cat_send_text_message( $uuids[ $service ]['admin'], $messages['admin'] );
90-
}
91-
92-
if ( isset( $uuids[ $service ]['user'] ) && count( $uuids[ $service ]['user'] ) > 0 ) {
93-
$this->bot_cat_line_notify_service->bot_cat_send_text_message( $uuids[ $service ]['user'], $messages['user'] );
94-
}
95-
}
96-
9784
if ( $service === 'telegram' ) {
9885
if ( isset( $uuids[ $service ]['admin'] ) && count( $uuids[ $service ]['admin'] ) > 0 ) {
9986
$this->bot_cat_telegram_service->bot_cat_send_text_message( $uuids[ $service ]['admin'], $messages['admin'] );

includes/Service/BotCatOAuthService.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,35 +75,6 @@ public function bot_cat_oauth_view(): string {
7575
$html .= "</td></tr>";
7676
}
7777

78-
// LINE Notify
79-
$options = get_option( BOT_CAT_OPTION_PREFIX . 'line_notify' );
80-
81-
// Check user role need show OAuth button
82-
$oauth_show_profile = false;
83-
if ( $options['oauth_show_profile'] ) {
84-
foreach ( $roles as $role ) {
85-
if ( isset( $options['oauth_show_profile'][ $role ] ) ) {
86-
$oauth_show_profile = true;
87-
break;
88-
}
89-
}
90-
}
91-
92-
if ( isset( $options['is_enable'] ) && $oauth_show_profile ) {
93-
$url = BOT_CAT_OFFICIAL_URL . 'auth/' . $redirect_token . '/line_notify?user=' . $user_token;
94-
$line_notify_uuid = get_user_meta( $user_id, BOT_CAT_OPTION_PREFIX . 'line_notify_uuid' );
95-
96-
$html .= '<tr><th>LINE Notify</th><td>';
97-
98-
if ( isset( $line_notify_uuid ) && $line_notify_uuid ) {
99-
$html .= __( 'Connected', 'bot-cat' );
100-
} else {
101-
$html .= '<a href="' . esc_url( $url ) . '">' . __( 'Connect', 'bot-cat' ) . '</a>';
102-
}
103-
104-
$html .= "</td></tr>";
105-
}
106-
10778
// Telegram
10879
$options = get_option( BOT_CAT_OPTION_PREFIX . 'telegram' );
10980

includes/View/Admin/BotCatLineNotifyAdminView.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Simply send chatbot notifications via plugins
44

55
## Description
66

7-
[BotCat](https://bot-cat.com) plugin is the ultimate way to send chatbot message via *LINE*, *LINE Notify*, *Telegram*, and others.
7+
[BotCat](https://bot-cat.com) plugin is the ultimate way to send chatbot message via *LINE*, *Telegram*, *Slack*, and others.
88

99
### Installation
1010

0 commit comments

Comments
 (0)