From 286fcb98f40b76c9e2288b14c9f51cc395594245 Mon Sep 17 00:00:00 2001 From: Brian Litwin Date: Mon, 4 May 2020 14:38:45 -0400 Subject: [PATCH] Discord: create snapshots from test instance (#1736) This adds a bash script that fetches data from our test Discord instance. We will be able to test against this data and easily update the data if Discord's api changes. Test plan: After running bash script, inspected snapshot files and verified that the data appears reasonable. Verified that the check for `jq` and `SOURCECRED_DISCORD_TOKEN` both fail and exit if `jq` isn't installed or the Discord bot token hasn't been set. --- ...gzOTkzNjQ0MTg1MDI2Njk_YWZ0ZXI9MCZsaW1pdD01 | 16 ++ ...MjEzNDcyL21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ | 151 ++++++++++++++++++ ...OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ | 137 ++++++++++++++++ ...FmdGVyPTY3ODM5NDQ1NTg0OTU2NjIwOCZsaW1pdD01 | 127 +++++++++++++++ ...FmdGVyPTY3ODM5NDQzNjc1NzA5NDQxMCZsaW1pdD01 | 117 ++++++++++++++ ...bS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOA | 87 ++++++++++ ...bGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9jaGFubmVscw | 73 +++++++++ ...OTQ5ODQyOC9tZW1iZXJzP2FmdGVyPTAmbGltaXQ9NQ | 92 +++++++++++ .../discord/update_discord_api_snapshots.sh | 40 +++++ 9 files changed, 840 insertions(+) create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzLzY3ODY5NzM1MDM4NTg5MzQwNC9yZWFjdGlvbnMvc291cmNlY3JlZDo2NzgzOTkzNjQ0MTg1MDI2Njk_YWZ0ZXI9MCZsaW1pdD01 create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQ1NTg0OTU2NjIwOCZsaW1pdD01 create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQzNjc1NzA5NDQxMCZsaW1pdD01 create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOA create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9jaGFubmVscw create mode 100644 src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9tZW1iZXJzP2FmdGVyPTAmbGltaXQ9NQ create mode 100755 src/plugins/discord/update_discord_api_snapshots.sh diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzLzY3ODY5NzM1MDM4NTg5MzQwNC9yZWFjdGlvbnMvc291cmNlY3JlZDo2NzgzOTkzNjQ0MTg1MDI2Njk_YWZ0ZXI9MCZsaW1pdD01 b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzLzY3ODY5NzM1MDM4NTg5MzQwNC9yZWFjdGlvbnMvc291cmNlY3JlZDo2NzgzOTkzNjQ0MTg1MDI2Njk_YWZ0ZXI9MCZsaW1pdD01 new file mode 100644 index 0000000..364a8a3 --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzLzY3ODY5NzM1MDM4NTg5MzQwNC9yZWFjdGlvbnMvc291cmNlY3JlZDo2NzgzOTkzNjQ0MTg1MDI2Njk_YWZ0ZXI9MCZsaW1pdD01 @@ -0,0 +1,16 @@ +[ + { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + { + "id": "439050857921904640", + "username": "Brian Litwin", + "avatar": "1cc439c3506ede04a77be8105d934df4", + "discriminator": "2386", + "public_flags": 0 + } +] diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ new file mode 100644 index 0000000..1bbba29 --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4MzQ4OTgwODQ5MjEzNDcyL21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ @@ -0,0 +1,151 @@ +[ + { + "id": "678401508219420682", + "type": 7, + "content": "", + "channel_id": "678348980849213472", + "author": { + "id": "439050857921904640", + "username": "Brian Litwin", + "avatar": "1cc439c3506ede04a77be8105d934df4", + "discriminator": "2386", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:45:23.650000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678370372390748199", + "type": 0, + "content": "Made <@!420341518948237331> and <@!432981598858903585> admins 😄", + "channel_id": "678348980849213472", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [ + { + "id": "432981598858903585", + "username": "wchargin", + "avatar": "012988df3eab485878fd588696097802", + "discriminator": "8658", + "public_flags": 0 + }, + { + "id": "420341518948237331", + "username": "decentralion", + "avatar": "a70b70bc0471e6a1efe5124c39c76020", + "discriminator": "8636", + "public_flags": 0 + } + ], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-15T22:41:40.290000+00:00", + "edited_timestamp": "2020-02-16T00:06:41.114000+00:00", + "flags": 0, + "reactions": [ + { + "emoji": { + "id": null, + "name": "👀" + }, + "count": 1, + "me": false + }, + { + "emoji": { + "id": null, + "name": "👍" + }, + "count": 1, + "me": false + } + ] + }, + { + "id": "678367818013737031", + "type": 7, + "content": "", + "channel_id": "678348980849213472", + "author": { + "id": "420341518948237331", + "username": "decentralion", + "avatar": "a70b70bc0471e6a1efe5124c39c76020", + "discriminator": "8636", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-15T22:31:31.279000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678365403600257034", + "type": 7, + "content": "", + "channel_id": "678348980849213472", + "author": { + "id": "432981598858903585", + "username": "wchargin", + "avatar": "012988df3eab485878fd588696097802", + "discriminator": "8658", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-15T22:21:55.638000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678359229685563412", + "type": 7, + "content": "", + "channel_id": "678348980849213472", + "author": { + "id": "678351352770068560", + "username": "CredBot-Beanow", + "avatar": "6f5b83041061a114c9f0fb26b863622c", + "discriminator": "1705", + "public_flags": 0, + "bot": true + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-15T21:57:23.662000+00:00", + "edited_timestamp": null, + "flags": 0 + } +] diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ new file mode 100644 index 0000000..4e71fb3 --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTAmbGltaXQ9NQ @@ -0,0 +1,137 @@ +[ + { + "id": "678394436757094410", + "type": 0, + "content": "5", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:17.682000+00:00", + "edited_timestamp": null, + "flags": 0, + "reactions": [ + { + "emoji": { + "id": "678399364418502669", + "name": "sourcecred" + }, + "count": 1, + "me": false + } + ] + }, + { + "id": "678394433233747978", + "type": 0, + "content": "4", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:16.842000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394431149178940", + "type": 0, + "content": "3", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:16.345000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394428569813013", + "type": 0, + "content": "2", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:15.730000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394426153893948", + "type": 0, + "content": "1", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:15.154000+00:00", + "edited_timestamp": null, + "flags": 0, + "reactions": [ + { + "emoji": { + "id": null, + "name": "👍" + }, + "count": 1, + "me": false + } + ] + } +] diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQ1NTg0OTU2NjIwOCZsaW1pdD01 b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQ1NTg0OTU2NjIwOCZsaW1pdD01 new file mode 100644 index 0000000..ec68f43 --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQ1NTg0OTU2NjIwOCZsaW1pdD01 @@ -0,0 +1,127 @@ +[ + { + "id": "678394480184918016", + "type": 0, + "content": "15", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:28.036000+00:00", + "edited_timestamp": null, + "flags": 0, + "reactions": [ + { + "emoji": { + "id": null, + "name": "😆" + }, + "count": 1, + "me": false + } + ] + }, + { + "id": "678394477106167818", + "type": 0, + "content": "14", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:27.302000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394473428025354", + "type": 0, + "content": "13", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:26.425000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394469048909841", + "type": 0, + "content": "12", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:25.381000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394468373626890", + "type": 0, + "content": "11", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:25.220000+00:00", + "edited_timestamp": null, + "flags": 0 + } +] diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQzNjc1NzA5NDQxMCZsaW1pdD01 b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQzNjc1NzA5NDQxMCZsaW1pdD01 new file mode 100644 index 0000000..2aa86f3 --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvY2hhbm5lbHMvNjc4Mzk0NDA2NTA3OTA1MTI5L21lc3NhZ2VzP2FmdGVyPTY3ODM5NDQzNjc1NzA5NDQxMCZsaW1pdD01 @@ -0,0 +1,117 @@ +[ + { + "id": "678394455849566208", + "type": 0, + "content": "10", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:22.234000+00:00", + "edited_timestamp": "2020-02-16T00:17:38.520000+00:00", + "flags": 0 + }, + { + "id": "678394451462193154", + "type": 0, + "content": "9", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:21.188000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394448497082388", + "type": 0, + "content": "8", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:20.481000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394445351092275", + "type": 0, + "content": "7", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:19.731000+00:00", + "edited_timestamp": null, + "flags": 0 + }, + { + "id": "678394442301833247", + "type": 0, + "content": "6", + "channel_id": "678394406507905129", + "author": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "attachments": [], + "embeds": [], + "mentions": [], + "mention_roles": [], + "pinned": false, + "mention_everyone": false, + "tts": false, + "timestamp": "2020-02-16T00:17:19.004000+00:00", + "edited_timestamp": null, + "flags": 0 + } +] diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOA b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOA new file mode 100644 index 0000000..a332d6c --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOA @@ -0,0 +1,87 @@ +{ + "id": "678348980639498428", + "name": "SourceCred Test Server", + "icon": null, + "description": null, + "splash": null, + "discovery_splash": null, + "features": [], + "emojis": [ + { + "name": "sourcecred", + "roles": [], + "id": "678399364418502669", + "require_colons": true, + "managed": false, + "animated": false, + "available": true + } + ], + "banner": null, + "owner_id": "143776454050709505", + "application_id": null, + "region": "us-south", + "afk_channel_id": null, + "afk_timeout": 300, + "system_channel_id": "678348980849213472", + "widget_enabled": false, + "widget_channel_id": null, + "verification_level": 0, + "roles": [ + { + "id": "678348980639498428", + "name": "@everyone", + "permissions": 33620992, + "position": 0, + "color": 0, + "hoist": false, + "managed": false, + "mentionable": false + }, + { + "id": "678349848684003359", + "name": "allow-adding-data", + "permissions": 104324673, + "position": 1, + "color": 2123412, + "hoist": false, + "managed": false, + "mentionable": false + }, + { + "id": "678350026946117694", + "name": "admins", + "permissions": 104324681, + "position": 2, + "color": 15105570, + "hoist": false, + "managed": false, + "mentionable": false + }, + { + "id": "678359229433905152", + "name": "CredBot-Beanow", + "permissions": 66560, + "position": 1, + "color": 0, + "hoist": false, + "managed": true, + "mentionable": false + } + ], + "default_message_notifications": 1, + "mfa_level": 0, + "explicit_content_filter": 0, + "max_presences": null, + "max_members": 250000, + "max_video_channel_users": 25, + "vanity_url_code": null, + "premium_tier": 0, + "premium_subscription_count": 0, + "system_channel_flags": 0, + "preferred_locale": "en-US", + "rules_channel_id": null, + "public_updates_channel_id": null, + "embed_enabled": false, + "embed_channel_id": null +} diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9jaGFubmVscw b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9jaGFubmVscw new file mode 100644 index 0000000..e3a7638 --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9jaGFubmVscw @@ -0,0 +1,73 @@ +[ + { + "id": "678348980756938813", + "type": 4, + "name": "Text Channels", + "position": 0, + "parent_id": null, + "guild_id": "678348980639498428", + "permission_overwrites": [], + "nsfw": false + }, + { + "id": "678348980798881844", + "type": 4, + "name": "Voice Channels", + "position": 0, + "parent_id": null, + "guild_id": "678348980639498428", + "permission_overwrites": [], + "nsfw": false + }, + { + "id": "678348980849213472", + "last_message_id": "678697350385893404", + "type": 0, + "name": "general", + "position": 0, + "parent_id": "678348980756938813", + "topic": null, + "guild_id": "678348980639498428", + "permission_overwrites": [], + "nsfw": false, + "rate_limit_per_user": 0 + }, + { + "id": "678348980878573661", + "type": 2, + "name": "General", + "position": 0, + "parent_id": "678348980798881844", + "bitrate": 64000, + "user_limit": 0, + "guild_id": "678348980639498428", + "permission_overwrites": [], + "nsfw": false + }, + { + "id": "678394406507905129", + "last_message_id": "696003686320832643", + "type": 0, + "name": "pagination", + "position": 1, + "parent_id": "678348980756938813", + "topic": "A known length of messages to test pagination.", + "guild_id": "678348980639498428", + "permission_overwrites": [], + "nsfw": false, + "rate_limit_per_user": 0 + }, + { + "id": "678696874869522446", + "last_message_id": "678698977100824587", + "type": 0, + "name": "notmymessage", + "position": 2, + "parent_id": "678348980756938813", + "topic": "Reactions to messages which aren't our own.", + "guild_id": "678348980639498428", + "permission_overwrites": [], + "nsfw": false, + "rate_limit_per_user": 0 + } +] diff --git a/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9tZW1iZXJzP2FmdGVyPTAmbGltaXQ9NQ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9tZW1iZXJzP2FmdGVyPTAmbGltaXQ9NQ new file mode 100644 index 0000000..da4ba9c --- /dev/null +++ b/src/plugins/discord/snapshots/aHR0cHM6Ly9kaXNjb3JkYXBwLmNvbS9hcGkvZ3VpbGRzLzY3ODM0ODk4MDYzOTQ5ODQyOC9tZW1iZXJzP2FmdGVyPTAmbGltaXQ9NQ @@ -0,0 +1,92 @@ +[ + { + "user": { + "id": "143776454050709505", + "username": "Beanow", + "avatar": "6496446fe1455f31f9536b132dcc4ac8", + "discriminator": "5887", + "public_flags": 0 + }, + "roles": [ + "678349848684003359", + "678350026946117694" + ], + "nick": null, + "premium_since": null, + "mute": false, + "deaf": false, + "joined_at": "2020-02-15T21:16:40.215000+00:00" + }, + { + "user": { + "id": "420341518948237331", + "username": "decentralion", + "avatar": "a70b70bc0471e6a1efe5124c39c76020", + "discriminator": "8636", + "public_flags": 0 + }, + "roles": [ + "678349848684003359", + "678350026946117694" + ], + "nick": null, + "premium_since": null, + "mute": false, + "deaf": false, + "joined_at": "2020-02-15T22:31:31.243000+00:00" + }, + { + "user": { + "id": "432981598858903585", + "username": "wchargin", + "avatar": "012988df3eab485878fd588696097802", + "discriminator": "8658", + "public_flags": 0 + }, + "roles": [ + "678349848684003359", + "678350026946117694" + ], + "nick": null, + "premium_since": null, + "mute": false, + "deaf": false, + "joined_at": "2020-02-15T22:21:55.613000+00:00" + }, + { + "user": { + "id": "439050857921904640", + "username": "Brian Litwin", + "avatar": "1cc439c3506ede04a77be8105d934df4", + "discriminator": "2386", + "public_flags": 0 + }, + "roles": [ + "678349848684003359", + "678350026946117694" + ], + "nick": null, + "premium_since": null, + "mute": false, + "deaf": false, + "joined_at": "2020-02-16T00:45:23.478000+00:00" + }, + { + "user": { + "id": "678351352770068560", + "username": "CredBot-Beanow", + "avatar": "6f5b83041061a114c9f0fb26b863622c", + "discriminator": "1705", + "public_flags": 0, + "bot": true + }, + "roles": [ + "678359229433905152" + ], + "nick": null, + "premium_since": null, + "mute": false, + "deaf": false, + "joined_at": "2020-02-15T21:57:23.609000+00:00" + } +] diff --git a/src/plugins/discord/update_discord_api_snapshots.sh b/src/plugins/discord/update_discord_api_snapshots.sh new file mode 100755 index 0000000..d828b32 --- /dev/null +++ b/src/plugins/discord/update_discord_api_snapshots.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -eu + +snapshots_dir=src/plugins/discord/snapshots +test_instance_url="https://discordapp.com/api" + +if [ ! "$(jq --version)" ]; then + printf >&2 'This script depends on jq. Please install it.\n' + exit 1 +fi + +if [ -z "${SOURCECRED_DISCORD_BOT_TOKEN:-}" ]; then + printf >&2 "Please set the SOURCECRED_DISCORD_TOKEN environment variable.\n" + exit 1 +fi + +toplevel="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)" +cd "${toplevel}" + +fetch() { + url="${test_instance_url}$1" + filename="$(printf '%s' "${url}" | base64 -w 0 | tr -d '=' | tr '/+' '_-')" + path="${snapshots_dir}/${filename}" + curl -sfL "$url" \ + -H "Accept: application/json" \ + -H "Authorization: Bot ${SOURCECRED_DISCORD_BOT_TOKEN}" \ + | jq '.' > "${path}" +} + +rm -r "${snapshots_dir}" +mkdir "${snapshots_dir}" +fetch "/guilds/678348980639498428" +fetch "/guilds/678348980639498428/channels" +fetch "/guilds/678348980639498428/members?after=0&limit=5" +fetch "/channels/678348980849213472/messages?after=0&limit=5" +fetch "/channels/678394406507905129/messages?after=0&limit=5" +fetch "/channels/678394406507905129/messages?after=678394436757094410&limit=5" +fetch "/channels/678394406507905129/messages?after=678394455849566208&limit=5" +fetch "/channels/678348980849213472/messages/678697350385893404/reactions/sourcecred:678399364418502669?after=0&limit=5"