Remove folder.
This commit is contained in:
parent
1fc6d054ab
commit
c692632303
|
@ -1,16 +0,0 @@
|
|||
MUD Client
|
||||
|
||||
I suppose this also works as telnet client. That's basically all it is at the moment.
|
||||
|
||||
Connect to a MUD over telnet and play over channel/PM. Allows one telnet session per nick so you can play with your IRC friends.
|
||||
MUD not included, there are plenty out there, there is just a client to allow playing them over IRC.
|
||||
|
||||
config plugins.MUD.server (server address)
|
||||
|
||||
config plugins.MUD.port (port)
|
||||
|
||||
MUD join (connect to server/port and print output to current channel)
|
||||
|
||||
MUD m (send text to MUD or newline if blank and return output)
|
||||
|
||||
MUD stop (disconnect the telnet session)
|
|
@ -1,42 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2019 oddluck
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
"""
|
||||
MUD: Play interactive fiction games
|
||||
"""
|
||||
|
||||
import supybot
|
||||
import supybot.world as world
|
||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
||||
# in here if you're keeping the plugin in CVS or some similar system.
|
||||
__version__ = ""
|
||||
|
||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||
__author__ = supybot.Author('oddluck', 'oddluck',
|
||||
'oddluck@riseup.net')
|
||||
|
||||
# This is a dictionary mapping supybot.Author instances to lists of
|
||||
# contributions.
|
||||
__contributors__ = {}
|
||||
|
||||
# This is a url where the most recent plugin package can be downloaded.
|
||||
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
||||
if world.testing:
|
||||
from . import test
|
||||
|
||||
Class = plugin.Class
|
||||
MUD = config.MUD
|
|
@ -1,33 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2019, oddluck
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('MUD')
|
||||
except:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified themself as an advanced
|
||||
# user or not. You should effect your configuration by manipulating the
|
||||
# registry as appropriate.
|
||||
from supybot.questions import expect, anything, something, yn
|
||||
conf.registerPlugin('MUD', True)
|
||||
|
||||
MUD = conf.registerPlugin('MUD')
|
||||
|
||||
conf.registerGlobalValue(MUD, 'server',
|
||||
registry.String('', _("""Server Address""")))
|
||||
|
||||
conf.registerGlobalValue(MUD, 'port',
|
||||
registry.Integer('', _("""Port""")))
|
103
MUD/plugin.py
103
MUD/plugin.py
|
@ -1,103 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2019 oddluck
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
import supybot.utils as utils
|
||||
from supybot.commands import *
|
||||
import supybot.plugins as plugins
|
||||
import supybot.ircutils as ircutils
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
from telnetlib import Telnet
|
||||
import re
|
||||
|
||||
try:
|
||||
from supybot.i18n import PluginInternationalization
|
||||
_ = PluginInternationalization('MUD')
|
||||
except ImportError:
|
||||
# Placeholder that allows to run the plugin on a bot
|
||||
# without the i18n module
|
||||
_ = lambda x: x
|
||||
|
||||
class MUD(callbacks.Plugin):
|
||||
"""
|
||||
Play Infocom (Interactive Fiction, Z_machine) Games.
|
||||
"""
|
||||
threaded = True
|
||||
|
||||
def __init__(self, irc):
|
||||
self.__parent = super(MUD, self)
|
||||
self.__parent.__init__(irc)
|
||||
self.tn = {}
|
||||
self.ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
|
||||
|
||||
def join(self, irc, msg, args):
|
||||
"""
|
||||
Join the MUD
|
||||
"""
|
||||
channel = msg.args[0]
|
||||
nick = msg.nick
|
||||
try:
|
||||
if self.tn[nick]:
|
||||
irc.reply("You already have an open connection. Please stop that connection first.")
|
||||
except:
|
||||
self.tn[nick] = Telnet(self.registryValue('server'), self.registryValue('port'))
|
||||
response = self.output(self.tn[nick])
|
||||
for line in response:
|
||||
if line.strip():
|
||||
irc.reply(line, prefixNick=False)
|
||||
join = wrap(join)
|
||||
|
||||
def m(self, irc, msg, args, input):
|
||||
"""[<input>]
|
||||
Send user input or blank line (ENTER/RETURN) to the game.
|
||||
"""
|
||||
channel = msg.args[0]
|
||||
nick = msg.nick
|
||||
if input:
|
||||
command = input.strip()
|
||||
else:
|
||||
command = None
|
||||
if self.tn[nick]:
|
||||
if command:
|
||||
self.tn[nick].write(command.encode() + b"\r\n")
|
||||
else:
|
||||
self.tn[nick].write(b"\r\n")
|
||||
response = self.output(self.tn[nick])
|
||||
for line in response:
|
||||
if line.strip():
|
||||
irc.reply(line, prefixNick=False)
|
||||
else:
|
||||
irc.reply("Nick not connected?")
|
||||
m = wrap(m, [additional('text')])
|
||||
|
||||
def stop(self, irc, msg, args):
|
||||
"""
|
||||
Stop game.
|
||||
"""
|
||||
channel = msg.args[0]
|
||||
nick = msg.nick
|
||||
try:
|
||||
if self.tn[nick]:
|
||||
irc.reply("Closing connection.")
|
||||
self.tn[nick].close()
|
||||
del self.tn[nick]
|
||||
else:
|
||||
irc.reply("No connection opened.")
|
||||
except:
|
||||
irc.reply("No connection opened.")
|
||||
stop = wrap(stop)
|
||||
|
||||
def output(self, output):
|
||||
response = []
|
||||
response = output.read_until(b"\a", timeout=2)
|
||||
clean = []
|
||||
for line in response.splitlines():
|
||||
clean.append(self.ansi_escape.sub('', line.decode()))
|
||||
return clean
|
||||
|
||||
Class = MUD
|
||||
|
18
MUD/test.py
18
MUD/test.py
|
@ -1,18 +0,0 @@
|
|||
###
|
||||
# Copyright (c) 2019, oddluck
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
|
||||
|
||||
class InfocomTestCase(PluginTestCase):
|
||||
plugins = ('MUD',)
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue