Class slack_messenger (o2scl)¶
-
class slack_messenger¶
Object to send messages to Slack using curl.
Note
Experimental
Public Functions
-
inline slack_messenger(std::string p_channel = "", std::string p_username = "", std::string p_url = "", bool p_mpi_time = false)¶
Create a messenger object with specified channel, username, URL and time method.
If the URL is not specified, this constructor tries to determine it from the environment variable
O2SCL_SLACK_URL
.
-
inline void set_time_mode(bool loc_mpi_time)¶
Set the time mode (normal or MPI)
-
inline bool set_url_from_env(std::string env_var)¶
Set the Slack webhook URL from the environment variable
env_var
.
-
inline bool set_channel_from_env(std::string env_var)¶
Set the channel from the environment variable
env_var
.
-
inline bool set_username_from_env(std::string env_var)¶
Set the username from the environment variable
env_var
.
-
inline int send(std::string message, bool err_on_fail = true)¶
Send a message.
-
inline int send_image(std::string message, std::string image_url, std::string alt_text, bool err_on_fail = true)¶
Send a message.
Public Members
-
std::string url¶
The URL for the Slack webhook.
-
std::string channel¶
The destination channel.
-
double min_time_between¶
Minimum time between messages in seconds (default 300)
-
std::string icon¶
Icon to use (without colons; default “computer”)
-
std::string username¶
Slack username.
-
int verbose¶
Verbosity parameter (default 1)
-
inline slack_messenger(std::string p_channel = "", std::string p_username = "", std::string p_url = "", bool p_mpi_time = false)¶