added curse
This commit is contained in:
parent
9a3052e9cb
commit
1e0b06f437
@ -2,14 +2,34 @@
|
||||
#include "message.h"
|
||||
#include <QTimer>
|
||||
#include <time.h>
|
||||
#include "user.h"
|
||||
|
||||
#define VOY_NONE -1
|
||||
enum{VOY_A, VOY_E, VOY_I, VOY_O, VOY_U, VOY_ET, VOY_AI, VOY_OU, VOY_IN, VOY_ON, VOY_OI, VOY_EN, VOY_OUILLE, VOY_ATTE, VOY_US};
|
||||
|
||||
bool PoilAuModule::messageHandler(Message msg)
|
||||
{
|
||||
if(msg.args.startsWith("!curse ") == 0 && getUsers()->getFromNick(msg.nick)->isOp())
|
||||
{
|
||||
QStringList str = msg.args.split(' ');
|
||||
if(str.size() == 2)
|
||||
{
|
||||
setCursed(str[1]);
|
||||
answer = say(QString("%1 is now the cursed").arg(str[1]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(msg.command.compare("NICK", Qt::CaseInsensitive) == 0 && msg.nick.compare(cursedNick) == 0)
|
||||
{
|
||||
setCursed(msg.args);
|
||||
answer = say(QString("%1 is now the cursed").arg(msg.args));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg.args.startsWith("!")) return false;
|
||||
if(!isReady)
|
||||
bool cursed = (cursedNick.compare(msg.nick) == 0);
|
||||
if(!isReady && !cursed)
|
||||
return false;
|
||||
if(msg.command.compare(QString("PRIVMSG"), Qt::CaseInsensitive) != 0)
|
||||
return false;
|
||||
@ -173,6 +193,10 @@ void PoilAuModule::setReady()
|
||||
isReady = true;
|
||||
}
|
||||
|
||||
void PoilAuModule::setCursed(QString nick)
|
||||
{
|
||||
cursedNick = nick;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -9,14 +9,16 @@ class PoilAuModule : public QObject, public Module
|
||||
Q_OBJECT
|
||||
|
||||
bool isReady;
|
||||
QString cursedNick;
|
||||
public:
|
||||
PoilAuModule() : isReady(true) {}
|
||||
PoilAuModule() : isReady(true), cursedNick("CaptainPlop") {}
|
||||
|
||||
virtual bool messageHandler(Message msg);
|
||||
virtual QString getName();
|
||||
|
||||
public slots:
|
||||
void setReady();
|
||||
void setCursed(QString);
|
||||
};
|
||||
|
||||
#endif // POILAUMODULE_H
|
||||
|
@ -69,6 +69,9 @@ bool PunisherModule::messageHandler(Message msg)
|
||||
return true;
|
||||
}
|
||||
|
||||
if(msg.nick.compare("LadySparrow") == 0)
|
||||
return false;
|
||||
|
||||
for(const QString &w : forbidden_words)
|
||||
{
|
||||
if(msg.args.contains(w, Qt::CaseInsensitive))
|
||||
|
Loading…
x
Reference in New Issue
Block a user