mirror of
https://github.com/anope/anope.git
synced 2026-07-05 23:33:12 +02:00
Send replies from fantasy commands back to the channel, this will be expanded on later
This commit is contained in:
+56
-55
@@ -17,7 +17,7 @@
|
||||
class CommandBSInfo : public Command
|
||||
{
|
||||
private:
|
||||
void send_bot_channels(User *u, BotInfo *bi)
|
||||
void send_bot_channels(CommandSource &source, BotInfo *bi)
|
||||
{
|
||||
Anope::string buf;
|
||||
for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
|
||||
@@ -28,7 +28,7 @@ class CommandBSInfo : public Command
|
||||
{
|
||||
if (buf.length() + ci->name.length() > 300)
|
||||
{
|
||||
u->SendMessage(Config->s_BotServ, "%s", buf.c_str());
|
||||
source.Reply("%s", buf.c_str());
|
||||
buf.clear();
|
||||
}
|
||||
buf += " " + ci->name + " ";
|
||||
@@ -36,7 +36,7 @@ class CommandBSInfo : public Command
|
||||
}
|
||||
|
||||
if (!buf.empty())
|
||||
u->SendMessage(Config->s_BotServ, "%s", buf.c_str());
|
||||
source.Reply("%s", buf.c_str());
|
||||
return;
|
||||
}
|
||||
public:
|
||||
@@ -45,159 +45,160 @@ class CommandBSInfo : public Command
|
||||
this->SetFlag(CFLAG_STRIP_CHANNEL);
|
||||
}
|
||||
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
BotInfo *bi;
|
||||
ChannelInfo *ci;
|
||||
Anope::string query = params[0];
|
||||
const Anope::string &query = params[0];
|
||||
|
||||
int need_comma = 0;
|
||||
bool need_comma = false;
|
||||
char buf[BUFSIZE], *end;
|
||||
|
||||
if ((bi = findbot(query)))
|
||||
User *u = source.u;
|
||||
BotInfo *bi = findbot(query);
|
||||
ChannelInfo *ci;
|
||||
if (bi)
|
||||
{
|
||||
u->SendMessage(BotServ, BOT_INFO_BOT_HEADER, bi->nick.c_str());
|
||||
u->SendMessage(BotServ, BOT_INFO_BOT_MASK, bi->GetIdent().c_str(), bi->host.c_str());
|
||||
u->SendMessage(BotServ, BOT_INFO_BOT_REALNAME, bi->realname.c_str());
|
||||
u->SendMessage(BotServ, BOT_INFO_BOT_CREATED, do_strftime(bi->created).c_str());
|
||||
u->SendMessage(BotServ, BOT_INFO_BOT_OPTIONS, GetString(u, (bi->HasFlag(BI_PRIVATE) ? NICK_INFO_OPT_PRIVATE : NICK_INFO_OPT_NONE)).c_str());
|
||||
u->SendMessage(BotServ, BOT_INFO_BOT_USAGE, bi->chancount);
|
||||
source.Reply(BOT_INFO_BOT_HEADER, bi->nick.c_str());
|
||||
source.Reply(BOT_INFO_BOT_MASK, bi->GetIdent().c_str(), bi->host.c_str());
|
||||
source.Reply(BOT_INFO_BOT_REALNAME, bi->realname.c_str());
|
||||
source.Reply(BOT_INFO_BOT_CREATED, do_strftime(bi->created).c_str());
|
||||
source.Reply(BOT_INFO_BOT_OPTIONS, GetString(u, (bi->HasFlag(BI_PRIVATE) ? NICK_INFO_OPT_PRIVATE : NICK_INFO_OPT_NONE)).c_str());
|
||||
source.Reply(BOT_INFO_BOT_USAGE, bi->chancount);
|
||||
|
||||
if (u->Account()->HasPriv("botserv/administration"))
|
||||
this->send_bot_channels(u, bi);
|
||||
this->send_bot_channels(source, bi);
|
||||
}
|
||||
else if ((ci = cs_findchan(query)))
|
||||
{
|
||||
if (!check_access(u, ci, CA_FOUNDER) && !u->Account()->HasPriv("botserv/administration"))
|
||||
{
|
||||
u->SendMessage(BotServ, ACCESS_DENIED);
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
u->SendMessage(BotServ, CHAN_INFO_HEADER, ci->name.c_str());
|
||||
source.Reply(CHAN_INFO_HEADER, ci->name.c_str());
|
||||
if (ci->bi)
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_BOT, ci->bi->nick.c_str());
|
||||
source.Reply(BOT_INFO_CHAN_BOT, ci->bi->nick.c_str());
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_BOT_NONE);
|
||||
source.Reply(BOT_INFO_CHAN_BOT_NONE);
|
||||
|
||||
if (ci->botflags.HasFlag(BS_KICK_BADWORDS))
|
||||
{
|
||||
if (ci->ttb[TTB_BADWORDS])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_BADWORDS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_BADWORDS]);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_BADWORDS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_BADWORDS]);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_BADWORDS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_BADWORDS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_BADWORDS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_BADWORDS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_BOLDS))
|
||||
{
|
||||
if (ci->ttb[TTB_BOLDS])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_BOLDS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_BOLDS]);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_BOLDS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_BOLDS]);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_BOLDS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_BOLDS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_BOLDS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_BOLDS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_CAPS))
|
||||
{
|
||||
if (ci->ttb[TTB_CAPS])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_CAPS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_CAPS], ci->capsmin, ci->capspercent);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_CAPS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_CAPS], ci->capsmin, ci->capspercent);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_CAPS_ON, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->capsmin, ci->capspercent);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_CAPS_ON, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->capsmin, ci->capspercent);
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_CAPS_OFF, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_CAPS_OFF, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_COLORS))
|
||||
{
|
||||
if (ci->ttb[TTB_COLORS])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_COLORS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_COLORS]);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_COLORS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_COLORS]);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_COLORS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_COLORS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_COLORS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_COLORS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_FLOOD))
|
||||
{
|
||||
if (ci->ttb[TTB_FLOOD])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_FLOOD_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_FLOOD], ci->floodlines, ci->floodsecs);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_FLOOD_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_FLOOD], ci->floodlines, ci->floodsecs);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_FLOOD_ON, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->floodlines, ci->floodsecs);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_FLOOD_ON, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->floodlines, ci->floodsecs);
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_FLOOD_OFF, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_FLOOD_OFF, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_REPEAT))
|
||||
{
|
||||
if (ci->ttb[TTB_REPEAT])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_REPEAT_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_REPEAT], ci->repeattimes);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_REPEAT_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_REPEAT], ci->repeattimes);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_REPEAT_ON, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->repeattimes);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_REPEAT_ON, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->repeattimes);
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_REPEAT_OFF, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_REPEAT_OFF, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_REVERSES))
|
||||
{
|
||||
if (ci->ttb[TTB_REVERSES])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_REVERSES_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_REVERSES]);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_REVERSES_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_REVERSES]);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_REVERSES, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_REVERSES, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_REVERSES, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_REVERSES, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_UNDERLINES))
|
||||
{
|
||||
if (ci->ttb[TTB_UNDERLINES])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_UNDERLINES_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_UNDERLINES]);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_UNDERLINES_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_UNDERLINES]);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_UNDERLINES, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_UNDERLINES, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_UNDERLINES, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_UNDERLINES, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
if (ci->botflags.HasFlag(BS_KICK_ITALICS))
|
||||
{
|
||||
if (ci->ttb[TTB_ITALICS])
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_ITALICS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_ITALICS]);
|
||||
source.Reply(BOT_INFO_CHAN_KICK_ITALICS_BAN, GetString(u, BOT_INFO_ACTIVE).c_str(), ci->ttb[TTB_ITALICS]);
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_ITALICS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_ITALICS, GetString(u, BOT_INFO_ACTIVE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_KICK_ITALICS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_KICK_ITALICS, GetString(u, BOT_INFO_INACTIVE).c_str());
|
||||
|
||||
end = buf;
|
||||
*end = 0;
|
||||
if (ci->botflags.HasFlag(BS_DONTKICKOPS))
|
||||
{
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s", GetString(u, BOT_INFO_OPT_DONTKICKOPS).c_str());
|
||||
need_comma = 1;
|
||||
need_comma = true;
|
||||
}
|
||||
if (ci->botflags.HasFlag(BS_DONTKICKVOICES))
|
||||
{
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", GetString(u, BOT_INFO_OPT_DONTKICKVOICES).c_str());
|
||||
need_comma = 1;
|
||||
need_comma = true;
|
||||
}
|
||||
if (ci->botflags.HasFlag(BS_FANTASY))
|
||||
{
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", GetString(u, BOT_INFO_OPT_FANTASY).c_str());
|
||||
need_comma = 1;
|
||||
need_comma = true;
|
||||
}
|
||||
if (ci->botflags.HasFlag(BS_GREET))
|
||||
{
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", GetString(u, BOT_INFO_OPT_GREET).c_str());
|
||||
need_comma = 1;
|
||||
need_comma = true;
|
||||
}
|
||||
if (ci->botflags.HasFlag(BS_NOBOT))
|
||||
{
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", GetString(u, BOT_INFO_OPT_NOBOT).c_str());
|
||||
need_comma = 1;
|
||||
need_comma = true;
|
||||
}
|
||||
if (ci->botflags.HasFlag(BS_SYMBIOSIS))
|
||||
{
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", GetString(u, BOT_INFO_OPT_SYMBIOSIS).c_str());
|
||||
need_comma = 1;
|
||||
need_comma = true;
|
||||
}
|
||||
u->SendMessage(BotServ, BOT_INFO_CHAN_OPTIONS, *buf ? buf : GetString(u, BOT_INFO_OPT_NONE).c_str());
|
||||
source.Reply(BOT_INFO_CHAN_OPTIONS, *buf ? buf : GetString(u, BOT_INFO_OPT_NONE).c_str());
|
||||
}
|
||||
else
|
||||
u->SendMessage(BotServ, BOT_INFO_NOT_FOUND, query.c_str());
|
||||
source.Reply(BOT_INFO_NOT_FOUND, query.c_str());
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user