Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cujarrett/destiny-insights-bot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.13.1
Choose a base ref
...
head repository: cujarrett/destiny-insights-bot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.14.0
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Sep 20, 2020

  1. 🔧 CI Tests & Access

    cujarrett committed Sep 20, 2020
    Copy the full SHA
    cbc171d View commit details
  2. Merge pull request #39 from cujarrett/update-access

    🔧 CI Tests & Access
    cujarrett authored Sep 20, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b670b49 View commit details
Showing with 230 additions and 40 deletions.
  1. +5 −0 CHANGELOG.md
  2. +197 −1 package-lock.json
  3. +4 −1 package.json
  4. +8 −22 src/integrations/twitter.js
  5. +16 −0 src/settings.js
  6. +0 −16 test/integration/dynamodb.js
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.14.0] - 2020-09-20
### Changed
- :wrench: CI Tests & Access

## [v1.13.1] - 2020-09-12
### Fixed
- :bug: Fixes bug with historic context for each tweet
@@ -88,6 +92,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- :sparkles: Integration with Twitter to post tweets
- :rocket: Continuous Integration pipeline config

[v1.14.0]: https://github.com/cujarrett/banshee-44-mods-bot/compare/v1.13.1...v1.14.0
[v1.13.1]: https://github.com/cujarrett/banshee-44-mods-bot/compare/v1.13.0...v1.13.1
[v1.13.0]: https://github.com/cujarrett/banshee-44-mods-bot/compare/v1.12.0...v1.13.0
[v1.12.0]: https://github.com/cujarrett/banshee-44-mods-bot/compare/v1.11.0...v1.12.0
198 changes: 197 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "banshee-44-mods-bot",
"version": "1.13.1",
"version": "1.14.0",
"author": "Matt Jarrett",
"license": "MIT",
"description": "Node JS Twitter bot that tweets Destiny 2's Banshee-44 daily mods available for sale",
@@ -26,7 +26,10 @@
"devDependencies": {
"aws-sdk": "~2.747.0",
"eslint": "~7.8.1",
"nconf": "~0.10.0",
"nyc": "~15.1.0",
"os": "~0.1.1",
"path": "~0.12.7",
"tap-spec": "~5.0.0",
"tape-async": "~2.3.0"
},
30 changes: 8 additions & 22 deletions src/integrations/twitter.js
Original file line number Diff line number Diff line change
@@ -2,13 +2,8 @@ const Twit = require("twit")
const { getSecret } = require("./aws-secrets-manager.js")

module.exports.test = async (message) => {
const {
TWITTER_TEST_CONSUMER_API_KEY,
TWITTER_TEST_CONSUMER_SECRET,
TWITTER_TEST_ACCESS_TOKEN,
TWITTER_TEST_ACCESS_TOKEN_SECRET
} = await getSecret()

// eslint-disable-next-line max-len
const { TWITTER_TEST_CONSUMER_API_KEY, TWITTER_TEST_CONSUMER_SECRET, TWITTER_TEST_ACCESS_TOKEN, TWITTER_TEST_ACCESS_TOKEN_SECRET } = require("../settings.js")
// Allow Twit mandated use of _ in object keys
/* eslint-disable camelcase*/
const twitterBotConfig = {
@@ -19,20 +14,13 @@ module.exports.test = async (message) => {
timeout_ms: 60 * 1000,
strictSSL: true
}
/* eslint-disable camelcase*/

const response = await tweet(message, twitterBotConfig)
return response
return await post(message, twitterBotConfig)
}

module.exports.post = async (message) => {
const {
TWITTER_CONSUMER_API_KEY,
TWITTER_CONSUMER_SECRET,
TWITTER_ACCESS_TOKEN,
TWITTER_ACCESS_TOKEN_SECRET
} = await getSecret()

module.exports.tweet = async (message) => {
// eslint-disable-next-line max-len
const { TWITTER_CONSUMER_API_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_TOKEN_SECRET } = await getSecret()
// Allow Twit mandated use of _ in object keys
/* eslint-disable camelcase*/
const twitterBotConfig = {
@@ -43,13 +31,11 @@ module.exports.post = async (message) => {
timeout_ms: 60 * 1000,
strictSSL: true
}
/* eslint-disable camelcase*/

const response = await tweet(message, twitterBotConfig)
console.log(response)
await post(message, twitterBotConfig)
}

const tweet = async (message, twitterBotConfig) => {
const post = async (message, twitterBotConfig) => {
try {
const twitter = new Twit(twitterBotConfig)
await twitter.post("statuses/update", { status: message })
16 changes: 16 additions & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const os = require("os")
const path = require("path")
const nconf = require("nconf")

nconf.stores = {}
nconf.env()

const homeDirectory = os.homedir()
const configFilePath = path.join(homeDirectory, ".banshee-44-mods-bot.ini")

nconf.use("file", {
file: configFilePath,
format: nconf.formats.ini
})

module.exports = nconf.get()
Loading