Comparing version 1.0.6 to 1.1.0
@@ -5,3 +5,3 @@ const fs = require('fs'), path = require('path'), util = require('util') | ||
exports = module.exports = (name, fn) => { | ||
let mew = () => { | ||
let mews = () => { | ||
if(typeof fn !== 'function') fn = require(fn) | ||
@@ -39,3 +39,3 @@ if(typeof fn !== 'function') throw new Error(`required file "${name}" doesn't export a function`) | ||
property.get = opts => opts[key] = value | ||
property.set = opts => arg => opts[key] = Number(arg) | ||
property.set = opts => arg => opts[key] = +arg | ||
break | ||
@@ -98,12 +98,13 @@ | ||
let getter = (getterProp = props, ...getterArgs) => { | ||
let nextMew | ||
let mew | ||
getterProp = Object.assign({}, getterProp) | ||
if(getterArgs.length === target) { | ||
nextMew = (...format) => { | ||
mew = (...format) => { | ||
fn.call(Object.assign({}, getterProp), util.format(...format), ...getterArgs) | ||
return getter(getterProp, ...getterArgs) | ||
} | ||
Object.defineProperty(mew, 'name', {value: `${name} mew`}) | ||
} else { | ||
nextMew = (...args) => { | ||
mew = (...args) => { | ||
let myArgs = getterArgs.concat(args.splice(0, target - getterArgs.length)) | ||
@@ -113,5 +114,6 @@ if(args.length) return getter(getterProp, ...myArgs)(...args) | ||
} | ||
Object.defineProperty(mew, 'name', {value: `incomplete ${name} mew`}) | ||
} | ||
Object.defineProperties(nextMew, properties(getterProp, newProp => getter(newProp, ...getterArgs))) | ||
return nextMew | ||
Object.defineProperties(mew, properties(getterProp, newProp => getter(newProp, ...getterArgs))) | ||
return mew | ||
} | ||
@@ -124,4 +126,4 @@ | ||
mew = () => ({getter, setter}) | ||
return mew() | ||
mews = () => ({getter, setter}) | ||
return mews() | ||
} | ||
@@ -131,7 +133,9 @@ | ||
configurable, enumerable, | ||
get: () => mew().getter(), | ||
set: (...args) => mew().setter(...args) | ||
get: () => mews().getter(), | ||
set: (...args) => mews().setter(...args) | ||
}) | ||
} | ||
Object.defineProperty(exports, 'name', {value: 'mews'}) | ||
fs | ||
@@ -138,0 +142,0 @@ .readdirSync(path.join(__dirname, 'mews')) |
@@ -1,6 +0,3 @@ | ||
const https = require('https') | ||
const request = require('request') | ||
let hostname = 'api.telegram.org', method = 'POST' | ||
let headers = {'Content-Type': 'application/json'} | ||
exports = module.exports = function(text, token, chat_id) { | ||
@@ -10,4 +7,2 @@ let match = /(?:bot)?(\d+:[-\w]+)/.exec(token) | ||
let path = `/bot${token}/sendMessage` | ||
let { | ||
@@ -18,9 +13,11 @@ parse_mode, disable_web_page_preview, | ||
https | ||
.request({hostname, method, path, headers}) | ||
.on('error', e => {}) | ||
.end(JSON.stringify({ | ||
disable_web_page_preview = +disable_web_page_preview | ||
disable_notification = +disable_notification | ||
request.post(`https://api.telegram.org/bot${token}/sendMessage`, { | ||
formData: { | ||
chat_id, text, parse_mode, disable_web_page_preview, | ||
disable_notification, reply_markup | ||
})) | ||
} | ||
}) | ||
} | ||
@@ -27,0 +24,0 @@ |
{ | ||
"name": "mews", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "trust your output to a mews", | ||
@@ -27,3 +27,6 @@ "main": "lib/index.js", | ||
}, | ||
"homepage": "https://github.com/stawberri/mew#readme" | ||
"homepage": "https://github.com/stawberri/mew#readme", | ||
"dependencies": { | ||
"request": "^2.74.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # mews | ||
mews are intended to make sending messages over [Telegram](https://telegram.org/) as easy as using `console.log`. | ||
mews are intended to make sending messages on Telegram and Twitter as easy as using `console.log`. | ||
@@ -138,3 +138,3 @@ ```js | ||
* `botToken` *string*. Your telegram bot's API token. You get this when you create your bot, and can ask BotFather for it again with the `/token` command. | ||
* `botToken` *string*. Your telegram bot's API token. [BotFather](https://telegram.me/BotFather) will tell give you this when you create a bot or use the `/token` command. | ||
* `chatID` *string*. Your recipient's chat ID, which is usually a positive integer for users, a negative integer for groups, or a name for channels. | ||
@@ -163,1 +163,22 @@ * `...output` Desired output. | ||
``` | ||
### mew = mews.twitter(consumer\_key, consumer\_secret, token, token_secret, ...output) | ||
Send a tweet on twitter with the provided app and account details. You can grab some from Twitter's [Application Management site](https://apps.twitter.com). | ||
* `consumer_key` *string*. Twitter app consumer key (api key) | ||
* `consumer_secret` *string*. Twitter app consumer secret (api secret) | ||
* `token` *string*. Twitter user access token | ||
* `token_secret` *string*. Twitter user access token secret | ||
* `...output` Desired output. | ||
#### twitter configuration | ||
* `mew.sensitive` *toggle*. Flags your tweet as potentially containing sensitive content. | ||
* `mew.possibly_sensitive` *alias*. `mew.sensitive` | ||
```js | ||
let mew = mews.twitter(cKey, cSecret) | ||
mew = mews.twitter(token, tSecret) | ||
mew('This is a tweet.') | ||
``` |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
15207
7
172
182
0
1
+ Addedrequest@^2.74.0
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)