anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

bs_autoassign.cpp (727B)

      1 /*
      2  *
      3  * (C) 2003-2022 Anope Team
      4  * Contact us at team@anope.org
      5  *
      6  * Please read COPYING and README for further details.
      7  *
      8  */
      9 
     10 #include "module.h"
     11 
     12 class BSAutoAssign : public Module
     13 {
     14  public:
     15 	BSAutoAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
     16 	{
     17 	}
     18 
     19 	void OnChanRegistered(ChannelInfo *ci) anope_override
     20 	{
     21 		const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string>("bot");
     22 		if (bot.empty())
     23 			return;
     24 
     25 		BotInfo *bi = BotInfo::Find(bot, true);
     26 		if (bi == NULL)
     27 		{
     28 			Log(this) << "bs_autoassign is configured to assign bot " << bot << ", but it does not exist?";
     29 			return;
     30 		}
     31 
     32 		bi->Assign(NULL, ci);
     33 	}
     34 };
     35 
     36 MODULE_INIT(BSAutoAssign)