Skip to content

Commit

Permalink
Merge pull request #55 from laminas/remove-twitter-features
Browse files Browse the repository at this point in the history
Purge all twitter functionality
  • Loading branch information
Xerkus authored Dec 6, 2023
2 parents e544778 + be783fd commit eb3a7d7
Show file tree
Hide file tree
Showing 47 changed files with 21 additions and 3,542 deletions.
6 changes: 0 additions & 6 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ SLACK_CHANNEL_GITHUB=github
SLACK_SIGNING_SECRET=
SLACK_TOKEN=
SLACK_WEBHOOK_LOGGING=
TWEET_VERIFICATION_TOKEN=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_SECRET=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
MASTODON_CLIENT_ID=
MASTODON_CLIENT_SECRET=
MASTODON_BEARER_TOKEN=

42 changes: 2 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ The Laminas Bot acts as:
- Report repository build status to the Laminas Slack #github channel.
- Report releases to:
- The Laminas Slack #github channel.
- The [@getlaminas](https://twitter.com/getlaminas) twitter account.
- The https://getlaminas API, to allow rebuilding the release RSS feed.

- A Discourse webhook handler:
Expand All @@ -41,18 +40,6 @@ The Laminas Bot acts as:
given repository.
- /regenerate-tsc-list triggers rebuilding the list of TSC members (the only
ones authorized to initiate slash commands).
- `/tweet [media:url] message` allows sending a tweet via the
[@getlaminas](https://twitter.com/getlaminas) twitter account, optionally
with media.
- `/retweet {url}` allows retweeting a tweet as specified by `{url}` via the
[@getlaminas](https://twitter.com/getlaminas) twitter account.
- `/reply-to-tweet {url} {message}` allows replying to a tweet as specified by
`{url}` via the [@getlaminas](https://twitter.com/getlaminas) twitter account.

- A webhook for incoming tweets. This webhook works in conjunction with a recipe
on IFTTT that monitors tweets on the getlaminas account, and then passes them
to our webhook. The webhook queues a job that sends the tweet details to a
configured Slack channel.

### Requirements

Expand All @@ -77,9 +64,6 @@ The Laminas Bot acts as:
- /regenerate-tsc-list
- /register-repo {repo}
- /build-docs {repo}
- /tweet [media:url] {message}
- /retweet {url}
- /reply-to-tweet {url} {message}
- Setup an incoming webhook
- Add location to SLACK_WEBHOOK_LOGGING
- Invite the bot to #technical-steering-committee and #laminasbot-errors
Expand All @@ -93,15 +77,6 @@ The Laminas Bot acts as:
- From Discourse
- We need a signing secret; this can be arbitrary, but once used, must be used
when registering ALL webhooks. Add to DISCOURSE_SECRET

- From Twitter
- We need the access token and secret, and the consumer key and secret, as:
- TWITTER_ACCESS_TOKEN
- TWITTER_ACCESS_SECRET
- TWITTER_CONSUMER_KEY
- TWITTER_CONSUMER_SECRET
- We need the shared token between IFTTT and the website for accepting tweets
as TWEET_VERIFICATION_TOKEN.

- From Mastodon
- We need access credentials from a created app as
Expand All @@ -116,7 +91,7 @@ The Laminas Bot acts as:

#### Handlers

There are four primary endpoints:
There are three primary endpoints:

- `/api/discourse/[:channel]/:event` is an incoming webhook from Discourse. The
`:channel` is the name of the Slack channel to notify, and the `:event`
Expand All @@ -136,12 +111,6 @@ There are four primary endpoints:
implementation and dispatch. Individual implementations marshal appropriate
events to dispatch via the event dispatcher.

- `/api/twitter/[:token]` is an incoming webhook from IFTTT. The `:token` is the
shared token between the IFTTT and the webhook; if not identical, requests are
rejected. They payload must contain the elements text, url, and timestamp, and
is used to dispatch an `App\Twitter\Tweet` event before returning a 202
response.

#### Events

The repository provides the following event types, with the listed handlers.
Expand All @@ -153,14 +122,10 @@ Event Type | Handler(s) | Action taken
`App\GitHub\Event\GitHubIssue` | `App\GitHub\Listener\GitHubIssueListener` | Send a notification to Slack about issue creation or closure.
`App\GitHub\Event\GitHubIssueComment` | `App\GitHub\Listener\GitHubIssueCommentListener` | Send a notification to Slack about comment creation on an issue or pull request.
`App\GitHub\Event\GitHubPullRequest` | `App\GitHub\Listener\GitHubPullRequestListener` | Send a notification to Slack about pull request creation or closure.
`App\GitHub\Event\GitHubRelease` | `App\GitHub\Listener\GitHubRelease\SlackListener`, `App\GitHub\Listener\GitHubReleaseTweetListener`, `App\GitHub\Listener\GitHubReleaseWebsiteUpdateListener` | Send a notification to Slack about release creation; tweet the release details; and notify the website of the release so it can update the release RSS feed.
`App\GitHub\Event\GitHubRelease` | `App\GitHub\Listener\GitHubRelease\SlackListener`, `App\GitHub\Listener\GitHubReleaseWebsiteUpdateListener` | Send a notification to Slack about release creation and notify the website of the release so it can update the release RSS feed.
`App\GitHub\Event\GitHubStatus` | `App\GitHub\Listener\GitHubStatusListener` | Send a notification to Slack about a build failure, error, or success.
`App\GitHub\Event\RegisterWebhook` | `App\GitHub\Listener\RegisterWebhookListener` | Use the GitHub API to register the Laminas-BOT webhook with the given repository.
`App\Slack\Event\RegenerateAuthorizedUserList` | `App\Slack\Listener\RegenerateAuthorizedUserListListener` | Use the Slack Web API to rebuild the list of authorized slash command users from the current #technical-steering-committee list.
`App\Slack\Event\Retweet` | `App\Slack\Listener\RetweetListener` | Use the Twitter API to retweet a given tweet.
`App\Slack\Event\Tweet` | `App\Slack\Listener\TweetListener` | Use the Twitter API to send a tweet.
`App\Slack\Event\TwitterReply` | `App\Slack\Listener\TwitterReplyListener` | Use the Twitter API to send a message in reply to another tweet.
`App\Twitter\Tweet` | `App\Twitter\TweetListener` | Send a Slack message to a configured channel with details on a single tweet.

All listeners are decorated using the `DeferredServiceListenerDelegator` class
from the phly/phly-swoole-taskworker package. This means that they will be
Expand Down Expand Up @@ -236,6 +201,3 @@ All of these objects support:
technical steering committee members. If not, an error message is returned to
the user immediately. The list is generated on application initialization, and
again on receipt of a /regenerate-tsc-list command.

- A shared secret is configured between IFTTT and the Twitter webhook, and we
also verify the payload structure.
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"ext-hash": "*",
"ext-json": "*",
"ext-openswoole": "*",
"beberlei/assert": "^2.9.9 || ^3.0.0",
"beberlei/assert": "^2.9.9 || ^3.3.2",
"colorfield/mastodon-api": "^0.1.5",
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"guzzlehttp/guzzle": "^6.3 || ^7.8",
"laminas/laminas-cli": "^1.9.0",
"laminas/laminas-component-installer": "^3.4.0",
"laminas/laminas-config-aggregator": "^1.14.0",
Expand All @@ -30,7 +30,6 @@
"laminas/laminas-servicemanager": "^3.22.1",
"laminas/laminas-stdlib": "^3.18.0",
"laminas/laminas-stratigility": "^3.11.0",
"laminas/laminas-twitter": "^3.7.0",
"league/commonmark": "^2.4.1",
"mezzio/mezzio": "^3.18.0",
"mezzio/mezzio-fastroute": "^3.11.0",
Expand All @@ -52,14 +51,14 @@
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"require-dev": {
"filp/whoops": "^2.14.5",
"filp/whoops": "^2.15.3",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-development-mode": "^3.1",
"mezzio/mezzio-tooling": "^2.5",
"phpspec/prophecy-phpunit": "^2.0.1",
"phpunit/phpunit": "^9.5.26",
"laminas/laminas-development-mode": "^3.11",
"mezzio/mezzio-tooling": "^2.8",
"phpspec/prophecy-phpunit": "^2.0.2",
"phpunit/phpunit": "^9.6.13",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.7.1"
"squizlabs/php_codesniffer": "^3.7.2"
},
"config": {
"discard-changes": true,
Expand Down
Loading

0 comments on commit eb3a7d7

Please sign in to comment.