backport automatic module name detection
This commit is contained in:
parent
ee1240b818
commit
2179c2770a
2 changed files with 4 additions and 3 deletions
5
bot.py
5
bot.py
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import asyncio, os, importlib
|
||||
import asyncio, os, importlib, inspect
|
||||
|
||||
from irctokens import build, Line
|
||||
from ircrobots import Bot as BaseBot
|
||||
|
@ -41,7 +41,8 @@ def rawm(rname):
|
|||
|
||||
|
||||
|
||||
async def message(self,modname,channel,msg):
|
||||
async def message(self,channel,msg):
|
||||
modname = os.path.splittext(os.path.basename(inspect.stack()[1].filename))[0]
|
||||
await self.send(build("PRIVMSG",[channel,f'[\x036{modname}\x0f] {msg}']))
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import bot
|
|||
@bot.command('test')
|
||||
@bot.is_admin
|
||||
async def testy(self,channel,nick,msg):
|
||||
await bot.message(self,'test',channel,'hi there')
|
||||
await bot.message(self,channel,'hi there')
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue