mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-12 18:58:00 +00:00
irc: make channels configurable on a per-actor basis
This commit is contained in:
parent
87a7789cd0
commit
5e9b2cd275
|
@ -25,10 +25,17 @@ irc:
|
|||
# channels for the bot to join
|
||||
channels:
|
||||
- '#mychannel'
|
||||
- '#myotherchannel'
|
||||
|
||||
# channels for the bot to relay AP posts to
|
||||
relay_channels:
|
||||
- '#mychannel'
|
||||
|
||||
# allow any AP actor to be relayed
|
||||
'#mychannel': []
|
||||
|
||||
# allow only one AP actor to be relayed
|
||||
'#myotherchannel':
|
||||
- 'https://example.org/~alyssa'
|
||||
|
||||
# IRC services credentials.
|
||||
sasl_username: viera
|
||||
|
|
|
@ -254,8 +254,9 @@ class IRCProtocol(asyncio.Protocol):
|
|||
if len(content) > 256:
|
||||
msgcontent += '...'
|
||||
|
||||
targets = [chan for chan, actors in IRC_CONFIG['relay_channels'].items() if not actors or actor['id'] in actors]
|
||||
message = fmt.format(name=actor['name'], content=msgcontent, url=obj['id'])
|
||||
target = ','.join(IRC_CONFIG['relay_channels'])
|
||||
target = ','.join(targets)
|
||||
|
||||
self.say(target, message)
|
||||
|
||||
|
|
Loading…
Reference in a new issue