fix triggers
This commit is contained in:
parent
c65bfa0c7d
commit
847d5ae7e9
1 changed files with 26 additions and 8 deletions
|
@ -97,22 +97,31 @@ async def addalias(self,c,n,m):
|
||||||
async def addot(self,c,n,m):
|
async def addot(self,c,n,m):
|
||||||
al = m.split(' ')[0]
|
al = m.split(' ')[0]
|
||||||
m = m[len(al)+1:] # dont use the list since i want trailing spaces
|
m = m[len(al)+1:] # dont use the list since i want trailing spaces
|
||||||
if al in self.rawm:
|
if al in shared.rawm:
|
||||||
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
|
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
|
||||||
return
|
return
|
||||||
self.rawm[al]=Ot(m,al).ot
|
shared.rawm[al]=Ot(m,al).ot
|
||||||
|
|
||||||
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
|
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
|
||||||
|
|
||||||
|
|
||||||
|
async def addspook(self,c,n,m):
|
||||||
|
al = m.split(' ')[0]
|
||||||
|
m = m[len(al)+1:] # dont use the list since i want trailing spaces
|
||||||
|
if al in shared.rawm:
|
||||||
|
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
|
||||||
|
return
|
||||||
|
shared.rawm[al]=Spook(m,al).spook
|
||||||
|
|
||||||
|
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
|
||||||
|
|
||||||
async def addtrigger(self,c,n,m):
|
async def addtrigger(self,c,n,m):
|
||||||
al = m.split(' ')[0]
|
al = m.split(' ')[0]
|
||||||
m = m[len(al)+1:] # dont use the list since i want trailing spaces
|
m = m[len(al)+1:] # dont use the list since i want trailing spaces
|
||||||
if al in self.rawm:
|
if al in shared.rawm:
|
||||||
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
|
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
|
||||||
return
|
return
|
||||||
self.rawm[al]=Trigger(m,al).trigger
|
shared.rawm[al]=Trigger(m,al).trigger
|
||||||
|
|
||||||
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
|
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
|
||||||
|
|
||||||
|
@ -124,10 +133,18 @@ class Ot():
|
||||||
self.al = str(al)
|
self.al = str(al)
|
||||||
async def ot(alself,self,c,n,m):
|
async def ot(alself,self,c,n,m):
|
||||||
if alself.al in m and n != self.nickname:
|
if alself.al in m and n != self.nickname:
|
||||||
asyncio.create_task(self.on_message(c,n,alself.ms.format(m)))
|
asyncio.create_task(self.on_privmsg(build("PRIVMSG",[c,alself.ms.format(m)],n+'!spoof@spoof')))
|
||||||
self.rawm.pop(alself.al)
|
shared.rawm.pop(alself.al)
|
||||||
|
|
||||||
|
|
||||||
|
class Spook():
|
||||||
|
def __init__(self, ms, al):
|
||||||
|
self.ms = str(ms)
|
||||||
|
self.al = str(al)
|
||||||
|
async def spook(alself,self,c,n,m):
|
||||||
|
if alself.al in m and n != self.nickname:
|
||||||
|
asyncio.create_task(self.message(c,alself.ms.format(m)))
|
||||||
|
shared.rawm.pop(alself.al)
|
||||||
|
|
||||||
|
|
||||||
class Trigger():
|
class Trigger():
|
||||||
|
@ -136,14 +153,14 @@ class Trigger():
|
||||||
self.al = str(al)
|
self.al = str(al)
|
||||||
async def trigger(alself,self,c,n,m):
|
async def trigger(alself,self,c,n,m):
|
||||||
if alself.al in m:
|
if alself.al in m:
|
||||||
asyncio.create_task(self.on_message(c,n,alself.ms.format(m)))
|
asyncio.create_task(self.on_privmsg(build("PRIVMSG",[c,alself.ms.format(m)],n+'!spoof@spoof')))
|
||||||
|
|
||||||
|
|
||||||
class Alias():
|
class Alias():
|
||||||
def __init__(self, ms):
|
def __init__(self, ms):
|
||||||
self.ms = str(ms)
|
self.ms = str(ms)
|
||||||
async def alias(alself,self,c,n,m):
|
async def alias(alself,self,c,n,m):
|
||||||
asyncio.create_task(self.on_message(c,n,alself.ms.format(m)))
|
asyncio.create_task(self.on_privmsg(build("PRIVMSG",[c,alself.ms.format(m)],n+'!spoof@spoof')))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +177,7 @@ commands = {
|
||||||
'addalias': addalias,
|
'addalias': addalias,
|
||||||
'addtrigger': addtrigger,
|
'addtrigger': addtrigger,
|
||||||
'addot': addot,
|
'addot': addot,
|
||||||
|
'addspook': addspook,
|
||||||
}
|
}
|
||||||
|
|
||||||
@command('admin')
|
@command('admin')
|
||||||
|
|
Loading…
Reference in a new issue