mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-03 08:51:13 -05:00
RelayNext: merge 'unset' and 'remove' commands into 'remove'
New behavior: 'remove' without arguments removes entire relay, 'remove' with channels specified will remove those channels in question. 'unset' is dropped. Also update the README accordingly.
This commit is contained in:
parent
45879709e5
commit
78006970a5
@ -31,8 +31,17 @@ The `list` command will list all relays defined.
|
|||||||
|
|
||||||
### Removing/clearing relays
|
### Removing/clearing relays
|
||||||
|
|
||||||
The `unset` command removes a relay name, while the `clear` command clears all relays. The `remove` command removes individual channels from a relay, deleting it completely when the amount of channels is less than 2.
|
Once a relay is created, you can remove the relays (or channels within them) using the `remove` command. There is also a `clear` command which clears all relays.
|
||||||
|
|
||||||
|
To remove channels from an existing relay:
|
||||||
|
|
||||||
|
* `relaynext remove Your-relay-name #channel1@networkone #blah@networktwo`
|
||||||
|
|
||||||
|
Or, to delete an entire relay:
|
||||||
|
|
||||||
|
* `relaynext remove Your-relay-name`
|
||||||
|
|
||||||
|
Relays require at least two channels to relay between. When the last two channels are removed, the relay is automatically deleted.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
### Relaying non-PRIVMSG events
|
### Relaying non-PRIVMSG events
|
||||||
|
@ -440,21 +440,23 @@ class RelayNext(callbacks.Plugin):
|
|||||||
many('somethingWithoutSpaces')])
|
many('somethingWithoutSpaces')])
|
||||||
|
|
||||||
def remove(self, irc, msg, args, rid, relays):
|
def remove(self, irc, msg, args, rid, relays):
|
||||||
"""<id> <relays>
|
"""<id> [<relays>]
|
||||||
|
|
||||||
Removes <relays> from relay <id>. <relays> is a space separated
|
Removes <relays> from relay <id>. <relays> is a space separated
|
||||||
list of #channel@network combinations, where <network> is the name
|
list of #channel@network combinations, where <network> is the name
|
||||||
of your network. <id> is the name of your relay, which can be a
|
of your network. <id> is the name of your relay, which can be a
|
||||||
number, string, etc.
|
number, string, etc. If <relays> is not given, removes the entire
|
||||||
|
relay.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
current_relays = self.db[rid]
|
current_relays = self.db[rid]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error("No such relay '%s' exists." % rid, Raise=True)
|
irc.error("No such relay '%s' exists." % rid, Raise=True)
|
||||||
if type(relays) == list:
|
if not relays:
|
||||||
relays = list(map(str.lower, relays))
|
del self.db[rid]
|
||||||
else:
|
irc.replySuccess()
|
||||||
relays = [relays.lower()]
|
return
|
||||||
|
relays = list(map(str.lower, relays))
|
||||||
self.checkRelays(irc, relays)
|
self.checkRelays(irc, relays)
|
||||||
for relay in relays:
|
for relay in relays:
|
||||||
current_relays.discard(relay)
|
current_relays.discard(relay)
|
||||||
@ -462,20 +464,7 @@ class RelayNext(callbacks.Plugin):
|
|||||||
del self.db[rid]
|
del self.db[rid]
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
remove = wrap(remove, ['admin', 'somethingWithoutSpaces',
|
remove = wrap(remove, ['admin', 'somethingWithoutSpaces',
|
||||||
many('somethingWithoutSpaces')])
|
any('somethingWithoutSpaces')])
|
||||||
|
|
||||||
def unset(self, irc, msg, args, rid):
|
|
||||||
"""<id>
|
|
||||||
|
|
||||||
Removes relay <id>.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
del self.db[rid]
|
|
||||||
except KeyError:
|
|
||||||
irc.error("No such relay '%s' exists." % rid, Raise=True)
|
|
||||||
else:
|
|
||||||
irc.replySuccess()
|
|
||||||
unset = wrap(unset, ['admin', 'somethingWithoutSpaces'])
|
|
||||||
|
|
||||||
def list(self, irc, msg, args):
|
def list(self, irc, msg, args):
|
||||||
"""takes no arguments.
|
"""takes no arguments.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user