aegis.cpp
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
message_create.hpp
1 //
2 // message_create.hpp
3 // ******************
4 //
5 // Copyright (c) 2019 Sharon W (sharon at aegis dot gg)
6 //
7 // Distributed under the MIT License. (See accompanying file LICENSE)
8 //
9 
10 #pragma once
11 
12 #include "aegis/config.hpp"
13 #include "aegis/fwd.hpp"
14 #include "aegis/snowflake.hpp"
15 #include "aegis/gateway/objects/message.hpp"
16 #include "aegis/error.hpp"
17 
18 namespace aegis
19 {
20 
21 namespace gateway
22 {
23 
24 namespace events
25 {
26 
30 {
32  lib::optional<std::reference_wrapper<aegis::user>> user;
36  bool has_user() const noexcept
37  {
38  return user.has_value();
39  }
40  aegis::user & get_user() const
41  {
42  if (has_user())
43  return user.value().get();
44 #if defined(AEGIS_HAS_BUILTIN_OPTIONAL)
45  throw lib::bad_optional_access("bad optional access");
46 #else
47  throw lib::bad_optional_access();
48 #endif
49  }
50 };
51 
52 }
53 
54 }
55 
56 }
objects::message msg
Definition: message_create.hpp:34
aegis::channel & channel
Definition: message_create.hpp:33
Definition: message.hpp:57
Class for performing actions pertaining to a specified channel.
Definition: channel.hpp:170
Stores user-specific and guild-specific attributes of users.
Definition: user.hpp:37
Definition: message_create.hpp:29
lib::optional< std::reference_wrapper< aegis::user > > user
Definition: message_create.hpp:32
Tracks websocket shards and their connections.
Definition: shard.hpp:42
shards::shard & shard
Definition: message_create.hpp:31