-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchat.h
More file actions
48 lines (38 loc) · 1.31 KB
/
chat.h
File metadata and controls
48 lines (38 loc) · 1.31 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
// Maybe redundant to Twitch API.
#include "level.h"
#include "quesoqueue.h"
#include "obs_text_source.h"
#include "timer.h"
#include <string>
#include <sstream>
#include <functional>
#include <map>
#include "chips.h"
class Chat {
public:
Chat(const QuesoQueue &qq, const Timer &timer, const ObsTextSource &textSource);
void HandleMessage(std::stringstream message, std::string sender);
void WriteMessage(std::string message);
void Write(std::string command);
void Connect();
void Listen();
private:
std::string NextLevelMessage(std::optional<Level> l);
std::string CurrentLevelMessage(std::optional<Level> l);
std::string PositionMessage(int position, std::string requestor);
std::string LevelListMessage(std::optional<Level> current, PriorityQueso list);
static std::string GetRemainder(std::stringstream &message);
bool _canAddToQueue = false;
QuesoQueue _qq;
Timer _timer;
ObsTextSource _textSource;
std::string _priorityText;
std::string _server = "irc.chat.twitch.tv";
unsigned short _port = 6667;
std::string _nick = "quesoqueue";
int _sockHandle;
std::string _help =
"Try these: !add ABC-DEF-GHI | !remove | !current | !list | !position";
std::unordered_map<std::string_view, ChipContainer> _commandMap;
};