juju/plugins/admin.py

23 lines
885 B
Python
Raw Normal View History

2023-06-26 15:31:30 +00:00
#!/usr/bin/python3
import pinhook.plugin
import util.tilde
@pinhook.plugin.command('&eval', help_text='Evaluates a string in the bot', ops=True, ops_msg='This command is ops only for safety reasons')
def eval_cmd(msg):
if msg.nick in msg.ops:
try:
def r(txt): msg.privmsg(msg.channel,str(txt))
return pinhook.plugin.message(str(eval(msg.arg)))
except Exception as e:
return pinhook.plugin.message('error {}'.format(e))
@pinhook.plugin.command('&exec', help_text='Executes a string in the bot', ops=True, ops_msg='This command is ops only for safety reasons')
def exec_cmd(msg):
try:
def r(txt): msg.privmsg(msg.channel,str(txt))
exec(msg.arg)
return False #pinhook.plugin.message('executed {}'.format(msg.arg))
except Exception as e:
return pinhook.plugin.message('error {}'.format(e))