fix a few things

This commit is contained in:
root 2020-02-08 17:55:20 +02:00
parent a805472f47
commit 4a3d98849f
2 changed files with 9 additions and 5 deletions

View File

@ -2,6 +2,10 @@
How to use: How to use:
`!paste <text>` will paste text to your PrivateBin instance `!paste <text>` will create a paste that expires in 24 hours
`!bpaste <text>` will create a one-time paste
`!get <pasteid>#<password>` will retrieve a given paste `!get <pasteid>#<password>` will retrieve a given paste
`!echo <text>` will echo your message back `!echo <text>` will echo your message back

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys
@ -33,12 +33,12 @@ class PBBot(sleekxmpp.ClientXMPP):
if msg['type'] in ('chat', 'normal'): if msg['type'] in ('chat', 'normal'):
if "!paste" in msg['body']: if "!paste" in msg['body']:
arg = msg['body'].replace('!paste', '').strip() arg = msg['body'].replace('!paste', '').strip()
output = subprocess.check_output(['/bin/env', 'pbincli', \ output = subprocess.check_output(['env', 'pbincli', \
'send', '--text', arg]).decode('utf-8') 'send', '--text', arg]).decode('utf-8')
msg.reply(output).send() msg.reply(output).send()
elif "!bpaste" in msg['body']: elif "!bpaste" in msg['body']:
arg = msg['body'].replace('!paste', '').strip() arg = msg['body'].replace('!paste', '').strip()
output = subprocess.check_output(['/bin/env', 'pbincli', \ output = subprocess.check_output(['env', 'pbincli', \
'send', '-B', '--text', arg]).decode('utf-8') 'send', '-B', '--text', arg]).decode('utf-8')
msg.reply(output).send() msg.reply(output).send()
elif "!get" in msg['body']: elif "!get" in msg['body']:
@ -50,7 +50,7 @@ class PBBot(sleekxmpp.ClientXMPP):
arg = msg['body'].replace('!echo', '').strip() arg = msg['body'].replace('!echo', '').strip()
msg.reply("Thanks for sending\n" + arg).send() msg.reply("Thanks for sending\n" + arg).send()
else: else:
msg.reply("Commands: paste echo get").send() msg.reply("Commands (prefix with !): paste bpaste echo get").send()
if __name__ == '__main__': if __name__ == '__main__':
# Setup the command line arguments. # Setup the command line arguments.