from plumeria.command import commands, CommandError
from plumeria.message.lists import build_list
from plumeria.perms import owners_only
from plumeria.transport import transports


@commands.register('accept invite', category='Discord')
@owners_only
async def accept_invite(message):
    """
    Accept an invite to join a server.

    Example::

        /accept invite https://discord.gg/00000
    """
    url = message.content.strip()
    results = []
    if not len(url):
        raise CommandError("Supply an invite URL.")
    for transport in transports.transports.values():
        if hasattr(transport, 'accept_invite'):
            try:
                await transport.accept_invite(url)
                results.append((transport.id, 'Success \N{WHITE HEAVY CHECK MARK}'))
            except Exception as e:
                results.append((transport.id, '\N{WARNING SIGN} {}'.format(str(e))))
        else:
            results.append((transport.id, "\N{WARNING SIGN} No support for invite links"))
    if len(results):
        return build_list(["**{}:** {}".format(e[0], e[1]) for e in results])
    else:
        raise CommandError("No transports available.")

from plumeria.command import commands, CommandError
from plumeria.message.lists import build_list
from plumeria.perms import owners_only
from plumeria.transport import transports


@commands.register('join', category='Discord')
@owners_only
async def join(message):
    """
    Accept an invite to join a server.

    Example::

        /join https://discord.gg/00000
    """
    url = message.content.strip()
    results = []
    if not len(url):
        raise CommandError("Supply an invite URL.")
    for transport in transports.transports.values():
        if hasattr(transport, 'accept_invite'):
            try:
                await transport.accept_invite(url)
                results.append((transport.id, 'Success \N{WHITE HEAVY CHECK MARK}'))
            except Exception as e:
                results.append((transport.id, '\N{WARNING SIGN} {}'.format(str(e))))
        else:
            results.append((transport.id, "\N{WARNING SIGN} No support for invite links"))
    if len(results):
        return build_list(["**{}:** {}".format(e[0], e[1]) for e in results])
    else:
        raise CommandError("No transports available.")

Use /join instead of /accept invite.
Use /join instead of /accept invite.

  from plumeria.command import commands, CommandError
  from plumeria.message.lists import build_list
  from plumeria.perms import owners_only
  from plumeria.transport import transports
  
  
- @commands.register('accept invite', category='Discord')
+ @commands.register('join', category='Discord')
  @owners_only
- async def accept_invite(message):
+ async def join(message):
      """
      Accept an invite to join a server.
  
      Example::
  
-         /accept invite https://discord.gg/00000
+         /join https://discord.gg/00000
      """
      url = message.content.strip()
      results = []
      if not len(url):
          raise CommandError("Supply an invite URL.")
      for transport in transports.transports.values():
          if hasattr(transport, 'accept_invite'):
              try:
                  await transport.accept_invite(url)
                  results.append((transport.id, 'Success \N{WHITE HEAVY CHECK MARK}'))
              except Exception as e:
                  results.append((transport.id, '\N{WARNING SIGN} {}'.format(str(e))))
          else:
              results.append((transport.id, "\N{WARNING SIGN} No support for invite links"))
      if len(results):
          return build_list(["**{}:** {}".format(e[0], e[1]) for e in results])
      else:
          raise CommandError("No transports available.")
  
Use /join instead of /accept invite.
## Code Before:
from plumeria.command import commands, CommandError
from plumeria.message.lists import build_list
from plumeria.perms import owners_only
from plumeria.transport import transports


@commands.register('accept invite', category='Discord')
@owners_only
async def accept_invite(message):
    """
    Accept an invite to join a server.

    Example::

        /accept invite https://discord.gg/00000
    """
    url = message.content.strip()
    results = []
    if not len(url):
        raise CommandError("Supply an invite URL.")
    for transport in transports.transports.values():
        if hasattr(transport, 'accept_invite'):
            try:
                await transport.accept_invite(url)
                results.append((transport.id, 'Success \N{WHITE HEAVY CHECK MARK}'))
            except Exception as e:
                results.append((transport.id, '\N{WARNING SIGN} {}'.format(str(e))))
        else:
            results.append((transport.id, "\N{WARNING SIGN} No support for invite links"))
    if len(results):
        return build_list(["**{}:** {}".format(e[0], e[1]) for e in results])
    else:
        raise CommandError("No transports available.")

## Instruction:
Use /join instead of /accept invite.
## Code After:
from plumeria.command import commands, CommandError
from plumeria.message.lists import build_list
from plumeria.perms import owners_only
from plumeria.transport import transports


@commands.register('join', category='Discord')
@owners_only
async def join(message):
    """
    Accept an invite to join a server.

    Example::

        /join https://discord.gg/00000
    """
    url = message.content.strip()
    results = []
    if not len(url):
        raise CommandError("Supply an invite URL.")
    for transport in transports.transports.values():
        if hasattr(transport, 'accept_invite'):
            try:
                await transport.accept_invite(url)
                results.append((transport.id, 'Success \N{WHITE HEAVY CHECK MARK}'))
            except Exception as e:
                results.append((transport.id, '\N{WARNING SIGN} {}'.format(str(e))))
        else:
            results.append((transport.id, "\N{WARNING SIGN} No support for invite links"))
    if len(results):
        return build_list(["**{}:** {}".format(e[0], e[1]) for e in results])
    else:
        raise CommandError("No transports available.")
