Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
# type: () -> int
usage = """zulip-send [options] [recipient...]
Sends a message to specified recipients.
Examples: zulip-send --stream denmark --subject castle -m "Something is rotten in the state of Denmark."
zulip-send hamlet@example.com cordelia@example.com -m "Conscience doth make cowards of us all."
Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options.
"""
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
parser.add_argument('recipients',
nargs='*',
help='email addresses of the recipients of the message')
parser.add_argument('-m', '--message',
help='Specifies the message to send, prevents interactive prompting.')
group = parser.add_argument_group('Stream parameters')
group.add_argument('-s', '--stream',
dest='stream',
action='store',
help='Allows the user to specify a stream for the message.')
group.add_argument('-S', '--subject',
dest='subject',
action='store',
Example:
./irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username --stream='test' --topic='#mypy'
--stream is a Zulip stream.
--topic is a Zulip topic, is optionally specified, defaults to "IRC".
--nickserv-pw is a password for the nickserv, is optionally specified.
Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options.
Note that "_zulip" will be automatically appended to the IRC nick provided
"""
if __name__ == "__main__":
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage), allow_provisioning=True)
parser.add_argument('--irc-server', default=None)
parser.add_argument('--port', default=6667)
parser.add_argument('--nick-prefix', default=None)
parser.add_argument('--channel', default=None)
parser.add_argument('--stream', default="general")
parser.add_argument('--topic', default="IRC")
parser.add_argument('--nickserv-pw', default='')
options = parser.parse_args()
# Setting the client to irc_mirror is critical for this to work
options.client = "irc_mirror"
zulip_client = zulip.init_from_options(options)
try:
from irc_mirror_backend import IRCBot
except ImportError:
traceback.print_exc()