Add .re command
This commit is contained in:
parent
a4d803f305
commit
0d5f7069a0
11
ubot.py
11
ubot.py
@ -134,6 +134,16 @@ async def edit(event):
|
||||
for i in range(0,cnt):
|
||||
await event.respond(msg)
|
||||
|
||||
if msg.startswith('.re'):
|
||||
import os
|
||||
|
||||
regex = str(msg.split(' ', 1)[1])
|
||||
inmsg = await event.get_reply_message()
|
||||
outmsg = os.popen('echo "' + str(inmsg.text) + '" | sed "' + regex + '"').read()
|
||||
rpl = f'`{regex}`\n'
|
||||
rpl += f'{outmsg}\n'
|
||||
await event.edit(rpl)
|
||||
|
||||
if msg.startswith('.sauce'):
|
||||
rpl = 'Sauce: [ghnou/ubot](https://git.nixmagic.com/ghnou/ubot)'
|
||||
await event.edit(rpl)
|
||||
@ -148,6 +158,7 @@ async def edit(event):
|
||||
rpl += '.sh - Execute a shell command.\n'
|
||||
rpl += '.sys - Show system information.\n'
|
||||
rpl += '.spam - Spam messages.. yea.\n'
|
||||
rpl += '.re - s/foo/bar/\n'
|
||||
rpl += '.sauce - Get the bot\'s source code.\n'
|
||||
rpl += '.help - Show this help message.\n'
|
||||
await event.edit(rpl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user