├── .github ├── FUNDING.yml └── workflows │ ├── PostToTwitter.yml │ ├── RePostSlackIntegration.yml │ └── SlackIntegration.yml ├── .gitignore ├── Manifest.toml ├── Project.toml ├── README.md ├── assets ├── Julia Bot-2.png ├── JuliaSlackOrg.png └── Logo.png └── src ├── RePostStackOverflow.jl ├── StackOverflowBot.jl └── TwitterBot.jl /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: logankilpatrick 4 | -------------------------------------------------------------------------------- /.github/workflows/PostToTwitter.yml: -------------------------------------------------------------------------------- 1 | name: PostToTwitter 2 | 3 | on: 4 | schedule: 5 | # * is a special character in YAML so you have to quote this string 6 | - cron: '*/30 * * * *' 7 | 8 | # on: push #Used for Debug 9 | 10 | jobs: 11 | test: 12 | runs-on: macos-latest 13 | env: 14 | API_Key: ${{ secrets.API_Key }} 15 | API_Key_Secret: ${{ secrets.API_Key_Secret }} 16 | Access_Token: ${{ secrets.Access_Token }} 17 | Access_Token_Secret: ${{ secrets.Access_Token_Secret }} 18 | steps: 19 | - name: "Checkout actions" 20 | uses: actions/checkout@v1.0.0 21 | - name: "Check PWD" 22 | run: pwd 23 | - name: "Setup Julia action" 24 | uses: julia-actions/setup-julia@v1 25 | with: 26 | version: "1.7.0" 27 | - name: "Build Julia project" 28 | uses: julia-actions/julia-buildpkg@master 29 | - name: "Tun Tweet bot" 30 | run: julia --project src/TwitterBot.jl ${{ secrets.API_Key }} ${{ secrets.API_Key_Secret }} ${{ secrets.Access_Token }} ${{ secrets.Access_Token_Secret }} 31 | -------------------------------------------------------------------------------- /.github/workflows/RePostSlackIntegration.yml: -------------------------------------------------------------------------------- 1 | name: RePostToSlack 2 | 3 | on: 4 | schedule: 5 | # * is a special character in YAML so you have to quote this string 6 | - cron: '0 11 2-30/2 * *' 7 | # Runs on all even number days at 11 am UTC! 8 | 9 | # on: push #Used for Debug 10 | 11 | jobs: 12 | test: 13 | runs-on: macos-latest 14 | steps: 15 | - uses: actions/checkout@v1.0.0 16 | - run: pwd 17 | - uses: julia-actions/setup-julia@v1 18 | with: 19 | version: 1.7.0 20 | - uses: julia-actions/julia-buildpkg@master 21 | - run: julia --project src/RePostStackOverflow.jl ${{ secrets.JuliaLangSlackEndPoint }} 22 | 23 | -------------------------------------------------------------------------------- /.github/workflows/SlackIntegration.yml: -------------------------------------------------------------------------------- 1 | name: SendToSlack 2 | 3 | on: 4 | schedule: 5 | # * is a special character in YAML so you have to quote this string 6 | - cron: '*/30 * * * *' 7 | 8 | # on: push #Used for Debug 9 | 10 | jobs: 11 | test: 12 | runs-on: macos-latest 13 | steps: 14 | - uses: actions/checkout@v1.0.0 15 | - run: pwd 16 | - uses: julia-actions/setup-julia@v1 17 | with: 18 | version: 1.7.0 19 | - uses: julia-actions/julia-buildpkg@master 20 | - run: julia --project src/StackOverflowBot.jl ${{ secrets.JuliaLangSlackEndPoint }} 21 | 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /dev/ 3 | .vscode 4 | -------------------------------------------------------------------------------- /Manifest.toml: -------------------------------------------------------------------------------- 1 | # This file is machine-generated - editing it directly is not advised 2 | 3 | [[ArgTools]] 4 | uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" 5 | 6 | [[Artifacts]] 7 | uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" 8 | 9 | [[Base64]] 10 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" 11 | 12 | [[CSV]] 13 | deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings"] 14 | git-tree-sha1 = "873fb188a4b9d76549b81465b1f75c82aaf59238" 15 | uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" 16 | version = "0.10.4" 17 | 18 | [[CodecZlib]] 19 | deps = ["TranscodingStreams", "Zlib_jll"] 20 | git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da" 21 | uuid = "944b1d66-785c-5afd-91f1-9de20f533193" 22 | version = "0.7.0" 23 | 24 | [[Compat]] 25 | deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] 26 | git-tree-sha1 = "b153278a25dd42c65abbf4e62344f9d22e59191b" 27 | uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" 28 | version = "3.43.0" 29 | 30 | [[CompilerSupportLibraries_jll]] 31 | deps = ["Artifacts", "Libdl"] 32 | uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" 33 | 34 | [[Crayons]] 35 | git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" 36 | uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" 37 | version = "4.1.1" 38 | 39 | [[DataAPI]] 40 | git-tree-sha1 = "fb5f5316dd3fd4c5e7c30a24d50643b73e37cd40" 41 | uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" 42 | version = "1.10.0" 43 | 44 | [[DataFrames]] 45 | deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] 46 | git-tree-sha1 = "daa21eb85147f72e41f6352a57fccea377e310a9" 47 | uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" 48 | version = "1.3.4" 49 | 50 | [[DataStructures]] 51 | deps = ["Compat", "InteractiveUtils", "OrderedCollections"] 52 | git-tree-sha1 = "cc1a8e22627f33c789ab60b36a9132ac050bbf75" 53 | uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" 54 | version = "0.18.12" 55 | 56 | [[DataValueInterfaces]] 57 | git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" 58 | uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" 59 | version = "1.0.0" 60 | 61 | [[Dates]] 62 | deps = ["Printf"] 63 | uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" 64 | 65 | [[DelimitedFiles]] 66 | deps = ["Mmap"] 67 | uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" 68 | 69 | [[Distributed]] 70 | deps = ["Random", "Serialization", "Sockets"] 71 | uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" 72 | 73 | [[Downloads]] 74 | deps = ["ArgTools", "LibCURL", "NetworkOptions"] 75 | uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" 76 | 77 | [[FilePathsBase]] 78 | deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"] 79 | git-tree-sha1 = "129b104185df66e408edd6625d480b7f9e9823a0" 80 | uuid = "48062228-2e41-5def-b9a4-89aafe57970f" 81 | version = "0.9.18" 82 | 83 | [[Formatting]] 84 | deps = ["Printf"] 85 | git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8" 86 | uuid = "59287772-0a20-5a39-b81b-1366585eb4c0" 87 | version = "0.4.2" 88 | 89 | [[Future]] 90 | deps = ["Random"] 91 | uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" 92 | 93 | [[HTTP]] 94 | deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"] 95 | git-tree-sha1 = "c7ec02c4c6a039a98a15f955462cd7aea5df4508" 96 | uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" 97 | version = "0.8.19" 98 | 99 | [[IniFile]] 100 | git-tree-sha1 = "f550e6e32074c939295eb5ea6de31849ac2c9625" 101 | uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f" 102 | version = "0.5.1" 103 | 104 | [[InlineStrings]] 105 | deps = ["Parsers"] 106 | git-tree-sha1 = "61feba885fac3a407465726d0c330b3055df897f" 107 | uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" 108 | version = "1.1.2" 109 | 110 | [[InteractiveUtils]] 111 | deps = ["Markdown"] 112 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" 113 | 114 | [[InvertedIndices]] 115 | git-tree-sha1 = "bee5f1ef5bf65df56bdd2e40447590b272a5471f" 116 | uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" 117 | version = "1.1.0" 118 | 119 | [[IteratorInterfaceExtensions]] 120 | git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" 121 | uuid = "82899510-4779-5014-852e-03e436cf321d" 122 | version = "1.0.0" 123 | 124 | [[JSON]] 125 | deps = ["Dates", "Mmap", "Parsers", "Unicode"] 126 | git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e" 127 | uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" 128 | version = "0.21.3" 129 | 130 | [[LibCURL]] 131 | deps = ["LibCURL_jll", "MozillaCACerts_jll"] 132 | uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" 133 | 134 | [[LibCURL_jll]] 135 | deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] 136 | uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" 137 | 138 | [[LibGit2]] 139 | deps = ["Base64", "NetworkOptions", "Printf", "SHA"] 140 | uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" 141 | 142 | [[LibSSH2_jll]] 143 | deps = ["Artifacts", "Libdl", "MbedTLS_jll"] 144 | uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" 145 | 146 | [[Libdl]] 147 | uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" 148 | 149 | [[LinearAlgebra]] 150 | deps = ["Libdl", "libblastrampoline_jll"] 151 | uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" 152 | 153 | [[Logging]] 154 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" 155 | 156 | [[Markdown]] 157 | deps = ["Base64"] 158 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" 159 | 160 | [[MbedTLS]] 161 | deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"] 162 | git-tree-sha1 = "1c38e51c3d08ef2278062ebceade0e46cefc96fe" 163 | uuid = "739be429-bea8-5141-9913-cc70e7f3736d" 164 | version = "1.0.3" 165 | 166 | [[MbedTLS_jll]] 167 | deps = ["Artifacts", "Libdl"] 168 | uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" 169 | 170 | [[Missings]] 171 | deps = ["DataAPI"] 172 | git-tree-sha1 = "bf210ce90b6c9eed32d25dbcae1ebc565df2687f" 173 | uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" 174 | version = "1.0.2" 175 | 176 | [[Mmap]] 177 | uuid = "a63ad114-7e13-5084-954f-fe012c677804" 178 | 179 | [[MozillaCACerts_jll]] 180 | uuid = "14a3606d-f60d-562e-9121-12d972cd8159" 181 | 182 | [[NetworkOptions]] 183 | uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" 184 | 185 | [[OAuth]] 186 | deps = ["Base64", "HTTP", "MbedTLS", "Random"] 187 | git-tree-sha1 = "3d9e7e347195527b60491ee6e368f4b8b1947411" 188 | uuid = "22d8b318-f366-56fb-a292-a93f7d76c017" 189 | version = "1.0.0" 190 | 191 | [[OpenBLAS_jll]] 192 | deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] 193 | uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" 194 | 195 | [[OrderedCollections]] 196 | git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c" 197 | uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" 198 | version = "1.4.1" 199 | 200 | [[Parsers]] 201 | deps = ["Dates"] 202 | git-tree-sha1 = "1285416549ccfcdf0c50d4997a94331e88d68413" 203 | uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" 204 | version = "2.3.1" 205 | 206 | [[Pkg]] 207 | deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] 208 | uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" 209 | 210 | [[PooledArrays]] 211 | deps = ["DataAPI", "Future"] 212 | git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7" 213 | uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" 214 | version = "1.4.2" 215 | 216 | [[PrettyTables]] 217 | deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"] 218 | git-tree-sha1 = "dfb54c4e414caa595a1f2ed759b160f5a3ddcba5" 219 | uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" 220 | version = "1.3.1" 221 | 222 | [[Printf]] 223 | deps = ["Unicode"] 224 | uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" 225 | 226 | [[REPL]] 227 | deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] 228 | uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" 229 | 230 | [[Random]] 231 | deps = ["SHA", "Serialization"] 232 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" 233 | 234 | [[Reexport]] 235 | git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" 236 | uuid = "189a3867-3050-52da-a836-e630ba90ab69" 237 | version = "1.2.2" 238 | 239 | [[SHA]] 240 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" 241 | 242 | [[SentinelArrays]] 243 | deps = ["Dates", "Random"] 244 | git-tree-sha1 = "6a2f7d70512d205ca8c7ee31bfa9f142fe74310c" 245 | uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" 246 | version = "1.3.12" 247 | 248 | [[Serialization]] 249 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" 250 | 251 | [[SharedArrays]] 252 | deps = ["Distributed", "Mmap", "Random", "Serialization"] 253 | uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" 254 | 255 | [[Slack]] 256 | deps = ["CodecZlib", "HTTP", "JSON"] 257 | git-tree-sha1 = "06ce4ddf279c45416b0871ac85f3f00bcaf0410d" 258 | uuid = "40bba58d-c7f1-4fe3-926e-2f246c890c3c" 259 | version = "0.1.2" 260 | 261 | [[Sockets]] 262 | uuid = "6462fe0b-24de-5631-8697-dd941f90decc" 263 | 264 | [[SortingAlgorithms]] 265 | deps = ["DataStructures"] 266 | git-tree-sha1 = "b3363d7460f7d098ca0912c69b082f75625d7508" 267 | uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" 268 | version = "1.0.1" 269 | 270 | [[SparseArrays]] 271 | deps = ["LinearAlgebra", "Random"] 272 | uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" 273 | 274 | [[StackOverflow]] 275 | deps = ["CodecZlib", "HTTP", "JSON"] 276 | git-tree-sha1 = "387a65cb878dd62809d163c174335548216d1fd1" 277 | repo-rev = "Main" 278 | repo-url = "https://github.com/logankilpatrick/StackOverflow.jl.git" 279 | uuid = "1a8df32f-26ad-40b8-8029-212bc012bd57" 280 | version = "0.1.2" 281 | 282 | [[Statistics]] 283 | deps = ["LinearAlgebra", "SparseArrays"] 284 | uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" 285 | 286 | [[TOML]] 287 | deps = ["Dates"] 288 | uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" 289 | 290 | [[TableTraits]] 291 | deps = ["IteratorInterfaceExtensions"] 292 | git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" 293 | uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" 294 | version = "1.0.1" 295 | 296 | [[Tables]] 297 | deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] 298 | git-tree-sha1 = "5ce79ce186cc678bbb5c5681ca3379d1ddae11a1" 299 | uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" 300 | version = "1.7.0" 301 | 302 | [[Tar]] 303 | deps = ["ArgTools", "SHA"] 304 | uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" 305 | 306 | [[Test]] 307 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] 308 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" 309 | 310 | [[TranscodingStreams]] 311 | deps = ["Random", "Test"] 312 | git-tree-sha1 = "216b95ea110b5972db65aa90f88d8d89dcb8851c" 313 | uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" 314 | version = "0.9.6" 315 | 316 | [[Twitter]] 317 | deps = ["CSV", "DataFrames", "JSON", "OAuth"] 318 | git-tree-sha1 = "8c1421ac5642035d379847434661ab27510d5aab" 319 | repo-rev = "Master" 320 | repo-url = "https://github.com/randyzwitch/Twitter.jl.git" 321 | uuid = "92393bbf-ba23-5323-a3fa-fbe1e5f35af8" 322 | version = "0.9.0" 323 | 324 | [[UUIDs]] 325 | deps = ["Random", "SHA"] 326 | uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" 327 | 328 | [[Unicode]] 329 | uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" 330 | 331 | [[WeakRefStrings]] 332 | deps = ["DataAPI", "InlineStrings", "Parsers"] 333 | git-tree-sha1 = "b1be2855ed9ed8eac54e5caff2afcdb442d52c23" 334 | uuid = "ea10d353-3f73-51f8-a26c-33c1cb351aa5" 335 | version = "1.4.2" 336 | 337 | [[Zlib_jll]] 338 | deps = ["Libdl"] 339 | uuid = "83775a58-1f1d-513f-b197-d71354ab007a" 340 | 341 | [[libblastrampoline_jll]] 342 | deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] 343 | uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" 344 | 345 | [[nghttp2_jll]] 346 | deps = ["Artifacts", "Libdl"] 347 | uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" 348 | 349 | [[p7zip_jll]] 350 | deps = ["Artifacts", "Libdl"] 351 | uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" 352 | -------------------------------------------------------------------------------- /Project.toml: -------------------------------------------------------------------------------- 1 | name = "StackOverflowBot" 2 | uuid = "3897cc02-8aa8-4eb8-aa59-cd66ac8f776d" 3 | authors = ["Logan Kilpatrick <23kilpatrick23@gmail.com>"] 4 | version = "0.1.0" 5 | 6 | [deps] 7 | Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" 8 | HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" 9 | Slack = "40bba58d-c7f1-4fe3-926e-2f246c890c3c" 10 | StackOverflow = "1a8df32f-26ad-40b8-8029-212bc012bd57" 11 | Twitter = "92393bbf-ba23-5323-a3fa-fbe1e5f35af8" 12 | 13 | [compat] 14 | julia = "^1.3" 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stack Overflow, Twitter, and Slack 2 | Integration between Stackoverflow, Twitter, and Slack for the JuliaLang.slack.com workspace. 3 | 4 | Every 30 minutes, a GitHub Action will run, which pings the StackOverflow API for new [Julia tagged questions](https://stackoverflow.com/questions/tagged/julia). 5 | If there are new questions, it posts them in the `#stackoverflow-feed` channel on the [JuliaLang Slack](https://julialang.org/slack/) and on [Twitter](https://twitter.com/JuliaOverflow). 6 | 7 | Every even numbered day of the month at 11 AM UTC time, un-answered questions will be re-posted. 8 | 9 | This project is built in pure Julia and uses [Slack.jl](https://github.com/logankilpatrick/Slack.jl) as well as [StackOverflow.jl](https://github.com/logankilpatrick/StackOverflow.jl). 10 | 11 | ## Current state 12 | 13 | The code for this repo should now be in a static state and 100% Julia (yay). The only change on the near horizon is that Re-posted questions will be sent as a threaded message. This integration will happen in Slack.jl and then be utilized here. 14 | 15 | All feeedback / suggestions / feature requests are welcome! Just open an issue on this repo. 16 | 17 | ## Env Secrets 18 | 19 | `JULIALANGSLACKENDPOINT` should be in the form or `/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE`. See https://github.com/JuliaLangSlack/Slack.jl#usage for more details. 20 | 21 | ## Resources 22 | [YML Check](https://yamlchecker.com) 23 | 24 | [Slack App settings page](https://api.slack.com/apps/AN12MEVDH/general?) 25 | 26 | [Slack Message formatting check](https://api.slack.com/docs/messages/builder?msg=%7B%22text%22%3A%20%22This%20is%20a%20line%20of%20text.%5CnAnd%20this%20is%20another%20one.%22%7D) 27 | 28 | [GitHub Action Scheduling Docs](https://help.github.com/en/articles/events-that-trigger-workflows#scheduled-events-schedule) 29 | 30 | [Slack.jl](https://github.com/logankilpatrick/Slack.jl) 31 | 32 | [StackOverflow.jl](https://github.com/logankilpatrick/StackOverflow.jl) 33 | -------------------------------------------------------------------------------- /assets/Julia Bot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangSlack/StackOverflowBot/6eef60c2550346fab5040b90649f21bb3202f17d/assets/Julia Bot-2.png -------------------------------------------------------------------------------- /assets/JuliaSlackOrg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangSlack/StackOverflowBot/6eef60c2550346fab5040b90649f21bb3202f17d/assets/JuliaSlackOrg.png -------------------------------------------------------------------------------- /assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangSlack/StackOverflowBot/6eef60c2550346fab5040b90649f21bb3202f17d/assets/Logo.png -------------------------------------------------------------------------------- /src/RePostStackOverflow.jl: -------------------------------------------------------------------------------- 1 | using StackOverflow, Dates, HTTP, Slack 2 | 3 | endpoint = ARGS[1] 4 | yesterday = trunc(Int64,floor(Dates.time()))- 86400 5 | currenttime = Dates.time() 6 | eightDaysAgo = (yesterday - 604800) 7 | flag_holder = false 8 | posts = getrecentquestionsfortag(fromdate = string(eightDaysAgo), todate = string(yesterday)) 9 | 10 | for question in posts 11 | 12 | global flag_holder 13 | 14 | if flag_holder == false 15 | response = sendtoslack("The following questions are being re-posted since no one answered yet:", endpoint) 16 | println(response) 17 | flag_holder = true 18 | end 19 | 20 | link = question.link 21 | view_count = question.view_count 22 | owner = question.owner 23 | score = question.score 24 | title = question.title 25 | answer_count = question.answer_count 26 | if (answer_count == 0) 27 | data = Dict("attachments" => [Dict("color" => "#fd1919", 28 | "title" => "$(string(title))", 29 | "title_link" => "$(link)", 30 | "text" => "$(link)", 31 | "footer" => "Slack API", 32 | "ts" => "$(trunc(Int64,floor(Dates.time())))", 33 | "fields" => [Dict("title" => "Answer Count: $(answer_count)", "short" => false)] 34 | )]) 35 | response = sendattachmenttoslack(data, endpoint) 36 | println(response) 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /src/StackOverflowBot.jl: -------------------------------------------------------------------------------- 1 | using StackOverflow, Dates, HTTP, Slack 2 | 3 | endpoint = ARGS[1] # Where endpoint looks like: "/services/TQVJBU534/BR8C1LMPS/42thawJz34SWSgZCpniyLBSE" (just an example). 4 | # The bot uses Endpoint URL's to send messages. Find our more here: https://api.slack.com/apps/AN12MEVDH/incoming-webhooks?success=1 5 | # A new endpoint needs to generated for each channel you want to send posts too. 6 | 7 | currenttime = trunc(Int64,floor(Dates.time())) #Get current time in Unix Epcot Time 8 | thirtyMinsAgo = currenttime - 1800 #rewind 30 minutes since that's the frequency the job run's at. 9 | posts = getrecentquestionsfortag(fromdate = string(thirtyMinsAgo), todate = string(currenttime)) 10 | 11 | for question in posts 12 | link = question.link 13 | view_count = question.view_count 14 | owner = question.owner 15 | score = question.score 16 | title = question.title 17 | answer_count = question.answer_count 18 | 19 | data = Dict("attachments" => [Dict("color" => "#36a64f", 20 | "title" => "$(string(title))", 21 | "title_link" => "$(link)", 22 | "text" => "$(link)", 23 | "footer" => "Slack API", 24 | "ts" => "$(string(currenttime))", 25 | "fields" => [Dict("title" => "Answer Count: $(answer_count)", "short" => false)] 26 | )]) 27 | 28 | response = sendattachmenttoslack(data, endpoint) 29 | println(response) 30 | end 31 | -------------------------------------------------------------------------------- /src/TwitterBot.jl: -------------------------------------------------------------------------------- 1 | using StackOverflow, Dates, HTTP, Twitter 2 | 3 | currenttime = trunc(Int64,floor(Dates.time())) #Get current time in Unix Epcot Time 4 | thirtyMinsAgo = currenttime - 1800 #rewind 30 minutes since that's the frequency the job run's at. 5 | posts = getrecentquestionsfortag(fromdate = string(thirtyMinsAgo), todate = string(currenttime)) 6 | 7 | API_Key = ARGS[1] 8 | API_Key_Secret = ARGS[2] 9 | Access_Token = ARGS[3] 10 | Access_Token_Secret = ARGS[4] 11 | 12 | twitterauth(API_Key, API_Key_Secret, Access_Token, Access_Token_Secret) 13 | 14 | for question in posts 15 | link = question.link 16 | 17 | title = question.title 18 | 19 | myStatus = "$title #JuliaLang \n $link" 20 | 21 | # Get the 20 most recent tweets this account has liked 22 | tweets = get_favorites_list() 23 | 24 | # Loop through and check if the text is the same from any of the last 20 tweets 25 | newTweet = true 26 | for tweet in tweets 27 | if occursin(link, tweet.text) 28 | newTweet = false 29 | end 30 | end 31 | 32 | if newTweet == true 33 | myTweet = post_status_update(status=myStatus) 34 | 35 | # Like every tweet we put out 36 | post_favorites_create(id=myTweet.id) 37 | 38 | else 39 | print("Duplicate tweet with link: $link .... avoided") 40 | end 41 | 42 | end 43 | --------------------------------------------------------------------------------