-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgameserv.cpp
56 lines (47 loc) · 1.28 KB
/
gameserv.cpp
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
49
50
51
52
53
54
55
56
/* GameServ core functions
*
* (C) 2019 Michael Hazell
* Contact me at michaelhazell@hotmail.com
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#include "module.h"
class GameServCore : public Module
{
Reference<BotInfo> GameServ;
public:
GameServCore(const Anope::string& modname, const Anope::string& creator) : Module(modname, creator, PSEUDOCLIENT | THIRD)
{
if(!IRCD)
{
throw ModuleException("IRCd protocol module not loaded");
}
}
void OnReload(Configuration::Conf* conf) anope_override
{
const Anope::string& gsnick = conf->GetModule(this)->Get<const Anope::string>("client");
if (gsnick.empty())
{
throw ConfigException(Module::name + ": <client> must be defined");
}
BotInfo* bi = BotInfo::Find(gsnick, true);
if (!bi)
{
throw ConfigException(Module::name + ": no bot named " + gsnick);
}
GameServ = bi;
}
EventReturn OnPreHelp(CommandSource& source, const std::vector<Anope::string>& params) anope_override
{
if (!params.empty() || source.c || source.service != *GameServ)
{
return EVENT_CONTINUE;
}
source.Reply(_("%s commands:"), GameServ->nick.c_str());
return EVENT_CONTINUE;
}
};
MODULE_INIT(GameServCore)