original_docstring: The on_message event handler for this module
  
      Args:
          message (discord.Message): Input message
      
docstring: The on_message event handler for this module
docstring_tokens: The on_message event handler for this module
code: async def on_message(message):
      """The on_message event handler for this module
  
      Args:
          message (discord.Message): Input message
      """
  
      # Simplify message info
      server = message.server
      author = message.author
      channel = message.channel
      content = message.content
  
      data = datatools.get_data()
  
      if not data["discord"]["servers"][server.id][_data.modulename]["activated"]:
          return
  
      # Only reply to server messages and don't reply to myself
      if server is not None and author != channel.server.me:
          # Commands section
          prefix = data["discord"]["servers"][server.id]["prefix"]
          if content.startswith(prefix):
              # Parse message
              package = content.split(" ")
              command = package[0][len(prefix):]
              args = package[1:]
  
              alias_steam = ["steam", "pc"]
              alias_ps = ["ps", "psn", "playstation", "ps4", "playstation 4"]
              alias_xbox = ["xbox", "xb", "xb1", "xbone", "xbox one", "xbox one"]
  
              platform = "steam"
              if len(args) > 0:
                  player_name = args[0]
              else:
                  return
  
              if len(args) > 1:
                  platform = ' '.join(args[1:]).lower()
  
              if platform in alias_steam:
                  platform = "steam"
              elif platform in alias_ps:
                  platform = "ps"
              elif platform in alias_xbox:
                  platform = "xbox"
  
              # Commands
              if command == 'rlstats':
                  await client.send_typing(channel)
  
                  # Get Rocket League stats from stats API
                  success, rldata = api_rocketleaguestats.check_rank(player_name, platform)
                  # Create embed UI
                  if success:
                      embed = ui_embed.success(channel, rldata[0], rldata[1], rldata[2], rldata[3])
                  else:
                      embed = ui_embed.fail_api(channel)
  
                  await embed.send()
code_tokens: async def on_message ( message ) : server = message . server author = message . author channel = message . channel content = message . content data = datatools . get_data ( ) if not data [ "discord" ] [ "servers" ] [ server . id ] [ _data . modulename ] [ "activated" ] : return if server is not None and author != channel . server . me : prefix = data [ "discord" ] [ "servers" ] [ server . id ] [ "prefix" ] if content . startswith ( prefix ) : package = content . split ( " " ) command = package [ 0 ] [ len ( prefix ) : ] args = package [ 1 : ] alias_steam = [ "steam" , "pc" ] alias_ps = [ "ps" , "psn" , "playstation" , "ps4" , "playstation 4" ] alias_xbox = [ "xbox" , "xb" , "xb1" , "xbone" , "xbox one" , "xbox one" ] platform = "steam" if len ( args ) > 0 : player_name = args [ 0 ] else : return if len ( args ) > 1 : platform = ' ' . join ( args [ 1 : ] ) . lower ( ) if platform in alias_steam : platform = "steam" elif platform in alias_ps : platform = "ps" elif platform in alias_xbox : platform = "xbox" if command == 'rlstats' : await client . send_typing ( channel ) success , rldata = api_rocketleaguestats . check_rank ( player_name , platform ) if success : embed = ui_embed . success ( channel , rldata [ 0 ] , rldata [ 1 ] , rldata [ 2 ] , rldata [ 3 ] ) else : embed = ui_embed . fail_api ( channel ) await embed . send ( )
short_docstring: The on_message event handler for this module
short_docstring_tokens: The on_message event handler for this module
comment: """The on_message event handler for this module
  
      Args:
          message (discord.Message): Input message
      """$SEP$# Simplify message info$SEP$# Only reply to server messages and don't reply to myself$SEP$# Commands section$SEP$# Parse message$SEP$# Commands$SEP$# Get Rocket League stats from stats API$SEP$# Create embed UI