From 5095a254aa7f1da44f257a77a2b9b655e954116e Mon Sep 17 00:00:00 2001 From: pocketjawa Date: Sat, 3 Mar 2018 01:21:47 -0500 Subject: [PATCH] Added skip command for JawaFM --- helpcommand.txt | 3 ++- pocketbot.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/helpcommand.txt b/helpcommand.txt index d2809bd..967d8cd 100644 --- a/helpcommand.txt +++ b/helpcommand.txt @@ -21,4 +21,5 @@ **!conch** or **!magicconch**: Same as the 8ball command but waaaaay cooler! :shell: **!giveaway prize**: Do a giveaway based on users reacting with the emoji you react with secretly. Use in private and replace prize with an actual prize! **!np**: Posts currently playing info for ToukuFM. -**!roll**: Rolls any number of dice! Use like `!roll d20`, `!roll 2d6`, or `!roll 3d6 d20` \ No newline at end of file +**!roll**: Rolls any number of dice! Use like `!roll d20`, `!roll 2d6`, or `!roll 3d6 d20` +**!fmskip station**: Tells LiquidSoap to skip the currently playing track on **station** on JawaFM. \ No newline at end of file diff --git a/pocketbot.py b/pocketbot.py index 9ed4038..cefbf04 100644 --- a/pocketbot.py +++ b/pocketbot.py @@ -10,6 +10,7 @@ import os import requests import json import re +import telnetlib #Get script location cwd = os.path.dirname(os.path.realpath(__file__)) @@ -331,6 +332,18 @@ def on_message(message): #Send output to chat yield from client.send_message(message.channel, output) + #Skip tracks/mixes on JawaFM + elif message.content.lower().startswith('!fmskip'): + args = message.content.partition(' ')[2] + station = args.partition(' ')[0] + if (station is ''): + yield from client.send_message(message.channel, 'Please provide a station to skip.') + else: + skipcommand = station + '(dot)ogg.skip\n' + tn = telnetlib.Telnet("localhost", 1234) + tn.write(skipcommand.encode('ascii')) + tn.close() + client.loop.create_task(ups_check())