forked from coin-au-carre/slacking
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05-channels.cpp
More file actions
30 lines (21 loc) · 824 Bytes
/
05-channels.cpp
File metadata and controls
30 lines (21 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "slacking.hpp"
#include <fstream>
int main() {
// Load the token from a file. You can also specify directly the token in your code as a string.
std::string mytoken;
std::ifstream infile("token.txt");
std::getline(infile, mytoken);
slack::create(mytoken);
// You can display all the JSON response
std::cout << slack::instance().channels.list() << std::endl;
// You can display filtered informations
auto channels = slack::channels().list_magic();
std::cout << channels << '\n';
// Iterate on channels
for (auto const& channel : channels) {
std::cout << channel.name << std::endl;
}
// Get precise informations on a specific channel
auto channel_id = channels[0].id;
std::cout << slack::channels().info(channel_id) << std::endl;
}