reddit_bot 1.7.7 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/reddit_bot.rb +36 -21
  3. data/reddit_bot.gemspec +9 -11
  4. metadata +12 -80
  5. data/.gitignore +0 -5
  6. data/Gemfile +0 -5
  7. data/README.md +0 -101
  8. data/Rakefile +0 -6
  9. data/examples/.bashrc +0 -2
  10. data/examples/.gitignore +0 -2
  11. data/examples/Gemfile.lock +0 -17
  12. data/examples/boilerplate.rb +0 -12
  13. data/examples/councilofricks/Gemfile +0 -4
  14. data/examples/councilofricks/Gemfile.lock +0 -17
  15. data/examples/councilofricks/main.rb +0 -58
  16. data/examples/cptflairbot3/.bashrc +0 -1
  17. data/examples/cptflairbot3/Code.gs +0 -13
  18. data/examples/cptflairbot3/Gemfile +0 -5
  19. data/examples/cptflairbot3/Gemfile.lock +0 -74
  20. data/examples/cptflairbot3/app.js +0 -40
  21. data/examples/cptflairbot3/casual/casualpokemontrades.htm +0 -910
  22. data/examples/cptflairbot3/casual/script.js +0 -55
  23. data/examples/cptflairbot3/casual/style.css +0 -1099
  24. data/examples/cptflairbot3/log.htm +0 -1
  25. data/examples/cptflairbot3/main.rb +0 -62
  26. data/examples/cptflairbot3/package.json +0 -6
  27. data/examples/cptflairbot3/pubsub.rb +0 -30
  28. data/examples/cptflairbot3/update_gas_hook_secret.rb +0 -4
  29. data/examples/devflairbot/Gemfile +0 -6
  30. data/examples/devflairbot/Gemfile.lock +0 -74
  31. data/examples/devflairbot/main.rb +0 -81
  32. data/examples/dut/Gemfile +0 -4
  33. data/examples/dut/Gemfile.lock +0 -24
  34. data/examples/dut/main.rb +0 -41
  35. data/examples/get_dimensions.rb +0 -212
  36. data/examples/iostroubleshooting/Gemfile +0 -5
  37. data/examples/iostroubleshooting/Gemfile.lock +0 -16
  38. data/examples/iostroubleshooting/main.rb +0 -36
  39. data/examples/johnnymarr/Gemfile +0 -3
  40. data/examples/johnnymarr/Gemfile.lock +0 -17
  41. data/examples/johnnymarr/main.rb +0 -54
  42. data/examples/johnnymarr/twitter.rb +0 -80
  43. data/examples/largeimages/Gemfile +0 -11
  44. data/examples/largeimages/Gemfile.lock +0 -105
  45. data/examples/largeimages/main.rb +0 -173
  46. data/examples/largeimagesreview/Gemfile +0 -4
  47. data/examples/largeimagesreview/Gemfile.lock +0 -15
  48. data/examples/largeimagesreview/main.rb +0 -43
  49. data/examples/mlgtv/Gemfile +0 -4
  50. data/examples/mlgtv/Gemfile.lock +0 -23
  51. data/examples/mlgtv/channels.txt +0 -127
  52. data/examples/mlgtv/main.rb +0 -160
  53. data/examples/net_http_utils.rb +0 -148
  54. data/examples/oneplus/Gemfile +0 -5
  55. data/examples/oneplus/Gemfile.lock +0 -26
  56. data/examples/oneplus/main.rb +0 -43
  57. data/examples/realtimeww2/.bashrc +0 -1
  58. data/examples/realtimeww2/Gemfile +0 -3
  59. data/examples/realtimeww2/Gemfile.lock +0 -17
  60. data/examples/realtimeww2/main.rb +0 -129
  61. data/examples/sexypizza/Gemfile +0 -3
  62. data/examples/sexypizza/Gemfile.lock +0 -15
  63. data/examples/sexypizza/main.rb +0 -33
  64. data/examples/unisa/Gemfile +0 -4
  65. data/examples/unisa/Gemfile.lock +0 -24
  66. data/examples/unisa/main.rb +0 -41
  67. data/examples/wallpaper/Gemfile +0 -5
  68. data/examples/wallpaper/Gemfile.lock +0 -34
  69. data/examples/wallpaper/main.rb +0 -27
  70. data/examples/yayornay/Gemfile +0 -3
  71. data/examples/yayornay/Gemfile.lock +0 -15
  72. data/examples/yayornay/main.rb +0 -33
@@ -1,40 +0,0 @@
1
- exports.casualpokemontrades = function(event, callback) {
2
-
3
- // based on https://www.tomas-dvorak.cz/posts/nodejs-request-without-dependencies/
4
- const getContent = function(url) {
5
- return new Promise((resolve, reject) => {
6
- const lib = url.startsWith("https") ? require("https") : require("http");
7
- const request = function(url) {
8
- lib.get(url, (response) => {
9
- var body = [];
10
- /*if (response.statusCode == 302) {
11
- body = [];
12
- request(response.headers.location);
13
- } else*/ if (response.statusCode < 200 || response.statusCode > 299) {
14
- reject(new Error("Failed to load page, status code: " + response.statusCode));
15
- } else {
16
- response.on("data", (chunk) => body.push(chunk));
17
- response.on("end", () => resolve(body.join("")));
18
- };
19
- } ).on("error", (err) => reject(err));
20
- };
21
- request(url);
22
- } );
23
- };
24
-
25
- const storage = require("@google-cloud/storage")();
26
- storage.
27
- bucket("casualpokemontrades.function.nakilon.pro").
28
- file("gas_hook_id.secret").
29
- download( function(err, contents) {
30
- const log_payload = JSON.parse(Buffer.from(event.data.data, "base64").toString()).jsonPayload;
31
- console.log(log_payload);
32
- const path = "https://script.google.com/macros/s/" + contents.toString() + "/exec?payload=" + Buffer.from(JSON.stringify(log_payload)).toString("base64");
33
- console.log(path);
34
- getContent(path);
35
- // then((html) => console.log(html)).
36
- // catch((err) => console.error(err));
37
- } );
38
-
39
- callback();
40
- };